Pause at swipeout works.
authorHeli Hyvättinen <heli.hyvattinen@kymp.net>
Sat, 27 Aug 2011 19:43:20 +0000 (22:43 +0300)
committerHeli Hyvättinen <heli.hyvattinen@kymp.net>
Sat, 27 Aug 2011 19:43:20 +0000 (22:43 +0300)
chessclockview.cpp
main.cpp
qml/ClocksPage.qml
qml/main.qml

index 7f46774..d76605b 100644 (file)
@@ -14,28 +14,16 @@ bool ChessClockView::event(QEvent *event)
 
     if (event->type() == QEvent::WindowDeactivate)
     {
-        QDeclarativeContext * pContext = new QDeclarativeContext (rootContext());
-        if (pContext)
-        {
-
-//            pContext->setContextProperty("applicationActive", false);
-            qDebug() << "Window deactivated";
-
-//            QDeclarativeEngine * pEngine = engine();
-//            engine()->
-        }
-
         QGraphicsObject *pObject = rootObject();
-        pObject->setProperty("applicationActive",false);
+        if (pObject)
+            pObject->setProperty("applicationActive",false);
     }
 
     else if (event->type() == QEvent::WindowActivate)
     {
-        QDeclarativeContext * pContext = rootContext();
-        if (pContext)
-        {
-            pContext->setContextProperty("clocksPage.applicationActive", true);
-        }
+        QGraphicsObject *pObject = rootObject();
+        if (pObject)
+            pObject->setProperty("applicationActive",true);
     }
 
 
index 353cc34..65889fe 100644 (file)
--- a/main.cpp
+++ b/main.cpp
@@ -34,6 +34,7 @@ Q_DECL_EXPORT int main(int argc, char *argv[])
 
     ChessClockView view;
     view.setSource(QUrl("qrc:/qml/main.qml"));
+
     view.showFullScreen();
     return app.exec();
 }
index 6a2e611..739968e 100644 (file)
@@ -48,7 +48,13 @@ Page
             wrappedClocksWidget.startGame(timeControl,whiteInitialTime,whiteAdditionalTime,whiteTurnsPerAddition,blackInitialTime,blackAdditionalTime,blackTurnsPerAddition)
     }
 
+    property bool appActive: applicationActive
 
+    onAppActiveChanged:
+    {
+        if (appActive == false)
+            wrappedClocksWidget.pause()
+    }
 
     tools: ToolBarLayout
     {
index e8a4ef7..fb7208f 100644 (file)
@@ -29,15 +29,6 @@ PageStackWindow {
 
     property bool applicationActive: true //This is supposed to be set from C++
 
-    property bool appActive: applicationActive
-
-    onAppActiveChanged:
-    {
-        if (appActive == false)
-            wrappedClocksWidget.pause()
-            theme.inverted = false
-    }
-
 
     Component.onCompleted: theme.inverted = true