From bfb99fed8efd71290f67735d27c7aa6bf4ee88f0 Mon Sep 17 00:00:00 2001
From: Marvin Borner
Date: Sun, 5 Apr 2020 00:53:01 +0200
Subject: Added simple help legend/bar
---
qml/Bit.qml | 2 +-
qml/pages/Game.qml | 7 ++++---
qml/pages/Menu.qml | 21 ++++++++++++++++-----
translations/harbour-binaryfun-de.ts | 6 +++++-
translations/harbour-binaryfun.ts | 4 ++++
5 files changed, 30 insertions(+), 10 deletions(-)
diff --git a/qml/Bit.qml b/qml/Bit.qml
index 6563e73..1b1e4b1 100644
--- a/qml/Bit.qml
+++ b/qml/Bit.qml
@@ -49,7 +49,7 @@ Loader {
}
} else if (index !== bits){
var num = Math.floor(Math.random() * (Math.pow(2, bits) - 1)) + 1;
- this.text = num;
+ this.text = root.help ? (Math.pow(2, bits - index - 1)) : num;
root.matrix[index] = num;
} else {
this.text = "0/1";
diff --git a/qml/pages/Game.qml b/qml/pages/Game.qml
index 3ab037d..fb0f01d 100644
--- a/qml/pages/Game.qml
+++ b/qml/pages/Game.qml
@@ -3,7 +3,9 @@ import Sailfish.Silica 1.0
import ".."
Page {
- property int bits: 0 // gets passed by previous page
+ // Get passed by previous page
+ property int bits: 0
+ property bool help: false
id: page
allowedOrientations: Orientation.Portrait
@@ -21,6 +23,7 @@ Page {
Column {
property int bits: page.bits
+ property bool help: page.help
property var correct: new Array(bits)
property var matrix: new Array(Math.pow(bits + 1, 2))
property var start_time: 0
@@ -90,7 +93,6 @@ Page {
id: info_label
text: "0 / " + root.bits
anchors.horizontalCenter: parent.horizontalCenter
- // anchors.top: grid.bottom
anchors.bottom: page.bottom
}
@@ -98,7 +100,6 @@ Page {
id: timer_label
text: "0s"
anchors.horizontalCenter: parent.horizontalCenter
- // anchors.top: won.bottom
anchors.bottom: page.bottom
}
diff --git a/qml/pages/Menu.qml b/qml/pages/Menu.qml
index 1d93a0f..caf2e00 100644
--- a/qml/pages/Menu.qml
+++ b/qml/pages/Menu.qml
@@ -10,6 +10,8 @@ Page {
contentHeight: column.height
Column {
+ property bool bar: false
+
id: column
width: page.width
height: page.height
@@ -24,38 +26,47 @@ Page {
anchors.verticalCenter: parent.verticalCenter
rowSpacing: Theme.paddingLarge * 2
+ Button {
+ text: qsTr("Help bar") + ": 0"
+ onClicked: {
+ column.bar = this.text.slice(-1) === "0";
+ this.text = column.bar ? qsTr("Help bar") + ": 1" : qsTr("Help bar") + ": 0"
+ }
+ }
+
Button {
text: qsTr("Very easy (2 Bit)")
+ ButtonLayout.newLine: true
onClicked: {
- pageStack.push(Qt.resolvedUrl("Game.qml"), {bits: 2});
+ pageStack.push(Qt.resolvedUrl("Game.qml"), {bits: 2, help: column.bar});
}
}
Button {
text: qsTr("Easy (4 Bit)")
onClicked: {
- pageStack.push(Qt.resolvedUrl("Game.qml"), {bits: 4});
+ pageStack.push(Qt.resolvedUrl("Game.qml"), {bits: 4, help: column.bar});
}
}
Button {
text: qsTr("Medium (6 Bit)")
onClicked: {
- pageStack.push(Qt.resolvedUrl("Game.qml"), {bits: 6});
+ pageStack.push(Qt.resolvedUrl("Game.qml"), {bits: 6, help: column.bar});
}
}
Button {
text: qsTr("Hard (8 Bit)")
onClicked: {
- pageStack.push(Qt.resolvedUrl("Game.qml"), {bits: 8});
+ pageStack.push(Qt.resolvedUrl("Game.qml"), {bits: 8, help: column.bar});
}
}
Button {
text: qsTr("God-like (10 Bit)")
onClicked: {
- pageStack.push(Qt.resolvedUrl("Game.qml"), {bits: 10});
+ pageStack.push(Qt.resolvedUrl("Game.qml"), {bits: 10, help: column.bar});
}
}
}
diff --git a/translations/harbour-binaryfun-de.ts b/translations/harbour-binaryfun-de.ts
index 7b44a02..1b660f8 100644
--- a/translations/harbour-binaryfun-de.ts
+++ b/translations/harbour-binaryfun-de.ts
@@ -54,7 +54,11 @@
God-like (10 Bit)
-
+ Krass (10 Bit)
+
+
+ Help bar
+ Legende
diff --git a/translations/harbour-binaryfun.ts b/translations/harbour-binaryfun.ts
index 141787e..31d14b0 100644
--- a/translations/harbour-binaryfun.ts
+++ b/translations/harbour-binaryfun.ts
@@ -56,5 +56,9 @@
God-like (10 Bit)
+
+ Help bar
+
+
--
cgit v1.2.3