summaryrefslogtreecommitdiffstats
path: root/knetwalk/src
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 /knetwalk/src
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 'knetwalk/src')
-rw-r--r--knetwalk/src/cell.cpp24
-rw-r--r--knetwalk/src/cell.h14
-rw-r--r--knetwalk/src/highscores.cpp10
-rw-r--r--knetwalk/src/highscores.h2
-rw-r--r--knetwalk/src/mainwindow.cpp82
-rw-r--r--knetwalk/src/mainwindow.h34
6 files changed, 83 insertions, 83 deletions
diff --git a/knetwalk/src/cell.cpp b/knetwalk/src/cell.cpp
index 4d561cec..a08b0d78 100644
--- a/knetwalk/src/cell.cpp
+++ b/knetwalk/src/cell.cpp
@@ -12,8 +12,8 @@
* GNU General Public License for more details. *
***************************************************************************/
-#include <qpainter.h>
-#include <qimage.h>
+#include <tqpainter.h>
+#include <tqimage.h>
#include <kglobal.h>
#include <kiconloader.h>
@@ -26,7 +26,7 @@ Cell::PixmapMap Cell::disconnectedpixmap;
void Cell::initPixmaps()
{
- typedef QMap<int, QString> NamesMap;
+ typedef TQMap<int, TQString> NamesMap;
NamesMap names;
names[L] = "0001";
names[D] = "0010";
@@ -46,10 +46,10 @@ void Cell::initPixmaps()
NamesMap::ConstIterator it;
for(it = names.constBegin(); it != names.constEnd(); ++it)
{
- connectedpixmap[it.key()]=new QPixmap(KGlobal::iconLoader()->loadIcon(
+ connectedpixmap[it.key()]=new TQPixmap(KGlobal::iconLoader()->loadIcon(
locate("data","knetwalk/cable"+it.data()+".png"), KIcon::NoGroup, 32) );
- QImage image = connectedpixmap[it.key()]->convertToImage();
+ TQImage image = connectedpixmap[it.key()]->convertToImage();
for(int y = 0; y < image.height(); y++)
{
QRgb* line = (QRgb*)image.scanLine(y);
@@ -65,11 +65,11 @@ void Cell::initPixmaps()
}
}
}
- disconnectedpixmap[it.key()] = new QPixmap(image);
+ disconnectedpixmap[it.key()] = new TQPixmap(image);
}
}
-Cell::Cell(QWidget* parent, int i) : QWidget(parent, 0, WNoAutoErase)
+Cell::Cell(TQWidget* parent, int i) : TQWidget(parent, 0, WNoAutoErase)
{
angle = 0;
light = 0;
@@ -146,7 +146,7 @@ void Cell::setLight(int l)
update();
}
-void Cell::paintEvent(QPaintEvent*)
+void Cell::paintEvent(TQPaintEvent*)
{
if(changed)
{
@@ -157,12 +157,12 @@ void Cell::paintEvent(QPaintEvent*)
pixmap = KGlobal::iconLoader()->loadIcon(locate("data", "knetwalk/background.png"), KIcon::NoGroup, 32);
}
- QPainter paint;
+ TQPainter paint;
paint.begin(&pixmap);
if(light)
{
- paint.setPen(QPen(white, 5));
+ paint.setPen(TQPen(white, 5));
paint.drawLine(0, width() - light, width(), 2 * width() - light);
}
@@ -181,7 +181,7 @@ void Cell::paintEvent(QPaintEvent*)
else paint.drawPixmap(int(-offset), int(-offset), *disconnectedpixmap[ddirs]);
paint.resetXForm();
- QPixmap pix;
+ TQPixmap pix;
if(root)
{
@@ -201,7 +201,7 @@ void Cell::paintEvent(QPaintEvent*)
bitBlt(this, 0, 0, &pixmap);
}
-void Cell::mousePressEvent(QMouseEvent* e)
+void Cell::mousePressEvent(TQMouseEvent* e)
{
if(e->button() == LeftButton)
emit lClicked(iindex);
diff --git a/knetwalk/src/cell.h b/knetwalk/src/cell.h
index 2dd5009c..8e51e349 100644
--- a/knetwalk/src/cell.h
+++ b/knetwalk/src/cell.h
@@ -15,15 +15,15 @@
#ifndef CELL_H
#define CELL_H
-#include <qpixmap.h>
-#include <qwidget.h>
+#include <tqpixmap.h>
+#include <tqwidget.h>
class Cell : public QWidget
{
Q_OBJECT
public:
enum Dirs { Free = 0, U = 1, R = 2, D = 4, L = 8, None = 16 };
- Cell(QWidget* parent, int i);
+ Cell(TQWidget* parent, int i);
int index() const;
void rotate(int a);
void setDirs(Dirs d);
@@ -41,10 +41,10 @@ class Cell : public QWidget
void rClicked(int);
void mClicked(int);
protected:
- virtual void paintEvent(QPaintEvent*);
- virtual void mousePressEvent(QMouseEvent*);
+ virtual void paintEvent(TQPaintEvent*);
+ virtual void mousePressEvent(TQMouseEvent*);
private:
- typedef QMap<int, QPixmap*> PixmapMap;
+ typedef TQMap<int, TQPixmap*> PixmapMap;
static PixmapMap connectedpixmap;
static PixmapMap disconnectedpixmap;
int angle;
@@ -55,7 +55,7 @@ class Cell : public QWidget
bool root;
bool locked;
Dirs ddirs;
- QPixmap pixmap;
+ TQPixmap pixmap;
};
#endif
diff --git a/knetwalk/src/highscores.cpp b/knetwalk/src/highscores.cpp
index 28742662..4bcbf922 100644
--- a/knetwalk/src/highscores.cpp
+++ b/knetwalk/src/highscores.cpp
@@ -31,14 +31,14 @@ namespace KExtHighscore
setShowStatistics(true);
*/
const uint RANGE[16] = { 0, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160 };
- QMemArray<uint> s;
+ TQMemArray<uint> s;
s.duplicate(RANGE, 16);
setScoreHistogram(s, ScoreNotBound);
//Item *item = new Item((uint)0, i18n("Clicks"), Qt::AlignRight);
//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) {
@@ -47,13 +47,13 @@ namespace KExtHighscore
case I18N: return i18n(level[gameType]);
case WW: return data.wwLabel;
}
- return QString::null;*/
+ return TQString::null;*/
return i18n(levels[gameType]);
}
void ExtManager::convertLegacy(uint gameType)
{
- QString group;
+ TQString group;
switch (gameType)
{
case Settings::EnumSkill::Novice: group = "Novice level"; break;
@@ -64,7 +64,7 @@ namespace KExtHighscore
}
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");
int score = cg.config()->readNumEntry("score", 0);
diff --git a/knetwalk/src/highscores.h b/knetwalk/src/highscores.h
index c9f4f7af..67ff21ae 100644
--- a/knetwalk/src/highscores.h
+++ b/knetwalk/src/highscores.h
@@ -27,7 +27,7 @@ namespace KExtHighscore
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/knetwalk/src/mainwindow.cpp b/knetwalk/src/mainwindow.cpp
index 15e615ed..17fa9b82 100644
--- a/knetwalk/src/mainwindow.cpp
+++ b/knetwalk/src/mainwindow.cpp
@@ -12,20 +12,20 @@
* GNU General Public License for more details. *
***************************************************************************/
-#include <qaction.h>
-#include <qapplication.h>
-#include <qeventloop.h>
-#include <qgrid.h>
-#include <qlabel.h>
-#include <qlayout.h>
-#include <qlineedit.h>
-#include <qprocess.h>
-#include <qpushbutton.h>
-#include <qsettings.h>
-#include <qsound.h>
-#include <qtimer.h>
-#include <qtoolbutton.h>
-#include <qwhatsthis.h>
+#include <tqaction.h>
+#include <tqapplication.h>
+#include <tqeventloop.h>
+#include <tqgrid.h>
+#include <tqlabel.h>
+#include <tqlayout.h>
+#include <tqlineedit.h>
+#include <tqprocess.h>
+#include <tqpushbutton.h>
+#include <tqsettings.h>
+#include <tqsound.h>
+#include <tqtimer.h>
+#include <tqtoolbutton.h>
+#include <tqwhatsthis.h>
#include <stdio.h>
#include <stdlib.h>
@@ -50,9 +50,9 @@
#include "cell.h"
#include "mainwindow.h"
-static QMap<Cell::Dirs, Cell::Dirs> contrdirs;
+static TQMap<Cell::Dirs, Cell::Dirs> contrdirs;
-MainWindow::MainWindow(QWidget *parent, const char* name, WFlags /*fl*/) :
+MainWindow::MainWindow(TQWidget *parent, const char* name, WFlags /*fl*/) :
KMainWindow(parent, name, WStyle_NoBorder)
{
m_clickcount = 0;
@@ -64,14 +64,14 @@ MainWindow::MainWindow(QWidget *parent, const char* name, WFlags /*fl*/) :
KNotifyClient::startDaemon();
- KStdGameAction::gameNew(this, SLOT(slotNewGame()), actionCollection());
+ KStdGameAction::gameNew(this, TQT_SLOT(slotNewGame()), actionCollection());
- KStdGameAction::highscores(this, SLOT(showHighscores()), actionCollection());
- KStdGameAction::quit(this, SLOT(close()), actionCollection());
- KStdGameAction::configureHighscores(this, SLOT(configureHighscores()), actionCollection());
+ KStdGameAction::highscores(this, TQT_SLOT(showHighscores()), actionCollection());
+ KStdGameAction::quit(this, TQT_SLOT(close()), actionCollection());
+ KStdGameAction::configureHighscores(this, TQT_SLOT(configureHighscores()), actionCollection());
m_levels = KStdGameAction::chooseGameType(0, 0, actionCollection());
- QStringList lst;
+ TQStringList lst;
lst += i18n("Novice");
lst += i18n("Normal");
lst += i18n("Expert");
@@ -83,10 +83,10 @@ MainWindow::MainWindow(QWidget *parent, const char* name, WFlags /*fl*/) :
statusBar()->insertItem("abcdefghijklmnopqrst: 0 ",1);
setAutoSaveSettings();
createGUI();
- connect(m_levels, SIGNAL(activated(int)), this, SLOT(newGame(int)));
+ connect(m_levels, TQT_SIGNAL(activated(int)), this, TQT_SLOT(newGame(int)));
- QWhatsThis::add(this, i18n("<h3>Rules of the Game</h3>"
+ TQWhatsThis::add(this, i18n("<h3>Rules of the Game</h3>"
"<p>You are the system administrator and your goal"
" is to connect each computer to the central server."
"<p>Click the right mouse button to turn the cable"
@@ -98,8 +98,8 @@ MainWindow::MainWindow(QWidget *parent, const char* name, WFlags /*fl*/) :
const int cellsize = 32;
const int gridsize = cellsize * MasterBoardSize + 2;
- QGrid* grid = new QGrid(MasterBoardSize, this);
- grid->setFrameStyle(QFrame::Panel | QFrame::Sunken);
+ TQGrid* grid = new TQGrid(MasterBoardSize, this);
+ grid->setFrameStyle(TQFrame::Panel | TQFrame::Sunken);
grid->setFixedSize(gridsize, gridsize);
setCentralWidget(grid);
@@ -108,9 +108,9 @@ MainWindow::MainWindow(QWidget *parent, const char* name, WFlags /*fl*/) :
{
board[i] = new Cell(grid, i);
board[i]->setFixedSize(cellsize, cellsize);
- connect(board[i], SIGNAL(lClicked(int)), SLOT(lClicked(int)));
- connect(board[i], SIGNAL(rClicked(int)), SLOT(rClicked(int)));
- connect(board[i], SIGNAL(mClicked(int)), SLOT(mClicked(int)));
+ connect(board[i], TQT_SIGNAL(lClicked(int)), TQT_SLOT(lClicked(int)));
+ connect(board[i], TQT_SIGNAL(rClicked(int)), TQT_SLOT(rClicked(int)));
+ connect(board[i], TQT_SIGNAL(mClicked(int)), TQT_SLOT(mClicked(int)));
}
srand(time(0));
@@ -148,8 +148,8 @@ void MainWindow::newGame(int sk)
Settings::writeConfig();
m_clickcount = 0;
- QString clicks = i18n("Click: %1");
- statusBar()->changeItem(clicks.arg(QString::number(m_clickcount)),1);
+ TQString clicks = i18n("Click: %1");
+ statusBar()->changeItem(clicks.arg(TQString::number(m_clickcount)),1);
KNotifyClient::event(winId(), "startsound", i18n("New Game"));
for(int i = 0; i < MasterBoardSize * MasterBoardSize; i++)
@@ -276,7 +276,7 @@ void MainWindow::addRandomDir(CellList& list)
Cell* dcell = dCell(cell);
Cell* lcell = lCell(cell);
- typedef QMap<Cell::Dirs, Cell*> CellMap;
+ typedef TQMap<Cell::Dirs, Cell*> CellMap;
CellMap freecells;
if(ucell && ucell->dirs() == Cell::Free) freecells[Cell::U] = ucell;
@@ -359,9 +359,9 @@ void MainWindow::rotate(int index, bool toleft)
updateConnections();
for(int i = 0; i < 14; i++)
{
- kapp->eventLoop()->processEvents(QEventLoop::ExcludeUserInput);
- QTimer::singleShot(20, board[index], SLOT(update()));
- kapp->eventLoop()->processEvents(QEventLoop::ExcludeUserInput | QEventLoop::WaitForMore);
+ kapp->eventLoop()->processEvents(TQEventLoop::ExcludeUserInput);
+ TQTimer::singleShot(20, board[index], TQT_SLOT(update()));
+ kapp->eventLoop()->processEvents(TQEventLoop::ExcludeUserInput | TQEventLoop::WaitForMore);
board[index]->rotate(toleft ? -6 : 6);
}
@@ -369,8 +369,8 @@ void MainWindow::rotate(int index, bool toleft)
KNotifyClient::event(winId(), "connectsound");
m_clickcount++;
- QString clicks = i18n("Click: %1");
- statusBar()->changeItem(clicks.arg(QString::number(m_clickcount)),1);
+ TQString clicks = i18n("Click: %1");
+ statusBar()->changeItem(clicks.arg(TQString::number(m_clickcount)),1);
if (isGameOver())
{
@@ -388,10 +388,10 @@ void MainWindow::blink(int index)
{
for(int i = 0; i < board[index]->width() * 2; i += 2)
{
- kapp->eventLoop()->processEvents(QEventLoop::ExcludeUserInput);
- QTimer::singleShot(20, board[index], SLOT(update()));
- kapp->eventLoop()->processEvents(QEventLoop::ExcludeUserInput |
- QEventLoop::WaitForMore);
+ kapp->eventLoop()->processEvents(TQEventLoop::ExcludeUserInput);
+ TQTimer::singleShot(20, board[index], TQT_SLOT(update()));
+ kapp->eventLoop()->processEvents(TQEventLoop::ExcludeUserInput |
+ TQEventLoop::WaitForMore);
board[index]->setLight(i);
}
board[index]->setLight(0);
@@ -408,7 +408,7 @@ bool MainWindow::isGameOver()
return true;
}
-void MainWindow::closeEvent(QCloseEvent* event)
+void MainWindow::closeEvent(TQCloseEvent* event)
{
event->accept();
}
diff --git a/knetwalk/src/mainwindow.h b/knetwalk/src/mainwindow.h
index c28b6ed6..622db60c 100644
--- a/knetwalk/src/mainwindow.h
+++ b/knetwalk/src/mainwindow.h
@@ -28,9 +28,9 @@ class MainWindow : public KMainWindow
{
Q_OBJECT
public:
- MainWindow(QWidget *parent=0, const char* name=0, WFlags fl=0);
+ MainWindow(TQWidget *parent=0, const char* name=0, WFlags fl=0);
protected:
- virtual void closeEvent(QCloseEvent*);
+ virtual void closeEvent(TQCloseEvent*);
private:
//enum Skill { Novice, Normal, Expert, Master };
enum BoardSize
@@ -45,7 +45,7 @@ class MainWindow : public KMainWindow
NumHighscores = 10,
MinimumNumCells = 20
};
- typedef QValueList<Cell*> CellList;
+ typedef TQValueList<Cell*> CellList;
public slots:
void slotNewGame();
void newGame(int);
@@ -64,30 +64,30 @@ class MainWindow : public KMainWindow
Cell* lCell(Cell* cell) const;
Cell* rCell(Cell* cell) const;
bool isGameOver();
- bool startBrowser(const QString& url);
+ bool startBrowser(const TQString& url);
bool updateConnections();
void blink(int index);
void rotate(int index, bool toleft);
void addRandomDir(CellList& list);
- void dialog(const QString& caption, const QString& text);
+ void dialog(const TQString& caption, const TQString& text);
private:
bool wrapped;
Cell* root;
Cell* board[MasterBoardSize * MasterBoardSize];
- QSound* clicksound;
- QSound* connectsound;
- QSound* startsound;
- QSound* turnsound;
- QSound* winsound;
+ TQSound* clicksound;
+ TQSound* connectsound;
+ TQSound* startsound;
+ TQSound* turnsound;
+ TQSound* winsound;
- QString username;
- QString soundpath;
- QAction* soundaction;
- QStringList highscores;
- QLCDNumber* lcd;
- QPopupMenu* gamemenu;
- QPopupMenu* skillmenu;
+ TQString username;
+ TQString soundpath;
+ TQAction* soundaction;
+ TQStringList highscores;
+ TQLCDNumber* lcd;
+ TQPopupMenu* gamemenu;
+ TQPopupMenu* skillmenu;
int m_clickcount;
KSelectAction* m_levels;