mirror of
git://git.savannah.nongnu.org/eliot.git
synced 2024-12-25 21:59:30 +01:00
Topping:: allow shuffling the rack
This commit is contained in:
parent
59b739d292
commit
cedb320f91
2 changed files with 13 additions and 1 deletions
|
@ -32,6 +32,7 @@
|
|||
#include "dic.h"
|
||||
#include "move.h"
|
||||
#include "pldrack.h"
|
||||
#include "player.h"
|
||||
#include "public_game.h"
|
||||
#include "game_exception.h"
|
||||
#include "debug.h"
|
||||
|
@ -64,6 +65,9 @@ ToppingWidget::ToppingWidget(QWidget *parent, PlayModel &iPlayModel, PublicGame
|
|||
QObject::connect(m_mediator, SIGNAL(notifyProblem(QString)),
|
||||
this, SIGNAL(notifyProblem(QString)));
|
||||
|
||||
QObject::connect(pushButtonShuffle, SIGNAL(clicked()),
|
||||
this, SLOT(shuffle()));
|
||||
|
||||
// Associate the model to the view.
|
||||
// We use a proxy for easy sorting.
|
||||
m_model = new QStandardItemModel(this);
|
||||
|
@ -113,7 +117,7 @@ void ToppingWidget::refresh()
|
|||
}
|
||||
else
|
||||
{
|
||||
wstring rack = m_game->getCurrentRack().toString(PlayedRack::RACK_SIMPLE);
|
||||
wstring rack = m_game->getCurrentPlayer().getCurrentRack().toString(PlayedRack::RACK_SIMPLE);
|
||||
// Update the rack only if it is needed, to avoid losing cursor position
|
||||
if (qfw(rack) != lineEditRack->text())
|
||||
lineEditRack->setText(qfw(rack));
|
||||
|
@ -172,6 +176,13 @@ void ToppingWidget::lockSizesChanged(bool checked)
|
|||
}
|
||||
|
||||
|
||||
void ToppingWidget::shuffle()
|
||||
{
|
||||
m_game->shuffleRack();
|
||||
emit gameUpdated();
|
||||
}
|
||||
|
||||
|
||||
void ToppingWidget::showHintsDialog()
|
||||
{
|
||||
const Move &move = m_game->toppingGetTopMove();
|
||||
|
|
|
@ -57,6 +57,7 @@ protected:
|
|||
|
||||
private slots:
|
||||
void lockSizesChanged(bool checked);
|
||||
void shuffle();
|
||||
void showHintsDialog();
|
||||
void hintUsed(const AbstractHint&);
|
||||
|
||||
|
|
Loading…
Reference in a new issue