mirror of
git://git.savannah.nongnu.org/eliot.git
synced 2024-12-27 09:58:08 +01:00
Topping: do not show the lineEdit control showing points of the move
This commit is contained in:
parent
cbe7f1e172
commit
9268767567
6 changed files with 21 additions and 40 deletions
|
@ -36,7 +36,7 @@ INIT_LOGGER(qt, PlayWordMediator);
|
||||||
|
|
||||||
|
|
||||||
PlayWordMediator::PlayWordMediator(QObject *parent, QLineEdit &iEditPlay,
|
PlayWordMediator::PlayWordMediator(QObject *parent, QLineEdit &iEditPlay,
|
||||||
QLineEdit &iEditCoord, QLineEdit &iEditPoints,
|
QLineEdit &iEditCoord, QLineEdit *iEditPoints,
|
||||||
QPushButton &iButtonPlay,
|
QPushButton &iButtonPlay,
|
||||||
PlayModel &iPlayModel, PublicGame *iGame)
|
PlayModel &iPlayModel, PublicGame *iGame)
|
||||||
: QObject(parent), m_game(iGame), m_lineEditPlay(iEditPlay),
|
: QObject(parent), m_game(iGame), m_lineEditPlay(iEditPlay),
|
||||||
|
@ -136,8 +136,10 @@ void PlayWordMediator::updatePointsAndState()
|
||||||
m_lineEditCoord.hasAcceptableInput();
|
m_lineEditCoord.hasAcceptableInput();
|
||||||
m_pushButtonPlay.setEnabled(acceptableInput);
|
m_pushButtonPlay.setEnabled(acceptableInput);
|
||||||
|
|
||||||
|
if (m_lineEditPoints)
|
||||||
|
{
|
||||||
if (!acceptableInput)
|
if (!acceptableInput)
|
||||||
m_lineEditPoints.clear();
|
m_lineEditPoints->clear();
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Compute the points of the word
|
// Compute the points of the word
|
||||||
|
@ -145,9 +147,10 @@ void PlayWordMediator::updatePointsAndState()
|
||||||
const wstring &coords = wfq(m_lineEditCoord.text());
|
const wstring &coords = wfq(m_lineEditCoord.text());
|
||||||
int points = m_game->computePoints(word, coords);
|
int points = m_game->computePoints(word, coords);
|
||||||
if (points >= 0)
|
if (points >= 0)
|
||||||
m_lineEditPoints.setText(QString("%1").arg(points));
|
m_lineEditPoints->setText(QString("%1").arg(points));
|
||||||
else
|
else
|
||||||
m_lineEditPoints.setText("#");
|
m_lineEditPoints->setText("#");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -57,7 +57,7 @@ class PlayWordMediator: public QObject
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PlayWordMediator(QObject *parent, QLineEdit &iEditWord,
|
PlayWordMediator(QObject *parent, QLineEdit &iEditWord,
|
||||||
QLineEdit &iEditCoord, QLineEdit &iEditPoints,
|
QLineEdit &iEditCoord, QLineEdit *iEditPoints,
|
||||||
QPushButton &iButtonPlay,
|
QPushButton &iButtonPlay,
|
||||||
PlayModel &iPlayModel, PublicGame *iGame);
|
PlayModel &iPlayModel, PublicGame *iGame);
|
||||||
|
|
||||||
|
@ -99,7 +99,7 @@ private:
|
||||||
PublicGame *m_game;
|
PublicGame *m_game;
|
||||||
QLineEdit &m_lineEditPlay;
|
QLineEdit &m_lineEditPlay;
|
||||||
QLineEdit &m_lineEditCoord;
|
QLineEdit &m_lineEditCoord;
|
||||||
QLineEdit &m_lineEditPoints;
|
QLineEdit *m_lineEditPoints;
|
||||||
QPushButton &m_pushButtonPlay;
|
QPushButton &m_pushButtonPlay;
|
||||||
PlayModel &m_playModel;
|
PlayModel &m_playModel;
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,7 @@ PlayerWidget::PlayerWidget(QWidget *parent, PlayModel &iPlayModel,
|
||||||
|
|
||||||
// Use the mediator
|
// Use the mediator
|
||||||
m_mediator = new PlayWordMediator(this, *lineEditPlay, *lineEditCoords,
|
m_mediator = new PlayWordMediator(this, *lineEditPlay, *lineEditCoords,
|
||||||
*lineEditPoints, *pushButtonPlay,
|
lineEditPoints, *pushButtonPlay,
|
||||||
iPlayModel, iGame);
|
iPlayModel, iGame);
|
||||||
QObject::connect(m_mediator, SIGNAL(gameUpdated()),
|
QObject::connect(m_mediator, SIGNAL(gameUpdated()),
|
||||||
this, SIGNAL(gameUpdated()));
|
this, SIGNAL(gameUpdated()));
|
||||||
|
|
|
@ -82,7 +82,7 @@ ToppingWidget::ToppingWidget(QWidget *parent, PlayModel &iPlayModel,
|
||||||
|
|
||||||
// Use the mediator
|
// Use the mediator
|
||||||
m_mediator = new PlayWordMediator(this, *lineEditPlay, *lineEditCoords,
|
m_mediator = new PlayWordMediator(this, *lineEditPlay, *lineEditCoords,
|
||||||
*lineEditPoints, *pushButtonPlay,
|
NULL, *pushButtonPlay,
|
||||||
iPlayModel, m_game);
|
iPlayModel, m_game);
|
||||||
QObject::connect(m_mediator, SIGNAL(gameUpdated()),
|
QObject::connect(m_mediator, SIGNAL(gameUpdated()),
|
||||||
this, SIGNAL(gameUpdated()));
|
this, SIGNAL(gameUpdated()));
|
||||||
|
|
|
@ -57,7 +57,7 @@ TrainingWidget::TrainingWidget(QWidget *parent, PlayModel &iPlayModel, PublicGam
|
||||||
|
|
||||||
// Use the mediator
|
// Use the mediator
|
||||||
m_mediator = new PlayWordMediator(this, *lineEditPlay, *lineEditCoords,
|
m_mediator = new PlayWordMediator(this, *lineEditPlay, *lineEditCoords,
|
||||||
*lineEditPoints, *pushButtonPlay,
|
lineEditPoints, *pushButtonPlay,
|
||||||
iPlayModel, m_game);
|
iPlayModel, m_game);
|
||||||
QObject::connect(m_mediator, SIGNAL(gameUpdated()),
|
QObject::connect(m_mediator, SIGNAL(gameUpdated()),
|
||||||
this, SIGNAL(gameUpdated()));
|
this, SIGNAL(gameUpdated()));
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>642</width>
|
<width>632</width>
|
||||||
<height>151</height>
|
<height>134</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
|
@ -19,9 +19,6 @@
|
||||||
<height>16777215</height>
|
<height>16777215</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<widget class="QWidget" name="layoutWidget">
|
<widget class="QWidget" name="layoutWidget">
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
|
@ -52,25 +49,6 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</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">
|
<item row="2" column="4">
|
||||||
<widget class="QPushButton" name="pushButtonGetHints">
|
<widget class="QPushButton" name="pushButtonGetHints">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
|
Loading…
Reference in a new issue