Skip to content

Commit

Permalink
Version 1.2 (Button, fr+de translations, bigger font + timer interval…
Browse files Browse the repository at this point in the history
… is 600)
  • Loading branch information
GoAlexander committed May 8, 2016
1 parent c25db3a commit 6200a7e
Show file tree
Hide file tree
Showing 10 changed files with 74 additions and 54 deletions.
2 changes: 1 addition & 1 deletion harbour-chance.desktop
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ Name=Chance.
#
# Remember to comment out the following line, if you do not want to use
# a different app name in German locale (de).
Name[de]=harbour-chance
#Name[de]=harbour-chance

7 changes: 4 additions & 3 deletions harbour-chance.pro
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ OTHER_FILES += qml/harbour-chance.qml \
rpm/harbour-chance.spec \
rpm/harbour-chance.yaml \
translations/*.ts \
harbour-chance.desktop \
images/* \
harbour-chance.desktop
#images/* \
#qml/pages/magic-ball.png

SAILFISHAPP_ICONS = 86x86 108x108 128x128 256x256
Expand All @@ -38,7 +38,8 @@ CONFIG += sailfishapp_i18n
# planning to localize your app, remember to comment out the
# following TRANSLATIONS line. And also do not forget to
# modify the localized app name in the the .desktop file.
TRANSLATIONS += translations/harbour-chance-de.ts
TRANSLATIONS += translations/harbour-chance-de.ts \
translations/harbour-chance-fr.ts

DISTFILES += \
qml/pages/AboutPage.qml \
Expand Down
13 changes: 5 additions & 8 deletions qml/cover/CoverPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,23 @@ CoverBackground {
return Math.ceil(Math.random() *2);
}

/*
function answer() {
function buttonAnswer() {
var answers = ["It is certain.", "It is decidedly so.", "Without a doubt.", "Yes — definitely.", "You may rely on it.",
"As I see it, yes.", "Most likely.", "Outlook good.", "Signs point to yes.", "Yes.",
"Reply hazy, try again.", "Ask again later.", "Better not tell you now.", "Cannot predict now.", "Concentrate and ask again.",
"Don’t count on it.", "My reply is no.", "My sources say no.", "Outlook not so good.", "Very doubtful."];

//return Math.ceil(Math.random() *2);
//return Math.ceil(shakeSensor.random * 1000) % 2;
return answers [Math.ceil(shakeSensor.random * 1000) % 20]; //TODO Is it right? I mean probability is correct?!
return answers [Math.ceil(Math.random() * 20)];
}
*/


Label {
id: label
anchors.centerIn: parent
font.bold: true
text: qsTr("Chance.")
EnterKey.onClicked: makeDecision();
EnterKey.onClicked: answer();
//EnterKey.onClicked: buttonAnswer();
}

CoverActionList {
Expand All @@ -44,7 +41,7 @@ CoverBackground {
label.text = "No!";
}

//label.text = answer();
//label.text = buttonAnswer(); // some answers are out of cover!
}
}
}
Expand Down
1 change: 1 addition & 0 deletions qml/pages/AboutPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ Page {
{
Qt.openUrlExternally("https://github.com/GoAlexander/harbour-chance");
}

}
}

Expand Down
47 changes: 28 additions & 19 deletions qml/pages/FirstPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Page {
id: page
allowedOrientations: Orientation.All

property real flag: 0
function answer() {
var answers = ["It is certain.", "It is decidedly so.", "Without a doubt.", "Yes — definitely.", "You may rely on it.",
"As I see it, yes.", "Most likely.", "Outlook good.", "Signs point to yes.", "Yes.",
Expand All @@ -15,7 +16,16 @@ Page {

//return Math.ceil(Math.random() *2);
//return Math.ceil(shakeSensor.random * 1000) % 2;
return answers [Math.ceil(shakeSensor.random * 1000) % 20]; //TODO Is it right? I mean probability is correct?!
return answers [Math.ceil(shakeSensor.random * 1000) % 20];
}

function buttonAnswer() {
var answers = ["It is certain.", "It is decidedly so.", "Without a doubt.", "Yes — definitely.", "You may rely on it.",
"As I see it, yes.", "Most likely.", "Outlook good.", "Signs point to yes.", "Yes.",
"Reply hazy, try again.", "Ask again later.", "Better not tell you now.", "Cannot predict now.", "Concentrate and ask again.",
"Don’t count on it.", "My reply is no.", "My sources say no.", "Outlook not so good.", "Very doubtful."];

return answers [Math.ceil(Math.random() * 20)];
}

// To enable PullDownMenu, place our content in a SilicaFlickable
Expand Down Expand Up @@ -44,29 +54,35 @@ Page {
title: qsTr("Chance.")
}


Text {
id: output
width: parent.width
horizontalAlignment: Text.Center
color: Theme.secondaryColor
font.bold: true
wrapMode: Text.Wrap
font.pixelSize: Theme.fontSizeExtraLarge
EnterKey.onClicked: answer();
//EnterKey.onClicked: buttonAnswer();
}

Label {

Button {
id: convertButton
text: qsTr("Shake for answer!")
text: qsTr("Go")
anchors.horizontalCenter: parent.horizontalCenter

/*onClicked: {
if (answer() === 1) {
output.text = "Yes!";
} else {
output.text = "No!";
}
}*/
onClicked: {
output.text = buttonAnswer();
}
}

Label {
id: label
text: qsTr("Click or shake!")
anchors.horizontalCenter: parent.horizontalCenter
font.pixelSize: Theme.fontSizeExtraSmall
}
}
}

Expand Down Expand Up @@ -94,18 +110,11 @@ Page {
}
Timer {
id: shakeTimeout
interval: 1200
interval: 600 //1200
repeat: false
onTriggered: {
// console.log("answer", shakeSensor.count, shakeSensor.random);
if (shakeSensor.count >= 2) {
/*
if (answer() === 1) {
output.text = "Yes!";
} else {
output.text = "No!";
}
*/
output.text = answer();
}
shakeSensor.count = 0;
Expand Down
4 changes: 2 additions & 2 deletions rpm/harbour-chance.spec
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ Name: harbour-chance
%{!?qtc_qmake5:%define qtc_qmake5 %qmake5}
%{!?qtc_make:%define qtc_make make}
%{?qtc_builddir:%define _builddir %qtc_builddir}
Summary: Chance helps to make decision (with help of random :))
Version: 1.1
Summary: Chance evolved to magic ball!
Version: 1.2
Release: 1
Group: Qt/Qt
License: LICENSE
Expand Down
4 changes: 2 additions & 2 deletions rpm/harbour-chance.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Name: harbour-chance
Summary: Chance helps to make decision (with help of random :))
Version: 1.1
Summary: Chance evolved to magic ball!
Version: 1.2
Release: 1
# The contents of the Group field should be one of the groups listed here:
# http://gitorious.org/meego-developer-tools/spectacle/blobs/master/data/GROUPS
Expand Down
24 changes: 14 additions & 10 deletions translations/harbour-chance-de.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,45 +5,49 @@
<name>AboutPage</name>
<message>
<source>Chance.</source>
<translation type="unfinished"></translation>
<translation>Chance.</translation>
</message>
<message>
<source>License: GPLv3</source>
<translation type="unfinished"></translation>
<translation>Lizenz: GPLv3</translation>
</message>
<message>
<source>You can find the source code at the:</source>
<translation type="unfinished"></translation>
<translation>Hier können Sie den Quellkode finden:</translation>
</message>
<message>
<source>GitHub</source>
<translation type="unfinished"></translation>
<translation>GitHuB</translation>
</message>
<message>
<source>This program evolved to 8-ball. So, &quot;Chance.&quot; answers you with classical magic ball expressions. ;)</source>
<translation type="unfinished"></translation>
<translation>Dieses Programm hat ins 8-Ball evolutioniert. So, &quot;Chance.&quot; antwortet Sie mit den klassischen magic ball Ausdrücken. ;)</translation>
</message>
</context>
<context>
<name>CoverPage</name>
<message>
<source>Chance.</source>
<translation type="unfinished"></translation>
<translation>Chance.</translation>
</message>
</context>
<context>
<name>FirstPage</name>
<message>
<source>About</source>
<translation type="unfinished"></translation>
<translation>Etwa</translation>
</message>
<message>
<source>Chance.</source>
<translation type="unfinished"></translation>
<translation>Chance.</translation>
</message>
<message>
<source>Shake for answer!</source>
<translation type="unfinished"></translation>
<source>Go</source>
<translation>Gehen</translation>
</message>
<message>
<source>Click or shake!</source>
<translation>Klicken Sie oder schütteln!</translation>
</message>
</context>
</TS>
20 changes: 12 additions & 8 deletions translations/harbour-chance-fr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,22 @@
<source>Chance.</source>
<translation>Chance.</translation>
</message>
<message>
<source>This program answers you yes/no if you can`t make a decision. ;)</source>
<translation>Ce programme vous répond oui/non si vous ne pouvez pas vous décider. ;)</translation>
</message>
<message>
<source>License: GPLv3</source>
<translation>License : GPLv3</translation>
<translation>Licence : GPLv3</translation>
</message>
<message>
<source>You can find the source code at the:</source>
<translation>Vous pouvez récupérer le code source ici : </translation>
<translation>Vous pouvez retrouver le code source sur :</translation>
</message>
<message>
<source>GitHub</source>
<translation>GitHub</translation>
</message>
<message>
<source>This program evolved to 8-ball. So, &quot;Chance.&quot; answers you with classical magic ball expressions. ;)</source>
<translation>Ce programme est inspiré de la 8-ball. Ainsi, &quot;Chance.&quot; vous répond avec les fameuses expressions de la boule magique. ;)</translation>
</message>
</context>
<context>
<name>CoverPage</name>
Expand All @@ -42,8 +42,12 @@
<translation>Chance.</translation>
</message>
<message>
<source>Randomize!</source>
<translation>Au hasard !</translation>
<source>Go</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Click or shake!</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>
6 changes: 5 additions & 1 deletion translations/harbour-chance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,11 @@
<translation type="unfinished"></translation>
</message>
<message>
<source>Shake for answer!</source>
<source>Go</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Click or shake!</source>
<translation type="unfinished"></translation>
</message>
</context>
Expand Down

0 comments on commit 6200a7e

Please sign in to comment.