[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Eliot-dev] eliot/qt board_widget.cpp board_widget.h tile_w...
From: |
Olivier Teulière |
Subject: |
[Eliot-dev] eliot/qt board_widget.cpp board_widget.h tile_w... |
Date: |
Fri, 22 Oct 2010 16:56:33 +0000 |
CVSROOT: /cvsroot/eliot
Module name: eliot
Changes by: Olivier Teulière <ipkiss> 10/10/22 16:56:33
Modified files:
qt : board_widget.cpp board_widget.h tile_widget.cpp
Log message:
Display the letters correctly
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/eliot/qt/board_widget.cpp?cvsroot=eliot&r1=1.18&r2=1.19
http://cvs.savannah.gnu.org/viewcvs/eliot/qt/board_widget.h?cvsroot=eliot&r1=1.7&r2=1.8
http://cvs.savannah.gnu.org/viewcvs/eliot/qt/tile_widget.cpp?cvsroot=eliot&r1=1.2&r2=1.3
Patches:
Index: board_widget.cpp
===================================================================
RCS file: /cvsroot/eliot/eliot/qt/board_widget.cpp,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -b -r1.18 -r1.19
--- board_widget.cpp 17 Oct 2010 21:45:10 -0000 1.18
+++ board_widget.cpp 22 Oct 2010 16:56:32 -0000 1.19
@@ -121,7 +121,8 @@
};
BoardWidget::BoardWidget(CoordModel &iCoordModel, QWidget *parent)
- : QFrame(parent), m_game(NULL), m_coordModel(iCoordModel)
+ : QFrame(parent), m_game(NULL), m_coordModel(iCoordModel),
+ m_widgetsMatrix(BOARD_MAX + 1, BOARD_MAX + 1, 0)
{
// Try to have a black background... FIXME: not working well!
QPalette pal = palette();
@@ -131,7 +132,7 @@
setForegroundRole(QPalette::Window);
setBackgroundRole(QPalette::Window);
- BoardLayout *layout = new BoardLayout(16);
+ BoardLayout *layout = new BoardLayout(BOARD_MAX + 1);
// Line full of coordinates
layout->addWidget(new BasicTileWidget(this, ""));
for (unsigned int col = BOARD_MIN; col <= BOARD_MAX; ++col)
@@ -160,6 +161,7 @@
else if (Board::GetLetterMultiplier(row, col) == 2)
mult = TileWidget::LETTER_DOUBLE;
TileWidget *t = new TileWidget(this, mult);
+ m_widgetsMatrix[row][col] = t;
layout->addWidget(t);
}
}
@@ -194,6 +196,21 @@
void BoardWidget::refresh()
{
+ if (m_game != NULL)
+ {
+ const Board &board = m_game->getBoard();
+ for (unsigned int row = BOARD_MIN; row <= BOARD_MAX; ++row)
+ {
+ for (unsigned int col = BOARD_MIN; col <= BOARD_MAX; ++col)
+ {
+ m_widgetsMatrix[row][col]->tileChanged(
+ board.getTile(row, col),
+ board.isJoker(row, col),
+ board.isTestChar(row, col),
+ false, false);
+ }
+ }
+ }
update();
}
Index: board_widget.h
===================================================================
RCS file: /cvsroot/eliot/eliot/qt/board_widget.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- board_widget.h 17 Oct 2010 21:28:01 -0000 1.7
+++ board_widget.h 22 Oct 2010 16:56:33 -0000 1.8
@@ -22,10 +22,11 @@
#define BOARD_WIDGET_H_
#include <QtGui/QFrame>
+#include "matrix.h"
-class QTreeView;
class PublicGame;
+class TileWidget;
class CoordModel;
class Coord;
@@ -57,6 +58,8 @@
/// Coordinates of the next word to play
CoordModel &m_coordModel;
+
+ Matrix<TileWidget*> m_widgetsMatrix;
};
#endif
Index: tile_widget.cpp
===================================================================
RCS file: /cvsroot/eliot/eliot/qt/tile_widget.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- tile_widget.cpp 17 Oct 2010 21:45:10 -0000 1.2
+++ tile_widget.cpp 22 Oct 2010 16:56:33 -0000 1.3
@@ -170,7 +170,7 @@
{
painter.setFont(pointsFont);
painter.drawText(xPos + squareSize * (1 - pointsCoeff),
- yPos + squareSize * (1 - pointsCoeff) + 1,
+ yPos + squareSize * (1 - pointsCoeff),
squareSize * pointsCoeff, squareSize *
pointsCoeff + 3,
Qt::AlignRight | Qt::AlignBottom,
QString("%1").arg(m_tile.getPoints()));
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Eliot-dev] eliot/qt board_widget.cpp board_widget.h tile_w...,
Olivier Teulière <=