diff options
Diffstat (limited to 'kmines')
-rw-r--r-- | kmines/defines.h | 2 | ||||
-rw-r--r-- | kmines/dialogs.cpp | 82 | ||||
-rw-r--r-- | kmines/dialogs.h | 16 | ||||
-rw-r--r-- | kmines/field.cpp | 52 | ||||
-rw-r--r-- | kmines/field.h | 22 | ||||
-rw-r--r-- | kmines/frame.cpp | 52 | ||||
-rw-r--r-- | kmines/frame.h | 26 | ||||
-rw-r--r-- | kmines/highscores.cpp | 10 | ||||
-rw-r--r-- | kmines/highscores.h | 2 | ||||
-rw-r--r-- | kmines/kzoommainwindow.cpp | 24 | ||||
-rw-r--r-- | kmines/kzoommainwindow.h | 6 | ||||
-rw-r--r-- | kmines/main.cpp | 74 | ||||
-rw-r--r-- | kmines/main.h | 2 | ||||
-rw-r--r-- | kmines/solver/bfield.cpp | 8 | ||||
-rw-r--r-- | kmines/solver/bfield.h | 8 | ||||
-rw-r--r-- | kmines/solver/solver.cpp | 30 | ||||
-rw-r--r-- | kmines/solver/solver.h | 6 | ||||
-rw-r--r-- | kmines/solver/test.cpp | 2 | ||||
-rw-r--r-- | kmines/status.cpp | 128 | ||||
-rw-r--r-- | kmines/status.h | 20 |
20 files changed, 286 insertions, 286 deletions
diff --git a/kmines/defines.h b/kmines/defines.h index 145a29cc..0a2074e4 100644 --- a/kmines/defines.h +++ b/kmines/defines.h @@ -19,7 +19,7 @@ #ifndef DEFINES_H #define DEFINES_H -#include <qcolor.h> +#include <tqcolor.h> class Level diff --git a/kmines/dialogs.cpp b/kmines/dialogs.cpp index d02b2eea..ad956c30 100644 --- a/kmines/dialogs.cpp +++ b/kmines/dialogs.cpp @@ -19,16 +19,16 @@ #include "dialogs.h" #include "dialogs.moc" -#include <qpixmap.h> -#include <qvgroupbox.h> -#include <qlayout.h> -#include <qhbox.h> -#include <qvbox.h> -#include <qgrid.h> -#include <qlabel.h> -#include <qtimer.h> -#include <qwhatsthis.h> -#include <qcheckbox.h> +#include <tqpixmap.h> +#include <tqvgroupbox.h> +#include <tqlayout.h> +#include <tqhbox.h> +#include <tqvbox.h> +#include <tqgrid.h> +#include <tqlabel.h> +#include <tqtimer.h> +#include <tqwhatsthis.h> +#include <tqcheckbox.h> #include <klocale.h> #include <kmessagebox.h> @@ -56,12 +56,12 @@ const char **Smiley::XPM_NAMES[NbMoods] = { void Smiley::setMood(Mood mood) { - QPixmap p(XPM_NAMES[mood]); + TQPixmap p(XPM_NAMES[mood]); setPixmap(p); } //----------------------------------------------------------------------------- -DigitalClock::DigitalClock(QWidget *parent) +DigitalClock::DigitalClock(TQWidget *parent) : KGameLCDClock(parent, "digital_clock") { setFrameStyle(Panel | Sunken); @@ -120,40 +120,40 @@ const uint CustomConfig::maxHeight = 50; const uint CustomConfig::minHeight = 5; CustomConfig::CustomConfig() - : QWidget(0, "custom_config_widget"), _block(false) + : TQWidget(0, "custom_config_widget"), _block(false) { - QVBoxLayout *top = new QVBoxLayout(this, KDialog::spacingHint()); + TQVBoxLayout *top = new TQVBoxLayout(this, KDialog::spacingHint()); _width = new KIntNumInput(this, "kcfg_CustomWidth"); _width->setLabel(i18n("Width:")); _width->setRange(minWidth, maxWidth); - connect(_width, SIGNAL(valueChanged(int)), SLOT(updateNbMines())); + connect(_width, TQT_SIGNAL(valueChanged(int)), TQT_SLOT(updateNbMines())); top->addWidget(_width); _height = new KIntNumInput(this, "kcfg_CustomHeight"); _height->setLabel(i18n("Height:")); _height->setRange(minWidth, maxWidth); - connect(_height, SIGNAL(valueChanged(int)), SLOT(updateNbMines())); + connect(_height, TQT_SIGNAL(valueChanged(int)), TQT_SLOT(updateNbMines())); top->addWidget(_height); _mines = new KIntNumInput(this, "kcfg_CustomMines"); _mines->setLabel(i18n("No. of mines:")); _mines->setRange(1, Level::maxNbMines(maxWidth, maxHeight)); - connect(_mines, SIGNAL(valueChanged(int)), SLOT(updateNbMines())); + connect(_mines, TQT_SIGNAL(valueChanged(int)), TQT_SLOT(updateNbMines())); top->addWidget(_mines); top->addSpacing(2 * KDialog::spacingHint()); // combo to choose level - QHBoxLayout *hbox = new QHBoxLayout(top); - QLabel *label = new QLabel(i18n("Choose level:"), this); + TQHBoxLayout *hbox = new TQHBoxLayout(top); + TQLabel *label = new TQLabel(i18n("Choose level:"), this); hbox->addWidget(label); _gameType = new KComboBox(false, this); - connect(_gameType, SIGNAL(activated(int)), SLOT(typeChosen(int))); + connect(_gameType, TQT_SIGNAL(activated(int)), TQT_SLOT(typeChosen(int))); for (uint i=0; i<=Level::NB_TYPES; i++) _gameType->insertItem(i18n(Level::LABELS[i])); hbox->addWidget(_gameType); - hbox->addWidget(new QWidget(this), 1); + hbox->addWidget(new TQWidget(this), 1); top->addStretch(1); } @@ -209,34 +209,34 @@ static const char *MOUSE_ACTION_LABELS[Settings::EnumMouseAction::COUNT-1] = { }; GameConfig::GameConfig() - : QWidget(0, "game_config_widget"), _magicDialogEnabled(false) + : TQWidget(0, "game_config_widget"), _magicDialogEnabled(false) { - QVBoxLayout *top = new QVBoxLayout(this, KDialog::spacingHint()); + TQVBoxLayout *top = new TQVBoxLayout(this, KDialog::spacingHint()); - QCheckBox *cb = new QCheckBox(i18n("Enable ? mark"), this, "kcfg_UncertainMark"); + TQCheckBox *cb = new TQCheckBox(i18n("Enable ? mark"), this, "kcfg_UncertainMark"); top->addWidget(cb); - cb = new QCheckBox(i18n("Enable keyboard"), this, "kcfg_KeyboardGame"); + cb = new TQCheckBox(i18n("Enable keyboard"), this, "kcfg_KeyboardGame"); top->addWidget(cb); - cb = new QCheckBox(i18n("Pause if window loses focus"), this, "kcfg_PauseFocus"); + cb = new TQCheckBox(i18n("Pause if window loses focus"), this, "kcfg_PauseFocus"); top->addWidget(cb); - cb = new QCheckBox(i18n("\"Magic\" reveal"), this, "kcfg_MagicReveal"); - QWhatsThis::add(cb, i18n("Set flags and reveal squares where they are trivial.")); - connect(cb, SIGNAL(toggled(bool)), SLOT(magicModified(bool))); + cb = new TQCheckBox(i18n("\"Magic\" reveal"), this, "kcfg_MagicReveal"); + TQWhatsThis::add(cb, i18n("Set flags and reveal squares where they are trivial.")); + connect(cb, TQT_SIGNAL(toggled(bool)), TQT_SLOT(magicModified(bool))); top->addWidget(cb); top->addSpacing(2 * KDialog::spacingHint()); - QHBoxLayout *hbox = new QHBoxLayout(top); - QVGroupBox *gb = new QVGroupBox(i18n("Mouse Bindings"), this); + TQHBoxLayout *hbox = new TQHBoxLayout(top); + TQVGroupBox *gb = new TQVGroupBox(i18n("Mouse Bindings"), this); hbox->addWidget(gb); - QGrid *grid = new QGrid(2, gb); + TQGrid *grid = new TQGrid(2, gb); grid->setSpacing(KDialog::spacingHint()); for (uint i=0; i< Settings::EnumButton::COUNT; i++) { - (void)new QLabel(i18n(MOUSE_BUTTON_LABELS[i]), grid); - QComboBox *cb = new QComboBox(false, grid, MOUSE_CONFIG_NAMES[i]); + (void)new TQLabel(i18n(MOUSE_BUTTON_LABELS[i]), grid); + TQComboBox *cb = new TQComboBox(false, grid, MOUSE_CONFIG_NAMES[i]); for (uint k=0; k< (Settings::EnumMouseAction::COUNT-1); k++) cb->insertItem(i18n(MOUSE_ACTION_LABELS[k])); cb->setCurrentItem(i); @@ -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."), QString::null, "magic_reveal_warning"); + KMessageBox::information(this, i18n("When the \"magic\" reveal is on, you lose the ability to enter the highscores."), TQString::null, "magic_reveal_warning"); } //----------------------------------------------------------------------------- @@ -269,21 +269,21 @@ static const char *N_COLOR_CONFIG_NAMES[KMines::NB_N_COLORS] = { }; AppearanceConfig::AppearanceConfig() - : QWidget(0, "appearance_config_widget") + : TQWidget(0, "appearance_config_widget") { - QVBoxLayout *top = new QVBoxLayout(this, KDialog::spacingHint()); + TQVBoxLayout *top = new TQVBoxLayout(this, KDialog::spacingHint()); - QHBoxLayout *hbox = new QHBoxLayout(top); - QGrid *grid = new QGrid(2, this); + TQHBoxLayout *hbox = new TQHBoxLayout(top); + TQGrid *grid = new TQGrid(2, this); grid->setSpacing(KDialog::spacingHint()); hbox->addWidget(grid); for (uint i=0; i<Settings::EnumType::COUNT; i++) { - (void)new QLabel(i18n(COLOR_LABELS[i]), grid); + (void)new TQLabel(i18n(COLOR_LABELS[i]), grid); KColorButton *cb = new KColorButton(grid, COLOR_CONFIG_NAMES[i]); cb->setFixedWidth(100); } for (uint i=0; i<NB_N_COLORS; i++) { - (void)new QLabel(i18n("%n mine color:", "%n mines color:", i+1), grid); + (void)new TQLabel(i18n("%n mine color:", "%n mines color:", i+1), grid); KColorButton *cb = new KColorButton(grid, N_COLOR_CONFIG_NAMES[i]); cb->setFixedWidth(100); } diff --git a/kmines/dialogs.h b/kmines/dialogs.h index 12dde5ac..15321a49 100644 --- a/kmines/dialogs.h +++ b/kmines/dialogs.h @@ -19,7 +19,7 @@ #ifndef DIALOGS_H #define DIALOGS_H -#include <qpushbutton.h> +#include <tqpushbutton.h> #include <kgamelcd.h> #include <kexthighscore.h> @@ -31,12 +31,12 @@ class KComboBox; class KIntNumInput; //----------------------------------------------------------------------------- -class Smiley : public QPushButton, public KMines +class Smiley : public TQPushButton, public KMines { Q_OBJECT public: - Smiley(QWidget *parent, const char *name = 0) - : QPushButton(QString::null, parent, name) {} + Smiley(TQWidget *parent, const char *name = 0) + : TQPushButton(TQString::null, parent, name) {} public slots: void setMood(Mood); @@ -50,7 +50,7 @@ class DigitalClock : public KGameLCDClock { Q_OBJECT public: - DigitalClock(QWidget *parent); + DigitalClock(TQWidget *parent); void reset(bool customGame); @@ -73,7 +73,7 @@ class DigitalClock : public KGameLCDClock }; //----------------------------------------------------------------------------- -class CustomConfig : public QWidget, public KMines +class CustomConfig : public TQWidget, public KMines { Q_OBJECT public: @@ -97,7 +97,7 @@ class CustomConfig : public QWidget, public KMines }; //----------------------------------------------------------------------------- -class GameConfig : public QWidget, public KMines +class GameConfig : public TQWidget, public KMines { Q_OBJECT public: @@ -115,7 +115,7 @@ class GameConfig : public QWidget, public KMines }; -class AppearanceConfig : public QWidget, public KMines +class AppearanceConfig : public TQWidget, public KMines { Q_OBJECT public: diff --git a/kmines/field.cpp b/kmines/field.cpp index 1f3b3dfd..ff3b4e46 100644 --- a/kmines/field.cpp +++ b/kmines/field.cpp @@ -21,9 +21,9 @@ #include <math.h> -#include <qlayout.h> -#include <qtimer.h> -#include <qpainter.h> +#include <tqlayout.h> +#include <tqtimer.h> +#include <tqpainter.h> #include <klocale.h> #include <knotifyclient.h> @@ -44,22 +44,22 @@ const Field::ActionData Field::ACTION_DATA[Nb_Actions] = { { "UnsetUncertain", "unset_uncertain", I18N_NOOP("Question mark unset") } }; -Field::Field(QWidget *parent) +Field::Field(TQWidget *parent) : FieldFrame(parent), _state(Init), _solvingState(Regular), _level(Level::Easy) {} void Field::readSettings() { if ( inside(_cursor) ) { - QPainter p(this); + TQPainter p(this); drawCase(p, _cursor); } if ( Settings::magicReveal() ) emit setCheating(); } -QSize Field::sizeHint() const +TQSize Field::sizeHint() const { - return QSize(2*frameWidth() + _level.width()*Settings::caseSize(), + return TQSize(2*frameWidth() + _level.width()*Settings::caseSize(), 2*frameWidth() + _level.height()*Settings::caseSize()); } @@ -70,7 +70,7 @@ void Field::setLevel(const Level &level) adjustSize(); } -void Field::setReplayField(const QString &field) +void Field::setReplayField(const TQString &field) { setState(Replaying); initReplay(field); @@ -97,9 +97,9 @@ void Field::reset(bool init) update(); } -void Field::paintEvent(QPaintEvent *e) +void Field::paintEvent(TQPaintEvent *e) { - QPainter painter(this); + TQPainter painter(this); drawFrame(&painter); if ( _state==Paused ) return; @@ -115,27 +115,27 @@ void Field::paintEvent(QPaintEvent *e) void Field::changeCase(const Coord &p, CaseState newState) { BaseField::changeCase(p, newState); - QPainter painter(this); + TQPainter painter(this); drawCase(painter, p); if ( isActive() ) emit updateStatus( hasMine(p) ); } -QPoint Field::toPoint(const Coord &p) const +TQPoint Field::toPoint(const Coord &p) const { - QPoint qp; + TQPoint qp; qp.setX( p.first*Settings::caseSize() + frameWidth() ); qp.setY( p.second*Settings::caseSize() + frameWidth() ); return qp; } -Coord Field::fromPoint(const QPoint &qp) const +Coord Field::fromPoint(const TQPoint &qp) const { double i = (double)(qp.x() - frameWidth()) / Settings::caseSize(); double j = (double)(qp.y() - frameWidth()) / Settings::caseSize(); return Coord((int)floor(i), (int)floor(j)); } -int Field::mapMouseButton(QMouseEvent *e) const +int Field::mapMouseButton(TQMouseEvent *e) const { switch (e->button()) { case Qt::LeftButton: return Settings::mouseAction(Settings::EnumButton::left); @@ -162,7 +162,7 @@ void Field::revealActions(bool press) } } -void Field::mousePressEvent(QMouseEvent *e) +void Field::mousePressEvent(TQMouseEvent *e) { if ( !isActive() || (_currentAction!=Settings::EnumMouseAction::None) ) return; @@ -175,7 +175,7 @@ void Field::mousePressEvent(QMouseEvent *e) revealActions(true); } -void Field::mouseReleaseEvent(QMouseEvent *e) +void Field::mouseReleaseEvent(TQMouseEvent *e) { if ( !isActive() ) return; @@ -199,7 +199,7 @@ void Field::mouseReleaseEvent(QMouseEvent *e) } } -void Field::mouseMoveEvent(QMouseEvent *e) +void Field::mouseMoveEvent(TQMouseEvent *e) { if ( !isActive() ) return; @@ -215,7 +215,7 @@ void Field::mouseMoveEvent(QMouseEvent *e) void Field::pressCase(const Coord &c, bool pressed) { if ( state(c)==Covered ) { - QPainter painter(this); + TQPainter painter(this); drawCase(painter, c, pressed); } } @@ -224,7 +224,7 @@ void Field::pressClearFunction(const Coord &p, bool pressed) { pressCase(p, pressed); CoordList n = coveredNeighbours(p); - QPainter painter(this); + TQPainter painter(this); for (CoordList::const_iterator it=n.begin(); it!=n.end(); ++it) drawCase(painter, *it, pressed); } @@ -233,7 +233,7 @@ void Field::keyboardAutoReveal() { _cursor_back = _cursor; pressClearFunction(_cursor_back, true); - QTimer::singleShot(50, this, SLOT(keyboardAutoRevealSlot())); + TQTimer::singleShot(50, this, TQT_SLOT(keyboardAutoRevealSlot())); } void Field::keyboardAutoRevealSlot() @@ -385,7 +385,7 @@ void Field::placeCursor(const Coord &p) Coord old = _cursor; _cursor = p; if ( Settings::keyboardGame() ) { - QPainter painter(this); + TQPainter painter(this); drawCase(painter, old); drawCase(painter, _cursor); } @@ -394,7 +394,7 @@ void Field::placeCursor(const Coord &p) void Field::resetAdvised() { if ( !inside(_advisedCoord) ) return; - QPainter p(this); + TQPainter p(this); Coord tmp = _advisedCoord; _advisedCoord = Coord(-1, -1); drawCase(p, tmp); @@ -407,16 +407,16 @@ void Field::setAdvised(const Coord &c, double proba) _advisedCoord = c; _advisedProba = proba; if ( inside(c) ) { - QPainter p(this); + TQPainter p(this); drawCase(p, c); } } -void Field::drawCase(QPainter &painter, const Coord &c, bool pressed) const +void Field::drawCase(TQPainter &painter, const Coord &c, bool pressed) const { Q_ASSERT( inside(c) ); - QString text; + TQString text; uint nbMines = 0; PixmapType type = NoPixmap; diff --git a/kmines/field.h b/kmines/field.h index 32b959fe..7e079d65 100644 --- a/kmines/field.h +++ b/kmines/field.h @@ -36,12 +36,12 @@ class Field : public FieldFrame, public BaseField static const ActionData ACTION_DATA[Nb_Actions]; public: - Field(QWidget *parent); + Field(TQWidget *parent); - virtual QSize sizeHint() const; + virtual TQSize sizeHint() const; void setLevel(const Level &level); - void setReplayField(const QString &field); + void setReplayField(const TQString &field); const Level &level() const { return _level; } void reset(bool init); @@ -74,10 +74,10 @@ class Field : public FieldFrame, public BaseField void addAction(const KGrid2D::Coord &, Field::ActionType); protected: - void paintEvent(QPaintEvent *); - void mousePressEvent(QMouseEvent *); - void mouseReleaseEvent(QMouseEvent *); - void mouseMoveEvent(QMouseEvent *); + void paintEvent(TQPaintEvent *); + void mousePressEvent(TQMouseEvent *); + void mouseReleaseEvent(TQMouseEvent *); + void mouseMoveEvent(TQMouseEvent *); private slots: void keyboardAutoRevealSlot(); @@ -104,13 +104,13 @@ class Field : public FieldFrame, public BaseField void changeCase(const KGrid2D::Coord &, CaseState newState); void addMarkAction(const KGrid2D::Coord &, CaseState newS, CaseState oldS); - QPoint toPoint(const KGrid2D::Coord &) const; - KGrid2D::Coord fromPoint(const QPoint &) const; + TQPoint toPoint(const KGrid2D::Coord &) const; + KGrid2D::Coord fromPoint(const TQPoint &) const; - void drawCase(QPainter &, const KGrid2D::Coord &, + void drawCase(TQPainter &, const KGrid2D::Coord &, bool forcePressed = false) const; - int mapMouseButton(QMouseEvent *) const; + int mapMouseButton(TQMouseEvent *) const; void resetAdvised(); void setState(GameState); }; diff --git a/kmines/frame.cpp b/kmines/frame.cpp index a502b87d..6c9446c2 100644 --- a/kmines/frame.cpp +++ b/kmines/frame.cpp @@ -18,18 +18,18 @@ #include "frame.h" -#include <qpainter.h> -#include <qbitmap.h> -#include <qstyle.h> -#include <qdrawutil.h> +#include <tqpainter.h> +#include <tqbitmap.h> +#include <tqstyle.h> +#include <tqdrawutil.h> #include "settings.h" -FieldFrame::FieldFrame(QWidget *parent) - : QFrame(parent, "field"), _button(0) +FieldFrame::FieldFrame(TQWidget *parent) + : TQFrame(parent, "field"), _button(0) { - setFrameStyle( QFrame::Box | QFrame::Raised ); + setFrameStyle( TQFrame::Box | TQFrame::Raised ); setLineWidth(2); setMidLineWidth(2); } @@ -39,7 +39,7 @@ void FieldFrame::adjustSize() setFixedSize(sizeHint()); _button.resize(Settings::caseSize(), Settings::caseSize()); - QBitmap mask; + TQBitmap mask; for (uint i=0; i<Nb_Pixmap_Types; i++) { drawPixmap(mask, (PixmapType)i, true); drawPixmap(_pixmaps[i], (PixmapType)i, false); @@ -51,22 +51,22 @@ void FieldFrame::adjustSize() _advised[i].setMask(mask); } - QFont f = font(); + TQFont f = font(); f.setPointSize(QMAX(1, Settings::caseSize()-6)); f.setBold(true); setFont(f); } -void FieldFrame::initPixmap(QPixmap &pix, bool mask) const +void FieldFrame::initPixmap(TQPixmap &pix, bool mask) const { pix.resize(Settings::caseSize(), Settings::caseSize()); if (mask) pix.fill(color0); } -void FieldFrame::drawPixmap(QPixmap &pix, PixmapType type, bool mask) const +void FieldFrame::drawPixmap(TQPixmap &pix, PixmapType type, bool mask) const { initPixmap(pix, mask); - QPainter p(&pix); + TQPainter p(&pix); if ( type==FlagPixmap ) { p.setWindow(0, 0, 16, 16); @@ -84,7 +84,7 @@ void FieldFrame::drawPixmap(QPixmap &pix, PixmapType type, bool mask) const p.setWindow(0, 0, 20, 20); if ( type==ExplodedPixmap ) p.fillRect(2, 2, 16, 16, (mask ? color1 : Settings::color(Settings::EnumType::explosion))); - QPen pen(mask ? color1 : black, 1); + TQPen pen(mask ? color1 : black, 1); p.setPen(pen); p.setBrush(mask ? color1 : black); p.drawLine(10,3,10,18); @@ -107,37 +107,37 @@ void FieldFrame::drawPixmap(QPixmap &pix, PixmapType type, bool mask) const } } -void FieldFrame::drawAdvised(QPixmap &pix, uint i, bool mask) const +void FieldFrame::drawAdvised(TQPixmap &pix, uint i, bool mask) const { initPixmap(pix, mask); - QPainter p(&pix); + TQPainter p(&pix); p.setWindow(0, 0, 16, 16); - p.setPen( QPen(mask ? color1 : Settings::mineColor(i), 2) ); + p.setPen( TQPen(mask ? color1 : Settings::mineColor(i), 2) ); p.drawRect(3, 3, 11, 11); } -void FieldFrame::drawBox(QPainter &painter, const QPoint &p, - bool pressed, PixmapType type, const QString &text, +void FieldFrame::drawBox(TQPainter &painter, const TQPoint &p, + bool pressed, PixmapType type, const TQString &text, uint nbMines, int advised, bool hasFocus) const { qDrawShadePanel(&painter, p.x(), p.y(), _button.width(), _button.height(), colorGroup(), pressed, 2, - &colorGroup().brush(QColorGroup::Background)); + &colorGroup().brush(TQColorGroup::Background)); if (hasFocus) { painter.translate(p.x(), p.y()); - QRect fbr = style().subRect(QStyle::SR_PushButtonFocusRect, &_button); - style().drawPrimitive(QStyle::PE_FocusRect, &painter, fbr, - colorGroup(), QStyle::Style_Enabled); + TQRect fbr = style().subRect(TQStyle::SR_PushButtonFocusRect, &_button); + style().drawPrimitive(TQStyle::PE_FocusRect, &painter, fbr, + colorGroup(), TQStyle::Style_Enabled); painter.resetXForm(); } - QRect r(p, _button.size()); - const QPixmap *pixmap = (type==NoPixmap ? 0 : &_pixmaps[type]); - QColor color = (nbMines==0 ? black : Settings::mineColor(nbMines-1)); + 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, text, -1, &color); if ( advised!=-1 ) style().drawItem(&painter, r, AlignCenter, colorGroup(), true, - &_advised[advised], QString::null); + &_advised[advised], TQString::null); } diff --git a/kmines/frame.h b/kmines/frame.h index 91dc1541..280b94c4 100644 --- a/kmines/frame.h +++ b/kmines/frame.h @@ -19,18 +19,18 @@ #ifndef FRAME_H #define FRAME_H -#include <qframe.h> -#include <qpixmap.h> -#include <qpushbutton.h> +#include <tqframe.h> +#include <tqpixmap.h> +#include <tqpushbutton.h> #include "defines.h" class QPainter; -class FieldFrame : public QFrame, public KMines +class FieldFrame : public TQFrame, public KMines { public: - FieldFrame(QWidget *parent); + FieldFrame(TQWidget *parent); protected: enum PixmapType { FlagPixmap = 0, MinePixmap, ExplodedPixmap, @@ -38,19 +38,19 @@ class FieldFrame : public QFrame, public KMines NoPixmap = Nb_Pixmap_Types }; enum { Nb_Advised = 5 }; - void drawBox(QPainter &, const QPoint &, bool pressed, - PixmapType, const QString &text, + void drawBox(TQPainter &, const TQPoint &, bool pressed, + PixmapType, const TQString &text, uint nbMines, int advised, bool hasFocus) const; virtual void adjustSize(); private: - QPushButton _button; - QPixmap _pixmaps[Nb_Pixmap_Types]; - QPixmap _advised[Nb_Advised]; + TQPushButton _button; + TQPixmap _pixmaps[Nb_Pixmap_Types]; + TQPixmap _advised[Nb_Advised]; - void drawPixmap(QPixmap &, PixmapType, bool mask) const; - void drawAdvised(QPixmap &, uint i, bool mask) const; - void initPixmap(QPixmap &, bool mask) const; + void drawPixmap(TQPixmap &, PixmapType, bool mask) const; + void drawAdvised(TQPixmap &, uint i, bool mask) const; + void initPixmap(TQPixmap &, bool mask) const; }; #endif diff --git a/kmines/highscores.cpp b/kmines/highscores.cpp index c0e40c10..565e9bf7 100644 --- a/kmines/highscores.cpp +++ b/kmines/highscores.cpp @@ -38,7 +38,7 @@ ExtManager::ExtManager() setShowStatistics(true); const uint RANGE[16] = { 1, 3120, 3180, 3240, 3300, 3360, 3420, 3480, 3510, 3540, 3550, 3560, 3570, 3580, 3590, 3600 }; - QMemArray<uint> s; + TQMemArray<uint> s; s.duplicate(RANGE, 16); setScoreHistogram(s, ScoreBound); @@ -46,7 +46,7 @@ ExtManager::ExtManager() addScoreItem("nb_actions", item); } -QString ExtManager::gameTypeLabel(uint gameType, LabelType type) const +TQString ExtManager::gameTypeLabel(uint gameType, LabelType type) const { const Level::Data &data = Level::DATA[gameType]; switch (type) { @@ -55,12 +55,12 @@ QString ExtManager::gameTypeLabel(uint gameType, LabelType type) const case I18N: return i18n(Level::LABELS[gameType]); case WW: return data.wwLabel; } - return QString::null; + return TQString::null; } void ExtManager::convertLegacy(uint gameType) { - QString group; + TQString group; switch ((Level::Type)gameType) { case Level::Easy: group = "Easy level"; break; case Level::Normal: group = "Normal level"; break; @@ -69,7 +69,7 @@ void ExtManager::convertLegacy(uint gameType) } KConfigGroupSaver cg(kapp->config(), group); - QString name = cg.config()->readEntry("Name", QString::null); + TQString name = cg.config()->readEntry("Name", TQString::null); if ( name.isNull() ) return; if ( name.isEmpty() ) name = i18n("anonymous"); uint minutes = cg.config()->readUnsignedNumEntry("Min", 0); diff --git a/kmines/highscores.h b/kmines/highscores.h index d1f577a7..5de69535 100644 --- a/kmines/highscores.h +++ b/kmines/highscores.h @@ -31,7 +31,7 @@ class KDE_EXPORT ExtManager : public Manager ExtManager(); private: - QString gameTypeLabel(uint gameTye, LabelType) const; + TQString gameTypeLabel(uint gameTye, LabelType) const; void convertLegacy(uint gameType); bool isStrictlyLess(const Score &s1, const Score &s2) const; }; diff --git a/kmines/kzoommainwindow.cpp b/kmines/kzoommainwindow.cpp index 115d5175..4e1b85a5 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, SLOT(zoomIn()), actionCollection()); + _zoomInAction = KStdAction::zoomIn(this, TQT_SLOT(zoomIn()), actionCollection()); _zoomOutAction = - KStdAction::zoomOut(this, SLOT(zoomOut()), actionCollection()); + KStdAction::zoomOut(this, TQT_SLOT(zoomOut()), actionCollection()); _menu = - KStdAction::showMenubar(this, SLOT(toggleMenubar()), actionCollection()); + KStdAction::showMenubar(this, TQT_SLOT(toggleMenubar()), actionCollection()); } void KZoomMainWindow::init(const char *popupName) @@ -48,32 +48,32 @@ void KZoomMainWindow::init(const char *popupName) // context popup if (popupName) { - QPopupMenu *popup = - static_cast<QPopupMenu *>(factory()->container(popupName, this)); + TQPopupMenu *popup = + static_cast<TQPopupMenu *>(factory()->container(popupName, this)); Q_ASSERT(popup); if (popup) KContextMenuManager::insert(this, popup); } } -void KZoomMainWindow::addWidget(QWidget *widget) +void KZoomMainWindow::addWidget(TQWidget *widget) { widget->adjustSize(); - QWidget *tlw = widget->topLevelWidget(); + TQWidget *tlw = widget->topLevelWidget(); KZoomMainWindow *zm = static_cast<KZoomMainWindow *>(tlw->qt_cast("KZoomMainWindow")); Q_ASSERT(zm); zm->_widgets.append(widget); - connect(widget, SIGNAL(destroyed()), zm, SLOT(widgetDestroyed())); + connect(widget, TQT_SIGNAL(destroyed()), zm, TQT_SLOT(widgetDestroyed())); } void KZoomMainWindow::widgetDestroyed() { - _widgets.remove(static_cast<const QWidget *>(sender())); + _widgets.remove(static_cast<const TQWidget *>(sender())); } -bool KZoomMainWindow::eventFilter(QObject *o, QEvent *e) +bool KZoomMainWindow::eventFilter(TQObject *o, TQEvent *e) { - if ( e->type()==QEvent::LayoutHint ) + if ( e->type()==TQEvent::LayoutHint ) setFixedSize(minimumSize()); // because K/QMainWindow // does not manage fixed central widget // with hidden menubar... @@ -84,7 +84,7 @@ void KZoomMainWindow::setZoom(uint zoom) { _zoom = zoom; writeZoomSetting(_zoom); - QPtrListIterator<QWidget> it(_widgets); + TQPtrListIterator<TQWidget> it(_widgets); for (; it.current(); ++it) (*it)->adjustSize();; _zoomOutAction->setEnabled( _zoom>_minZoom ); diff --git a/kmines/kzoommainwindow.h b/kmines/kzoommainwindow.h index da8ec96c..d5c80bd4 100644 --- a/kmines/kzoommainwindow.h +++ b/kmines/kzoommainwindow.h @@ -51,7 +51,7 @@ public: * widget is called whenever the zoom is changed. * This function assumes that the topLevelWidget() is the KZoomMainWindow. */ - static void addWidget(QWidget *widget); + static void addWidget(TQWidget *widget); uint zoom() const { return _zoom; } @@ -69,7 +69,7 @@ protected: void init(const char *popupName = 0); virtual void setZoom(uint zoom); - virtual bool eventFilter(QObject *o, QEvent *e); + virtual bool eventFilter(TQObject *o, TQEvent *e); virtual bool queryExit(); /** You need to implement this method since different application @@ -115,7 +115,7 @@ private slots: private: uint _zoom, _zoomStep, _minZoom, _maxZoom; - QPtrList<QWidget> _widgets; + TQPtrList<TQWidget> _widgets; KAction *_zoomInAction, *_zoomOutAction; KToggleAction *_menu; diff --git a/kmines/main.cpp b/kmines/main.cpp index 52620887..6752e7a5 100644 --- a/kmines/main.cpp +++ b/kmines/main.cpp @@ -19,7 +19,7 @@ #include "main.h" #include "main.moc" -#include <qptrvector.h> +#include <tqptrvector.h> #include <kaccel.h> #include <kapplication.h> @@ -43,17 +43,17 @@ #include "dialogs.h" const MainWidget::KeyData MainWidget::KEY_DATA[NB_KEYS] = { -{I18N_NOOP("Move Up"), "keyboard_moveup", Key_Up, SLOT(moveUp())}, -{I18N_NOOP("Move Down"), "keyboard_movedown", Key_Down, SLOT(moveDown())}, -{I18N_NOOP("Move Right"), "keyboard_moveright", Key_Right, SLOT(moveRight())}, -{I18N_NOOP("Move Left"), "keyboard_moveleft", Key_Left, SLOT(moveLeft())}, -{I18N_NOOP("Move at Left Edge"), "keyboard_leftedge", Key_Home, SLOT(moveLeftEdge())}, -{I18N_NOOP("Move at Right Edge"), "keyboard_rightedge", Key_End, SLOT(moveRightEdge())}, -{I18N_NOOP("Move at Top Edge"), "keyboard_topedge", Key_PageUp, SLOT(moveTop())}, -{I18N_NOOP("Move at Bottom Edge"), "keyboard_bottomedge", Key_PageDown, SLOT(moveBottom())}, -{I18N_NOOP("Reveal Mine"), "keyboard_revealmine", Key_Space, SLOT(reveal())}, -{I18N_NOOP("Mark Mine"), "keyboard_markmine", Key_W, SLOT(mark())}, -{I18N_NOOP("Automatic Reveal"), "keyboard_autoreveal", Key_Return, SLOT(autoReveal())} +{I18N_NOOP("Move Up"), "keyboard_moveup", Key_Up, TQT_SLOT(moveUp())}, +{I18N_NOOP("Move Down"), "keyboard_movedown", Key_Down, TQT_SLOT(moveDown())}, +{I18N_NOOP("Move Right"), "keyboard_moveright", Key_Right, TQT_SLOT(moveRight())}, +{I18N_NOOP("Move Left"), "keyboard_moveleft", Key_Left, TQT_SLOT(moveLeft())}, +{I18N_NOOP("Move at Left Edge"), "keyboard_leftedge", Key_Home, TQT_SLOT(moveLeftEdge())}, +{I18N_NOOP("Move at Right Edge"), "keyboard_rightedge", Key_End, TQT_SLOT(moveRightEdge())}, +{I18N_NOOP("Move at Top Edge"), "keyboard_topedge", Key_PageUp, TQT_SLOT(moveTop())}, +{I18N_NOOP("Move at Bottom Edge"), "keyboard_bottomedge", Key_PageDown, TQT_SLOT(moveBottom())}, +{I18N_NOOP("Reveal Mine"), "keyboard_revealmine", Key_Space, TQT_SLOT(reveal())}, +{I18N_NOOP("Mark Mine"), "keyboard_markmine", Key_W, TQT_SLOT(mark())}, +{I18N_NOOP("Automatic Reveal"), "keyboard_autoreveal", Key_Return, TQT_SLOT(autoReveal())} }; @@ -63,17 +63,17 @@ MainWidget::MainWidget() KNotifyClient::startDaemon(); _status = new Status(this); - connect(_status, SIGNAL(gameStateChangedSignal(KMines::GameState)), - SLOT(gameStateChanged(KMines::GameState))); - connect(_status, SIGNAL(pause()), SLOT(pause())); + 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, SLOT(restartGame()), actionCollection()); - _pause = KStdGameAction::pause(_status, SLOT(pauseGame()), + KStdGameAction::gameNew(_status, TQT_SLOT(restartGame()), actionCollection()); + _pause = KStdGameAction::pause(_status, TQT_SLOT(pauseGame()), actionCollection()); - KStdGameAction::highscores(this, SLOT(showHighscores()), + KStdGameAction::highscores(this, TQT_SLOT(showHighscores()), actionCollection()); - KStdGameAction::quit(qApp, SLOT(quit()), actionCollection()); + KStdGameAction::quit(qApp, TQT_SLOT(quit()), actionCollection()); // keyboard _keybCollection = new KActionCollection(this); @@ -84,40 +84,40 @@ MainWidget::MainWidget() } // Settings - KStdAction::preferences(this, SLOT(configureSettings()), + KStdAction::preferences(this, TQT_SLOT(configureSettings()), actionCollection()); - KStdAction::keyBindings(this, SLOT(configureKeys()), actionCollection()); - KStdAction::configureNotifications(this, SLOT(configureNotifications()), + KStdAction::keyBindings(this, TQT_SLOT(configureKeys()), actionCollection()); + KStdAction::configureNotifications(this, TQT_SLOT(configureNotifications()), actionCollection()); - KStdGameAction::configureHighscores(this, SLOT(configureHighscores()), + KStdGameAction::configureHighscores(this, TQT_SLOT(configureHighscores()), actionCollection()); // Levels _levels = KStdGameAction::chooseGameType(0, 0, actionCollection()); - QStringList list; + TQStringList list; for (uint i=0; i<=Level::NB_TYPES; i++) list += i18n(Level::LABELS[i]); _levels->setItems(list); - connect(_levels, SIGNAL(activated(int)), _status, SLOT(newGame(int))); + connect(_levels, TQT_SIGNAL(activated(int)), _status, TQT_SLOT(newGame(int))); // Adviser _advise = - KStdGameAction::hint(_status, SLOT(advise()), actionCollection()); - _solve = KStdGameAction::solve(_status, SLOT(solve()), actionCollection()); - (void)new KAction(i18n("Solving Rate..."), 0, _status, SLOT(solveRate()), + 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()), actionCollection(), "solve_rate"); // Log (void)new KAction(KGuiItem(i18n("View Log"), "viewmag"), 0, - _status, SLOT(viewLog()), + _status, TQT_SLOT(viewLog()), actionCollection(), "log_view"); (void)new KAction(KGuiItem(i18n("Replay Log"), "player_play"), - 0, _status, SLOT(replayLog()), + 0, _status, TQT_SLOT(replayLog()), actionCollection(), "log_replay"); (void)new KAction(KGuiItem(i18n("Save Log..."), "filesave"), 0, - _status, SLOT(saveLog()), + _status, TQT_SLOT(saveLog()), actionCollection(), "log_save"); (void)new KAction(KGuiItem(i18n("Load Log..."), "fileopen"), 0, - _status, SLOT(loadLog()), + _status, TQT_SLOT(loadLog()), actionCollection(), "log_load"); setupGUI( KMainWindow::Save | Create ); @@ -146,9 +146,9 @@ void MainWidget::showHighscores() KExtHighscore::show(this); } -void MainWidget::focusOutEvent(QFocusEvent *e) +void MainWidget::focusOutEvent(TQFocusEvent *e) { - if ( Settings::pauseFocus() && e->reason()==QFocusEvent::ActiveWindow + if ( Settings::pauseFocus() && e->reason()==TQFocusEvent::ActiveWindow && _status->isPlaying() ) pause(); KMainWindow::focusOutEvent(e); } @@ -163,7 +163,7 @@ void MainWidget::configureSettings() dialog->addPage(new AppearanceConfig, i18n("Appearance"), "style"); CustomConfig *cc = new CustomConfig; dialog->addPage(cc, i18n("Custom Game"), "package_settings"); - connect(dialog, SIGNAL(settingsChanged()), SLOT(settingsChanged())); + connect(dialog, TQT_SIGNAL(settingsChanged()), TQT_SLOT(settingsChanged())); dialog->show(); cc->init(); gc->init(); @@ -177,8 +177,8 @@ void MainWidget::configureHighscores() void MainWidget::settingsChanged() { bool enabled = Settings::keyboardGame(); - QValueList<KAction *> list = _keybCollection->actions(); - QValueList<KAction *>::Iterator it; + TQValueList<KAction *> list = _keybCollection->actions(); + TQValueList<KAction *>::Iterator it; for (it = list.begin(); it!=list.end(); ++it) (*it)->setEnabled(enabled); _status->settingsChanged(); diff --git a/kmines/main.h b/kmines/main.h index 21ec28b1..8cae018a 100644 --- a/kmines/main.h +++ b/kmines/main.h @@ -45,7 +45,7 @@ class MainWidget : public KZoomMainWindow, public KMines void pause(); protected: - virtual void focusOutEvent(QFocusEvent *); + virtual void focusOutEvent(TQFocusEvent *); virtual bool queryExit(); private: diff --git a/kmines/solver/bfield.cpp b/kmines/solver/bfield.cpp index d6c03643..24f5221f 100644 --- a/kmines/solver/bfield.cpp +++ b/kmines/solver/bfield.cpp @@ -58,7 +58,7 @@ void BaseField::reset(uint width, uint height, uint nbMines) fill(tmp); } -bool BaseField::checkField(uint w, uint h, uint nb, const QString &s) +bool BaseField::checkField(uint w, uint h, uint nb, const TQString &s) { if ( s.length()!=w*h ) return false; uint n = 0; @@ -69,7 +69,7 @@ bool BaseField::checkField(uint w, uint h, uint nb, const QString &s) return ( n==nb ); } -void BaseField::initReplay(const QString &s) +void BaseField::initReplay(const TQString &s) { Q_ASSERT( checkField(width(), height(), _nbMines, s) ); @@ -212,9 +212,9 @@ void BaseField::doMark(const Coord &c) changeCase(c, Marked); } -QCString BaseField::string() const +TQCString BaseField::string() const { - QCString s(size()); + TQCString s(size()); for (uint i=0; i<size(); i++) s[i] = (hasMine(coord(i)) ? '1' : '0'); return s; diff --git a/kmines/solver/bfield.h b/kmines/solver/bfield.h index 9c91d41c..a4849ced 100644 --- a/kmines/solver/bfield.h +++ b/kmines/solver/bfield.h @@ -19,7 +19,7 @@ #ifndef BASE_FIELD_H #define BASE_FIELD_H -#include <qcstring.h> +#include <tqcstring.h> #include <krandomsequence.h> #include <kgrid2d.h> @@ -36,8 +36,8 @@ class BaseField : public KGrid2D::Square<KMines::Case>, public KMines void reset(uint width, uint height, uint nbMines); static bool checkField(uint width, uint height, uint nbMines, - const QString &field); - void initReplay(const QString &field); // string == "0100011011000101..." + const TQString &field); + void initReplay(const TQString &field); // string == "0100011011000101..." // -------------------------- // interface used by the solver @@ -56,7 +56,7 @@ class BaseField : public KGrid2D::Square<KMines::Case>, public KMines // ------------------------- uint nbMarked() const { return _nbMarked; } - QCString string() const; + TQCString string() const; void showAllMines(bool won); diff --git a/kmines/solver/solver.cpp b/kmines/solver/solver.cpp index 00807fca..f8607b79 100644 --- a/kmines/solver/solver.cpp +++ b/kmines/solver/solver.cpp @@ -23,9 +23,9 @@ #include <algorithm> #include <assert.h> -#include <qtimer.h> -#include <qlayout.h> -#include <qlabel.h> +#include <tqtimer.h> +#include <tqlayout.h> +#include <tqlabel.h> #include <kprogress.h> #include <klocale.h> @@ -50,8 +50,8 @@ class SolverPrivate #endif }; -Solver::Solver(QObject *parent) - : QObject(parent) +Solver::Solver(TQObject *parent) + : TQObject(parent) { d = new SolverPrivate; @@ -174,7 +174,7 @@ bool Solver::solveStep() } if (_inOneStep) return solveStep(); - else QTimer::singleShot(0, this, SLOT(solveStep())); + else TQTimer::singleShot(0, this, TQT_SLOT(solveStep())); return false; } @@ -186,24 +186,24 @@ bool Solver::solveOneStep(BaseField &field) //----------------------------------------------------------------------------- -SolvingRateDialog::SolvingRateDialog(const BaseField &field, QWidget *parent) +SolvingRateDialog::SolvingRateDialog(const BaseField &field, TQWidget *parent) : KDialogBase(Plain, i18n("Compute Solving Rate"), Ok|Close, Close, parent, "compute_solving_rate", true, true), _refField(field) { - connect(&_solver, SIGNAL(solvingDone(bool)), SLOT(solvingDone(bool))); + connect(&_solver, TQT_SIGNAL(solvingDone(bool)), TQT_SLOT(solvingDone(bool))); KGuiItem item = KStdGuiItem::ok(); item.setText(i18n("Start")); setButtonOK(item); - QVBoxLayout *top = new QVBoxLayout(plainPage(), 0, spacingHint()); - QLabel *label = new QLabel(i18n("Width: %1").arg(field.width()), + TQVBoxLayout *top = new TQVBoxLayout(plainPage(), 0, spacingHint()); + TQLabel *label = new TQLabel(i18n("Width: %1").arg(field.width()), plainPage()); top->addWidget(label); - label = new QLabel(i18n("Height: %1").arg(field.height()), plainPage()); + label = new TQLabel(i18n("Height: %1").arg(field.height()), plainPage()); top->addWidget(label); - label = new QLabel(i18n("Mines: %1 (%2%)").arg(field.nbMines()) + label = new TQLabel(i18n("Mines: %1 (%2%)").arg(field.nbMines()) .arg( field.nbMines() * 100.0 / field.size()), plainPage()); top->addWidget(label); @@ -215,7 +215,7 @@ SolvingRateDialog::SolvingRateDialog(const BaseField &field, QWidget *parent) _progress->setFormat("%v"); top->addWidget(_progress); - _label = new QLabel(i18n("Success rate:"), plainPage()); + _label = new TQLabel(i18n("Success rate:"), plainPage()); top->addWidget(_label); } @@ -225,7 +225,7 @@ void SolvingRateDialog::slotOk() _i = 0; _success = 0; _progress->setValue(0); - QTimer::singleShot(0, this, SLOT(step())); + TQTimer::singleShot(0, this, TQT_SLOT(step())); } void SolvingRateDialog::step() @@ -245,5 +245,5 @@ void SolvingRateDialog::solvingDone(bool success) _label->setText(i18n("Success rate: %1%") .arg(_success * 100.0 / _i, 0, 'f', 3)); _progress->advance(1); - QTimer::singleShot(0, this, SLOT(step())); + TQTimer::singleShot(0, this, TQT_SLOT(step())); } diff --git a/kmines/solver/solver.h b/kmines/solver/solver.h index f076874e..22d6c591 100644 --- a/kmines/solver/solver.h +++ b/kmines/solver/solver.h @@ -33,7 +33,7 @@ class Solver : public QObject { Q_OBJECT public: - Solver(QObject *parent = 0); + Solver(TQObject *parent = 0); ~Solver(); /** A method to advice a point placement */ @@ -63,7 +63,7 @@ class SolvingRateDialog : public KDialogBase { Q_OBJECT public: - SolvingRateDialog(const BaseField &field, QWidget *parent); + SolvingRateDialog(const BaseField &field, TQWidget *parent); private slots: void step(); @@ -75,7 +75,7 @@ class SolvingRateDialog : public KDialogBase BaseField _field; Solver _solver; uint _i, _success; - QLabel *_label; + TQLabel *_label; KProgress *_progress; static const uint NB_STEPS = 200; diff --git a/kmines/solver/test.cpp b/kmines/solver/test.cpp index dd56d7a0..ed42da70 100644 --- a/kmines/solver/test.cpp +++ b/kmines/solver/test.cpp @@ -34,7 +34,7 @@ int main(int argc, char *argv[]) for(pmi = pm.begin(); pmi != pm.end(); ++pmi) pic[pmi->second.second][pmi->second.first] = pmi->first; - QString s; + TQString s; for(uint i=0;i<H;++i) { for(uint j=0;j<W;++j) cout << s.sprintf("%+.02f ", pic[i][j]).latin1(); diff --git a/kmines/status.cpp b/kmines/status.cpp index a3d5f061..ec9dfc3e 100644 --- a/kmines/status.cpp +++ b/kmines/status.cpp @@ -19,13 +19,13 @@ #include "status.h" #include "status.moc" -#include <qpainter.h> -#include <qpixmap.h> -#include <qwhatsthis.h> -#include <qlayout.h> -#include <qwidgetstack.h> -#include <qtextedit.h> -#include <qtimer.h> +#include <tqpainter.h> +#include <tqpixmap.h> +#include <tqwhatsthis.h> +#include <tqlayout.h> +#include <tqwidgetstack.h> +#include <tqtextedit.h> +#include <tqtimer.h> #include <kapplication.h> #include <klocale.h> @@ -45,27 +45,27 @@ #include "version.h" -Status::Status(QWidget *parent) - : QWidget(parent, "status"), _oldLevel(Level::Easy) +Status::Status(TQWidget *parent) + : TQWidget(parent, "status"), _oldLevel(Level::Easy) { - _timer = new QTimer(this); - connect(_timer, SIGNAL(timeout()), SLOT(replayStep())); + _timer = new TQTimer(this); + connect(_timer, TQT_SIGNAL(timeout()), TQT_SLOT(replayStep())); _solver = new Solver(this); - connect(_solver, SIGNAL(solvingDone(bool)), SLOT(solvingDone(bool))); + connect(_solver, TQT_SIGNAL(solvingDone(bool)), TQT_SLOT(solvingDone(bool))); // top layout - QGridLayout *top = new QGridLayout(this, 2, 5, 10, 10); + TQGridLayout *top = new TQGridLayout(this, 2, 5, 10, 10); top->setColStretch(1, 1); top->setColStretch(3, 1); // status bar // mines left LCD left = new KGameLCD(5, this); - left->setFrameStyle(QFrame::Panel | QFrame::Sunken); + left->setFrameStyle(TQFrame::Panel | TQFrame::Sunken); left->setDefaultBackgroundColor(black); left->setDefaultColor(white); - QWhatsThis::add(left, i18n("<qt>Mines left.<br/>" + TQWhatsThis::add(left, i18n("<qt>Mines left.<br/>" "It turns <font color=\"red\">red</font> " "when you have flagged more cases than " "present mines.</qt>")); @@ -73,14 +73,14 @@ Status::Status(QWidget *parent) // smiley smiley = new Smiley(this); - connect(smiley, SIGNAL(clicked()), SLOT(smileyClicked())); - smiley->setFocusPolicy(QWidget::NoFocus); - QWhatsThis::add(smiley, i18n("Press to start a new game")); + connect(smiley, TQT_SIGNAL(clicked()), TQT_SLOT(smileyClicked())); + smiley->setFocusPolicy(TQWidget::NoFocus); + TQWhatsThis::add(smiley, i18n("Press to start a new game")); top->addWidget(smiley, 0, 2); // digital clock LCD dg = new DigitalClock(this); - QWhatsThis::add(dg, i18n("<qt>Time elapsed.<br/>" + TQWhatsThis::add(dg, i18n("<qt>Time elapsed.<br/>" "It turns <font color=\"blue\">blue</font> " "if it is a highscore " "and <font color=\"red\">red</font> " @@ -88,32 +88,32 @@ Status::Status(QWidget *parent) top->addWidget(dg, 0, 4); // mines field - _fieldContainer = new QWidget(this); - QGridLayout *g = new QGridLayout(_fieldContainer, 1, 1); + _fieldContainer = new TQWidget(this); + TQGridLayout *g = new TQGridLayout(_fieldContainer, 1, 1); _field = new Field(_fieldContainer); _field->readSettings(); g->addWidget(_field, 0, 0, AlignCenter); - connect( _field, SIGNAL(updateStatus(bool)), SLOT(updateStatus(bool)) ); - connect(_field, SIGNAL(gameStateChanged(GameState)), - SLOT(gameStateChangedSlot(GameState)) ); - connect(_field, SIGNAL(setMood(Mood)), smiley, SLOT(setMood(Mood))); - connect(_field, SIGNAL(setCheating()), dg, SLOT(setCheating())); - connect(_field,SIGNAL(addAction(const KGrid2D::Coord &, Field::ActionType)), - SLOT(addAction(const KGrid2D::Coord &, Field::ActionType))); - QWhatsThis::add(_field, i18n("Mines field.")); + connect( _field, TQT_SIGNAL(updateStatus(bool)), TQT_SLOT(updateStatus(bool)) ); + connect(_field, TQT_SIGNAL(gameStateChanged(GameState)), + TQT_SLOT(gameStateChangedSlot(GameState)) ); + connect(_field, TQT_SIGNAL(setMood(Mood)), smiley, TQT_SLOT(setMood(Mood))); + connect(_field, TQT_SIGNAL(setCheating()), dg, TQT_SLOT(setCheating())); + connect(_field,TQT_SIGNAL(addAction(const KGrid2D::Coord &, Field::ActionType)), + TQT_SLOT(addAction(const KGrid2D::Coord &, Field::ActionType))); + TQWhatsThis::add(_field, i18n("Mines field.")); // resume button - _resumeContainer = new QWidget(this); - g = new QGridLayout(_resumeContainer, 1, 1); - QFont f = font(); + _resumeContainer = new TQWidget(this); + g = new TQGridLayout(_resumeContainer, 1, 1); + TQFont f = font(); f.setBold(true); - QPushButton *pb - = new QPushButton(i18n("Press to Resume"), _resumeContainer); + TQPushButton *pb + = new TQPushButton(i18n("Press to Resume"), _resumeContainer); pb->setFont(f); - connect(pb, SIGNAL(clicked()), SIGNAL(pause())); + connect(pb, TQT_SIGNAL(clicked()), TQT_SIGNAL(pause())); g->addWidget(pb, 0, 0, AlignCenter); - _stack = new QWidgetStack(this); + _stack = new TQWidgetStack(this); _stack->addWidget(_fieldContainer); _stack->addWidget(_resumeContainer); _stack->raiseWidget(_fieldContainer); @@ -176,7 +176,7 @@ void Status::settingsChanged() void Status::updateStatus(bool mine) { int r = _field->nbMines() - _field->nbMarked(); - QColor color = (r<0 && !_field->isSolved() ? red : white); + TQColor color = (r<0 && !_field->isSolved() ? red : white); left->setColor(color); left->display(r); @@ -207,14 +207,14 @@ void Status::setGameOver(bool won) if ( Settings::magicReveal() ) _logRoot.setAttribute("complete_reveal", "true"); - QString sa = "none"; + TQString sa = "none"; if ( _field->solvingState()==Solved ) sa = "solving"; else if ( _field->solvingState()==Advised ) sa = "advising"; _logRoot.setAttribute("solver", sa); - QDomElement f = _log.createElement("Field"); + TQDomElement f = _log.createElement("Field"); _logRoot.appendChild(f); - QDomText data = _log.createTextNode(_field->string()); + TQDomText data = _log.createTextNode(_field->string()); f.appendChild(data); } @@ -235,10 +235,10 @@ void Status::setPlaying() // game log const Level &level = _field->level(); - _log = QDomDocument("kmineslog"); + _log = TQDomDocument("kmineslog"); _logRoot = _log.createElement("kmineslog"); _logRoot.setAttribute("version", SHORT_VERSION); - QDateTime date = QDateTime::currentDateTime(); + TQDateTime date = TQDateTime::currentDateTime(); _logRoot.setAttribute("date", date.toString(Qt::ISODate)); _logRoot.setAttribute("width", level.width()); _logRoot.setAttribute("height", level.height()); @@ -250,7 +250,7 @@ void Status::setPlaying() void Status::gameStateChanged(GameState state, bool won) { - QWidget *w = _fieldContainer; + TQWidget *w = _fieldContainer; switch (state) { case Playing: @@ -282,7 +282,7 @@ void Status::gameStateChanged(GameState state, bool won) void Status::addAction(const KGrid2D::Coord &c, Field::ActionType type) { - QDomElement action = _log.createElement("Action"); + TQDomElement action = _log.createElement("Action"); action.setAttribute("time", dg->pretty()); action.setAttribute("column", c.first); action.setAttribute("line", c.second); @@ -296,7 +296,7 @@ void Status::advise() int res = KMessageBox::warningContinueCancel(this, i18n("When the solver gives " "you advice, your score will not be added to the highscores."), - QString::null, QString::null, "advice_warning"); + TQString::null, TQString::null, "advice_warning"); if ( res==KMessageBox::Cancel ) return; dg->setCheating(); float probability; @@ -326,7 +326,7 @@ void Status::viewLog() { KDialogBase d(this, "view_log", true, i18n("View Game Log"), KDialogBase::Close, KDialogBase::Close); - QTextEdit *view = new QTextEdit(&d); + TQTextEdit *view = new TQTextEdit(&d); view->setReadOnly(true); view->setTextFormat(PlainText); view->setText(_log.toString()); @@ -337,7 +337,7 @@ void Status::viewLog() void Status::saveLog() { - 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, false, this) ) { KGuiItem gi = KStdGuiItem::save(); @@ -356,13 +356,13 @@ void Status::saveLog() void Status::loadLog() { - KURL url = KFileDialog::getOpenURL(QString::null, QString::null, this); + KURL url = KFileDialog::getOpenURL(TQString::null, TQString::null, this); if ( url.isEmpty() ) return; - QString tmpFile; + TQString tmpFile; bool success = false; - QDomDocument doc; + TQDomDocument doc; if( KIO::NetAccess::download(url, tmpFile, this) ) { - QFile file(tmpFile); + TQFile file(tmpFile); if ( file.open(IO_ReadOnly) ) { int errorLine; bool ok = doc.setContent(&file, 0, &errorLine); @@ -390,11 +390,11 @@ void Status::loadLog() } } -bool Status::checkLog(const QDomDocument &doc) +bool Status::checkLog(const TQDomDocument &doc) { // check root element if ( doc.doctype().name()!="kmineslog" ) return false; - QDomElement root = doc.namedItem("kmineslog").toElement(); + TQDomElement root = doc.namedItem("kmineslog").toElement(); if ( root.isNull() ) return false; bool ok; uint w = root.attribute("width").toUInt(&ok); @@ -407,24 +407,24 @@ bool Status::checkLog(const QDomDocument &doc) if ( !ok || nb==0 || nb>Level::maxNbMines(w, h) ) return false; // check field - QDomElement field = root.namedItem("Field").toElement(); + TQDomElement field = root.namedItem("Field").toElement(); if ( field.isNull() ) return false; - QString ftext = field.text(); + TQString ftext = field.text(); if ( !BaseField::checkField(w, h, nb, ftext) ) return false; // check action list - QDomElement list = root.namedItem("ActionList").toElement(); + TQDomElement list = root.namedItem("ActionList").toElement(); if ( list.isNull() ) return false; - QDomNodeList actions = list.elementsByTagName("Action"); + TQDomNodeList actions = list.elementsByTagName("Action"); if ( actions.count()==0 ) return false; for (uint i=0; i<actions.count(); i++) { - QDomElement a = actions.item(i).toElement(); + TQDomElement a = actions.item(i).toElement(); if ( a.isNull() ) return false; uint i0 = a.attribute("line").toUInt(&ok); if ( !ok || i0>=h ) return false; uint j = a.attribute("column").toUInt(&ok); if ( !ok || j>=w ) return false; - QString type = a.attribute("type"); + TQString type = a.attribute("type"); uint k = 0; for (; k<Field::Nb_Actions; k++) if ( type==Field::ACTION_DATA[k].name ) break; @@ -441,11 +441,11 @@ void Status::replayLog() uint h = _logRoot.attribute("height").toUInt(); uint n = _logRoot.attribute("mines").toUInt(); Level level(w, h, n); - QDomNode f = _logRoot.namedItem("Field"); + TQDomNode f = _logRoot.namedItem("Field"); _oldLevel = _field->level(); newGame(level); _field->setReplayField(f.toElement().text()); - QString s = _logRoot.attribute("complete_reveal"); + TQString s = _logRoot.attribute("complete_reveal"); _completeReveal = ( s=="true" ); f = _logRoot.namedItem("ActionList"); @@ -458,16 +458,16 @@ void Status::replayStep() { if ( _index>=_actions.count() ) { _timer->stop(); - _actions = QDomNodeList(); + _actions = TQDomNodeList(); return; } _timer->changeInterval(200); - QDomElement a = _actions.item(_index).toElement(); + TQDomElement a = _actions.item(_index).toElement(); dg->setTime(a.attribute("time")); uint i = a.attribute("column").toUInt(); uint j = a.attribute("line").toUInt(); - QString type = a.attribute("type"); + TQString type = a.attribute("type"); for (uint k=0; k<Field::Nb_Actions; k++) if ( type==Field::ACTION_DATA[k].name ) { _field->doAction((Field::ActionType)k, diff --git a/kmines/status.h b/kmines/status.h index 6fd06a76..4249fe82 100644 --- a/kmines/status.h +++ b/kmines/status.h @@ -19,7 +19,7 @@ #ifndef STATUS_H #define STATUS_H -#include <qdom.h> +#include <tqdom.h> #include "field.h" @@ -30,11 +30,11 @@ class Solver; class QWidgetStack; class QTimer; -class Status : public QWidget, public KMines +class Status : public TQWidget, public KMines { Q_OBJECT public : - Status(QWidget *parent); + Status(TQWidget *parent); const Level ¤tLevel() const { return _field->level(); } bool isPlaying() const { return _field->gameState()==Playing; } @@ -84,28 +84,28 @@ class Status : public QWidget, public KMines private: Field *_field; - QWidget *_fieldContainer, *_resumeContainer; - QWidgetStack *_stack; + TQWidget *_fieldContainer, *_resumeContainer; + TQWidgetStack *_stack; Smiley *smiley; KGameLCD *left; DigitalClock *dg; Solver *_solver; - QDomDocument _log; - QDomElement _logRoot, _logList; - QDomNodeList _actions; + TQDomDocument _log; + TQDomElement _logRoot, _logList; + TQDomNodeList _actions; uint _index; bool _completeReveal; Level _oldLevel; - QTimer *_timer; + TQTimer *_timer; void setGameOver(bool won); void setStopped(); void setPlaying(); void newGame(const Level &); void gameStateChanged(GameState, bool won); - static bool checkLog(const QDomDocument &); + static bool checkLog(const TQDomDocument &); }; #endif // STATUS_H |