From 5d7ad548932423d5c523537bf36f21b86fbfeda4 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Heli=20Hyv=C3=A4ttinen?= Date: Fri, 7 Oct 2011 14:30:37 +0300 Subject: [PATCH] Pause button hidden when game paused --- classes/clockswidget.cpp | 2 ++ classes/clockswidget.h | 8 ++++++-- classes/wrappedclockswidget.cpp | 2 ++ classes/wrappedclockswidget.h | 3 +++ qml/ClocksPage.qml | 3 +++ 5 files changed, 16 insertions(+), 2 deletions(-) diff --git a/classes/clockswidget.cpp b/classes/clockswidget.cpp index 61e086e..de46005 100644 --- a/classes/clockswidget.cpp +++ b/classes/clockswidget.cpp @@ -219,6 +219,7 @@ void ClocksWidget::mousePressEvent(QMouseEvent *event) // pauseButton_->setVisible(true); white_->continueTurn(); status_=WhiteTurn; + emit unPaused(); //For Harmattan, to inform QML break; case BlackPause: // Continue play @@ -228,6 +229,7 @@ void ClocksWidget::mousePressEvent(QMouseEvent *event) // pauseButton_->setVisible(true); black_->continueTurn(); status_=BlackTurn; + emit unPaused(); //For Harmattan, to inform QML break; case Stopped: emit ClickedWhenStopped(); diff --git a/classes/clockswidget.h b/classes/clockswidget.h index 1d5015d..06e6372 100644 --- a/classes/clockswidget.h +++ b/classes/clockswidget.h @@ -3,6 +3,7 @@ Chess Clock Copyright (c) Arto Hyvättinen 2010 + Changes for porting to Harmattan(c) Heli Hyvättinen 2011 This file is part of Chess Clock software. @@ -36,8 +37,10 @@ class ChessClock; /*! Widget with two clocks - @author Arto Hyvättinen - @date 2010-08-14 + @author Arto Hyvättinen (& Heli Hyvättinen) + @date 2011-10-07 + + Central widget of Chess Clock. Needed to create new ClocksWidget to @@ -61,6 +64,7 @@ protected: signals: void TurnFinished(TurnInformation* turnInfo); void ClickedWhenStopped(); + void unPaused(); //For Harmattan, to inform QML public slots: /*! Pause game */ diff --git a/classes/wrappedclockswidget.cpp b/classes/wrappedclockswidget.cpp index b2cf229..1d2783e 100644 --- a/classes/wrappedclockswidget.cpp +++ b/classes/wrappedclockswidget.cpp @@ -131,6 +131,8 @@ void WrappedClocksWidget::startGame(TimeControlType timeControl, int whiteInitia pClocksWidget_ = new ClocksWidget(pWhiteClock_, pBlackClock_); + connect(pClocksWidget_,SIGNAL(unPaused()),this,(SIGNAL(unPaused()))); + pClocksWidget_->setAttribute(Qt::WA_NoSystemBackground); setWidget(pClocksWidget_); diff --git a/classes/wrappedclockswidget.h b/classes/wrappedclockswidget.h index b9d03b7..e0956eb 100644 --- a/classes/wrappedclockswidget.h +++ b/classes/wrappedclockswidget.h @@ -43,6 +43,7 @@ public: bool isPlayStarted(); + enum TimeControlType { NormalClock, @@ -55,6 +56,8 @@ public: signals: + void unPaused(); + public slots: /*! Start a new game diff --git a/qml/ClocksPage.qml b/qml/ClocksPage.qml index 739968e..2c2dcb8 100644 --- a/qml/ClocksPage.qml +++ b/qml/ClocksPage.qml @@ -70,10 +70,12 @@ Page ToolIcon { + id: pauseButton iconId: "toolbar-mediacontrol-pause" onClicked: { wrappedClocksWidget.pause() + visible = false } } @@ -88,6 +90,7 @@ Page WrappedClocksWidget { id: wrappedClocksWidget + onUnPaused: pauseButton.visible = true } -- 1.7.9.5