From ff4b91459e19831ee087399c8148fbbfb441deb6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olivier=20Teuli=C3=A8re?= Date: Sun, 20 Jan 2013 11:45:46 +0100 Subject: [PATCH] MainWindow: do not show the visual rack until a game is started --- qt/main_window.cpp | 18 ++++++++++-------- qt/main_window.h | 4 ++++ 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/qt/main_window.cpp b/qt/main_window.cpp index 95b971f..2467486 100644 --- a/qt/main_window.cpp +++ b/qt/main_window.cpp @@ -164,17 +164,18 @@ MainWindow::MainWindow(QWidget *iParent) vSplitter->addWidget(boardWidget); #endif - // Rack widget below the board - RackWidget *rackWidget = new RackWidget; - rackWidget->setPlayModel(&m_playModel); - rackWidget->setFrameStyle(QFrame::WinPanel | QFrame::Raised); - QObject::connect(rackWidget, SIGNAL(gameUpdated()), + // Rack widget below the board (hidden until there is a game) + m_rackWidget = new RackWidget; + m_rackWidget->setPlayModel(&m_playModel); + m_rackWidget->setFrameStyle(QFrame::WinPanel | QFrame::Raised); + QObject::connect(m_rackWidget, SIGNAL(gameUpdated()), m_gameSignals, SLOT(notifyGameUpdated())); QObject::connect(m_gameSignals, SIGNAL(gameChanged(const PublicGame*)), - rackWidget, SLOT(setGame(const PublicGame*))); + m_rackWidget, SLOT(setGame(const PublicGame*))); QObject::connect(m_gameSignals, SIGNAL(currPlayerRackChanged(const PlayedRack&)), - rackWidget, SLOT(setRack(const PlayedRack&))); - vSplitter->addWidget(rackWidget); + m_rackWidget, SLOT(setRack(const PlayedRack&))); + m_rackWidget->hide(); + vSplitter->addWidget(m_rackWidget); hlayout->addWidget(vSplitter); m_ui.groupBoxTest->setLayout(hlayout); @@ -425,6 +426,7 @@ void MainWindow::updateForGame(PublicGame *iGame) m_actionGamePrint->setEnabled(true); m_actionGameSaveAs->setEnabled(true); m_actionSettingsDefineTables->setEnabled(iGame->getMode() == PublicGame::kARBITRATION); + m_rackWidget->show(); statusBar()->addWidget(m_lettersLabel); m_lettersLabel->show(); statusBar()->addWidget(m_turnLabel); diff --git a/qt/main_window.h b/qt/main_window.h index 7c4a39b..3ed811e 100644 --- a/qt/main_window.h +++ b/qt/main_window.h @@ -39,6 +39,7 @@ class Board; class History; class PublicGame; class HistoryTabWidget; +class RackWidget; class PlayerTabWidget; class ScoreWidget; class TrainingWidget; @@ -147,6 +148,9 @@ private: /// Widget for the game history HistoryTabWidget *m_historyTabWidget; + /// Widget for the visual rack + RackWidget *m_rackWidget; + /// Widget for the players PlayerTabWidget *m_playersWidget;