summaryrefslogtreecommitdiffstats
path: root/kbackgammon/kbgboard.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'kbackgammon/kbgboard.cpp')
-rw-r--r--kbackgammon/kbgboard.cpp298
1 files changed, 149 insertions, 149 deletions
diff --git a/kbackgammon/kbgboard.cpp b/kbackgammon/kbgboard.cpp
index 8b961a45..fc024ab8 100644
--- a/kbackgammon/kbgboard.cpp
+++ b/kbackgammon/kbgboard.cpp
@@ -39,12 +39,12 @@
#include <math.h>
#include <kcolordialog.h>
#include <klocale.h>
-#include <qlayout.h>
-#include <qgroupbox.h>
-#include <qbuttongroup.h>
+#include <tqlayout.h>
+#include <tqgroupbox.h>
+#include <tqbuttongroup.h>
#include <kconfig.h>
-#include <qwhatsthis.h>
-#include <qvbox.h>
+#include <tqwhatsthis.h>
+#include <tqvbox.h>
#include <kiconloader.h>
#include <ktabctl.h>
#include <kpushbutton.h>
@@ -64,17 +64,17 @@ static const int MINIMUM_CHECKER_SIZE = 10;
void KBgBoardSetup::setupDefault()
{
// default background color
- setBackgroundColor(QColor(200, 200, 166));
- pbc_1->setPalette(QPalette(backgroundColor()));
+ setBackgroundColor(TQColor(200, 200, 166));
+ pbc_1->setPalette(TQPalette(backgroundColor()));
// checker colors
baseColors[0] = black;
baseColors[1] = white;
- pbc_2->setPalette(QPalette(baseColors[0]));
- pbc_3->setPalette(QPalette(baseColors[1]));
+ pbc_2->setPalette(TQPalette(baseColors[0]));
+ pbc_3->setPalette(TQPalette(baseColors[1]));
// default font
- setFont(QFont("Serif", 18, QFont::Normal));
+ setFont(TQFont("Serif", 18, TQFont::Normal));
kf->setFont(getFont());
// short moves
@@ -128,7 +128,7 @@ void KBgBoardSetup::getSetupPages(KDialogBase *nb)
* Main Widget
* ===========
*/
- QVBox *vbp = nb->addVBoxPage(i18n("Board"), i18n("Here you can configure the backgammon board"),
+ TQVBox *vbp = nb->addVBoxPage(i18n("Board"), i18n("Here you can configure the backgammon board"),
kapp->iconLoader()->loadIcon(PROG_NAME, KIcon::Desktop));
/*
@@ -136,16 +136,16 @@ void KBgBoardSetup::getSetupPages(KDialogBase *nb)
*/
KTabCtl *tc = new KTabCtl(vbp, "board tabs");
- QWidget *w = new QWidget(tc);
- QGridLayout *gl = new QGridLayout(w, 3, 1, nb->spacingHint());
+ TQWidget *w = new TQWidget(tc);
+ TQGridLayout *gl = new TQGridLayout(w, 3, 1, nb->spacingHint());
/*
* Group boxes
* ===========
*/
- QGroupBox *ga = new QGroupBox(w);
- QButtonGroup *gm = new QButtonGroup(w);
- QGroupBox *go = new QGroupBox(w);
+ TQGroupBox *ga = new TQGroupBox(w);
+ TQButtonGroup *gm = new TQButtonGroup(w);
+ TQGroupBox *go = new TQGroupBox(w);
ga->setTitle(i18n("Colors"));
gm->setTitle(i18n("Short Moves"));
@@ -159,35 +159,35 @@ void KBgBoardSetup::getSetupPages(KDialogBase *nb)
* Appearance group
* ----------------
*/
- QGridLayout *blc = new QGridLayout(ga, 2, 2, 20);
+ TQGridLayout *blc = new TQGridLayout(ga, 2, 2, 20);
- pbc_1 = new QPushButton(i18n("Background"), ga);
- pbc_1->setPalette(QPalette(backgroundColor()));
+ pbc_1 = new TQPushButton(i18n("Background"), ga);
+ pbc_1->setPalette(TQPalette(backgroundColor()));
- pbc_2 = new QPushButton(i18n("Color 1"), ga);
- pbc_2->setPalette(QPalette(baseColors[0]));
+ pbc_2 = new TQPushButton(i18n("Color 1"), ga);
+ pbc_2->setPalette(TQPalette(baseColors[0]));
- pbc_3 = new QPushButton(i18n("Color 2"), ga);
- pbc_3->setPalette(QPalette(baseColors[1]));
+ pbc_3 = new TQPushButton(i18n("Color 2"), ga);
+ pbc_3->setPalette(TQPalette(baseColors[1]));
blc->addWidget(pbc_2, 0, 0);
blc->addWidget(pbc_3, 0, 1);
blc->addMultiCellWidget(pbc_1, 1, 1, 0, 1);
- connect(pbc_1, SIGNAL(clicked()), this, SLOT(selectBackgroundColor()));
- connect(pbc_2, SIGNAL(clicked()), this, SLOT(selectBaseColorOne()));
- connect(pbc_3, SIGNAL(clicked()), this, SLOT(selectBaseColorTwo()));
+ connect(pbc_1, TQT_SIGNAL(clicked()), this, TQT_SLOT(selectBackgroundColor()));
+ connect(pbc_2, TQT_SIGNAL(clicked()), this, TQT_SLOT(selectBaseColorOne()));
+ connect(pbc_3, TQT_SIGNAL(clicked()), this, TQT_SLOT(selectBaseColorTwo()));
/*
* Moving style
* ------------
*/
- QBoxLayout *blm = new QVBoxLayout(gm, nb->spacingHint());
+ TQBoxLayout *blm = new TQVBoxLayout(gm, nb->spacingHint());
blm->addSpacing(gm->fontMetrics().height());
for (int i = 0; i < 3; i++)
- rbMove[i] = new QRadioButton(gm);
+ rbMove[i] = new TQRadioButton(gm);
rbMove[SHORT_MOVE_NONE]->setText(i18n("&Disable short moves. Only drag and drop will move."));
rbMove[SHORT_MOVE_SINGLE]->setText(i18n("&Single clicks with the left mouse button will\n"
@@ -205,9 +205,9 @@ void KBgBoardSetup::getSetupPages(KDialogBase *nb)
* Other options
* -------------
*/
- QGridLayout *glo = new QGridLayout(go, 1, 1, 20);
+ TQGridLayout *glo = new TQGridLayout(go, 1, 1, 20);
- cbp = new QCheckBox(i18n("Show pip count in title bar"), go);
+ cbp = new TQCheckBox(i18n("Show pip count in title bar"), go);
cbp->setChecked(computePipCount);
cbp->adjustSize();
cbp->setMinimumSize(cbp->size());
@@ -234,10 +234,10 @@ void KBgBoardSetup::getSetupPages(KDialogBase *nb)
* Font selection page
* ===================
*/
- w = new QWidget(tc);
+ w = new TQWidget(tc);
kf = new KFontChooser(w);
kf->setFont(getFont());
- gl = new QGridLayout(w, 1, 1, nb->spacingHint());
+ gl = new TQGridLayout(w, 1, 1, nb->spacingHint());
gl->addWidget(kf, 0, 0);
gl->activate();
w->adjustSize();
@@ -248,7 +248,7 @@ void KBgBoardSetup::getSetupPages(KDialogBase *nb)
/*
* Empty constructor calls the board constructor
*/
-KBgBoardSetup::KBgBoardSetup(QWidget *parent, const char *name, QPopupMenu *menu)
+KBgBoardSetup::KBgBoardSetup(TQWidget *parent, const char *name, TQPopupMenu *menu)
: KBgBoard(parent, name, menu)
{
// empty
@@ -263,7 +263,7 @@ void KBgBoardSetup::selectBaseColorOne()
c->setColor(baseColors[0]);
if (c->exec()) {
baseColors[0] = c->color();
- pbc_2->setPalette(QPalette(baseColors[0]));
+ pbc_2->setPalette(TQPalette(baseColors[0]));
for (int i = 0; i < 30; i++)
cells[i]->update();
}
@@ -279,7 +279,7 @@ void KBgBoardSetup::selectBaseColorTwo()
c->setColor(baseColors[1]);
if (c->exec()) {
baseColors[1] = c->color();
- pbc_3->setPalette(QPalette(baseColors[1]));
+ pbc_3->setPalette(TQPalette(baseColors[1]));
for (int i = 0; i < 30; i++)
cells[i]->update();
}
@@ -295,7 +295,7 @@ void KBgBoardSetup::selectBackgroundColor()
c->setColor(backgroundColor());
if (c->exec()) {
setBackgroundColor(c->color());
- pbc_1->setPalette(QPalette(backgroundColor()));
+ pbc_1->setPalette(TQPalette(backgroundColor()));
for (int i = 0; i < 30; i++)
cells[i]->update();
}
@@ -323,8 +323,8 @@ void KBgBoard::saveConfig()
*/
void KBgBoard::readConfig()
{
- QColor col(200, 200, 166);
- QFont fon("Serif", 18, QFont::Normal);
+ TQColor col(200, 200, 166);
+ TQFont fon("Serif", 18, TQFont::Normal);
KConfig* config = kapp->config();
config->setGroup(name());
@@ -341,7 +341,7 @@ void KBgBoard::readConfig()
* Get the font the board cells should use for the display of
* numbers and cube value.
*/
-QFont KBgBoard::getFont() const
+TQFont KBgBoard::getFont() const
{
return boardFont;
}
@@ -350,7 +350,7 @@ QFont KBgBoard::getFont() const
* Allows the users of the board classe to set the font to be used
* on the board. Note that the fontsize is dynamically set
*/
-void KBgBoard::setFont(const QFont& f)
+void KBgBoard::setFont(const TQFont& f)
{
boardFont = f;
}
@@ -378,16 +378,16 @@ void KBgBoard::queryCube()
* Constructor, creates the dialog but does not show nor execute it.
*/
KBgBoardQCube::KBgBoardQCube(int val, bool us, bool them)
- : QDialog(0, 0, true)
+ : TQDialog(0, 0, true)
{
setCaption(i18n("Set Cube Values"));
- QBoxLayout *vbox = new QVBoxLayout(this, 17);
+ TQBoxLayout *vbox = new TQVBoxLayout(this, 17);
- QLabel *info = new QLabel(this);
+ TQLabel *info = new TQLabel(this);
- cb[0] = new QComboBox(this, "first sb");
- cb[1] = new QComboBox(this, "second sb");
+ cb[0] = new TQComboBox(this, "first sb");
+ cb[1] = new TQComboBox(this, "second sb");
ok = new KPushButton(KStdGuiItem::ok(), this);
cancel = new KPushButton(KStdGuiItem::cancel(), this);
@@ -399,8 +399,8 @@ KBgBoardQCube::KBgBoardQCube(int val, bool us, bool them)
vbox->addWidget(info, 0);
- QBoxLayout *hbox_1 = new QHBoxLayout();
- QBoxLayout *hbox_2 = new QHBoxLayout();
+ TQBoxLayout *hbox_1 = new TQHBoxLayout();
+ TQBoxLayout *hbox_2 = new TQHBoxLayout();
vbox->addLayout(hbox_1);
vbox->addLayout(hbox_2);
@@ -471,11 +471,11 @@ KBgBoardQCube::KBgBoardQCube(int val, bool us, bool them)
cb[0]->setFocus();
- connect(ok, SIGNAL(clicked()), SLOT(accept()));
- connect(cancel, SIGNAL(clicked()), SLOT(reject()));
+ connect(ok, TQT_SIGNAL(clicked()), TQT_SLOT(accept()));
+ connect(cancel, TQT_SIGNAL(clicked()), TQT_SLOT(reject()));
- connect(cb[0], SIGNAL(activated(int)), SLOT(changePlayer(int)));
- connect(cb[1], SIGNAL(activated(int)), SLOT(changeValue (int)));
+ connect(cb[0], TQT_SIGNAL(activated(int)), TQT_SLOT(changePlayer(int)));
+ connect(cb[1], TQT_SIGNAL(activated(int)), TQT_SLOT(changeValue (int)));
}
/*
@@ -528,16 +528,16 @@ void KBgBoardQCube::changePlayer(int val)
* Constructor, creates the dialog but does not show nor execute it.
*/
KBgBoardQDice::KBgBoardQDice(const char *name)
- : QDialog(0, name, true)
+ : TQDialog(0, name, true)
{
setCaption(i18n("Set Dice Values"));
- QBoxLayout *vbox = new QVBoxLayout(this, 17);
+ TQBoxLayout *vbox = new TQVBoxLayout(this, 17);
- QLabel *info = new QLabel(this);
+ TQLabel *info = new TQLabel(this);
- sb[0] = new QSpinBox(this, "first sb");
- sb[1] = new QSpinBox(this, "second sb");
+ sb[0] = new TQSpinBox(this, "first sb");
+ sb[1] = new TQSpinBox(this, "second sb");
ok = new KPushButton(KStdGuiItem::ok(), this);
cancel = new KPushButton(KStdGuiItem::cancel(), this);
@@ -548,8 +548,8 @@ KBgBoardQDice::KBgBoardQDice(const char *name)
vbox->addWidget(info, 0);
- QBoxLayout *hbox_1 = new QHBoxLayout();
- QBoxLayout *hbox_2 = new QHBoxLayout();
+ TQBoxLayout *hbox_1 = new TQHBoxLayout();
+ TQBoxLayout *hbox_2 = new TQHBoxLayout();
vbox->addLayout(hbox_1);
vbox->addLayout(hbox_2);
@@ -577,8 +577,8 @@ KBgBoardQDice::KBgBoardQDice(const char *name)
sb[0]->setFocus();
- connect(ok, SIGNAL(clicked()), SLOT(accept()));
- connect(cancel, SIGNAL(clicked()), SLOT(reject()));
+ connect(ok, TQT_SIGNAL(clicked()), TQT_SLOT(accept()));
+ connect(cancel, TQT_SIGNAL(clicked()), TQT_SLOT(reject()));
sb[0]->setValue(1);
sb[1]->setValue(1);
@@ -656,7 +656,7 @@ KBgStatus* KBgBoard::getState(KBgStatus *st) const
/*
* This function lets external users change the context menu
*/
-void KBgBoard::setContextMenu(QPopupMenu *menu)
+void KBgBoard::setContextMenu(TQPopupMenu *menu)
{
contextMenu = menu;
}
@@ -670,12 +670,12 @@ void KBgBoard::sendMove()
if (getEditMode())
return;
- QString s, t;
+ TQString s, t;
s.setNum(moveHistory.count());
s += " ";
- QPtrListIterator<KBgBoardMove> it(moveHistory);
+ TQPtrListIterator<KBgBoardMove> it(moveHistory);
for (; it.current(); ++it) {
KBgBoardMove *move = it.current();
if (move->source() == BAR_US || move->source() == BAR_THEM ) {
@@ -702,22 +702,22 @@ void KBgBoard::sendMove()
}
/*
- * This is overloaded from QWidget, since it has to pass the new
+ * This is overloaded from TQWidget, since it has to pass the new
* background color to the child widgets (the cells).
*/
-void KBgBoard::setBackgroundColor(const QColor &col)
+void KBgBoard::setBackgroundColor(const TQColor &col)
{
if (col != backgroundColor()) {
- QWidget::setBackgroundColor(col);
+ TQWidget::setBackgroundColor(col);
for( int i = 0; i < 30; ++i)
cells[i]->setBackgroundColor(col);
}
}
/*
- * Overloaded from QWidget since we have to resize all cells
+ * Overloaded from TQWidget since we have to resize all cells
*/
-void KBgBoard::resizeEvent(QResizeEvent *)
+void KBgBoard::resizeEvent(TQResizeEvent *)
{
int xo0 = 0;
int xo1, w;
@@ -750,7 +750,7 @@ void KBgBoard::resizeEvent(QResizeEvent *)
* can print whatever she/he wants above the 0.2*p->viewport().height()
* margin (like game status information).
*/
-void KBgBoard::print(QPainter *p)
+void KBgBoard::print(TQPainter *p)
{
double sf = 0.8*p->viewport().width()/width();
int xo = int((p->viewport().width() - sf*width())/2);
@@ -770,7 +770,7 @@ void KBgBoard::print(QPainter *p)
* of the given sign(!). I.e. we distinguish checkers by whether
* they are negative or positive.
*/
-QColor KBgBoard::getCheckerColor(int p) const
+TQColor KBgBoard::getCheckerColor(int p) const
{
return ((p < 0) ? baseColors[0] : baseColors[1]);
}
@@ -799,14 +799,14 @@ int KBgBoardCell::getCheckerDiameter() const
/*
* Draws the cells content using the painter p.
- * Reimplemented from QLabel.
+ * Reimplemented from TQLabel.
*/
-void KBgBoardCell::drawContents(QPainter *)
+void KBgBoardCell::drawContents(TQPainter *)
{
- QRect cr(0, 0, width(), height());
+ TQRect cr(0, 0, width(), height());
cr.moveBottomLeft(rect().bottomLeft());
- QPixmap pix(cr.size());
- QPainter tmp;
+ TQPixmap pix(cr.size());
+ TQPainter tmp;
pix.fill(this, cr.topLeft());
tmp.begin(&pix);
paintCell(&tmp);
@@ -825,7 +825,7 @@ void KBgBoardCell::drawContents(QPainter *)
* overloaded paintCell() member are supposed to call this one after(!) they
* have painted themselves.
*/
-void KBgBoardCell::paintCell(QPainter *p, int xo, int yo, double sf) const
+void KBgBoardCell::paintCell(TQPainter *p, int xo, int yo, double sf) const
{
int x1 = xo; int x2 = xo;
int y1 = yo; int y2 = yo;
@@ -857,7 +857,7 @@ void KBgBoardCell::paintCell(QPainter *p, int xo, int yo, double sf) const
* for bars and homes to get them separated from the rest of the board.
*/
void
-KBgBoardCell::drawVertBorder(QPainter *p, int xo, int yo, double sf) const
+KBgBoardCell::drawVertBorder(TQPainter *p, int xo, int yo, double sf) const
{
p->setBrush(black);
p->setPen(black);
@@ -870,7 +870,7 @@ KBgBoardCell::drawVertBorder(QPainter *p, int xo, int yo, double sf) const
* starts at the upper left corner (xo, yo) and uses the scaling factor
* sf.
*/
-void KBgBoardHome::paintCell(QPainter *p, int xo, int yo, double sf) const
+void KBgBoardHome::paintCell(TQPainter *p, int xo, int yo, double sf) const
{
/*
* Only these homes contain checkers. The other ones contains dice and cube.
@@ -902,7 +902,7 @@ void KBgBoardHome::paintCell(QPainter *p, int xo, int yo, double sf) const
* checkers and the cube. Please read the comments in the code on how
* and why the checkers and (especially) the cube is printed.
*/
-void KBgBoardBar::paintCell(QPainter *p, int xo, int yo, double sf) const
+void KBgBoardBar::paintCell(TQPainter *p, int xo, int yo, double sf) const
{
/*
* Put in the checkers.
@@ -944,18 +944,18 @@ void KBgBoardBar::paintCell(QPainter *p, int xo, int yo, double sf) const
* the coundaries given by cubeRect(...). The other parameters are like
* in the other functions.
*/
-void KBgBoardCell::drawCube(QPainter *p, int who, int xo, int yo,
+void KBgBoardCell::drawCube(TQPainter *p, int who, int xo, int yo,
double sf) const
{
- QRect r = cubeRect(who, true, sf);
- r.moveTopLeft(QPoint(xo+r.left(), yo+r.top()));
+ TQRect r = cubeRect(who, true, sf);
+ r.moveTopLeft(TQPoint(xo+r.left(), yo+r.top()));
p->setBrush(black);
p->setPen(black);
p->drawRoundRect(r, 20, 20);
r = cubeRect(who, false, sf);
- r.moveTopLeft(QPoint(xo+r.left(), yo+r.top()));
+ r.moveTopLeft(TQPoint(xo+r.left(), yo+r.top()));
p->setBrush(white);
p->setPen(white);
@@ -964,7 +964,7 @@ void KBgBoardCell::drawCube(QPainter *p, int who, int xo, int yo,
p->setBrush(black);
p->setPen(black);
- QString cubeNum;
+ TQString cubeNum;
int v = board->getCube();
/*
* Ensure that the cube shows 64 initially
@@ -975,7 +975,7 @@ void KBgBoardCell::drawCube(QPainter *p, int who, int xo, int yo,
/*
* Adjust the font size
*/
- QFont f = board->getFont();
+ TQFont f = board->getFont();
f.setPointSizeFloat(0.75*f.pointSizeFloat());
p->setFont(f);
p->drawText(r, AlignCenter, cubeNum);
@@ -987,12 +987,12 @@ void KBgBoardCell::drawCube(QPainter *p, int who, int xo, int yo,
* is scaled with a default value of 1.0. The scale parameter determines the the
* size of the dice relative to the checker diameter.
*/
-QRect KBgBoardCell::diceRect(int i, bool big, double sf, double scale) const
+TQRect KBgBoardCell::diceRect(int i, bool big, double sf, double scale) const
{
int d = int(scale*getCheckerDiameter());
int l = (1+width())%2;
int k = (big ? 0 : 1);
- return(QRect(sf*(width()/2-d+k),
+ return(TQRect(sf*(width()/2-d+k),
sf*(height()/2-2*d-3+2*i*(d+3)-1+k),
sf*(2*(d-k)+1-l),
sf*(2*(d-k)+1-l)));
@@ -1003,9 +1003,9 @@ QRect KBgBoardCell::diceRect(int i, bool big, double sf, double scale) const
* is moved to the correct place and scaled correctly. The cube is slightly
* smaller than the dice.
*/
-QRect KBgBoardCell::cubeRect(int who, bool big, double sf) const
+TQRect KBgBoardCell::cubeRect(int who, bool big, double sf) const
{
- QRect r = diceRect(0, big, sf, 0.40);
+ TQRect r = diceRect(0, big, sf, 0.40);
int d = int(0.40*getCheckerDiameter());
int h = r.height();
@@ -1025,7 +1025,7 @@ QRect KBgBoardCell::cubeRect(int who, bool big, double sf) const
r.setTop( -d*sf - k);
break;
default:
- return(QRect(0,0,0,0));
+ return(TQRect(0,0,0,0));
}
r.setHeight(h);
return r;
@@ -1036,14 +1036,14 @@ QRect KBgBoardCell::cubeRect(int who, bool big, double sf) const
* If the painting of dice should be saved this is the place
* to modify.
*/
-void KBgBoardHome::drawDiceFace(QPainter *p, int col, int num, int who,
+void KBgBoardHome::drawDiceFace(TQPainter *p, int col, int num, int who,
int xo, int yo, double sf) const
{
p->setBrush(board->getCheckerColor(col));
p->setPen(board->getCheckerColor(col));
- QRect r = diceRect(num, false, sf);
- r.moveTopLeft(QPoint(xo+r.left(), yo+r.top()));
+ TQRect r = diceRect(num, false, sf);
+ r.moveTopLeft(TQPoint(xo+r.left(), yo+r.top()));
int cx = r.width() /2;
int cy = r.height()/2;
@@ -1087,13 +1087,13 @@ void KBgBoardHome::drawDiceFace(QPainter *p, int col, int num, int who,
* The square is suited to contain a a face value as printed
* by drawDiceFace(...).
*/
-void KBgBoardHome::drawDiceFrame(QPainter *p, int col, int num,
+void KBgBoardHome::drawDiceFrame(TQPainter *p, int col, int num,
int xo, int yo, bool big, double sf) const
{
p->setBrush(board->getCheckerColor(col));
p->setPen(board->getCheckerColor(col));
- QRect r = diceRect(num, big, sf);
- r.moveTopLeft(QPoint(xo+r.left(), yo+r.top()));
+ TQRect r = diceRect(num, big, sf);
+ r.moveTopLeft(TQPoint(xo+r.left(), yo+r.top()));
p->drawRoundRect(r, 20, 20);
}
@@ -1101,7 +1101,7 @@ void KBgBoardHome::drawDiceFrame(QPainter *p, int col, int num,
* If the event is left button we just store that. If the event is right
* button we ask the board to possibly display the popup menu.
*/
-void KBgBoardCell::mousePressEvent(QMouseEvent *e)
+void KBgBoardCell::mousePressEvent(TQMouseEvent *e)
{
if (e->button() == RightButton)
board->showContextMenu();
@@ -1140,7 +1140,7 @@ int KBgBoard::getShortMoveMode()
* tests are ok, the shortest possible move away from here is
* made.
*/
-void KBgBoardCell::checkAndMakeShortMove(QMouseEvent *e, int m)
+void KBgBoardCell::checkAndMakeShortMove(TQMouseEvent *e, int m)
{
if ((e->button() == LeftButton) &&
(board->getShortMoveMode() == m) &&
@@ -1152,7 +1152,7 @@ void KBgBoardCell::checkAndMakeShortMove(QMouseEvent *e, int m)
/*
* This functions reacts on a double click.
*/
-void KBgBoardCell::mouseDoubleClickEvent(QMouseEvent *e)
+void KBgBoardCell::mouseDoubleClickEvent(TQMouseEvent *e)
{
checkAndMakeShortMove(e, SHORT_MOVE_DOUBLE);
}
@@ -1162,9 +1162,9 @@ void KBgBoardCell::mouseDoubleClickEvent(QMouseEvent *e)
* about two different double clicks: double the cube and make a
* short move.
*/
-void KBgBoardBar::mouseDoubleClickEvent(QMouseEvent *e)
+void KBgBoardBar::mouseDoubleClickEvent(TQMouseEvent *e)
{
- QRect r = cubeRect(cellID == BAR_THEM ? CUBE_UPPER : CUBE_LOWER, true);
+ TQRect r = cubeRect(cellID == BAR_THEM ? CUBE_UPPER : CUBE_LOWER, true);
if (board->canDouble(US) &&
board->canDouble(THEM) && r.contains(e->pos())) {
if (board->getEditMode())
@@ -1189,7 +1189,7 @@ KBgBoard::~KBgBoard()
* This function draws dice and cube on the painter for a home cell.
* who may be either US or THEM.
*/
-void KBgBoardHome::drawDiceAndCube(QPainter *p, int who, int xo, int yo,
+void KBgBoardHome::drawDiceAndCube(TQPainter *p, int who, int xo, int yo,
double sf) const
{
int col = ((who == THEM) ? -color : color);
@@ -1316,7 +1316,7 @@ int KBgBoard::getPipCount(const int& w) const
* only if the the click happened within the boundaries of a
* dice or the cube.
*/
-void KBgBoardHome::mouseDoubleClickEvent(QMouseEvent * e)
+void KBgBoardHome::mouseDoubleClickEvent(TQMouseEvent * e)
{
if (e->button() != LeftButton)
return;
@@ -1331,7 +1331,7 @@ void KBgBoardHome::mouseDoubleClickEvent(QMouseEvent * e)
int w = ((cellID == HOME_US_LEFT || cellID == HOME_US_RIGHT) ?
US : THEM);
for (int i = 0; i < 2; ++i) {
- QRect r = diceRect(i, true);
+ TQRect r = diceRect(i, true);
if (r.contains(e->pos())) {
if (board->getEditMode()) {
@@ -1355,7 +1355,7 @@ void KBgBoardHome::mouseDoubleClickEvent(QMouseEvent * e)
}
if (board->canDouble(w) &&
!(board->canDouble(US) && board->canDouble(THEM))) {
- QRect r = cubeRect(w, true);
+ TQRect r = cubeRect(w, true);
if (r.contains(e->pos()))
if (board->getEditMode())
board->queryCube();
@@ -1432,7 +1432,7 @@ bool KBgBoard::moveOffPossible() const
* a pointer to the cell or NULL if there is no cell under the point.
*/
-KBgBoardCell* KBgBoard::getCellByPos(const QPoint& p) const
+KBgBoardCell* KBgBoard::getCellByPos(const TQPoint& p) const
{
for (int i = 0; i < 30; ++i) {
if (cells[i]->rect().contains(cells[i]->mapFromParent(p)))
@@ -1512,11 +1512,11 @@ bool KBgBoardCell::getPiece()
* This function stores the current cursor and replaces it with the
* supplied one c.
*/
-void KBgBoard::replaceCursor(const QCursor& c)
+void KBgBoard::replaceCursor(const TQCursor& c)
{
if (savedCursor)
delete savedCursor;
- savedCursor = new QCursor(cursor());
+ savedCursor = new TQCursor(cursor());
setCursor(c);
}
@@ -1558,7 +1558,7 @@ void KBgBoardCell::putPiece(int newColor)
* the cell where the first mousePressEvent occurred receives the release event.
* The release event marks the end of a drag or a single click short move.
*/
-void KBgBoardCell::mouseReleaseEvent(QMouseEvent *e)
+void KBgBoardCell::mouseReleaseEvent(TQMouseEvent *e)
{
if (dragInProgress) {
@@ -1608,12 +1608,12 @@ KBgBoardField::~KBgBoardField()
/*
* This is the constructor of the bars. It calls the base class' constructor
- * and defines the QWhatsThis string.
+ * and defines the TQWhatsThis string.
*/
-KBgBoardBar::KBgBoardBar(QWidget * parent, int numID)
+KBgBoardBar::KBgBoardBar(TQWidget * parent, int numID)
: KBgBoardCell(parent, numID)
{
- QWhatsThis::add(this, i18n("This is the bar of the backgammon board.\n\n"
+ TQWhatsThis::add(this, i18n("This is the bar of the backgammon board.\n\n"
"Checkers that have been kicked from the board are put "
"on the bar and remain there until they can be put back "
"on the board. Checkers can be moved by dragging them to "
@@ -1625,12 +1625,12 @@ KBgBoardBar::KBgBoardBar(QWidget * parent, int numID)
/*
* This is the constructor of regular fields. It calls the base class' constructor
- * and defines the QWhatsThis string.
+ * and defines the TQWhatsThis string.
*/
-KBgBoardField::KBgBoardField(QWidget * parent, int numID)
+KBgBoardField::KBgBoardField(TQWidget * parent, int numID)
: KBgBoardCell(parent, numID)
{
- QWhatsThis::add(this, i18n("This is a regular field of the backgammon board.\n\n"
+ TQWhatsThis::add(this, i18n("This is a regular field of the backgammon board.\n\n"
"Checkers can be placed on this field and if the current state "
"of the game and the dice permit this, they can be moved by "
"dragging them to their destination or by using the 'short "
@@ -1639,12 +1639,12 @@ KBgBoardField::KBgBoardField(QWidget * parent, int numID)
/*
* This is the constructor of the homes. It calls the base class' constructor
- * and defines the QWhatsThis string.
+ * and defines the TQWhatsThis string.
*/
-KBgBoardHome::KBgBoardHome(QWidget * parent, int numID)
+KBgBoardHome::KBgBoardHome(TQWidget * parent, int numID)
: KBgBoardCell(parent, numID)
{
- QWhatsThis::add(this, i18n("This part of the backgammon board is the home.\n\n"
+ TQWhatsThis::add(this, i18n("This part of the backgammon board is the home.\n\n"
"Depending on the direction of the game, one of the homes "
"contains the dice and the other one contains checkers that "
"have been moved off the board. Checkers can never be moved "
@@ -1734,8 +1734,8 @@ int KBgBoard::getTurn() const
* This is the constructor of the basic cells. It initializes the cell
* to a sane state and connects a signal to the board.
*/
-KBgBoardCell::KBgBoardCell(QWidget * parent, int numID)
- : QLabel(parent)
+KBgBoardCell::KBgBoardCell(TQWidget * parent, int numID)
+ : TQLabel(parent)
{
board = (KBgBoard *)parent;
@@ -1749,7 +1749,7 @@ KBgBoardCell::KBgBoardCell(QWidget * parent, int numID)
mouseButton = NoButton;
dragInProgress = false;
- connect(parent, SIGNAL(finishedUpdate()), this, SLOT(refresh()));
+ connect(parent, TQT_SIGNAL(finishedUpdate()), this, TQT_SLOT(refresh()));
}
/*
@@ -1858,7 +1858,7 @@ void KBgBoard::updateField(int f, int v)
*/
void KBgBoard::showContextMenu()
{
- if (contextMenu) contextMenu->popup(QCursor::pos());
+ if (contextMenu) contextMenu->popup(TQCursor::pos());
}
/*
@@ -2149,23 +2149,23 @@ void KBgBoard::setState(const KBgStatus &st)
* This function starts a drag from this cell if possible. It asks the board to
* change the mouse pointer and takes a checker away from this cell.
*/
-void KBgBoardCell::mouseMoveEvent(QMouseEvent *)
+void KBgBoardCell::mouseMoveEvent(TQMouseEvent *)
{
if ((mouseButton == LeftButton) && dragPossible()) {
dragInProgress = true;
- QRect cr(0, 0, 1+getCheckerDiameter(), 1+getCheckerDiameter());
+ TQRect cr(0, 0, 1+getCheckerDiameter(), 1+getCheckerDiameter());
cr.moveBottomLeft(rect().bottomLeft());
- QPixmap pix(cr.size());
- QPainter tmp;
+ TQPixmap pix(cr.size());
+ TQPainter tmp;
pix.fill(this, cr.topLeft());
tmp.begin(&pix);
board->drawSimpleChecker(&tmp, 0, 0, pcs, getCheckerDiameter());
tmp.end();
pix.setMask(pix.createHeuristicMask());
- QBitmap mask = *(pix.mask());
- QBitmap newCursor;
+ TQBitmap mask = *(pix.mask());
+ TQBitmap newCursor;
newCursor = pix;
- board->replaceCursor(QCursor(newCursor, mask));
+ board->replaceCursor(TQCursor(newCursor, mask));
if (board->getEditMode())
board->storeTurn(pcs);
getPiece();
@@ -2179,7 +2179,7 @@ void KBgBoardCell::mouseMoveEvent(QMouseEvent *)
* maximum diameter of diam. This checker has only two colors and
* as such it is suited for the mouse cursor and printing.
*/
-void KBgBoard::drawSimpleChecker(QPainter *p, int x, int y, int pcs,
+void KBgBoard::drawSimpleChecker(TQPainter *p, int x, int y, int pcs,
int diam) const
{
p->setBrush(getCheckerColor(pcs));
@@ -2202,7 +2202,7 @@ void KBgBoard::drawSimpleChecker(QPainter *p, int x, int y, int pcs,
* on a field respectively. upper indicates whether the checker is
* in the upper half of the board or not.
*/
-void KBgBoard::drawChecker(QPainter *p, int x, int y, int pcs, int diam,
+void KBgBoard::drawChecker(TQPainter *p, int x, int y, int pcs, int diam,
int col, bool upper) const
{
drawCircle(p, x, y, pcs, diam , col, upper, true );
@@ -2215,7 +2215,7 @@ void KBgBoard::drawChecker(QPainter *p, int x, int y, int pcs, int diam,
* up to fifteen checkers fit on the cell. This is used by homes and
* bars.
*/
-void KBgBoardCell::drawOverlappingCheckers(QPainter *p, int xo, int yo,
+void KBgBoardCell::drawOverlappingCheckers(TQPainter *p, int xo, int yo,
double sf) const
{
int d = getCheckerDiameter();
@@ -2240,9 +2240,9 @@ void KBgBoardCell::drawOverlappingCheckers(QPainter *p, int xo, int yo,
* checkers in such a way that always five are in one level and the next
* level is slightly shifted.
*/
-void KBgBoardField::paintCell(QPainter *p, int xo, int yo, double sf) const
+void KBgBoardField::paintCell(TQPainter *p, int xo, int yo, double sf) const
{
- QColor color, alphaColor, background = backgroundColor();
+ TQColor color, alphaColor, background = backgroundColor();
bool printing = abs(xo)+abs(yo) > 0;
if (printing) {
@@ -2251,7 +2251,7 @@ void KBgBoardField::paintCell(QPainter *p, int xo, int yo, double sf) const
* paper. This justs draws a triangle and surrounds
* it by a black triangle. Easy but works.
*/
- QPointArray pa(3);
+ TQPointArray pa(3);
color = (getNumber()%2 ? white : black);
@@ -2362,11 +2362,11 @@ void KBgBoardField::paintCell(QPainter *p, int xo, int yo, double sf) const
p->setBrush(color);
p->setPen(color);
- QString t;
+ TQString t;
t.setNum(getNumber());
p->setFont(board->getFont());
- int textHeight = QFontMetrics(p->font()).height();
+ int textHeight = TQFontMetrics(p->font()).height();
p->drawText(xo, yo+((cellID < 13) ? 5 : height()-5-textHeight),
width()*sf, textHeight, AlignCenter, t);
@@ -2408,12 +2408,12 @@ void KBgBoardField::paintCell(QPainter *p, int xo, int yo, double sf) const
* about the triangles on the cells. This is long but it is just a big if
* construct.
*/
-void KBgBoard::drawCircle(QPainter *p, int x, int y, int pcs, int diam,
+void KBgBoard::drawCircle(TQPainter *p, int x, int y, int pcs, int diam,
int col, bool upper, bool outer) const
{
- QColor fColor = getCheckerColor(pcs);
- QColor alphaColor;
- QColor bColor;
+ TQColor fColor = getCheckerColor(pcs);
+ TQColor alphaColor;
+ TQColor bColor;
int red, green, blue;
int rad = diam/2;
@@ -2823,8 +2823,8 @@ void KBgBoard::getRollDice(const int w)
* You have to change the status by passing a KBgStatus
* object to setState(...) before you can play!
*/
-KBgBoard::KBgBoard(QWidget *parent, const char *name, QPopupMenu *menu)
- : QWidget(parent, name)
+KBgBoard::KBgBoard(TQWidget *parent, const char *name, TQPopupMenu *menu)
+ : TQWidget(parent, name)
{
/*
* The following lines set up internal bookkeeping data.
@@ -2898,21 +2898,21 @@ KBgBoard::KBgBoard(QWidget *parent, const char *name, QPopupMenu *menu)
* overwritten by the user.
*/
shortMoveMode = SHORT_MOVE_DOUBLE;
- setBackgroundColor(QColor(200, 200, 166));
+ setBackgroundColor(TQColor(200, 200, 166));
computePipCount = true;
/*
* Set initial font
*/
- setFont(QApplication::font());
+ setFont(TQApplication::font());
}
-QSize KBgBoard::minimumSizeHint() const
+TQSize KBgBoard::minimumSizeHint() const
{
- return QSize(MINIMUM_CHECKER_SIZE * 15, MINIMUM_CHECKER_SIZE * 11);
+ return TQSize(MINIMUM_CHECKER_SIZE * 15, MINIMUM_CHECKER_SIZE * 11);
}
-QSize KBgBoard::sizeHint() const {
- return QSize(MINIMUM_CHECKER_SIZE *15*4,MINIMUM_CHECKER_SIZE*11*2);
+TQSize KBgBoard::sizeHint() const {
+ return TQSize(MINIMUM_CHECKER_SIZE *15*4,MINIMUM_CHECKER_SIZE*11*2);
}