Skip to content
This repository was archived by the owner on May 24, 2023. It is now read-only.

Commit bfb99fe

Browse files
committed
Added simple help legend/bar
1 parent f6a21a0 commit bfb99fe

5 files changed

Lines changed: 30 additions & 10 deletions

File tree

qml/Bit.qml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ Loader {
4949
}
5050
} else if (index !== bits){
5151
var num = Math.floor(Math.random() * (Math.pow(2, bits) - 1)) + 1;
52-
this.text = num;
52+
this.text = root.help ? (Math.pow(2, bits - index - 1)) : num;
5353
root.matrix[index] = num;
5454
} else {
5555
this.text = "0/1";

qml/pages/Game.qml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ import Sailfish.Silica 1.0
33
import ".."
44

55
Page {
6-
property int bits: 0 // gets passed by previous page
6+
// Get passed by previous page
7+
property int bits: 0
8+
property bool help: false
79

810
id: page
911
allowedOrientations: Orientation.Portrait
@@ -21,6 +23,7 @@ Page {
2123

2224
Column {
2325
property int bits: page.bits
26+
property bool help: page.help
2427
property var correct: new Array(bits)
2528
property var matrix: new Array(Math.pow(bits + 1, 2))
2629
property var start_time: 0
@@ -90,15 +93,13 @@ Page {
9093
id: info_label
9194
text: "0 / " + root.bits
9295
anchors.horizontalCenter: parent.horizontalCenter
93-
// anchors.top: grid.bottom
9496
anchors.bottom: page.bottom
9597
}
9698

9799
Label {
98100
id: timer_label
99101
text: "0s"
100102
anchors.horizontalCenter: parent.horizontalCenter
101-
// anchors.top: won.bottom
102103
anchors.bottom: page.bottom
103104
}
104105

qml/pages/Menu.qml

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ Page {
1010
contentHeight: column.height
1111

1212
Column {
13+
property bool bar: false
14+
1315
id: column
1416
width: page.width
1517
height: page.height
@@ -24,38 +26,47 @@ Page {
2426
anchors.verticalCenter: parent.verticalCenter
2527
rowSpacing: Theme.paddingLarge * 2
2628

29+
Button {
30+
text: qsTr("Help bar") + ": 0"
31+
onClicked: {
32+
column.bar = this.text.slice(-1) === "0";
33+
this.text = column.bar ? qsTr("Help bar") + ": 1" : qsTr("Help bar") + ": 0"
34+
}
35+
}
36+
2737
Button {
2838
text: qsTr("Very easy (2 Bit)")
39+
ButtonLayout.newLine: true
2940
onClicked: {
30-
pageStack.push(Qt.resolvedUrl("Game.qml"), {bits: 2});
41+
pageStack.push(Qt.resolvedUrl("Game.qml"), {bits: 2, help: column.bar});
3142
}
3243
}
3344

3445
Button {
3546
text: qsTr("Easy (4 Bit)")
3647
onClicked: {
37-
pageStack.push(Qt.resolvedUrl("Game.qml"), {bits: 4});
48+
pageStack.push(Qt.resolvedUrl("Game.qml"), {bits: 4, help: column.bar});
3849
}
3950
}
4051

4152
Button {
4253
text: qsTr("Medium (6 Bit)")
4354
onClicked: {
44-
pageStack.push(Qt.resolvedUrl("Game.qml"), {bits: 6});
55+
pageStack.push(Qt.resolvedUrl("Game.qml"), {bits: 6, help: column.bar});
4556
}
4657
}
4758

4859
Button {
4960
text: qsTr("Hard (8 Bit)")
5061
onClicked: {
51-
pageStack.push(Qt.resolvedUrl("Game.qml"), {bits: 8});
62+
pageStack.push(Qt.resolvedUrl("Game.qml"), {bits: 8, help: column.bar});
5263
}
5364
}
5465

5566
Button {
5667
text: qsTr("God-like (10 Bit)")
5768
onClicked: {
58-
pageStack.push(Qt.resolvedUrl("Game.qml"), {bits: 10});
69+
pageStack.push(Qt.resolvedUrl("Game.qml"), {bits: 10, help: column.bar});
5970
}
6071
}
6172
}

translations/harbour-binaryfun-de.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,11 @@
5454
</message>
5555
<message>
5656
<source>God-like (10 Bit)</source>
57-
<translation type="unfinished"></translation>
57+
<translation>Krass (10 Bit)</translation>
58+
</message>
59+
<message>
60+
<source>Help bar</source>
61+
<translation>Legende</translation>
5862
</message>
5963
</context>
6064
</TS>

translations/harbour-binaryfun.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,5 +56,9 @@
5656
<source>God-like (10 Bit)</source>
5757
<translation type="unfinished"></translation>
5858
</message>
59+
<message>
60+
<source>Help bar</source>
61+
<translation type="unfinished"></translation>
62+
</message>
5963
</context>
6064
</TS>

0 commit comments

Comments
 (0)