Commit 298b47b4 authored by Frederik Schwarzer's avatar Frederik Schwarzer

Hide the hint after the timeout.

parent 2b4bb226
......@@ -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)
......
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment