summaryrefslogtreecommitdiffstats
path: root/libksirtet/common
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 /libksirtet/common
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 'libksirtet/common')
-rw-r--r--libksirtet/common/ai.cpp6
-rw-r--r--libksirtet/common/ai.h6
-rw-r--r--libksirtet/common/board.cpp4
-rw-r--r--libksirtet/common/board.h3
-rw-r--r--libksirtet/common/factory.h2
-rw-r--r--libksirtet/common/field.cpp8
-rw-r--r--libksirtet/common/field.h3
-rw-r--r--libksirtet/common/highscores.cpp10
-rw-r--r--libksirtet/common/inter.cpp10
-rw-r--r--libksirtet/common/inter.h5
-rw-r--r--libksirtet/common/main.cpp12
-rw-r--r--libksirtet/common/main.h1
-rw-r--r--libksirtet/common/misc_ui.cpp46
-rw-r--r--libksirtet/common/misc_ui.h22
-rw-r--r--libksirtet/common/settings.h4
-rw-r--r--libksirtet/common/types.h6
16 files changed, 80 insertions, 68 deletions
diff --git a/libksirtet/common/ai.cpp b/libksirtet/common/ai.cpp
index 78f9d5af..3960291e 100644
--- a/libksirtet/common/ai.cpp
+++ b/libksirtet/common/ai.cpp
@@ -222,7 +222,7 @@ double AI::points() const
for (uint i=0; i<_elements.size(); i++) {
if ( _elements[i].coefficient==0.0 ) continue;
double v = _elements[i].data->function(*main, *board);
- if ( _elements[i].data->triggered && qRound(v)<_elements[i].trigger )
+ if ( _elements[i].data->triggered && tqRound(v)<_elements[i].trigger )
continue;
pts += _elements[i].coefficient * v;
}
@@ -343,14 +343,14 @@ TQCString AIConfig::coefficientKey(const char *name)
double AIConfig::coefficient(const AI::Data &data)
{
- KConfigSkeletonItem *item = CommonPrefs::self()->findItem( TQString("Coefficient_%1").arg(data.name) );
+ KConfigSkeletonItem *item = CommonPrefs::self()->findItem( TQString("Coefficient_%1").tqarg(data.name) );
assert(item);
return item->property().toDouble();
}
int AIConfig::trigger(const AI::Data &data)
{
- KConfigSkeletonItem *item = CommonPrefs::self()->findItem( TQString("Trigger_%1").arg(data.name) );
+ KConfigSkeletonItem *item = CommonPrefs::self()->findItem( TQString("Trigger_%1").tqarg(data.name) );
assert(item);
return item->property().toInt();
}
diff --git a/libksirtet/common/ai.h b/libksirtet/common/ai.h
index b25a1d90..2211cd3d 100644
--- a/libksirtet/common/ai.h
+++ b/libksirtet/common/ai.h
@@ -38,9 +38,10 @@ class LIBKSIRTET_EXPORT AIPiece
};
//-----------------------------------------------------------------------------
-class LIBKSIRTET_EXPORT AI : public QObject
+class LIBKSIRTET_EXPORT AI : public TQObject
{
Q_OBJECT
+ TQ_OBJECT
public:
struct Data {
const char *name, *label, *whatsthis;
@@ -103,9 +104,10 @@ class LIBKSIRTET_EXPORT AI : public QObject
};
//-----------------------------------------------------------------------------
-class LIBKSIRTET_EXPORT AIConfig : public QWidget
+class LIBKSIRTET_EXPORT AIConfig : public TQWidget
{
Q_OBJECT
+ TQ_OBJECT
public:
AIConfig(const TQValueVector<AI::Element> &elements);
diff --git a/libksirtet/common/board.cpp b/libksirtet/common/board.cpp
index 7a0802ad..93851b87 100644
--- a/libksirtet/common/board.cpp
+++ b/libksirtet/common/board.cpp
@@ -11,8 +11,8 @@
#include "commonprefs.h"
-Board::Board(bool graphic, GiftPool *gp, TQWidget *parent)
- : BaseBoard(graphic, parent),
+Board::Board(bool graphic, GiftPool *gp, TQWidget *tqparent)
+ : BaseBoard(graphic, tqparent),
_giftPool(gp), aiEngine(0)
{}
diff --git a/libksirtet/common/board.h b/libksirtet/common/board.h
index 7b9f0b3a..5f38df9e 100644
--- a/libksirtet/common/board.h
+++ b/libksirtet/common/board.h
@@ -11,8 +11,9 @@ class AI;
class LIBKSIRTET_EXPORT Board : public BaseBoard
{
Q_OBJECT
+ TQ_OBJECT
public:
- Board(bool graphic, GiftPool *, TQWidget *parent);
+ Board(bool graphic, GiftPool *, TQWidget *tqparent);
virtual ~Board();
void setType(bool computer);
diff --git a/libksirtet/common/factory.h b/libksirtet/common/factory.h
index 2d02dcb2..5cd0cdbf 100644
--- a/libksirtet/common/factory.h
+++ b/libksirtet/common/factory.h
@@ -25,7 +25,7 @@ class LIBKSIRTET_EXPORT CommonFactory : public BaseFactory
const CommonBoardInfo &cbi;
- virtual BaseField *createField(TQWidget *parent) = 0;
+ virtual BaseField *createField(TQWidget *tqparent) = 0;
virtual AI *createAI() = 0;
TQWidget *createAIConfig();
diff --git a/libksirtet/common/field.cpp b/libksirtet/common/field.cpp
index 4c00ba4e..ea6a3ffc 100644
--- a/libksirtet/common/field.cpp
+++ b/libksirtet/common/field.cpp
@@ -19,8 +19,8 @@
#include "commonprefs.h"
-Field::Field(TQWidget *parent)
-: MPSimpleBoard(parent), BaseField(this)
+Field::Field(TQWidget *tqparent)
+: MPSimpleBoard(tqparent), BaseField(this)
{
// column 1
// score LCD
@@ -39,7 +39,7 @@ Field::Field(TQWidget *parent)
// level progress
levelLabel = new TQLabel(this);
- levelLabel->setAlignment(AlignCenter);
+ levelLabel->tqsetAlignment(AlignCenter);
lcds->addWidget(levelLabel, 5, 0);
toLevel = new KProgress(this);
toLevel->setTextEnabled(true);
@@ -77,7 +77,7 @@ Field::Field(TQWidget *parent)
vbl->addStretch(1);
labShowNext = new TQLabel(i18n("Next Tile"), this);
- labShowNext->setAlignment(AlignCenter);
+ labShowNext->tqsetAlignment(AlignCenter);
vbl->addWidget(labShowNext, 0);
showNext = new ShowNextPiece(board, this);
_snRootPixmap = new KCanvasRootPixmap(showNext);
diff --git a/libksirtet/common/field.h b/libksirtet/common/field.h
index ce0168e6..69d11bfb 100644
--- a/libksirtet/common/field.h
+++ b/libksirtet/common/field.h
@@ -18,8 +18,9 @@ class KGameLCDClock;
class LIBKSIRTET_EXPORT Field : public MPSimpleBoard, public BaseField
{
Q_OBJECT
+ TQ_OBJECT
public:
- Field(TQWidget *parent);
+ Field(TQWidget *tqparent);
public slots:
void moveLeft();
diff --git a/libksirtet/common/highscores.cpp b/libksirtet/common/highscores.cpp
index 459b35af..fb1642c0 100644
--- a/libksirtet/common/highscores.cpp
+++ b/libksirtet/common/highscores.cpp
@@ -11,10 +11,10 @@ using namespace KExtHighscore;
CommonHighscores::CommonHighscores()
{
- Item *item = new Item((uint)1, i18n("Level"), Qt::AlignRight);
+ Item *item = new Item((uint)1, i18n("Level"), TQt::AlignRight);
addScoreItem("level", item);
item = new Item((uint)0, i18n(bfactory->mainData.removedLabel),
- Qt::AlignRight);
+ TQt::AlignRight);
addScoreItem("removed", item);
}
@@ -23,13 +23,13 @@ void CommonHighscores::convertLegacy(uint)
KConfigGroupSaver cg(kapp->config(), "High Scores");
for (uint i=0; i<10; i++) {
TQString name
- = cg.config()->readEntry(TQString("name%1").arg(i), TQString::null);
+ = cg.config()->readEntry(TQString("name%1").tqarg(i), TQString());
if ( name.isNull() ) break;
if ( name.isEmpty() ) name = i18n("anonymous");
uint score
- = cg.config()->readUnsignedNumEntry(TQString("score%1").arg(i), 0);
+ = cg.config()->readUnsignedNumEntry(TQString("score%1").tqarg(i), 0);
uint level
- = cg.config()->readUnsignedNumEntry(TQString("level%1").arg(i), 1);
+ = cg.config()->readUnsignedNumEntry(TQString("level%1").tqarg(i), 1);
Score s(Won);
s.setScore(score);
s.setData("name", name);
diff --git a/libksirtet/common/inter.cpp b/libksirtet/common/inter.cpp
index c5630108..e81f7347 100644
--- a/libksirtet/common/inter.cpp
+++ b/libksirtet/common/inter.cpp
@@ -33,8 +33,8 @@ const int Interface::KEYCODE_TWO[Nb_Actions] = {
Key_F, Key_G, Key_D, Key_Space, Key_E, Key_C, SHIFT+Key_F, SHIFT+Key_G
};
-Interface::Interface(const MPGameInfo &gi, TQWidget *parent)
- : MPSimpleInterface(gi, Nb_Actions, ACTION_DATA, parent)
+Interface::Interface(const MPGameInfo &gi, TQWidget *tqparent)
+ : MPSimpleInterface(gi, Nb_Actions, ACTION_DATA, tqparent)
{
setDefaultKeycodes(1, 0, KEYCODE_ONE);
setDefaultKeycodes(2, 0, KEYCODE_TWO);
@@ -91,10 +91,10 @@ void Interface::_sendPlayData()
}
}
-void Interface::_showHighscores(TQWidget *parent)
+void Interface::_showHighscores(TQWidget *tqparent)
{
- if ( !server() || nbPlayers()!=1 ) _scores.show(parent);
- else BaseInterface::_showHighscores(parent);
+ if ( !server() || nbPlayers()!=1 ) _scores.show(tqparent);
+ else BaseInterface::_showHighscores(tqparent);
}
void Interface::_showGameOverData()
diff --git a/libksirtet/common/inter.h b/libksirtet/common/inter.h
index 02041afa..fb8a8349 100644
--- a/libksirtet/common/inter.h
+++ b/libksirtet/common/inter.h
@@ -15,8 +15,9 @@ class Field;
class LIBKSIRTET_EXPORT Interface : public MPSimpleInterface, public BaseInterface
{
Q_OBJECT
+ TQ_OBJECT
public:
- Interface(const MPGameInfo &, TQWidget *parent);
+ Interface(const MPGameInfo &, TQWidget *tqparent);
signals:
void settingsChanged();
@@ -27,7 +28,7 @@ public slots:
void settingsChangedSlot() { emit settingsChanged(); }
protected:
- void _showHighscores(TQWidget *parent);
+ void _showHighscores(TQWidget *tqparent);
private:
TQMemArray<ClientPlayData> _data;
diff --git a/libksirtet/common/main.cpp b/libksirtet/common/main.cpp
index e7674846..8856a726 100644
--- a/libksirtet/common/main.cpp
+++ b/libksirtet/common/main.cpp
@@ -20,22 +20,22 @@ void MainWindow::init()
{
Interface *inter = static_cast<Interface *>(_inter);
inter->normalGame();
- setFocusPolicy(StrongFocus);
+ setFocusPolicy(TQ_StrongFocus);
// Modes
bool ama = ( bfactory->bbi.nbArcadeStages!=0 );
TQString s = (ama ? i18n("&Single Human (Normal)") : i18n("&Single Human"));
- (void)new KAction(s, 0, inter, TQT_SLOT(normalGame()),
+ (void)new KAction(s, 0, TQT_TQOBJECT(inter), TQT_SLOT(normalGame()),
actionCollection(), "mp_single_human");
if (ama) (void)new KAction(i18n("&Single Human (Arcade)"), 0,
- inter, TQT_SLOT(arcadeGame()),
+ TQT_TQOBJECT(inter), TQT_SLOT(arcadeGame()),
actionCollection(), "mp_arcade");
- (void)new KAction(i18n("Human vs &Human"), 0, inter, TQT_SLOT(humanVsHuman()),
+ (void)new KAction(i18n("Human vs &Human"), 0, TQT_TQOBJECT(inter), TQT_SLOT(humanVsHuman()),
actionCollection(), "mp_human_vs_human");
(void)new KAction(i18n("Human vs &Computer"), 0,
- inter, TQT_SLOT(humanVsComputer()),
+ TQT_TQOBJECT(inter), TQT_SLOT(humanVsComputer()),
actionCollection(), "mp_human_vs_computer");
- (void)new KAction(i18n("&More..."), 0, inter, TQT_SLOT(dialog()),
+ (void)new KAction(i18n("&More..."), 0, TQT_TQOBJECT(inter), TQT_SLOT(dialog()),
actionCollection(), "mp_more");
buildGUI(inter);
diff --git a/libksirtet/common/main.h b/libksirtet/common/main.h
index a98fc6f1..a1534a95 100644
--- a/libksirtet/common/main.h
+++ b/libksirtet/common/main.h
@@ -8,6 +8,7 @@
class LIBKSIRTET_EXPORT MainWindow : public BaseMainWindow
{
Q_OBJECT
+ TQ_OBJECT
public:
MainWindow() {}
diff --git a/libksirtet/common/misc_ui.cpp b/libksirtet/common/misc_ui.cpp
index cf802e25..6e9cffec 100644
--- a/libksirtet/common/misc_ui.cpp
+++ b/libksirtet/common/misc_ui.cpp
@@ -24,8 +24,8 @@ const uint LED_HEIGHT = 15;
const uint LED_SPACING = 5;
/*****************************************************************************/
-ShowNextPiece::ShowNextPiece(BaseBoard *board, TQWidget *parent)
- : FixedCanvasView(parent, "show_next_piece")
+ShowNextPiece::ShowNextPiece(BaseBoard *board, TQWidget *tqparent)
+ : FixedCanvasView(tqparent, "show_next_piece")
{
setCanvas(board->next());
setFrameStyle(TQFrame::Panel | TQFrame::Sunken);
@@ -33,15 +33,15 @@ ShowNextPiece::ShowNextPiece(BaseBoard *board, TQWidget *parent)
}
/*****************************************************************************/
-Shadow::Shadow(BaseBoard *board, TQWidget *parent)
- : TQWidget(parent, "shadow"), _xOffset(board->frameWidth()),
+Shadow::Shadow(BaseBoard *board, TQWidget *tqparent)
+ : TQWidget(tqparent, "shadow"), _xOffset(board->frameWidth()),
_board(board), _show(false)
{
KZoomMainWindow::addWidget(this);
connect(board, TQT_SIGNAL(updatePieceConfigSignal()), TQT_SLOT(update()));
}
-TQSize Shadow::sizeHint() const
+TQSize Shadow::tqsizeHint() const
{
return TQSize(_xOffset + _board->matrix().width() * BasePrefs::blockSize(),
SHADOW_HEIGHT);
@@ -78,19 +78,19 @@ void Shadow::paintEvent(TQPaintEvent *)
/*****************************************************************************/
-class Led : public QWidget
+class Led : public TQWidget
{
public:
- Led(const TQColor &c, TQWidget *parent)
- : TQWidget(parent), col(c), _on(FALSE) {}
+ Led(const TQColor &c, TQWidget *tqparent)
+ : TQWidget(tqparent), col(c), _on(FALSE) {}
TQSizePolicy sizePolicy() const
{ return TQSizePolicy(TQSizePolicy::Fixed, TQSizePolicy::Fixed); }
- TQSize sizeHint() const { return TQSize(LED_WIDTH, LED_HEIGHT); }
+ TQSize tqsizeHint() const { return TQSize(LED_WIDTH, LED_HEIGHT); }
- void on() { if (!_on) { _on = TRUE; repaint(); } }
- void off() { if (_on) {_on = FALSE; repaint(); } }
- void setColor(const TQColor &c) { if (c!=col) { col = c; repaint(); } }
+ void on() { if (!_on) { _on = TRUE; tqrepaint(); } }
+ void off() { if (_on) {_on = FALSE; tqrepaint(); } }
+ void setColor(const TQColor &c) { if (c!=col) { col = c; tqrepaint(); } }
protected:
void paintEvent(TQPaintEvent *) {
@@ -105,8 +105,8 @@ class Led : public QWidget
bool _on;
};
-GiftPool::GiftPool(TQWidget *parent)
- : TQHBox(parent, "gift_pool"), nb(0), ready(false)
+GiftPool::GiftPool(TQWidget *tqparent)
+ : TQHBox(tqparent, "gift_pool"), nb(0), ready(false)
{
setSpacing(LED_SPACING);
leds.resize(cfactory->cbi.nbGiftLeds);
@@ -114,9 +114,9 @@ GiftPool::GiftPool(TQWidget *parent)
leds.insert(i, new Led(yellow, this));
}
-TQSize GiftPool::sizeHint() const
+TQSize GiftPool::tqsizeHint() const
{
- TQSize s = (leds.size() ? leds[0]->sizeHint() : TQSize());
+ TQSize s = (leds.size() ? leds[0]->tqsizeHint() : TQSize());
return TQSize((s.width()+LED_SPACING)*leds.size()-LED_SPACING, s.height());
}
@@ -131,9 +131,9 @@ void GiftPool::put(uint n)
if ( nb==0 && !ready )
TQTimer::singleShot(cfactory->cbi.giftPoolTimeout,
this, TQT_SLOT(timeout()));
- uint e = QMIN(nb+n, leds.size());
+ uint e = TQMIN(nb+n, leds.size());
for (uint i=nb; i<e; i++) leds[i]->on();
- uint f = QMIN(nb+n-e, leds.size());
+ uint f = TQMIN(nb+n-e, leds.size());
for (uint i=0; i<f; i++) leds[i]->setColor(red);
nb += n;
}
@@ -161,7 +161,7 @@ uint GiftPool::take()
void GiftPool::reset()
{
- killTimers();
+ TQT_TQOBJECT(this)->killTimers();
ready = false;
nb = 0;
for (uint i=0; i<leds.size(); i++) {
@@ -171,10 +171,10 @@ void GiftPool::reset()
}
//-----------------------------------------------------------------------------
-PlayerProgress::PlayerProgress(BaseBoard *board, TQWidget *parent,
+PlayerProgress::PlayerProgress(BaseBoard *board, TQWidget *tqparent,
const char *name)
- : KGameProgress(0, board->matrix().height(), 0, KGameProgress::Vertical,
- parent, name), _board(board)
+ : KGameProgress(0, board->matrix().height(), 0, Qt::Vertical,
+ tqparent, name), _board(board)
{
setBackgroundColor(lightGray);
setTextEnabled(false);
@@ -182,7 +182,7 @@ PlayerProgress::PlayerProgress(BaseBoard *board, TQWidget *parent,
KZoomMainWindow::addWidget(this);
}
-TQSize PlayerProgress::sizeHint() const
+TQSize PlayerProgress::tqsizeHint() const
{
return TQSize(10, _board->matrix().height() * BasePrefs::blockSize())
+ 2 * TQSize(frameWidth(), frameWidth());
diff --git a/libksirtet/common/misc_ui.h b/libksirtet/common/misc_ui.h
index 38544a02..61b87b96 100644
--- a/libksirtet/common/misc_ui.h
+++ b/libksirtet/common/misc_ui.h
@@ -14,18 +14,20 @@
class LIBKSIRTET_EXPORT ShowNextPiece : public FixedCanvasView
{
Q_OBJECT
+ TQ_OBJECT
public:
- ShowNextPiece(BaseBoard *, TQWidget *parent);
+ ShowNextPiece(BaseBoard *, TQWidget *tqparent);
};
/*****************************************************************************/
-class LIBKSIRTET_EXPORT Shadow : public QWidget
+class LIBKSIRTET_EXPORT Shadow : public TQWidget
{
Q_OBJECT
+ TQ_OBJECT
public:
- Shadow(BaseBoard *, TQWidget *parent);
+ Shadow(BaseBoard *, TQWidget *tqparent);
- virtual TQSize sizeHint() const;
+ virtual TQSize tqsizeHint() const;
virtual TQSizePolicy sizePolicy() const;
void setDisplay(bool show);
@@ -40,13 +42,14 @@ class LIBKSIRTET_EXPORT Shadow : public QWidget
/*****************************************************************************/
class Led;
-class LIBKSIRTET_EXPORT GiftPool : public QHBox
+class LIBKSIRTET_EXPORT GiftPool : public TQHBox
{
Q_OBJECT
+ TQ_OBJECT
public:
- GiftPool(TQWidget *parent);
+ GiftPool(TQWidget *tqparent);
- virtual TQSize sizeHint() const;
+ virtual TQSize tqsizeHint() const;
virtual TQSizePolicy sizePolicy() const;
void reset();
@@ -68,10 +71,11 @@ class LIBKSIRTET_EXPORT GiftPool : public QHBox
class LIBKSIRTET_EXPORT PlayerProgress : public KGameProgress
{
Q_OBJECT
+ TQ_OBJECT
public:
- PlayerProgress(BaseBoard *board, TQWidget *parent = 0, const char *name = 0);
+ PlayerProgress(BaseBoard *board, TQWidget *tqparent = 0, const char *name = 0);
- virtual TQSize sizeHint() const;
+ virtual TQSize tqsizeHint() const;
virtual TQSizePolicy sizePolicy() const;
private:
diff --git a/libksirtet/common/settings.h b/libksirtet/common/settings.h
index 2a554e8d..a33c2b12 100644
--- a/libksirtet/common/settings.h
+++ b/libksirtet/common/settings.h
@@ -10,14 +10,16 @@
class LIBKSIRTET_EXPORT AppearanceConfig : public BaseAppearanceConfig
{
Q_OBJECT
+ TQ_OBJECT
public:
AppearanceConfig();
};
//-----------------------------------------------------------------------------
-class LIBKSIRTET_EXPORT GameConfig : public QWidget
+class LIBKSIRTET_EXPORT GameConfig : public TQWidget
{
Q_OBJECT
+ TQ_OBJECT
public:
GameConfig();
diff --git a/libksirtet/common/types.h b/libksirtet/common/types.h
index 5b85f302..702f8a70 100644
--- a/libksirtet/common/types.h
+++ b/libksirtet/common/types.h
@@ -6,11 +6,11 @@
#include "lib/libksirtet_export.h"
-struct ClientPlayData { Q_UINT8 height, gift, end; };
+struct ClientPlayData { TQ_UINT8 height, gift, end; };
LIBKSIRTET_EXPORT TQDataStream &operator <<(TQDataStream &s, const ClientPlayData &d);
LIBKSIRTET_EXPORT TQDataStream &operator >>(TQDataStream &s, ClientPlayData &d);
-struct ServerPlayData { Q_UINT8 prevHeight, nextHeight, gift; };
+struct ServerPlayData { TQ_UINT8 prevHeight, nextHeight, gift; };
LIBKSIRTET_EXPORT TQDataStream &operator <<(TQDataStream &s, const ServerPlayData &d);
LIBKSIRTET_EXPORT TQDataStream &operator >>(TQDataStream &s, ServerPlayData &d);
@@ -18,7 +18,7 @@ class ServerInitData
{
public:
TQString prevName, nextName, name;
- Q_UINT32 initLevel, seed;
+ TQ_UINT32 initLevel, seed;
};
LIBKSIRTET_EXPORT TQDataStream &operator <<(TQDataStream &s, const ServerInitData &d);
LIBKSIRTET_EXPORT TQDataStream &operator >>(TQDataStream &s, ServerInitData &d);