diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:42:31 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:42:31 +0000 |
commit | 576eb4299a00bc053db35414406f46372a0f70f2 (patch) | |
tree | 4c030922d533821db464af566188e7d40cc8848c /libkdegames/highscore | |
parent | 0718336b6017d1a4fc1d626544180a5a2a29ddec (diff) | |
download | tdegames-576eb4299a00bc053db35414406f46372a0f70f2.tar.gz tdegames-576eb4299a00bc053db35414406f46372a0f70f2.zip |
Trinity Qt initial conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdegames@1157643 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'libkdegames/highscore')
-rw-r--r-- | libkdegames/highscore/kconfigrawbackend.cpp | 4 | ||||
-rw-r--r-- | libkdegames/highscore/kconfigrawbackend.h | 4 | ||||
-rw-r--r-- | libkdegames/highscore/kexthighscore.cpp | 28 | ||||
-rw-r--r-- | libkdegames/highscore/kexthighscore.h | 18 | ||||
-rw-r--r-- | libkdegames/highscore/kexthighscore_gui.cpp | 190 | ||||
-rw-r--r-- | libkdegames/highscore/kexthighscore_gui.h | 70 | ||||
-rw-r--r-- | libkdegames/highscore/kexthighscore_internal.cpp | 176 | ||||
-rw-r--r-- | libkdegames/highscore/kexthighscore_internal.h | 104 | ||||
-rw-r--r-- | libkdegames/highscore/kexthighscore_item.cpp | 70 | ||||
-rw-r--r-- | libkdegames/highscore/kexthighscore_item.h | 62 | ||||
-rw-r--r-- | libkdegames/highscore/kexthighscore_tab.cpp | 98 | ||||
-rw-r--r-- | libkdegames/highscore/kexthighscore_tab.h | 24 | ||||
-rw-r--r-- | libkdegames/highscore/khighscore.cpp | 60 | ||||
-rw-r--r-- | libkdegames/highscore/khighscore.h | 48 | ||||
-rw-r--r-- | libkdegames/highscore/kscoredialog.cpp | 110 | ||||
-rw-r--r-- | libkdegames/highscore/kscoredialog.h | 20 |
16 files changed, 543 insertions, 543 deletions
diff --git a/libkdegames/highscore/kconfigrawbackend.cpp b/libkdegames/highscore/kconfigrawbackend.cpp index a379ba23..29ffa845 100644 --- a/libkdegames/highscore/kconfigrawbackend.cpp +++ b/libkdegames/highscore/kconfigrawbackend.cpp @@ -21,11 +21,11 @@ #include "kconfigrawbackend.moc" #include <unistd.h> -#include <qfile.h> +#include <tqfile.h> KConfigRawBackEnd::KConfigRawBackEnd(KConfigBase *_config, int fd) - : KConfigINIBackEnd(_config, QString::null, "config", false), + : KConfigINIBackEnd(_config, TQString::null, "config", false), _fd(fd), _stream(0) { _file.open(IO_ReadOnly, _fd); diff --git a/libkdegames/highscore/kconfigrawbackend.h b/libkdegames/highscore/kconfigrawbackend.h index 4b780320..0c5fde03 100644 --- a/libkdegames/highscore/kconfigrawbackend.h +++ b/libkdegames/highscore/kconfigrawbackend.h @@ -20,7 +20,7 @@ #ifndef _KCONFIGRAWBACKEND_H #define _KCONFIGRAWBACKEND_H -#include <qfile.h> +#include <tqfile.h> #include <kconfigbackend.h> #include <ksimpleconfig.h> @@ -39,7 +39,7 @@ public: private: int _fd; FILE *_stream; - QFile _file; + TQFile _file; class KConfigRawBackEndPrivate; KConfigRawBackEndPrivate *d; diff --git a/libkdegames/highscore/kexthighscore.cpp b/libkdegames/highscore/kexthighscore.cpp index 0ad9b3af..585dafd4 100644 --- a/libkdegames/highscore/kexthighscore.cpp +++ b/libkdegames/highscore/kexthighscore.cpp @@ -19,7 +19,7 @@ #include "kexthighscore.h" -#include <qlayout.h> +#include <tqlayout.h> #include <kdebug.h> @@ -44,7 +44,7 @@ void setGameType(uint type) internal->setGameType(type); } -bool configure(QWidget *parent) +bool configure(TQWidget *parent) { internal->checkFirst(); ConfigDialog *cd = new ConfigDialog(parent); @@ -54,14 +54,14 @@ bool configure(QWidget *parent) return saved; } -void show(QWidget *parent, int rank) +void show(TQWidget *parent, int rank) { HighscoresDialog *hd = new HighscoresDialog(rank, parent); hd->exec(); delete hd; } -void submitScore(const Score &score, QWidget *widget) +void submitScore(const Score &score, TQWidget *widget) { int rank = internal->submitScore(score, widget, internal->showMode!=Manager::NeverShow); @@ -81,7 +81,7 @@ void submitScore(const Score &score, QWidget *widget) } } -void show(QWidget *widget) +void show(TQWidget *widget) { internal->checkFirst(); show(widget, -1); @@ -145,7 +145,7 @@ void Manager::setShowDrawGamesStatistic(bool show) internal->showDrawGames = show; } -void Manager::setWWHighscores(const KURL &url, const QString &version) +void Manager::setWWHighscores(const KURL &url, const TQString &version) { Q_ASSERT( url.isValid() ); internal->serverURL = url; @@ -157,7 +157,7 @@ void Manager::setWWHighscores(const KURL &url, const QString &version) internal->version = version; } -void Manager::setScoreHistogram(const QMemArray<uint> &scores, +void Manager::setScoreHistogram(const TQMemArray<uint> &scores, ScoreTypeBound type) { Q_ASSERT( scores.size()>=2 ); @@ -238,7 +238,7 @@ void Manager::setScoreItem(uint worstScore, Item *item) ->item()->setDefaultValue(worstScore); } -void Manager::addScoreItem(const QString &name, Item *item) +void Manager::addScoreItem(const TQString &name, Item *item) { internal->scoreInfos().addItem(name, item, true); } @@ -247,7 +247,7 @@ void Manager::setPlayerItem(PlayerItemType type, Item *item) { const Item *scoreItem = internal->scoreInfos().item("score")->item(); uint def = scoreItem->defaultValue().toUInt(); - QString name; + TQString name; switch (type) { case MeanScore: name = "mean score"; @@ -261,7 +261,7 @@ void Manager::setPlayerItem(PlayerItemType type, Item *item) internal->playerInfos().setItem(name, item); } -QString Manager::gameTypeLabel(uint gameType, LabelType type) const +TQString Manager::gameTypeLabel(uint gameType, LabelType type) const { if ( gameType!=0 ) kdFatal(11002) << "You need to reimplement KExtHighscore::Manager for " @@ -272,15 +272,15 @@ QString Manager::gameTypeLabel(uint gameType, LabelType type) const case I18N: break; case WW: return "normal"; } - return QString::null; + return TQString::null; } -void Manager::addToQueryURL(KURL &url, const QString &item, - const QString &content) +void Manager::addToQueryURL(KURL &url, const TQString &item, + const TQString &content) { Q_ASSERT( !item.isEmpty() && url.queryItem(item).isNull() ); - QString query = url.query(); + TQString query = url.query(); if ( !query.isEmpty() ) query += '&'; query += item + '=' + KURL::encode_string(content); url.setQuery(query); diff --git a/libkdegames/highscore/kexthighscore.h b/libkdegames/highscore/kexthighscore.h index 2484f97b..6dac5ff7 100644 --- a/libkdegames/highscore/kexthighscore.h +++ b/libkdegames/highscore/kexthighscore.h @@ -51,19 +51,19 @@ KDE_EXPORT void setGameType(uint gameType); * Configure the highscores. * @return true if the configuration has been modified and saved */ -KDE_EXPORT bool configure(QWidget *parent); +KDE_EXPORT bool configure(TQWidget *parent); /** * Show the highscores lists. */ -KDE_EXPORT void show(QWidget *parent); +KDE_EXPORT void show(TQWidget *parent); /** * Submit a score. See @ref Manager for usage example. * * @param widget a widget used as parent for error message box. */ -KDE_EXPORT void submitScore(const Score &score, QWidget *widget); +KDE_EXPORT void submitScore(const Score &score, TQWidget *widget); /** * @return the last score in the local list of highscores. The worst possible @@ -160,7 +160,7 @@ class KDE_EXPORT Manager * @param version the game version which is sent to the web server (it can * be useful for backward compatibility on the server side). */ - void setWWHighscores(const KURL &url, const QString &version); + void setWWHighscores(const KURL &url, const TQString &version); /** * Set if the number of lost games should be track for the world-wide @@ -211,7 +211,7 @@ class KDE_EXPORT Manager * * Note: should be called at construction time. */ - void setScoreHistogram(const QMemArray<uint> &scores, ScoreTypeBound type); + void setScoreHistogram(const TQMemArray<uint> &scores, ScoreTypeBound type); /** * Enumerate different conditions under which to show the @@ -272,7 +272,7 @@ class KDE_EXPORT Manager * * Note : This method should be called at construction time. */ - void addScoreItem(const QString &name, Item *item); + void addScoreItem(const TQString &name, Item *item); enum PlayerItemType { MeanScore, BestScore }; /** @@ -307,7 +307,7 @@ class KDE_EXPORT Manager * implementation works only for one game type : you need to reimplement * this method if the number of game types is more than one. */ - virtual QString gameTypeLabel(uint gameType, LabelType type) const; + virtual TQString gameTypeLabel(uint gameType, LabelType type) const; protected: /** @@ -352,8 +352,8 @@ class KDE_EXPORT Manager * @param item the item name * @param content the item content */ - static void addToQueryURL(KURL &url, const QString &item, - const QString &content); + static void addToQueryURL(KURL &url, const TQString &item, + const TQString &content); friend class ManagerPrivate; diff --git a/libkdegames/highscore/kexthighscore_gui.cpp b/libkdegames/highscore/kexthighscore_gui.cpp index 547a885c..3786f529 100644 --- a/libkdegames/highscore/kexthighscore_gui.cpp +++ b/libkdegames/highscore/kexthighscore_gui.cpp @@ -20,11 +20,11 @@ #include "kexthighscore_gui.h" #include "kexthighscore_gui.moc" -#include <qlayout.h> -#include <qtextstream.h> -#include <qheader.h> -#include <qgrid.h> -#include <qvgroupbox.h> +#include <tqlayout.h> +#include <tqtextstream.h> +#include <tqheader.h> +#include <tqgrid.h> +#include <tqvgroupbox.h> #include <kapplication.h> #include <kmessagebox.h> @@ -45,23 +45,23 @@ namespace KExtHighscore { //----------------------------------------------------------------------------- -ShowItem::ShowItem(QListView *list, bool highlight) +ShowItem::ShowItem(TQListView *list, bool highlight) : KListViewItem(list), _highlight(highlight) {} -void ShowItem::paintCell(QPainter *p, const QColorGroup &cg, +void ShowItem::paintCell(TQPainter *p, const TQColorGroup &cg, int column, int width, int align) { - QColorGroup cgrp(cg); - if (_highlight) cgrp.setColor(QColorGroup::Text, red); + TQColorGroup cgrp(cg); + if (_highlight) cgrp.setColor(TQColorGroup::Text, red); KListViewItem::paintCell(p, cgrp, column, width, align); } //----------------------------------------------------------------------------- -ScoresList::ScoresList(QWidget *parent) +ScoresList::ScoresList(TQWidget *parent) : KListView(parent) { - setSelectionMode(QListView::NoSelection); + setSelectionMode(TQListView::NoSelection); setItemMargin(3); setAllColumnsShowFocus(true); setSorting(-1); @@ -74,16 +74,16 @@ void ScoresList::addHeader(const ItemArray &items) addLineItem(items, 0, 0); } -QListViewItem *ScoresList::addLine(const ItemArray &items, +TQListViewItem *ScoresList::addLine(const ItemArray &items, uint index, bool highlight) { - QListViewItem *item = new ShowItem(this, highlight); + TQListViewItem *item = new ShowItem(this, highlight); addLineItem(items, index, item); return item; } void ScoresList::addLineItem(const ItemArray &items, - uint index, QListViewItem *line) + uint index, TQListViewItem *line) { uint k = 0; for (uint i=0; i<items.size(); i++) { @@ -99,11 +99,11 @@ void ScoresList::addLineItem(const ItemArray &items, } //----------------------------------------------------------------------------- -HighscoresList::HighscoresList(QWidget *parent) +HighscoresList::HighscoresList(TQWidget *parent) : ScoresList(parent) {} -QString HighscoresList::itemText(const ItemContainer &item, uint row) const +TQString HighscoresList::itemText(const ItemContainer &item, uint row) const { return item.pretty(row); } @@ -111,26 +111,26 @@ QString HighscoresList::itemText(const ItemContainer &item, uint row) const void HighscoresList::load(const ItemArray &items, int highlight) { clear(); - QListViewItem *line = 0; + TQListViewItem *line = 0; for (int j=items.nbEntries()-1; j>=0; j--) { - QListViewItem *item = addLine(items, j, j==highlight); + TQListViewItem *item = addLine(items, j, j==highlight); if ( j==highlight ) line = item; } if (line) ensureItemVisible(line); } //----------------------------------------------------------------------------- -HighscoresWidget::HighscoresWidget(QWidget *parent) - : QWidget(parent, "show_highscores_widget"), +HighscoresWidget::HighscoresWidget(TQWidget *parent) + : TQWidget(parent, "show_highscores_widget"), _scoresUrl(0), _playersUrl(0), _statsTab(0), _histoTab(0) { const ScoreInfos &s = internal->scoreInfos(); const PlayerInfos &p = internal->playerInfos(); - QVBoxLayout *vbox = new QVBoxLayout(this, KDialogBase::spacingHint()); + TQVBoxLayout *vbox = new TQVBoxLayout(this, KDialogBase::spacingHint()); - _tw = new QTabWidget(this); - connect(_tw, SIGNAL(currentChanged(QWidget *)), SLOT(tabChanged())); + _tw = new TQTabWidget(this); + connect(_tw, TQT_SIGNAL(currentChanged(TQWidget *)), TQT_SLOT(tabChanged())); vbox->addWidget(_tw); // scores tab @@ -160,15 +160,15 @@ HighscoresWidget::HighscoresWidget(QWidget *parent) KURL url = internal->queryURL(ManagerPrivate::Scores); _scoresUrl = new KURLLabel(url.url(), i18n("View world-wide highscores"), this); - connect(_scoresUrl, SIGNAL(leftClickedURL(const QString &)), - SLOT(showURL(const QString &))); + connect(_scoresUrl, TQT_SIGNAL(leftClickedURL(const TQString &)), + TQT_SLOT(showURL(const TQString &))); vbox->addWidget(_scoresUrl); url = internal->queryURL(ManagerPrivate::Players); _playersUrl = new KURLLabel(url.url(), i18n("View world-wide players"), this); - connect(_playersUrl, SIGNAL(leftClickedURL(const QString &)), - SLOT(showURL(const QString &))); + connect(_playersUrl, TQT_SIGNAL(leftClickedURL(const TQString &)), + TQT_SLOT(showURL(const TQString &))); vbox->addWidget(_playersUrl); } } @@ -179,7 +179,7 @@ void HighscoresWidget::changeTab(int i) _tw->setCurrentPage(i); } -void HighscoresWidget::showURL(const QString &url) const +void HighscoresWidget::showURL(const TQString &url) const { (void)new KRun(KURL(url)); } @@ -197,7 +197,7 @@ void HighscoresWidget::load(int rank) } //----------------------------------------------------------------------------- -HighscoresDialog::HighscoresDialog(int rank, QWidget *parent) +HighscoresDialog::HighscoresDialog(int rank, TQWidget *parent) : KDialogBase(internal->nbGameTypes()>1 ? TreeList : Plain, i18n("Highscores"), Close|User1|User2, Close, parent, "show_highscores", true, true, @@ -208,25 +208,25 @@ HighscoresDialog::HighscoresDialog(int rank, QWidget *parent) if ( internal->nbGameTypes()>1 ) { for (uint i=0; i<internal->nbGameTypes(); i++) { - QString title = internal->manager.gameTypeLabel(i, Manager::I18N); - QString icon = internal->manager.gameTypeLabel(i, Manager::Icon); - QWidget *w = addVBoxPage(title, QString::null, + TQString title = internal->manager.gameTypeLabel(i, Manager::I18N); + TQString icon = internal->manager.gameTypeLabel(i, Manager::Icon); + TQWidget *w = addVBoxPage(title, TQString::null, BarIcon(icon, KIcon::SizeLarge)); if ( i==internal->gameType() ) createPage(w); } - connect(this, SIGNAL(aboutToShowPage(QWidget *)), - SLOT(createPage(QWidget *))); + connect(this, TQT_SIGNAL(aboutToShowPage(TQWidget *)), + TQT_SLOT(createPage(TQWidget *))); showPage(internal->gameType()); } else { - QVBoxLayout *vbox = new QVBoxLayout(plainPage()); + TQVBoxLayout *vbox = new TQVBoxLayout(plainPage()); createPage(plainPage()); vbox->addWidget(_widgets[0]); setMainWidget(_widgets[0]); } } -void HighscoresDialog::createPage(QWidget *page) +void HighscoresDialog::createPage(TQWidget *page) { internal->hsConfig().readCurrentConfig(); _current = page; @@ -234,7 +234,7 @@ void HighscoresDialog::createPage(QWidget *page) int i = (several ? pageIndex(page) : 0); if ( _widgets[i]==0 ) { _widgets[i] = new HighscoresWidget(page); - connect(_widgets[i], SIGNAL(tabChanged(int)), SLOT(tabChanged(int))); + connect(_widgets[i], TQT_SIGNAL(tabChanged(int)), TQT_SLOT(tabChanged(int))); } uint type = internal->gameType(); if (several) internal->setGameType(i); @@ -251,7 +251,7 @@ void HighscoresDialog::slotUser1() void HighscoresDialog::slotUser2() { - KURL url = KFileDialog::getSaveURL(QString::null, QString::null, this); + KURL url = KFileDialog::getSaveURL(TQString::null, TQString::null, this); if ( url.isEmpty() ) return; if ( KIO::NetAccess::exists(url, true, this) ) { KGuiItem gi = KStdGuiItem::save(); @@ -270,7 +270,7 @@ void HighscoresDialog::slotUser2() //----------------------------------------------------------------------------- LastMultipleScoresList::LastMultipleScoresList( - const QValueVector<Score> &scores, QWidget *parent) + const TQValueVector<Score> &scores, TQWidget *parent) : ScoresList(parent), _scores(scores) { const ScoreInfos &s = internal->scoreInfos(); @@ -279,7 +279,7 @@ LastMultipleScoresList::LastMultipleScoresList( } void LastMultipleScoresList::addLineItem(const ItemArray &si, - uint index, QListViewItem *line) + uint index, TQListViewItem *line) { uint k = 1; // skip "id" for (uint i=0; i<si.size()-2; i++) { @@ -294,20 +294,20 @@ void LastMultipleScoresList::addLineItem(const ItemArray &si, } } -QString LastMultipleScoresList::itemText(const ItemContainer &item, +TQString LastMultipleScoresList::itemText(const ItemContainer &item, uint row) const { - QString name = item.name(); + TQString name = item.name(); if ( name=="rank" ) - return (_scores[row].type()==Won ? i18n("Winner") : QString::null); - QVariant v = _scores[row].data(name); + return (_scores[row].type()==Won ? i18n("Winner") : TQString::null); + TQVariant v = _scores[row].data(name); if ( name=="name" ) return v.toString(); return item.item()->pretty(row, v); } //----------------------------------------------------------------------------- TotalMultipleScoresList::TotalMultipleScoresList( - const QValueVector<Score> &scores, QWidget *parent) + const TQValueVector<Score> &scores, TQWidget *parent) : ScoresList(parent), _scores(scores) { const ScoreInfos &s = internal->scoreInfos(); @@ -316,7 +316,7 @@ TotalMultipleScoresList::TotalMultipleScoresList( } void TotalMultipleScoresList::addLineItem(const ItemArray &si, - uint index, QListViewItem *line) + uint index, TQListViewItem *line) { const PlayerInfos &pi = internal->playerInfos(); uint k = 1; // skip "id" @@ -330,7 +330,7 @@ void TotalMultipleScoresList::addLineItem(const ItemArray &si, } if (line) line->setText(i, itemText(*container, index)); else { - QString label = + TQString label = (i==2 ? i18n("Won Games") : container->item()->label()); addColumn(label); setColumnAlignment(i, container->item()->alignment()); @@ -338,90 +338,90 @@ void TotalMultipleScoresList::addLineItem(const ItemArray &si, } } -QString TotalMultipleScoresList::itemText(const ItemContainer &item, +TQString TotalMultipleScoresList::itemText(const ItemContainer &item, uint row) const { - QString name = item.name(); - if ( name=="rank" ) return QString::number(_scores.size()-row); + TQString name = item.name(); + if ( name=="rank" ) return TQString::number(_scores.size()-row); if ( name=="nb games" ) - return QString::number( _scores[row].data("nb won games").toUInt() ); - QVariant v = _scores[row].data(name); + return TQString::number( _scores[row].data("nb won games").toUInt() ); + TQVariant v = _scores[row].data(name); if ( name=="name" ) return v.toString(); return item.item()->pretty(row, v); } //----------------------------------------------------------------------------- -ConfigDialog::ConfigDialog(QWidget *parent) +ConfigDialog::ConfigDialog(TQWidget *parent) : KDialogBase(Swallow, i18n("Configure Highscores"), Ok|Apply|Cancel, Cancel, parent, "configure_highscores", true, true), _saved(false), _WWHEnabled(0) { - QWidget *page = 0; - QTabWidget *tab = 0; + TQWidget *page = 0; + TQTabWidget *tab = 0; if ( internal->isWWHSAvailable() ) { - tab = new QTabWidget(this); + tab = new TQTabWidget(this); setMainWidget(tab); - page = new QWidget(tab); + page = new TQWidget(tab); tab->addTab(page, i18n("Main")); } else { - page = new QWidget(this); + page = new TQWidget(this); setMainWidget(page); } - QGridLayout *pageTop = - new QGridLayout(page, 2, 2, spacingHint(), spacingHint()); + TQGridLayout *pageTop = + new TQGridLayout(page, 2, 2, spacingHint(), spacingHint()); - QLabel *label = new QLabel(i18n("Nickname:"), page); + TQLabel *label = new TQLabel(i18n("Nickname:"), page); pageTop->addWidget(label, 0, 0); - _nickname = new QLineEdit(page); - connect(_nickname, SIGNAL(textChanged(const QString &)), - SLOT(modifiedSlot())); - connect(_nickname, SIGNAL(textChanged(const QString &)), - SLOT(nickNameChanged(const QString &))); + _nickname = new TQLineEdit(page); + connect(_nickname, TQT_SIGNAL(textChanged(const TQString &)), + TQT_SLOT(modifiedSlot())); + connect(_nickname, TQT_SIGNAL(textChanged(const TQString &)), + TQT_SLOT(nickNameChanged(const TQString &))); _nickname->setMaxLength(16); pageTop->addWidget(_nickname, 0, 1); - label = new QLabel(i18n("Comment:"), page); + label = new TQLabel(i18n("Comment:"), page); pageTop->addWidget(label, 1, 0); - _comment = new QLineEdit(page); - connect(_comment, SIGNAL(textChanged(const QString &)), - SLOT(modifiedSlot())); + _comment = new TQLineEdit(page); + connect(_comment, TQT_SIGNAL(textChanged(const TQString &)), + TQT_SLOT(modifiedSlot())); _comment->setMaxLength(50); pageTop->addWidget(_comment, 1, 1); if (tab) { _WWHEnabled - = new QCheckBox(i18n("World-wide highscores enabled"), page); - connect(_WWHEnabled, SIGNAL(toggled(bool)), - SLOT(modifiedSlot())); + = new TQCheckBox(i18n("World-wide highscores enabled"), page); + connect(_WWHEnabled, TQT_SIGNAL(toggled(bool)), + TQT_SLOT(modifiedSlot())); pageTop->addMultiCellWidget(_WWHEnabled, 2, 2, 0, 1); // advanced tab - QWidget *page = new QWidget(tab); + TQWidget *page = new TQWidget(tab); tab->addTab(page, i18n("Advanced")); - QVBoxLayout *pageTop = - new QVBoxLayout(page, spacingHint(), spacingHint()); + TQVBoxLayout *pageTop = + new TQVBoxLayout(page, spacingHint(), spacingHint()); - QVGroupBox *group = new QVGroupBox(i18n("Registration Data"), page); + TQVGroupBox *group = new TQVGroupBox(i18n("Registration Data"), page); pageTop->addWidget(group); - QGrid *grid = new QGrid(2, group); + TQGrid *grid = new TQGrid(2, group); grid->setSpacing(spacingHint()); - label = new QLabel(i18n("Nickname:"), grid); + label = new TQLabel(i18n("Nickname:"), grid); _registeredName = new KLineEdit(grid); _registeredName->setReadOnly(true); - label = new QLabel(i18n("Key:"), grid); + label = new TQLabel(i18n("Key:"), grid); _key = new KLineEdit(grid); _key->setReadOnly(true); KGuiItem gi = KStdGuiItem::clear(); gi.setText(i18n("Remove")); _removeButton = new KPushButton(gi, grid); - connect(_removeButton, SIGNAL(clicked()), SLOT(removeSlot())); + connect(_removeButton, TQT_SIGNAL(clicked()), TQT_SLOT(removeSlot())); } load(); @@ -429,7 +429,7 @@ ConfigDialog::ConfigDialog(QWidget *parent) enableButtonApply(false); } -void ConfigDialog::nickNameChanged(const QString &text) +void ConfigDialog::nickNameChanged(const TQString &text) { enableButtonOK( !text.isEmpty() ); } @@ -456,7 +456,7 @@ void ConfigDialog::removeSlot() i18n("This will permanently remove your " "registration key. You will not be able to use " "the currently registered nickname anymore."), - QString::null, gi); + TQString::null, gi); if ( res==KMessageBox::Continue ) { internal->playerInfos().removeKey(); _registeredName->clear(); @@ -471,7 +471,7 @@ void ConfigDialog::load() { internal->hsConfig().readCurrentConfig(); const PlayerInfos &infos = internal->playerInfos(); - _nickname->setText(infos.isAnonymous() ? QString::null : infos.name()); + _nickname->setText(infos.isAnonymous() ? TQString::null : infos.name()); _comment->setText(infos.comment()); if (_WWHEnabled) { _WWHEnabled->setChecked(infos.isWWEnabled()); @@ -491,7 +491,7 @@ bool ConfigDialog::save() // do not bother the user with "nickname empty" if he has not // messed with nickname settings ... - QString newName = _nickname->text(); + TQString newName = _nickname->text(); if ( newName.isEmpty() && !internal->playerInfos().isAnonymous() && !enabled ) return true; @@ -516,28 +516,28 @@ bool ConfigDialog::save() } //----------------------------------------------------------------------------- -AskNameDialog::AskNameDialog(QWidget *parent) +AskNameDialog::AskNameDialog(TQWidget *parent) : KDialogBase(Plain, i18n("Enter Your Nickname"), Ok | Cancel, Ok, parent, "ask_name_dialog") { internal->hsConfig().readCurrentConfig(); - QVBoxLayout *top = - new QVBoxLayout(plainPage(), marginHint(), spacingHint()); - QLabel *label = - new QLabel(i18n("Congratulations, you have won!"), plainPage()); + TQVBoxLayout *top = + new TQVBoxLayout(plainPage(), marginHint(), spacingHint()); + TQLabel *label = + new TQLabel(i18n("Congratulations, you have won!"), plainPage()); top->addWidget(label); - QHBoxLayout *hbox = new QHBoxLayout(top); - label = new QLabel(i18n("Enter your nickname:"), plainPage()); + TQHBoxLayout *hbox = new TQHBoxLayout(top); + label = new TQLabel(i18n("Enter your nickname:"), plainPage()); hbox->addWidget(label); - _edit = new QLineEdit(plainPage()); + _edit = new TQLineEdit(plainPage()); _edit->setFocus(); - connect(_edit, SIGNAL(textChanged(const QString &)), SLOT(nameChanged())); + connect(_edit, TQT_SIGNAL(textChanged(const TQString &)), TQT_SLOT(nameChanged())); hbox->addWidget(_edit); top->addSpacing(spacingHint()); - _checkbox = new QCheckBox(i18n("Do not ask again."), plainPage()); + _checkbox = new TQCheckBox(i18n("Do not ask again."), plainPage()); top->addWidget(_checkbox); nameChanged(); diff --git a/libkdegames/highscore/kexthighscore_gui.h b/libkdegames/highscore/kexthighscore_gui.h index e721299a..2a142856 100644 --- a/libkdegames/highscore/kexthighscore_gui.h +++ b/libkdegames/highscore/kexthighscore_gui.h @@ -20,10 +20,10 @@ #ifndef KEXTHIGHSCORE_GUI_H #define KEXTHIGHSCORE_GUI_H -#include <qcheckbox.h> -#include <qlabel.h> -#include <qvbox.h> -#include <qtabwidget.h> +#include <tqcheckbox.h> +#include <tqlabel.h> +#include <tqvbox.h> +#include <tqtabwidget.h> #include <klistview.h> #include <klineedit.h> @@ -45,10 +45,10 @@ class AdditionalTab; class ShowItem : public KListViewItem { public: - ShowItem(QListView *, bool highlight); + ShowItem(TQListView *, bool highlight); protected: - virtual void paintCell(QPainter *, const QColorGroup &, int column, + virtual void paintCell(TQPainter *, const TQColorGroup &, int column, int width, int align); private: @@ -59,17 +59,17 @@ class ScoresList : public KListView { Q_OBJECT public: - ScoresList(QWidget *parent); + ScoresList(TQWidget *parent); void addHeader(const ItemArray &); protected: - QListViewItem *addLine(const ItemArray &, uint index, bool highlight); - virtual QString itemText(const ItemContainer &, uint row) const = 0; + TQListViewItem *addLine(const ItemArray &, uint index, bool highlight); + virtual TQString itemText(const ItemContainer &, uint row) const = 0; private: virtual void addLineItem(const ItemArray &, uint index, - QListViewItem *item); + TQListViewItem *item); }; //----------------------------------------------------------------------------- @@ -77,19 +77,19 @@ class HighscoresList : public ScoresList { Q_OBJECT public: - HighscoresList(QWidget *parent); + HighscoresList(TQWidget *parent); void load(const ItemArray &, int highlight); protected: - QString itemText(const ItemContainer &, uint row) const; + TQString itemText(const ItemContainer &, uint row) const; }; class HighscoresWidget : public QWidget { Q_OBJECT public: - HighscoresWidget(QWidget *parent); + HighscoresWidget(TQWidget *parent); void load(int rank); @@ -100,11 +100,11 @@ class HighscoresWidget : public QWidget void changeTab(int i); private slots: - void showURL(const QString &) const; + void showURL(const TQString &) const; void tabChanged() { emit tabChanged(_tw->currentPageIndex()); } private: - QTabWidget *_tw; + TQTabWidget *_tw; HighscoresList *_scoresList, *_playersList; KURLLabel *_scoresUrl, *_playersUrl; AdditionalTab *_statsTab, *_histoTab; @@ -114,18 +114,18 @@ class HighscoresDialog : public KDialogBase { Q_OBJECT public: - HighscoresDialog(int rank, QWidget *parent); + HighscoresDialog(int rank, TQWidget *parent); private slots: void slotUser1(); void slotUser2(); void tabChanged(int i) { _tab = i; } - void createPage(QWidget *); + void createPage(TQWidget *); private: int _rank, _tab; - QWidget *_current; - QValueVector<HighscoresWidget *> _widgets; + TQWidget *_current; + TQValueVector<HighscoresWidget *> _widgets; }; //----------------------------------------------------------------------------- @@ -133,28 +133,28 @@ class LastMultipleScoresList : public ScoresList { Q_OBJECT public: - LastMultipleScoresList(const QValueVector<Score> &, QWidget *parent); + LastMultipleScoresList(const TQValueVector<Score> &, TQWidget *parent); private: - void addLineItem(const ItemArray &, uint index, QListViewItem *line); - QString itemText(const ItemContainer &, uint row) const; + void addLineItem(const ItemArray &, uint index, TQListViewItem *line); + TQString itemText(const ItemContainer &, uint row) const; private: - const QValueVector<Score> &_scores; + const TQValueVector<Score> &_scores; }; class TotalMultipleScoresList : public ScoresList { Q_OBJECT public: - TotalMultipleScoresList(const QValueVector<Score> &, QWidget *parent); + TotalMultipleScoresList(const TQValueVector<Score> &, TQWidget *parent); private: - void addLineItem(const ItemArray &, uint index, QListViewItem *line); - QString itemText(const ItemContainer &, uint row) const; + void addLineItem(const ItemArray &, uint index, TQListViewItem *line); + TQString itemText(const ItemContainer &, uint row) const; private: - const QValueVector<Score> &_scores; + const TQValueVector<Score> &_scores; }; //----------------------------------------------------------------------------- @@ -162,7 +162,7 @@ class ConfigDialog : public KDialogBase { Q_OBJECT public: - ConfigDialog(QWidget *parent); + ConfigDialog(TQWidget *parent); bool hasBeenSaved() const { return _saved; } @@ -171,12 +171,12 @@ class ConfigDialog : public KDialogBase void removeSlot(); void accept(); void slotApply() { save(); } - void nickNameChanged(const QString &); + void nickNameChanged(const TQString &); private: bool _saved; - QCheckBox *_WWHEnabled; - QLineEdit *_nickname, *_comment; + TQCheckBox *_WWHEnabled; + TQLineEdit *_nickname, *_comment; KLineEdit *_key, *_registeredName; KPushButton *_removeButton; @@ -189,17 +189,17 @@ class AskNameDialog : public KDialogBase { Q_OBJECT public: - AskNameDialog(QWidget *parent); + AskNameDialog(TQWidget *parent); - QString name() const { return _edit->text(); } + TQString name() const { return _edit->text(); } bool dontAskAgain() const { return _checkbox->isChecked(); } private slots: void nameChanged(); private: - QLineEdit *_edit; - QCheckBox *_checkbox; + TQLineEdit *_edit; + TQCheckBox *_checkbox; }; } // namespace diff --git a/libkdegames/highscore/kexthighscore_internal.cpp b/libkdegames/highscore/kexthighscore_internal.cpp index a8395753..3c73c3aa 100644 --- a/libkdegames/highscore/kexthighscore_internal.cpp +++ b/libkdegames/highscore/kexthighscore_internal.cpp @@ -23,9 +23,9 @@ #include <sys/types.h> #include <unistd.h> -#include <qfile.h> -#include <qlayout.h> -#include <qdom.h> +#include <tqfile.h> +#include <tqlayout.h> +#include <tqdom.h> #include <kglobal.h> #include <kio/netaccess.h> @@ -62,17 +62,17 @@ void ItemContainer::setItem(Item *item) _item = item; } -QString ItemContainer::entryName() const +TQString ItemContainer::entryName() const { if ( _subGroup.isEmpty() ) return _name; return _name + "_" + _subGroup; } -QVariant ItemContainer::read(uint i) const +TQVariant ItemContainer::read(uint i) const { Q_ASSERT(_item); - QVariant v = _item->defaultValue(); + TQVariant v = _item->defaultValue(); if ( isStored() ) { internal->hsConfig().setHighscoreGroup(_group); v = internal->hsConfig().readPropertyEntry(i+1, entryName(), v); @@ -80,13 +80,13 @@ QVariant ItemContainer::read(uint i) const return _item->read(i, v); } -QString ItemContainer::pretty(uint i) const +TQString ItemContainer::pretty(uint i) const { Q_ASSERT(_item); return _item->pretty(i, read(i)); } -void ItemContainer::write(uint i, const QVariant &value) const +void ItemContainer::write(uint i, const TQVariant &value) const { Q_ASSERT( isStored() ); Q_ASSERT( internal->hsConfig().isLocked() ); @@ -111,14 +111,14 @@ ItemArray::~ItemArray() for (uint i=0; i<size(); i++) delete at(i); } -int ItemArray::findIndex(const QString &name) const +int ItemArray::findIndex(const TQString &name) const { for (uint i=0; i<size(); i++) if ( at(i)->name()==name ) return i; return -1; } -const ItemContainer *ItemArray::item(const QString &name) const +const ItemContainer *ItemArray::item(const TQString &name) const { int i = findIndex(name); if ( i==-1 ) kdError(11002) << k_funcinfo << "no item named \"" << name @@ -126,7 +126,7 @@ const ItemContainer *ItemArray::item(const QString &name) const return at(i); } -ItemContainer *ItemArray::item(const QString &name) +ItemContainer *ItemArray::item(const TQString &name) { int i = findIndex(name); if ( i==-1 ) kdError(11002) << k_funcinfo << "no item named \"" << name @@ -134,7 +134,7 @@ ItemContainer *ItemArray::item(const QString &name) return at(i); } -void ItemArray::setItem(const QString &name, Item *item) +void ItemArray::setItem(const TQString &name, Item *item) { int i = findIndex(name); if ( i==-1 ) kdError(11002) << k_funcinfo << "no item named \"" << name @@ -144,7 +144,7 @@ void ItemArray::setItem(const QString &name, Item *item) _setItem(i, name, item, stored, canHaveSubGroup); } -void ItemArray::addItem(const QString &name, Item *item, +void ItemArray::addItem(const TQString &name, Item *item, bool stored, bool canHaveSubGroup) { if ( findIndex(name)!=-1 ) @@ -155,16 +155,16 @@ void ItemArray::addItem(const QString &name, Item *item, _setItem(i, name, item, stored, canHaveSubGroup); } -void ItemArray::_setItem(uint i, const QString &name, Item *item, +void ItemArray::_setItem(uint i, const TQString &name, Item *item, bool stored, bool canHaveSubGroup) { at(i)->setItem(item); at(i)->setName(name); - at(i)->setGroup(stored ? _group : QString::null); - at(i)->setSubGroup(canHaveSubGroup ? _subGroup : QString::null); + at(i)->setGroup(stored ? _group : TQString::null); + at(i)->setSubGroup(canHaveSubGroup ? _subGroup : TQString::null); } -void ItemArray::setGroup(const QString &group) +void ItemArray::setGroup(const TQString &group) { Q_ASSERT( !group.isNull() ); _group = group; @@ -172,7 +172,7 @@ void ItemArray::setGroup(const QString &group) if ( at(i)->isStored() ) at(i)->setGroup(group); } -void ItemArray::setSubGroup(const QString &subGroup) +void ItemArray::setSubGroup(const TQString &subGroup) { Q_ASSERT( !subGroup.isNull() ); _subGroup = subGroup; @@ -197,7 +197,7 @@ void ItemArray::write(uint k, const Score &data, uint nb) const } } -void ItemArray::exportToText(QTextStream &s) const +void ItemArray::exportToText(TQTextStream &s) const { for (uint k=0; k<nbEntries()+1; k++) { for (uint i=0; i<size(); i++) { @@ -219,7 +219,7 @@ class ScoreNameItem : public NameItem ScoreNameItem(const ScoreInfos &score, const PlayerInfos &infos) : _score(score), _infos(infos) {} - QString pretty(uint i, const QVariant &v) const { + TQString pretty(uint i, const TQVariant &v) const { uint id = _score.item("id")->read(i).toUInt(); if ( id==0 ) return NameItem::pretty(i, v); return _infos.prettyName(id-1); @@ -269,7 +269,7 @@ PlayerInfos::PlayerInfos() it = Manager::createItem(Manager::BestScoreDefault); addItem("best score", it, true, true); addItem("date", new DateItem, true, true); - it = new Item(QString::null, i18n("Comment"), Qt::AlignLeft); + it = new Item(TQString::null, i18n("Comment"), Qt::AlignLeft); addItem("comment", it); // statistics items @@ -281,7 +281,7 @@ PlayerInfos::PlayerInfos() addItem("max won trend", new Item((uint)0), true, true); struct passwd *pwd = getpwuid(getuid()); - QString username = pwd->pw_name; + TQString username = pwd->pw_name; #ifdef HIGHSCORE_DIRECTORY internal->hsConfig().setHighscoreGroup("players"); for (uint i=0; ;i++) { @@ -300,9 +300,9 @@ PlayerInfos::PlayerInfos() internal->hsConfig().lockForWriting(); KEMailSettings emailConfig; emailConfig.setProfile(emailConfig.defaultProfileName()); - QString name = emailConfig.getSetting(KEMailSettings::RealName); + TQString name = emailConfig.getSetting(KEMailSettings::RealName); if ( name.isEmpty() || isNameUsed(name) ) name = username; - if ( isNameUsed(name) ) name= QString(ItemContainer::ANONYMOUS); + if ( isNameUsed(name) ) name= TQString(ItemContainer::ANONYMOUS); #ifdef HIGHSCORE_DIRECTORY internal->hsConfig().writeEntry(_id+1, "username", username); item("name")->write(_id, name); @@ -314,14 +314,14 @@ PlayerInfos::PlayerInfos() #ifdef HIGHSCORE_DIRECTORY if (_oldLocalPlayer) { // player already exists in local config file // copy player data - QString prefix = QString("%1_").arg(_oldLocalId+1); - QMap<QString, QString> entries = + TQString prefix = TQString("%1_").arg(_oldLocalId+1); + TQMap<TQString, TQString> entries = cg.config()->entryMap("KHighscore_players"); - QMap<QString, QString>::const_iterator it; + TQMap<TQString, TQString>::const_iterator it; for (it=entries.begin(); it!=entries.end(); ++it) { - QString key = it.key(); + TQString key = it.key(); if ( key.find(prefix)==0 ) { - QString name = key.right(key.length()-prefix.length()); + TQString name = key.right(key.length()-prefix.length()); if ( name!="name" || !isNameUsed(it.data()) ) internal->hsConfig().writeEntry(_id+1, name, it.data()); } @@ -340,7 +340,7 @@ PlayerInfos::PlayerInfos() internal->hsConfig().writeAndUnlock(); } -void PlayerInfos::createHistoItems(const QMemArray<uint> &scores, bool bound) +void PlayerInfos::createHistoItems(const TQMemArray<uint> &scores, bool bound) { Q_ASSERT( _histogram.size()==0 ); _bound = bound; @@ -357,14 +357,14 @@ bool PlayerInfos::isAnonymous() const uint PlayerInfos::nbEntries() const { internal->hsConfig().setHighscoreGroup("players"); - QStringList list = internal->hsConfig().readList("name", -1); + TQStringList list = internal->hsConfig().readList("name", -1); return list.count(); } -QString PlayerInfos::key() const +TQString PlayerInfos::key() const { ConfigGroup cg; - return cg.config()->readEntry(HS_KEY, QString::null); + return cg.config()->readEntry(HS_KEY, TQString::null); } bool PlayerInfos::isWWEnabled() const @@ -373,13 +373,13 @@ bool PlayerInfos::isWWEnabled() const return cg.config()->readBoolEntry(HS_WW_ENABLED, false); } -QString PlayerInfos::histoName(uint i) const +TQString PlayerInfos::histoName(uint i) const { - const QMemArray<uint> &sh = _histogram; + const TQMemArray<uint> &sh = _histogram; Q_ASSERT( i<sh.size() || (_bound || i==sh.size()) ); if ( i==sh.size() ) - return QString("nb scores greater than %1").arg(sh[sh.size()-1]); - return QString("nb scores less than %1").arg(sh[i]); + return TQString("nb scores greater than %1").arg(sh[sh.size()-1]); + return TQString("nb scores less than %1").arg(sh[i]); } uint PlayerInfos::histoSize() const @@ -446,7 +446,7 @@ void PlayerInfos::submitScore(const Score &score) const // update histogram if ( score.type()==Won ) { - const QMemArray<uint> &sh = _histogram; + const TQMemArray<uint> &sh = _histogram; for (uint i=1; i<histoSize(); i++) if ( i==sh.size() || score.score()<sh[i] ) { item(histoName(i))->increment(_id); @@ -455,7 +455,7 @@ void PlayerInfos::submitScore(const Score &score) const } } -bool PlayerInfos::isNameUsed(const QString &newName) const +bool PlayerInfos::isNameUsed(const TQString &newName) const { if ( newName==name() ) return false; // own name... for (uint i=0; i<nbEntries(); i++) @@ -464,14 +464,14 @@ bool PlayerInfos::isNameUsed(const QString &newName) const return false; } -void PlayerInfos::modifyName(const QString &newName) const +void PlayerInfos::modifyName(const TQString &newName) const { item("name")->write(_id, newName); } -void PlayerInfos::modifySettings(const QString &newName, - const QString &comment, bool WWEnabled, - const QString &newKey) const +void PlayerInfos::modifySettings(const TQString &newName, + const TQString &comment, bool WWEnabled, + const TQString &newKey) const { modifyName(newName); item("comment")->write(_id, comment); @@ -481,10 +481,10 @@ void PlayerInfos::modifySettings(const QString &newName, if (WWEnabled) cg.config()->writeEntry(HS_REGISTERED_NAME, newName); } -QString PlayerInfos::registeredName() const +TQString PlayerInfos::registeredName() const { ConfigGroup cg; - return cg.config()->readEntry(HS_REGISTERED_NAME, QString::null); + return cg.config()->readEntry(HS_REGISTERED_NAME, TQString::null); } void PlayerInfos::removeKey() @@ -493,12 +493,12 @@ void PlayerInfos::removeKey() // save old key/nickname uint i = 0; - QString str = "%1 old #%2"; - QString sk; + TQString str = "%1 old #%2"; + TQString sk; do { i++; sk = str.arg(HS_KEY).arg(i); - } while ( !cg.config()->readEntry(sk, QString::null).isEmpty() ); + } while ( !cg.config()->readEntry(sk, TQString::null).isEmpty() ); cg.config()->writeEntry(sk, key()); cg.config()->writeEntry(str.arg(HS_REGISTERED_NAME).arg(i), registeredName()); @@ -531,11 +531,11 @@ ManagerPrivate::~ManagerPrivate() delete _hsConfig; } -KURL ManagerPrivate::queryURL(QueryType type, const QString &newName) const +KURL ManagerPrivate::queryURL(QueryType type, const TQString &newName) const { KURL url = serverURL; - QString nameItem = "nickname"; - QString name = _playerInfos->registeredName(); + TQString nameItem = "nickname"; + TQString name = _playerInfos->registeredName(); bool withVersion = true; bool key = false; bool level = false; @@ -572,7 +572,7 @@ KURL ManagerPrivate::queryURL(QueryType type, const QString &newName) const if ( !name.isEmpty() ) Manager::addToQueryURL(url, nameItem, name); if (key) Manager::addToQueryURL(url, "key", _playerInfos->key()); if (level) { - QString label = manager.gameTypeLabel(_gameType, Manager::WW); + TQString label = manager.gameTypeLabel(_gameType, Manager::WW); if ( !label.isEmpty() ) Manager::addToQueryURL(url, "level", label); } @@ -602,61 +602,61 @@ const char *DUMMY_STRINGS[] = { const char *UNABLE_TO_CONTACT = I18N_NOOP("Unable to contact world-wide highscore server"); -bool ManagerPrivate::doQuery(const KURL &url, QWidget *parent, - QDomNamedNodeMap *map) +bool ManagerPrivate::doQuery(const KURL &url, TQWidget *parent, + TQDomNamedNodeMap *map) { KIO::http_update_cache(url, true, 0); // remove cache ! - QString tmpFile; + TQString tmpFile; if ( !KIO::NetAccess::download(url, tmpFile, parent) ) { - QString details = i18n("Server URL: %1").arg(url.host()); + TQString details = i18n("Server URL: %1").arg(url.host()); KMessageBox::detailedSorry(parent, i18n(UNABLE_TO_CONTACT), details); return false; } - QFile file(tmpFile); + TQFile file(tmpFile); if ( !file.open(IO_ReadOnly) ) { KIO::NetAccess::removeTempFile(tmpFile); - QString details = i18n("Unable to open temporary file."); + TQString details = i18n("Unable to open temporary file."); KMessageBox::detailedSorry(parent, i18n(UNABLE_TO_CONTACT), details); return false; } - QTextStream t(&file); - QString content = t.read().stripWhiteSpace(); + TQTextStream t(&file); + TQString content = t.read().stripWhiteSpace(); file.close(); KIO::NetAccess::removeTempFile(tmpFile); - QDomDocument doc; + TQDomDocument doc; if ( doc.setContent(content) ) { - QDomElement root = doc.documentElement(); - QDomElement element = root.firstChild().toElement(); + TQDomElement root = doc.documentElement(); + TQDomElement element = root.firstChild().toElement(); if ( element.tagName()=="success" ) { if (map) *map = element.attributes(); return true; } if ( element.tagName()=="error" ) { - QDomAttr attr = element.attributes().namedItem("label").toAttr(); + TQDomAttr attr = element.attributes().namedItem("label").toAttr(); if ( !attr.isNull() ) { - QString msg = i18n(attr.value().latin1()); - QString caption = i18n("Message from world-wide highscores " + TQString msg = i18n(attr.value().latin1()); + TQString caption = i18n("Message from world-wide highscores " "server"); KMessageBox::sorry(parent, msg, caption); return false; } } } - QString msg = i18n("Invalid answer from world-wide highscores server."); - QString details = i18n("Raw message: %1").arg(content); + TQString msg = i18n("Invalid answer from world-wide highscores server."); + TQString details = i18n("Raw message: %1").arg(content); KMessageBox::detailedSorry(parent, msg, details); return false; } -bool ManagerPrivate::getFromQuery(const QDomNamedNodeMap &map, - const QString &name, QString &value, - QWidget *parent) +bool ManagerPrivate::getFromQuery(const TQDomNamedNodeMap &map, + const TQString &name, TQString &value, + TQWidget *parent) { - QDomAttr attr = map.namedItem(name).toAttr(); + TQDomAttr attr = map.namedItem(name).toAttr(); if ( attr.isNull() ) { KMessageBox::sorry(parent, i18n("Invalid answer from world-wide " @@ -683,11 +683,11 @@ int ManagerPrivate::rank(const Score &score) const return (i<_scoreInfos->maxNbEntries() ? (int)i : -1); } -bool ManagerPrivate::modifySettings(const QString &newName, - const QString &comment, bool WWEnabled, - QWidget *widget) +bool ManagerPrivate::modifySettings(const TQString &newName, + const TQString &comment, bool WWEnabled, + TQWidget *widget) { - QString newKey; + TQString newKey; bool newPlayer = false; if (WWEnabled) { @@ -696,7 +696,7 @@ bool ManagerPrivate::modifySettings(const QString &newName, KURL url = queryURL((newPlayer ? Register : Change), newName); Manager::addToQueryURL(url, "comment", comment); - QDomNamedNodeMap map; + TQDomNamedNodeMap map; bool ok = doQuery(url, widget, &map); if ( !ok || (newPlayer && !getFromQuery(map, "key", newKey, widget)) ) return false; @@ -720,7 +720,7 @@ void ManagerPrivate::convertToGlobal() // read old highscores KHighscore *tmp = _hsConfig; _hsConfig = new KHighscore(true, 0); - QValueVector<Score> scores(_scoreInfos->nbEntries()); + TQValueVector<Score> scores(_scoreInfos->nbEntries()); for (uint i=0; i<scores.count(); i++) scores[i] = readScore(i); @@ -759,8 +759,8 @@ void ManagerPrivate::setGameType(uint type) Q_ASSERT( type<_nbGameTypes ); _gameType = kMin(type, _nbGameTypes-1); - QString str = "scores"; - QString lab = manager.gameTypeLabel(_gameType, Manager::Standard); + TQString str = "scores"; + TQString lab = manager.gameTypeLabel(_gameType, Manager::Standard); if ( !lab.isEmpty() ) { _playerInfos->setSubGroup(lab); str += "_" + lab; @@ -774,22 +774,22 @@ void ManagerPrivate::checkFirst() } int ManagerPrivate::submitScore(const Score &ascore, - QWidget *widget, bool askIfAnonymous) + TQWidget *widget, bool askIfAnonymous) { checkFirst(); Score score = ascore; score.setData("id", _playerInfos->id() + 1); - score.setData("date", QDateTime::currentDateTime()); + score.setData("date", TQDateTime::currentDateTime()); // ask new name if anonymous and winner const char *dontAskAgainName = "highscore_ask_name_dialog"; - QString newName; + TQString newName; KMessageBox::ButtonCode dummy; if ( score.type()==Won && askIfAnonymous && _playerInfos->isAnonymous() && KMessageBox::shouldBeShownYesNo(dontAskAgainName, dummy) ) { AskNameDialog d(widget); - if ( d.exec()==QDialog::Accepted ) newName = d.name(); + if ( d.exec()==TQDialog::Accepted ) newName = d.name(); if ( d.dontAskAgain() ) KMessageBox::saveDontShowAgainYesNo(dontAskAgainName, KMessageBox::No); @@ -825,7 +825,7 @@ int ManagerPrivate::submitLocal(const Score &score) } bool ManagerPrivate::submitWorldWide(const Score &score, - QWidget *widget) const + TQWidget *widget) const { if ( score.type()==Lost && !trackLostGames ) return true; if ( score.type()==Draw && !trackDrawGames ) return true; @@ -833,15 +833,15 @@ bool ManagerPrivate::submitWorldWide(const Score &score, KURL url = queryURL(Submit); manager.additionalQueryItems(url, score); int s = (score.type()==Won ? score.score() : (int)score.type()); - QString str = QString::number(s); + TQString str = TQString::number(s); Manager::addToQueryURL(url, "score", str); - KMD5 context(QString(_playerInfos->registeredName() + str).latin1()); + KMD5 context(TQString(_playerInfos->registeredName() + str).latin1()); Manager::addToQueryURL(url, "check", context.hexDigest()); return doQuery(url, widget); } -void ManagerPrivate::exportHighscores(QTextStream &s) +void ManagerPrivate::exportHighscores(TQTextStream &s) { uint tmp = _gameType; diff --git a/libkdegames/highscore/kexthighscore_internal.h b/libkdegames/highscore/kexthighscore_internal.h index 3b206877..639c059b 100644 --- a/libkdegames/highscore/kexthighscore_internal.h +++ b/libkdegames/highscore/kexthighscore_internal.h @@ -48,16 +48,16 @@ class RankItem : public Item RankItem() : Item((uint)0, i18n("Rank"), Qt::AlignRight) {} - QVariant read(uint rank, const QVariant &) const { return rank; } - QString pretty(uint rank, const QVariant &) const - { return QString::number(rank+1); } + TQVariant read(uint rank, const TQVariant &) const { return rank; } + TQString pretty(uint rank, const TQVariant &) const + { return TQString::number(rank+1); } }; class NameItem : public Item { public: NameItem() - : Item(QString::null, i18n("Name"), Qt::AlignLeft) { + : Item(TQString::null, i18n("Name"), Qt::AlignLeft) { setPrettySpecial(Anonymous); } }; @@ -66,7 +66,7 @@ class DateItem : public Item { public: DateItem() - : Item(QDateTime(), i18n("Date"), Qt::AlignRight) { + : Item(TQDateTime(), i18n("Date"), Qt::AlignRight) { setPrettyFormat(DateTime); } }; @@ -92,29 +92,29 @@ class ItemContainer const Item *item() const { return _item; } Item *item() { return _item; } - void setName(const QString &name) { _name = name; } - QString name() const { return _name; } + void setName(const TQString &name) { _name = name; } + TQString name() const { return _name; } - void setGroup(const QString &group) { _group = group; } + void setGroup(const TQString &group) { _group = group; } bool isStored() const { return !_group.isNull(); } - void setSubGroup(const QString &subGroup) { _subGroup = subGroup; } + void setSubGroup(const TQString &subGroup) { _subGroup = subGroup; } bool canHaveSubGroup() const { return !_subGroup.isNull(); } static const char ANONYMOUS[]; // name assigned to anonymous players static const char ANONYMOUS_LABEL[]; - QVariant read(uint i) const; - QString pretty(uint i) const; - void write(uint i, const QVariant &value) const; - // for UInt QVariant (return new value) + TQVariant read(uint i) const; + TQString pretty(uint i) const; + void write(uint i, const TQVariant &value) const; + // for UInt TQVariant (return new value) uint increment(uint i) const; private: Item *_item; - QString _name, _group, _subGroup; + TQString _name, _group, _subGroup; - QString entryName() const; + TQString entryName() const; ItemContainer(const ItemContainer &); ItemContainer &operator =(const ItemContainer &); @@ -125,7 +125,7 @@ class ItemContainer * Manage a bunch of @ref Item which are saved under the same group * in KHighscores config file. */ -class ItemArray : public QMemArray<ItemContainer *> +class ItemArray : public TQMemArray<ItemContainer *> { public: ItemArray(); @@ -133,26 +133,26 @@ class ItemArray : public QMemArray<ItemContainer *> virtual uint nbEntries() const = 0; - const ItemContainer *item(const QString &name) const; - ItemContainer *item(const QString &name); + const ItemContainer *item(const TQString &name) const; + ItemContainer *item(const TQString &name); - void addItem(const QString &name, Item *, bool stored = true, + void addItem(const TQString &name, Item *, bool stored = true, bool canHaveSubGroup = false); - void setItem(const QString &name, Item *); - int findIndex(const QString &name) const; + void setItem(const TQString &name, Item *); + int findIndex(const TQString &name) const; - void setGroup(const QString &group); - void setSubGroup(const QString &subGroup); + void setGroup(const TQString &group); + void setSubGroup(const TQString &subGroup); void read(uint k, Score &data) const; void write(uint k, const Score &data, uint maxNbLines) const; - void exportToText(QTextStream &) const; + void exportToText(TQTextStream &) const; private: - QString _group, _subGroup; + TQString _group, _subGroup; - void _setItem(uint i, const QString &name, Item *, bool stored, + void _setItem(uint i, const TQString &name, Item *, bool stored, bool canHaveSubGroup); ItemArray(const ItemArray &); @@ -176,7 +176,7 @@ class ScoreInfos : public ItemArray class ConfigGroup : public KConfigGroupSaver { public: - ConfigGroup(const QString &group = QString::null) + ConfigGroup(const TQString &group = TQString::null) : KConfigGroupSaver(kapp->config(), group) {} }; @@ -189,34 +189,34 @@ class PlayerInfos : public ItemArray bool isNewPlayer() const { return _newPlayer; } bool isOldLocalPlayer() const { return _oldLocalPlayer; } uint nbEntries() const; - QString name() const { return item("name")->read(_id).toString(); } + TQString name() const { return item("name")->read(_id).toString(); } bool isAnonymous() const; - QString prettyName() const { return prettyName(_id); } - QString prettyName(uint id) const { return item("name")->pretty(id); } - QString registeredName() const; - QString comment() const { return item("comment")->pretty(_id); } + TQString prettyName() const { return prettyName(_id); } + TQString prettyName(uint id) const { return item("name")->pretty(id); } + TQString registeredName() const; + TQString comment() const { return item("comment")->pretty(_id); } bool isWWEnabled() const; - QString key() const; + TQString key() const; uint id() const { return _id; } uint oldLocalId() const { return _oldLocalId; } - void createHistoItems(const QMemArray<uint> &scores, bool bound); - QString histoName(uint i) const; + void createHistoItems(const TQMemArray<uint> &scores, bool bound); + TQString histoName(uint i) const; uint histoSize() const; - const QMemArray<uint> &histogram() const { return _histogram; } + const TQMemArray<uint> &histogram() const { return _histogram; } void submitScore(const Score &) const; // return true if the nickname is already used locally - bool isNameUsed(const QString &name) const; - void modifyName(const QString &newName) const; - void modifySettings(const QString &newName, const QString &comment, - bool WWEnabled, const QString &newKey) const; + bool isNameUsed(const TQString &name) const; + void modifyName(const TQString &newName) const; + void modifySettings(const TQString &newName, const TQString &comment, + bool WWEnabled, const TQString &newKey) const; void removeKey(); private: bool _newPlayer, _bound, _oldLocalPlayer; uint _id, _oldLocalId; - QMemArray<uint> _histogram; + TQMemArray<uint> _histogram; }; //----------------------------------------------------------------------------- @@ -227,13 +227,13 @@ class ManagerPrivate void init(uint maxNbentries); ~ManagerPrivate(); - bool modifySettings(const QString &newName, const QString &comment, - bool WWEnabled, QWidget *widget); + bool modifySettings(const TQString &newName, const TQString &comment, + bool WWEnabled, TQWidget *widget); void setGameType(uint type); void checkFirst(); int submitLocal(const Score &score); - int submitScore(const Score &score, QWidget *widget, bool askIfAnonymous); + int submitScore(const Score &score, TQWidget *widget, bool askIfAnonymous); Score readScore(uint i) const; uint gameType() const { return _gameType; } @@ -243,13 +243,13 @@ class ManagerPrivate PlayerInfos &playerInfos() { return *_playerInfos; } KHighscore &hsConfig() { return *_hsConfig; } enum QueryType { Submit, Register, Change, Players, Scores }; - KURL queryURL(QueryType type, const QString &newName=QString::null) const; + KURL queryURL(QueryType type, const TQString &newName=TQString::null) const; - void exportHighscores(QTextStream &); + void exportHighscores(TQTextStream &); Manager &manager; KURL serverURL; - QString version; + TQString version; bool showStatistics, showDrawGames, trackLostGames, trackDrawGames; Manager::ShowMode showMode; @@ -264,11 +264,11 @@ class ManagerPrivate // return -1 if not a local best score int rank(const Score &score) const; - bool submitWorldWide(const Score &score, QWidget *parent) const; - static bool doQuery(const KURL &url, QWidget *parent, - QDomNamedNodeMap *map = 0); - static bool getFromQuery(const QDomNamedNodeMap &map, const QString &name, - QString &value, QWidget *parent); + bool submitWorldWide(const Score &score, TQWidget *parent) const; + static bool doQuery(const KURL &url, TQWidget *parent, + TQDomNamedNodeMap *map = 0); + static bool getFromQuery(const TQDomNamedNodeMap &map, const TQString &name, + TQString &value, TQWidget *parent); void convertToGlobal(); }; diff --git a/libkdegames/highscore/kexthighscore_item.cpp b/libkdegames/highscore/kexthighscore_item.cpp index 48556e02..fa6c7e2c 100644 --- a/libkdegames/highscore/kexthighscore_item.cpp +++ b/libkdegames/highscore/kexthighscore_item.cpp @@ -19,7 +19,7 @@ #include "kexthighscore_item.h" -#include <qlayout.h> +#include <tqlayout.h> #include <kglobal.h> #include <kdialogbase.h> #include <kdebug.h> @@ -33,7 +33,7 @@ namespace KExtHighscore { //----------------------------------------------------------------------------- -Item::Item(const QVariant &def, const QString &label, int alignment) +Item::Item(const TQVariant &def, const TQString &label, int alignment) : _default(def), _label(label), _alignment(alignment), _format(NoFormat), _special(NoSpecial) {} @@ -41,16 +41,16 @@ Item::Item(const QVariant &def, const QString &label, int alignment) Item::~Item() {} -QVariant Item::read(uint, const QVariant &value) const +TQVariant Item::read(uint, const TQVariant &value) const { return value; } void Item::setPrettyFormat(Format format) { - bool buint = ( _default.type()==QVariant::UInt ); - bool bdouble = ( _default.type()==QVariant::Double ); - bool bnum = ( buint || bdouble || _default.type()==QVariant::Int ); + bool buint = ( _default.type()==TQVariant::UInt ); + bool bdouble = ( _default.type()==TQVariant::Double ); + bool bnum = ( buint || bdouble || _default.type()==TQVariant::Int ); switch (format) { case OneDecimal: @@ -61,7 +61,7 @@ void Item::setPrettyFormat(Format format) Q_ASSERT(bnum); break; case DateTime: - Q_ASSERT( _default.type()==QVariant::DateTime ); + Q_ASSERT( _default.type()==TQVariant::DateTime ); break; case NoFormat: break; @@ -72,9 +72,9 @@ void Item::setPrettyFormat(Format format) void Item::setPrettySpecial(Special special) { - bool buint = ( _default.type()==QVariant::UInt ); - bool bnum = ( buint || _default.type()==QVariant::Double - || _default.type()==QVariant::Int ); + bool buint = ( _default.type()==TQVariant::UInt ); + bool bnum = ( buint || _default.type()==TQVariant::Double + || _default.type()==TQVariant::Int ); switch (special) { case ZeroNotDefined: @@ -86,7 +86,7 @@ void Item::setPrettySpecial(Special special) case DefaultNotDefined: break; case Anonymous: - Q_ASSERT( _default.type()==QVariant::String ); + Q_ASSERT( _default.type()==TQVariant::String ); break; case NoSpecial: break; @@ -95,15 +95,15 @@ void Item::setPrettySpecial(Special special) _special = special; } -QString Item::timeFormat(uint n) +TQString Item::timeFormat(uint n) { Q_ASSERT( n<=3600 && n!=0 ); n = 3600 - n; - return QString::number(n / 60).rightJustify(2, '0') + ':' - + QString::number(n % 60).rightJustify(2, '0'); + return TQString::number(n / 60).rightJustify(2, '0') + ':' + + TQString::number(n % 60).rightJustify(2, '0'); } -QString Item::pretty(uint, const QVariant &value) const +TQString Item::pretty(uint, const TQVariant &value) const { switch (_special) { case ZeroNotDefined: @@ -125,9 +125,9 @@ QString Item::pretty(uint, const QVariant &value) const switch (_format) { case OneDecimal: - return QString::number(value.toDouble(), 'f', 1); + return TQString::number(value.toDouble(), 'f', 1); case Percentage: - return QString::number(value.toDouble(), 'f', 1) + "%"; + return TQString::number(value.toDouble(), 'f', 1) + "%"; case MinuteTime: return timeFormat(value.toUInt()); case DateTime: @@ -152,13 +152,13 @@ Score::Score(ScoreType type) Score::~Score() {} -const QVariant &Score::data(const QString &name) const +const TQVariant &Score::data(const TQString &name) const { Q_ASSERT( _data.contains(name) ); return _data[name]; } -void Score::setData(const QString &name, const QVariant &value) +void Score::setData(const TQString &name, const TQVariant &value) { Q_ASSERT( _data.contains(name) ); Q_ASSERT( _data[name].type()==value.type() ); @@ -176,14 +176,14 @@ bool Score::operator <(const Score &score) return internal->manager.isStrictlyLess(*this, score); } -QDataStream &operator <<(QDataStream &s, const Score &score) +TQDataStream &operator <<(TQDataStream &s, const Score &score) { s << (Q_UINT8)score.type(); s << score._data; return s; } -QDataStream &operator >>(QDataStream &s, Score &score) +TQDataStream &operator >>(TQDataStream &s, Score &score) { Q_UINT8 type; s >> type; @@ -204,7 +204,7 @@ void MultiplayerScores::clear() Score score; for (uint i=0; i<_scores.size(); i++) { _nbGames[i] = 0; - QVariant name = _scores[i].data("name"); + TQVariant name = _scores[i].data("name"); _scores[i] = score; _scores[i].setData("name", name); _scores[i]._data["mean score"] = double(0); @@ -219,14 +219,14 @@ void MultiplayerScores::setPlayerCount(uint nb) clear(); } -void MultiplayerScores::setName(uint i, const QString &name) +void MultiplayerScores::setName(uint i, const TQString &name) { _scores[i].setData("name", name); } void MultiplayerScores::addScore(uint i, const Score &score) { - QVariant name = _scores[i].data("name"); + TQVariant name = _scores[i].data("name"); double mean = _scores[i].data("mean score").toDouble(); uint won = _scores[i].data("nb won games").toUInt(); _scores[i] = score; @@ -238,7 +238,7 @@ void MultiplayerScores::addScore(uint i, const Score &score) _scores[i]._data["nb won games"] = won; } -void MultiplayerScores::show(QWidget *parent) +void MultiplayerScores::show(TQWidget *parent) { // check consistency if ( _nbGames.size()<2 ) kdWarning(11002) << "less than 2 players" << endl; @@ -252,11 +252,11 @@ void MultiplayerScores::show(QWidget *parent) } // order the players according to the number of won games - QValueVector<Score> ordered; + TQValueVector<Score> ordered; for (uint i=0; i<_scores.size(); i++) { uint won = _scores[i].data("nb won games").toUInt(); double mean = _scores[i].data("mean score").toDouble(); - QValueVector<Score>::iterator it; + TQValueVector<Score>::iterator it; for(it = ordered.begin(); it!=ordered.end(); ++it) { uint cwon = (*it).data("nb won games").toUInt(); double cmean = (*it).data("mean score").toDouble(); @@ -272,21 +272,21 @@ void MultiplayerScores::show(QWidget *parent) KDialogBase dialog(KDialogBase::Plain, i18n("Multiplayers Scores"), KDialogBase::Close, KDialogBase::Close, parent, "show_multiplayers_score", true, true); - QHBoxLayout *hbox = new QHBoxLayout(dialog.plainPage(), + TQHBoxLayout *hbox = new TQHBoxLayout(dialog.plainPage(), KDialog::marginHint(), KDialog::spacingHint()); - QVBox *vbox = new QVBox(dialog.plainPage()); + TQVBox *vbox = new TQVBox(dialog.plainPage()); hbox->addWidget(vbox); - if ( _nbGames[0]==0 ) (void)new QLabel(i18n("No game played."), vbox); + if ( _nbGames[0]==0 ) (void)new TQLabel(i18n("No game played."), vbox); else { - (void)new QLabel(i18n("Scores for last game:"), vbox); + (void)new TQLabel(i18n("Scores for last game:"), vbox); (void)new LastMultipleScoresList(ordered, vbox); } if ( _nbGames[0]>1 ) { - vbox = new QVBox(dialog.plainPage()); + vbox = new TQVBox(dialog.plainPage()); hbox->addWidget(vbox); - (void)new QLabel(i18n("Scores for the last %1 games:") + (void)new TQLabel(i18n("Scores for the last %1 games:") .arg(_nbGames[0]), vbox); (void)new TotalMultipleScoresList(ordered, vbox); } @@ -295,14 +295,14 @@ void MultiplayerScores::show(QWidget *parent) dialog.exec(); } -QDataStream &operator <<(QDataStream &s, const MultiplayerScores &score) +TQDataStream &operator <<(TQDataStream &s, const MultiplayerScores &score) { s << score._scores; s << score._nbGames; return s; } -QDataStream &operator >>(QDataStream &s, MultiplayerScores &score) +TQDataStream &operator >>(TQDataStream &s, MultiplayerScores &score) { s >> score._scores; s >> score._nbGames; diff --git a/libkdegames/highscore/kexthighscore_item.h b/libkdegames/highscore/kexthighscore_item.h index 0200fabd..ff067bd2 100644 --- a/libkdegames/highscore/kexthighscore_item.h +++ b/libkdegames/highscore/kexthighscore_item.h @@ -20,10 +20,10 @@ #ifndef KEXTHIGHSCORE_ITEM_H #define KEXTHIGHSCORE_ITEM_H -#include <qvariant.h> -#include <qnamespace.h> -#include <qmap.h> -#include <qvaluevector.h> +#include <tqvariant.h> +#include <tqnamespace.h> +#include <tqmap.h> +#include <tqvaluevector.h> #include <kdemacros.h> class QWidget; @@ -75,14 +75,14 @@ class KDE_EXPORT Item /** * Constructor. * - * @param def default value ; the QVariant also gives the type of data. + * @param def default value ; the TQVariant also gives the type of data. * Be sure to cast the value to the required type (for e.g. with uint). * @param label the label corresponding to the item. If empty, the item * is not shown. * @param alignment the alignment of the item. */ - Item(const QVariant &def = QVariant::Invalid, - const QString &label = QString::null, int alignment = Qt::AlignRight); + Item(const TQVariant &def = TQVariant::Invalid, + const TQString &label = TQString::null, int alignment = Qt::AlignRight); virtual ~Item(); @@ -106,12 +106,12 @@ class KDE_EXPORT Item /** * Set the label. */ - void setLabel(const QString &label) { _label = label; } + void setLabel(const TQString &label) { _label = label; } /** * @return the label. */ - QString label() const { return _label; } + TQString label() const { return _label; } /** * @return the alignment. @@ -121,12 +121,12 @@ class KDE_EXPORT Item /** * Set default value. */ - void setDefaultValue(const QVariant &value) { _default = value; } + void setDefaultValue(const TQVariant &value) { _default = value; } /** * @return the default value. */ - const QVariant &defaultValue() const { return _default; } + const TQVariant &defaultValue() const { return _default; } /** * @return the converted value (by default the value is left @@ -135,7 +135,7 @@ class KDE_EXPORT Item * @param i the element index ("rank" for score / "id" for player) * @param value the value to convert */ - virtual QVariant read(uint i, const QVariant &value) const; + virtual TQVariant read(uint i, const TQVariant &value) const; /** * @return the string to be displayed. You may need to reimplement this @@ -144,11 +144,11 @@ class KDE_EXPORT Item * @param i the element index ("rank" for score / "id" for player) * @param value the value to convert */ - virtual QString pretty(uint i, const QVariant &value) const; + virtual TQString pretty(uint i, const TQVariant &value) const; private: - QVariant _default; - QString _label; + TQVariant _default; + TQString _label; int _alignment; Format _format; Special _special; @@ -156,7 +156,7 @@ class KDE_EXPORT Item class ItemPrivate; ItemPrivate *d; - static QString timeFormat(uint); + static TQString timeFormat(uint); }; //----------------------------------------------------------------------------- @@ -192,14 +192,14 @@ class KDE_EXPORT Score /** * @return the data associated with the named Item. */ - const QVariant &data(const QString &name) const; + const TQVariant &data(const TQString &name) const; /** * Set the data associated with the named Item. Note that the * value should have the type of the default value of the * Item. */ - void setData(const QString &name, const QVariant &value); + void setData(const TQString &name, const TQVariant &value); /** * @return the score value. @@ -230,19 +230,19 @@ class KDE_EXPORT Score private: ScoreType _type; - QMap<QString, QVariant> _data; + TQMap<TQString, TQVariant> _data; class ScorePrivate; ScorePrivate *d; friend class MultiplayerScores; - friend QDataStream &operator <<(QDataStream &stream, const Score &score); - friend QDataStream &operator >>(QDataStream &stream, Score &score); + friend TQDataStream &operator <<(TQDataStream &stream, const Score &score); + friend TQDataStream &operator >>(TQDataStream &stream, Score &score); }; -KDE_EXPORT QDataStream &operator <<(QDataStream &stream, const Score &score); -KDE_EXPORT QDataStream &operator >>(QDataStream &stream, Score &score); +KDE_EXPORT TQDataStream &operator <<(TQDataStream &stream, const Score &score); +KDE_EXPORT TQDataStream &operator >>(TQDataStream &stream, Score &score); /** * This class is used to store and show scores for multiplayer games. @@ -279,7 +279,7 @@ class KDE_EXPORT MultiplayerScores /** * Set the name of player. */ - void setName(uint player, const QString &name); + void setName(uint player, const TQString &name); /** * Add the score of player. @@ -294,23 +294,23 @@ class KDE_EXPORT MultiplayerScores /** * Show scores. */ - void show(QWidget *parent); + void show(TQWidget *parent); private: - QValueVector<uint> _nbGames; - QValueVector<Score> _scores; + TQValueVector<uint> _nbGames; + TQValueVector<Score> _scores; class MultiplayerScoresPrivate; MultiplayerScoresPrivate *d; - friend QDataStream &operator <<(QDataStream &stream, + friend TQDataStream &operator <<(TQDataStream &stream, const MultiplayerScores &score); - friend QDataStream &operator >>(QDataStream &stream, + friend TQDataStream &operator >>(TQDataStream &stream, MultiplayerScores &score); }; -KDE_EXPORT QDataStream &operator <<(QDataStream &stream, const MultiplayerScores &score); -KDE_EXPORT QDataStream &operator >>(QDataStream &stream, MultiplayerScores &score); +KDE_EXPORT TQDataStream &operator <<(TQDataStream &stream, const MultiplayerScores &score); +KDE_EXPORT TQDataStream &operator >>(TQDataStream &stream, MultiplayerScores &score); } // namespace diff --git a/libkdegames/highscore/kexthighscore_tab.cpp b/libkdegames/highscore/kexthighscore_tab.cpp index 3e9cbe8a..3b2b5852 100644 --- a/libkdegames/highscore/kexthighscore_tab.cpp +++ b/libkdegames/highscore/kexthighscore_tab.cpp @@ -20,11 +20,11 @@ #include "kexthighscore_tab.h" #include "kexthighscore_tab.moc" -#include <qlayout.h> -#include <qlabel.h> -#include <qvgroupbox.h> -#include <qgrid.h> -#include <qheader.h> +#include <tqlayout.h> +#include <tqlabel.h> +#include <tqvgroupbox.h> +#include <tqgrid.h> +#include <tqheader.h> #include <kdialogbase.h> #include <klistview.h> @@ -39,14 +39,14 @@ namespace KExtHighscore { //----------------------------------------------------------------------------- -PlayersCombo::PlayersCombo(QWidget *parent, const char *name) - : QComboBox(parent, name) +PlayersCombo::PlayersCombo(TQWidget *parent, const char *name) + : TQComboBox(parent, name) { const PlayerInfos &p = internal->playerInfos(); for (uint i = 0; i<p.nbEntries(); i++) insertItem(p.prettyName(i)); - insertItem(QString("<") + i18n("all") + '>'); - connect(this, SIGNAL(activated(int)), SLOT(activatedSlot(int))); + insertItem(TQString("<") + i18n("all") + '>'); + connect(this, TQT_SIGNAL(activated(int)), TQT_SLOT(activatedSlot(int))); } void PlayersCombo::activatedSlot(int i) @@ -65,19 +65,19 @@ void PlayersCombo::load() } //----------------------------------------------------------------------------- -AdditionalTab::AdditionalTab(QWidget *parent, const char *name) - : QWidget(parent, name) +AdditionalTab::AdditionalTab(TQWidget *parent, const char *name) + : TQWidget(parent, name) { - QVBoxLayout *top = new QVBoxLayout(this, KDialogBase::marginHint(), + TQVBoxLayout *top = new TQVBoxLayout(this, KDialogBase::marginHint(), KDialogBase::spacingHint()); - QHBoxLayout *hbox = new QHBoxLayout(top); - QLabel *label = new QLabel(i18n("Select player:"), this); + TQHBoxLayout *hbox = new TQHBoxLayout(top); + TQLabel *label = new TQLabel(i18n("Select player:"), this); hbox->addWidget(label); _combo = new PlayersCombo(this); - connect(_combo, SIGNAL(playerSelected(uint)), - SLOT(playerSelected(uint))); - connect(_combo, SIGNAL(allSelected()), SLOT(allSelected())); + connect(_combo, TQT_SIGNAL(playerSelected(uint)), + TQT_SLOT(playerSelected(uint))); + connect(_combo, TQT_SIGNAL(allSelected()), TQT_SLOT(allSelected())); hbox->addWidget(_combo); hbox->addStretch(1); } @@ -94,11 +94,11 @@ void AdditionalTab::allSelected() display(internal->playerInfos().nbEntries()); } -QString AdditionalTab::percent(uint n, uint total, bool withBraces) +TQString AdditionalTab::percent(uint n, uint total, bool withBraces) { - if ( n==0 || total==0 ) return QString::null; - QString s = QString("%1%").arg(100.0 * n / total, 0, 'f', 1); - return (withBraces ? QString("(") + s + ")" : s); + if ( n==0 || total==0 ) return TQString::null; + TQString s = TQString("%1%").arg(100.0 * n / total, 0, 'f', 1); + return (withBraces ? TQString("(") + s + ")" : s); } void AdditionalTab::load() @@ -116,32 +116,32 @@ const char *StatisticsTab::TREND_LABELS[Nb_Trends] = { I18N_NOOP("Current:"), I18N_NOOP("Max won:"), I18N_NOOP("Max lost:") }; -StatisticsTab::StatisticsTab(QWidget *parent) +StatisticsTab::StatisticsTab(TQWidget *parent) : AdditionalTab(parent, "statistics_tab") { // construct GUI - QVBoxLayout *top = static_cast<QVBoxLayout *>(layout()); + TQVBoxLayout *top = static_cast<TQVBoxLayout *>(layout()); - QHBoxLayout *hbox = new QHBoxLayout(top); - QVBoxLayout *vbox = new QVBoxLayout(hbox); - QVGroupBox *group = new QVGroupBox(i18n("Game Counts"), this); + TQHBoxLayout *hbox = new TQHBoxLayout(top); + TQVBoxLayout *vbox = new TQVBoxLayout(hbox); + TQVGroupBox *group = new TQVGroupBox(i18n("Game Counts"), this); vbox->addWidget(group); - QGrid *grid = new QGrid(3, group); + TQGrid *grid = new TQGrid(3, group); grid->setSpacing(KDialogBase::spacingHint()); for (uint k=0; k<Nb_Counts; k++) { if ( Count(k)==Draw && !internal->showDrawGames ) continue; - (void)new QLabel(i18n(COUNT_LABELS[k]), grid); - _nbs[k] = new QLabel(grid); - _percents[k] = new QLabel(grid); + (void)new TQLabel(i18n(COUNT_LABELS[k]), grid); + _nbs[k] = new TQLabel(grid); + _percents[k] = new TQLabel(grid); } - group = new QVGroupBox(i18n("Trends"), this); + group = new TQVGroupBox(i18n("Trends"), this); vbox->addWidget(group); - grid = new QGrid(2, group); + grid = new TQGrid(2, group); grid->setSpacing(KDialogBase::spacingHint()); for (uint k=0; k<Nb_Trends; k++) { - (void)new QLabel(i18n(TREND_LABELS[k]), grid); - _trends[k] = new QLabel(grid); + (void)new TQLabel(i18n(TREND_LABELS[k]), grid); + _trends[k] = new TQLabel(grid); } hbox->addStretch(1); @@ -182,9 +182,9 @@ void StatisticsTab::load() init(); } -QString StatisticsTab::percent(const Data &d, Count count) const +TQString StatisticsTab::percent(const Data &d, Count count) const { - if ( count==Total ) return QString::null; + if ( count==Total ) return TQString::null; return AdditionalTab::percent(d.count[count], d.count[Total], true); } @@ -193,26 +193,26 @@ void StatisticsTab::display(uint i) const Data &d = _data[i]; for (uint k=0; k<Nb_Counts; k++) { if ( Count(k) && !internal->showDrawGames ) continue; - _nbs[k]->setText(QString::number(d.count[k])); + _nbs[k]->setText(TQString::number(d.count[k])); _percents[k]->setText(percent(d, Count(k))); } for (uint k=0; k<Nb_Trends; k++) { - QString s; + TQString s; if ( d.trend[k]>0 ) s = '+'; int prec = (i==internal->playerInfos().nbEntries() ? 1 : 0); - _trends[k]->setText(s + QString::number(d.trend[k], 'f', prec)); + _trends[k]->setText(s + TQString::number(d.trend[k], 'f', prec)); } } //----------------------------------------------------------------------------- -HistogramTab::HistogramTab(QWidget *parent) +HistogramTab::HistogramTab(TQWidget *parent) : AdditionalTab(parent, "histogram_tab") { // construct GUI - QVBoxLayout *top = static_cast<QVBoxLayout *>(layout()); + TQVBoxLayout *top = static_cast<TQVBoxLayout *>(layout()); _list = new KListView(this); - _list->setSelectionMode(QListView::NoSelection); + _list->setSelectionMode(TQListView::NoSelection); _list->setItemMargin(3); _list->setAllColumnsShowFocus(true); _list->setSorting(-1); @@ -225,14 +225,14 @@ HistogramTab::HistogramTab(QWidget *parent) _list->addColumn(i18n("Count")); _list->addColumn(i18n("Percent")); for (uint i=0; i<4; i++) _list->setColumnAlignment(i, AlignRight); - _list->addColumn(QString::null); + _list->addColumn(TQString::null); const Item *sitem = internal->scoreInfos().item("score")->item(); const PlayerInfos &pi = internal->playerInfos(); - const QMemArray<uint> &sh = pi.histogram(); + const TQMemArray<uint> &sh = pi.histogram(); for (uint k=1; k<pi.histoSize(); k++) { - QString s1 = sitem->pretty(0, sh[k-1]); - QString s2; + TQString s1 = sitem->pretty(0, sh[k-1]); + TQString s2; if ( k==sh.size() ) s2 = "..."; else if ( sh[k]!=sh[k-1]+1 ) s2 = sitem->pretty(0, sh[k]); (void)new KListViewItem(_list, s1, s2); @@ -264,14 +264,14 @@ void HistogramTab::load() void HistogramTab::display(uint i) { const PlayerInfos &pi = internal->playerInfos(); - QListViewItem *item = _list->firstChild(); + TQListViewItem *item = _list->firstChild(); uint s = pi.histoSize() - 1; for (int k=s-1; k>=0; k--) { uint nb = _counts[i*s + k]; - item->setText(2, QString::number(nb)); + item->setText(2, TQString::number(nb)); item->setText(3, percent(nb, _data[i])); uint width = (_data[i]==0 ? 0 : qRound(150.0 * nb / _data[i])); - QPixmap pixmap(width, 10); + TQPixmap pixmap(width, 10); pixmap.fill(blue); item->setPixmap(4, pixmap); item = item->nextSibling(); diff --git a/libkdegames/highscore/kexthighscore_tab.h b/libkdegames/highscore/kexthighscore_tab.h index ce47a75f..3d31bc95 100644 --- a/libkdegames/highscore/kexthighscore_tab.h +++ b/libkdegames/highscore/kexthighscore_tab.h @@ -20,8 +20,8 @@ #ifndef KEXTHIGHSCORE_TAB_H #define KEXTHIGHSCORE_TAB_H -#include <qcombobox.h> -#include <qmemarray.h> +#include <tqcombobox.h> +#include <tqmemarray.h> class QLabel; class KListView; @@ -35,7 +35,7 @@ class PlayersCombo : public QComboBox { Q_OBJECT public: - PlayersCombo(QWidget *parent = 0, const char *name = 0); + PlayersCombo(TQWidget *parent = 0, const char *name = 0); void load(); @@ -53,7 +53,7 @@ class AdditionalTab : public QWidget { Q_OBJECT public: - AdditionalTab(QWidget *parent, const char *name); + AdditionalTab(TQWidget *parent, const char *name); virtual void load(); @@ -63,7 +63,7 @@ class AdditionalTab : public QWidget protected: void init(); - static QString percent(uint n, uint total, bool withBraces = false); + static TQString percent(uint n, uint total, bool withBraces = false); virtual void display(uint i) = 0; private: @@ -75,7 +75,7 @@ class StatisticsTab : public AdditionalTab { Q_OBJECT public: - StatisticsTab(QWidget *parent); + StatisticsTab(TQWidget *parent); void load(); @@ -88,10 +88,10 @@ class StatisticsTab : public AdditionalTab uint count[Nb_Counts]; double trend[Nb_Trends]; }; - QMemArray<Data> _data; - QLabel *_nbs[Nb_Counts], *_percents[Nb_Counts], *_trends[Nb_Trends]; + TQMemArray<Data> _data; + TQLabel *_nbs[Nb_Counts], *_percents[Nb_Counts], *_trends[Nb_Trends]; - QString percent(const Data &, Count) const; + TQString percent(const Data &, Count) const; void display(uint i); }; @@ -100,13 +100,13 @@ class HistogramTab : public AdditionalTab { Q_OBJECT public: - HistogramTab(QWidget *parent); + HistogramTab(TQWidget *parent); void load(); private: - QMemArray<uint> _counts; - QMemArray<uint> _data; + TQMemArray<uint> _counts; + TQMemArray<uint> _data; KListView *_list; void display(uint i); diff --git a/libkdegames/highscore/khighscore.cpp b/libkdegames/highscore/khighscore.cpp index 4e1f68e5..26bb47c3 100644 --- a/libkdegames/highscore/khighscore.cpp +++ b/libkdegames/highscore/khighscore.cpp @@ -46,7 +46,7 @@ class KHighscorePrivate public: KHighscorePrivate() {} - QString group; + TQString group; bool global; }; @@ -56,14 +56,14 @@ static KStaticDeleter<KFileLock> lockSD; static KStaticDeleter<KRawConfig> configSD; -KHighscore::KHighscore(QObject* parent) - : QObject(parent) +KHighscore::KHighscore(TQObject* parent) + : TQObject(parent) { init(true); } -KHighscore::KHighscore(bool forceLocal, QObject* parent) - : QObject(parent) +KHighscore::KHighscore(bool forceLocal, TQObject* parent) + : TQObject(parent) { init(forceLocal); } @@ -95,7 +95,7 @@ void KHighscore::readCurrentConfig() void KHighscore::init(const char *appname) { #ifdef HIGHSCORE_DIRECTORY - const QString filename = QString::fromLocal8Bit("%1/%2.scores") + const TQString filename = TQString::fromLocal8Bit("%1/%2.scores") .arg(HIGHSCORE_DIRECTORY).arg(appname); int fd = open(filename.local8Bit(), O_RDWR); if ( fd<0 ) kdFatal(11002) << "cannot open global highscore file \"" @@ -111,7 +111,7 @@ void KHighscore::init(const char *appname) #endif } -bool KHighscore::lockForWriting(QWidget *widget) +bool KHighscore::lockForWriting(TQWidget *widget) { if ( isLocked() ) return true; @@ -132,7 +132,7 @@ bool KHighscore::lockForWriting(QWidget *widget) if ( !first ) { KGuiItem item = KStdGuiItem::cont(); item.setText(i18n("Retry")); - int res = KMessageBox::warningContinueCancel(widget, i18n("Cannot access the highscore file. Another user is probably currently writing to it."), QString::null, item, "ask_lock_global_highscore_file"); + int res = KMessageBox::warningContinueCancel(widget, i18n("Cannot access the highscore file. Another user is probably currently writing to it."), TQString::null, item, "ask_lock_global_highscore_file"); if ( res==KMessageBox::Cancel ) break; } else sleep(1); first = false; @@ -165,90 +165,90 @@ KConfig* KHighscore::config() const return (d->global ? _config : kapp->config()); } -void KHighscore::writeEntry(int entry, const QString& key, const QVariant& value) +void KHighscore::writeEntry(int entry, const TQString& key, const TQVariant& value) { Q_ASSERT( isLocked() ); KConfigGroupSaver cg(config(), group()); - QString confKey = QString("%1_%2").arg(entry).arg(key); + TQString confKey = TQString("%1_%2").arg(entry).arg(key); cg.config()->writeEntry(confKey, value); } -void KHighscore::writeEntry(int entry, const QString& key, int value) +void KHighscore::writeEntry(int entry, const TQString& key, int value) { Q_ASSERT( isLocked() ); KConfigGroupSaver cg(config(), group()); - QString confKey = QString("%1_%2").arg(entry).arg(key); + TQString confKey = TQString("%1_%2").arg(entry).arg(key); cg.config()->writeEntry(confKey, value); } -void KHighscore::writeEntry(int entry, const QString& key, const QString &value) +void KHighscore::writeEntry(int entry, const TQString& key, const TQString &value) { Q_ASSERT (isLocked() ); KConfigGroupSaver cg(config(), group()); - QString confKey = QString("%1_%2").arg(entry).arg(key); + TQString confKey = TQString("%1_%2").arg(entry).arg(key); cg.config()->writeEntry(confKey, value); } -QVariant KHighscore::readPropertyEntry(int entry, const QString& key, const QVariant& pDefault) const +TQVariant KHighscore::readPropertyEntry(int entry, const TQString& key, const TQVariant& pDefault) const { KConfigGroupSaver cg(config(), group()); - QString confKey = QString("%1_%2").arg(entry).arg(key); + TQString confKey = TQString("%1_%2").arg(entry).arg(key); return cg.config()->readPropertyEntry(confKey, pDefault); } -QString KHighscore::readEntry(int entry, const QString& key, const QString& pDefault) const +TQString KHighscore::readEntry(int entry, const TQString& key, const TQString& pDefault) const { KConfigGroupSaver cg(config(), group()); - QString confKey = QString("%1_%2").arg(entry).arg(key); + TQString confKey = TQString("%1_%2").arg(entry).arg(key); return cg.config()->readEntry(confKey, pDefault); } -int KHighscore::readNumEntry(int entry, const QString& key, int pDefault) const +int KHighscore::readNumEntry(int entry, const TQString& key, int pDefault) const { KConfigGroupSaver cg(config(), group()); - QString confKey = QString("%1_%2").arg(entry).arg(key); + TQString confKey = TQString("%1_%2").arg(entry).arg(key); return cg.config()->readNumEntry(confKey, pDefault); } -bool KHighscore::hasEntry(int entry, const QString& key) const +bool KHighscore::hasEntry(int entry, const TQString& key) const { KConfigGroupSaver cg(config(), group()); - QString confKey = QString("%1_%2").arg(entry).arg(key); + TQString confKey = TQString("%1_%2").arg(entry).arg(key); return cg.config()->hasKey(confKey); } -QStringList KHighscore::readList(const QString& key, int lastEntry) const +TQStringList KHighscore::readList(const TQString& key, int lastEntry) const { - QStringList list; + TQStringList list; for (int i = 1; hasEntry(i, key) && ((lastEntry > 0) ? (i <= lastEntry) : true); i++) { list.append(readEntry(i, key)); } return list; } -void KHighscore::writeList(const QString& key, const QStringList& list) +void KHighscore::writeList(const TQString& key, const TQStringList& list) { for (int unsigned i = 1; i <= list.count(); i++) { writeEntry(i, key, list[i - 1]); } } -void KHighscore::setHighscoreGroup(const QString& group) +void KHighscore::setHighscoreGroup(const TQString& group) { d->group = group; } -const QString& KHighscore::highscoreGroup() const +const TQString& KHighscore::highscoreGroup() const { return d->group; } -QString KHighscore::group() const +TQString KHighscore::group() const { if ( highscoreGroup().isNull() ) - return (d->global ? QString::null : GROUP); + return (d->global ? TQString::null : GROUP); return (d->global ? highscoreGroup() - : QString("%1_%2").arg(GROUP).arg(highscoreGroup())); + : TQString("%1_%2").arg(GROUP).arg(highscoreGroup())); } bool KHighscore::hasTable() const diff --git a/libkdegames/highscore/khighscore.h b/libkdegames/highscore/khighscore.h index b1e3d25f..42c9fcda 100644 --- a/libkdegames/highscore/khighscore.h +++ b/libkdegames/highscore/khighscore.h @@ -23,8 +23,8 @@ #ifndef __KHIGHSCORE_H__ #define __KHIGHSCORE_H__ -#include <qstring.h> -#include <qobject.h> +#include <tqstring.h> +#include <tqobject.h> #include <kdemacros.h> class KConfig; class KFileLock; @@ -67,7 +67,7 @@ class KHighscorePrivate; * single player, so the "best times" of a player. To write highscores for a * specific player in a specific level you will have to use a more complex way: * \code - * QString group = QString("%1_%2").arg(player).arg(level); + * TQString group = TQString("%1_%2").arg(player).arg(level); * table->setGroup(group); * writeHighscore(table, player, level); * \endcode @@ -76,7 +76,7 @@ class KHighscorePrivate; * don't use i18n() for the keys or groups! Here is the code to read the above * written entry: * \code - * QString firstName = highscore->readEntry(0, "name"); + * TQString firstName = highscore->readEntry(0, "name"); * \endcode * Easy, what? * @author Andreas Beckermann <b_mann@gmx.de> @@ -89,7 +89,7 @@ public: * Constructor. The highscore file is forced to be local to support * games using the old behaviour. */ - KHighscore(QObject* parent = 0); + KHighscore(TQObject* parent = 0); /** * Constructor. @@ -100,7 +100,7 @@ public: * @param parent parent widget for this widget * @since 3.2 */ - KHighscore(bool forceLocal, QObject *parent); + KHighscore(bool forceLocal, TQObject *parent); /** * Read the current state of the highscore file. Remember that when @@ -137,7 +137,7 @@ public: * @return false on error or if the config file is locked by another * process. In such case, the config stays read-only. */ - bool lockForWriting(QWidget *widget = 0); + bool lockForWriting(TQWidget *widget = 0); /** * Effectively write and unlock the system-wide highscore file @@ -167,20 +167,20 @@ public: * are prefixed with the entry number * @param value The value of this entry **/ - void writeEntry(int entry, const QString& key, const QString& value); + void writeEntry(int entry, const TQString& key, const TQString& value); /** * This is an overloaded member function, provided for convenience. * It differs from the above function only in what argument(s) it accepts. **/ - void writeEntry(int entry, const QString& key, int value); + void writeEntry(int entry, const TQString& key, int value); /** * This is an overloaded member function, provided for convenience. * It differs from the above function only in what argument(s) it accepts. - * See KConfigBase documentation for allowed QVariant::Type. + * See KConfigBase documentation for allowed TQVariant::Type. **/ - void writeEntry(int entry, const QString& key, const QVariant &value); + void writeEntry(int entry, const TQString& key, const TQVariant &value); /** * Reads an entry from the highscore table. @@ -193,7 +193,7 @@ public: * @return The value of this entry+key pair or pDefault if the entry+key * pair doesn't exist **/ - QString readEntry(int entry, const QString& key, const QString& pDefault = QString::null) const; + TQString readEntry(int entry, const TQString& key, const TQString& pDefault = TQString::null) const; /** * Read a numeric value. @@ -206,22 +206,22 @@ public: * @return The value of this entry+key pair or pDefault if the entry+key * pair doesn't exist **/ - int readNumEntry(int entry, const QString& key, int pDefault = -1) const; + int readNumEntry(int entry, const TQString& key, int pDefault = -1) const; /** - * Read a QVariant entry. - * See KConfigBase documentation for allowed QVariant::Type. + * Read a TQVariant entry. + * See KConfigBase documentation for allowed TQVariant::Type. * * @return the value of this entry+key pair or pDefault if the entry+key * pair doesn't exist or */ - QVariant readPropertyEntry(int entry, const QString &key, const QVariant &pDefault) const; + TQVariant readPropertyEntry(int entry, const TQString &key, const TQVariant &pDefault) const; /** * @return True if the highscore table conatins the entry/key pair, * otherwise false **/ - bool hasEntry(int entry, const QString& key) const; + bool hasEntry(int entry, const TQString& key) const; /** * Reads a list of entries from the highscore table starting at 1 until @@ -240,7 +240,7 @@ public: * 20 entries. If lastEntry is <= 0 then rading is only stopped when when an * entry does not exist. **/ - QStringList readList(const QString& key, int lastEntry = 20) const; + TQStringList readList(const TQString& key, int lastEntry = 20) const; /** * Writes a list of entries to the highscore table. @@ -253,7 +253,7 @@ public: * are prefixed with the entry number * @param list The list of values **/ - void writeList(const QString& key, const QStringList& list); + void writeList(const TQString& key, const TQStringList& list); /** * @return Whether a highscore table exists. You can use this @@ -273,24 +273,24 @@ public: * Set the new highscore group. The group is being prefixed with * "KHighscore_" in the table. * @param groupname The new groupname. E.g. use "easy" for the easy - * level of your game. If you use QString::null (the default) the + * level of your game. If you use TQString::null (the default) the * default group is used. **/ - void setHighscoreGroup(const QString& groupname = QString::null); + void setHighscoreGroup(const TQString& groupname = TQString::null); /** * @return The currently used group. This doesn't contain the prefix * ("KHighscore_") but the same as setHighscoreGroup uses. The - * default is QString::null + * default is TQString::null **/ - const QString& highscoreGroup() const; + const TQString& highscoreGroup() const; protected: /** * @return A groupname to be used in KConfig. Used internally to * prefix the value from highscoreGroup() with "KHighscore_" **/ - QString group() const; + TQString group() const; /** * @return A pointer to the KConfig object to be used. This is diff --git a/libkdegames/highscore/kscoredialog.cpp b/libkdegames/highscore/kscoredialog.cpp index 37155650..7bed0c6b 100644 --- a/libkdegames/highscore/kscoredialog.cpp +++ b/libkdegames/highscore/kscoredialog.cpp @@ -24,13 +24,13 @@ this software. #include "config.h" -#include <qlabel.h> -#include <qlayout.h> -#include <qlineedit.h> -#include <qwidgetstack.h> -#include <qtimer.h> -#include <qevent.h> -#include <qptrvector.h> +#include <tqlabel.h> +#include <tqlayout.h> +#include <tqlineedit.h> +#include <tqwidgetstack.h> +#include <tqtimer.h> +#include <tqevent.h> +#include <tqptrvector.h> #include <kapplication.h> #include <kconfig.h> @@ -42,29 +42,29 @@ this software. class KScoreDialog::KScoreDialogPrivate { public: - QPtrList<FieldInfo> scores; - QWidget *page; - QGridLayout *layout; - QLineEdit *edit; - QPtrVector<QWidgetStack> stack; - QPtrVector<QLabel> labels; - QLabel *commentLabel; - QString comment; + TQPtrList<FieldInfo> scores; + TQWidget *page; + TQGridLayout *layout; + TQLineEdit *edit; + TQPtrVector<TQWidgetStack> stack; + TQPtrVector<TQLabel> labels; + TQLabel *commentLabel; + TQString comment; int fields; int newName; int latest; int nrCols; bool loaded; - QString configGroup; + TQString configGroup; - QMap<int, int> col; - QMap<int, QString> header; - QMap<int, QString> key; - QString player; + TQMap<int, int> col; + TQMap<int, TQString> header; + TQMap<int, TQString> key; + TQString player; }; -KScoreDialog::KScoreDialog(int fields, QWidget *parent, const char *oname) +KScoreDialog::KScoreDialog(int fields, TQWidget *parent, const char *oname) : KDialogBase(parent, oname, true, i18n("High Scores"), Ok, Ok, true) { d = new KScoreDialogPrivate(); @@ -90,7 +90,7 @@ KScoreDialog::KScoreDialog(int fields, QWidget *parent, const char *oname) d->key[Score] = "Score"; d->page = makeMainWidget(); - connect(this, SIGNAL(okClicked()), SLOT(slotGotName())); + connect(this, TQT_SIGNAL(okClicked()), TQT_SLOT(slotGotName())); } KScoreDialog::~KScoreDialog() @@ -98,18 +98,18 @@ KScoreDialog::~KScoreDialog() delete d; } -void KScoreDialog::setConfigGroup(const QString &group) +void KScoreDialog::setConfigGroup(const TQString &group) { d->configGroup = group; d->loaded = false; } -void KScoreDialog::setComment(const QString &comment) +void KScoreDialog::setComment(const TQString &comment) { d->comment = comment; } -void KScoreDialog::addField(int field, const QString &header, const QString &key) +void KScoreDialog::addField(int field, const TQString &header, const TQString &key) { d->fields |= field; d->header[field] = header; @@ -126,19 +126,19 @@ void KScoreDialog::setupDialog() d->col[field] = d->nrCols++; } - d->layout = new QGridLayout(d->page, 15, d->nrCols, marginHint() + 20, spacingHint()); + d->layout = new TQGridLayout(d->page, 15, d->nrCols, marginHint() + 20, spacingHint()); d->layout->addRowSpacing(4, 15); - d->commentLabel = new QLabel(d->page); + d->commentLabel = new TQLabel(d->page); d->commentLabel->setAlignment(AlignVCenter | AlignHCenter); d->layout->addMultiCellWidget(d->commentLabel, 1, 1, 0, d->nrCols-1); - QFont bold = font(); + TQFont bold = font(); bold.setBold(true); - QLabel *label; + TQLabel *label; d->layout->addColSpacing(0, 50); - label = new QLabel(i18n("Rank"), d->page); + label = new TQLabel(i18n("Rank"), d->page); d->layout->addWidget(label, 3, 0); label->setFont(bold); @@ -148,7 +148,7 @@ void KScoreDialog::setupDialog() { d->layout->addColSpacing(d->col[field], 50); - label = new QLabel(d->header[field], d->page); + label = new TQLabel(d->header[field], d->page); d->layout->addWidget(label, 3, d->col[field], field <= Name ? AlignLeft : AlignRight); label->setFont(bold); } @@ -160,19 +160,19 @@ void KScoreDialog::setupDialog() d->labels.resize(d->nrCols * 10); d->stack.resize(10); - QString num; + TQString num; for (int i = 1; i <= 10; ++i) { - QLabel *label; + TQLabel *label; num.setNum(i); - label = new QLabel(i18n("#%1").arg(num), d->page); + label = new TQLabel(i18n("#%1").arg(num), d->page); d->labels.insert((i-1)*d->nrCols + 0, label); d->layout->addWidget(label, i+4, 0); if (d->fields & Name) { - QWidgetStack *stack = new QWidgetStack(d->page); + TQWidgetStack *stack = new TQWidgetStack(d->page); d->stack.insert(i-1, stack); d->layout->addWidget(stack, i+4, d->col[Name]); - label = new QLabel(d->page); + label = new TQLabel(d->page); d->labels.insert((i-1)*d->nrCols + d->col[Name], label); stack->addWidget(label); stack->raiseWidget(label); @@ -181,7 +181,7 @@ void KScoreDialog::setupDialog() { if (d->fields & field) { - label = new QLabel(d->page); + label = new TQLabel(d->page); d->labels.insert((i-1)*d->nrCols + d->col[field], label); d->layout->addWidget(label, i+4, d->col[field], AlignRight); } @@ -200,7 +200,7 @@ void KScoreDialog::aboutToShow() d->commentLabel->setText(d->comment); if (d->comment.isEmpty()) { - d->commentLabel->setMinimumSize(QSize(1,1)); + d->commentLabel->setMinimumSize(TQSize(1,1)); d->commentLabel->hide(); d->layout->addRowSpacing(0, -15); d->layout->addRowSpacing(2, -15); @@ -212,15 +212,15 @@ void KScoreDialog::aboutToShow() d->layout->addRowSpacing(0, -10); d->layout->addRowSpacing(2, 10); } - d->comment = QString::null; + d->comment = TQString::null; - QFont normal = font(); - QFont bold = normal; + TQFont normal = font(); + TQFont bold = normal; bold.setBold(true); - QString num; + TQString num; for (int i = 1; i <= 10; ++i) { - QLabel *label; + TQLabel *label; num.setNum(i); FieldInfo *score = d->scores.at(i-1); label = d->labels[(i-1)*d->nrCols + 0]; @@ -233,14 +233,14 @@ void KScoreDialog::aboutToShow() { if (d->newName == i) { - QWidgetStack *stack = d->stack[i-1]; - d->edit = new QLineEdit(d->player, stack); + TQWidgetStack *stack = d->stack[i-1]; + d->edit = new TQLineEdit(d->player, stack); d->edit->setMinimumWidth(40); stack->addWidget(d->edit); stack->raiseWidget(d->edit); d->edit->setFocus(); - connect(d->edit, SIGNAL(returnPressed()), - this, SLOT(slotGotReturn())); + connect(d->edit, TQT_SIGNAL(returnPressed()), + this, TQT_SLOT(slotGotReturn())); } else { @@ -272,14 +272,14 @@ void KScoreDialog::aboutToShow() void KScoreDialog::loadScores() { - QString key, value; + TQString key, value; d->loaded = true; d->scores.clear(); KConfigGroup config(kapp->config(), d->configGroup.utf8()); d->player = config.readEntry("LastPlayer"); - QString num; + TQString num; for (int i = 1; i <= 10; ++i) { num.setNum(i); FieldInfo *score = new FieldInfo(); @@ -297,12 +297,12 @@ void KScoreDialog::loadScores() void KScoreDialog::saveScores() { - QString key, value; + TQString key, value; KConfigGroup config(kapp->config(), d->configGroup.utf8()); config.writeEntry("LastPlayer", d->player); - QString num; + TQString num; for (int i = 1; i <= 10; ++i) { num.setNum(i); FieldInfo *score = d->scores.at(i-1); @@ -365,7 +365,7 @@ void KScoreDialog::show() void KScoreDialog::slotGotReturn() { - QTimer::singleShot(0, this, SLOT(slotGotName())); + TQTimer::singleShot(0, this, TQT_SLOT(slotGotName())); } void KScoreDialog::slotGotName() @@ -377,10 +377,10 @@ void KScoreDialog::slotGotName() (*d->scores.at(d->newName-1))[Name] = d->player; saveScores(); - QFont bold = font(); + TQFont bold = font(); bold.setBold(true); - QLabel *label = d->labels[(d->newName-1)*d->nrCols + d->col[Name]]; + TQLabel *label = d->labels[(d->newName-1)*d->nrCols + d->col[Name]]; label->setFont(bold); label->setText(d->player); d->stack[(d->newName-1)]->raiseWidget(label); @@ -397,7 +397,7 @@ int KScoreDialog::highScore() return (*d->scores.first())[Score].toInt(); } -void KScoreDialog::keyPressEvent( QKeyEvent *ev) +void KScoreDialog::keyPressEvent( TQKeyEvent *ev) { if ((d->newName != -1) && (ev->key() == Key_Return)) { diff --git a/libkdegames/highscore/kscoredialog.h b/libkdegames/highscore/kscoredialog.h index 4d4a76db..50424caa 100644 --- a/libkdegames/highscore/kscoredialog.h +++ b/libkdegames/highscore/kscoredialog.h @@ -25,8 +25,8 @@ this software. #ifndef KSCOREDIALOG_H #define KSCOREDIALOG_H -#include <qmap.h> -#include <qptrlist.h> +#include <tqmap.h> +#include <tqptrlist.h> #include <kdialogbase.h> #include <kdemacros.h> @@ -52,14 +52,14 @@ public: Time = 1 << 28, Score = 1 << 29 }; - typedef QMap<int, QString> FieldInfo; + typedef TQMap<int, TQString> FieldInfo; /** * @param fields Which fields should be listed. - * @param parent passed to parent QWidget constructor - * @param name passed to parent QWidget constructor + * @param parent passed to parent TQWidget constructor + * @param name passed to parent TQWidget constructor */ - KScoreDialog(int fields, QWidget *parent=0, const char *name=0); + KScoreDialog(int fields, TQWidget *parent=0, const char *name=0); ~KScoreDialog(); @@ -67,13 +67,13 @@ public: * @param group to use for reading/writing highscores from/to. By default * the class will use "High Score" */ - void setConfigGroup(const QString &group); + void setConfigGroup(const TQString &group); /** * @param comment to add when showing high-scores. * The comment is only used once. */ - void setComment(const QString &comment); + void setComment(const TQString &comment); /** * Define an extra FieldInfo entry. @@ -81,7 +81,7 @@ public: * @param header Header shown in the dialog for this field * @param key used to store this field with. */ - void addField(int field, const QString &header, const QString &key); + void addField(int field, const TQString &header, const TQString &key); /** * Adds a new score to the list. @@ -115,7 +115,7 @@ private: void aboutToShow(); void setupDialog(); - void keyPressEvent( QKeyEvent *ev); + void keyPressEvent( TQKeyEvent *ev); private: class KScoreDialogPrivate; |