[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [kmines/viranch/qtquick] src/qml: Use popup item for showing paused message
From: Viranch Mehta <viranch.mehta () gmail ! com>
Date: 2013-04-23 19:18:19
Message-ID: 20130423191819.5E403A603F () git ! kde ! org
[Download RAW message or body]
Git commit f5f0da5c5e5658ce488e69a88bbee888f0a16da8 by Viranch Mehta.
Committed on 23/04/2013 at 02:22.
Pushed by viranch into branch 'viranch/qtquick'.
Use popup item for showing paused message
M +4 -0 src/qml/MineField.qml
M +21 -4 src/qml/main.qml
http://commits.kde.org/kmines/f5f0da5c5e5658ce488e69a88bbee888f0a16da8
diff --git a/src/qml/MineField.qml b/src/qml/MineField.qml
index 5092247..6d82870 100644
--- a/src/qml/MineField.qml
+++ b/src/qml/MineField.qml
@@ -131,4 +131,8 @@ Item {
return "";
}
}
+
+ function show() { opacity = 1; }
+
+ function hide() { opacity = 0; }
}
diff --git a/src/qml/main.qml b/src/qml/main.qml
index 707c3ab..4934fb1 100644
--- a/src/qml/main.qml
+++ b/src/qml/main.qml
@@ -16,6 +16,7 @@
*/
import QtQuick 1.1
+import org.kde.games.core 0.1 as KgCore
import "logic.js" as Logic
Item {
@@ -43,10 +44,6 @@ Item {
anchors.fill: parent
}
- function setGamePaused(paused) {
- field.opacity = 1 - paused;
- }
-
MineField {
id: field
anchors.centerIn: parent
@@ -56,4 +53,24 @@ Item {
onFlaggedMinesChanged: canvas.minesCountChanged(flaggedMines, mines);
Behavior on opacity { NumberAnimation { duration: 50 } }
}
+
+ KgCore.PopupItem {
+ id: pausePopup
+ text: i18n("Game is paused.")
+ messageOpacity: 0.9
+ messageTimeout: 0
+ sharpness: 5
+ hideOnMouseClick: false
+ anchors.centerIn: parent
+ }
+
+ function setGamePaused(paused) {
+ if (paused) {
+ field.hide();
+ pausePopup.show();
+ } else {
+ pausePopup.hide();
+ field.show();
+ }
+ }
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic