Merge lp:~nik90/sudoku-app/uc1.3-migrate into lp:sudoku-app

Proposed by Nekhelesh Ramananthan
Status: Merged
Approved by: Dinko Osmankovic
Approved revision: 429
Merged at revision: 414
Proposed branch: lp:~nik90/sudoku-app/uc1.3-migrate
Merge into: lp:sudoku-app
Diff against target: 2322 lines (+787/-922)
24 files modified
click/manifest.json.in (+2/-2)
components/AboutTab.qml (+25/-19)
components/AddProfileDialog.qml (+3/-3)
components/BigBlock.qml (+3/-3)
components/BottomEdge.qml (+1/-1)
components/BottomEdgeSlide.qml (+1/-1)
components/ColorSchemeDefault.qml (+2/-2)
components/ColorSchemeSimple.qml (+2/-5)
components/ColorSchemeUbuntu.qml (+3/-7)
components/DialogButton.qml (+3/-3)
components/HighscoresTab.qml (+107/-113)
components/ManageProfileDialog.qml (+3/-3)
components/NewGameSelectionButton.qml (+3/-3)
components/RadialAction.qml (+1/-1)
components/SettingsTab.qml (+359/-0)
components/SingleValueListItem.qml (+22/-0)
components/SudokuBlocksGrid.qml (+3/-7)
components/SudokuButton.qml (+2/-2)
components/SudokuButtonsGrid.qml (+4/-4)
components/SudokuDialogButton.qml (+2/-2)
components/TabsList.qml (+36/-0)
debian/changelog (+9/-0)
po/com.ubuntu.sudoku.pot (+131/-171)
sudoku-app.qml (+60/-570)
To merge this branch: bzr merge lp:~nik90/sudoku-app/uc1.3-migrate
Reviewer Review Type Date Requested Status
Jenkins Bot continuous-integration Approve
Dinko Osmankovic continuous-integration Approve
Review via email: mp+287387@code.launchpad.net

Commit message

This MP does the following,
- Migrates to Ubuntu.Components 1.3 (including Popups 1.3)
- Updated framework to 15.04.3-qml
- Updated QtQuick import to 2.4
- Migrated to PageHeaders & ListItemLayouts
- Incremented app version to 1.6
- Moved SettingsTab.qml to its own file
- Removed unnecessary comments
- Removed deprecated unity hud imports
- Removed unused actions declared in suduko-app.qml

Description of the change

This MP does the following,
- Migrates to Ubuntu.Components 1.3 (including Popups 1.3)
- Updated framework to 15.04.3-qml
- Updated QtQuick import to 2.4
- Migrated to PageHeaders & ListItemLayouts
- Incremented app version to 1.6
- Moved SettingsTab.qml to its own file
- Removed unnecessary comments
- Removed deprecated unity hud imports
- Removed unused actions declared in suduko-app.qml

@Sudoku devs, with the upcoming UITK Silo for OTA-10, Sudoku is broken badly and needs to migrate to Ubuntu.Components 1.3 asap. This MP does that along with other much needed improvements.

To post a comment you must log in.
lp:~nik90/sudoku-app/uc1.3-migrate updated
429. By Nekhelesh Ramananthan

Updated debian changelog

Revision history for this message
Dinko Osmankovic (dinko-metalac) wrote :

Thanks nik90.

review: Approve (continuous-integration)
Revision history for this message
Jenkins Bot (ubuntu-core-apps-jenkins-bot) :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'click/manifest.json.in'
--- click/manifest.json.in 2015-07-15 16:14:23 +0000
+++ click/manifest.json.in 2016-02-28 17:36:02 +0000
@@ -1,7 +1,7 @@
1{1{
2 "architecture": "all",2 "architecture": "all",
3 "description": "Sudoku game for Ubuntu devices.",3 "description": "Sudoku game for Ubuntu devices.",
4 "framework": "ubuntu-sdk-15.04",4 "framework": "ubuntu-sdk-15.04.3-qml",
5 "hooks": {5 "hooks": {
6 "sudoku": {6 "sudoku": {
7 "apparmor": "sudoku.apparmor",7 "apparmor": "sudoku.apparmor",
@@ -12,7 +12,7 @@
12 "maintainer": "Ubuntu Core Apps Developers <ubuntu-touch-coreapps@lists.launchpad.net>",12 "maintainer": "Ubuntu Core Apps Developers <ubuntu-touch-coreapps@lists.launchpad.net>",
13 "name": "@PROJECT_NAME@",13 "name": "@PROJECT_NAME@",
14 "title": "Sudoku",14 "title": "Sudoku",
15 "version": "1.1.@BZR_REVNO@",15 "version": "1.6.@BZR_REVNO@",
16 "x-source": {16 "x-source": {
17 "vcs-bzr": "@BZR_SOURCE@",17 "vcs-bzr": "@BZR_SOURCE@",
18 "vcs-bzr-revno": "@BZR_REVNO@"18 "vcs-bzr-revno": "@BZR_REVNO@"
1919
=== modified file 'components/AboutTab.qml'
--- components/AboutTab.qml 2015-07-16 11:29:03 +0000
+++ components/AboutTab.qml 2016-02-28 17:36:02 +0000
@@ -1,18 +1,26 @@
1import QtQuick 2.31import QtQuick 2.4
2import Ubuntu.Components 1.12import Ubuntu.Components 1.3
3import Ubuntu.Components.ListItems 1.0 as ListItem
4import QtQuick.LocalStorage 2.03import QtQuick.LocalStorage 2.0
5import Ubuntu.Components.Popups 1.04import Ubuntu.Components.Popups 1.3
6import Ubuntu.Layouts 1.05import Ubuntu.Layouts 1.0
7import "../js/localStorage.js" as Settings6import "../js/localStorage.js" as Settings
8import "../components"7import "../components"
9//import Ubuntu.HUD 1.0 as HUD
10import Ubuntu.Unity.Action 1.1 as UnityActions
11import UserMetrics 0.1
128
13Tab {9Tab {
10 id: aboutTab
14 objectName: "aboutTab"11 objectName: "aboutTab"
12
15 page: Page {13 page: Page {
14 id: aboutPage
15
16 header: PageHeader {
17 title: i18n.tr("About")
18 leadingActionBar {
19 numberOfSlots: 0
20 actions: tabsList.actions
21 }
22 }
23
16 Layouts {24 Layouts {
17 id: aboutTabLayout25 id: aboutTabLayout
18 width: mainView.width26 width: mainView.width
@@ -31,14 +39,15 @@
3139
32 }40 }
33 spacing: units.gu(5)41 spacing: units.gu(5)
42
34 ItemLayout {43 ItemLayout {
35 item: "icon"44 item: "icon"
36 id: iconTabletItem45 id: iconTabletItem
37 property real maxWidth: units.gu(80)46 property real maxWidth: units.gu(80)
38 width: Math.min(parent.width, maxWidth)/247 width: Math.min(parent.width, maxWidth)/2
39 height: Math.min(parent.width, maxWidth)/248 height: Math.min(parent.width, maxWidth)/2
49 }
4050
41 }
42 Column {51 Column {
43 //height: iconTabletItem.height52 //height: iconTabletItem.height
44 spacing: 153 spacing: 1
@@ -65,17 +74,15 @@
65 }74 }
66 }75 }
67 }76 }
68
69
70 ]77 ]
7178
72 Column {79 Column {
73 id: aboutColumn;80 id: aboutColumn;
81
74 spacing: units.gu(3)82 spacing: units.gu(3)
75 //anchors.fill: parent
76 //anchors.horizontalCenter: parent.horizontalCenter;
77 width: parent.width83 width: parent.width
78 y: units.gu(6);84 y: units.gu(6);
85
79 Rectangle {86 Rectangle {
80 Layouts.item: "icon"87 Layouts.item: "icon"
81 property real maxWidth: units.gu(45)88 property real maxWidth: units.gu(45)
@@ -89,15 +96,16 @@
89 smooth: true96 smooth: true
90 anchors.fill: parent97 anchors.fill: parent
91 fillMode: Image.PreserveAspectFit98 fillMode: Image.PreserveAspectFit
92
93 }99 }
94 }100 }
101
95 Grid {102 Grid {
96 anchors.horizontalCenter: parent.horizontalCenter103 anchors.horizontalCenter: parent.horizontalCenter
97 columns: 2104 columns: 2
98 rowSpacing: units.gu(2)105 rowSpacing: units.gu(2)
99 columnSpacing: mainView.width/10106 columnSpacing: mainView.width/10
100 Layouts.item: "info"107 Layouts.item: "info"
108
101 Label {109 Label {
102 objectName: "authorLabel"110 objectName: "authorLabel"
103 text: i18n.tr("Author(s): ")111 text: i18n.tr("Author(s): ")
@@ -117,7 +125,6 @@
117 font.bold: true;125 font.bold: true;
118 text: "dinko.metalac@gmail.com"126 text: "dinko.metalac@gmail.com"
119 }127 }
120
121 }128 }
122129
123 Row {130 Row {
@@ -131,6 +138,7 @@
131 onLinkActivated: Qt.openUrlExternally(link)138 onLinkActivated: Qt.openUrlExternally(link)
132 }139 }
133 }140 }
141
134 Row {142 Row {
135 anchors.horizontalCenter: parent.horizontalCenter;143 anchors.horizontalCenter: parent.horizontalCenter;
136 Layouts.item: "version"144 Layouts.item: "version"
@@ -141,22 +149,20 @@
141 Label {149 Label {
142 objectName: "version"150 objectName: "version"
143 font.bold: true;151 font.bold: true;
144 text: "1.5"152 text: "1.6"
145 }153 }
146 }154 }
155
147 Row {156 Row {
148 Layouts.item: "year"157 Layouts.item: "year"
149 anchors.horizontalCenter: parent.horizontalCenter;158 anchors.horizontalCenter: parent.horizontalCenter;
150 Label {159 Label {
151 objectName: "yearLabel"160 objectName: "yearLabel"
152 font.bold: true;161 font.bold: true;
153 text: "2013"162 text: "2016"
154
155
156 }163 }
157 }164 }
158 }165 }
159
160 }166 }
161 }167 }
162}168}
163169
=== modified file 'components/AddProfileDialog.qml'
--- components/AddProfileDialog.qml 2014-10-06 12:41:09 +0000
+++ components/AddProfileDialog.qml 2016-02-28 17:36:02 +0000
@@ -1,6 +1,6 @@
1import QtQuick 2.31import QtQuick 2.4
2import Ubuntu.Components 1.12import Ubuntu.Components 1.3
3import Ubuntu.Components.Popups 1.03import Ubuntu.Components.Popups 1.3
4import "../js/localStorage.js" as Settings4import "../js/localStorage.js" as Settings
5import QtQuick.LocalStorage 2.05import QtQuick.LocalStorage 2.0
66
77
=== modified file 'components/BigBlock.qml'
--- components/BigBlock.qml 2015-07-16 11:29:03 +0000
+++ components/BigBlock.qml 2016-02-28 17:36:02 +0000
@@ -1,6 +1,6 @@
1import QtQuick 2.31import QtQuick 2.4
2import Ubuntu.Components 1.12import Ubuntu.Components 1.3
3import Ubuntu.Components.Popups 1.03import Ubuntu.Components.Popups 1.3
4import "../js/SudokuCU.js" as SudokuCU4import "../js/SudokuCU.js" as SudokuCU
5import QtFeedback 5.05import QtFeedback 5.0
66
77
=== modified file 'components/BottomEdge.qml'
--- components/BottomEdge.qml 2015-07-16 11:29:03 +0000
+++ components/BottomEdge.qml 2016-02-28 17:36:02 +0000
@@ -1,6 +1,6 @@
1import QtQuick 2.21import QtQuick 2.2
2import QtFeedback 5.02import QtFeedback 5.0
3import Ubuntu.Components 1.13import Ubuntu.Components 1.3
44
5Item {5Item {
6 id: bottomEdge6 id: bottomEdge
77
=== modified file 'components/BottomEdgeSlide.qml'
--- components/BottomEdgeSlide.qml 2015-07-16 11:29:03 +0000
+++ components/BottomEdgeSlide.qml 2016-02-28 17:36:02 +0000
@@ -1,6 +1,6 @@
1import QtQuick 2.21import QtQuick 2.2
2import QtFeedback 5.02import QtFeedback 5.0
3import Ubuntu.Components 1.13import Ubuntu.Components 1.3
44
5Item {5Item {
6 id: bottomEdge6 id: bottomEdge
77
=== modified file 'components/ColorSchemeDefault.qml'
--- components/ColorSchemeDefault.qml 2015-02-23 07:44:43 +0000
+++ components/ColorSchemeDefault.qml 2016-02-28 17:36:02 +0000
@@ -1,5 +1,5 @@
1import QtQuick 2.31import QtQuick 2.4
2import Ubuntu.Components 1.12import Ubuntu.Components 1.3
33
4Item {4Item {
55
66
=== modified file 'components/ColorSchemeSimple.qml'
--- components/ColorSchemeSimple.qml 2014-11-08 11:58:23 +0000
+++ components/ColorSchemeSimple.qml 2016-02-28 17:36:02 +0000
@@ -1,5 +1,5 @@
1import QtQuick 2.31import QtQuick 2.4
2import Ubuntu.Components 1.12import Ubuntu.Components 1.3
33
4Item {4Item {
55
@@ -15,8 +15,5 @@
15 property color dialogButtonColor2: "white"15 property color dialogButtonColor2: "white"
16 property color dialogButtonColor3: "white"16 property color dialogButtonColor3: "white"
17 property color dialogButtonTextColor: UbuntuColors.orange17 property color dialogButtonTextColor: UbuntuColors.orange
18 property color headerColor: "#2C001E"
19 property color backgroundColor: "#2C001E"18 property color backgroundColor: "#2C001E"
20 property color footerColor: "#5E2750"
21
22}19}
2320
=== modified file 'components/ColorSchemeUbuntu.qml'
--- components/ColorSchemeUbuntu.qml 2015-02-23 07:44:43 +0000
+++ components/ColorSchemeUbuntu.qml 2016-02-28 17:36:02 +0000
@@ -1,8 +1,7 @@
1import QtQuick 2.31import QtQuick 2.4
2import Ubuntu.Components 1.12import Ubuntu.Components 1.3
33
4Item {4Item {
5
6 property color defaultColor: "transparent" // "#F5F5F5";5 property color defaultColor: "transparent" // "#F5F5F5";
7 property color defaultStartingColor : UbuntuColors.lightAubergine;6 property color defaultStartingColor : UbuntuColors.lightAubergine;
8 property color defaultNotAllowedColor : UbuntuColors.darkAubergine;7 property color defaultNotAllowedColor : UbuntuColors.darkAubergine;
@@ -15,8 +14,5 @@
15 property color dialogButtonColor2: UbuntuColors.orange14 property color dialogButtonColor2: UbuntuColors.orange
16 property color dialogButtonColor3: "black"15 property color dialogButtonColor3: "black"
17 property color dialogButtonTextColor: "white"16 property color dialogButtonTextColor: "white"
18 property color headerColor: "#F5F5F5"17 property color backgroundColor: "#FFFFFF"
19 property color backgroundColor: "#F5F5F5"
20 property color footerColor: "#F5F5F5"
21
22}18}
2319
=== modified file 'components/DialogButton.qml'
--- components/DialogButton.qml 2014-10-06 12:41:09 +0000
+++ components/DialogButton.qml 2016-02-28 17:36:02 +0000
@@ -1,5 +1,5 @@
1import QtQuick 2.31import QtQuick 2.4
2import Ubuntu.Components 1.12import Ubuntu.Components 1.3
33
4UbuntuShape {4UbuntuShape {
5 id: button5 id: button
@@ -14,7 +14,7 @@
14 height: size;14 height: size;
15 width: size;15 width: size;
16 radius: "medium"16 radius: "medium"
17 color: buttonColor17 backgroundColor: buttonColor
18 //border.color: Qt.darker(buttonColor,1.5)18 //border.color: Qt.darker(buttonColor,1.5)
1919
20 Text {20 Text {
2121
=== modified file 'components/HighscoresTab.qml'
--- components/HighscoresTab.qml 2015-07-17 11:48:07 +0000
+++ components/HighscoresTab.qml 2016-02-28 17:36:02 +0000
@@ -1,16 +1,13 @@
1import QtQuick 2.31import QtQuick 2.4
2import Ubuntu.Components 1.22import Ubuntu.Components 1.3
3//import Ubuntu.Components.ListItems 1.0 as ListItem
4import QtQuick.LocalStorage 2.03import QtQuick.LocalStorage 2.0
5import Ubuntu.Components.Popups 1.04import Ubuntu.Components.Popups 1.3
6import Ubuntu.Layouts 1.05import Ubuntu.Layouts 1.0
7import "../js/localStorage.js" as Settings6import "../js/localStorage.js" as Settings
8import "../components"7import "../components"
9//import Ubuntu.HUD 1.0 as HUD
10import Ubuntu.Unity.Action 1.1 as UnityActions
11import UserMetrics 0.1
128
13Page {9Tab {
10 id: highScoresTab
1411
15 function appendModel(item)12 function appendModel(item)
16 {13 {
@@ -27,40 +24,94 @@
27 for (var i = 0; i < highscoresModel.count; i++)24 for (var i = 0; i < highscoresModel.count; i++)
28 {25 {
29 if (highscoresModel.get(i).firstname === firstName &&26 if (highscoresModel.get(i).firstname === firstName &&
30 highscoresModel.get(i).lastname === lastName )27 highscoresModel.get(i).lastname === lastName )
31 highscoresModel.remove(i);28 highscoresModel.remove(i);
32 }29 }
33 }30 }
3431
35 BottomEdge {32 Page {
36 z:233 id: highScoresPage
37 hintIconName: "delete"34
38 actions: [35 header: PageHeader {
39 RadialAction {36 title: i18n.tr("About")
40 iconName: "contact"37 leadingActionBar {
41 iconColor: UbuntuColors.orange38 numberOfSlots: 0
42 onTriggered: {39 actions: tabsList.actions
43 Settings.deleteScoresWithProfileId(currentUserId)
44 highscoresModel.clearModelProfileId(currentUserId);
45 }
46 },
47 RadialAction {
48 iconName: "contact-group"
49 iconColor: UbuntuColors.orange
50 onTriggered: {
51 Settings.deleteAllScores();
52 highscoresModel.clear();
53 }
54 }40 }
55 ]41
56 }42 trailingActionBar.actions: [
5743 Action {
58 head.actions: [44 objectName: "allusersbutton"
59 Action {45 text: "All\nusers"
60 objectName: "allusersbutton"46 iconSource: Qt.resolvedUrl("../icons/all-users.svg")
61 text: "All\nusers"47 onTriggered: {
62 iconSource: Qt.resolvedUrl("../icons/all-users.svg")48 var allScores = Settings.getAllScores()
63 onTriggered: {49 highscoresModel.clear();
50 highscoresHeaderText = i18n.tr("<b>Best scores for all players</b>");
51 for(var i = 0; i < allScores.length; i++) {
52 var rowItem = allScores[i];
53 //print("ROW ",rowItem)
54 var firstName = Settings.getUserFirstName(rowItem[1]);
55 var lastName = Settings.getUserLastName(rowItem[1]);
56 //res.push([dbItem.first_name, dbItem.last_name, dbItem.score])
57 highscoresModel.append({ 'id': rowItem[0],
58 'firstname': firstName,
59 'lastname': lastName,
60 'score': rowItem[2] });
61 }
62 }
63 },
64 Action {
65 text: "Current\nuser"
66 objectName: "currentuserbutton"
67 iconSource: Qt.resolvedUrl("../icons/single-user.svg")
68 onTriggered: {
69 var firstName = Settings.getUserFirstName(currentUserId);
70 var lastName = Settings.getUserLastName(currentUserId);
71 //print(firstName, lastName)
72 // TRANSLATORS: %1 is user's first name and %2 is last name
73 highscoresHeaderText = "<b>" + i18n.tr("Best scores for %1 %2").arg(firstName).arg(lastName) + "</b>"
74 var allScores = Settings.getAllScoresForUser(currentUserId)
75 highscoresModel.clear();
76 for(var i = 0; i < allScores.length; i++) {
77 var rowItem = allScores[i];
78 //res.push([dbItem.first_name, dbItem.last_name, dbItem.score])
79 highscoresModel.append({'firstname': firstName,
80 'lastname': lastName,
81 'score': rowItem[1] });
82 }
83 }
84 }
85 ]
86 }
87
88 BottomEdge {
89 z:2
90 hintIconName: "delete"
91 actions: [
92 RadialAction {
93 iconName: "contact"
94 iconColor: UbuntuColors.orange
95 onTriggered: {
96 Settings.deleteScoresWithProfileId(currentUserId)
97 highscoresModel.clearModelProfileId(currentUserId);
98 }
99 },
100 RadialAction {
101 iconName: "contact-group"
102 iconColor: UbuntuColors.orange
103 onTriggered: {
104 Settings.deleteAllScores();
105 highscoresModel.clear();
106 }
107 }
108 ]
109 }
110
111 ListModel {
112 id: highscoresModel
113
114 onDataChanged: {
64 var allScores = Settings.getAllScores()115 var allScores = Settings.getAllScores()
65 highscoresModel.clear();116 highscoresModel.clear();
66 highscoresHeaderText = i18n.tr("<b>Best scores for all players</b>");117 highscoresHeaderText = i18n.tr("<b>Best scores for all players</b>");
@@ -76,91 +127,37 @@
76 'score': rowItem[2] });127 'score': rowItem[2] });
77 }128 }
78 }129 }
79 },130 }
80 Action {131
81 text: "Current\nuser"
82 objectName: "currentuserbutton"
83 iconSource: Qt.resolvedUrl("../icons/single-user.svg")
84 onTriggered: {
85 var firstName = Settings.getUserFirstName(currentUserId);
86 var lastName = Settings.getUserLastName(currentUserId);
87 //print(firstName, lastName)
88 // TRANSLATORS: %1 is user's first name and %2 is last name
89 highscoresHeaderText = "<b>" + i18n.tr("Best scores for %1 %2").arg(firstName).arg(lastName) + "</b>"
90 var allScores = Settings.getAllScoresForUser(currentUserId)
91 highscoresModel.clear();
92 for(var i = 0; i < allScores.length; i++) {
93 var rowItem = allScores[i];
94 //res.push([dbItem.first_name, dbItem.last_name, dbItem.score])
95 highscoresModel.append({'firstname': firstName,
96 'lastname': lastName,
97 'score': rowItem[1] });
98 }
99 }
100 }
101
102 //locked: true
103 //opened: true
104 ]
105
106
107 ListModel {
108 id: highscoresModel
109
110 onDataChanged: {
111 var allScores = Settings.getAllScores()
112 highscoresModel.clear();
113 highscoresHeaderText = i18n.tr("<b>Best scores for all players</b>");
114 for(var i = 0; i < allScores.length; i++) {
115 var rowItem = allScores[i];
116 //print("ROW ",rowItem)
117 var firstName = Settings.getUserFirstName(rowItem[1]);
118 var lastName = Settings.getUserLastName(rowItem[1]);
119 //res.push([dbItem.first_name, dbItem.last_name, dbItem.score])
120 highscoresModel.append({ 'id': rowItem[0],
121 'firstname': firstName,
122 'lastname': lastName,
123 'score': rowItem[2] });
124 }
125 }
126
127 /*ListElement {
128 firstname: "Bill"
129 lastname: "Smith"
130 score: "120"
131 }
132 ListElement {
133 firstname: "John"
134 lastname: "Brown"
135 score: "130"
136 }*/
137 }
138 Column {
139 anchors.fill: parent
140 clip: true
141 UbuntuListView {132 UbuntuListView {
142 id: highScoresListView133 id: highScoresListView
134
135 anchors {
136 top: highScoresPage.header.bottom
137 topMargin: units.gu(2)
138 left: parent.left
139 right: parent.right
140 bottom: parent.bottom
141 }
142
143 model: highscoresModel143 model: highscoresModel
144 width: parent.width
145 height:parent.height
146144
147 header: Label {145 header: Label {
148 id: highscoresHeader146 id: highscoresHeader
149 objectName: "highscoreslabel"147 objectName: "highscoreslabel"
150 text: highscoresHeaderText148 text: highscoresHeaderText
151 height: units.gu(5)149 height: units.gu(5)
150 anchors.left: parent.left
151 anchors.leftMargin: units.gu(2)
152 }152 }
153153
154 delegate: ListItem {154 delegate: ListItem {
155 Label {155 ListItemLayout {
156 anchors.left: parent.left156 title.text: "%1. %2 %3".arg(index+1).arg(firstname).arg(lastname)
157 anchors.leftMargin: units.gu(1)157 Label {
158 text: (index+1) + ". " + firstname + " " + lastname158 SlotsLayout.position: SlotsLayout.Last
159 }159 text: score
160 Label {160 }
161 anchors.right: parent.right
162 anchors.rightMargin: units.gu(1)
163 text: score
164 }161 }
165162
166 leadingActions: ListItemActions {163 leadingActions: ListItemActions {
@@ -168,17 +165,14 @@
168 Action {165 Action {
169 iconName: "delete"166 iconName: "delete"
170 onTriggered: {167 onTriggered: {
171 //print(index, id, firstname);
172 Settings.deleteScoreWithId(id);168 Settings.deleteScoreWithId(id);
173 highscoresModel.remove(index,1);169 highscoresModel.remove(index,1);
174 }170 }
175 }171 }
176 ]172 ]
177 }173 }
178 //value: score
179 }174 }
180 }175 }
181 }176 }
182}177}
183178
184
185179
=== modified file 'components/ManageProfileDialog.qml'
--- components/ManageProfileDialog.qml 2014-10-06 12:41:09 +0000
+++ components/ManageProfileDialog.qml 2016-02-28 17:36:02 +0000
@@ -1,6 +1,6 @@
1import QtQuick 2.31import QtQuick 2.4
2import Ubuntu.Components 1.12import Ubuntu.Components 1.3
3import Ubuntu.Components.Popups 1.03import Ubuntu.Components.Popups 1.3
4import "../js/localStorage.js" as Settings4import "../js/localStorage.js" as Settings
5import QtQuick.LocalStorage 2.05import QtQuick.LocalStorage 2.0
66
77
=== modified file 'components/NewGameSelectionButton.qml'
--- components/NewGameSelectionButton.qml 2014-10-06 12:41:09 +0000
+++ components/NewGameSelectionButton.qml 2016-02-28 17:36:02 +0000
@@ -1,6 +1,6 @@
1import QtQuick 2.31import QtQuick 2.4
2import Ubuntu.Components 1.12import Ubuntu.Components 1.3
3import Ubuntu.Components.Popups 1.03import Ubuntu.Components.Popups 1.3
44
5UbuntuShape {5UbuntuShape {
6 id: gameDifficultyButton6 id: gameDifficultyButton
77
=== modified file 'components/RadialAction.qml'
--- components/RadialAction.qml 2015-07-16 11:29:03 +0000
+++ components/RadialAction.qml 2016-02-28 17:36:02 +0000
@@ -1,5 +1,5 @@
1import QtQuick 2.01import QtQuick 2.0
2import Ubuntu.Components 1.12import Ubuntu.Components 1.3
33
4Action {4Action {
5 property string iconName: "add"5 property string iconName: "add"
66
=== added file 'components/SettingsTab.qml'
--- components/SettingsTab.qml 1970-01-01 00:00:00 +0000
+++ components/SettingsTab.qml 2016-02-28 17:36:02 +0000
@@ -0,0 +1,359 @@
1import QtQuick 2.4
2import Ubuntu.Components 1.3
3import QtQuick.LocalStorage 2.0
4import Ubuntu.Components.Popups 1.3
5import Ubuntu.Layouts 1.0
6import "../js/localStorage.js" as Settings
7
8Tab {
9 id: settingsTab;
10 objectName: "settingsTab"
11
12 property alias disableHintsChecked: disableHints.checked;
13 property alias disableVibrationsChecked: disableVibrations.checked;
14 property alias difficultyIndex: difficultySelector.selectedIndex;
15 property alias themeIndex: themeSelector.selectedIndex;
16
17 page: Page {
18 id: settingsPage
19 objectName: "settingsPage"
20
21 anchors.fill: parent
22
23 header: PageHeader {
24 flickable: flickableSettings
25 title: i18n.tr("Settings")
26 leadingActionBar {
27 numberOfSlots: 0
28 actions: tabsList.actions
29 }
30 }
31
32 Component {
33 id: profileSelector
34 Dialog {
35 objectName: "selectProfileDialog"
36 title: i18n.tr("Select profile")
37
38 Column{
39 height: mainColumnSettings.height*2/3
40 ListView {
41
42 id: profileListView
43 objectName: "profileListView"
44 clip: true
45 width: parent.width
46 height: parent.height - units.gu(12)
47 model: profilesModel
48
49 delegate: ListItem {
50 height: selectProfileLayout.height + divider.height
51 ListItemLayout {
52 id: selectProfileLayout
53 title.text: firstname + " " + lastname
54 ProgressionSlot {}
55 }
56 onClicked: {
57 currentUserId = profileId;
58 hide()
59 }
60 }
61 }
62
63 SudokuDialogButton{
64 anchors.horizontalCenter: parent.horizontalCenter
65 id:cancelButton
66 buttonText: i18n.tr("Cancel")
67 width: parent.width/2;
68 size: units.gu(5)
69 buttonColor: sudokuBlocksGrid.dialogButtonColor1
70 textColor: sudokuBlocksGrid.dialogButtonTextColor
71 //border.color: "transparent"
72 onTriggered: {
73 hide()
74 }
75 }
76
77 }
78 }
79 }
80
81 Component {
82 id: manageProfileSelector
83 Dialog {
84 objectName: "manageProfileDialog"
85 title: i18n.tr("Select profile")
86
87 Column{
88 height: mainColumnSettings.height*2/3
89 ListView {
90 id: manageProfileListView
91 objectName: "manageProfileListView"
92 clip: true
93 width: parent.width
94 height: parent.height - units.gu(12)
95 model: profilesModel
96
97 delegate:ListItem {
98 height: manageProfileLayout.height + divider.height
99 ListItemLayout {
100 id: manageProfileLayout
101 title.text: firstname + " " + lastname
102 ProgressionSlot {}
103 }
104 onClicked: {
105 hide()
106 editUserId = profileId
107 PopupUtils.open(manageProfileDialog, selectorProfile)
108 }
109 }
110 }
111 SudokuDialogButton{
112
113 anchors.horizontalCenter: parent.horizontalCenter
114 id:cancelButton
115 objectName: "cancelButton"
116 buttonText: i18n.tr("Cancel")
117 width: parent.width/2;
118 size: units.gu(5)
119 buttonColor: sudokuBlocksGrid.dialogButtonColor1
120 textColor: sudokuBlocksGrid.dialogButtonTextColor
121 //border.color: "transparent"
122 onTriggered: {
123 hide()
124 }
125 }
126 }
127 }
128 }
129
130 ListModel{
131 id: profilesModel
132 }
133
134 Flickable {
135 id: flickableSettings
136 objectName: "settingsContainer"
137
138 anchors.fill: parent
139 contentHeight: mainColumnSettings.height
140
141 Column {
142 id: mainColumnSettings;
143
144 height: childrenRect.height
145 width: parent.width
146 spacing: units.gu(1)
147
148 ListItem {
149 height: sudokuSettingsLayout.height + divider.height
150 ListItemLayout {
151 id: sudokuSettingsLayout
152 title.text: i18n.tr("Sudoku settings")
153 title.font.weight: Font.DemiBold
154 }
155 }
156
157 OptionSelector {
158 objectName: "difficultySelector"
159 id: difficultySelector
160 text: i18n.tr("Default Difficulty")
161 width: parent.width - units.gu(4)
162 anchors.horizontalCenter: parent.horizontalCenter
163 model: [i18n.tr("Easy"), i18n.tr("Moderate"), i18n.tr("Hard"), i18n.tr("Ultra Hard"), i18n.tr("Always ask")]
164 onSelectedIndexChanged: {
165 //print(difficultySelector.selectedIndex)
166 switch(difficultySelector.selectedIndex) {
167 case 0:
168 var randomnumber = Math.floor(Math.random()*9);
169 randomnumber += 31;
170 sudokuBlocksGrid.createNewGame(81 - randomnumber);
171 Settings.setSetting("Difficulty", selectedIndex)
172 sudokuBlocksGrid.gameDifficulty = 0
173 break;
174 case 1:
175 var randomnumber = Math.floor(Math.random()*4);
176 randomnumber += 26;
177 sudokuBlocksGrid.createNewGame(81 - randomnumber);
178 Settings.setSetting("Difficulty", selectedIndex)
179 sudokuBlocksGrid.gameDifficulty = 1
180 break;
181 case 2:
182 var randomnumber = Math.floor(Math.random()*4);
183 randomnumber += 21;
184 sudokuBlocksGrid.createNewGame(81 - randomnumber);
185 Settings.setSetting("Difficulty", selectedIndex)
186 sudokuBlocksGrid.gameDifficulty = 2
187 break;
188 case 3:
189 var randomnumber = Math.floor(Math.random()*3);
190 randomnumber += 17;
191 sudokuBlocksGrid.createNewGame(81 - randomnumber);
192 Settings.setSetting("Difficulty", selectedIndex)
193 sudokuBlocksGrid.gameDifficulty = 3
194 break;
195 case 4:
196 Settings.setSetting("Difficulty", selectedIndex)
197 break;
198 }
199 }
200
201 }
202
203 OptionSelector {
204 objectName: "themeSelector"
205 id: themeSelector
206 text: i18n.tr("Theme")
207 model: ["UbuntuColours", "Simple"]
208 width: parent.width - units.gu(4)
209 anchors.horizontalCenter: parent.horizontalCenter
210 onSelectedIndexChanged: {
211 var newColorScheme = null;
212 if (selectedIndex == 0)
213 {
214 //print("Ubuntu")
215 var result = Settings.setSetting("ColorTheme", selectedIndex);
216 //print(result);
217 sudokuBlocksGrid.changeColorScheme("ColorSchemeUbuntu.qml");
218 }
219 if (selectedIndex == 1)
220 {
221 //print("Simple")
222 var result = Settings.setSetting("ColorTheme", selectedIndex);
223 //print(result);
224 sudokuBlocksGrid.changeColorScheme("ColorSchemeSimple.qml");
225 }
226 }
227 Component.onCompleted: selectedIndex = 0
228 }
229
230 ListItem {
231 objectName: "hintsSwitchClickable"
232 height: hintsSettingsLayout.height + divider.height
233
234 ListItemLayout {
235 id: hintsSettingsLayout
236 title.text: i18n.tr("Hints")
237
238 Switch {
239 id: disableHints
240 objectName: "hintsSwitch"
241 checked: disableHintsChecked
242 SlotsLayout.position: SlotsLayout.Last
243 onCheckedChanged: {
244 Settings.setSetting("DisableHints", checked ? "true":"false")
245 }
246 }
247 }
248 }
249
250 ListItem {
251 objectName: "vibrationsSwitchClickable"
252 height: vibrationsSettingsLayout.height + divider.height
253
254 ListItemLayout {
255 id: vibrationsSettingsLayout
256 title.text: i18n.tr("Vibration Alerts")
257
258 Switch {
259 id: disableVibrations
260 objectName: "vibrationsSwitch"
261 checked: disableVibrationsChecked
262 SlotsLayout.position: SlotsLayout.Last
263 onCheckedChanged: {
264 Settings.setSetting("DisableVibrations", checked ? "true":"false")
265 }
266 }
267 }
268 }
269
270 ListItem {
271 height: profileSettingsLayout.height + divider.height
272 ListItemLayout {
273 id: profileSettingsLayout
274 title.text: i18n.tr("Profiles settings")
275 title.font.weight: Font.DemiBold
276 }
277 }
278
279 SingleValueListItem {
280 id: selectorProfile
281 objectName: "Current profile"
282 title.text: i18n.tr("Current profile")
283 value: {
284 if(currentUserId==-1)
285 return i18n.tr("None")
286 else
287 return Settings.getUserFirstName(currentUserId)+" "+Settings.getUserLastName(currentUserId);
288
289 }
290 Component.onCompleted: currentUserId = Settings.getSetting("currentUserId")
291
292 onClicked: {
293 var allProfiles = new Array();
294 allProfiles = Settings.getAllProfiles()
295
296 profilesModel.clear()
297
298 for(var i = 0; i < allProfiles.length; i++)
299 {
300 profilesModel.append({"profileId":allProfiles[i].id,"lastname":allProfiles[i].lastname, "firstname":allProfiles[i].firstname})
301 }
302 PopupUtils.open(profileSelector, selectorProfile)
303 }
304 }
305
306 AddProfileDialog{
307 id:addProfileDialog
308 }
309
310 ManageProfileDialog{
311 id:manageProfileDialog
312 }
313
314 ListItem {
315 id: addSingleValue
316 objectName: "Add profile"
317 height: addSingleValueLayout.height + divider.height
318 ListItemLayout {
319 id: addSingleValueLayout
320 title.text: i18n.tr("Add profile")
321 ProgressionSlot {}
322 }
323 onClicked: {
324 PopupUtils.open(addProfileDialog, addSingleValue);
325 }
326 }
327
328 ListItem {
329 id: manageProfileSingleValue
330 objectName: "Manage profiles"
331 height: manageProfileSingleValueLayout.height + divider.height
332 ListItemLayout {
333 id: manageProfileSingleValueLayout
334 title.text: i18n.tr("Manage profiles")
335 ProgressionSlot {}
336 }
337 onClicked: {
338 var allProfiles = new Array();
339 allProfiles = Settings.getAllProfiles()
340
341 profilesModel.clear()
342
343 for(var i = 0; i < allProfiles.length; i++)
344 {
345 profilesModel.append({"profileId":allProfiles[i].id,"lastname":allProfiles[i].lastname, "firstname":allProfiles[i].firstname})
346 }
347
348 PopupUtils.open(manageProfileSelector, manageProfileSingleValue)
349 }
350 }
351 }
352 }
353
354 Scrollbar {
355 flickableItem: flickableSettings
356 align: Qt.AlignTrailing
357 }
358 }
359}
0360
=== added file 'components/SingleValueListItem.qml'
--- components/SingleValueListItem.qml 1970-01-01 00:00:00 +0000
+++ components/SingleValueListItem.qml 2016-02-28 17:36:02 +0000
@@ -0,0 +1,22 @@
1import QtQuick 2.4
2import Ubuntu.Components 1.3
3
4ListItem {
5 id: customListItem
6
7 property alias title: customItemLayout.title
8 property alias value: _value.text
9
10 ListItemLayout {
11 id: customItemLayout
12
13 title.text: " "
14
15 Label {
16 id: _value
17 SlotsLayout.position: SlotsLayout.Trailing;
18 }
19
20 ProgressionSlot {}
21 }
22}
023
=== modified file 'components/SudokuBlocksGrid.qml'
--- components/SudokuBlocksGrid.qml 2015-07-16 15:00:01 +0000
+++ components/SudokuBlocksGrid.qml 2016-02-28 17:36:02 +0000
@@ -1,6 +1,6 @@
1import QtQuick 2.31import QtQuick 2.4
2import Ubuntu.Components 1.12import Ubuntu.Components 1.3
3import Ubuntu.Components.Popups 1.03import Ubuntu.Components.Popups 1.3
4import "../js/SudokuCU.js" as SudokuCU4import "../js/SudokuCU.js" as SudokuCU
5import QtFeedback 5.05import QtFeedback 5.0
66
@@ -120,13 +120,9 @@
120 colorScheme.dialogButtonColor2 = temp.dialogButtonColor2;120 colorScheme.dialogButtonColor2 = temp.dialogButtonColor2;
121 colorScheme.dialogButtonTextColor = temp.dialogButtonTextColor;121 colorScheme.dialogButtonTextColor = temp.dialogButtonTextColor;
122122
123 colorScheme.headerColor = temp.headerColor;
124 colorScheme.backgroundColor = temp.backgroundColor;123 colorScheme.backgroundColor = temp.backgroundColor;
125 colorScheme.footerColor = temp.footerColor;
126124
127 mainView.headerColor = colorScheme.headerColor;
128 mainView.backgroundColor = colorScheme.backgroundColor;125 mainView.backgroundColor = colorScheme.backgroundColor;
129 mainView.footerColor = colorScheme.footerColor;
130126
131 for (var i = 0; i < 9; i++) {127 for (var i = 0; i < 9; i++) {
132 for (var j = 0; j < 9; j++) {128 for (var j = 0; j < 9; j++) {
133129
=== modified file 'components/SudokuButton.qml'
--- components/SudokuButton.qml 2014-10-06 12:41:09 +0000
+++ components/SudokuButton.qml 2016-02-28 17:36:02 +0000
@@ -1,5 +1,5 @@
1import QtQuick 2.31import QtQuick 2.4
2import Ubuntu.Components 1.12import Ubuntu.Components 1.3
33
4Rectangle {4Rectangle {
5 id: button5 id: button
66
=== modified file 'components/SudokuButtonsGrid.qml'
--- components/SudokuButtonsGrid.qml 2015-07-16 15:00:01 +0000
+++ components/SudokuButtonsGrid.qml 2016-02-28 17:36:02 +0000
@@ -1,6 +1,6 @@
1import QtQuick 2.31import QtQuick 2.4
2import Ubuntu.Components 1.12import Ubuntu.Components 1.3
3import Ubuntu.Components.Popups 1.03import Ubuntu.Components.Popups 1.3
44
5Repeater {5Repeater {
66
@@ -132,7 +132,7 @@
132 }132 }
133133
134 Component.onCompleted: {134 Component.onCompleted: {
135 switch(difficultySelector.selectedIndex) {135 switch(settingsTab.difficultyIndex) {
136 case 0:136 case 0:
137 var randomnumber = Math.floor(Math.random()*9);137 var randomnumber = Math.floor(Math.random()*9);
138 randomnumber += 31;138 randomnumber += 31;
139139
=== modified file 'components/SudokuDialogButton.qml'
--- components/SudokuDialogButton.qml 2014-10-06 12:41:09 +0000
+++ components/SudokuDialogButton.qml 2016-02-28 17:36:02 +0000
@@ -1,5 +1,5 @@
1import QtQuick 2.31import QtQuick 2.4
2import Ubuntu.Components 1.12import Ubuntu.Components 1.3
33
4DialogButton {4DialogButton {
5 id: dialogButton5 id: dialogButton
66
=== added file 'components/TabsList.qml'
--- components/TabsList.qml 1970-01-01 00:00:00 +0000
+++ components/TabsList.qml 2016-02-28 17:36:02 +0000
@@ -0,0 +1,36 @@
1import QtQuick 2.4
2import Ubuntu.Components 1.3
3
4ActionList {
5 id: tabsList
6
7 children: [
8 Action {
9 text: i18n.tr("Sudoku")
10 onTriggered: {
11 tabs.selectedTabIndex = 0
12 }
13 },
14
15 Action {
16 text: i18n.tr("Scores")
17 onTriggered: {
18 tabs.selectedTabIndex = 1
19 }
20 },
21
22 Action {
23 text: i18n.tr("Settings")
24 onTriggered: {
25 tabs.selectedTabIndex = 2
26 }
27 },
28
29 Action {
30 text: i18n.tr("About")
31 onTriggered: {
32 tabs.selectedTabIndex = 3
33 }
34 }
35 ]
36}
037
=== modified file 'debian/changelog'
--- debian/changelog 2014-05-02 10:20:04 +0000
+++ debian/changelog 2016-02-28 17:36:02 +0000
@@ -1,3 +1,12 @@
1sudoku-app (1.6) UNRELEASED; urgency=medium
2
3 * Migrated to Ubuntu.Components 1.3
4 * Updated framework to 15.04.3-qml
5 * Updated to QtQuick 2.4
6 * Removed unused comments, deprecated imports and unused actions
7
8 -- Nekhelesh <krnekhelesh@nik90-laptop> Sun, 28 Feb 2016 18:34:26 +0100
9
1sudoku-app (1.1) raring; urgency=medium10sudoku-app (1.1) raring; urgency=medium
211
3 * Add -qt5 command line option (LP: #1288885) 12 * Add -qt5 command line option (LP: #1288885)
413
=== modified file 'po/com.ubuntu.sudoku.pot'
--- po/com.ubuntu.sudoku.pot 2015-07-17 11:48:07 +0000
+++ po/com.ubuntu.sudoku.pot 2016-02-28 17:36:02 +0000
@@ -8,7 +8,7 @@
8msgstr ""8msgstr ""
9"Project-Id-Version: sudoku-app\n"9"Project-Id-Version: sudoku-app\n"
10"Report-Msgid-Bugs-To: \n"10"Report-Msgid-Bugs-To: \n"
11"POT-Creation-Date: 2015-07-17 13:47+0200\n"11"POT-Creation-Date: 2016-02-28 22:53+0530\n"
12"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"12"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
13"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"13"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14"Language-Team: LANGUAGE <LL@li.org>\n"14"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -18,15 +18,20 @@
18"Content-Transfer-Encoding: 8bit\n"18"Content-Transfer-Encoding: 8bit\n"
19"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"19"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
2020
21#: ../components/AboutTab.qml:10321#: ../components/AboutTab.qml:17 ../components/HighscoresTab.qml:36
22#: ../components/TabsList.qml:30
23msgid "About"
24msgstr ""
25
26#: ../components/AboutTab.qml:111
22msgid "Author(s): "27msgid "Author(s): "
23msgstr ""28msgstr ""
2429
25#: ../components/AboutTab.qml:11330#: ../components/AboutTab.qml:121
26msgid "Contact: "31msgid "Contact: "
27msgstr ""32msgstr ""
2833
29#: ../components/AboutTab.qml:13934#: ../components/AboutTab.qml:147
30msgid "Version: "35msgid "Version: "
31msgstr ""36msgstr ""
3237
@@ -43,7 +48,7 @@
43msgstr ""48msgstr ""
4449
45#: ../components/AddProfileDialog.qml:5350#: ../components/AddProfileDialog.qml:53
46#: ../components/ManageProfileDialog.qml:69 ../sudoku-app.qml:35451#: ../components/ManageProfileDialog.qml:69 ../sudoku-app.qml:192
47msgid "OK"52msgid "OK"
48msgstr ""53msgstr ""
4954
@@ -62,9 +67,9 @@
62msgstr ""67msgstr ""
6368
64#: ../components/AddProfileDialog.qml:8569#: ../components/AddProfileDialog.qml:85
65#: ../components/ManageProfileDialog.qml:12770#: ../components/ManageProfileDialog.qml:127 ../components/SettingsTab.qml:66
66#: ../components/SudokuBlocksGrid.qml:492 ../sudoku-app.qml:50771#: ../components/SettingsTab.qml:116 ../components/SudokuBlocksGrid.qml:488
67#: ../sudoku-app.qml:881 ../sudoku-app.qml:93372#: ../sudoku-app.qml:343
68msgid "Cancel"73msgid "Cancel"
69msgstr ""74msgstr ""
7075
@@ -89,14 +94,13 @@
89msgid "Hinted blocks"94msgid "Hinted blocks"
90msgstr ""95msgstr ""
9196
92#: ../components/HighscoresTab.qml:66 ../components/HighscoresTab.qml:11397#: ../components/HighscoresTab.qml:50 ../components/HighscoresTab.qml:117
93#: ../sudoku-app.qml:24 ../sudoku-app.qml:153 ../sudoku-app.qml:20798#: ../sudoku-app.qml:21 ../sudoku-app.qml:49 ../sudoku-app.qml:82
94#: ../sudoku-app.qml:244
95msgid "<b>Best scores for all players</b>"99msgid "<b>Best scores for all players</b>"
96msgstr ""100msgstr ""
97101
98#. TRANSLATORS: %1 is user's first name and %2 is last name102#. TRANSLATORS: %1 is user's first name and %2 is last name
99#: ../components/HighscoresTab.qml:89 ../sudoku-app.qml:176103#: ../components/HighscoresTab.qml:73
100#, qt-format104#, qt-format
101msgid "Best scores for %1 %2"105msgid "Best scores for %1 %2"
102msgstr ""106msgstr ""
@@ -109,215 +113,171 @@
109msgid "Delete"113msgid "Delete"
110msgstr ""114msgstr ""
111115
112#: ../components/SudokuBlocksGrid.qml:334116#: ../components/SettingsTab.qml:25 ../components/TabsList.qml:23
117msgid "Settings"
118msgstr ""
119
120#: ../components/SettingsTab.qml:36 ../components/SettingsTab.qml:85
121msgid "Select profile"
122msgstr ""
123
124#: ../components/SettingsTab.qml:152
125msgid "Sudoku settings"
126msgstr ""
127
128#: ../components/SettingsTab.qml:160
129msgid "Default Difficulty"
130msgstr ""
131
132#: ../components/SettingsTab.qml:163 ../sudoku-app.qml:272
133msgid "Easy"
134msgstr ""
135
136#: ../components/SettingsTab.qml:163 ../sudoku-app.qml:291
137msgid "Moderate"
138msgstr ""
139
140#: ../components/SettingsTab.qml:163 ../sudoku-app.qml:308
141msgid "Hard"
142msgstr ""
143
144#: ../components/SettingsTab.qml:163
145msgid "Ultra Hard"
146msgstr ""
147
148#: ../components/SettingsTab.qml:163
149msgid "Always ask"
150msgstr ""
151
152#: ../components/SettingsTab.qml:206
153msgid "Theme"
154msgstr ""
155
156#: ../components/SettingsTab.qml:236
157msgid "Hints"
158msgstr ""
159
160#: ../components/SettingsTab.qml:256
161msgid "Vibration Alerts"
162msgstr ""
163
164#: ../components/SettingsTab.qml:274
165msgid "Profiles settings"
166msgstr ""
167
168#: ../components/SettingsTab.qml:282
169msgid "Current profile"
170msgstr ""
171
172#: ../components/SettingsTab.qml:285
173msgid "None"
174msgstr ""
175
176#: ../components/SettingsTab.qml:320
177msgid "Add profile"
178msgstr ""
179
180#: ../components/SettingsTab.qml:334
181msgid "Manage profiles"
182msgstr ""
183
184#: ../components/SudokuBlocksGrid.qml:330
113msgid "Please pick a number"185msgid "Please pick a number"
114msgstr ""186msgstr ""
115187
116#: ../components/SudokuBlocksGrid.qml:395188#: ../components/SudokuBlocksGrid.qml:391
117msgid "Clear"189msgid "Clear"
118msgstr ""190msgstr ""
119191
120#: ../components/SudokuBlocksGrid.qml:465192#: ../components/SudokuBlocksGrid.qml:461
121#, qt-format193#, qt-format
122msgid ""194msgid ""
123"You are a cheat...\n"195"You are a cheat...\n"
124"But we give you\n"196"But we give you\n"
125"%1 point."197"%1 point."
126msgid_plural ""198msgid_plural ""
127"You are a cheat...\n"199"You are a cheat...\n"
128"But we give you\n"200"But we give you\n"
129"%1 points."201"%1 points."
130msgstr[0] ""202msgstr[0] ""
131msgstr[1] ""203msgstr[1] ""
132204
133#: ../components/SudokuBlocksGrid.qml:472205#: ../components/SudokuBlocksGrid.qml:468
134#, qt-format206#, qt-format
135msgid ""207msgid ""
136"Congratulations!\n"208"Congratulations!\n"
137"We give you\n"209"We give you\n"
138"%1 point."210"%1 point."
139msgid_plural ""211msgid_plural ""
140"Congratulations!\n"212"Congratulations!\n"
141"We give you\n"213"We give you\n"
142"%1 points."214"%1 points."
143msgstr[0] ""215msgstr[0] ""
144msgstr[1] ""216msgstr[1] ""
145217
146#: ../js/localStorage.js:11 ../sudoku-app.qml:688218#: ../components/TabsList.qml:9 ../js/localStorage.js:11 ../sudoku-app.qml:590
147#: com.ubuntu.sudoku_sudoku.desktop.in.in.h:1219#: com.ubuntu.sudoku_sudoku.desktop.in.in.h:1
148msgid "Sudoku"220msgid "Sudoku"
149msgstr ""221msgstr ""
150222
223#: ../components/TabsList.qml:16
224msgid "Scores"
225msgstr ""
226
151#: ../js/localStorage.js:12227#: ../js/localStorage.js:12
152msgid "User"228msgid "User"
153msgstr ""229msgstr ""
154230
155#: ../sudoku-app.qml:50 ../sudoku-app.qml:51 ../sudoku-app.qml:763231#: ../sudoku-app.qml:75
156msgid "New game"
157msgstr ""
158
159#: ../sudoku-app.qml:58 ../sudoku-app.qml:59
160msgid "Reveal hint"
161msgstr ""
162
163#: ../sudoku-app.qml:67 ../sudoku-app.qml:68
164msgid "Show settings"
165msgstr ""
166
167#: ../sudoku-app.qml:75 ../sudoku-app.qml:76
168msgid "Change difficulty to Easy"
169msgstr ""
170
171#: ../sudoku-app.qml:88 ../sudoku-app.qml:89
172msgid "Change difficulty to Moderate"
173msgstr ""
174
175#: ../sudoku-app.qml:101 ../sudoku-app.qml:102
176msgid "Change difficulty to Hard"
177msgstr ""
178
179#: ../sudoku-app.qml:114 ../sudoku-app.qml:115
180msgid "Change difficulty to Ultra Hard"
181msgstr ""
182
183#: ../sudoku-app.qml:127 ../sudoku-app.qml:128
184msgid "Change theme to Simple"
185msgstr ""
186
187#: ../sudoku-app.qml:137 ../sudoku-app.qml:138
188msgid "Change theme to UbuntuColors"
189msgstr ""
190
191#: ../sudoku-app.qml:147 ../sudoku-app.qml:148
192msgid "Show scores for all users"
193msgstr ""
194
195#: ../sudoku-app.qml:168 ../sudoku-app.qml:169
196msgid "Show scores for current user"
197msgstr ""
198
199#: ../sudoku-app.qml:233
200msgid ""232msgid ""
201"You are a cheat... \n"233"You are a cheat... \n"
202"But we give you\n"234"But we give you\n"
203msgstr ""235msgstr ""
204236
205#: ../sudoku-app.qml:235237#: ../sudoku-app.qml:77
206msgid "point."238msgid "point."
207msgid_plural "points."239msgid_plural "points."
208msgstr[0] ""240msgstr[0] ""
209msgstr[1] ""241msgstr[1] ""
210242
211#: ../sudoku-app.qml:341243#: ../sudoku-app.qml:179
212msgid "Sudoku games played today"244msgid "Sudoku games played today"
213msgstr ""245msgstr ""
214246
215#: ../sudoku-app.qml:342247#: ../sudoku-app.qml:180
216msgid "No Sudoku games played today"248msgid "No Sudoku games played today"
217msgstr ""249msgstr ""
218250
219#: ../sudoku-app.qml:371251#: ../sudoku-app.qml:209
220msgid "New Game"252msgid "New Game"
221msgstr ""253msgstr ""
222254
223#: ../sudoku-app.qml:372255#: ../sudoku-app.qml:210
224msgid "Select difficulty level"256msgid "Select difficulty level"
225msgstr ""257msgstr ""
226258
227#: ../sudoku-app.qml:436 ../sudoku-app.qml:982259#: ../sudoku-app.qml:325
228msgid "Easy"
229msgstr ""
230
231#: ../sudoku-app.qml:455 ../sudoku-app.qml:982
232msgid "Moderate"
233msgstr ""
234
235#: ../sudoku-app.qml:472 ../sudoku-app.qml:982
236msgid "Hard"
237msgstr ""
238
239#: ../sudoku-app.qml:489
240msgid ""260msgid ""
241"Ultra\n"261"Ultra\n"
242"Hard"262"Hard"
243msgstr ""263msgstr ""
244264
245#: ../sudoku-app.qml:744265#: ../sudoku-app.qml:577
246msgid "You are a cheat..."266msgid "You are a cheat..."
247msgstr ""267msgstr ""
248268
249#: ../sudoku-app.qml:744269#: ../sudoku-app.qml:577
250msgid "Congratulations!"270msgid "Congratulations!"
251msgstr ""271msgstr ""
252272
253#: ../sudoku-app.qml:780273#: ../sudoku-app.qml:600
274msgid "New game"
275msgstr ""
276
277#: ../sudoku-app.qml:616
254msgid "Show hint"278msgid "Show hint"
255msgstr ""279msgstr ""
256280
257#: ../sudoku-app.qml:820
258msgid "Scores"
259msgstr ""
260
261#: ../sudoku-app.qml:830
262msgid "Settings"
263msgstr ""
264
265#: ../sudoku-app.qml:852 ../sudoku-app.qml:900
266msgid "Select profile"
267msgstr ""
268
269#: ../sudoku-app.qml:973
270msgid "<b>Sudoku settings</b>"
271msgstr ""
272
273#: ../sudoku-app.qml:979
274msgid "Default Difficulty"
275msgstr ""
276
277#: ../sudoku-app.qml:982
278msgid "Ultra Hard"
279msgstr ""
280
281#: ../sudoku-app.qml:982
282msgid "Always ask"
283msgstr ""
284
285#: ../sudoku-app.qml:1024
286msgid "Theme"
287msgstr ""
288
289#: ../sudoku-app.qml:1050
290msgid "Hints"
291msgstr ""
292
293#: ../sudoku-app.qml:1066
294msgid "Vibration Alerts"
295msgstr ""
296
297#: ../sudoku-app.qml:1083
298msgid "<b>Profiles settings</b>"
299msgstr ""
300
301#: ../sudoku-app.qml:1087
302msgid "Current profile"
303msgstr ""
304
305#: ../sudoku-app.qml:1091
306msgid "None"
307msgstr ""
308
309#: ../sudoku-app.qml:1127
310msgid "Add profile"
311msgstr ""
312
313#: ../sudoku-app.qml:1136
314msgid "Manage profiles"
315msgstr ""
316
317#: ../sudoku-app.qml:1168
318msgid "About"
319msgstr ""
320
321#: com.ubuntu.sudoku_sudoku.desktop.in.in.h:2281#: com.ubuntu.sudoku_sudoku.desktop.in.in.h:2
322msgid "Sudoku Game for Ubuntu Touch."282msgid "Sudoku Game for Ubuntu Touch."
323msgstr ""283msgstr ""
324284
=== modified file 'sudoku-app.qml'
--- sudoku-app.qml 2015-07-17 11:48:07 +0000
+++ sudoku-app.qml 2016-02-28 17:36:02 +0000
@@ -1,14 +1,11 @@
1import QtQuick 2.31import QtQuick 2.4
2import Ubuntu.Components 1.12import UserMetrics 0.1
3import Ubuntu.Components.ListItems 1.0 as ListItem3import Ubuntu.Layouts 1.0
4import Ubuntu.Components 1.3
4import QtQuick.LocalStorage 2.05import QtQuick.LocalStorage 2.0
5import Ubuntu.Components.Popups 1.06import Ubuntu.Components.Popups 1.3
6import Ubuntu.Layouts 1.0
7import "js/localStorage.js" as Settings7import "js/localStorage.js" as Settings
8import "components"8import "components"
9//import Ubuntu.HUD 1.0 as HUD
10import Ubuntu.Unity.Action 1.1 as UnityActions
11import UserMetrics 0.1
129
13MainView {10MainView {
14 id: mainView11 id: mainView
@@ -32,163 +29,8 @@
3229
33 width: units.gu(41);30 width: units.gu(41);
34 height: units.gu(70);31 height: units.gu(70);
35
36 //headerColor: sudokuBlocksGrid.headerColor
37 //backgroundColor: sudokuBlocksGrid.backgroundColor
38 //footerColor: sudokuBlocksGrid.footerColor
39
40 /*HUD.HUD {
41 applicationIdentifier: "sudoku-app" // this has to match the .desktop file!
42 HUD.Context {*/
43
44 StateSaver.properties: "width, height"32 StateSaver.properties: "width, height"
4533
46 useDeprecatedToolbar: false
47
48 actions: [
49 Action {
50 text: i18n.tr("New game")
51 keywords: i18n.tr("New game")
52 onTriggered: {
53 tabs.selectedTabIndex = 0
54 createNewGame()
55 }
56 },
57 Action {
58 text: i18n.tr("Reveal hint")
59 keywords: i18n.tr("Reveal hint")
60 enabled: disableHints.checked
61 onTriggered: {
62 tabs.selectedTabIndex = 0
63 revealHint()
64 }
65 },
66 Action {
67 text: i18n.tr("Show settings")
68 keywords: i18n.tr("Show settings")
69 onTriggered: {
70 tabs.selectedTabIndex = 2
71 revealHint()
72 }
73 },
74 Action {
75 text: i18n.tr("Change difficulty to Easy")
76 keywords: i18n.tr("Change difficulty to Easy")
77 onTriggered: {
78 tabs.selectedTabIndex = 0
79 difficultySelector.selectedIndex = 0
80 var randomnumber = Math.floor(Math.random()*9);
81 randomnumber += 31;
82 sudokuBlocksGrid.createNewGame(81 - randomnumber);
83 Settings.setSetting("Difficulty", 0)
84 createNewGame()
85 }
86 },
87 Action {
88 text: i18n.tr("Change difficulty to Moderate")
89 keywords: i18n.tr("Change difficulty to Moderate")
90 onTriggered: {
91 tabs.selectedTabIndex = 0
92 difficultySelector.selectedIndex = 1
93 var randomnumber = Math.floor(Math.random()*4);
94 randomnumber += 26;
95 sudokuBlocksGrid.createNewGame(81 - randomnumber);
96 Settings.setSetting("Difficulty", 1)
97 createNewGame()
98 }
99 },
100 Action {
101 text: i18n.tr("Change difficulty to Hard")
102 keywords: i18n.tr("Change difficulty to Hard")
103 onTriggered: {
104 tabs.selectedTabIndex = 0
105 difficultySelector.selectedIndex = 2
106 var randomnumber = Math.floor(Math.random()*4);
107 randomnumber += 21;
108 sudokuBlocksGrid.createNewGame(81 - randomnumber);
109 Settings.setSetting("Difficulty", 2)
110 createNewGame()
111 }
112 },
113 Action {
114 text: i18n.tr("Change difficulty to Ultra Hard")
115 keywords: i18n.tr("Change difficulty to Ultra Hard")
116 onTriggered: {
117 tabs.selectedTabIndex = 0
118 difficultySelector.selectedIndex = 3
119 var randomnumber = Math.floor(Math.random()*3);
120 randomnumber += 17;
121 sudokuBlocksGrid.createNewGame(81 - randomnumber);
122 Settings.setSetting("Difficulty", 3)
123 createNewGame()
124 }
125 },
126 Action {
127 text: i18n.tr("Change theme to Simple")
128 keywords: i18n.tr("Change theme to Simple")
129 onTriggered: {
130 //print("Simple")
131 var result = Settings.setSetting("ColorTheme", 1);
132 //print(result);
133 sudokuBlocksGrid.changeColorScheme("ColorSchemeSimple.qml");
134 }
135 },
136 Action {
137 text: i18n.tr("Change theme to UbuntuColors")
138 keywords: i18n.tr("Change theme to UbuntuColors")
139 onTriggered: {
140 print("UbuntuColors")
141 var result = Settings.setSetting("ColorTheme", 0);
142 //print(result);
143 sudokuBlocksGrid.changeColorScheme("ColorSchemeUbuntu.qml");
144 }
145 },
146 Action {
147 text: i18n.tr("Show scores for all users")
148 keywords: i18n.tr("Show scores for all users")
149 onTriggered: {
150 tabs.selectedTabIndex = 1
151 var allScores = Settings.getAllScores()
152 highscoresModel.clear();
153 highscoresHeaderText = i18n.tr("<b>Best scores for all players</b>");
154 for(var i = 0; i < allScores.length; i++) {
155 var rowItem = allScores[i];
156 //print("ROW ",rowItem)
157 var firstName = Settings.getUserFirstName(rowItem[1]);
158 var lastName = Settings.getUserLastName(rowItem[1]);
159 //res.push([dbItem.first_name, dbItem.last_name, dbItem.score])
160 highscoresModel.append({ 'id': rowItem[0],
161 'firstname': firstName,
162 'lastname': lastName,
163 'score': rowItem[2] });
164 }
165 }
166 },
167 Action {
168 text: i18n.tr("Show scores for current user")
169 keywords: i18n.tr("Show scores for current user")
170 onTriggered: {
171 tabs.selectedTabIndex = 1
172 var firstName = Settings.getUserFirstName(currentUserId);
173 var lastName = Settings.getUserLastName(currentUserId);
174 //print(firstName, lastName)
175 // TRANSLATORS: %1 is user's first name and %2 is last name
176 highscoresHeaderText = "<b>" + i18n.tr("Best scores for %1 %2").arg(firstName).arg(lastName) + "</b>"
177 var allScores = Settings.getAllScoresForUser(currentUserId)
178 highscoresModel.clear();
179 for(var i = 0; i < allScores.length; i++) {
180 var rowItem = allScores[i];
181 //res.push([dbItem.first_name, dbItem.last_name, dbItem.score])
182 highscoresModel.append({'firstname': firstName,
183 'lastname': lastName,
184 'score': rowItem[1] });
185 }
186 }
187 }
188 ]
189 //}
190 //}
191
192 onCurrentUserIdChanged: {34 onCurrentUserIdChanged: {
193 Settings.setSetting("currentUserId", currentUserId)35 Settings.setSetting("currentUserId", currentUserId)
194 }36 }
@@ -214,7 +56,7 @@
214 /*highscoresModel.append({'firstname': firstName,56 /*highscoresModel.append({'firstname': firstName,
215 'lastname': lastName,57 'lastname': lastName,
216 'score': rowItem[1] });*/58 'score': rowItem[1] });*/
217 hsPage.appendModel({ 'id': rowItem[0],59 highscoresTab.appendModel({ 'id': rowItem[0],
218 'firstname': firstName,60 'firstname': firstName,
219 'lastname': lastName,61 'lastname': lastName,
220 'score': rowItem[2] });62 'score': rowItem[2] });
@@ -223,7 +65,7 @@
223 }65 }
22466
225 function revealHint() {67 function revealHint() {
226 if(disableHints.checked)68 if(settingsTab.disableHintsChecked)
227 {69 {
228 sudokuBlocksGrid.revealHint();70 sudokuBlocksGrid.revealHint();
229 sudokuBlocksGrid.checkIfCheating = true;71 sudokuBlocksGrid.checkIfCheating = true;
@@ -234,13 +76,9 @@
234 + sudokuBlocksGrid.calculateScore()76 + sudokuBlocksGrid.calculateScore()
235 + " " + i18n.tr("point.","points.",1)77 + " " + i18n.tr("point.","points.",1)
23678
237 // print (sudokuBlocksGrid.numberOfActions)
238 // print (sudokuBlocksGrid.numberOfHints)
239 // print (sudokuBlocksGrid.gameSeconds)
240 // print (sudokuBlocksGrid.gameDifficulty)
241 var allScores = Settings.getAllScores()79 var allScores = Settings.getAllScores()
242 //highscoresModel.clear();80 //highscoresModel.clear();
243 hsPage.clearModel()81 highscoresTab.clearModel()
244 highscoresHeaderText = i18n.tr("<b>Best scores for all players</b>");82 highscoresHeaderText = i18n.tr("<b>Best scores for all players</b>");
245 for(var i = 0; i < allScores.length; i++) {83 for(var i = 0; i < allScores.length; i++) {
246 var rowItem = allScores[i];84 var rowItem = allScores[i];
@@ -251,7 +89,7 @@
251 /*highscoresModel.append({'firstname': firstName,89 /*highscoresModel.append({'firstname': firstName,
252 'lastname': lastName,90 'lastname': lastName,
253 'score': rowItem[1] });*/91 'score': rowItem[1] });*/
254 hsPage.appendModel({ 'id': rowItem[0],92 highscoresTab.appendModel({ 'id': rowItem[0],
255 'firstname': firstName,93 'firstname': firstName,
256 'lastname': lastName,94 'lastname': lastName,
257 'score': rowItem[2] });95 'score': rowItem[2] });
@@ -263,7 +101,7 @@
263 }101 }
264102
265 function createNewGame() {103 function createNewGame() {
266 switch(difficultySelector.selectedIndex) {104 switch(settingsTab.difficultyIndex) {
267 case 0:105 case 0:
268 var randomnumber = Math.floor(Math.random()*9);106 var randomnumber = Math.floor(Math.random()*9);
269 randomnumber += 31;107 randomnumber += 31;
@@ -419,8 +257,6 @@
419 }257 }
420 }258 }
421259
422
423
424 Column {260 Column {
425 spacing: units.gu(5)261 spacing: units.gu(5)
426262
@@ -624,7 +460,7 @@
624 if (settingsTab.difficultyIndex < 0)460 if (settingsTab.difficultyIndex < 0)
625 settingsTab.difficultyIndex = 0461 settingsTab.difficultyIndex = 0
626 //print(settingsTab.difficultyIndex)462 //print(settingsTab.difficultyIndex)
627 //print(Settings.getSetting("DisableHints"));463 //print(Settings.getSetting("settingsTab.disableHints"));
628 settingsTab.disableHintsChecked = Settings.getSetting("DisableHints") == "true" ? true : false;464 settingsTab.disableHintsChecked = Settings.getSetting("DisableHints") == "true" ? true : false;
629 settingsTab.disableVibrationsChecked = Settings.getSetting("DisableVibrations") == "true" ? true : false;465 settingsTab.disableVibrationsChecked = Settings.getSetting("DisableVibrations") == "true" ? true : false;
630 settingsTab.themeIndex = parseInt(Settings.getSetting("ColorTheme"));466 settingsTab.themeIndex = parseInt(Settings.getSetting("ColorTheme"));
@@ -658,7 +494,7 @@
658 /*highscoresModel.append({'firstname': firstName,494 /*highscoresModel.append({'firstname': firstName,
659 'lastname': lastName,495 'lastname': lastName,
660 'score': rowItem[1] });*/496 'score': rowItem[1] });*/
661 hsPage.appendModel({ 'id': rowItem[0],497 highscoresTab.appendModel({ 'id': rowItem[0],
662 'firstname': firstName,498 'firstname': firstName,
663 'lastname': lastName,499 'lastname': lastName,
664 'score': rowItem[2] })500 'score': rowItem[2] })
@@ -670,7 +506,7 @@
670 {506 {
671 currentUserId = Settings.getSetting("currentUserId")507 currentUserId = Settings.getSetting("currentUserId")
672 }508 }
673 if (difficultySelector.selectedIndex == 4) {509 if (settingsTab.difficultyIndex === 4) {
674 PopupUtils.open(newGameComponent)510 PopupUtils.open(newGameComponent)
675 }511 }
676512
@@ -680,13 +516,15 @@
680 id: tabs516 id: tabs
681 anchors.fill: parent517 anchors.fill: parent
682518
519 TabsList {
520 id: tabsList
521 }
522
683 // First tab begins here523 // First tab begins here
684 Tab {524 Tab {
685 id: mainTab;525 id: mainTab;
686 objectName: "MainTab"526 objectName: "MainTab"
687527
688 title: i18n.tr("Sudoku")
689
690 Timer {528 Timer {
691 id: winTimer;529 id: winTimer;
692 interval: 2000;530 interval: 2000;
@@ -694,7 +532,7 @@
694 repeat: false;532 repeat: false;
695 onTriggered: {533 onTriggered: {
696 gameFinishedRectangle.visible = false;534 gameFinishedRectangle.visible = false;
697 switch(difficultySelector.selectedIndex) {535 switch(settingsTab.difficultyIndex) {
698 case 0:536 case 0:
699 var randomnumber = Math.floor(Math.random()*9);537 var randomnumber = Math.floor(Math.random()*9);
700 randomnumber += 31;538 randomnumber += 31;
@@ -725,18 +563,13 @@
725563
726 UbuntuShape {564 UbuntuShape {
727 id: gameFinishedRectangle;565 id: gameFinishedRectangle;
728 color: "black";566 backgroundColor: "black";
729 opacity: 0.8567 opacity: 0.8
730 //border.color: sudokuBlocksGrid.defaultBorderColor;
731 width: mainView.width568 width: mainView.width
732 radius: "medium"569 radius: "medium"
733 height: mainView.height*1.3570 height: mainView.height*1.3
734 z: 100;571 z: 100;
735 visible: false;572 visible: false;
736 //x: mainView.width / 2 - width/2;
737 //y: mainView.weight / 2 - height/2;
738 //anchors.verticalCenter: mainView.verticalCenter;
739 //anchors.horizontalCenter: mainView.verticalCenter;
740 anchors.centerIn: parent;573 anchors.centerIn: parent;
741 //y: units.gu(5);574 //y: units.gu(5);
742 Label {575 Label {
@@ -751,421 +584,78 @@
751 }584 }
752585
753 page: Page {586 page: Page {
587 id: mainPage
588
589 header: PageHeader {
590 title: i18n.tr("Sudoku")
591
592 leadingActionBar {
593 numberOfSlots: 0
594 actions: tabsList.actions
595 }
596
597 trailingActionBar.actions: [
598 Action {
599 objectName: "newgamebutton"
600 text: i18n.tr("New game");
601 iconSource: Qt.resolvedUrl("icons/new_game_ubuntu.svg")
602 onTriggered: {
603 if(gameFinishedRectangle.visible) gameFinishedRectangle.visible = false;
604 //createNewGame()
605 if (settingsTab.difficultyIndex == 4)
606 PopupUtils.open(newGameComponent)
607 else {
608 createNewGame()
609 }
610 }
611 },
612 Action {
613 objectName: "hintbutton"
614 id: revealHintAction
615 iconSource: Qt.resolvedUrl("icons/hint.svg")
616 text: i18n.tr("Show hint");
617 enabled: settingsTab.disableHintsChecked
618 onTriggered: {
619 revealHint()
620 }
621 }
622 ]
623 }
754624
755 BottomEdgeSlide {625 BottomEdgeSlide {
756 z:2626 z:2
757 hintIconName: "help-contents"627 hintIconName: "help-contents"
758 }628 }
759629
760 head.actions: [
761 Action {
762 objectName: "newgamebutton"
763 text: i18n.tr("New game");
764 iconSource: Qt.resolvedUrl("icons/new_game_ubuntu.svg")
765 onTriggered: {
766 if(gameFinishedRectangle.visible) gameFinishedRectangle.visible = false;
767 //print("new block distance:", blockDistance);
768 //createNewGame()
769 if (settingsTab.difficultyIndex == 4)
770 PopupUtils.open(newGameComponent)
771 else {
772 createNewGame()
773 }
774 }
775 },
776 Action {
777 objectName: "hintbutton"
778 id: revealHintAction
779 iconSource: Qt.resolvedUrl("icons/hint.svg")
780 text: i18n.tr("Show hint");
781 enabled: disableHints.checked;
782 onTriggered: {
783 revealHint()
784 }
785 }
786 ]
787
788 //Column {
789 // id: mainColumn;
790 //width: mainView.width;
791 //height: mainView.height;
792 //anchors.left: parent.left;
793 //anchors.leftMargin: units.dp(3)
794 //anchors.fill: parent
795 //spacing: units.gu(5)
796
797 SudokuBlocksGrid {630 SudokuBlocksGrid {
798 id: sudokuBlocksGrid;631 id: sudokuBlocksGrid;
799 objectName: "blockgrid"632 objectName: "blockgrid"
800 //x: units.dp(3)
801 x: !mainView.wideAspect() ? 0.5*(mainView.width-9*sudokuBlocksGrid.blockSize-633 x: !mainView.wideAspect() ? 0.5*(mainView.width-9*sudokuBlocksGrid.blockSize-
802 22*sudokuBlocksGrid.blockDistance) :634 22*sudokuBlocksGrid.blockDistance) :
803 0.25*(mainView.width-9*sudokuBlocksGrid.blockSize-635 0.25*(mainView.width-9*sudokuBlocksGrid.blockSize-
804 22*sudokuBlocksGrid.blockDistance)636 22*sudokuBlocksGrid.blockDistance)
805637
806 y: !mainView.wideAspect() ? units.gu(1) : mainView.height*0.05638 y: !mainView.wideAspect() ? mainPage.header.height : mainView.height*0.05
807639
808 }640 }
809
810 //}
811 }641 }
812
813 }642 }
814643
815 // Highscores Tab644 // Highscores Tab
816645 HighscoresTab {
817 Tab {
818 id: highscoresTab646 id: highscoresTab
819 objectName: "highscoresTab"647 objectName: "highscoresTab"
820 title: i18n.tr("Scores")
821 page: HighscoresTab{ id: hsPage }
822 }648 }
823649
824
825
826 // settingsTab650 // settingsTab
827 Tab {651 SettingsTab {
828 id: settingsTab;652 id: settingsTab
829 objectName: "settingsTab"653 objectName: "settingsTab"
830 title: i18n.tr("Settings")
831
832 property alias disableHintsChecked: disableHints.checked;
833 property alias disableVibrationsChecked: disableVibrations.checked;
834 property alias difficultyIndex: difficultySelector.selectedIndex;
835 property alias themeIndex: themeSelector.selectedIndex;
836
837 page: Page {
838 objectName: "settingsPage"
839
840 anchors {
841 left: parent.left
842 right: parent.right
843 top: parent.top
844 }
845 height: mainView.height
846
847
848 Component {
849 id: profileSelector
850 Dialog {
851 objectName: "selectProfileDialog"
852 title: i18n.tr("Select profile")
853
854 Column{
855 height: mainColumnSettings.height*2/3
856 ListView {
857
858 id: profileListView
859 objectName: "profileListView"
860 clip: true
861 width: parent.width
862 height: parent.height - units.gu(12)
863 model: profilesModel
864
865 delegate:
866 ListItem.Standard {
867 text: firstname + " " + lastname
868 progression: true
869 onTriggered: {
870 //console.log("clicked "+index)
871 currentUserId = profileId;
872 hide()
873 }
874 }
875
876 }
877
878 SudokuDialogButton{
879 anchors.horizontalCenter: parent.horizontalCenter
880 id:cancelButton
881 buttonText: i18n.tr("Cancel")
882 width: parent.width/2;
883 size: units.gu(5)
884 buttonColor: sudokuBlocksGrid.dialogButtonColor1
885 textColor: sudokuBlocksGrid.dialogButtonTextColor
886 //border.color: "transparent"
887 onTriggered: {
888 hide()
889 }
890 }
891
892 }
893 }
894 }
895
896 Component {
897 id: manageProfileSelector
898 Dialog {
899 objectName: "manageProfileDialog"
900 title: i18n.tr("Select profile")
901
902 Column{
903 height: mainColumnSettings.height*2/3
904 ListView {
905 id: manageProfileListView
906 objectName: "manageProfileListView"
907 clip: true
908 width: parent.width
909 height: parent.height - units.gu(12)
910 model: profilesModel
911
912 delegate:
913
914 ListItem.Standard {
915 text: firstname + " " + lastname
916
917 progression: true
918 onTriggered: {
919 hide()
920 editUserId = profileId
921 PopupUtils.open(manageProfileDialog, selectorProfile)
922 }
923 }
924
925
926
927 }
928 SudokuDialogButton{
929
930 anchors.horizontalCenter: parent.horizontalCenter
931 id:cancelButton
932 objectName: "cancelButton"
933 buttonText: i18n.tr("Cancel")
934 width: parent.width/2;
935 size: units.gu(5)
936 buttonColor: sudokuBlocksGrid.dialogButtonColor1
937 textColor: sudokuBlocksGrid.dialogButtonTextColor
938 //border.color: "transparent"
939 onTriggered: {
940 hide()
941 }
942 }
943 }
944 }
945 }
946
947 ListModel{
948 id: profilesModel
949 }
950
951 //id: mainColumnSettings;
952 //width: settingsTab.width;
953 //height: settingsTab.height;
954 //anchors.fill: parent
955 //anchors.horizontalCenter: parent.horizontalCenter;
956 //spacing: units.gu(1)
957 Flickable {
958 id: flickableSettings
959 anchors.fill: parent
960 //height: parent.height - units.gu(10)
961 //width: parent.width
962 flickableDirection: Flickable.VerticalFlick
963 //clip: true
964 objectName: "settingsContainer"
965 Column {
966 id: mainColumnSettings;
967 //anchors.fill: parent
968 height: parent.height
969 width: parent.width
970 spacing: units.gu(1)
971
972 ListItem.Header {
973 text: i18n.tr("<b>Sudoku settings</b>")
974 }
975
976 OptionSelector {
977 objectName: "difficultySelector"
978 id: difficultySelector
979 text: i18n.tr("Default Difficulty")
980 width: parent.width - units.gu(4)
981 anchors.horizontalCenter: parent.horizontalCenter
982 model: [i18n.tr("Easy"), i18n.tr("Moderate"), i18n.tr("Hard"), i18n.tr("Ultra Hard"), i18n.tr("Always ask")]
983 onSelectedIndexChanged: {
984 //print(difficultySelector.selectedIndex)
985 switch(difficultySelector.selectedIndex) {
986 case 0:
987 var randomnumber = Math.floor(Math.random()*9);
988 randomnumber += 31;
989 sudokuBlocksGrid.createNewGame(81 - randomnumber);
990 Settings.setSetting("Difficulty", selectedIndex)
991 sudokuBlocksGrid.gameDifficulty = 0
992 break;
993 case 1:
994 var randomnumber = Math.floor(Math.random()*4);
995 randomnumber += 26;
996 sudokuBlocksGrid.createNewGame(81 - randomnumber);
997 Settings.setSetting("Difficulty", selectedIndex)
998 sudokuBlocksGrid.gameDifficulty = 1
999 break;
1000 case 2:
1001 var randomnumber = Math.floor(Math.random()*4);
1002 randomnumber += 21;
1003 sudokuBlocksGrid.createNewGame(81 - randomnumber);
1004 Settings.setSetting("Difficulty", selectedIndex)
1005 sudokuBlocksGrid.gameDifficulty = 2
1006 break;
1007 case 3:
1008 var randomnumber = Math.floor(Math.random()*3);
1009 randomnumber += 17;
1010 sudokuBlocksGrid.createNewGame(81 - randomnumber);
1011 Settings.setSetting("Difficulty", selectedIndex)
1012 sudokuBlocksGrid.gameDifficulty = 3
1013 break;
1014 case 4:
1015 Settings.setSetting("Difficulty", selectedIndex)
1016 break;
1017 }
1018 }
1019
1020 }
1021 OptionSelector {
1022 objectName: "themeSelector"
1023 id: themeSelector
1024 text: i18n.tr("Theme")
1025 model: ["UbuntuColours", "Simple"]
1026 width: parent.width - units.gu(4)
1027 anchors.horizontalCenter: parent.horizontalCenter
1028 onSelectedIndexChanged: {
1029 var newColorScheme = null;
1030 if (selectedIndex == 0)
1031 {
1032 //print("Ubuntu")
1033 var result = Settings.setSetting("ColorTheme", selectedIndex);
1034 //print(result);
1035 sudokuBlocksGrid.changeColorScheme("ColorSchemeUbuntu.qml");
1036 }
1037 if (selectedIndex == 1)
1038 {
1039 //print("Simple")
1040 var result = Settings.setSetting("ColorTheme", selectedIndex);
1041 //print(result);
1042 sudokuBlocksGrid.changeColorScheme("ColorSchemeSimple.qml");
1043 }
1044 }
1045 Component.onCompleted: selectedIndex = 0
1046 }
1047
1048 ListItem.Standard {
1049 objectName: "hintsSwitchClickable"
1050 text: i18n.tr("Hints")
1051 width: parent.width
1052 control: Switch {
1053 objectName: "hintsSwitch"
1054 id: disableHints
1055 anchors.horizontalCenter: parent.horizontalCenter
1056 anchors.verticalCenter: parent.verticalCenter
1057 checked: disableHintsChecked
1058 onCheckedChanged: {
1059 var result = Settings.setSetting("DisableHints", checked ? "true":"false");
1060 //print(result);
1061 }
1062 }
1063 }
1064 ListItem.Standard {
1065 objectName: "vibrationsSwitchClickable"
1066 text: i18n.tr("Vibration Alerts")
1067 width: parent.width
1068 control: Switch {
1069 objectName: "vibrationsSwitch"
1070 id: disableVibrations
1071 anchors.horizontalCenter: parent.horizontalCenter
1072 anchors.verticalCenter: parent.verticalCenter
1073 checked: disableVibrationsChecked
1074 onCheckedChanged: {
1075 var result = Settings.setSetting("DisableVibrations", checked ? "true":"false");
1076 //print(result);
1077 }
1078 }
1079 }
1080 ListItem.Divider {}
1081
1082 ListItem.Header {
1083 text: i18n.tr("<b>Profiles settings</b>")
1084 }
1085 ListItem.SingleValue {
1086 objectName: "Current profile"
1087 text: i18n.tr("Current profile")
1088 id: selectorProfile
1089 value: {
1090 if(currentUserId==-1)
1091 return i18n.tr("None")
1092 else
1093 return Settings.getUserFirstName(currentUserId)+" "+Settings.getUserLastName(currentUserId);
1094
1095 }
1096
1097 Component.onCompleted:
1098 currentUserId = Settings.getSetting("currentUserId")
1099
1100 onClicked: {
1101
1102 var allProfiles = new Array();
1103 allProfiles = Settings.getAllProfiles()
1104
1105 profilesModel.clear()
1106
1107 for(var i = 0; i < allProfiles.length; i++)
1108 {
1109 profilesModel.append({"profileId":allProfiles[i].id,"lastname":allProfiles[i].lastname, "firstname":allProfiles[i].firstname})
1110 }
1111 PopupUtils.open(profileSelector, selectorProfile)
1112 }
1113 }
1114
1115 AddProfileDialog{
1116 id:addProfileDialog
1117 }
1118
1119 ManageProfileDialog{
1120 id:manageProfileDialog
1121 }
1122
1123
1124 ListItem.SingleValue {
1125 objectName: "Add profile"
1126 id:addSingleValue
1127 text: i18n.tr("Add profile")
1128 onClicked: {
1129 PopupUtils.open(addProfileDialog, addSingleValue);
1130 }
1131 }
1132
1133 ListItem.SingleValue {
1134 objectName: "Manage profiles"
1135 id:manageProfileSingleValue
1136 text: i18n.tr("Manage profiles")
1137 onClicked: {
1138
1139 var allProfiles = new Array();
1140 allProfiles = Settings.getAllProfiles()
1141
1142 profilesModel.clear()
1143
1144 for(var i = 0; i < allProfiles.length; i++)
1145 {
1146 profilesModel.append({"profileId":allProfiles[i].id,"lastname":allProfiles[i].lastname, "firstname":allProfiles[i].firstname})
1147 }
1148
1149 PopupUtils.open(manageProfileSelector, manageProfileSingleValue)
1150 }
1151 }
1152 }
1153 }
1154
1155 Scrollbar {
1156 flickableItem: flickableSettings
1157 align: Qt.AlignTrailing
1158 }
1159 }
1160
1161
1162 }654 }
1163655
1164
1165 AboutTab {656 AboutTab {
1166 id: aboutTab657 id: aboutTab
1167 objectName: "aboutTab"658 objectName: "aboutTab"
1168 title: i18n.tr("About")
1169 }659 }
1170 }660 }
1171}661}

Subscribers

People subscribed via source and target branches