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

Commit 15e08d6

Browse files
committed
Heavy renaming and 0-check fix
1 parent 81cc34b commit 15e08d6

20 files changed

+52
-878
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.user

BinaryFun.pro.user

Lines changed: 0 additions & 799 deletions
This file was deleted.

BinaryFun.desktop renamed to harbour-binaryfun.desktop

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
[Desktop Entry]
22
Type=Application
33
X-Nemo-Application-Type=silica-qt5
4-
Icon=BinaryFun
5-
Exec=BinaryFun
4+
Icon=harbour-binaryfun
5+
Exec=harbour-binaryfun
66
Name=Binary Fun
77
# translation example:
88
# your app name in German locale (de)

BinaryFun.pro renamed to harbour-binaryfun.pro

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,23 @@
1010
# - translation filenames have to be changed
1111

1212
# The name of your application
13-
TARGET = BinaryFun
13+
TARGET = harbour-binaryfun
1414

1515
CONFIG += sailfishapp
1616

17-
SOURCES += src/BinaryFun.cpp
17+
SOURCES += src/harbour-binaryfun.cpp
1818

19-
DISTFILES += qml/BinaryFun.qml \
19+
DISTFILES += qml/harbour-binaryfun.qml \
2020
qml/Bit.qml \
2121
qml/cover/CoverPage.qml \
2222
qml/pages/Game.qml \
2323
qml/pages/Menu.qml \
24-
rpm/BinaryFun.changes.in \
25-
rpm/BinaryFun.changes.run.in \
26-
rpm/BinaryFun.spec \
27-
rpm/BinaryFun.yaml \
24+
rpm/harbour-binaryfun.changes.in \
25+
rpm/harbour-binaryfun.changes.run.in \
26+
rpm/harbour-binaryfun.spec \
27+
rpm/harbour-binaryfun.yaml \
2828
translations/*.ts \
29-
BinaryFun.desktop \
29+
harbour-binaryfun.desktop \
3030
qml/pages/LeaderBoard.qml
3131

3232
SAILFISHAPP_ICONS = 86x86 108x108 128x128 172x172
@@ -39,4 +39,4 @@ CONFIG += sailfishapp_i18n
3939
# planning to localize your app, remember to comment out the
4040
# following TRANSLATIONS line. And also do not forget to
4141
# modify the localized app name in the the .desktop file.
42-
TRANSLATIONS += translations/BinaryFun-de.ts
42+
TRANSLATIONS += translations/harbour-binaryfun-de.ts
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

qml/Bit.qml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,16 @@ Loader {
3737
var indices = root.matrix.slice(0, bits);
3838
var transformed = [];
3939
indices.forEach(function(elem) {
40-
transformed.unshift((pad((parseInt(elem) >>> 0).toString(2), bits))[grid.row - 1]);
40+
transformed.push((pad((parseInt(elem) >>> 0).toString(2), bits))[grid.row - 1]);
4141
});
4242

4343
var transformed_num = parseInt(transformed.join(""), 2);
4444
this.text = transformed_num;
4545
root.matrix[index] = transformed_num;
46+
if (transformed_num === 0) { // A rather dumb fix.
47+
root.check(index - 1);
48+
root.check(index - 1);
49+
}
4650
} else if (index !== bits){
4751
var num = Math.floor(Math.random() * (Math.pow(2, bits) - 1)) + 1;
4852
this.text = num;
File renamed without changes.

qml/pages/Game.qml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Page {
66
property int bits: 0 // gets passed by previous page
77

88
id: page
9-
allowedOrientations: Orientation.All
9+
allowedOrientations: Orientation.Portrait
1010

1111
SilicaFlickable {
1212
anchors.fill: parent
@@ -47,22 +47,24 @@ Page {
4747
var near = nearest(index);
4848
var current_score = parseInt(info_label.text.substr(0, info_label.text.indexOf('/')))
4949

50-
if (Number(root.matrix.slice(near, near + bits).join("")).toString() === (root.matrix[near + bits] >>> 0).toString(2)) {
50+
if (Number(root.matrix.slice(near, near + bits).join("")).toString() === (root.matrix[near + bits] >>> 0).toString(2) && timer.running) {
5151
correct[near / (bits + 1) - 1] = 1;
5252
info_label.text = current_score + 1 + " / " + root.bits;
5353
} else {
54-
if (correct[near / (bits + 1) - 1] === 1) {
54+
if (correct[near / (bits + 1) - 1] === 1 && timer.running) {
5555
info_label.text = current_score - 1 + " / " + root.bits;
5656
}
5757

5858
correct[near / (bits + 1) - 1] = 0;
5959
}
6060

6161
if (correct.filter(function(i) { return i === 1 }).length === bits) {
62-
info_label.text = "Yeeehaaw!";
63-
timer_label.text = ((new Date().getTime() - start_time) / 1000) + "s - Not bad!"
64-
timer.running = false;
65-
new_game.visible = true;
62+
if (timer.running) { // aka still playing
63+
info_label.text = "Yeeehaaw!";
64+
timer_label.text = ((new Date().getTime() - start_time) / 1000) + "s - " + qsTr("Not bad!");
65+
timer.running = false;
66+
new_game.visible = true;
67+
}
6668
}
6769
}
6870

qml/pages/LeaderBoard.qml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import Sailfish.Silica 1.0
33

44
Page {
55
id: page
6-
allowedOrientations: Orientation.All
6+
allowedOrientations: Orientation.Portrait
77

88
SilicaFlickable {
99
anchors.fill: parent

qml/pages/Menu.qml

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

44
Page {
55
id: page
6-
allowedOrientations: Orientation.All
6+
allowedOrientations: Orientation.Portrait
77

88
SilicaFlickable {
99
anchors.fill: parent
@@ -53,7 +53,7 @@ Page {
5353
}
5454

5555
Button {
56-
text: qsTr("Godlike (10 Bit)")
56+
text: qsTr("God-like (10 Bit)")
5757
onClicked: {
5858
pageStack.push(Qt.resolvedUrl("Game.qml"), {bits: 10});
5959
}

rpm/BinaryFun.changes.in

Lines changed: 0 additions & 17 deletions
This file was deleted.

rpm/BinaryFun.changes.run.in

Lines changed: 0 additions & 25 deletions
This file was deleted.

rpm/BinaryFun.spec renamed to rpm/harbour-binaryfun.spec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# Generated by: spectacle version 0.27
44
#
55

6-
Name: BinaryFun
6+
Name: harbour-binaryfun
77

88
# >> macros
99
# << macros
@@ -19,7 +19,7 @@ Group: Qt/Qt
1919
License: LICENSE
2020
URL: http://example.org/
2121
Source0: %{name}-%{version}.tar.bz2
22-
Source100: BinaryFun.yaml
22+
Source100: harbour-binaryfun.yaml
2323
Requires: sailfishsilica-qt5 >= 0.10.9
2424
BuildRequires: pkgconfig(sailfishapp) >= 1.0.2
2525
BuildRequires: pkgconfig(Qt5Core)

rpm/BinaryFun.yaml renamed to rpm/harbour-binaryfun.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Name: BinaryFun
1+
Name: harbour-binaryfun
22
Summary: An awesome binary game
33
Version: 0.1.1
44
Release: 1

src/BinaryFun.cpp renamed to src/harbour-binaryfun.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
int main(int argc, char *argv[])
88
{
9-
// SailfishApp::main() will display "qml/BinaryFun.qml", if you need more
9+
// SailfishApp::main() will display "qml/harbour-binaryfun.qml", if you need more
1010
// control over initialization, you can use:
1111
//
1212
// - SailfishApp::application(int, char *[]) to get the QGuiApplication *

translations/BinaryFun-de.ts renamed to translations/harbour-binaryfun-de.ts

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,51 +5,55 @@
55
<name>CoverPage</name>
66
<message>
77
<source>Binary Fun</source>
8-
<translation type="unfinished">Binary Fun</translation>
8+
<translation type="unfinished">Binär-Spaß</translation>
99
</message>
1010
</context>
1111
<context>
1212
<name>Game</name>
1313
<message>
1414
<source>Binary Fun</source>
15-
<translation type="unfinished">Binary Fun</translation>
15+
<translation>Binär-Spaß</translation>
1616
</message>
1717
<message>
1818
<source>Play again!</source>
19-
<translation type="unfinished"></translation>
19+
<translation>Nochmal!</translation>
20+
</message>
21+
<message>
22+
<source>Not bad!</source>
23+
<translation>Nicht schlecht!</translation>
2024
</message>
2125
</context>
2226
<context>
2327
<name>LeaderBoard</name>
2428
<message>
2529
<source>Under Construction!</source>
26-
<translation type="unfinished"></translation>
30+
<translation>Im Aufbau!</translation>
2731
</message>
2832
</context>
2933
<context>
3034
<name>Menu</name>
3135
<message>
3236
<source>Binary Fun</source>
33-
<translation type="unfinished">Binary Fun</translation>
37+
<translation>Binär-Spaß</translation>
3438
</message>
3539
<message>
3640
<source>Easy (4 Bit)</source>
37-
<translation type="unfinished"></translation>
41+
<translation>Einfach (4 Bit)</translation>
3842
</message>
3943
<message>
4044
<source>Medium (6 Bit)</source>
41-
<translation type="unfinished"></translation>
45+
<translation>Mittel (6 Bit)</translation>
4246
</message>
4347
<message>
4448
<source>Hard (8 Bit)</source>
45-
<translation type="unfinished"></translation>
49+
<translation>Schwer (8 Bit)</translation>
4650
</message>
4751
<message>
4852
<source>Very easy (2 Bit)</source>
49-
<translation type="unfinished"></translation>
53+
<translation>Sehr einfach (2 Bit)</translation>
5054
</message>
5155
<message>
52-
<source>Godlike (10 Bit)</source>
56+
<source>God-like (10 Bit)</source>
5357
<translation type="unfinished"></translation>
5458
</message>
5559
</context>

translations/BinaryFun.ts renamed to translations/harbour-binaryfun.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@
1818
<source>Play again!</source>
1919
<translation type="unfinished"></translation>
2020
</message>
21+
<message>
22+
<source>Not bad!</source>
23+
<translation type="unfinished"></translation>
24+
</message>
2125
</context>
2226
<context>
2327
<name>LeaderBoard</name>
@@ -49,7 +53,7 @@
4953
<translation type="unfinished"></translation>
5054
</message>
5155
<message>
52-
<source>Godlike (10 Bit)</source>
56+
<source>God-like (10 Bit)</source>
5357
<translation type="unfinished"></translation>
5458
</message>
5559
</context>

0 commit comments

Comments
 (0)