From 576eb4299a00bc053db35414406f46372a0f70f2 Mon Sep 17 00:00:00 2001 From: tpearson Date: Sat, 31 Jul 2010 19:42:31 +0000 Subject: Trinity Qt initial conversion git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdegames@1157643 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- ksame/KSameWidget.cpp | 48 +++++++++++++++++++++---------------------- ksame/KSameWidget.h | 2 +- ksame/StoneField.cpp | 2 +- ksame/StoneField.h | 4 ++-- ksame/StoneWidget.cpp | 56 +++++++++++++++++++++++++-------------------------- ksame/StoneWidget.h | 20 +++++++++--------- ksame/main.cpp | 4 ++-- 7 files changed, 68 insertions(+), 68 deletions(-) (limited to 'ksame') diff --git a/ksame/KSameWidget.cpp b/ksame/KSameWidget.cpp index e9f2d730..a0e0142e 100644 --- a/ksame/KSameWidget.cpp +++ b/ksame/KSameWidget.cpp @@ -21,8 +21,8 @@ #include "KSameWidget.h" -#include -#include +#include +#include #include #include @@ -46,20 +46,20 @@ static int default_colors=3; #define Board KScoreDialog::Custom1 -KSameWidget::KSameWidget(QWidget *parent, const char* name, WFlags fl) : +KSameWidget::KSameWidget(TQWidget *parent, const char* name, WFlags fl) : KMainWindow(parent,name,fl) { - KStdGameAction::gameNew(this, SLOT(m_new()), actionCollection(), "game_new"); + KStdGameAction::gameNew(this, TQT_SLOT(m_new()), actionCollection(), "game_new"); restart = new KAction(i18n("&Restart This Board"), CTRL+Key_R, this, - SLOT(m_restart()), actionCollection(), "game_restart"); - KStdGameAction::highscores(this, SLOT(m_showhs()), actionCollection(), "game_highscores"); - KStdGameAction::quit(this, SLOT(close()), actionCollection(), "game_quit"); - undo = KStdGameAction::undo(this, SLOT(m_undo()), actionCollection(), "edit_undo"); + TQT_SLOT(m_restart()), actionCollection(), "game_restart"); + KStdGameAction::highscores(this, TQT_SLOT(m_showhs()), actionCollection(), "game_highscores"); + KStdGameAction::quit(this, TQT_SLOT(close()), actionCollection(), "game_quit"); + undo = KStdGameAction::undo(this, TQT_SLOT(m_undo()), actionCollection(), "edit_undo"); random = new KToggleAction(i18n("&Random Board"), 0, 0, 0, actionCollection(), "random_board"); - showNumberRemaining = new KToggleAction(i18n("&Show Number Remaining"), 0, this, SLOT(showNumberRemainingToggled()), actionCollection(), "showNumberRemaining"); + showNumberRemaining = new KToggleAction(i18n("&Show Number Remaining"), 0, this, TQT_SLOT(showNumberRemainingToggled()), actionCollection(), "showNumberRemaining"); - KStdAction::configureNotifications(this, SLOT(configureNotifications()), + KStdAction::configureNotifications(this, TQT_SLOT(configureNotifications()), actionCollection()); status=statusBar(); @@ -70,14 +70,14 @@ KSameWidget::KSameWidget(QWidget *parent, const char* name, WFlags fl) : stone = new StoneWidget(this,15,10); - connect( stone, SIGNAL(s_gameover()), this, SLOT(gameover())); - connect( stone, SIGNAL(s_colors(int)), this, SLOT(setColors(int))); - connect( stone, SIGNAL(s_board(int)), this, SLOT(setBoard(int))); - connect( stone, SIGNAL(s_marked(int)), this, SLOT(setMarked(int))); - connect( stone, SIGNAL(s_score(int)), this, SLOT(setScore(int))); - connect( stone, SIGNAL(s_remove(int,int)), this, SLOT(stonesRemoved(int,int))); + connect( stone, TQT_SIGNAL(s_gameover()), this, TQT_SLOT(gameover())); + connect( stone, TQT_SIGNAL(s_colors(int)), this, TQT_SLOT(setColors(int))); + connect( stone, TQT_SIGNAL(s_board(int)), this, TQT_SLOT(setBoard(int))); + connect( stone, TQT_SIGNAL(s_marked(int)), this, TQT_SLOT(setMarked(int))); + connect( stone, TQT_SIGNAL(s_score(int)), this, TQT_SLOT(setScore(int))); + connect( stone, TQT_SIGNAL(s_remove(int,int)), this, TQT_SLOT(stonesRemoved(int,int))); - connect(stone, SIGNAL(s_sizechanged()), this, SLOT(sizeChanged())); + connect(stone, TQT_SIGNAL(s_sizechanged()), this, TQT_SLOT(sizeChanged())); sizeChanged(); setCentralWidget(stone); @@ -119,10 +119,10 @@ void KSameWidget::sizeChanged() { void KSameWidget::showNumberRemainingToggled() { if(showNumberRemaining->isChecked()){ - QStringList list; + TQStringList list; for(int i=1;i<=stone->colors();i++) - list.append(QString("%1").arg(stone->count(i))); - QString count = QString(" (%1)").arg(list.join(",")); + list.append(TQString("%1").arg(stone->count(i))); + TQString count = TQString(" (%1)").arg(list.join(",")); status->changeItem(i18n("%1 Colors%2").arg(stone->colors()).arg(count),1); } else status->changeItem(i18n("%1 Colors").arg(stone->colors()),1); @@ -156,7 +156,7 @@ void KSameWidget::m_new() { KDialogBase::Ok | KDialogBase::Cancel, KDialogBase::Ok); - QVBox *page = dlg.makeVBoxMainWidget(); + TQVBox *page = dlg.makeVBoxMainWidget(); KIntNumInput bno(0, page); bno.setRange(0, 1000000, 1); @@ -207,10 +207,10 @@ void KSameWidget::stonesRemoved(int,int) { void KSameWidget::setScore(int score) { if(showNumberRemaining->isChecked()){ - QStringList list; + TQStringList list; for(int i=1;i<=stone->colors();i++) - list.append(QString("%1").arg(stone->count(i))); - QString count = QString(" (%1)").arg(list.join(",")); + list.append(TQString("%1").arg(stone->count(i))); + TQString count = TQString(" (%1)").arg(list.join(",")); status->changeItem(i18n("%1 Colors%2").arg(stone->colors()).arg(count),1); } status->changeItem(i18n("Score: %1").arg(score, 6),4); diff --git a/ksame/KSameWidget.h b/ksame/KSameWidget.h index ff02e1c4..46154094 100644 --- a/ksame/KSameWidget.h +++ b/ksame/KSameWidget.h @@ -31,7 +31,7 @@ class KSameWidget: public KMainWindow { Q_OBJECT public: - KSameWidget(QWidget *parent=0, const char* name=0, WFlags fl=0); + KSameWidget(TQWidget *parent=0, const char* name=0, WFlags fl=0); private slots: /* File Menu */ diff --git a/ksame/StoneField.cpp b/ksame/StoneField.cpp index 3862d7fb..673e0e38 100644 --- a/ksame/StoneField.cpp +++ b/ksame/StoneField.cpp @@ -60,7 +60,7 @@ StoneField::StoneField(int width, int height, Q_ASSERT(width>0); Q_ASSERT(height>0); - if (undoenabled) undolist=new QPtrList; + if (undoenabled) undolist=new TQPtrList; else undolist=0; sizex=width; diff --git a/ksame/StoneField.h b/ksame/StoneField.h index df199605..d38a19b6 100644 --- a/ksame/StoneField.h +++ b/ksame/StoneField.h @@ -23,7 +23,7 @@ #define _STONEFIELD #include -#include +#include struct Stone { unsigned char color; @@ -69,7 +69,7 @@ private: int marked; KRandomSequence random; - QPtrList *undolist; + TQPtrList *undolist; public: StoneField(int width=15,int height=10, int colors=3,unsigned int board=0, diff --git a/ksame/StoneWidget.cpp b/ksame/StoneWidget.cpp index 3d4114de..81fafca9 100644 --- a/ksame/StoneWidget.cpp +++ b/ksame/StoneWidget.cpp @@ -22,11 +22,11 @@ #include #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include #include @@ -42,15 +42,15 @@ struct StoneSlice { - QPixmap stone; + TQPixmap stone; }; -StoneWidget::StoneWidget( QWidget *parent, int x, int y ) - : QWidget(parent,"StoneWidget"), stonefield(x,y) +StoneWidget::StoneWidget( TQWidget *parent, int x, int y ) + : TQWidget(parent,"StoneWidget"), stonefield(x,y) { - setBackgroundPixmap(QPixmap(locate("wallpaper", "Time-For-Lunch-2.jpg"))); - QPixmap stonemap(locate("appdata", "stones.png")); + setBackgroundPixmap(TQPixmap(locate("wallpaper", "Time-For-Lunch-2.jpg"))); + TQPixmap stonemap(locate("appdata", "stones.png")); assert(!stonemap.isNull()); @@ -65,7 +65,7 @@ StoneWidget::StoneWidget( QWidget *parent, int x, int y ) stone_height=stonemap.height()/maxcolors; map = new StoneSlice*[maxcolors]; - QBitmap mask; + TQBitmap mask; for (int c = 0; c < maxcolors; c++) { map[c] = new StoneSlice[maxslices]; @@ -76,7 +76,7 @@ StoneWidget::StoneWidget( QWidget *parent, int x, int y ) &stonemap, stone_width * s, c*stone_height, stone_width,stone_height,CopyROP,false); - QImage im = map[c][s].stone.convertToImage(); + TQImage im = map[c][s].stone.convertToImage(); mask = im.createHeuristicMask(); map[c][s].stone.setMask(mask); } @@ -87,7 +87,7 @@ StoneWidget::StoneWidget( QWidget *parent, int x, int y ) setMouseTracking(true); - // QColor c(115,115,115); + // TQColor c(115,115,115); // setBackgroundColor(c); // emit s_sizechanged(); @@ -127,7 +127,7 @@ StoneWidget::marked() { QSize StoneWidget::size() { - return QSize(sizex,sizey); + return TQSize(sizex,sizey); } int @@ -137,7 +137,7 @@ StoneWidget::colors() { QSize StoneWidget::sizeHint () const { - return QSize(field_width,field_height); + return TQSize(field_width,field_height); } void @@ -174,7 +174,7 @@ StoneWidget::undo(int count) { int ret_val=stonefield.undo(count); - QPoint p=mapFromGlobal(cursor().pos()); + TQPoint p=mapFromGlobal(cursor().pos()); int x=p.x(); int y=p.y(); if (x<0||y<0||x>=field_width||y>=field_height) { @@ -214,13 +214,13 @@ void StoneWidget::readProperties(KConfig *conf) { } newGame(conf->readNumEntry("Board"),conf->readNumEntry("Colors")); - QStrList list; + TQStrList list; conf->readListEntry("Stones",list); for (const char *item=list.first();item;item=list.next()) { int x=-1,y=-1; if (sscanf(item,"%02X%02X",&x,&y)!=2) break; - history.append(new QPoint(x,y)); + history.append(new TQPoint(x,y)); stonefield.remove(x,y); } } @@ -230,10 +230,10 @@ void StoneWidget::saveProperties(KConfig *conf) { Q_ASSERT(conf); - QStrList list(true); - QString tmp; + TQStrList list(true); + TQString tmp; - for (QPoint *item=history.first();item;item=history.next()) { + for (TQPoint *item=history.first();item;item=history.next()) { tmp.sprintf("%02X%02X",item->x(),item->y()); list.append(tmp.ascii()); } @@ -244,8 +244,8 @@ StoneWidget::saveProperties(KConfig *conf) { } void -StoneWidget::timerEvent( QTimerEvent * ) { - QPoint p=mapFromGlobal(cursor().pos()); +StoneWidget::timerEvent( TQTimerEvent * ) { + TQPoint p=mapFromGlobal(cursor().pos()); int x=p.x(); int y=p.y(); if (x<0||y<0||x>=field_width||y>=field_height) @@ -255,7 +255,7 @@ StoneWidget::timerEvent( QTimerEvent * ) { } void -StoneWidget::paintEvent( QPaintEvent *e ) { +StoneWidget::paintEvent( TQPaintEvent *e ) { Stone *stone=stonefield.getField(); @@ -268,7 +268,7 @@ StoneWidget::paintEvent( QPaintEvent *e ) { bool redraw=stone->marked||stone->changed; if (!redraw&&e) { - QRect r(cx,cy,stone_width,stone_height); + TQRect r(cx,cy,stone_width,stone_height); redraw=r.intersects(e->rect()); } if (redraw) { @@ -291,7 +291,7 @@ StoneWidget::paintEvent( QPaintEvent *e ) { } void -StoneWidget::mousePressEvent ( QMouseEvent *e) { +StoneWidget::mousePressEvent ( TQMouseEvent *e) { if (stonefield.isGameover()) return; @@ -303,7 +303,7 @@ StoneWidget::mousePressEvent ( QMouseEvent *e) { int sy=y/stone_height; if (stonefield.remove(sx, sy)) { - history.append(new QPoint(sx, sy)); + history.append(new TQPoint(sx, sy)); emit s_remove(sx, sy); @@ -317,7 +317,7 @@ StoneWidget::mousePressEvent ( QMouseEvent *e) { } void -StoneWidget::mouseMoveEvent ( QMouseEvent *e) +StoneWidget::mouseMoveEvent ( TQMouseEvent *e) { if (stonefield.isGameover()) { stonefield.unmark(); diff --git a/ksame/StoneWidget.h b/ksame/StoneWidget.h index 05276924..b6840055 100644 --- a/ksame/StoneWidget.h +++ b/ksame/StoneWidget.h @@ -22,12 +22,12 @@ #ifndef _STONEWIDGET #define _STONEWIDGET -#include +#include #include "StoneField.h" struct StoneSlice; -class StoneWidget : public QWidget { +class StoneWidget : public TQWidget { Q_OBJECT int modified; @@ -37,7 +37,7 @@ class StoneWidget : public QWidget { int sizex, sizey; int field_width, field_height; - QPtrList history; + TQPtrList history; StoneField stonefield; // picture number of stonemovie @@ -46,15 +46,15 @@ class StoneWidget : public QWidget { StoneSlice **map; public: - StoneWidget( QWidget *parent=0, int x=10,int y=10); + StoneWidget( TQWidget *parent=0, int x=10,int y=10); ~StoneWidget(); unsigned int board(); int score(); int marked(); - QSize size(); + TQSize size(); int colors(); - virtual QSize sizeHint() const; + virtual TQSize sizeHint() const; bool undoPossible() const; @@ -75,10 +75,10 @@ public: int count(int color); protected: - void timerEvent( QTimerEvent *e ); - void paintEvent( QPaintEvent *e ); - void mousePressEvent ( QMouseEvent *e); - void mouseMoveEvent ( QMouseEvent *e); + void timerEvent( TQTimerEvent *e ); + void paintEvent( TQPaintEvent *e ); + void mousePressEvent ( TQMouseEvent *e); + void mouseMoveEvent ( TQMouseEvent *e); // properties of the stone picture int stone_width,stone_height; // size of one stone diff --git a/ksame/main.cpp b/ksame/main.cpp index 08c1e076..30423f16 100644 --- a/ksame/main.cpp +++ b/ksame/main.cpp @@ -19,7 +19,7 @@ */ #include -#include +#include #include #include @@ -39,7 +39,7 @@ int main( int argc, char **argv ) { aboutData.addAuthor("Marcus Kreutzberger", 0, "kreutzbe@informatik.mu-luebeck.de"); KCmdLineArgs::init(argc, argv, &aboutData); - KApplication::setColorSpec(QApplication::ManyColor+QApplication::CustomColor); + KApplication::setColorSpec(TQApplication::ManyColor+TQApplication::CustomColor); KApplication a; KGlobal::locale()->insertCatalogue("libkdegames"); -- cgit v1.2.1