summaryrefslogtreecommitdiffstats
path: root/kjumpingcube
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-07-31 19:42:31 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-07-31 19:42:31 +0000
commit576eb4299a00bc053db35414406f46372a0f70f2 (patch)
tree4c030922d533821db464af566188e7d40cc8848c /kjumpingcube
parent0718336b6017d1a4fc1d626544180a5a2a29ddec (diff)
downloadtdegames-576eb4299a00bc053db35414406f46372a0f70f2.tar.gz
tdegames-576eb4299a00bc053db35414406f46372a0f70f2.zip
Trinity Qt initial conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdegames@1157643 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kjumpingcube')
-rw-r--r--kjumpingcube/kcubeboxwidget.cpp52
-rw-r--r--kjumpingcube/kcubeboxwidget.h20
-rw-r--r--kjumpingcube/kcubewidget.cpp38
-rw-r--r--kjumpingcube/kcubewidget.h20
-rw-r--r--kjumpingcube/kjumpingcube.cpp54
-rw-r--r--kjumpingcube/kjumpingcube.h2
6 files changed, 93 insertions, 93 deletions
diff --git a/kjumpingcube/kcubeboxwidget.cpp b/kjumpingcube/kcubeboxwidget.cpp
index 98f305d9..bca13210 100644
--- a/kjumpingcube/kcubeboxwidget.cpp
+++ b/kjumpingcube/kcubeboxwidget.cpp
@@ -23,15 +23,15 @@
#include <kapplication.h>
#include <kconfig.h>
-#include <qlayout.h>
-#include <qtimer.h>
+#include <tqlayout.h>
+#include <tqtimer.h>
#include <assert.h>
#include <kcursor.h>
#include "prefs.h"
-KCubeBoxWidget::KCubeBoxWidget(const int d,QWidget *parent,const char *name)
- : QWidget(parent,name),
+KCubeBoxWidget::KCubeBoxWidget(const int d,TQWidget *parent,const char *name)
+ : TQWidget(parent,name),
CubeBoxBase<KCubeWidget>(d)
{
init();
@@ -39,8 +39,8 @@ KCubeBoxWidget::KCubeBoxWidget(const int d,QWidget *parent,const char *name)
-KCubeBoxWidget::KCubeBoxWidget(CubeBox& box,QWidget *parent,const char *name)
- :QWidget(parent,name),
+KCubeBoxWidget::KCubeBoxWidget(CubeBox& box,TQWidget *parent,const char *name)
+ :TQWidget(parent,name),
CubeBoxBase<KCubeWidget>(box.dim())
{
init();
@@ -57,8 +57,8 @@ KCubeBoxWidget::KCubeBoxWidget(CubeBox& box,QWidget *parent,const char *name)
-KCubeBoxWidget::KCubeBoxWidget(const KCubeBoxWidget& box,QWidget *parent,const char *name)
- :QWidget(parent,name),
+KCubeBoxWidget::KCubeBoxWidget(const KCubeBoxWidget& box,TQWidget *parent,const char *name)
+ :TQWidget(parent,name),
CubeBoxBase<KCubeWidget>(box.dim())
{
init();
@@ -198,7 +198,7 @@ void KCubeBoxWidget::getHint()
cubes[row][column]->showHint();
}
-void KCubeBoxWidget::setColor(Player player,QPalette color)
+void KCubeBoxWidget::setColor(Player player,TQPalette color)
{
KCubeWidget::setColor((Cube::Owner)player,color);
@@ -255,9 +255,9 @@ void KCubeBoxWidget::saveProperties(KConfigBase* config)
// save current player
config->writeEntry("onTurn",(int)currentPlayer);
- QStrList list;
+ TQStrList list;
list.setAutoDelete(true);
- QString owner, value, key;
+ TQString owner, value, key;
int cubeDim=dim();
for(int row=0; row < cubeDim ; row++)
@@ -277,9 +277,9 @@ void KCubeBoxWidget::saveProperties(KConfigBase* config)
void KCubeBoxWidget::readProperties(KConfigBase* config)
{
- QStrList list;
+ TQStrList list;
list.setAutoDelete(true);
- QString owner, value, key;
+ TQString owner, value, key;
setDim(config->readNumEntry("CubeDim",5));
int cubeDim=dim();
@@ -413,7 +413,7 @@ int KCubeBoxWidget::skill() const
return brain.skill();
}
-QPalette KCubeBoxWidget::color(Player forWhom)
+TQPalette KCubeBoxWidget::color(Player forWhom)
{
return KCubeWidget::color((KCubeWidget::Owner)forWhom);
}
@@ -429,18 +429,18 @@ void KCubeBoxWidget::init()
currentPlayer=One;
moveDelay=100;
- moveTimer=new QTimer(this);
+ moveTimer=new TQTimer(this);
computerPlOne=false;
computerPlTwo=false;
KCubeWidget::enableClicks(true);
loadSettings();
- connect(moveTimer,SIGNAL(timeout()),SLOT(nextLoopStep()));
- connect(this,SIGNAL(startedThinking()),SLOT(setWaitCursor()));
- connect(this,SIGNAL(stoppedThinking()),SLOT(setNormalCursor()));
- connect(this,SIGNAL(startedMoving()),SLOT(setWaitCursor()));
- connect(this,SIGNAL(stoppedMoving()),SLOT(setNormalCursor()));
- connect(this,SIGNAL(playerWon(int)),SLOT(stopActivities()));
+ connect(moveTimer,TQT_SIGNAL(timeout()),TQT_SLOT(nextLoopStep()));
+ connect(this,TQT_SIGNAL(startedThinking()),TQT_SLOT(setWaitCursor()));
+ connect(this,TQT_SIGNAL(stoppedThinking()),TQT_SLOT(setNormalCursor()));
+ connect(this,TQT_SIGNAL(startedMoving()),TQT_SLOT(setWaitCursor()));
+ connect(this,TQT_SIGNAL(stoppedMoving()),TQT_SLOT(setNormalCursor()));
+ connect(this,TQT_SIGNAL(playerWon(int)),TQT_SLOT(stopActivities()));
setNormalCursor();
@@ -453,7 +453,7 @@ void KCubeBoxWidget::initCubes()
int i,j;
// create Layout
- layout=new QGridLayout(this,s,s);
+ layout=new TQGridLayout(this,s,s);
for(i=0;i<s;i++)
@@ -476,8 +476,8 @@ void KCubeBoxWidget::initCubes()
cubes[i][j]->setCoordinates(i,j);
layout->addWidget(cubes[i][j],i,j);
cubes[i][j]->show();
- connect(cubes[i][j],SIGNAL(clicked(int,int,bool)),SLOT(stopHint()));
- connect(cubes[i][j],SIGNAL(clicked(int,int,bool)),SLOT(checkClick(int,int,bool)));
+ 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)));
}
// initialize cubes
@@ -504,9 +504,9 @@ void KCubeBoxWidget::initCubes()
}
-QSize KCubeBoxWidget::sizeHint() const
+TQSize KCubeBoxWidget::sizeHint() const
{
- return QSize(400,400);
+ return TQSize(400,400);
}
void KCubeBoxWidget::deleteCubes()
diff --git a/kjumpingcube/kcubeboxwidget.h b/kjumpingcube/kcubeboxwidget.h
index ff2f4ac0..ca532244 100644
--- a/kjumpingcube/kcubeboxwidget.h
+++ b/kjumpingcube/kcubeboxwidget.h
@@ -25,7 +25,7 @@
#include "cubeboxbase.h"
#include "kcubewidget.h"
#include "brain.h"
-#include <qwidget.h>
+#include <tqwidget.h>
class QGridLayout;
class CubeBox;
@@ -48,14 +48,14 @@ struct Loop
};
-class KCubeBoxWidget : public QWidget , public CubeBoxBase<KCubeWidget>
+class KCubeBoxWidget : public TQWidget , public CubeBoxBase<KCubeWidget>
{
Q_OBJECT
public:
- KCubeBoxWidget(const int dim=1,QWidget *parent=0,const char *name=0);
+ KCubeBoxWidget(const int dim=1,TQWidget *parent=0,const char *name=0);
- KCubeBoxWidget(CubeBox& box, QWidget *parent=0,const char *name=0);
- KCubeBoxWidget(const KCubeBoxWidget& box,QWidget *parent=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);
virtual ~KCubeBoxWidget();
KCubeBoxWidget& operator= (CubeBox& box);
@@ -75,7 +75,7 @@ public:
* @param forWhom for which player the color should be set
* @param color color for player one
*/
- void setColor(Player forWhom,QPalette color);
+ void setColor(Player forWhom,TQPalette color);
/**
* sets number of Cubes in a row/column to 'size'.
*/
@@ -100,7 +100,7 @@ public:
bool isMoving() const;
/** returns current Color for Player �forWhom� */
- QPalette color(Player forWhom);
+ TQPalette color(Player forWhom);
/**
* checks if 'player' is a computerplayer an computes next move if TRUE
@@ -130,7 +130,7 @@ signals:
void stoppedThinking();
protected:
- virtual QSize sizeHint() const;
+ virtual TQSize sizeHint() const;
virtual void deleteCubes();
virtual void initCubes();
@@ -146,11 +146,11 @@ protected slots:
private:
void init();
- QGridLayout *layout;
+ TQGridLayout *layout;
CubeBox *undoBox;
Brain brain;
- QTimer *moveTimer;
+ TQTimer *moveTimer;
int moveDelay;
Loop loop;
/** */
diff --git a/kjumpingcube/kcubewidget.cpp b/kjumpingcube/kcubewidget.cpp
index f23e3cce..d9500084 100644
--- a/kjumpingcube/kcubewidget.cpp
+++ b/kjumpingcube/kcubewidget.cpp
@@ -21,8 +21,8 @@
**************************************************************************** */
#include "kcubewidget.h"
-#include <qpainter.h>
-#include <qtimer.h>
+#include <tqpainter.h>
+#include <tqtimer.h>
#include <kapplication.h>
#include <kdebug.h>
@@ -31,8 +31,8 @@
** static elements **
** ****************************************************** */
bool KCubeWidget::_clicksAllowed=true;
-QPalette KCubeWidget::color1;
-QPalette KCubeWidget::color2;
+TQPalette KCubeWidget::color1;
+TQPalette KCubeWidget::color2;
void KCubeWidget::enableClicks(bool flag)
@@ -41,7 +41,7 @@ void KCubeWidget::enableClicks(bool flag)
}
-void KCubeWidget::setColor(Owner forWhom, QPalette newPalette)
+void KCubeWidget::setColor(Owner forWhom, TQPalette newPalette)
{
if(forWhom==One)
{
@@ -53,9 +53,9 @@ void KCubeWidget::setColor(Owner forWhom, QPalette newPalette)
}
}
-QPalette KCubeWidget::color(Owner forWhom)
+TQPalette KCubeWidget::color(Owner forWhom)
{
- QPalette color;
+ TQPalette color;
if(forWhom==One)
{
color=color1;
@@ -73,9 +73,9 @@ QPalette KCubeWidget::color(Owner forWhom)
** public functions **
** ****************************************************** */
-KCubeWidget::KCubeWidget(QWidget* parent,const char* name
+KCubeWidget::KCubeWidget(TQWidget* parent,const char* name
,Owner owner,int value,int max)
- : QFrame(parent,name),
+ : TQFrame(parent,name),
Cube(owner,value,max)
{
setFrameStyle(Panel|Raised);
@@ -86,9 +86,9 @@ KCubeWidget::KCubeWidget(QWidget* parent,const char* name
//initialize hintTimer
// will be automatically destroyed by the parent
- hintTimer = new QTimer(this);
+ hintTimer = new TQTimer(this);
hintCounter=0;
- connect(hintTimer,SIGNAL(timeout()),SLOT(hint()));
+ connect(hintTimer,TQT_SIGNAL(timeout()),TQT_SLOT(hint()));
setPalette(kapp->palette());
@@ -234,7 +234,7 @@ void KCubeWidget::hint()
** Event handler **
** ****************************************************** */
-void KCubeWidget::mouseReleaseEvent(QMouseEvent *e)
+void KCubeWidget::mouseReleaseEvent(TQMouseEvent *e)
{
// only accept click if it was inside this cube
if(e->x()< 0 || e->x() > width() || e->y() < 0 || e->y() > height())
@@ -249,19 +249,19 @@ void KCubeWidget::mouseReleaseEvent(QMouseEvent *e)
-void KCubeWidget::drawContents(QPainter *painter)
+void KCubeWidget::drawContents(TQPainter *painter)
{
- QRect contents=contentsRect();
- QPixmap buffer(contents.size());
+ TQRect contents=contentsRect();
+ TQPixmap buffer(contents.size());
buffer.fill(this,contents.topLeft());
- QPainter *p=new QPainter;
+ TQPainter *p=new QPainter;
p->begin(&buffer);
int h=contents.height();
int w=contents.width();
int circleSize=(h<w?h:w)/7;
int points=value();
- QBrush brush("black");
- QPen pen("black");
+ TQBrush brush("black");
+ TQPen pen("black");
p->setBrush(brush);
p->setPen(pen);
switch(points)
@@ -333,7 +333,7 @@ void KCubeWidget::drawContents(QPainter *painter)
default:
kdDebug() << "cube had value " << points << endl;
- QString s;
+ TQString s;
s.sprintf("%d",points);
p->drawText(w/2,h/2,s);
break;
diff --git a/kjumpingcube/kcubewidget.h b/kjumpingcube/kcubewidget.h
index f0d8d8cd..463a7d89 100644
--- a/kjumpingcube/kcubewidget.h
+++ b/kjumpingcube/kcubewidget.h
@@ -22,7 +22,7 @@
#ifndef KCUBEWIDGET_H
#define KCUBEWIDGET_H
-#include <qframe.h>
+#include <tqframe.h>
#include "cube.h"
class QPalette;
@@ -32,13 +32,13 @@ class QTimer;
/**
*
*/
-class KCubeWidget : public QFrame , public Cube
+class KCubeWidget : public TQFrame , public Cube
{
Q_OBJECT
public:
/** constructs a new KCubeWidget*/
- KCubeWidget(QWidget* parent=0,const char* name=0
+ KCubeWidget(TQWidget* parent=0,const char* name=0
,Owner owner=Cube::Nobody,int value=1,int max=0);
virtual ~KCubeWidget();
@@ -74,8 +74,8 @@ public:
/** enables or disables possibility to click a cube*/
static void enableClicks(bool flag);
- static void setColor(Owner forWhom, QPalette newPalette);
- static QPalette color(Owner forWhom);
+ static void setColor(Owner forWhom, TQPalette newPalette);
+ static TQPalette color(Owner forWhom);
public slots:
/** resets the Cube to default values */
@@ -88,10 +88,10 @@ signals:
protected:
/** checks, if mouseclick was inside this cube*/
- virtual void mouseReleaseEvent(QMouseEvent*);
+ virtual void mouseReleaseEvent(TQMouseEvent*);
/** refreshs the contents of the Cube */
- virtual void drawContents(QPainter*);
+ virtual void drawContents(TQPainter*);
@@ -108,11 +108,11 @@ private:
int _row;
int _column;
- QTimer *hintTimer;
+ TQTimer *hintTimer;
static bool _clicksAllowed;
- static QPalette color1;
- static QPalette color2;
+ static TQPalette color1;
+ static TQPalette color2;
};
diff --git a/kjumpingcube/kjumpingcube.cpp b/kjumpingcube/kjumpingcube.cpp
index 13619d99..f63665af 100644
--- a/kjumpingcube/kjumpingcube.cpp
+++ b/kjumpingcube/kjumpingcube.cpp
@@ -29,7 +29,7 @@
#include "prefs.h"
-#include <qregexp.h>
+#include <tqregexp.h>
#include <klocale.h>
#include <kfiledialog.h>
@@ -49,24 +49,24 @@
KJumpingCube::KJumpingCube()
: view(new KCubeBoxWidget(5, this, "KCubeBoxWidget"))
{
- connect(view,SIGNAL(playerChanged(int)),SLOT(changePlayer(int)));
- connect(view,SIGNAL(stoppedMoving()),SLOT(disableStop()));
- connect(view,SIGNAL(stoppedThinking()),SLOT(disableStop()));
- connect(view,SIGNAL(startedMoving()),SLOT(enableStop_Moving()));
- connect(view,SIGNAL(startedThinking()),SLOT(enableStop_Thinking()));
- connect(view,SIGNAL(playerWon(int)),SLOT(showWinner(int)));
+ connect(view,TQT_SIGNAL(playerChanged(int)),TQT_SLOT(changePlayer(int)));
+ connect(view,TQT_SIGNAL(stoppedMoving()),TQT_SLOT(disableStop()));
+ connect(view,TQT_SIGNAL(stoppedThinking()),TQT_SLOT(disableStop()));
+ connect(view,TQT_SIGNAL(startedMoving()),TQT_SLOT(enableStop_Moving()));
+ connect(view,TQT_SIGNAL(startedThinking()),TQT_SLOT(enableStop_Thinking()));
+ connect(view,TQT_SIGNAL(playerWon(int)),TQT_SLOT(showWinner(int)));
// tell the KMainWindow that this is indeed the main widget
setCentralWidget(view);
// init statusbar
- QString s = i18n("Current player:");
+ TQString s = i18n("Current player:");
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() );
- currentPlayer = new QWidget(this, "currentPlayer");
+ currentPlayer = new TQWidget(this, "currentPlayer");
currentPlayer->setFixedWidth(40);
statusBar()->addWidget(currentPlayer, ID_STATUS_TURN, false);
statusBar()->setItemAlignment(ID_STATUS_TURN, AlignLeft | AlignVCenter);
@@ -76,19 +76,19 @@ KJumpingCube::KJumpingCube()
}
void KJumpingCube::initKAction() {
- KStdGameAction::gameNew(this, SLOT(newGame()), actionCollection());
- KStdGameAction::load(this, SLOT(openGame()), actionCollection());
- KStdGameAction::save(this, SLOT(save()), actionCollection());
- KStdGameAction::saveAs(this, SLOT(saveAs()), actionCollection());
- KStdGameAction::quit(this, SLOT(close()), actionCollection());
+ 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());
- hintAction = KStdGameAction::hint(view, SLOT(getHint()), actionCollection());
+ hintAction = KStdGameAction::hint(view, TQT_SLOT(getHint()), actionCollection());
stopAction = new KAction(i18n("Stop &Thinking"), "stop",
- Qt::Key_Escape, this, SLOT(stop()), actionCollection(), "game_stop");
+ Qt::Key_Escape, this, TQT_SLOT(stop()), actionCollection(), "game_stop");
stopAction->setEnabled(false);
- undoAction = KStdGameAction::undo(this, SLOT(undo()), actionCollection());
+ undoAction = KStdGameAction::undo(this, TQT_SLOT(undo()), actionCollection());
undoAction->setEnabled(false);
- KStdAction::preferences(this, SLOT(showOptions()), actionCollection());
+ KStdAction::preferences(this, TQT_SLOT(showOptions()), actionCollection());
setupGUI();
}
@@ -114,7 +114,7 @@ void KJumpingCube::saveGame(bool saveAs)
return;
// check filename
- QRegExp pattern("*.kjc",true,true);
+ TQRegExp pattern("*.kjc",true,true);
if(!pattern.exactMatch(url.filename()))
{
url.setFileName( url.filename()+".kjc" );
@@ -122,9 +122,9 @@ void KJumpingCube::saveGame(bool saveAs)
if(KIO::NetAccess::exists(url,false,this))
{
- QString mes=i18n("The file %1 exists.\n"
+ TQString mes=i18n("The file %1 exists.\n"
"Do you want to overwrite it?").arg(url.url());
- result = KMessageBox::warningContinueCancel(this, mes, QString::null, i18n("Overwrite"));
+ result = KMessageBox::warningContinueCancel(this, mes, TQString::null, i18n("Overwrite"));
if(result==KMessageBox::Cancel)
return;
}
@@ -146,7 +146,7 @@ void KJumpingCube::saveGame(bool saveAs)
if(KIO::NetAccess::upload( tempFile.name(),gameURL,this ))
{
- QString s=i18n("game saved as %1");
+ TQString s=i18n("game saved as %1");
s=s.arg(gameURL.url());
statusBar()->message(s,MESSAGE_TIME);
}
@@ -168,21 +168,21 @@ void KJumpingCube::openGame()
return;
if(!KIO::NetAccess::exists(url,true,this))
{
- QString mes=i18n("The file %1 does not exist!").arg(url.url());
+ TQString mes=i18n("The file %1 does not exist!").arg(url.url());
KMessageBox::sorry(this,mes);
fileOk=false;
}
}
while(!fileOk);
- QString tempFile;
+ TQString tempFile;
if( KIO::NetAccess::download( url, tempFile, this ) )
{
KSimpleConfig config(tempFile,true);
config.setGroup("KJumpingCube");
if(!config.hasKey("Version"))
{
- QString mes=i18n("The file %1 isn't a KJumpingCube gamefile!")
+ TQString mes=i18n("The file %1 isn't a KJumpingCube gamefile!")
.arg(url.url());
KMessageBox::sorry(this,mes);
return;
@@ -227,7 +227,7 @@ void KJumpingCube::changePlayer(int newPlayer)
}
void KJumpingCube::showWinner(int player) {
- QString s=i18n("Winner is Player %1!").arg(player);
+ TQString s=i18n("Winner is Player %1!").arg(player);
KMessageBox::information(this,s,i18n("Winner"));
view->reset();
}
@@ -270,7 +270,7 @@ void KJumpingCube::showOptions(){
KConfigDialog *dialog = new KConfigDialog(this, "settings", Prefs::self(), KDialogBase::Swallow);
dialog->addPage(new Settings(0, "General"), i18n("General"), "package_settings");
- connect(dialog, SIGNAL(settingsChanged()), view, SLOT(loadSettings()));
+ connect(dialog, TQT_SIGNAL(settingsChanged()), view, TQT_SLOT(loadSettings()));
dialog->show();
}
diff --git a/kjumpingcube/kjumpingcube.h b/kjumpingcube/kjumpingcube.h
index 7ed961c7..3d2774f4 100644
--- a/kjumpingcube/kjumpingcube.h
+++ b/kjumpingcube/kjumpingcube.h
@@ -49,7 +49,7 @@ public:
private:
KCubeBoxWidget *view;
- QWidget *currentPlayer;
+ TQWidget *currentPlayer;
KAction *undoAction, *stopAction, *hintAction;
KURL gameURL;