[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [kmines/viranch/qtquick] src/qml: Add popup item for showing won/lost messages
From: Viranch Mehta <viranch.mehta () gmail ! com>
Date: 2013-07-23 21:12:08
Message-ID: E1V1jsO-0004Z9-FS () scm ! kde ! org
[Download RAW message or body]
Git commit f95f0d25456731f3a3e364d02657bfbe2aa618eb by Viranch Mehta.
Committed on 24/04/2013 at 11:01.
Pushed by viranch into branch 'viranch/qtquick'.
Add popup item for showing won/lost messages
M +1 -0 src/qml/logic.js
M +17 -1 src/qml/main.qml
http://commits.kde.org/kmines/f95f0d25456731f3a3e364d02657bfbe2aa618eb
diff --git a/src/qml/logic.js b/src/qml/logic.js
index 3712884..ed2bcc1 100644
--- a/src/qml/logic.js
+++ b/src/qml/logic.js
@@ -1,6 +1,7 @@
var firstClick = true;
function reset() {
+ messagePopup.hide();
field.rows = 0;
field.columns = 0;
field.flaggedMines = 0;
diff --git a/src/qml/main.qml b/src/qml/main.qml
index 4934fb1..8fb0566 100644
--- a/src/qml/main.qml
+++ b/src/qml/main.qml
@@ -27,7 +27,15 @@ Item {
signal gameOver(bool won)
property bool game_over: false
- onGameOver: game_over = true;
+ onGameOver: {
+ game_over = true;
+ if (won) {
+ messagePopup.text = i18n("Congratulations! You have won!");
+ } else {
+ messagePopup.text = i18n("You have lost.");
+ }
+ messagePopup.show();
+ }
property bool useQuestionMarks: true
@@ -64,6 +72,14 @@ Item {
anchors.centerIn: parent
}
+ KgCore.PopupItem {
+ id: messagePopup
+ messageOpacity: 0.9
+ messageTimeout: 4000
+ sharpness: 5
+ anchors.centerIn: parent
+ }
+
function setGamePaused(paused) {
if (paused) {
field.hide();
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic