mirror of
git://git.savannah.nongnu.org/eliot.git
synced 2025-01-30 20:34:27 +01:00
In free game mode, the "Change" button cannot be used anymore to pass without changing any letter.
This should be more intuitive.
This commit is contained in:
parent
6f4c575eb6
commit
bbb0ee4510
3 changed files with 23 additions and 4 deletions
|
@ -140,19 +140,33 @@ void PlayerWidget::on_lineEditChange_textChanged()
|
||||||
{
|
{
|
||||||
pushButtonChange->setEnabled(lineEditChange->hasAcceptableInput() &&
|
pushButtonChange->setEnabled(lineEditChange->hasAcceptableInput() &&
|
||||||
lineEditChange->text() != "");
|
lineEditChange->text() != "");
|
||||||
pushButtonPass->setEnabled(lineEditChange->text() == "");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PlayerWidget::on_lineEditChange_returnPressed()
|
void PlayerWidget::on_lineEditChange_returnPressed()
|
||||||
{
|
{
|
||||||
ASSERT(m_game->getMode() == PublicGame::kFREEGAME,
|
ASSERT(m_game->getMode() == PublicGame::kFREEGAME,
|
||||||
"Trying to pass or change letters while not in free game mode");
|
"Trying to change letters while not in free game mode");
|
||||||
|
|
||||||
QString inputLetters = lineEditChange->text();
|
pass(lineEditChange->text());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void PlayerWidget::on_pushButtonPass_clicked()
|
||||||
|
{
|
||||||
|
ASSERT(m_game->getMode() == PublicGame::kFREEGAME,
|
||||||
|
"Trying to pass while not in free game mode");
|
||||||
|
|
||||||
|
pass("");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void PlayerWidget::pass(QString inputLetters)
|
||||||
|
{
|
||||||
// Convert the input string into an internal one
|
// Convert the input string into an internal one
|
||||||
const wstring &letters =
|
const wstring &letters =
|
||||||
m_game->getDic().convertFromInput(qtw(inputLetters));
|
m_game->getDic().convertFromInput(qtw(inputLetters));
|
||||||
|
|
||||||
// Pass the turn (and possibly change letters)
|
// Pass the turn (and possibly change letters)
|
||||||
int res = m_game->freeGamePass(letters);
|
int res = m_game->freeGamePass(letters);
|
||||||
if (res == 0)
|
if (res == 0)
|
||||||
|
|
|
@ -56,11 +56,13 @@ protected:
|
||||||
private slots:
|
private slots:
|
||||||
void on_pushButtonShuffle_clicked();
|
void on_pushButtonShuffle_clicked();
|
||||||
void on_pushButtonChange_clicked() { on_lineEditChange_returnPressed(); }
|
void on_pushButtonChange_clicked() { on_lineEditChange_returnPressed(); }
|
||||||
void on_pushButtonPass_clicked() { on_lineEditChange_returnPressed(); }
|
void on_pushButtonPass_clicked();
|
||||||
void on_lineEditChange_textChanged();
|
void on_lineEditChange_textChanged();
|
||||||
void on_lineEditChange_returnPressed();
|
void on_lineEditChange_returnPressed();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void pass(QString inputLetters);
|
||||||
|
|
||||||
/// Encapsulated game, can be NULL
|
/// Encapsulated game, can be NULL
|
||||||
PublicGame *m_game;
|
PublicGame *m_game;
|
||||||
|
|
||||||
|
|
|
@ -48,6 +48,9 @@
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="2" colspan="2">
|
<item row="2" column="2" colspan="2">
|
||||||
<widget class="QPushButton" name="pushButtonChange">
|
<widget class="QPushButton" name="pushButtonChange">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>_("Change")</string>
|
<string>_("Change")</string>
|
||||||
</property>
|
</property>
|
||||||
|
|
Loading…
Add table
Reference in a new issue