Topping: do not show the lineEdit control showing points of the move

This commit is contained in:
Olivier Teulière 2013-01-14 01:16:20 +01:00
parent cbe7f1e172
commit 9268767567
6 changed files with 21 additions and 40 deletions

View file

@ -36,7 +36,7 @@ INIT_LOGGER(qt, PlayWordMediator);
PlayWordMediator::PlayWordMediator(QObject *parent, QLineEdit &iEditPlay,
QLineEdit &iEditCoord, QLineEdit &iEditPoints,
QLineEdit &iEditCoord, QLineEdit *iEditPoints,
QPushButton &iButtonPlay,
PlayModel &iPlayModel, PublicGame *iGame)
: QObject(parent), m_game(iGame), m_lineEditPlay(iEditPlay),
@ -136,8 +136,10 @@ void PlayWordMediator::updatePointsAndState()
m_lineEditCoord.hasAcceptableInput();
m_pushButtonPlay.setEnabled(acceptableInput);
if (m_lineEditPoints)
{
if (!acceptableInput)
m_lineEditPoints.clear();
m_lineEditPoints->clear();
else
{
// Compute the points of the word
@ -145,9 +147,10 @@ void PlayWordMediator::updatePointsAndState()
const wstring &coords = wfq(m_lineEditCoord.text());
int points = m_game->computePoints(word, coords);
if (points >= 0)
m_lineEditPoints.setText(QString("%1").arg(points));
m_lineEditPoints->setText(QString("%1").arg(points));
else
m_lineEditPoints.setText("#");
m_lineEditPoints->setText("#");
}
}
}

View file

@ -57,7 +57,7 @@ class PlayWordMediator: public QObject
public:
PlayWordMediator(QObject *parent, QLineEdit &iEditWord,
QLineEdit &iEditCoord, QLineEdit &iEditPoints,
QLineEdit &iEditCoord, QLineEdit *iEditPoints,
QPushButton &iButtonPlay,
PlayModel &iPlayModel, PublicGame *iGame);
@ -99,7 +99,7 @@ private:
PublicGame *m_game;
QLineEdit &m_lineEditPlay;
QLineEdit &m_lineEditCoord;
QLineEdit &m_lineEditPoints;
QLineEdit *m_lineEditPoints;
QPushButton &m_pushButtonPlay;
PlayModel &m_playModel;

View file

@ -47,7 +47,7 @@ PlayerWidget::PlayerWidget(QWidget *parent, PlayModel &iPlayModel,
// Use the mediator
m_mediator = new PlayWordMediator(this, *lineEditPlay, *lineEditCoords,
*lineEditPoints, *pushButtonPlay,
lineEditPoints, *pushButtonPlay,
iPlayModel, iGame);
QObject::connect(m_mediator, SIGNAL(gameUpdated()),
this, SIGNAL(gameUpdated()));

View file

@ -82,7 +82,7 @@ ToppingWidget::ToppingWidget(QWidget *parent, PlayModel &iPlayModel,
// Use the mediator
m_mediator = new PlayWordMediator(this, *lineEditPlay, *lineEditCoords,
*lineEditPoints, *pushButtonPlay,
NULL, *pushButtonPlay,
iPlayModel, m_game);
QObject::connect(m_mediator, SIGNAL(gameUpdated()),
this, SIGNAL(gameUpdated()));

View file

@ -57,7 +57,7 @@ TrainingWidget::TrainingWidget(QWidget *parent, PlayModel &iPlayModel, PublicGam
// Use the mediator
m_mediator = new PlayWordMediator(this, *lineEditPlay, *lineEditCoords,
*lineEditPoints, *pushButtonPlay,
lineEditPoints, *pushButtonPlay,
iPlayModel, m_game);
QObject::connect(m_mediator, SIGNAL(gameUpdated()),
this, SIGNAL(gameUpdated()));

View file

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>642</width>
<height>151</height>
<width>632</width>
<height>134</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
@ -19,9 +19,6 @@
<height>16777215</height>
</size>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<widget class="QWidget" name="layoutWidget">
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
@ -52,25 +49,6 @@
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLineEdit" name="lineEditPoints">
<property name="enabled">
<bool>false</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>50</width>
<height>16777215</height>
</size>
</property>
</widget>
</item>
<item row="2" column="4">
<widget class="QPushButton" name="pushButtonGetHints">
<property name="text">