summaryrefslogtreecommitdiffstats
path: root/ksame
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-11 04:58:26 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-11 04:58:26 +0000
commit838baf3f99ec5ab81b063eb5449a3381d860f377 (patch)
treedd31abcfde08ca92e4623b8f50b3d762a87c997a /ksame
parent2bf598bafa22fac4126fc8842df6b0119aadc0e9 (diff)
downloadtdegames-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 'ksame')
-rw-r--r--ksame/KSameWidget.cpp62
-rw-r--r--ksame/KSameWidget.h3
-rw-r--r--ksame/StoneWidget.cpp26
-rw-r--r--ksame/StoneWidget.h5
4 files changed, 49 insertions, 47 deletions
diff --git a/ksame/KSameWidget.cpp b/ksame/KSameWidget.cpp
index a0e0142e..28329b06 100644
--- a/ksame/KSameWidget.cpp
+++ b/ksame/KSameWidget.cpp
@@ -46,20 +46,20 @@ static int default_colors=3;
#define Board KScoreDialog::Custom1
-KSameWidget::KSameWidget(TQWidget *parent, const char* name, WFlags fl) :
- KMainWindow(parent,name,fl)
+KSameWidget::KSameWidget(TQWidget *tqparent, const char* name, WFlags fl) :
+ KMainWindow(tqparent,name,fl)
{
- KStdGameAction::gameNew(this, TQT_SLOT(m_new()), actionCollection(), "game_new");
- restart = new KAction(i18n("&Restart This Board"), CTRL+Key_R, this,
+ KStdGameAction::gameNew(TQT_TQOBJECT(this), TQT_SLOT(m_new()), actionCollection(), "game_new");
+ restart = new KAction(i18n("&Restart This Board"), CTRL+Key_R, TQT_TQOBJECT(this),
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");
+ KStdGameAction::highscores(TQT_TQOBJECT(this), TQT_SLOT(m_showhs()), actionCollection(), "game_highscores");
+ KStdGameAction::quit(TQT_TQOBJECT(this), TQT_SLOT(close()), actionCollection(), "game_quit");
+ undo = KStdGameAction::undo(TQT_TQOBJECT(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, TQT_SLOT(showNumberRemainingToggled()), actionCollection(), "showNumberRemaining");
+ showNumberRemaining = new KToggleAction(i18n("&Show Number Remaining"), 0, TQT_TQOBJECT(this), TQT_SLOT(showNumberRemainingToggled()), actionCollection(), "showNumberRemaining");
- KStdAction::configureNotifications(this, TQT_SLOT(configureNotifications()),
+ KStdAction::configureNotifications(TQT_TQOBJECT(this), TQT_SLOT(configureNotifications()),
actionCollection());
status=statusBar();
@@ -70,14 +70,14 @@ KSameWidget::KSameWidget(TQWidget *parent, const char* name, WFlags fl) :
stone = new StoneWidget(this,15,10);
- 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, TQT_SIGNAL(s_gameover()), TQT_TQOBJECT(this), TQT_SLOT(gameover()));
+ connect( stone, TQT_SIGNAL(s_colors(int)), TQT_TQOBJECT(this), TQT_SLOT(setColors(int)));
+ connect( stone, TQT_SIGNAL(s_board(int)), TQT_TQOBJECT(this), TQT_SLOT(setBoard(int)));
+ connect( stone, TQT_SIGNAL(s_marked(int)), TQT_TQOBJECT(this), TQT_SLOT(setMarked(int)));
+ connect( stone, TQT_SIGNAL(s_score(int)), TQT_TQOBJECT(this), TQT_SLOT(setScore(int)));
+ connect( stone, TQT_SIGNAL(s_remove(int,int)), TQT_TQOBJECT(this), TQT_SLOT(stonesRemoved(int,int)));
- connect(stone, TQT_SIGNAL(s_sizechanged()), this, TQT_SLOT(sizeChanged()));
+ connect(stone, TQT_SIGNAL(s_sizechanged()), TQT_TQOBJECT(this), TQT_SLOT(sizeChanged()));
sizeChanged();
setCentralWidget(stone);
@@ -113,7 +113,7 @@ void KSameWidget::saveProperties(KConfig *conf) {
}
void KSameWidget::sizeChanged() {
- stone->setFixedSize(stone->sizeHint());
+ stone->setFixedSize(stone->tqsizeHint());
}
void KSameWidget::showNumberRemainingToggled()
@@ -121,11 +121,11 @@ void KSameWidget::showNumberRemainingToggled()
if(showNumberRemaining->isChecked()){
TQStringList list;
for(int i=1;i<=stone->colors();i++)
- 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);
+ list.append(TQString("%1").tqarg(stone->count(i)));
+ TQString count = TQString(" (%1)").tqarg(list.join(","));
+ status->changeItem(i18n("%1 Colors%2").tqarg(stone->colors()).tqarg(count),1);
}
- else status->changeItem(i18n("%1 Colors").arg(stone->colors()),1);
+ else status->changeItem(i18n("%1 Colors").tqarg(stone->colors()),1);
KConfig *cfg = kapp->config();
cfg->writeEntry("showRemaining", showNumberRemaining->isChecked());
@@ -162,7 +162,7 @@ void KSameWidget::m_new() {
bno.setRange(0, 1000000, 1);
bno.setLabel(i18n("Select a board:"));
bno.setFocus();
- bno.setFixedSize(bno.sizeHint());
+ bno.setFixedSize(bno.tqsizeHint());
bno.setValue(stone->board());
if (dlg.exec()) newGame(bno.value(),default_colors);
@@ -188,15 +188,15 @@ void KSameWidget::m_showhs() {
}
void KSameWidget::setColors(int colors) {
- status->changeItem(i18n("%1 Colors").arg(colors),1);
+ status->changeItem(i18n("%1 Colors").tqarg(colors),1);
}
void KSameWidget::setBoard(int board) {
- status->changeItem(i18n("Board: %1").arg(board, 6), 2);
+ status->changeItem(i18n("Board: %1").tqarg(board, 6), 2);
}
void KSameWidget::setMarked(int m) {
- status->changeItem(i18n("Marked: %1").arg(m, 6),3);
+ status->changeItem(i18n("Marked: %1").tqarg(m, 6),3);
m_markedStones=m;
}
@@ -209,11 +209,11 @@ void KSameWidget::setScore(int score) {
if(showNumberRemaining->isChecked()){
TQStringList list;
for(int i=1;i<=stone->colors();i++)
- 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);
+ list.append(TQString("%1").tqarg(stone->count(i)));
+ TQString count = TQString(" (%1)").tqarg(list.join(","));
+ status->changeItem(i18n("%1 Colors%2").tqarg(stone->colors()).tqarg(count),1);
}
- status->changeItem(i18n("Score: %1").arg(score, 6),4);
+ status->changeItem(i18n("Score: %1").tqarg(score, 6),4);
undo->setEnabled(stone->undoPossible());
restart->setEnabled(!stone->isOriginalBoard());
}
@@ -222,11 +222,11 @@ void KSameWidget::gameover() {
if (stone->hasBonus()) {
KNotifyClient::event(winId(), "game won",
i18n("You even removed the last stone, great job! "
- "This gave you a score of %1 in total.").arg(stone->score()));
+ "This gave you a score of %1 in total.").tqarg(stone->score()));
} else {
KNotifyClient::event(winId(), "game over",
i18n("There are no more removeable stones. "
- "You got a score of %1 in total.").arg(stone->score()));
+ "You got a score of %1 in total.").tqarg(stone->score()));
}
stone->unmark();
KScoreDialog d(KScoreDialog::Name | KScoreDialog::Score, this);
diff --git a/ksame/KSameWidget.h b/ksame/KSameWidget.h
index 46154094..0d7f833b 100644
--- a/ksame/KSameWidget.h
+++ b/ksame/KSameWidget.h
@@ -29,9 +29,10 @@ class StoneWidget;
class KSameWidget: public KMainWindow {
Q_OBJECT
+ TQ_OBJECT
public:
- KSameWidget(TQWidget *parent=0, const char* name=0, WFlags fl=0);
+ KSameWidget(TQWidget *tqparent=0, const char* name=0, WFlags fl=0);
private slots:
/* File Menu */
diff --git a/ksame/StoneWidget.cpp b/ksame/StoneWidget.cpp
index 81fafca9..3109c33e 100644
--- a/ksame/StoneWidget.cpp
+++ b/ksame/StoneWidget.cpp
@@ -46,8 +46,8 @@ struct StoneSlice {
};
-StoneWidget::StoneWidget( TQWidget *parent, int x, int y )
- : TQWidget(parent,"StoneWidget"), stonefield(x,y)
+StoneWidget::StoneWidget( TQWidget *tqparent, int x, int y )
+ : TQWidget(tqparent,"StoneWidget"), stonefield(x,y)
{
setBackgroundPixmap(TQPixmap(locate("wallpaper", "Time-For-Lunch-2.jpg")));
TQPixmap stonemap(locate("appdata", "stones.png"));
@@ -65,20 +65,20 @@ StoneWidget::StoneWidget( TQWidget *parent, int x, int y )
stone_height=stonemap.height()/maxcolors;
map = new StoneSlice*[maxcolors];
- TQBitmap mask;
+ TQBitmap tqmask;
for (int c = 0; c < maxcolors; c++) {
map[c] = new StoneSlice[maxslices];
for (int s = 0; s < maxslices; s++) {
map[c][s].stone.resize(stone_width, stone_height);
assert(!map[c][s].stone.isNull());
- bitBlt(&map[c][s].stone, 0, 0,
- &stonemap, stone_width * s,
+ bitBlt(TQT_TQPAINTDEVICE(&map[c][s].stone), 0, 0,
+ TQT_TQPAINTDEVICE(&stonemap), stone_width * s,
c*stone_height,
stone_width,stone_height,CopyROP,false);
TQImage im = map[c][s].stone.convertToImage();
- mask = im.createHeuristicMask();
- map[c][s].stone.setMask(mask);
+ tqmask.convertFromImage(im.createHeuristicMask());
+ map[c][s].stone.setMask(tqmask);
}
}
@@ -102,7 +102,7 @@ StoneWidget::~StoneWidget() {
delete [] map;
setMouseTracking(false);
- killTimers();
+ TQT_TQOBJECT(this)->killTimers();
}
unsigned int
@@ -125,7 +125,7 @@ StoneWidget::marked() {
return stonefield.getMarked();
}
-QSize
+TQSize
StoneWidget::size() {
return TQSize(sizex,sizey);
}
@@ -135,8 +135,8 @@ StoneWidget::colors() {
return stonefield.getColors();
}
-QSize
-StoneWidget::sizeHint () const {
+TQSize
+StoneWidget::tqsizeHint () const {
return TQSize(field_width,field_height);
}
@@ -276,8 +276,8 @@ StoneWidget::paintEvent( TQPaintEvent *e ) {
if (stone->color) {
int tslice = stone->marked?slice:0;
- bitBlt(this,cx,cy,
- &map[stone->color-1][tslice].stone,
+ bitBlt(TQT_TQPAINTDEVICE(this),cx,cy,
+ TQT_TQPAINTDEVICE(&map[stone->color-1][tslice].stone),
0, 0,
stone_width,stone_height,CopyROP,FALSE);
diff --git a/ksame/StoneWidget.h b/ksame/StoneWidget.h
index b6840055..01e64ebe 100644
--- a/ksame/StoneWidget.h
+++ b/ksame/StoneWidget.h
@@ -29,6 +29,7 @@ struct StoneSlice;
class StoneWidget : public TQWidget {
Q_OBJECT
+ TQ_OBJECT
int modified;
// int marked; // # of marked stones
@@ -46,7 +47,7 @@ class StoneWidget : public TQWidget {
StoneSlice **map;
public:
- StoneWidget( TQWidget *parent=0, int x=10,int y=10);
+ StoneWidget( TQWidget *tqparent=0, int x=10,int y=10);
~StoneWidget();
unsigned int board();
@@ -54,7 +55,7 @@ public:
int marked();
TQSize size();
int colors();
- virtual TQSize sizeHint() const;
+ virtual TQSize tqsizeHint() const;
bool undoPossible() const;