diff --git a/qt/topping_widget.cpp b/qt/topping_widget.cpp index e53bca1..526ec8e 100644 --- a/qt/topping_widget.cpp +++ b/qt/topping_widget.cpp @@ -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(); diff --git a/qt/topping_widget.h b/qt/topping_widget.h index 1d36e4f..8d92dea 100644 --- a/qt/topping_widget.h +++ b/qt/topping_widget.h @@ -57,6 +57,7 @@ protected: private slots: void lockSizesChanged(bool checked); + void shuffle(); void showHintsDialog(); void hintUsed(const AbstractHint&);