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 | |
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')
-rw-r--r-- | kmines/dialogs.cpp | 8 | ||||
-rw-r--r-- | kmines/dialogs.h | 11 | ||||
-rw-r--r-- | kmines/field.cpp | 8 | ||||
-rw-r--r-- | kmines/field.h | 7 | ||||
-rw-r--r-- | kmines/frame.cpp | 66 | ||||
-rw-r--r-- | kmines/frame.h | 8 | ||||
-rw-r--r-- | kmines/highscores.cpp | 6 | ||||
-rw-r--r-- | kmines/kzoommainwindow.cpp | 10 | ||||
-rw-r--r-- | kmines/kzoommainwindow.h | 3 | ||||
-rw-r--r-- | kmines/main.cpp | 36 | ||||
-rw-r--r-- | kmines/main.h | 7 | ||||
-rw-r--r-- | kmines/solver/advFastRules.cpp | 26 | ||||
-rw-r--r-- | kmines/solver/headerP.h | 2 | ||||
-rw-r--r-- | kmines/solver/solver.cpp | 18 | ||||
-rw-r--r-- | kmines/solver/solver.h | 8 | ||||
-rw-r--r-- | kmines/status.cpp | 68 | ||||
-rw-r--r-- | kmines/status.h | 7 |
17 files changed, 156 insertions, 143 deletions
diff --git a/kmines/dialogs.cpp b/kmines/dialogs.cpp index ad956c30..a81c8d91 100644 --- a/kmines/dialogs.cpp +++ b/kmines/dialogs.cpp @@ -61,8 +61,8 @@ void Smiley::setMood(Mood mood) } //----------------------------------------------------------------------------- -DigitalClock::DigitalClock(TQWidget *parent) -: KGameLCDClock(parent, "digital_clock") +DigitalClock::DigitalClock(TQWidget *tqparent) +: KGameLCDClock(tqparent, "digital_clock") { setFrameStyle(Panel | Sunken); setDefaultBackgroundColor(black); @@ -165,7 +165,7 @@ void CustomConfig::updateNbMines() Level l(_width->value(), _height->value(), _mines->value()); _mines->setRange(1, Level::maxNbMines(l.width(), l.height())); _mines->setLabel(i18n("Mines (%1%):") - .arg( (100*l.nbMines()) / (l.width() * l.height()) )); + .tqarg( (100*l.nbMines()) / (l.width() * l.height()) )); _gameType->setCurrentItem(l.type()); _block = false; } @@ -249,7 +249,7 @@ GameConfig::GameConfig() void GameConfig::magicModified(bool on) { if ( !_magicDialogEnabled || !on ) return; - KMessageBox::information(this, i18n("When the \"magic\" reveal is on, you lose the ability to enter the highscores."), TQString::null, "magic_reveal_warning"); + KMessageBox::information(this, i18n("When the \"magic\" reveal is on, you lose the ability to enter the highscores."), TQString(), "magic_reveal_warning"); } //----------------------------------------------------------------------------- diff --git a/kmines/dialogs.h b/kmines/dialogs.h index 15321a49..f900f7e6 100644 --- a/kmines/dialogs.h +++ b/kmines/dialogs.h @@ -34,9 +34,10 @@ class KIntNumInput; class Smiley : public TQPushButton, public KMines { Q_OBJECT + TQ_OBJECT public: - Smiley(TQWidget *parent, const char *name = 0) - : TQPushButton(TQString::null, parent, name) {} + Smiley(TQWidget *tqparent, const char *name = 0) + : TQPushButton(TQString(), tqparent, name) {} public slots: void setMood(Mood); @@ -49,8 +50,9 @@ class Smiley : public TQPushButton, public KMines class DigitalClock : public KGameLCDClock { Q_OBJECT + TQ_OBJECT public: - DigitalClock(TQWidget *parent); + DigitalClock(TQWidget *tqparent); void reset(bool customGame); @@ -76,6 +78,7 @@ class DigitalClock : public KGameLCDClock class CustomConfig : public TQWidget, public KMines { Q_OBJECT + TQ_OBJECT public: CustomConfig(); @@ -100,6 +103,7 @@ class CustomConfig : public TQWidget, public KMines class GameConfig : public TQWidget, public KMines { Q_OBJECT + TQ_OBJECT public: GameConfig(); @@ -118,6 +122,7 @@ class GameConfig : public TQWidget, public KMines class AppearanceConfig : public TQWidget, public KMines { Q_OBJECT + TQ_OBJECT public: AppearanceConfig(); }; diff --git a/kmines/field.cpp b/kmines/field.cpp index ff3b4e46..582e6663 100644 --- a/kmines/field.cpp +++ b/kmines/field.cpp @@ -44,8 +44,8 @@ const Field::ActionData Field::ACTION_DATA[Nb_Actions] = { { "UnsetUncertain", "unset_uncertain", I18N_NOOP("Question mark unset") } }; -Field::Field(TQWidget *parent) - : FieldFrame(parent), _state(Init), _solvingState(Regular), _level(Level::Easy) +Field::Field(TQWidget *tqparent) + : FieldFrame(tqparent), _state(Init), _solvingState(Regular), _level(Level::Easy) {} void Field::readSettings() @@ -57,7 +57,7 @@ void Field::readSettings() if ( Settings::magicReveal() ) emit setCheating(); } -TQSize Field::sizeHint() const +TQSize Field::tqsizeHint() const { return TQSize(2*frameWidth() + _level.width()*Settings::caseSize(), 2*frameWidth() + _level.height()*Settings::caseSize()); @@ -117,7 +117,7 @@ void Field::changeCase(const Coord &p, CaseState newState) BaseField::changeCase(p, newState); TQPainter painter(this); drawCase(painter, p); - if ( isActive() ) emit updateStatus( hasMine(p) ); + if ( isActive() ) emit updatetqStatus( hasMine(p) ); } TQPoint Field::toPoint(const Coord &p) const diff --git a/kmines/field.h b/kmines/field.h index 7e079d65..4d17358f 100644 --- a/kmines/field.h +++ b/kmines/field.h @@ -27,6 +27,7 @@ class Field : public FieldFrame, public BaseField { Q_OBJECT + TQ_OBJECT public: enum ActionType { Reveal = 0, AutoReveal, SetFlag, UnsetFlag, SetUncertain, UnsetUncertain, Nb_Actions }; @@ -36,9 +37,9 @@ class Field : public FieldFrame, public BaseField static const ActionData ACTION_DATA[Nb_Actions]; public: - Field(TQWidget *parent); + Field(TQWidget *tqparent); - virtual TQSize sizeHint() const; + virtual TQSize tqsizeHint() const; void setLevel(const Level &level); void setReplayField(const TQString &field); @@ -67,7 +68,7 @@ class Field : public FieldFrame, public BaseField SolvingState solvingState() const { return _solvingState; } signals: - void updateStatus(bool); + void updatetqStatus(bool); void gameStateChanged(GameState); void setMood(Mood); void setCheating(); diff --git a/kmines/frame.cpp b/kmines/frame.cpp index 6c9446c2..7c712383 100644 --- a/kmines/frame.cpp +++ b/kmines/frame.cpp @@ -26,8 +26,8 @@ #include "settings.h" -FieldFrame::FieldFrame(TQWidget *parent) - : TQFrame(parent, "field"), _button(0) +FieldFrame::FieldFrame(TQWidget *tqparent) + : TQFrame(tqparent, "field"), _button(0) { setFrameStyle( TQFrame::Box | TQFrame::Raised ); setLineWidth(2); @@ -36,65 +36,67 @@ FieldFrame::FieldFrame(TQWidget *parent) void FieldFrame::adjustSize() { - setFixedSize(sizeHint()); + setFixedSize(tqsizeHint()); _button.resize(Settings::caseSize(), Settings::caseSize()); - TQBitmap mask; + TQBitmap tqmask; for (uint i=0; i<Nb_Pixmap_Types; i++) { - drawPixmap(mask, (PixmapType)i, true); + TQPixmap tqmask_pm = tqmask; + drawPixmap(tqmask_pm, (PixmapType)i, true); drawPixmap(_pixmaps[i], (PixmapType)i, false); - _pixmaps[i].setMask(mask); + _pixmaps[i].setMask(tqmask); } for (uint i=0; i<Nb_Advised; i++) { - drawAdvised(mask, i, true); + TQPixmap tqmask_pm = tqmask; + drawAdvised(tqmask_pm, i, true); drawAdvised(_advised[i], i, false); - _advised[i].setMask(mask); + _advised[i].setMask(tqmask); } TQFont f = font(); - f.setPointSize(QMAX(1, Settings::caseSize()-6)); + f.setPointSize(TQMAX(1, Settings::caseSize()-6)); f.setBold(true); setFont(f); } -void FieldFrame::initPixmap(TQPixmap &pix, bool mask) const +void FieldFrame::initPixmap(TQPixmap &pix, bool tqmask) const { pix.resize(Settings::caseSize(), Settings::caseSize()); - if (mask) pix.fill(color0); + if (tqmask) pix.fill(color0); } -void FieldFrame::drawPixmap(TQPixmap &pix, PixmapType type, bool mask) const +void FieldFrame::drawPixmap(TQPixmap &pix, PixmapType type, bool tqmask) const { - initPixmap(pix, mask); + initPixmap(pix, tqmask); TQPainter p(&pix); if ( type==FlagPixmap ) { p.setWindow(0, 0, 16, 16); - p.setPen( (mask ? color1 : black) ); + p.setPen( (tqmask ? color1 : black) ); p.drawLine(6, 13, 14, 13); p.drawLine(8, 12, 12, 12); p.drawLine(9, 11, 11, 11); p.drawLine(10, 2, 10, 10); - if (!mask) p.setPen(black); - p.setBrush( (mask ? color1 : Settings::color(Settings::EnumType::flag)) ); + if (!tqmask) p.setPen(black); + p.setBrush( (tqmask ? color1 : Settings::color(Settings::EnumType::flag)) ); p.drawRect(4, 3, 6, 5); return; } p.setWindow(0, 0, 20, 20); if ( type==ExplodedPixmap ) - p.fillRect(2, 2, 16, 16, (mask ? color1 : Settings::color(Settings::EnumType::explosion))); - TQPen pen(mask ? color1 : black, 1); + p.fillRect(2, 2, 16, 16, (tqmask ? color1 : Settings::color(Settings::EnumType::explosion))); + TQPen pen(tqmask ? color1 : black, 1); p.setPen(pen); - p.setBrush(mask ? color1 : black); + p.setBrush(tqmask ? color1 : black); p.drawLine(10,3,10,18); p.drawLine(3,10,18,10); p.drawLine(5, 5, 16, 16); p.drawLine(5, 15, 15, 5); p.drawEllipse(5, 5, 11, 11); - p.fillRect(8, 8, 2, 2, (mask ? color1 : white)); + p.fillRect(8, 8, 2, 2, (tqmask ? color1 : white)); if ( type==ErrorPixmap ) { - if (!mask) { + if (!tqmask) { pen.setColor(Settings::color(Settings::EnumType::error)); p.setPen(pen); } @@ -107,12 +109,12 @@ void FieldFrame::drawPixmap(TQPixmap &pix, PixmapType type, bool mask) const } } -void FieldFrame::drawAdvised(TQPixmap &pix, uint i, bool mask) const +void FieldFrame::drawAdvised(TQPixmap &pix, uint i, bool tqmask) const { - initPixmap(pix, mask); + initPixmap(pix, tqmask); TQPainter p(&pix); p.setWindow(0, 0, 16, 16); - p.setPen( TQPen(mask ? color1 : Settings::mineColor(i), 2) ); + p.setPen( TQPen(tqmask ? color1 : Settings::mineColor(i), 2) ); p.drawRect(3, 3, 11, 11); } @@ -122,22 +124,22 @@ void FieldFrame::drawBox(TQPainter &painter, const TQPoint &p, bool hasFocus) const { qDrawShadePanel(&painter, p.x(), p.y(), _button.width(), _button.height(), - colorGroup(), pressed, 2, - &colorGroup().brush(TQColorGroup::Background)); + tqcolorGroup(), pressed, 2, + &tqcolorGroup().brush(TQColorGroup::Background)); if (hasFocus) { painter.translate(p.x(), p.y()); - TQRect fbr = style().subRect(TQStyle::SR_PushButtonFocusRect, &_button); - style().drawPrimitive(TQStyle::PE_FocusRect, &painter, fbr, - colorGroup(), TQStyle::Style_Enabled); + TQRect fbr = tqstyle().subRect(TQStyle::SR_PushButtonFocusRect, &_button); + tqstyle().tqdrawPrimitive(TQStyle::PE_FocusRect, &painter, fbr, + tqcolorGroup(), TQStyle::Style_Enabled); painter.resetXForm(); } TQRect r(p, _button.size()); const TQPixmap *pixmap = (type==NoPixmap ? 0 : &_pixmaps[type]); TQColor color = (nbMines==0 ? black : Settings::mineColor(nbMines-1)); - style().drawItem(&painter, r, AlignCenter, colorGroup(), true, pixmap, + tqstyle().drawItem(&painter, r, AlignCenter, tqcolorGroup(), true, pixmap, text, -1, &color); if ( advised!=-1 ) - style().drawItem(&painter, r, AlignCenter, colorGroup(), true, - &_advised[advised], TQString::null); + tqstyle().drawItem(&painter, r, AlignCenter, tqcolorGroup(), true, + &_advised[advised], TQString()); } diff --git a/kmines/frame.h b/kmines/frame.h index 18efb76b..a271eb90 100644 --- a/kmines/frame.h +++ b/kmines/frame.h @@ -30,7 +30,7 @@ class TQPainter; class FieldFrame : public TQFrame, public KMines { public: - FieldFrame(TQWidget *parent); + FieldFrame(TQWidget *tqparent); protected: enum PixmapType { FlagPixmap = 0, MinePixmap, ExplodedPixmap, @@ -48,9 +48,9 @@ class FieldFrame : public TQFrame, public KMines TQPixmap _pixmaps[Nb_Pixmap_Types]; TQPixmap _advised[Nb_Advised]; - void drawPixmap(TQPixmap &, PixmapType, bool mask) const; - void drawAdvised(TQPixmap &, uint i, bool mask) const; - void initPixmap(TQPixmap &, bool mask) const; + void drawPixmap(TQPixmap &, PixmapType, bool tqmask) const; + void drawAdvised(TQPixmap &, uint i, bool tqmask) const; + void initPixmap(TQPixmap &, bool tqmask) const; }; #endif diff --git a/kmines/highscores.cpp b/kmines/highscores.cpp index 565e9bf7..51c2ab9b 100644 --- a/kmines/highscores.cpp +++ b/kmines/highscores.cpp @@ -42,7 +42,7 @@ ExtManager::ExtManager() s.duplicate(RANGE, 16); setScoreHistogram(s, ScoreBound); - Item *item = new Item((uint)0, i18n("Clicks"), Qt::AlignRight); + Item *item = new Item((uint)0, i18n("Clicks"), TQt::AlignRight); addScoreItem("nb_actions", item); } @@ -55,7 +55,7 @@ TQString ExtManager::gameTypeLabel(uint gameType, LabelType type) const case I18N: return i18n(Level::LABELS[gameType]); case WW: return data.wwLabel; } - return TQString::null; + return TQString(); } void ExtManager::convertLegacy(uint gameType) @@ -69,7 +69,7 @@ void ExtManager::convertLegacy(uint gameType) } KConfigGroupSaver cg(kapp->config(), group); - TQString name = cg.config()->readEntry("Name", TQString::null); + TQString name = cg.config()->readEntry("Name", TQString()); if ( name.isNull() ) return; if ( name.isEmpty() ) name = i18n("anonymous"); uint minutes = cg.config()->readUnsignedNumEntry("Min", 0); diff --git a/kmines/kzoommainwindow.cpp b/kmines/kzoommainwindow.cpp index 4e1b85a5..1d0f5319 100644 --- a/kmines/kzoommainwindow.cpp +++ b/kmines/kzoommainwindow.cpp @@ -30,11 +30,11 @@ KZoomMainWindow::KZoomMainWindow(uint min, uint max, uint step, const char *name { installEventFilter(this); - _zoomInAction = KStdAction::zoomIn(this, TQT_SLOT(zoomIn()), actionCollection()); + _zoomInAction = KStdAction::zoomIn(TQT_TQOBJECT(this), TQT_SLOT(zoomIn()), actionCollection()); _zoomOutAction = - KStdAction::zoomOut(this, TQT_SLOT(zoomOut()), actionCollection()); + KStdAction::zoomOut(TQT_TQOBJECT(this), TQT_SLOT(zoomOut()), actionCollection()); _menu = - KStdAction::showMenubar(this, TQT_SLOT(toggleMenubar()), actionCollection()); + KStdAction::showMenubar(TQT_TQOBJECT(this), TQT_SLOT(toggleMenubar()), actionCollection()); } void KZoomMainWindow::init(const char *popupName) @@ -58,7 +58,7 @@ void KZoomMainWindow::init(const char *popupName) void KZoomMainWindow::addWidget(TQWidget *widget) { widget->adjustSize(); - TQWidget *tlw = widget->topLevelWidget(); + TQWidget *tlw = widget->tqtopLevelWidget(); KZoomMainWindow *zm = static_cast<KZoomMainWindow *>(tlw->qt_cast("KZoomMainWindow")); Q_ASSERT(zm); @@ -74,7 +74,7 @@ void KZoomMainWindow::widgetDestroyed() bool KZoomMainWindow::eventFilter(TQObject *o, TQEvent *e) { if ( e->type()==TQEvent::LayoutHint ) - setFixedSize(minimumSize()); // because K/QMainWindow + setFixedSize(tqminimumSize()); // because K/TQMainWindow // does not manage fixed central widget // with hidden menubar... return KMainWindow::eventFilter(o, e); diff --git a/kmines/kzoommainwindow.h b/kmines/kzoommainwindow.h index d5c80bd4..e4353c2d 100644 --- a/kmines/kzoommainwindow.h +++ b/kmines/kzoommainwindow.h @@ -42,6 +42,7 @@ class KToggleAction; class KZoomMainWindow : public KMainWindow { Q_OBJECT + TQ_OBJECT public: /** Constructor. */ KZoomMainWindow(uint minZoom, uint maxZoom, uint zoomStep, @@ -49,7 +50,7 @@ public: /** Add a widget to be managed i.e. the adjustSize() method of the * widget is called whenever the zoom is changed. - * This function assumes that the topLevelWidget() is the KZoomMainWindow. + * This function assumes that the tqtopLevelWidget() is the KZoomMainWindow. */ static void addWidget(TQWidget *widget); diff --git a/kmines/main.cpp b/kmines/main.cpp index 6752e7a5..cead0eab 100644 --- a/kmines/main.cpp +++ b/kmines/main.cpp @@ -62,34 +62,34 @@ MainWidget::MainWidget() { KNotifyClient::startDaemon(); - _status = new Status(this); + _status = new tqStatus(this); connect(_status, TQT_SIGNAL(gameStateChangedSignal(KMines::GameState)), TQT_SLOT(gameStateChanged(KMines::GameState))); connect(_status, TQT_SIGNAL(pause()), TQT_SLOT(pause())); // Game & Popup - KStdGameAction::gameNew(_status, TQT_SLOT(restartGame()), actionCollection()); - _pause = KStdGameAction::pause(_status, TQT_SLOT(pauseGame()), + KStdGameAction::gameNew(TQT_TQOBJECT(_status), TQT_SLOT(restartGame()), actionCollection()); + _pause = KStdGameAction::pause(TQT_TQOBJECT(_status), TQT_SLOT(pauseGame()), actionCollection()); - KStdGameAction::highscores(this, TQT_SLOT(showHighscores()), + KStdGameAction::highscores(TQT_TQOBJECT(this), TQT_SLOT(showHighscores()), actionCollection()); - KStdGameAction::quit(qApp, TQT_SLOT(quit()), actionCollection()); + KStdGameAction::quit(TQT_TQOBJECT(tqApp), TQT_SLOT(quit()), actionCollection()); // keyboard _keybCollection = new KActionCollection(this); for (uint i=0; i<NB_KEYS; i++) { const KeyData &d = KEY_DATA[i]; - (void)new KAction(i18n(d.label), d.keycode, _status, + (void)new KAction(i18n(d.label), d.keycode, TQT_TQOBJECT(_status), d.slot, _keybCollection, d.name); } // Settings - KStdAction::preferences(this, TQT_SLOT(configureSettings()), + KStdAction::preferences(TQT_TQOBJECT(this), TQT_SLOT(configureSettings()), actionCollection()); - KStdAction::keyBindings(this, TQT_SLOT(configureKeys()), actionCollection()); - KStdAction::configureNotifications(this, TQT_SLOT(configureNotifications()), + KStdAction::keyBindings(TQT_TQOBJECT(this), TQT_SLOT(configureKeys()), actionCollection()); + KStdAction::configureNotifications(TQT_TQOBJECT(this), TQT_SLOT(configureNotifications()), actionCollection()); - KStdGameAction::configureHighscores(this, TQT_SLOT(configureHighscores()), + KStdGameAction::configureHighscores(TQT_TQOBJECT(this), TQT_SLOT(configureHighscores()), actionCollection()); // Levels _levels = KStdGameAction::chooseGameType(0, 0, actionCollection()); @@ -97,27 +97,27 @@ MainWidget::MainWidget() for (uint i=0; i<=Level::NB_TYPES; i++) list += i18n(Level::LABELS[i]); _levels->setItems(list); - connect(_levels, TQT_SIGNAL(activated(int)), _status, TQT_SLOT(newGame(int))); + connect(_levels, TQT_SIGNAL(activated(int)), TQT_TQOBJECT(_status), TQT_SLOT(newGame(int))); // Adviser _advise = - KStdGameAction::hint(_status, TQT_SLOT(advise()), actionCollection()); - _solve = KStdGameAction::solve(_status, TQT_SLOT(solve()), actionCollection()); - (void)new KAction(i18n("Solving Rate..."), 0, _status, TQT_SLOT(solveRate()), + KStdGameAction::hint(TQT_TQOBJECT(_status), TQT_SLOT(advise()), actionCollection()); + _solve = KStdGameAction::solve(TQT_TQOBJECT(_status), TQT_SLOT(solve()), actionCollection()); + (void)new KAction(i18n("Solving Rate..."), 0, TQT_TQOBJECT(_status), TQT_SLOT(solveRate()), actionCollection(), "solve_rate"); // Log (void)new KAction(KGuiItem(i18n("View Log"), "viewmag"), 0, - _status, TQT_SLOT(viewLog()), + TQT_TQOBJECT(_status), TQT_SLOT(viewLog()), actionCollection(), "log_view"); (void)new KAction(KGuiItem(i18n("Replay Log"), "player_play"), - 0, _status, TQT_SLOT(replayLog()), + 0, TQT_TQOBJECT(_status), TQT_SLOT(replayLog()), actionCollection(), "log_replay"); (void)new KAction(KGuiItem(i18n("Save Log..."), "filesave"), 0, - _status, TQT_SLOT(saveLog()), + TQT_TQOBJECT(_status), TQT_SLOT(saveLog()), actionCollection(), "log_save"); (void)new KAction(KGuiItem(i18n("Load Log..."), "fileopen"), 0, - _status, TQT_SLOT(loadLog()), + TQT_TQOBJECT(_status), TQT_SLOT(loadLog()), actionCollection(), "log_load"); setupGUI( KMainWindow::Save | Create ); diff --git a/kmines/main.h b/kmines/main.h index 8cae018a..7fb10eda 100644 --- a/kmines/main.h +++ b/kmines/main.h @@ -26,11 +26,12 @@ class KAction; class KToggleAction; class KSelectAction; -class Status; +class tqStatus; class MainWidget : public KZoomMainWindow, public KMines { Q_OBJECT + TQ_OBJECT public: MainWidget(); @@ -49,7 +50,7 @@ class MainWidget : public KZoomMainWindow, public KMines virtual bool queryExit(); private: - Status *_status; + tqStatus *_status; KToggleAction *_pause; KSelectAction *_levels; KAction *_advise, *_solve; @@ -57,7 +58,7 @@ class MainWidget : public KZoomMainWindow, public KMines struct KeyData { const char *label, *name; - Qt::Key keycode; + TQt::Key keycode; const char *slot; }; enum Key { NB_KEYS = 11 }; diff --git a/kmines/solver/advFastRules.cpp b/kmines/solver/advFastRules.cpp index 79c42bba..56b97b72 100644 --- a/kmines/solver/advFastRules.cpp +++ b/kmines/solver/advFastRules.cpp @@ -159,9 +159,9 @@ void AdviseFast::RuleSet::addGeneral(Coord p){ int AdviseFast::Rule::leaks = 0; #endif -AdviseFast::Rule::Rule(RuleSet *parent) : - _parent(parent), - _facts(parent->facts) +AdviseFast::Rule::Rule(RuleSet *tqparent) : + _parent(tqparent), + _facts(tqparent->facts) { #if defined(DEBUG) && DEBUG >= 2 cout << "Rule::Rule, leaks = " << ++leaks << endl; @@ -177,8 +177,8 @@ AdviseFast::Rule::~Rule() AdviseFast::GeneralRule::GeneralRule( Coord fact, - RuleSet *parent) : - Rule(parent), + RuleSet *tqparent) : + Rule(tqparent), _fact(fact) {} @@ -242,8 +242,8 @@ bool AdviseFast::GeneralRule::apply(CoordSet *) AdviseFast::EmptyRule::EmptyRule( Coord fact, - RuleSet *parent) : - Rule(parent), + RuleSet *tqparent) : + Rule(tqparent), _fact(fact) {} @@ -285,8 +285,8 @@ bool AdviseFast::EmptyRule::apply( AdviseFast::FullRule::FullRule( Coord fact, - RuleSet *parent) : - Rule(parent), + RuleSet *tqparent) : + Rule(tqparent), _fact(fact) {} @@ -336,8 +336,8 @@ bool AdviseFast::FullRule::apply( AdviseFast::InclusionRule::InclusionRule( Coord bigger, Coord smaller, - RuleSet *parent) : - Rule(parent), + RuleSet *tqparent) : + Rule(tqparent), _bigger(bigger), _smaller(smaller) {} @@ -402,8 +402,8 @@ bool AdviseFast::InclusionRule::apply( AdviseFast::IntersectionRule::IntersectionRule( Coord bigger, Coord smaller, - RuleSet *parent) : - Rule(parent), + RuleSet *tqparent) : + Rule(tqparent), _bigger(bigger), _smaller(smaller) {} diff --git a/kmines/solver/headerP.h b/kmines/solver/headerP.h index 984e3113..6cecd458 100644 --- a/kmines/solver/headerP.h +++ b/kmines/solver/headerP.h @@ -107,7 +107,7 @@ namespace AdviseFast { */ class RuleSet; struct Rule { - Rule(RuleSet *parent); + Rule(RuleSet *tqparent); virtual ~Rule(); virtual bool apply(CoordSet *surePoints) = 0; diff --git a/kmines/solver/solver.cpp b/kmines/solver/solver.cpp index f8607b79..36519043 100644 --- a/kmines/solver/solver.cpp +++ b/kmines/solver/solver.cpp @@ -50,8 +50,8 @@ class SolverPrivate #endif }; -Solver::Solver(TQObject *parent) - : TQObject(parent) +Solver::Solver(TQObject *tqparent) + : TQObject(tqparent) { d = new SolverPrivate; @@ -186,9 +186,9 @@ bool Solver::solveOneStep(BaseField &field) //----------------------------------------------------------------------------- -SolvingRateDialog::SolvingRateDialog(const BaseField &field, TQWidget *parent) +SolvingRateDialog::SolvingRateDialog(const BaseField &field, TQWidget *tqparent) : KDialogBase(Plain, i18n("Compute Solving Rate"), Ok|Close, - Close, parent, "compute_solving_rate", true, true), + Close, tqparent, "compute_solving_rate", true, true), _refField(field) { connect(&_solver, TQT_SIGNAL(solvingDone(bool)), TQT_SLOT(solvingDone(bool))); @@ -198,13 +198,13 @@ SolvingRateDialog::SolvingRateDialog(const BaseField &field, TQWidget *parent) setButtonOK(item); TQVBoxLayout *top = new TQVBoxLayout(plainPage(), 0, spacingHint()); - TQLabel *label = new TQLabel(i18n("Width: %1").arg(field.width()), + TQLabel *label = new TQLabel(i18n("Width: %1").tqarg(field.width()), plainPage()); top->addWidget(label); - label = new TQLabel(i18n("Height: %1").arg(field.height()), plainPage()); + label = new TQLabel(i18n("Height: %1").tqarg(field.height()), plainPage()); top->addWidget(label); - label = new TQLabel(i18n("Mines: %1 (%2%)").arg(field.nbMines()) - .arg( field.nbMines() * 100.0 / field.size()), + label = new TQLabel(i18n("Mines: %1 (%2%)").tqarg(field.nbMines()) + .tqarg( field.nbMines() * 100.0 / field.size()), plainPage()); top->addWidget(label); @@ -243,7 +243,7 @@ void SolvingRateDialog::solvingDone(bool success) { if (success) _success++; _label->setText(i18n("Success rate: %1%") - .arg(_success * 100.0 / _i, 0, 'f', 3)); + .tqarg(_success * 100.0 / _i, 0, 'f', 3)); _progress->advance(1); TQTimer::singleShot(0, this, TQT_SLOT(step())); } diff --git a/kmines/solver/solver.h b/kmines/solver/solver.h index c90c56d1..07b8881a 100644 --- a/kmines/solver/solver.h +++ b/kmines/solver/solver.h @@ -29,11 +29,12 @@ class TQLabel; class KProgress; class SolverPrivate; -class Solver : public QObject +class Solver : public TQObject { Q_OBJECT + TQ_OBJECT public: - Solver(TQObject *parent = 0); + Solver(TQObject *tqparent = 0); ~Solver(); /** A method to advice a point placement */ @@ -62,8 +63,9 @@ class Solver : public QObject class SolvingRateDialog : public KDialogBase { Q_OBJECT + TQ_OBJECT public: - SolvingRateDialog(const BaseField &field, TQWidget *parent); + SolvingRateDialog(const BaseField &field, TQWidget *tqparent); private slots: void step(); 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(); diff --git a/kmines/status.h b/kmines/status.h index c7d44b36..3626473a 100644 --- a/kmines/status.h +++ b/kmines/status.h @@ -30,11 +30,12 @@ class Solver; class TQWidgetStack; class TQTimer; -class Status : public TQWidget, public KMines +class tqStatus : public TQWidget, public KMines { Q_OBJECT + TQ_OBJECT public : - Status(TQWidget *parent); + tqStatus(TQWidget *tqparent); const Level ¤tLevel() const { return _field->level(); } bool isPlaying() const { return _field->gameState()==Playing; } @@ -50,7 +51,7 @@ class Status : public TQWidget, public KMines public slots: void newGame(int type); void restartGame(); - void updateStatus(bool); + void updatetqStatus(bool); void pauseGame() { _field->pause(); } void moveUp() { _field->moveCursor(KGrid2D::SquareBase::Up); } |