summaryrefslogtreecommitdiffstats
path: root/kshisen/app.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-07-31 19:42:31 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-07-31 19:42:31 +0000
commit576eb4299a00bc053db35414406f46372a0f70f2 (patch)
tree4c030922d533821db464af566188e7d40cc8848c /kshisen/app.cpp
parent0718336b6017d1a4fc1d626544180a5a2a29ddec (diff)
downloadtdegames-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 'kshisen/app.cpp')
-rw-r--r--kshisen/app.cpp154
1 files changed, 77 insertions, 77 deletions
diff --git a/kshisen/app.cpp b/kshisen/app.cpp
index 27f8cbf2..ab6e3b85 100644
--- a/kshisen/app.cpp
+++ b/kshisen/app.cpp
@@ -52,9 +52,9 @@
#include <kstdguiitem.h>
#include <kconfigdialog.h>
-#include <qlayout.h>
-#include <qtimer.h>
-#include <qlineedit.h>
+#include <tqlayout.h>
+#include <tqtimer.h>
+#include <tqlineedit.h>
#include <cmath>
@@ -62,7 +62,7 @@
#include "prefs.h"
#include "settings.h"
-App::App(QWidget *parent, const char *name) : KMainWindow(parent, name),
+App::App(TQWidget *parent, const char *name) : KMainWindow(parent, name),
cheat(false)
{
highscoreTable = new KHighscore(this);
@@ -89,13 +89,13 @@ App::App(QWidget *parent, const char *name) : KMainWindow(parent, name),
setupGUI();
- connect(board, SIGNAL(changed()), this, SLOT(enableItems()));
+ connect(board, TQT_SIGNAL(changed()), this, TQT_SLOT(enableItems()));
- QTimer *t = new QTimer(this);
+ TQTimer *t = new TQTimer(this);
t->start(1000);
- connect(t, SIGNAL(timeout()), this, SLOT(updateScore()));
- connect(board, SIGNAL(endOfGame()), this, SLOT(slotEndOfGame()));
- connect(board, SIGNAL(resized()), this, SLOT(boardResized()));
+ 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()));
kapp->processEvents();
@@ -106,25 +106,25 @@ App::App(QWidget *parent, const char *name) : KMainWindow(parent, name),
void App::initKAction()
{
// Game
- KStdGameAction::gameNew(this, SLOT(newGame()), actionCollection());
- KStdGameAction::restart(this, SLOT(restartGame()), actionCollection());
- KStdGameAction::pause(this, SLOT(pause()), actionCollection());
- KStdGameAction::highscores(this, SLOT(hallOfFame()), actionCollection());
- KStdGameAction::quit(this, SLOT(quitGame()), actionCollection());
+ 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());
// Move
- KStdGameAction::undo(this, SLOT(undo()), actionCollection());
- KStdGameAction::redo(this, SLOT(redo()), actionCollection());
- KStdGameAction::hint(this, SLOT(hint()), actionCollection());
+ KStdGameAction::undo(this, TQT_SLOT(undo()), actionCollection());
+ KStdGameAction::redo(this, TQT_SLOT(redo()), actionCollection());
+ KStdGameAction::hint(this, TQT_SLOT(hint()), actionCollection());
//new KAction(i18n("Is Game Solvable?"), 0, this,
- // SLOT(isSolvable()), actionCollection(), "move_solvable");
+ // TQT_SLOT(isSolvable()), actionCollection(), "move_solvable");
#ifdef DEBUGGING
- (void)new KAction(i18n("&Finish"), 0, board, SLOT(finish()), actionCollection(), "move_finish");
+ (void)new KAction(i18n("&Finish"), 0, board, TQT_SLOT(finish()), actionCollection(), "move_finish");
#endif
// Settings
- KStdAction::preferences(this, SLOT(showSettings()), actionCollection());
+ KStdAction::preferences(this, TQT_SLOT(showSettings()), actionCollection());
}
void App::hallOfFame()
@@ -207,7 +207,7 @@ void App::loadSettings()
// The user can work-around this situation by un-maximizing the window first.
if(Prefs::unscaled())
{
- QSize s = board->unscaledSize();
+ TQSize s = board->unscaledSize();
// We would have liked to have used KMainWindow::sizeForCentralWidgetSize(),
// but this function does not seem to work when the toolbar is docked on the
@@ -298,10 +298,10 @@ void App::slotEndOfGame()
}
else
{
- QString s = i18n("Congratulations! You made it in %1:%2:%3")
- .arg(QString().sprintf("%02d", board->getTimeForGame()/3600))
- .arg(QString().sprintf("%02d", (board->getTimeForGame() / 60) % 60))
- .arg(QString().sprintf("%02d", board->getTimeForGame() % 60));
+ 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));
KMessageBox::information(this, s, i18n("End of Game"));
}
@@ -314,19 +314,19 @@ void App::slotEndOfGame()
void App::updateScore()
{
int t = board->getTimeForGame();
- QString s = i18n(" Your time: %1:%2:%3 %4")
- .arg(QString().sprintf("%02d", t / 3600 ))
- .arg(QString().sprintf("%02d", (t / 60) % 60 ))
- .arg(QString().sprintf("%02d", t % 60 ))
- .arg(board->isPaused()?i18n("(Paused) "):QString::null);
+ 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);
statusBar()->changeItem(s, SBI_TIME);
// Number of tiles
int tl = (board->x_tiles() * board->y_tiles());
s = i18n(" Removed: %1/%2 ")
- .arg(QString().sprintf("%d", tl - board->tilesLeft()))
- .arg(QString().sprintf("%d", tl ));
+ .arg(TQString().sprintf("%d", tl - board->tilesLeft()))
+ .arg(TQString().sprintf("%d", tl ));
statusBar()->changeItem(s, SBI_TILES);
}
@@ -351,33 +351,33 @@ void App::resetCheatMode()
}
}
-QString App::getPlayerName()
+TQString App::getPlayerName()
{
- QDialog *dlg = new QDialog(this, "Hall of Fame", true);
+ TQDialog *dlg = new TQDialog(this, "Hall of Fame", true);
- QLabel *l1 = new QLabel(i18n("You've made it into the \"Hall Of Fame\". Type in\nyour name so mankind will always remember\nyour cool rating."), dlg);
+ 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());
- QLabel *l2 = new QLabel(i18n("Your name:"), dlg);
+ TQLabel *l2 = new TQLabel(i18n("Your name:"), dlg);
l2->setFixedSize(l2->sizeHint());
- QLineEdit *e = new QLineEdit(dlg);
+ TQLineEdit *e = new TQLineEdit(dlg);
e->setText("XXXXXXXXXXXXXXXX");
e->setMinimumWidth(e->sizeHint().width());
e->setFixedHeight(e->sizeHint().height());
e->setText( lastPlayerName );
e->setFocus();
- QPushButton *b = new KPushButton(KStdGuiItem::ok(), dlg);
+ TQPushButton *b = new KPushButton(KStdGuiItem::ok(), dlg);
b->setDefault(true);
b->setFixedSize(b->sizeHint());
- connect(b, SIGNAL(released()), dlg, SLOT(accept()));
- connect(e, SIGNAL(returnPressed()), dlg, SLOT(accept()));
+ connect(b, TQT_SIGNAL(released()), dlg, TQT_SLOT(accept()));
+ connect(e, TQT_SIGNAL(returnPressed()), dlg, TQT_SLOT(accept()));
// create layout
- QVBoxLayout *tl = new QVBoxLayout(dlg, 10);
- QHBoxLayout *tl1 = new QHBoxLayout();
+ TQVBoxLayout *tl = new TQVBoxLayout(dlg, 10);
+ TQHBoxLayout *tl1 = new TQHBoxLayout();
tl->addWidget(l1);
tl->addSpacing(5);
tl->addLayout(tl1);
@@ -469,7 +469,7 @@ int App::insertHighscore(const HighScore &hs)
void App::readHighscore()
{
- QStringList hi_x, hi_y, hi_sec, hi_date, hi_grav, hi_name;
+ TQStringList hi_x, hi_y, hi_sec, hi_date, hi_grav, hi_name;
hi_x = highscoreTable->readList("x", HIGHSCORE_MAX);
hi_y = highscoreTable->readList("y", HIGHSCORE_MAX);
hi_sec = highscoreTable->readList("seconds", HIGHSCORE_MAX);
@@ -501,7 +501,7 @@ void App::readOldHighscore()
{
// this is for before-KHighscore-highscores
int i;
- QString s, e, grp;
+ TQString s, e, grp;
KConfig *conf = kapp->config();
highscore.resize(0);
@@ -519,7 +519,7 @@ void App::readOldHighscore()
HighScore hs;
- QStringList e = conf->readListEntry(s, ' ');
+ TQStringList e = conf->readListEntry(s, ' ');
int nelem = e.count();
hs.x = (*e.at(0)).toInt();
hs.y = (*e.at(1)).toInt();
@@ -570,15 +570,15 @@ void App::readOldHighscore()
void App::writeHighscore()
{
int i;
- QStringList hi_x, hi_y, hi_sec, hi_date, hi_grav, hi_name;
+ TQStringList hi_x, hi_y, hi_sec, hi_date, hi_grav, hi_name;
for(i = 0; i < (int)highscore.size(); i++)
{
HighScore hs = highscore[i];
- hi_x.append(QString::number(hs.x));
- hi_y.append(QString::number(hs.y));
- hi_sec.append(QString::number(hs.seconds));
- hi_date.append(QString::number(hs.date));
- hi_grav.append(QString::number(hs.gravity));
+ hi_x.append(TQString::number(hs.x));
+ hi_y.append(TQString::number(hs.y));
+ hi_sec.append(TQString::number(hs.seconds));
+ hi_date.append(TQString::number(hs.date));
+ hi_grav.append(TQString::number(hs.gravity));
hi_name.append(hs.name);
}
highscoreTable->writeList("x", hi_x);
@@ -593,13 +593,13 @@ void App::writeHighscore()
void App::showHighscore(int focusitem)
{
// this may look a little bit confusing...
- QDialog *dlg = new QDialog(0, "hall_Of_fame", true);
+ TQDialog *dlg = new TQDialog(0, "hall_Of_fame", true);
dlg->setCaption(i18n("Hall of Fame"));
- QVBoxLayout *tl = new QVBoxLayout(dlg, 10);
+ TQVBoxLayout *tl = new TQVBoxLayout(dlg, 10);
- QLabel *l = new QLabel(i18n("Hall of Fame"), dlg);
- QFont f = font();
+ TQLabel *l = new TQLabel(i18n("Hall of Fame"), dlg);
+ TQFont f = font();
f.setPointSize(24);
f.setBold(true);
l->setFont(f);
@@ -609,7 +609,7 @@ void App::showHighscore(int focusitem)
tl->addWidget(l);
// insert highscores in a gridlayout
- QGridLayout *table = new QGridLayout(12, 5, 5);
+ TQGridLayout *table = new TQGridLayout(12, 5, 5);
tl->addLayout(table, 1);
// add a separator line
@@ -619,29 +619,29 @@ void App::showHighscore(int focusitem)
// add titles
f = font();
f.setBold(true);
- l = new QLabel(i18n("Rank"), dlg);
+ l = new TQLabel(i18n("Rank"), dlg);
l->setFont(f);
l->setMinimumSize(l->sizeHint());
table->addWidget(l, 0, 0);
- l = new QLabel(i18n("Name"), dlg);
+ l = new TQLabel(i18n("Name"), dlg);
l->setFont(f);
l->setMinimumSize(l->sizeHint());
table->addWidget(l, 0, 1);
- l = new QLabel(i18n("Time"), dlg);
+ l = new TQLabel(i18n("Time"), dlg);
l->setFont(f);
l->setMinimumSize(l->sizeHint());
table->addWidget(l, 0, 2);
- l = new QLabel(i18n("Size"), dlg);
+ l = new TQLabel(i18n("Size"), dlg);
l->setFont(f);
l->setMinimumSize(l->sizeHint());
table->addWidget(l, 0, 3);
- l = new QLabel(i18n("Score"), dlg);
+ l = new TQLabel(i18n("Score"), dlg);
l->setFont(f);
l->setMinimumSize(l->sizeHint().width()*3, l->sizeHint().height());
table->addWidget(l, 0, 4);
- QString s;
- QLabel *e[10][5];
+ TQString s;
+ TQLabel *e[10][5];
unsigned i, j;
for(i = 0; i < 10; i++)
@@ -652,25 +652,25 @@ void App::showHighscore(int focusitem)
// insert rank
s.sprintf("%d", i+1);
- e[i][0] = new QLabel(s, dlg);
+ e[i][0] = new TQLabel(s, dlg);
// insert name
if(i < highscore.size())
- e[i][1] = new QLabel(hs.name, dlg);
+ e[i][1] = new TQLabel(hs.name, dlg);
else
- e[i][1] = new QLabel("", dlg);
+ e[i][1] = new TQLabel("", dlg);
// insert time
- QTime ti(0,0,0);
+ TQTime ti(0,0,0);
if(i < highscore.size())
{
ti = ti.addSecs(hs.seconds);
s.sprintf("%02d:%02d:%02d", ti.hour(), ti.minute(), ti.second());
- e[i][2] = new QLabel(s, dlg);
+ e[i][2] = new TQLabel(s, dlg);
}
else
{
- e[i][2] = new QLabel("", dlg);
+ e[i][2] = new TQLabel("", dlg);
}
// insert size
@@ -679,21 +679,21 @@ void App::showHighscore(int focusitem)
else
s = "";
- e[i][3] = new QLabel(s, dlg);
+ e[i][3] = new TQLabel(s, dlg);
// insert score
if(i < highscore.size())
{
- s = QString("%1 %2")
+ s = TQString("%1 %2")
.arg(getScore(hs))
- .arg(hs.gravity ? i18n("(gravity)") : QString(""));
+ .arg(hs.gravity ? i18n("(gravity)") : TQString(""));
}
else
{
s = "";
}
- e[i][4] = new QLabel(s, dlg);
+ e[i][4] = new TQLabel(s, dlg);
e[i][4]->setAlignment(AlignRight);
}
@@ -718,12 +718,12 @@ void App::showHighscore(int focusitem)
}
}
- QPushButton *b = new KPushButton(KStdGuiItem::close(), dlg);
+ TQPushButton *b = new KPushButton(KStdGuiItem::close(), dlg);
b->setFixedSize(b->sizeHint());
// connect the "Close"-button to done
- connect(b, SIGNAL(clicked()), dlg, SLOT(accept()));
+ connect(b, TQT_SIGNAL(clicked()), dlg, TQT_SLOT(accept()));
b->setDefault(true);
b->setFocus();
@@ -752,8 +752,8 @@ 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, SIGNAL(settingsChanged()), this, SLOT(loadSettings()));
- connect(dialog, SIGNAL(settingsChanged()), board, SLOT(loadSettings()));
+ connect(dialog, TQT_SIGNAL(settingsChanged()), this, TQT_SLOT(loadSettings()));
+ connect(dialog, TQT_SIGNAL(settingsChanged()), board, TQT_SLOT(loadSettings()));
dialog->show();
}