From 838baf3f99ec5ab81b063eb5449a3381d860f377 Mon Sep 17 00:00:00 2001 From: tpearson Date: Sat, 11 Jun 2011 04:58:26 +0000 Subject: 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 --- kjumpingcube/kcubeboxwidget.cpp | 26 +++++++++++------------ kjumpingcube/kcubeboxwidget.h | 11 +++++----- kjumpingcube/kcubewidget.cpp | 10 ++++----- kjumpingcube/kcubewidget.h | 3 ++- kjumpingcube/kjumpingcube.cpp | 38 +++++++++++++++++----------------- kjumpingcube/kjumpingcube.h | 1 + kjumpingcube/settings.ui | 46 ++++++++++++++++++++--------------------- 7 files changed, 69 insertions(+), 66 deletions(-) (limited to 'kjumpingcube') diff --git a/kjumpingcube/kcubeboxwidget.cpp b/kjumpingcube/kcubeboxwidget.cpp index bca13210..57aecd15 100644 --- a/kjumpingcube/kcubeboxwidget.cpp +++ b/kjumpingcube/kcubeboxwidget.cpp @@ -30,8 +30,8 @@ #include "prefs.h" -KCubeBoxWidget::KCubeBoxWidget(const int d,TQWidget *parent,const char *name) - : TQWidget(parent,name), +KCubeBoxWidget::KCubeBoxWidget(const int d,TQWidget *tqparent,const char *name) + : TQWidget(tqparent,name), CubeBoxBase(d) { init(); @@ -39,8 +39,8 @@ KCubeBoxWidget::KCubeBoxWidget(const int d,TQWidget *parent,const char *name) -KCubeBoxWidget::KCubeBoxWidget(CubeBox& box,TQWidget *parent,const char *name) - :TQWidget(parent,name), +KCubeBoxWidget::KCubeBoxWidget(CubeBox& box,TQWidget *tqparent,const char *name) + :TQWidget(tqparent,name), CubeBoxBase(box.dim()) { init(); @@ -57,8 +57,8 @@ KCubeBoxWidget::KCubeBoxWidget(CubeBox& box,TQWidget *parent,const char *name) -KCubeBoxWidget::KCubeBoxWidget(const KCubeBoxWidget& box,TQWidget *parent,const char *name) - :TQWidget(parent,name), +KCubeBoxWidget::KCubeBoxWidget(const KCubeBoxWidget& box,TQWidget *tqparent,const char *name) + :TQWidget(tqparent,name), CubeBoxBase(box.dim()) { init(); @@ -453,13 +453,13 @@ void KCubeBoxWidget::initCubes() int i,j; // create Layout - layout=new TQGridLayout(this,s,s); + tqlayout=new TQGridLayout(this,s,s); for(i=0;isetRowStretch(i,1); - layout->setColStretch(i,1); + tqlayout->setRowStretch(i,1); + tqlayout->setColStretch(i,1); } @@ -474,7 +474,7 @@ void KCubeBoxWidget::initCubes() { cubes[i][j]=new KCubeWidget(this); cubes[i][j]->setCoordinates(i,j); - layout->addWidget(cubes[i][j],i,j); + tqlayout->addWidget(cubes[i][j],i,j); cubes[i][j]->show(); connect(cubes[i][j],TQT_SIGNAL(clicked(int,int,bool)),TQT_SLOT(stopHint())); connect(cubes[i][j],TQT_SIGNAL(clicked(int,int,bool)),TQT_SLOT(checkClick(int,int,bool))); @@ -504,15 +504,15 @@ void KCubeBoxWidget::initCubes() } -TQSize KCubeBoxWidget::sizeHint() const +TQSize KCubeBoxWidget::tqsizeHint() const { return TQSize(400,400); } void KCubeBoxWidget::deleteCubes() { - if(layout) - delete layout; + if(tqlayout) + delete tqlayout; CubeBoxBase::deleteCubes(); } diff --git a/kjumpingcube/kcubeboxwidget.h b/kjumpingcube/kcubeboxwidget.h index e2bf73ca..e8d0553e 100644 --- a/kjumpingcube/kcubeboxwidget.h +++ b/kjumpingcube/kcubeboxwidget.h @@ -51,11 +51,12 @@ struct Loop class KCubeBoxWidget : public TQWidget , public CubeBoxBase { Q_OBJECT + TQ_OBJECT public: - KCubeBoxWidget(const int dim=1,TQWidget *parent=0,const char *name=0); + KCubeBoxWidget(const int dim=1,TQWidget *tqparent=0,const char *name=0); - KCubeBoxWidget(CubeBox& box, TQWidget *parent=0,const char *name=0); - KCubeBoxWidget(const KCubeBoxWidget& box,TQWidget *parent=0,const char *name=0); + KCubeBoxWidget(CubeBox& box, TQWidget *tqparent=0,const char *name=0); + KCubeBoxWidget(const KCubeBoxWidget& box,TQWidget *tqparent=0,const char *name=0); virtual ~KCubeBoxWidget(); KCubeBoxWidget& operator= (CubeBox& box); @@ -130,7 +131,7 @@ signals: void stoppedThinking(); protected: - virtual TQSize sizeHint() const; + virtual TQSize tqsizeHint() const; virtual void deleteCubes(); virtual void initCubes(); @@ -146,7 +147,7 @@ protected slots: private: void init(); - TQGridLayout *layout; + TQGridLayout *tqlayout; CubeBox *undoBox; Brain brain; diff --git a/kjumpingcube/kcubewidget.cpp b/kjumpingcube/kcubewidget.cpp index 27797683..d4556eac 100644 --- a/kjumpingcube/kcubewidget.cpp +++ b/kjumpingcube/kcubewidget.cpp @@ -73,9 +73,9 @@ TQPalette KCubeWidget::color(Owner forWhom) ** public functions ** ** ****************************************************** */ -KCubeWidget::KCubeWidget(TQWidget* parent,const char* name +KCubeWidget::KCubeWidget(TQWidget* tqparent,const char* name ,Owner owner,int value,int max) - : TQFrame(parent,name), + : TQFrame(tqparent,name), Cube(owner,value,max) { setFrameStyle(Panel|Raised); @@ -85,7 +85,7 @@ KCubeWidget::KCubeWidget(TQWidget* parent,const char* name setCoordinates(0,0); //initialize hintTimer - // will be automatically destroyed by the parent + // will be automatically destroyed by the tqparent hintTimer = new TQTimer(this); hintCounter=0; connect(hintTimer,TQT_SIGNAL(timeout()),TQT_SLOT(hint())); @@ -93,7 +93,7 @@ KCubeWidget::KCubeWidget(TQWidget* parent,const char* name setPalette(kapp->palette()); // show values - repaint(false); + tqrepaint(false); } KCubeWidget::~KCubeWidget() @@ -240,7 +240,7 @@ void KCubeWidget::mouseReleaseEvent(TQMouseEvent *e) if(e->x()< 0 || e->x() > width() || e->y() < 0 || e->y() > height()) return; - if(e->button() == LeftButton && _clicksAllowed) + if(e->button() == Qt::LeftButton && _clicksAllowed) { stopHint(); emit clicked(row(),column(),true); diff --git a/kjumpingcube/kcubewidget.h b/kjumpingcube/kcubewidget.h index 804a9db4..3f578c13 100644 --- a/kjumpingcube/kcubewidget.h +++ b/kjumpingcube/kcubewidget.h @@ -35,10 +35,11 @@ class TQTimer; class KCubeWidget : public TQFrame , public Cube { Q_OBJECT + TQ_OBJECT public: /** constructs a new KCubeWidget*/ - KCubeWidget(TQWidget* parent=0,const char* name=0 + KCubeWidget(TQWidget* tqparent=0,const char* name=0 ,Owner owner=Cube::Nobody,int value=1,int max=0); virtual ~KCubeWidget(); diff --git a/kjumpingcube/kjumpingcube.cpp b/kjumpingcube/kjumpingcube.cpp index f63665af..a35dcf19 100644 --- a/kjumpingcube/kjumpingcube.cpp +++ b/kjumpingcube/kjumpingcube.cpp @@ -64,7 +64,7 @@ KJumpingCube::KJumpingCube() statusBar()->insertItem(s,ID_STATUS_TURN_TEXT, false); statusBar()->changeItem(s,ID_STATUS_TURN_TEXT); statusBar()->setItemAlignment (ID_STATUS_TURN_TEXT, AlignLeft | AlignVCenter); - statusBar()->setFixedHeight( statusBar()->sizeHint().height() ); + statusBar()->setFixedHeight( statusBar()->tqsizeHint().height() ); currentPlayer = new TQWidget(this, "currentPlayer"); currentPlayer->setFixedWidth(40); @@ -76,19 +76,19 @@ KJumpingCube::KJumpingCube() } void KJumpingCube::initKAction() { - KStdGameAction::gameNew(this, TQT_SLOT(newGame()), actionCollection()); - KStdGameAction::load(this, TQT_SLOT(openGame()), actionCollection()); - KStdGameAction::save(this, TQT_SLOT(save()), actionCollection()); - KStdGameAction::saveAs(this, TQT_SLOT(saveAs()), actionCollection()); - KStdGameAction::quit(this, TQT_SLOT(close()), actionCollection()); + KStdGameAction::gameNew(TQT_TQOBJECT(this), TQT_SLOT(newGame()), actionCollection()); + KStdGameAction::load(TQT_TQOBJECT(this), TQT_SLOT(openGame()), actionCollection()); + KStdGameAction::save(TQT_TQOBJECT(this), TQT_SLOT(save()), actionCollection()); + KStdGameAction::saveAs(TQT_TQOBJECT(this), TQT_SLOT(saveAs()), actionCollection()); + KStdGameAction::quit(TQT_TQOBJECT(this), TQT_SLOT(close()), actionCollection()); - hintAction = KStdGameAction::hint(view, TQT_SLOT(getHint()), actionCollection()); + hintAction = KStdGameAction::hint(TQT_TQOBJECT(view), TQT_SLOT(getHint()), actionCollection()); stopAction = new KAction(i18n("Stop &Thinking"), "stop", - Qt::Key_Escape, this, TQT_SLOT(stop()), actionCollection(), "game_stop"); + TQt::Key_Escape, TQT_TQOBJECT(this), TQT_SLOT(stop()), actionCollection(), "game_stop"); stopAction->setEnabled(false); - undoAction = KStdGameAction::undo(this, TQT_SLOT(undo()), actionCollection()); + undoAction = KStdGameAction::undo(TQT_TQOBJECT(this), TQT_SLOT(undo()), actionCollection()); undoAction->setEnabled(false); - KStdAction::preferences(this, TQT_SLOT(showOptions()), actionCollection()); + KStdAction::preferences(TQT_TQOBJECT(this), TQT_SLOT(showOptions()), actionCollection()); setupGUI(); } @@ -123,8 +123,8 @@ void KJumpingCube::saveGame(bool saveAs) if(KIO::NetAccess::exists(url,false,this)) { TQString mes=i18n("The file %1 exists.\n" - "Do you want to overwrite it?").arg(url.url()); - result = KMessageBox::warningContinueCancel(this, mes, TQString::null, i18n("Overwrite")); + "Do you want to overwrite it?").tqarg(url.url()); + result = KMessageBox::warningContinueCancel(this, mes, TQString(), i18n("Overwrite")); if(result==KMessageBox::Cancel) return; } @@ -147,12 +147,12 @@ void KJumpingCube::saveGame(bool saveAs) if(KIO::NetAccess::upload( tempFile.name(),gameURL,this )) { TQString s=i18n("game saved as %1"); - s=s.arg(gameURL.url()); + s=s.tqarg(gameURL.url()); statusBar()->message(s,MESSAGE_TIME); } else { - KMessageBox::sorry(this,i18n("There was an error in saving file\n%1").arg(gameURL.url())); + KMessageBox::sorry(this,i18n("There was an error in saving file\n%1").tqarg(gameURL.url())); } } @@ -168,7 +168,7 @@ void KJumpingCube::openGame() return; if(!KIO::NetAccess::exists(url,true,this)) { - TQString mes=i18n("The file %1 does not exist!").arg(url.url()); + TQString mes=i18n("The file %1 does not exist!").tqarg(url.url()); KMessageBox::sorry(this,mes); fileOk=false; } @@ -183,7 +183,7 @@ void KJumpingCube::openGame() if(!config.hasKey("Version")) { TQString mes=i18n("The file %1 isn't a KJumpingCube gamefile!") - .arg(url.url()); + .tqarg(url.url()); KMessageBox::sorry(this,mes); return; } @@ -197,7 +197,7 @@ void KJumpingCube::openGame() KIO::NetAccess::removeTempFile( tempFile ); } else - KMessageBox::sorry(this,i18n("There was an error loading file\n%1").arg( url.url() )); + KMessageBox::sorry(this,i18n("There was an error loading file\n%1").tqarg( url.url() )); } void KJumpingCube::stop() @@ -223,11 +223,11 @@ void KJumpingCube::changePlayer(int newPlayer) { undoAction->setEnabled(true); currentPlayer->setBackgroundColor(newPlayer == 1 ? Prefs::color1() : Prefs::color2()); - currentPlayer->repaint(); + currentPlayer->tqrepaint(); } void KJumpingCube::showWinner(int player) { - TQString s=i18n("Winner is Player %1!").arg(player); + TQString s=i18n("Winner is Player %1!").tqarg(player); KMessageBox::information(this,s,i18n("Winner")); view->reset(); } diff --git a/kjumpingcube/kjumpingcube.h b/kjumpingcube/kjumpingcube.h index 3d2774f4..14216922 100644 --- a/kjumpingcube/kjumpingcube.h +++ b/kjumpingcube/kjumpingcube.h @@ -42,6 +42,7 @@ class KCubeBoxWidget; */ class KJumpingCube : public KMainWindow { Q_OBJECT + TQ_OBJECT public: /** Default Constructor */ diff --git a/kjumpingcube/settings.ui b/kjumpingcube/settings.ui index 43908b76..d632e88a 100644 --- a/kjumpingcube/settings.ui +++ b/kjumpingcube/settings.ui @@ -1,10 +1,10 @@ Settings - + Settings - + 0 0 @@ -22,7 +22,7 @@ 0 - + frame3 @@ -39,7 +39,7 @@ unnamed - + groupBox3 @@ -56,7 +56,7 @@ unnamed - + kcfg_CubeDim @@ -79,7 +79,7 @@ Right - + textLabel6 @@ -87,14 +87,14 @@ 5x5 - + textLabel8 10x10 - + AlignVCenter|AlignRight @@ -110,14 +110,14 @@ Expanding - + 20 16 - + groupBox7 @@ -136,7 +136,7 @@ - + textLabel1 @@ -144,7 +144,7 @@ Player 1: - + textLabel2 @@ -162,7 +162,7 @@ - + groupBox2 @@ -173,18 +173,18 @@ unnamed - + textLabel4 Average - + AlignCenter - + textLabel3 @@ -192,18 +192,18 @@ Beginner - + textLabel5 Expert - + AlignVCenter|AlignRight - + kcfg_Skill @@ -225,7 +225,7 @@ - + groupBox1 @@ -236,7 +236,7 @@ unnamed - + kcfg_ComputerPlayer1 @@ -244,7 +244,7 @@ Player 1 - + kcfg_ComputerPlayer2 @@ -261,7 +261,7 @@ - + kcolorbutton.h -- cgit v1.2.1