summaryrefslogtreecommitdiffstats
path: root/kbackgammon/kbgboard.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'kbackgammon/kbgboard.cpp')
-rw-r--r--kbackgammon/kbgboard.cpp136
1 files changed, 68 insertions, 68 deletions
diff --git a/kbackgammon/kbgboard.cpp b/kbackgammon/kbgboard.cpp
index fc024ab8..b47c6192 100644
--- a/kbackgammon/kbgboard.cpp
+++ b/kbackgammon/kbgboard.cpp
@@ -196,7 +196,7 @@ void KBgBoardSetup::getSetupPages(KDialogBase *nb)
"move a checker the shortest possible distance."));
for (int i = 0; i < 3; i++) {
- rbMove[i]->setMinimumSize(rbMove[i]->sizeHint());
+ rbMove[i]->setMinimumSize(rbMove[i]->tqsizeHint());
blm->addWidget(rbMove[i]);
rbMove[i]->setChecked(i == getShortMoveMode());
}
@@ -248,8 +248,8 @@ void KBgBoardSetup::getSetupPages(KDialogBase *nb)
/*
* Empty constructor calls the board constructor
*/
-KBgBoardSetup::KBgBoardSetup(TQWidget *parent, const char *name, TQPopupMenu *menu)
- : KBgBoard(parent, name, menu)
+KBgBoardSetup::KBgBoardSetup(TQWidget *tqparent, const char *name, TQPopupMenu *menu)
+ : KBgBoard(tqparent, name, menu)
{
// empty
}
@@ -360,10 +360,10 @@ void KBgBoard::setFont(const TQFont& f)
*/
void KBgBoard::queryCube()
{
- KBgStatus *st = new KBgStatus();
+ KBgtqStatus *st = new KBgtqStatus();
getState(st);
- KBgBoardQCube *dlg =
- new KBgBoardQCube(abs(st->cube()), (st->cube(US) > 0), (st->cube(THEM) > 0));
+ KBgBoardTQCube *dlg =
+ new KBgBoardTQCube(abs(st->cube()), (st->cube(US) > 0), (st->cube(THEM) > 0));
if (dlg->exec()) {
bool u = ((dlg->getCubeValue() == 0) || (dlg->getCubeOwner() == US ));
bool t = ((dlg->getCubeValue() == 0) || (dlg->getCubeOwner() == THEM));
@@ -377,7 +377,7 @@ void KBgBoard::queryCube()
/*
* Constructor, creates the dialog but does not show nor execute it.
*/
-KBgBoardQCube::KBgBoardQCube(int val, bool us, bool them)
+KBgBoardTQCube::KBgBoardTQCube(int val, bool us, bool them)
: TQDialog(0, 0, true)
{
setCaption(i18n("Set Cube Values"));
@@ -395,7 +395,7 @@ KBgBoardQCube::KBgBoardQCube(int val, bool us, bool them)
"double. Note that a face value of 1 automatically allows both\n"
"players to double."));
- info->setMinimumSize(info->sizeHint());
+ info->setMinimumSize(info->tqsizeHint());
vbox->addWidget(info, 0);
@@ -454,17 +454,17 @@ KBgBoardQCube::KBgBoardQCube(int val, bool us, bool them)
else if (them)
cb[1]->setCurrentItem(THEM);
- cb[0]->setMinimumSize(cb[0]->sizeHint());
- cb[1]->setMinimumSize(cb[1]->sizeHint());
+ cb[0]->setMinimumSize(cb[0]->tqsizeHint());
+ cb[1]->setMinimumSize(cb[1]->tqsizeHint());
- ok->setMinimumSize(ok->sizeHint());
- cancel->setMinimumSize(cancel->sizeHint());
+ ok->setMinimumSize(ok->tqsizeHint());
+ cancel->setMinimumSize(cancel->tqsizeHint());
- setMinimumSize(childrenRect().size());
+ setMinimumSize(tqchildrenRect().size());
vbox->activate();
- resize(minimumSize());
+ resize(tqminimumSize());
ok->setAutoDefault (true);
ok->setDefault(true);
@@ -481,7 +481,7 @@ KBgBoardQCube::KBgBoardQCube(int val, bool us, bool them)
/*
* Deconstructor, empty.
*/
-KBgBoardQCube::~KBgBoardQCube()
+KBgBoardTQCube::~KBgBoardTQCube()
{
// nothing
}
@@ -489,7 +489,7 @@ KBgBoardQCube::~KBgBoardQCube()
/*
* Get the face value of the cube
*/
-int KBgBoardQCube::getCubeValue()
+int KBgBoardTQCube::getCubeValue()
{
return cb[0]->currentItem();
}
@@ -497,7 +497,7 @@ int KBgBoardQCube::getCubeValue()
/*
* Get the owner of the cube
*/
-int KBgBoardQCube::getCubeOwner()
+int KBgBoardTQCube::getCubeOwner()
{
return cb[1]->currentItem();
}
@@ -505,7 +505,7 @@ int KBgBoardQCube::getCubeOwner()
/*
* If the cube is open, the value can only be 1
*/
-void KBgBoardQCube::changeValue(int player)
+void KBgBoardTQCube::changeValue(int player)
{
if (player == BOTH)
cb[0]->setCurrentItem(0);
@@ -516,7 +516,7 @@ void KBgBoardQCube::changeValue(int player)
* If the value is 1, the cube has to be open; and if the value
* becomes bigger than 1, the player cannot stay open.
*/
-void KBgBoardQCube::changePlayer(int val)
+void KBgBoardTQCube::changePlayer(int val)
{
if (val == 0)
cb[1]->setCurrentItem(BOTH);
@@ -527,7 +527,7 @@ void KBgBoardQCube::changePlayer(int val)
/*
* Constructor, creates the dialog but does not show nor execute it.
*/
-KBgBoardQDice::KBgBoardQDice(const char *name)
+KBgBoardTQDice::KBgBoardTQDice(const char *name)
: TQDialog(0, name, true)
{
setCaption(i18n("Set Dice Values"));
@@ -544,7 +544,7 @@ KBgBoardQDice::KBgBoardQDice(const char *name)
info->setText(i18n("Set the face values of the selected dice. The other player's\n"
"dice will be cleared and it will be the dice's owner's turn."));
- info->setMinimumSize(info->sizeHint());
+ info->setMinimumSize(info->tqsizeHint());
vbox->addWidget(info, 0);
@@ -560,17 +560,17 @@ KBgBoardQDice::KBgBoardQDice(const char *name)
hbox_2->addWidget(ok);
hbox_2->addWidget(cancel);
- sb[0]->setMinimumSize(sb[0]->sizeHint());
- sb[1]->setMinimumSize(sb[1]->sizeHint());
+ sb[0]->setMinimumSize(sb[0]->tqsizeHint());
+ sb[1]->setMinimumSize(sb[1]->tqsizeHint());
- ok->setMinimumSize(ok->sizeHint());
- cancel->setMinimumSize(cancel->sizeHint());
+ ok->setMinimumSize(ok->tqsizeHint());
+ cancel->setMinimumSize(cancel->tqsizeHint());
- setMinimumSize(childrenRect().size());
+ setMinimumSize(tqchildrenRect().size());
vbox->activate();
- resize(minimumSize());
+ resize(tqminimumSize());
ok->setAutoDefault (true);
ok->setDefault(true);
@@ -590,7 +590,7 @@ KBgBoardQDice::KBgBoardQDice(const char *name)
/*
* Deconstructor, empty.
*/
-KBgBoardQDice::~KBgBoardQDice()
+KBgBoardTQDice::~KBgBoardTQDice()
{
// nothing
}
@@ -598,7 +598,7 @@ KBgBoardQDice::~KBgBoardQDice()
/*
* Get the face value of the dice
*/
-int KBgBoardQDice::getDice(int n)
+int KBgBoardTQDice::getDice(int n)
{
return sb[n]->value();
}
@@ -628,10 +628,10 @@ bool KBgBoard::getEditMode() const
}
/*
- * This function takes a KBgStatus object and fills it with the current
+ * This function takes a KBgtqStatus object and fills it with the current
* board status.
*/
-KBgStatus* KBgBoard::getState(KBgStatus *st) const
+KBgtqStatus* KBgBoard::getState(KBgtqStatus *st) const
{
st->setColor(color);
st->setDirection(direction);
@@ -915,7 +915,7 @@ void KBgBoardBar::paintCell(TQPainter *p, int xo, int yo, double sf) const
* the center belongs to two(!) fields - both bars.
*
* If we are not printing on paper we use the fact that
- * Qt will clip the drawing for us. So we print the upper
+ * TQt will clip the drawing for us. So we print the upper
* half of the cube and the lower half on different cells.
*
* Since there is no such thing as clipping when we print
@@ -1103,7 +1103,7 @@ void KBgBoardHome::drawDiceFrame(TQPainter *p, int col, int num,
*/
void KBgBoardCell::mousePressEvent(TQMouseEvent *e)
{
- if (e->button() == RightButton)
+ if (e->button() == Qt::RightButton)
board->showContextMenu();
else
mouseButton = e->button();
@@ -1142,7 +1142,7 @@ int KBgBoard::getShortMoveMode()
*/
void KBgBoardCell::checkAndMakeShortMove(TQMouseEvent *e, int m)
{
- if ((e->button() == LeftButton) &&
+ if ((e->button() == Qt::LeftButton) &&
(board->getShortMoveMode() == m) &&
(dragPossible()) &&
(!board->getEditMode()))
@@ -1166,7 +1166,7 @@ void KBgBoardBar::mouseDoubleClickEvent(TQMouseEvent *e)
{
TQRect r = cubeRect(cellID == BAR_THEM ? CUBE_UPPER : CUBE_LOWER, true);
if (board->canDouble(US) &&
- board->canDouble(THEM) && r.contains(e->pos())) {
+ board->canDouble(THEM) && r.tqcontains(e->pos())) {
if (board->getEditMode())
board->queryCube();
else
@@ -1318,7 +1318,7 @@ int KBgBoard::getPipCount(const int& w) const
*/
void KBgBoardHome::mouseDoubleClickEvent(TQMouseEvent * e)
{
- if (e->button() != LeftButton)
+ if (e->button() != Qt::LeftButton)
return;
/*
* Check whether this is the bookkeeping home...
@@ -1332,12 +1332,12 @@ void KBgBoardHome::mouseDoubleClickEvent(TQMouseEvent * e)
US : THEM);
for (int i = 0; i < 2; ++i) {
TQRect r = diceRect(i, true);
- if (r.contains(e->pos())) {
+ if (r.tqcontains(e->pos())) {
if (board->getEditMode()) {
- KBgBoardQDice *dlg = new KBgBoardQDice();
+ KBgBoardTQDice *dlg = new KBgBoardTQDice();
if (dlg->exec()) {
- KBgStatus *st = new KBgStatus();
+ KBgtqStatus *st = new KBgtqStatus();
board->getState(st);
st->setDice(w, 0, dlg->getDice(0));
st->setDice(w, 1, dlg->getDice(1));
@@ -1356,7 +1356,7 @@ void KBgBoardHome::mouseDoubleClickEvent(TQMouseEvent * e)
if (board->canDouble(w) &&
!(board->canDouble(US) && board->canDouble(THEM))) {
TQRect r = cubeRect(w, true);
- if (r.contains(e->pos()))
+ if (r.tqcontains(e->pos()))
if (board->getEditMode())
board->queryCube();
else
@@ -1367,7 +1367,7 @@ void KBgBoardHome::mouseDoubleClickEvent(TQMouseEvent * e)
/*
* This function determines if a checker can be dropped on this field.
- * It checks whether the field is already owned, empty or contains
+ * It checks whether the field is already owned, empty or tqcontains
* only one opponents piece. Then the dice are checked.
*/
bool KBgBoardField::dropPossible(int fromCellID, int newColor)
@@ -1435,7 +1435,7 @@ bool KBgBoard::moveOffPossible() const
KBgBoardCell* KBgBoard::getCellByPos(const TQPoint& p) const
{
for (int i = 0; i < 30; ++i) {
- if (cells[i]->rect().contains(cells[i]->mapFromParent(p)))
+ if (TQT_TQRECT_OBJECT(cells[i]->rect()).tqcontains(cells[i]->mapFromParent(p)))
return cells[i];
}
return NULL;
@@ -1610,8 +1610,8 @@ KBgBoardField::~KBgBoardField()
* This is the constructor of the bars. It calls the base class' constructor
* and defines the TQWhatsThis string.
*/
-KBgBoardBar::KBgBoardBar(TQWidget * parent, int numID)
- : KBgBoardCell(parent, numID)
+KBgBoardBar::KBgBoardBar(TQWidget * tqparent, int numID)
+ : KBgBoardCell(tqparent, numID)
{
TQWhatsThis::add(this, i18n("This is the bar of the backgammon board.\n\n"
"Checkers that have been kicked from the board are put "
@@ -1627,8 +1627,8 @@ KBgBoardBar::KBgBoardBar(TQWidget * parent, int numID)
* This is the constructor of regular fields. It calls the base class' constructor
* and defines the TQWhatsThis string.
*/
-KBgBoardField::KBgBoardField(TQWidget * parent, int numID)
- : KBgBoardCell(parent, numID)
+KBgBoardField::KBgBoardField(TQWidget * tqparent, int numID)
+ : KBgBoardCell(tqparent, numID)
{
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 "
@@ -1641,8 +1641,8 @@ KBgBoardField::KBgBoardField(TQWidget * parent, int numID)
* This is the constructor of the homes. It calls the base class' constructor
* and defines the TQWhatsThis string.
*/
-KBgBoardHome::KBgBoardHome(TQWidget * parent, int numID)
- : KBgBoardCell(parent, numID)
+KBgBoardHome::KBgBoardHome(TQWidget * tqparent, int numID)
+ : KBgBoardCell(tqparent, numID)
{
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 "
@@ -1734,10 +1734,10 @@ 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(TQWidget * parent, int numID)
- : TQLabel(parent)
+KBgBoardCell::KBgBoardCell(TQWidget * tqparent, int numID)
+ : TQLabel(tqparent)
{
- board = (KBgBoard *)parent;
+ board = (KBgBoard *)tqparent;
direction = +1;
color = -1;
@@ -1746,10 +1746,10 @@ KBgBoardCell::KBgBoardCell(TQWidget * parent, int numID)
stateChanged = false;
colorChanged = false;
directionChanged = false;
- mouseButton = NoButton;
+ mouseButton = Qt::NoButton;
dragInProgress = false;
- connect(parent, TQT_SIGNAL(finishedUpdate()), this, TQT_SLOT(refresh()));
+ connect(tqparent, TQT_SIGNAL(finishedUpdate()), this, TQT_SLOT(refresh()));
}
/*
@@ -1854,7 +1854,7 @@ void KBgBoard::updateField(int f, int v)
}
/*
- * This function displays the context menu our parent may have given us
+ * This function displays the context menu our tqparent may have given us
*/
void KBgBoard::showContextMenu()
{
@@ -2085,7 +2085,7 @@ bool KBgBoard::diceAllowMove(int src, int dest)
* This is the most important of all members of the board class. It takes
* a single board status object and initializes the internal status.
*/
-void KBgBoard::setState(const KBgStatus &st)
+void KBgBoard::setState(const KBgtqStatus &st)
{
color = st.color();
direction = st.direction();
@@ -2151,7 +2151,7 @@ void KBgBoard::setState(const KBgStatus &st)
*/
void KBgBoardCell::mouseMoveEvent(TQMouseEvent *)
{
- if ((mouseButton == LeftButton) && dragPossible()) {
+ if ((mouseButton == Qt::LeftButton) && dragPossible()) {
dragInProgress = true;
TQRect cr(0, 0, 1+getCheckerDiameter(), 1+getCheckerDiameter());
cr.moveBottomLeft(rect().bottomLeft());
@@ -2162,15 +2162,15 @@ void KBgBoardCell::mouseMoveEvent(TQMouseEvent *)
board->drawSimpleChecker(&tmp, 0, 0, pcs, getCheckerDiameter());
tmp.end();
pix.setMask(pix.createHeuristicMask());
- TQBitmap mask = *(pix.mask());
+ TQBitmap tqmask = *(pix.tqmask());
TQBitmap newCursor;
- newCursor = pix;
- board->replaceCursor(TQCursor(newCursor, mask));
+ newCursor = TQBitmap(pix);
+ board->replaceCursor(TQCursor(newCursor, tqmask));
if (board->getEditMode())
board->storeTurn(pcs);
getPiece();
}
- mouseButton = NoButton;
+ mouseButton = Qt::NoButton;
}
/*
@@ -2653,7 +2653,7 @@ void KBgBoard::redoMove()
}
/*
- * This function performs and undo for the last move and updates the parent
+ * This function performs and undo for the last move and updates the tqparent
* of the board by calling sendMove() after the undo.
*/
void KBgBoard::undoMove()
@@ -2820,11 +2820,11 @@ void KBgBoard::getRollDice(const int w)
* This is the constructor of the KBgBoard class. It creates
* a backgammon board with an initial distribution of checkers, empty
* dice and a cube with face value 1. The initial board is not usable!
- * You have to change the status by passing a KBgStatus
+ * You have to change the status by passing a KBgtqStatus
* object to setState(...) before you can play!
*/
-KBgBoard::KBgBoard(TQWidget *parent, const char *name, TQPopupMenu *menu)
- : TQWidget(parent, name)
+KBgBoard::KBgBoard(TQWidget *tqparent, const char *name, TQPopupMenu *menu)
+ : TQWidget(tqparent, name)
{
/*
* The following lines set up internal bookkeeping data.
@@ -2838,7 +2838,7 @@ KBgBoard::KBgBoard(TQWidget *parent, const char *name, TQPopupMenu *menu)
checkerDiam = MINIMUM_CHECKER_SIZE;
/*
- * We may be initialized with a popup menu by our parent.
+ * We may be initialized with a popup menu by our tqparent.
*/
contextMenu = menu;
@@ -2868,7 +2868,7 @@ KBgBoard::KBgBoard(TQWidget *parent, const char *name, TQPopupMenu *menu)
* Get the default seeting of the board and initialize the
* state of it.
*/
- KBgStatus *st = new KBgStatus();
+ KBgtqStatus *st = new KBgtqStatus();
st->setCube(1, true, true);
st->setDirection(+1);
@@ -2907,12 +2907,12 @@ KBgBoard::KBgBoard(TQWidget *parent, const char *name, TQPopupMenu *menu)
setFont(TQApplication::font());
}
-TQSize KBgBoard::minimumSizeHint() const
+TQSize KBgBoard::tqminimumSizeHint() const
{
return TQSize(MINIMUM_CHECKER_SIZE * 15, MINIMUM_CHECKER_SIZE * 11);
}
-TQSize KBgBoard::sizeHint() const {
+TQSize KBgBoard::tqsizeHint() const {
return TQSize(MINIMUM_CHECKER_SIZE *15*4,MINIMUM_CHECKER_SIZE*11*2);
}