diff options
Diffstat (limited to 'kshisen')
-rw-r--r-- | kshisen/app.cpp | 94 | ||||
-rw-r--r-- | kshisen/app.h | 3 | ||||
-rw-r--r-- | kshisen/board.cpp | 20 | ||||
-rw-r--r-- | kshisen/board.h | 7 | ||||
-rw-r--r-- | kshisen/settings.ui | 56 | ||||
-rw-r--r-- | kshisen/tileset.cpp | 6 |
6 files changed, 94 insertions, 92 deletions
diff --git a/kshisen/app.cpp b/kshisen/app.cpp index ab6e3b85..8717d767 100644 --- a/kshisen/app.cpp +++ b/kshisen/app.cpp @@ -62,10 +62,10 @@ #include "prefs.h" #include "settings.h" -App::App(TQWidget *parent, const char *name) : KMainWindow(parent, name), +App::App(TQWidget *tqparent, const char *name) : KMainWindow(tqparent, name), cheat(false) { - highscoreTable = new KHighscore(this); + highscoreTable = new KHighscore(TQT_TQOBJECT(this)); // TODO? // Would it make sense long term to have a kconfig update rather then @@ -89,13 +89,13 @@ App::App(TQWidget *parent, const char *name) : KMainWindow(parent, name), setupGUI(); - connect(board, TQT_SIGNAL(changed()), this, TQT_SLOT(enableItems())); + connect(board, TQT_SIGNAL(changed()), TQT_TQOBJECT(this), TQT_SLOT(enableItems())); TQTimer *t = new TQTimer(this); t->start(1000); - connect(t, TQT_SIGNAL(timeout()), this, TQT_SLOT(updateScore())); - connect(board, TQT_SIGNAL(endOfGame()), this, TQT_SLOT(slotEndOfGame())); - connect(board, TQT_SIGNAL(resized()), this, TQT_SLOT(boardResized())); + connect(t, TQT_SIGNAL(timeout()), TQT_TQOBJECT(this), TQT_SLOT(updateScore())); + connect(board, TQT_SIGNAL(endOfGame()), TQT_TQOBJECT(this), TQT_SLOT(slotEndOfGame())); + connect(board, TQT_SIGNAL(resized()), TQT_TQOBJECT(this), TQT_SLOT(boardResized())); kapp->processEvents(); @@ -106,16 +106,16 @@ App::App(TQWidget *parent, const char *name) : KMainWindow(parent, name), void App::initKAction() { // Game - KStdGameAction::gameNew(this, TQT_SLOT(newGame()), actionCollection()); - KStdGameAction::restart(this, TQT_SLOT(restartGame()), actionCollection()); - KStdGameAction::pause(this, TQT_SLOT(pause()), actionCollection()); - KStdGameAction::highscores(this, TQT_SLOT(hallOfFame()), actionCollection()); - KStdGameAction::quit(this, TQT_SLOT(quitGame()), actionCollection()); + KStdGameAction::gameNew(TQT_TQOBJECT(this), TQT_SLOT(newGame()), actionCollection()); + KStdGameAction::restart(TQT_TQOBJECT(this), TQT_SLOT(restartGame()), actionCollection()); + KStdGameAction::pause(TQT_TQOBJECT(this), TQT_SLOT(pause()), actionCollection()); + KStdGameAction::highscores(TQT_TQOBJECT(this), TQT_SLOT(hallOfFame()), actionCollection()); + KStdGameAction::quit(TQT_TQOBJECT(this), TQT_SLOT(quitGame()), actionCollection()); // Move - KStdGameAction::undo(this, TQT_SLOT(undo()), actionCollection()); - KStdGameAction::redo(this, TQT_SLOT(redo()), actionCollection()); - KStdGameAction::hint(this, TQT_SLOT(hint()), actionCollection()); + KStdGameAction::undo(TQT_TQOBJECT(this), TQT_SLOT(undo()), actionCollection()); + KStdGameAction::redo(TQT_TQOBJECT(this), TQT_SLOT(redo()), actionCollection()); + KStdGameAction::hint(TQT_TQOBJECT(this), TQT_SLOT(hint()), actionCollection()); //new KAction(i18n("Is Game Solvable?"), 0, this, // TQT_SLOT(isSolvable()), actionCollection(), "move_solvable"); @@ -124,7 +124,7 @@ void App::initKAction() #endif // Settings - KStdAction::preferences(this, TQT_SLOT(showSettings()), actionCollection()); + KStdAction::preferences(TQT_TQOBJECT(this), TQT_SLOT(showSettings()), actionCollection()); } void App::hallOfFame() @@ -299,9 +299,9 @@ void App::slotEndOfGame() else { TQString s = i18n("Congratulations! You made it in %1:%2:%3") - .arg(TQString().sprintf("%02d", board->getTimeForGame()/3600)) - .arg(TQString().sprintf("%02d", (board->getTimeForGame() / 60) % 60)) - .arg(TQString().sprintf("%02d", board->getTimeForGame() % 60)); + .tqarg(TQString().sprintf("%02d", board->getTimeForGame()/3600)) + .tqarg(TQString().sprintf("%02d", (board->getTimeForGame() / 60) % 60)) + .tqarg(TQString().sprintf("%02d", board->getTimeForGame() % 60)); KMessageBox::information(this, s, i18n("End of Game")); } @@ -315,18 +315,18 @@ void App::updateScore() { int t = board->getTimeForGame(); TQString s = i18n(" Your time: %1:%2:%3 %4") - .arg(TQString().sprintf("%02d", t / 3600 )) - .arg(TQString().sprintf("%02d", (t / 60) % 60 )) - .arg(TQString().sprintf("%02d", t % 60 )) - .arg(board->isPaused()?i18n("(Paused) "):TQString::null); + .tqarg(TQString().sprintf("%02d", t / 3600 )) + .tqarg(TQString().sprintf("%02d", (t / 60) % 60 )) + .tqarg(TQString().sprintf("%02d", t % 60 )) + .tqarg(board->isPaused()?i18n("(Paused) "):TQString()); statusBar()->changeItem(s, SBI_TIME); // Number of tiles int tl = (board->x_tiles() * board->y_tiles()); s = i18n(" Removed: %1/%2 ") - .arg(TQString().sprintf("%d", tl - board->tilesLeft())) - .arg(TQString().sprintf("%d", tl )); + .tqarg(TQString().sprintf("%d", tl - board->tilesLeft())) + .tqarg(TQString().sprintf("%d", tl )); statusBar()->changeItem(s, SBI_TILES); } @@ -356,26 +356,26 @@ TQString App::getPlayerName() TQDialog *dlg = new TQDialog(this, "Hall of Fame", true); TQLabel *l1 = new TQLabel(i18n("You've made it into the \"Hall Of Fame\". Type in\nyour name so mankind will always remember\nyour cool rating."), dlg); - l1->setFixedSize(l1->sizeHint()); + l1->setFixedSize(l1->tqsizeHint()); TQLabel *l2 = new TQLabel(i18n("Your name:"), dlg); - l2->setFixedSize(l2->sizeHint()); + l2->setFixedSize(l2->tqsizeHint()); TQLineEdit *e = new TQLineEdit(dlg); e->setText("XXXXXXXXXXXXXXXX"); - e->setMinimumWidth(e->sizeHint().width()); - e->setFixedHeight(e->sizeHint().height()); + e->setMinimumWidth(e->tqsizeHint().width()); + e->setFixedHeight(e->tqsizeHint().height()); e->setText( lastPlayerName ); e->setFocus(); TQPushButton *b = new KPushButton(KStdGuiItem::ok(), dlg); b->setDefault(true); - b->setFixedSize(b->sizeHint()); + b->setFixedSize(b->tqsizeHint()); connect(b, TQT_SIGNAL(released()), dlg, TQT_SLOT(accept())); connect(e, TQT_SIGNAL(returnPressed()), dlg, TQT_SLOT(accept())); - // create layout + // create tqlayout TQVBoxLayout *tl = new TQVBoxLayout(dlg, 10); TQHBoxLayout *tl1 = new TQHBoxLayout(); tl->addWidget(l1); @@ -603,12 +603,12 @@ void App::showHighscore(int focusitem) f.setPointSize(24); f.setBold(true); l->setFont(f); - l->setFixedSize(l->sizeHint()); + l->setFixedSize(l->tqsizeHint()); l->setFixedWidth(l->width() + 32); - l->setAlignment(AlignCenter); + l->tqsetAlignment(AlignCenter); tl->addWidget(l); - // insert highscores in a gridlayout + // insert highscores in a gridtqlayout TQGridLayout *table = new TQGridLayout(12, 5, 5); tl->addLayout(table, 1); @@ -621,23 +621,23 @@ void App::showHighscore(int focusitem) f.setBold(true); l = new TQLabel(i18n("Rank"), dlg); l->setFont(f); - l->setMinimumSize(l->sizeHint()); + l->setMinimumSize(l->tqsizeHint()); table->addWidget(l, 0, 0); l = new TQLabel(i18n("Name"), dlg); l->setFont(f); - l->setMinimumSize(l->sizeHint()); + l->setMinimumSize(l->tqsizeHint()); table->addWidget(l, 0, 1); l = new TQLabel(i18n("Time"), dlg); l->setFont(f); - l->setMinimumSize(l->sizeHint()); + l->setMinimumSize(l->tqsizeHint()); table->addWidget(l, 0, 2); l = new TQLabel(i18n("Size"), dlg); l->setFont(f); - l->setMinimumSize(l->sizeHint()); + l->setMinimumSize(l->tqsizeHint()); table->addWidget(l, 0, 3); l = new TQLabel(i18n("Score"), dlg); l->setFont(f); - l->setMinimumSize(l->sizeHint().width()*3, l->sizeHint().height()); + l->setMinimumSize(l->tqsizeHint().width()*3, l->tqsizeHint().height()); table->addWidget(l, 0, 4); TQString s; @@ -685,8 +685,8 @@ void App::showHighscore(int focusitem) if(i < highscore.size()) { s = TQString("%1 %2") - .arg(getScore(hs)) - .arg(hs.gravity ? i18n("(gravity)") : TQString("")); + .tqarg(getScore(hs)) + .tqarg(hs.gravity ? i18n("(gravity)") : TQString("")); } else { @@ -694,7 +694,7 @@ void App::showHighscore(int focusitem) } e[i][4] = new TQLabel(s, dlg); - e[i][4]->setAlignment(AlignRight); + e[i][4]->tqsetAlignment(AlignRight); } f = font(); @@ -704,12 +704,12 @@ void App::showHighscore(int focusitem) { for(j = 0; j < 5; j++) { - e[i][j]->setMinimumHeight(e[i][j]->sizeHint().height()); + e[i][j]->setMinimumHeight(e[i][j]->tqsizeHint().height()); if(j == 1) - e[i][j]->setMinimumWidth(std::max(e[i][j]->sizeHint().width(), 100)); + e[i][j]->setMinimumWidth(std::max(e[i][j]->tqsizeHint().width(), 100)); else - e[i][j]->setMinimumWidth(std::max(e[i][j]->sizeHint().width(), 60)); + e[i][j]->setMinimumWidth(std::max(e[i][j]->tqsizeHint().width(), 60)); if((int)i == focusitem) e[i][j]->setFont(f); @@ -720,14 +720,14 @@ void App::showHighscore(int focusitem) TQPushButton *b = new KPushButton(KStdGuiItem::close(), dlg); - b->setFixedSize(b->sizeHint()); + b->setFixedSize(b->tqsizeHint()); // connect the "Close"-button to done connect(b, TQT_SIGNAL(clicked()), dlg, TQT_SLOT(accept())); b->setDefault(true); b->setFocus(); - // make layout + // make tqlayout tl->addSpacing(10); tl->addWidget(b); tl->activate(); @@ -752,7 +752,7 @@ void App::showSettings(){ KConfigDialog *dialog = new KConfigDialog(this, "settings", Prefs::self(), KDialogBase::Swallow); Settings *general = new Settings(0, "General"); dialog->addPage(general, i18n("General"), "package_settings"); - connect(dialog, TQT_SIGNAL(settingsChanged()), this, TQT_SLOT(loadSettings())); + connect(dialog, TQT_SIGNAL(settingsChanged()), TQT_TQOBJECT(this), TQT_SLOT(loadSettings())); connect(dialog, TQT_SIGNAL(settingsChanged()), board, TQT_SLOT(loadSettings())); dialog->show(); } diff --git a/kshisen/app.h b/kshisen/app.h index 7e670138..917f9d1a 100644 --- a/kshisen/app.h +++ b/kshisen/app.h @@ -62,9 +62,10 @@ const unsigned HIGHSCORE_MAX = 10; class App : public KMainWindow { Q_OBJECT + TQ_OBJECT public: - App(TQWidget *parent = 0, const char *name=0); + App(TQWidget *tqparent = 0, const char *name=0); private slots: void loadSettings(); diff --git a/kshisen/board.cpp b/kshisen/board.cpp index ee0d70a7..d568b825 100644 --- a/kshisen/board.cpp +++ b/kshisen/board.cpp @@ -57,8 +57,8 @@ static int size_x[5] = {14, 18, 24, 26, 30}; static int size_y[5] = { 6, 8, 12, 14, 16}; static int DELAY[5] = {1000, 750, 500, 250, 125}; -Board::Board(TQWidget *parent, const char *name) : - TQWidget(parent, name, WResizeNoErase), field(0), +Board::Board(TQWidget *tqparent, const char *name) : + TQWidget(tqparent, name, WResizeNoErase), field(0), _x_tiles(0), _y_tiles(0), _delay(125), paused(false), gravity_flag(true), _solvable_flag(true), @@ -179,7 +179,7 @@ void Board::mousePressEvent(TQMouseEvent *e) } // Mark tile - if(e->button() == LeftButton) + if(e->button() == Qt::LeftButton) { clearHighlight(); @@ -188,7 +188,7 @@ void Board::mousePressEvent(TQMouseEvent *e) } // Assist by highlighting all tiles of same type - if(e->button() == RightButton) + if(e->button() == Qt::RightButton) { int clicked_tile = getField(pos_x, pos_y); @@ -261,8 +261,8 @@ void Board::setSize(int x, int y) // set the minimum size of the scalable window const double MINIMUM_SCALE = 0.2; - int w = qRound(tiles.unscaledTileWidth() * MINIMUM_SCALE) * x_tiles(); - int h = qRound(tiles.unscaledTileHeight() * MINIMUM_SCALE) * y_tiles(); + int w = tqRound(tiles.unscaledTileWidth() * MINIMUM_SCALE) * x_tiles(); + int h = tqRound(tiles.unscaledTileHeight() * MINIMUM_SCALE) * y_tiles(); w += tiles.unscaledTileWidth(); h += tiles.unscaledTileWidth(); @@ -444,7 +444,7 @@ void Board::updateField(int x, int y, bool erase) tiles.tileWidth(), tiles.tileHeight()); - repaint(r, erase); + tqrepaint(r, erase); } void Board::paintEvent(TQPaintEvent *e) @@ -459,7 +459,7 @@ void Board::paintEvent(TQPaintEvent *e) if(paused) { p.setFont(KGlobalSettings::largeFont()); - p.drawText(rect(), Qt::AlignCenter, i18n("Game Paused")); + p.drawText(rect(), TQt::AlignCenter, i18n("Game Paused")); } else { @@ -900,7 +900,7 @@ void Board::dumpBoard() const if(tile == EMPTY) row += " --"; else - row += TQString("%1").arg(getField(x, y), 3); + row += TQString("%1").tqarg(getField(x, y), 3); } kdDebug() << row << endl; } @@ -1071,7 +1071,7 @@ bool Board::pause() return paused; } -TQSize Board::sizeHint() const +TQSize Board::tqsizeHint() const { int dpi = TQPaintDeviceMetrics(this).logicalDpiX(); if (dpi < 75) diff --git a/kshisen/board.h b/kshisen/board.h index 2413d8d4..d6b3940a 100644 --- a/kshisen/board.h +++ b/kshisen/board.h @@ -67,12 +67,13 @@ public: int tile; }; -class Board : public QWidget +class Board : public TQWidget { Q_OBJECT + TQ_OBJECT public: - Board(TQWidget *parent = 0, const char *name=0); + Board(TQWidget *tqparent = 0, const char *name=0); ~Board(); virtual void paintEvent(TQPaintEvent *); @@ -134,7 +135,7 @@ private slots: void gravity(int, bool); protected: - virtual TQSize sizeHint() const; + virtual TQSize tqsizeHint() const; private: // functions void initBoard(); diff --git a/kshisen/settings.ui b/kshisen/settings.ui index 7f9846a6..77e7a316 100644 --- a/kshisen/settings.ui +++ b/kshisen/settings.ui @@ -1,10 +1,10 @@ <!DOCTYPE UI><UI version="3.2" stdsetdef="1"> <class>Settings</class> -<widget class="QWidget"> +<widget class="TQWidget"> <property name="name"> <cstring>Settings</cstring> </property> - <property name="geometry"> + <property name="tqgeometry"> <rect> <x>0</x> <y>0</y> @@ -16,7 +16,7 @@ <property name="name"> <cstring>unnamed</cstring> </property> - <widget class="QCheckBox"> + <widget class="TQCheckBox"> <property name="name"> <cstring>kcfg_Gravity</cstring> </property> @@ -24,7 +24,7 @@ <string>Gravity</string> </property> </widget> - <widget class="QCheckBox"> + <widget class="TQCheckBox"> <property name="name"> <cstring>kcfg_Solvable</cstring> </property> @@ -32,7 +32,7 @@ <string>Allow unsolvable games</string> </property> </widget> - <widget class="QGroupBox"> + <widget class="TQGroupBox"> <property name="name"> <cstring>difficulty_groupBox</cstring> </property> @@ -43,7 +43,7 @@ <property name="name"> <cstring>unnamed</cstring> </property> - <widget class="QSlider" row="0" column="0" rowspan="1" colspan="2"> + <widget class="TQSlider" row="0" column="0" rowspan="1" colspan="2"> <property name="name"> <cstring>kcfg_Level</cstring> </property> @@ -63,7 +63,7 @@ <enum>Below</enum> </property> </widget> - <widget class="QLabel" row="1" column="0"> + <widget class="TQLabel" row="1" column="0"> <property name="name"> <cstring>textLabel1</cstring> </property> @@ -71,20 +71,20 @@ <string>Easy</string> </property> </widget> - <widget class="QLabel" row="1" column="1"> + <widget class="TQLabel" row="1" column="1"> <property name="name"> <cstring>textLabel3</cstring> </property> <property name="text"> <string>Hard</string> </property> - <property name="alignment"> + <property name="tqalignment"> <set>AlignVCenter|AlignRight</set> </property> </widget> </grid> </widget> - <widget class="QGroupBox"> + <widget class="TQGroupBox"> <property name="name"> <cstring>speed_groupBox</cstring> </property> @@ -95,7 +95,7 @@ <property name="name"> <cstring>unnamed</cstring> </property> - <widget class="QSlider" row="0" column="0" rowspan="1" colspan="3"> + <widget class="TQSlider" row="0" column="0" rowspan="1" colspan="3"> <property name="name"> <cstring>kcfg_Speed</cstring> </property> @@ -115,7 +115,7 @@ <enum>Below</enum> </property> </widget> - <widget class="QLabel" row="1" column="0"> + <widget class="TQLabel" row="1" column="0"> <property name="name"> <cstring>textLabel4</cstring> </property> @@ -123,20 +123,20 @@ <string>Slow</string> </property> </widget> - <widget class="QLabel" row="1" column="2"> + <widget class="TQLabel" row="1" column="2"> <property name="name"> <cstring>textLabel6</cstring> </property> <property name="text"> <string>Fast</string> </property> - <property name="alignment"> + <property name="tqalignment"> <set>AlignVCenter|AlignRight</set> </property> </widget> </grid> </widget> - <widget class="QCheckBox"> + <widget class="TQCheckBox"> <property name="name"> <cstring>kcfg_Unscaled</cstring> </property> @@ -144,7 +144,7 @@ <string>Prefer unscaled tiles</string> </property> </widget> - <widget class="QGroupBox"> + <widget class="TQGroupBox"> <property name="name"> <cstring>size_groupBox</cstring> </property> @@ -155,7 +155,7 @@ <property name="name"> <cstring>unnamed</cstring> </property> - <widget class="QLabel" row="1" column="0"> + <widget class="TQLabel" row="1" column="0"> <property name="name"> <cstring>textLabel8</cstring> </property> @@ -163,40 +163,40 @@ <string>14x6</string> </property> </widget> - <widget class="QLabel" row="1" column="1"> + <widget class="TQLabel" row="1" column="1"> <property name="name"> <cstring>textLabel9</cstring> </property> <property name="text"> <string>18x8</string> </property> - <property name="alignment"> + <property name="tqalignment"> <set>AlignCenter</set> </property> </widget> - <widget class="QLabel" row="1" column="3"> + <widget class="TQLabel" row="1" column="3"> <property name="name"> <cstring>textLabel11</cstring> </property> <property name="text"> <string>26x14</string> </property> - <property name="alignment"> + <property name="tqalignment"> <set>AlignCenter</set> </property> </widget> - <widget class="QLabel" row="1" column="4"> + <widget class="TQLabel" row="1" column="4"> <property name="name"> <cstring>textLabel12</cstring> </property> <property name="text"> <string>30x16</string> </property> - <property name="alignment"> + <property name="tqalignment"> <set>AlignVCenter|AlignRight</set> </property> </widget> - <widget class="QSlider" row="0" column="0" rowspan="1" colspan="5"> + <widget class="TQSlider" row="0" column="0" rowspan="1" colspan="5"> <property name="name"> <cstring>kcfg_Size</cstring> </property> @@ -219,14 +219,14 @@ <enum>Below</enum> </property> </widget> - <widget class="QLabel" row="1" column="2"> + <widget class="TQLabel" row="1" column="2"> <property name="name"> <cstring>textLabel10</cstring> </property> <property name="text"> <string>24x12</string> </property> - <property name="alignment"> + <property name="tqalignment"> <set>AlignCenter</set> </property> </widget> @@ -242,7 +242,7 @@ <property name="sizeType"> <enum>Expanding</enum> </property> - <property name="sizeHint"> + <property name="tqsizeHint"> <size> <width>20</width> <height>20</height> @@ -251,5 +251,5 @@ </spacer> </vbox> </widget> -<layoutdefaults spacing="6" margin="11"/> +<tqlayoutdefaults spacing="6" margin="11"/> </UI> diff --git a/kshisen/tileset.cpp b/kshisen/tileset.cpp index 492cde79..e9b50c43 100644 --- a/kshisen/tileset.cpp +++ b/kshisen/tileset.cpp @@ -67,9 +67,9 @@ void TileSet::resizeTiles(int maxWidth, int maxHeight) // and maintain the tile's height-to-width ratio double ratio = static_cast<double>(unscaledTileHeight()) / unscaledTileWidth(); if(maxWidth * ratio < maxHeight) - maxHeight = qRound(maxWidth * ratio); + maxHeight = tqRound(maxWidth * ratio); else - maxWidth = qRound(maxHeight / ratio); + maxWidth = tqRound(maxHeight / ratio); if(maxHeight == tileHeight() && maxWidth == tileWidth()) return; @@ -118,7 +118,7 @@ TQPixmap TileSet::highlightedTile(int n) const int TileSet::lineWidth() const { - int width = qRound(tileHeight() / 10.0); + int width = tqRound(tileHeight() / 10.0); if(width < 3) width = 3; |