diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-11 04:58:26 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-11 04:58:26 +0000 |
commit | 838baf3f99ec5ab81b063eb5449a3381d860f377 (patch) | |
tree | dd31abcfde08ca92e4623b8f50b3d762a87c997a /kmines/status.cpp | |
parent | 2bf598bafa22fac4126fc8842df6b0119aadc0e9 (diff) | |
download | tdegames-838baf3f99ec5ab81b063eb5449a3381d860f377.tar.gz tdegames-838baf3f99ec5ab81b063eb5449a3381d860f377.zip |
TQt4 port kdegames
This enables compilation under both Qt3 and Qt4
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdegames@1236074 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kmines/status.cpp')
-rw-r--r-- | kmines/status.cpp | 68 |
1 files changed, 34 insertions, 34 deletions
diff --git a/kmines/status.cpp b/kmines/status.cpp index ec9dfc3e..6d20bf97 100644 --- a/kmines/status.cpp +++ b/kmines/status.cpp @@ -45,16 +45,16 @@ #include "version.h" -Status::Status(TQWidget *parent) - : TQWidget(parent, "status"), _oldLevel(Level::Easy) +tqStatus::tqStatus(TQWidget *tqparent) + : TQWidget(tqparent, "status"), _oldLevel(Level::Easy) { _timer = new TQTimer(this); connect(_timer, TQT_SIGNAL(timeout()), TQT_SLOT(replayStep())); - _solver = new Solver(this); + _solver = new Solver(TQT_TQOBJECT(this)); connect(_solver, TQT_SIGNAL(solvingDone(bool)), TQT_SLOT(solvingDone(bool))); -// top layout +// top tqlayout TQGridLayout *top = new TQGridLayout(this, 2, 5, 10, 10); top->setColStretch(1, 1); top->setColStretch(3, 1); @@ -74,7 +74,7 @@ Status::Status(TQWidget *parent) // smiley smiley = new Smiley(this); connect(smiley, TQT_SIGNAL(clicked()), TQT_SLOT(smileyClicked())); - smiley->setFocusPolicy(TQWidget::NoFocus); + smiley->setFocusPolicy(TQ_NoFocus); TQWhatsThis::add(smiley, i18n("Press to start a new game")); top->addWidget(smiley, 0, 2); @@ -93,7 +93,7 @@ Status::Status(TQWidget *parent) _field = new Field(_fieldContainer); _field->readSettings(); g->addWidget(_field, 0, 0, AlignCenter); - connect( _field, TQT_SIGNAL(updateStatus(bool)), TQT_SLOT(updateStatus(bool)) ); + connect( _field, TQT_SIGNAL(updatetqStatus(bool)), TQT_SLOT(updatetqStatus(bool)) ); connect(_field, TQT_SIGNAL(gameStateChanged(GameState)), TQT_SLOT(gameStateChangedSlot(GameState)) ); connect(_field, TQT_SIGNAL(setMood(Mood)), smiley, TQT_SLOT(setMood(Mood))); @@ -120,13 +120,13 @@ Status::Status(TQWidget *parent) top->addMultiCellWidget(_stack, 1, 1, 0, 4); } -void Status::smileyClicked() +void tqStatus::smileyClicked() { if ( _field->gameState()==Paused ) emit pause(); else restartGame(); } -void Status::newGame(int t) +void tqStatus::newGame(int t) { if ( _field->gameState()==Paused ) emit pause(); Level::Type type = (Level::Type)t; @@ -135,7 +135,7 @@ void Status::newGame(int t) else newGame( Settings::customLevel() ); } -void Status::newGame(const Level &level) +void tqStatus::newGame(const Level &level) { _timer->stop(); if ( level.type()!=Level::Custom ) @@ -143,14 +143,14 @@ void Status::newGame(const Level &level) _field->setLevel(level); } -bool Status::checkBlackMark() +bool tqStatus::checkBlackMark() { bool bm = ( _field->gameState()==Playing ); if (bm) KExtHighscore::submitScore(KExtHighscore::Lost, this); return bm; } -void Status::restartGame() +void tqStatus::restartGame() { if ( _field->gameState()==Paused ) emit pause(); else if ( _field->gameState()==Replaying ) { @@ -162,7 +162,7 @@ void Status::restartGame() } } -void Status::settingsChanged() +void tqStatus::settingsChanged() { _field->readSettings(); @@ -173,7 +173,7 @@ void Status::settingsChanged() newGame(l); } -void Status::updateStatus(bool mine) +void tqStatus::updatetqStatus(bool mine) { int r = _field->nbMines() - _field->nbMarked(); TQColor color = (r<0 && !_field->isSolved() ? red : white); @@ -184,7 +184,7 @@ void Status::updateStatus(bool mine) gameStateChanged(GameOver, true); // ends only for wins } -void Status::setGameOver(bool won) +void tqStatus::setGameOver(bool won) { if ( !won ) KNotifyClient::event(winId(), "explosion", i18n("Explosion!")); @@ -218,16 +218,16 @@ void Status::setGameOver(bool won) f.appendChild(data); } -void Status::setStopped() +void tqStatus::setStopped() { smiley->setMood(Normal); - updateStatus(false); + updatetqStatus(false); bool custom = ( _field->level().type()==Level::Custom ); dg->reset(custom); _field->setSolvingState(Regular); } -void Status::setPlaying() +void tqStatus::setPlaying() { smiley->setMood(Normal); dg->start(); @@ -238,7 +238,7 @@ void Status::setPlaying() _log = TQDomDocument("kmineslog"); _logRoot = _log.createElement("kmineslog"); _logRoot.setAttribute("version", SHORT_VERSION); - TQDateTime date = TQDateTime::currentDateTime(); + TQDateTime date = TQDateTime::tqcurrentDateTime(); _logRoot.setAttribute("date", date.toString(Qt::ISODate)); _logRoot.setAttribute("width", level.width()); _logRoot.setAttribute("height", level.height()); @@ -248,7 +248,7 @@ void Status::setPlaying() _logRoot.appendChild(_logList); } -void Status::gameStateChanged(GameState state, bool won) +void tqStatus::gameStateChanged(GameState state, bool won) { TQWidget *w = _fieldContainer; @@ -280,7 +280,7 @@ void Status::gameStateChanged(GameState state, bool won) emit gameStateChangedSignal(state); } -void Status::addAction(const KGrid2D::Coord &c, Field::ActionType type) +void tqStatus::addAction(const KGrid2D::Coord &c, Field::ActionType type) { TQDomElement action = _log.createElement("Action"); action.setAttribute("time", dg->pretty()); @@ -291,12 +291,12 @@ void Status::addAction(const KGrid2D::Coord &c, Field::ActionType type) dg->addAction(); } -void Status::advise() +void tqStatus::advise() { int res = KMessageBox::warningContinueCancel(this, i18n("When the solver gives " "you advice, your score will not be added to the highscores."), - TQString::null, TQString::null, "advice_warning"); + TQString(), TQString(), "advice_warning"); if ( res==KMessageBox::Cancel ) return; dg->setCheating(); float probability; @@ -304,25 +304,25 @@ void Status::advise() _field->setAdvised(c, probability); } -void Status::solve() +void tqStatus::solve() { dg->setCheating(); _solver->solve(*_field, false); _field->setSolvingState(Solved); } -void Status::solvingDone(bool success) +void tqStatus::solvingDone(bool success) { if ( !success ) gameStateChanged(GameOver, false); } -void Status::solveRate() +void tqStatus::solveRate() { SolvingRateDialog sd(*_field, this); sd.exec(); } -void Status::viewLog() +void tqStatus::viewLog() { KDialogBase d(this, "view_log", true, i18n("View Game Log"), KDialogBase::Close, KDialogBase::Close); @@ -335,9 +335,9 @@ void Status::viewLog() d.exec(); } -void Status::saveLog() +void tqStatus::saveLog() { - KURL url = KFileDialog::getSaveURL(TQString::null, TQString::null, this); + KURL url = KFileDialog::getSaveURL(TQString(), TQString(), this); if ( url.isEmpty() ) return; if ( KIO::NetAccess::exists(url, false, this) ) { KGuiItem gi = KStdGuiItem::save(); @@ -354,9 +354,9 @@ void Status::saveLog() tmp.unlink(); } -void Status::loadLog() +void tqStatus::loadLog() { - KURL url = KFileDialog::getOpenURL(TQString::null, TQString::null, this); + KURL url = KFileDialog::getOpenURL(TQString(), TQString(), this); if ( url.isEmpty() ) return; TQString tmpFile; bool success = false; @@ -368,7 +368,7 @@ void Status::loadLog() bool ok = doc.setContent(&file, 0, &errorLine); if ( !ok ) { KMessageBox::sorry(this, i18n("Cannot read XML file on line %1") - .arg(errorLine)); + .tqarg(errorLine)); return; } success = true; @@ -390,7 +390,7 @@ void Status::loadLog() } } -bool Status::checkLog(const TQDomDocument &doc) +bool tqStatus::checkLog(const TQDomDocument &doc) { // check root element if ( doc.doctype().name()!="kmineslog" ) return false; @@ -435,7 +435,7 @@ bool Status::checkLog(const TQDomDocument &doc) } -void Status::replayLog() +void tqStatus::replayLog() { uint w = _logRoot.attribute("width").toUInt(); uint h = _logRoot.attribute("height").toUInt(); @@ -454,7 +454,7 @@ void Status::replayLog() _timer->start(500); } -void Status::replayStep() +void tqStatus::replayStep() { if ( _index>=_actions.count() ) { _timer->stop(); |