summaryrefslogtreecommitdiffstats
path: root/kenolaba/BoardWidget.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-07-31 19:42:31 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-07-31 19:42:31 +0000
commit576eb4299a00bc053db35414406f46372a0f70f2 (patch)
tree4c030922d533821db464af566188e7d40cc8848c /kenolaba/BoardWidget.cpp
parent0718336b6017d1a4fc1d626544180a5a2a29ddec (diff)
downloadtdegames-576eb4299a00bc053db35414406f46372a0f70f2.tar.gz
tdegames-576eb4299a00bc053db35414406f46372a0f70f2.zip
Trinity Qt initial conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdegames@1157643 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kenolaba/BoardWidget.cpp')
-rw-r--r--kenolaba/BoardWidget.cpp94
1 files changed, 47 insertions, 47 deletions
diff --git a/kenolaba/BoardWidget.cpp b/kenolaba/BoardWidget.cpp
index 9d420cc3..da6358c7 100644
--- a/kenolaba/BoardWidget.cpp
+++ b/kenolaba/BoardWidget.cpp
@@ -6,9 +6,9 @@
* Josef Weidendorfer, 9/97
*/
-#include <qbitmap.h>
-#include <qpainter.h>
-#include <qcursor.h>
+#include <tqbitmap.h>
+#include <tqpainter.h>
+#include <tqcursor.h>
#include <klocale.h>
#include <kdebug.h>
@@ -34,7 +34,7 @@
#include "bitmaps/Arrow6"
#include "bitmaps/Arrow6Mask"
-BoardWidget::BoardWidget(Board& b, QWidget *parent, const char *name)
+BoardWidget::BoardWidget(Board& b, TQWidget *parent, const char *name)
: BallWidget(10,9,parent, name), board(b)
{
pList =0;
@@ -44,18 +44,18 @@ BoardWidget::BoardWidget(Board& b, QWidget *parent, const char *name)
#ifdef HAVE_KIR
m_backRenderer = KIRManager::attach( this, "Background" );
- connect( m_backRenderer, SIGNAL(rendered()),
- this, SLOT(drawBoard()) );
+ connect( m_backRenderer, TQT_SIGNAL(rendered()),
+ this, TQT_SLOT(drawBoard()) );
#endif
/* setup cursors */
#define createCursor(bitmap,name) \
- static QBitmap bitmap(bitmap##_width, bitmap##_height, \
+ static TQBitmap bitmap(bitmap##_width, bitmap##_height, \
(unsigned char *) bitmap##_bits, TRUE); \
- static QBitmap bitmap##Mask(bitmap##Mask_width, bitmap##Mask_height, \
+ static TQBitmap bitmap##Mask(bitmap##Mask_width, bitmap##Mask_height, \
(unsigned char *) bitmap##Mask_bits, TRUE); \
- name = new QCursor(bitmap, bitmap##Mask, bitmap##_x_hot, bitmap##_y_hot);
+ name = new TQCursor(bitmap, bitmap##Mask, bitmap##_x_hot, bitmap##_y_hot);
createCursor(Arrow1, arrow[1]);
createCursor(Arrow2, arrow[2]);
@@ -66,12 +66,12 @@ BoardWidget::BoardWidget(Board& b, QWidget *parent, const char *name)
setCursor(crossCursor);
- // boardColor = new QColor("lightblue");
- boardColor = new QColor(backgroundColor());
- redColor = new QColor("red2");
- yellowColor = new QColor("yellow2");
- redHColor = new QColor("orange");
- yellowHColor = new QColor("green");
+ // boardColor = new TQColor("lightblue");
+ boardColor = new TQColor(backgroundColor());
+ redColor = new TQColor("red2");
+ yellowColor = new TQColor("yellow2");
+ redHColor = new TQColor("orange");
+ yellowHColor = new TQColor("green");
initBalls();
@@ -149,18 +149,18 @@ void BoardWidget::initBalls()
for(i=0;i<3;i++) createPos(pos++, -2-i, 4-i, 0 );
}
-void BoardWidget::resizeEvent(QResizeEvent *e)
+void BoardWidget::resizeEvent(TQResizeEvent *e)
{
drawBoard();
BallWidget::resizeEvent(e);
}
-void BoardWidget::moveEvent(QMoveEvent*)
+void BoardWidget::moveEvent(TQMoveEvent*)
{
drawBoard();
}
-void BoardWidget::paintEvent(QPaintEvent *)
+void BoardWidget::paintEvent(TQPaintEvent *)
{
if (renderMode) {
pm = boardPM;
@@ -172,14 +172,14 @@ void BoardWidget::paintEvent(QPaintEvent *)
}
-void drawShadedHexagon(QPainter *p, int x, int y, int r, int lineWidth,
- const QColorGroup& g, bool sunken)
+void drawShadedHexagon(TQPainter *p, int x, int y, int r, int lineWidth,
+ const TQColorGroup& g, bool sunken)
{
int dx=r/2, dy=(r*87)/100;
int y1=y-dy, y2=y+dy;
int i;
- QPen oldPen = p->pen();
+ TQPen oldPen = p->pen();
p->setPen(sunken ? g.midlight() : g.dark());
@@ -201,13 +201,13 @@ void drawShadedHexagon(QPainter *p, int x, int y, int r, int lineWidth,
}
-void drawColor(QPainter *p, int x, int y, int r, QColor* c)
+void drawColor(TQPainter *p, int x, int y, int r, TQColor* c)
{
- QColor w("white");
- QPalette pal(*c);
+ TQColor w("white");
+ TQPalette pal(*c);
- QPen oldPen = p->pen();
- QBrush oldBrush = p->brush();
+ TQPen oldPen = p->pen();
+ TQBrush oldBrush = p->brush();
p->setBrush(pal.active().dark());
p->setPen(pal.active().dark());
@@ -236,18 +236,18 @@ void BoardWidget::drawBoard()
boardPM.fill(this, 0,0);
#ifndef HAVE_KIR
- QColorGroup g = QPalette( *boardColor ).active();
- QColorGroup g2 = QWidget::colorGroup();
+ TQColorGroup g = TQPalette( *boardColor ).active();
+ TQColorGroup g2 = TQWidget::colorGroup();
int boardSize = width() *10/12;
if (boardSize > height()) boardSize = height();
- QPainter p;
+ TQPainter p;
p.begin(&boardPM);
- p.setBrush(g2.brush(QColorGroup::Mid));
+ p.setBrush(g2.brush(TQColorGroup::Mid));
- QWMatrix m;
- QPoint cp = rect().center();
+ TQWMatrix m;
+ TQPoint cp = rect().center();
m.translate(cp.x(), cp.y());
m.scale(boardSize/1100.0, boardSize/1000.0);
@@ -259,7 +259,7 @@ void BoardWidget::drawBoard()
int i,j;
- QPointArray a;
+ TQPointArray a;
int dx=520 /2, dy=(520 *87)/100;
a.setPoints(6, -dx,-dy, dx,-dy, 2*dx,0, dx,dy, -dx,dy, -2*dx,0 );
p.drawPolygon(a);
@@ -352,12 +352,12 @@ void BoardWidget::draw()
int boardSize = width() *10/12;
if (boardSize > height()) boardSize = height();
- QPainter p;
+ TQPainter p;
p.begin(&pm);
p.setBrush(foregroundColor());
- QWMatrix m;
- QPoint cp = rect().center();
+ TQWMatrix m;
+ TQPoint cp = rect().center();
m.translate(cp.x(), cp.y());
m.scale(boardSize/1100.0, boardSize/1000.0);
@@ -829,7 +829,7 @@ bool BoardWidget::isValidEnd(int pos)
-void BoardWidget::mousePressEvent( QMouseEvent* pEvent )
+void BoardWidget::mousePressEvent( TQMouseEvent* pEvent )
{
int pos = positionOf( pEvent->x(), pEvent->y() );
int f = fieldOf(pos);
@@ -887,14 +887,14 @@ void BoardWidget::mousePressEvent( QMouseEvent* pEvent )
showStart(actMove,1);
startShown = true;
- QString tmp;
+ TQString tmp;
actValue = - board.calcEvaluation();
tmp = i18n("Board value: %1").arg(actValue);
emit updateSpy(tmp);
}
-void BoardWidget::mouseMoveEvent( QMouseEvent* pEvent )
+void BoardWidget::mouseMoveEvent( TQMouseEvent* pEvent )
{
if ((!gettingMove && !editMode) || !mbDown) return;
@@ -928,7 +928,7 @@ void BoardWidget::mouseMoveEvent( QMouseEvent* pEvent )
showStart(actMove,1);
startShown = true;
- QString tmp;
+ TQString tmp;
actValue = - board.calcEvaluation();
tmp = i18n("Board value: %1").arg(actValue);
emit updateSpy(tmp);
@@ -946,16 +946,16 @@ void BoardWidget::mouseMoveEvent( QMouseEvent* pEvent )
int v = board.calcEvaluation();
board.takeBack();
- QString tmp;
+ TQString tmp;
tmp.sprintf("%+d", v-actValue);
- QString str = QString("%1 : %2").arg(actMove.name()).arg(tmp);
+ TQString str = TQString("%1 : %2").arg(actMove.name()).arg(tmp);
emit updateSpy(str);
showMove(actMove,3);
setCursor(*arrow[shownDirection]);
}
else {
- QString tmp;
+ TQString tmp;
setCursor(crossCursor);
if (pos == startPos) {
@@ -970,7 +970,7 @@ void BoardWidget::mouseMoveEvent( QMouseEvent* pEvent )
}
-void BoardWidget::mouseReleaseEvent( QMouseEvent* pEvent )
+void BoardWidget::mouseReleaseEvent( TQMouseEvent* pEvent )
{
if (!gettingMove && !editMode) return;
mbDown = false;
@@ -1015,13 +1015,13 @@ void BoardWidget::mouseReleaseEvent( QMouseEvent* pEvent )
startValid = false;
setCursor(crossCursor);
- QString tmp;
+ TQString tmp;
emit updateSpy(tmp);
}
-QSize BoardWidget::sizeHint() const
+TQSize BoardWidget::sizeHint() const
{
- return QSize(400, 350);
+ return TQSize(400, 350);
}
#include "BoardWidget.moc"