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 /katomic | |
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 'katomic')
-rw-r--r-- | katomic/configbox.cpp | 6 | ||||
-rw-r--r-- | katomic/configbox.h | 1 | ||||
-rw-r--r-- | katomic/feld.cpp | 32 | ||||
-rw-r--r-- | katomic/feld.h | 7 | ||||
-rw-r--r-- | katomic/gamewidget.cpp | 38 | ||||
-rw-r--r-- | katomic/gamewidget.h | 5 | ||||
-rw-r--r-- | katomic/molek.cpp | 20 | ||||
-rw-r--r-- | katomic/molek.h | 5 | ||||
-rw-r--r-- | katomic/toplevel.cpp | 26 | ||||
-rw-r--r-- | katomic/toplevel.h | 1 |
10 files changed, 73 insertions, 68 deletions
diff --git a/katomic/configbox.cpp b/katomic/configbox.cpp index d6fcde23..30c77dd3 100644 --- a/katomic/configbox.cpp +++ b/katomic/configbox.cpp @@ -16,8 +16,8 @@ extern Options settings; -ConfigBox::ConfigBox ( TQWidget *parent, const char *name) - : KDialogBase ( parent, name, true, i18n("Configure"), Ok | Cancel, Ok, true ) +ConfigBox::ConfigBox ( TQWidget *tqparent, const char *name) + : KDialogBase ( tqparent, name, true, i18n("Configure"), Ok | Cancel, Ok, true ) { TQWidget *page = makeMainWidget(); @@ -33,7 +33,7 @@ ConfigBox::ConfigBox ( TQWidget *parent, const char *name) glay->addWidget(disp, 1, 2); disp->display(1); - speed = new TQSlider(1, 10, 1, 1, TQSlider::Horizontal, page); + speed = new TQSlider(1, 10, 1, 1, Qt::Horizontal, page); glay->addMultiCellWidget(speed, 2, 2, 2, 3); connect(speed, TQT_SIGNAL(valueChanged(int)), disp, TQT_SLOT(display(int))); diff --git a/katomic/configbox.h b/katomic/configbox.h index b3d8dfe2..5bffb932 100644 --- a/katomic/configbox.h +++ b/katomic/configbox.h @@ -16,6 +16,7 @@ class ConfigBox : public KDialogBase { Q_OBJECT + TQ_OBJECT public: ConfigBox ( TQWidget *, const char* name ); diff --git a/katomic/feld.cpp b/katomic/feld.cpp index e01060cb..48150efd 100644 --- a/katomic/feld.cpp +++ b/katomic/feld.cpp @@ -1,15 +1,15 @@ /**************************************************************** ** -** Implementation Feld class, derieved from Qt tutorial 8 +** Implementation Feld class, derieved from TQt tutorial 8 ** ****************************************************************/ // bemerkungen : wenn paintEvent aufgerufen wird, wird das komplette -// widget gel�scht und nur die sachen gezeichnet, die in +// widget gel�scht und nur die sachen gezeichnet, die in // paintEvent stehen ! sollen dinge z.b nur bei maustasten- -// druck gezeichnet werden, so mu� dies in mousePressEvent +// druck gezeichnet werden, so mu� dies in mousePressEvent // stehen ! -// paintEvent wird aufgerufen, falls fenster �berdeckt wird, +// paintEvent wird aufgerufen, falls fenster �berdeckt wird, // oder auch einfach bewegt wird #include <kiconloader.h> @@ -26,8 +26,8 @@ extern Options settings; -Feld::Feld( TQWidget *parent, const char *name ) : - TQWidget( parent, name ), +Feld::Feld( TQWidget *tqparent, const char *name ) : + TQWidget( tqparent, name ), data(locate("appdata", "pics/abilder.png")), undoBegin (0), undoSize (0), redoSize (0) { @@ -45,7 +45,7 @@ Feld::Feld( TQWidget *parent, const char *name ) : setMouseTracking(true); - setFocusPolicy(TQWidget::StrongFocus); + setFocusPolicy(TQ_StrongFocus); setBackgroundColor( TQColor( 0, 0, 0) ); setFixedSize(15 * 30, 15 * 30); @@ -70,7 +70,7 @@ void Feld::resetValidDirs() void Feld::load (const KSimpleConfig& config) { if(moving) - killTimers(); + TQT_TQOBJECT(this)->killTimers(); mol->load(config); @@ -124,7 +124,7 @@ void Feld::mousePressEvent (TQMouseEvent *e) resetValidDirs(); chosen = false; } - emitStatus(); + emittqStatus(); } const atom& Feld::getAtom(uint index) const @@ -154,7 +154,7 @@ void Feld::nextAtom() xpos = x; ypos = y; chosen = true; resetValidDirs(); - emitStatus(); + emittqStatus(); return; } } @@ -187,7 +187,7 @@ void Feld::previousAtom() xpos = x; ypos = y; chosen = true; resetValidDirs(); - emitStatus(); + emittqStatus(); return; } } @@ -198,7 +198,7 @@ void Feld::previousAtom() } -void Feld::emitStatus() +void Feld::emittqStatus() { if (!chosen || moving) {} else { @@ -231,7 +231,7 @@ void Feld::done () if (moving) return; - emitStatus(); + emittqStatus(); if (checkDone()) emit gameOver(moves); @@ -492,7 +492,7 @@ void Feld::timerEvent (TQTimerEvent *) if (frames <= 0) { moving = false; - killTimers (); + TQT_TQOBJECT(this)->killTimers (); done(); dir = None; } @@ -574,7 +574,7 @@ void Feld::paintEvent( TQPaintEvent * ) x = i * 30; y = j * 30; - // zeichnet Randst�cke + // zeichnet Randst�cke if (feld [i] [j] == 254) { putNonAtom(i, j, Feld::None, true); continue; } @@ -628,7 +628,7 @@ void Feld::paintEvent( TQPaintEvent * ) } - // zeichnet Verbindungsst�be + // zeichnet Verbindungsst�be if (getAtom(feld [i] [j]).obj >= 'A' && getAtom(feld [i] [j]).obj <= 'F') bitBlt (this, x, y, diff --git a/katomic/feld.h b/katomic/feld.h index b48ebf39..6383441c 100644 --- a/katomic/feld.h +++ b/katomic/feld.h @@ -27,12 +27,13 @@ class Molek; #define FIELD_SIZE 15 -class Feld : public QWidget +class Feld : public TQWidget { Q_OBJECT + TQ_OBJECT public: - Feld (TQWidget *parent=0, const char *name=0); + Feld (TQWidget *tqparent=0, const char *name=0); ~Feld (); enum Direction { None = 0, @@ -64,7 +65,7 @@ protected: void paintMovingAtom(); void mousePressEvent (TQMouseEvent *); void mouseMoveEvent (TQMouseEvent *); - void emitStatus(); + void emittqStatus(); protected: struct UndoInfo { diff --git a/katomic/gamewidget.cpp b/katomic/gamewidget.cpp index 2c9ccf0a..2bda7d0f 100644 --- a/katomic/gamewidget.cpp +++ b/katomic/gamewidget.cpp @@ -1,6 +1,6 @@ /* toplevel.cpp - Copyright (C) 1998 Andreas W�st ([email protected]) + Copyright (C) 1998 Andreas W�st ([email protected]) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -95,11 +95,11 @@ void GameWidget::doRedo () } void GameWidget::gameOver(int moves) { - KMessageBox::information(this, i18n("You solved level %1 with %2 moves!").arg(level).arg(moves), i18n("Congratulations")); + KMessageBox::information(this, i18n("You solved level %1 with %2 moves!").tqarg(level).tqarg(moves), i18n("Congratulations")); KScoreDialog high(KScoreDialog::Name | KScoreDialog::Score, this); - high.setCaption(i18n("Level %1 Highscores").arg(level)); - high.setConfigGroup(TQString("Highscores Level %1").arg(level)); + high.setCaption(i18n("Level %1 Highscores").tqarg(level)); + high.setConfigGroup(TQString("Highscores Level %1").tqarg(level)); KScoreDialog::FieldInfo scoreInfo; @@ -118,8 +118,8 @@ void GameWidget::getMoves(int moves) void GameWidget::mergeHighScores(int l) { - KConfigGroup oldConfig(kapp->config(), TQString("High Scores Level %1").arg(l).utf8()); - KConfigGroup newConfig(kapp->config(), TQString("Highscores Level %1").arg(l).utf8()); + KConfigGroup oldConfig(kapp->config(), TQString("High Scores Level %1").tqarg(l).utf8()); + KConfigGroup newConfig(kapp->config(), TQString("Highscores Level %1").tqarg(l).utf8()); newConfig.writeEntry("LastPlayer", oldConfig.readEntry("LastPlayer")); @@ -138,7 +138,7 @@ void GameWidget::mergeHighScores(int l) void GameWidget::updateLevel (int l) { level=l; - TQString levelFile = locate("appdata", TQString("levels/level_%1").arg(l)); + TQString levelFile = locate("appdata", TQString("levels/level_%1").tqarg(l)); if (levelFile.isNull()) { return updateLevel(1); } @@ -147,11 +147,11 @@ void GameWidget::updateLevel (int l) cfg.setGroup("Level"); feld->load(cfg); - if (!kapp->config()->hasGroup(TQString("Highscores Level %1").arg(level)) && - kapp->config()->hasGroup(TQString("High Scores Level %1").arg(level))) + if (!kapp->config()->hasGroup(TQString("Highscores Level %1").tqarg(level)) && + kapp->config()->hasGroup(TQString("High Scores Level %1").tqarg(level))) mergeHighScores(level); - highScore->setConfigGroup(TQString("Highscores Level %1").arg(level)); + highScore->setConfigGroup(TQString("Highscores Level %1").tqarg(level)); highest.setNum(highScore->highScore()); if (highest != "0" ) hs->setText(highest); @@ -159,7 +159,7 @@ void GameWidget::updateLevel (int l) ys->setText("0"); scrl->setValue(level); - feld->repaint(); + feld->tqrepaint(); } void GameWidget::restartLevel() @@ -167,8 +167,8 @@ void GameWidget::restartLevel() updateLevel(level); } -GameWidget::GameWidget ( TQWidget *parent, const char* name ) - : TQWidget( parent, name ) +GameWidget::GameWidget ( TQWidget *tqparent, const char* name ) + : TQWidget( tqparent, name ) { level = 1; nlevels = KGlobal::dirs()->findAllResources("appdata", "levels/level_*", @@ -188,10 +188,10 @@ GameWidget::GameWidget ( TQWidget *parent, const char* name ) // scrollbar scrl = new TQScrollBar(1, nlevels, 1, - 5, 1, TQScrollBar::Horizontal, vb, "scrl" ); + 5, 1, Qt::Horizontal, vb, "scrl" ); connect (scrl, TQT_SIGNAL (valueChanged (int)), TQT_SLOT (updateLevel (int))); - // molek�l + // molek�l molek = new Molek (vb, "molek"); feld->setMolek(molek); @@ -214,7 +214,7 @@ GameWidget::GameWidget ( TQWidget *parent, const char* name ) headerFont.setBold(true); hs = new TQLabel (highest, bg); - hs->setAlignment(Qt::AlignRight); + hs->tqsetAlignment(TQt::AlignRight); hs->setFont(headerFont); slay->addWidget(hs); @@ -223,7 +223,7 @@ GameWidget::GameWidget ( TQWidget *parent, const char* name ) slay->addWidget(new TQLabel(i18n("Your score so far:"), bg)); ys = new TQLabel (current, bg); - ys->setAlignment(Qt::AlignRight); + ys->tqsetAlignment(TQt::AlignRight); ys->setFont(headerFont); slay->addWidget(ys); @@ -245,8 +245,8 @@ GameWidget::~GameWidget() void GameWidget::showHighscores () { KScoreDialog high(KScoreDialog::Name | KScoreDialog::Score, this); - high.setCaption(i18n("Level %1 Highscores").arg(level)); - high.setConfigGroup(TQString("Highscores Level %1").arg(level)); + high.setCaption(i18n("Level %1 Highscores").tqarg(level)); + high.setConfigGroup(TQString("Highscores Level %1").tqarg(level)); high.exec(); } diff --git a/katomic/gamewidget.h b/katomic/gamewidget.h index a998c80a..839faa17 100644 --- a/katomic/gamewidget.h +++ b/katomic/gamewidget.h @@ -10,13 +10,14 @@ class KScoreDialog; #include <tqwidget.h> -class GameWidget : public QWidget +class GameWidget : public TQWidget { Q_OBJECT + TQ_OBJECT public: - GameWidget ( TQWidget *parent, const char *name=0 ); + GameWidget ( TQWidget *tqparent, const char *name=0 ); ~GameWidget(); diff --git a/katomic/molek.cpp b/katomic/molek.cpp index 26cbcbf6..7555736b 100644 --- a/katomic/molek.cpp +++ b/katomic/molek.cpp @@ -1,15 +1,15 @@ /**************************************************************** ** -** Implementation Molek class, derieved from Qt tutorial 8 +** Implementation Molek class, derieved from TQt tutorial 8 ** ****************************************************************/ // bemerkungen : wenn paintEvent aufgerufen wird, wird das komplette -// widget gel�scht und nur die sachen gezeichnet, die in +// widget gel�scht und nur die sachen gezeichnet, die in // paintEvent stehen ! sollen dinge z.b nur bei maustasten- -// druck gezeichnet werden, so mu� dies in mousePressEvent +// druck gezeichnet werden, so mu� dies in mousePressEvent // stehen ! -// paintEvent wird aufgerufen, falls fenster �berdeckt wird, +// paintEvent wird aufgerufen, falls fenster �berdeckt wird, // oder auch einfach bewegt wird #include <config.h> @@ -26,7 +26,7 @@ extern int level; -Molek::Molek( TQWidget *parent, const char *name ) : TQWidget( parent, name ), +Molek::Molek( TQWidget *tqparent, const char *name ) : TQWidget( tqparent, name ), data(locate("appdata", "pics/molek.png")) { setBackgroundColor (TQColor (0, 0, 0)); @@ -62,13 +62,13 @@ void Molek::load (const KSimpleConfig& config) if (value.isEmpty()) break; - current.obj = value.at(0).latin1(); + current.obj = value.tqat(0).latin1(); value = value.mid(2); if (value.isNull()) value = ""; strlcpy(current.conn, value.ascii(), sizeof(current.conn)); - kdWarning( atoms.find(current) != atoms.end() ) + kdWarning( atoms.tqfind(current) != atoms.end() ) << "OOOPS, duplicate atom definition in " << key << endl; atoms.append(current); atom_index++; @@ -82,7 +82,7 @@ void Molek::load (const KSimpleConfig& config) line = config.readEntry(key); for (int i = 0; i < MOLEK_SIZE; i++) - molek[i][j] = atom2int(line.at(i).latin1()); + molek[i][j] = atom2int(line.tqat(i).latin1()); } mname = i18n(config.readEntry("Name", I18N_NOOP("Noname")).latin1()); @@ -103,12 +103,12 @@ void Molek::load (const KSimpleConfig& config) height++; width++; - repaint (); + tqrepaint (); } void Molek::paintEvent( TQPaintEvent * ) { - TQString st = i18n("Level: %1").arg(level); + TQString st = i18n("Level: %1").tqarg(level); TQPainter paint (this); paint.setPen (TQColor (190, 190, 190)); diff --git a/katomic/molek.h b/katomic/molek.h index 354cf49b..4100fe46 100644 --- a/katomic/molek.h +++ b/katomic/molek.h @@ -20,12 +20,13 @@ class KSimpleConfig; #define MOLEK_SIZE 15 -class Molek : public QWidget +class Molek : public TQWidget { Q_OBJECT + TQ_OBJECT public: - Molek (TQWidget *parent=0, const char *name=0); + Molek (TQWidget *tqparent=0, const char *name=0); ~Molek (); void load(const KSimpleConfig& config); diff --git a/katomic/toplevel.cpp b/katomic/toplevel.cpp index bb9613f2..e2d9e745 100644 --- a/katomic/toplevel.cpp +++ b/katomic/toplevel.cpp @@ -1,6 +1,6 @@ /* toplevel.cpp - Copyright (C) 1998 Andreas W�st ([email protected]) + Copyright (C) 1998 Andreas W�st ([email protected]) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -40,27 +40,27 @@ extern Options settings; void AtomTopLevel::createMenu() { - KAction *act = KStdGameAction::highscores(main, TQT_SLOT(showHighscores()), actionCollection()); + KAction *act = KStdGameAction::highscores(TQT_TQOBJECT(main), TQT_SLOT(showHighscores()), actionCollection()); act->setText(i18n("Show &Highscores")); - KStdGameAction::quit(this, TQT_SLOT(close()), actionCollection()); - KStdGameAction::restart(main, TQT_SLOT(restartLevel()), actionCollection()); + KStdGameAction::quit(TQT_TQOBJECT(this), TQT_SLOT(close()), actionCollection()); + KStdGameAction::restart(TQT_TQOBJECT(main), TQT_SLOT(restartLevel()), actionCollection()); - KStdAction::preferences(this, TQT_SLOT(configopts()), actionCollection()); + KStdAction::preferences(TQT_TQOBJECT(this), TQT_SLOT(configopts()), actionCollection()); - undoAction = KStdGameAction::undo (main, TQT_SLOT(doUndo()), actionCollection()); - redoAction = KStdGameAction::redo (main, TQT_SLOT(doRedo()), actionCollection()); + undoAction = KStdGameAction::undo (TQT_TQOBJECT(main), TQT_SLOT(doUndo()), actionCollection()); + redoAction = KStdGameAction::redo (TQT_TQOBJECT(main), TQT_SLOT(doRedo()), actionCollection()); undoAction->setEnabled(false); redoAction->setEnabled(false); connect (main, TQT_SIGNAL (enableRedo(bool)), TQT_SLOT(enableRedo(bool))); connect (main, TQT_SIGNAL (enableUndo(bool)), TQT_SLOT(enableUndo(bool))); - new KAction(i18n("Atom Up"), Key_Up, main, TQT_SLOT(moveUp()), actionCollection(), "atom_up"); - new KAction(i18n("Atom Down"), Key_Down, main, TQT_SLOT(moveDown()), actionCollection(), "atom_down"); - new KAction(i18n("Atom Left"), Key_Left, main, TQT_SLOT(moveLeft()), actionCollection(), "atom_left"); - new KAction(i18n("Atom Right"), Key_Right, main, TQT_SLOT(moveRight()), actionCollection(), "atom_right"); + new KAction(i18n("Atom Up"), Key_Up, TQT_TQOBJECT(main), TQT_SLOT(moveUp()), actionCollection(), "atom_up"); + new KAction(i18n("Atom Down"), Key_Down, TQT_TQOBJECT(main), TQT_SLOT(moveDown()), actionCollection(), "atom_down"); + new KAction(i18n("Atom Left"), Key_Left, TQT_TQOBJECT(main), TQT_SLOT(moveLeft()), actionCollection(), "atom_left"); + new KAction(i18n("Atom Right"), Key_Right, TQT_TQOBJECT(main), TQT_SLOT(moveRight()), actionCollection(), "atom_right"); - new KAction(i18n("Next Atom"), Key_Tab, main, TQT_SLOT(nextAtom()), actionCollection(), "next_atom"); - new KAction(i18n("Previous Atom"), SHIFT+Key_Tab, main, TQT_SLOT(previousAtom()), actionCollection(), "prev_atom"); + new KAction(i18n("Next Atom"), Key_Tab, TQT_TQOBJECT(main), TQT_SLOT(nextAtom()), actionCollection(), "next_atom"); + new KAction(i18n("Previous Atom"), SHIFT+Key_Tab, TQT_TQOBJECT(main), TQT_SLOT(previousAtom()), actionCollection(), "prev_atom"); } void AtomTopLevel::configopts() diff --git a/katomic/toplevel.h b/katomic/toplevel.h index 38c613d0..6a62a3a2 100644 --- a/katomic/toplevel.h +++ b/katomic/toplevel.h @@ -24,6 +24,7 @@ class KConfig; class AtomTopLevel : public KMainWindow { Q_OBJECT + TQ_OBJECT public: |