summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrederik Schwarzer <[email protected]>2016-03-20 14:06:37 +0100
committerFrederik Schwarzer <[email protected]>2016-04-08 00:13:13 +0200
commit298b47b45270326371ac641a7988020d3180ae4c (patch)
tree2bbdedacc5ca4d15fe75022d49a172fd23abd961
parent2b4bb226af205de01391c0a2e2f1ae535d17293d (diff)
Hide the hint after the timeout.
-rw-r--r--src/gui/graphicsview/gamescene.cpp7
-rw-r--r--src/gui/graphicsview/gamescene.h3
2 files changed, 10 insertions, 0 deletions
diff --git a/src/gui/graphicsview/gamescene.cpp b/src/gui/graphicsview/gamescene.cpp
index 0800660..6d1a811 100644
--- a/src/gui/graphicsview/gamescene.cpp
+++ b/src/gui/graphicsview/gamescene.cpp
@@ -26,6 +26,7 @@
#include <QPainter>
#include <QGraphicsPixmapItem>
#include <QGraphicsSceneMouseEvent>
+#include <QTimer>
namespace Kigo {
@@ -39,6 +40,7 @@ GameScene::GameScene(Game *game, QObject *parent)
, m_gamePopup()
, m_showLabels(Preferences::showBoardLabels())
, m_showHint(false)
+ , m_hintTimer(new QTimer(this))
, m_showMoveNumbers(Preferences::showMoveNumbers())
, m_showPlacementMarker(true)
, m_showTerritory(false)
@@ -58,6 +60,7 @@ GameScene::GameScene(Game *game, QObject *parent)
connect(m_game, &Game::boardSizeChanged, this, &GameScene::changeBoardSize);
connect(m_game, &Game::currentPlayerChanged, this, &GameScene::hideHint);
connect(ThemeRenderer::self(), &ThemeRenderer::themeChanged, this, &GameScene::themeChanged);
+ connect(m_hintTimer, &QTimer::timeout, this, &GameScene::hideHint);
m_gamePopup.setMessageTimeout(3000);
m_gamePopup.setHideOnMouseClick(true);
@@ -100,6 +103,10 @@ void GameScene::showHint(bool show)
{
m_showHint = show;
updateHintItems();
+
+ if (show == true) {
+ m_hintTimer->start(static_cast<int>(Preferences::hintVisibleTime() * 1000));
+ }
}
void GameScene::showMoveNumbers(bool show)
diff --git a/src/gui/graphicsview/gamescene.h b/src/gui/graphicsview/gamescene.h
index cac9c8d..ee1e258 100644
--- a/src/gui/graphicsview/gamescene.h
+++ b/src/gui/graphicsview/gamescene.h
@@ -25,6 +25,8 @@
#include <QGraphicsScene>
+class QTimer;
+
namespace Kigo {
class Game;
@@ -77,6 +79,7 @@ private:
KGamePopupItem m_gamePopup;
bool m_showLabels; ///< Show board labels or not
bool m_showHint;
+ QTimer *m_hintTimer;
bool m_showMoveNumbers;
bool m_showPlacementMarker;
bool m_showTerritory;