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
1=== modified file 'click/manifest.json.in'
2--- click/manifest.json.in 2015-07-15 16:14:23 +0000
3+++ click/manifest.json.in 2016-02-28 17:36:02 +0000
4@@ -1,7 +1,7 @@
5 {
6 "architecture": "all",
7 "description": "Sudoku game for Ubuntu devices.",
8- "framework": "ubuntu-sdk-15.04",
9+ "framework": "ubuntu-sdk-15.04.3-qml",
10 "hooks": {
11 "sudoku": {
12 "apparmor": "sudoku.apparmor",
13@@ -12,7 +12,7 @@
14 "maintainer": "Ubuntu Core Apps Developers <ubuntu-touch-coreapps@lists.launchpad.net>",
15 "name": "@PROJECT_NAME@",
16 "title": "Sudoku",
17- "version": "1.1.@BZR_REVNO@",
18+ "version": "1.6.@BZR_REVNO@",
19 "x-source": {
20 "vcs-bzr": "@BZR_SOURCE@",
21 "vcs-bzr-revno": "@BZR_REVNO@"
22
23=== modified file 'components/AboutTab.qml'
24--- components/AboutTab.qml 2015-07-16 11:29:03 +0000
25+++ components/AboutTab.qml 2016-02-28 17:36:02 +0000
26@@ -1,18 +1,26 @@
27-import QtQuick 2.3
28-import Ubuntu.Components 1.1
29-import Ubuntu.Components.ListItems 1.0 as ListItem
30+import QtQuick 2.4
31+import Ubuntu.Components 1.3
32 import QtQuick.LocalStorage 2.0
33-import Ubuntu.Components.Popups 1.0
34+import Ubuntu.Components.Popups 1.3
35 import Ubuntu.Layouts 1.0
36 import "../js/localStorage.js" as Settings
37 import "../components"
38-//import Ubuntu.HUD 1.0 as HUD
39-import Ubuntu.Unity.Action 1.1 as UnityActions
40-import UserMetrics 0.1
41
42 Tab {
43+ id: aboutTab
44 objectName: "aboutTab"
45+
46 page: Page {
47+ id: aboutPage
48+
49+ header: PageHeader {
50+ title: i18n.tr("About")
51+ leadingActionBar {
52+ numberOfSlots: 0
53+ actions: tabsList.actions
54+ }
55+ }
56+
57 Layouts {
58 id: aboutTabLayout
59 width: mainView.width
60@@ -31,14 +39,15 @@
61
62 }
63 spacing: units.gu(5)
64+
65 ItemLayout {
66 item: "icon"
67 id: iconTabletItem
68 property real maxWidth: units.gu(80)
69 width: Math.min(parent.width, maxWidth)/2
70 height: Math.min(parent.width, maxWidth)/2
71+ }
72
73- }
74 Column {
75 //height: iconTabletItem.height
76 spacing: 1
77@@ -65,17 +74,15 @@
78 }
79 }
80 }
81-
82-
83 ]
84
85 Column {
86 id: aboutColumn;
87+
88 spacing: units.gu(3)
89- //anchors.fill: parent
90- //anchors.horizontalCenter: parent.horizontalCenter;
91 width: parent.width
92 y: units.gu(6);
93+
94 Rectangle {
95 Layouts.item: "icon"
96 property real maxWidth: units.gu(45)
97@@ -89,15 +96,16 @@
98 smooth: true
99 anchors.fill: parent
100 fillMode: Image.PreserveAspectFit
101-
102 }
103 }
104+
105 Grid {
106 anchors.horizontalCenter: parent.horizontalCenter
107 columns: 2
108 rowSpacing: units.gu(2)
109 columnSpacing: mainView.width/10
110 Layouts.item: "info"
111+
112 Label {
113 objectName: "authorLabel"
114 text: i18n.tr("Author(s): ")
115@@ -117,7 +125,6 @@
116 font.bold: true;
117 text: "dinko.metalac@gmail.com"
118 }
119-
120 }
121
122 Row {
123@@ -131,6 +138,7 @@
124 onLinkActivated: Qt.openUrlExternally(link)
125 }
126 }
127+
128 Row {
129 anchors.horizontalCenter: parent.horizontalCenter;
130 Layouts.item: "version"
131@@ -141,22 +149,20 @@
132 Label {
133 objectName: "version"
134 font.bold: true;
135- text: "1.5"
136+ text: "1.6"
137 }
138 }
139+
140 Row {
141 Layouts.item: "year"
142 anchors.horizontalCenter: parent.horizontalCenter;
143 Label {
144 objectName: "yearLabel"
145 font.bold: true;
146- text: "2013"
147-
148-
149+ text: "2016"
150 }
151 }
152 }
153-
154 }
155 }
156 }
157
158=== modified file 'components/AddProfileDialog.qml'
159--- components/AddProfileDialog.qml 2014-10-06 12:41:09 +0000
160+++ components/AddProfileDialog.qml 2016-02-28 17:36:02 +0000
161@@ -1,6 +1,6 @@
162-import QtQuick 2.3
163-import Ubuntu.Components 1.1
164-import Ubuntu.Components.Popups 1.0
165+import QtQuick 2.4
166+import Ubuntu.Components 1.3
167+import Ubuntu.Components.Popups 1.3
168 import "../js/localStorage.js" as Settings
169 import QtQuick.LocalStorage 2.0
170
171
172=== modified file 'components/BigBlock.qml'
173--- components/BigBlock.qml 2015-07-16 11:29:03 +0000
174+++ components/BigBlock.qml 2016-02-28 17:36:02 +0000
175@@ -1,6 +1,6 @@
176-import QtQuick 2.3
177-import Ubuntu.Components 1.1
178-import Ubuntu.Components.Popups 1.0
179+import QtQuick 2.4
180+import Ubuntu.Components 1.3
181+import Ubuntu.Components.Popups 1.3
182 import "../js/SudokuCU.js" as SudokuCU
183 import QtFeedback 5.0
184
185
186=== modified file 'components/BottomEdge.qml'
187--- components/BottomEdge.qml 2015-07-16 11:29:03 +0000
188+++ components/BottomEdge.qml 2016-02-28 17:36:02 +0000
189@@ -1,6 +1,6 @@
190 import QtQuick 2.2
191 import QtFeedback 5.0
192-import Ubuntu.Components 1.1
193+import Ubuntu.Components 1.3
194
195 Item {
196 id: bottomEdge
197
198=== modified file 'components/BottomEdgeSlide.qml'
199--- components/BottomEdgeSlide.qml 2015-07-16 11:29:03 +0000
200+++ components/BottomEdgeSlide.qml 2016-02-28 17:36:02 +0000
201@@ -1,6 +1,6 @@
202 import QtQuick 2.2
203 import QtFeedback 5.0
204-import Ubuntu.Components 1.1
205+import Ubuntu.Components 1.3
206
207 Item {
208 id: bottomEdge
209
210=== modified file 'components/ColorSchemeDefault.qml'
211--- components/ColorSchemeDefault.qml 2015-02-23 07:44:43 +0000
212+++ components/ColorSchemeDefault.qml 2016-02-28 17:36:02 +0000
213@@ -1,5 +1,5 @@
214-import QtQuick 2.3
215-import Ubuntu.Components 1.1
216+import QtQuick 2.4
217+import Ubuntu.Components 1.3
218
219 Item {
220
221
222=== modified file 'components/ColorSchemeSimple.qml'
223--- components/ColorSchemeSimple.qml 2014-11-08 11:58:23 +0000
224+++ components/ColorSchemeSimple.qml 2016-02-28 17:36:02 +0000
225@@ -1,5 +1,5 @@
226-import QtQuick 2.3
227-import Ubuntu.Components 1.1
228+import QtQuick 2.4
229+import Ubuntu.Components 1.3
230
231 Item {
232
233@@ -15,8 +15,5 @@
234 property color dialogButtonColor2: "white"
235 property color dialogButtonColor3: "white"
236 property color dialogButtonTextColor: UbuntuColors.orange
237- property color headerColor: "#2C001E"
238 property color backgroundColor: "#2C001E"
239- property color footerColor: "#5E2750"
240-
241 }
242
243=== modified file 'components/ColorSchemeUbuntu.qml'
244--- components/ColorSchemeUbuntu.qml 2015-02-23 07:44:43 +0000
245+++ components/ColorSchemeUbuntu.qml 2016-02-28 17:36:02 +0000
246@@ -1,8 +1,7 @@
247-import QtQuick 2.3
248-import Ubuntu.Components 1.1
249+import QtQuick 2.4
250+import Ubuntu.Components 1.3
251
252 Item {
253-
254 property color defaultColor: "transparent" // "#F5F5F5";
255 property color defaultStartingColor : UbuntuColors.lightAubergine;
256 property color defaultNotAllowedColor : UbuntuColors.darkAubergine;
257@@ -15,8 +14,5 @@
258 property color dialogButtonColor2: UbuntuColors.orange
259 property color dialogButtonColor3: "black"
260 property color dialogButtonTextColor: "white"
261- property color headerColor: "#F5F5F5"
262- property color backgroundColor: "#F5F5F5"
263- property color footerColor: "#F5F5F5"
264-
265+ property color backgroundColor: "#FFFFFF"
266 }
267
268=== modified file 'components/DialogButton.qml'
269--- components/DialogButton.qml 2014-10-06 12:41:09 +0000
270+++ components/DialogButton.qml 2016-02-28 17:36:02 +0000
271@@ -1,5 +1,5 @@
272-import QtQuick 2.3
273-import Ubuntu.Components 1.1
274+import QtQuick 2.4
275+import Ubuntu.Components 1.3
276
277 UbuntuShape {
278 id: button
279@@ -14,7 +14,7 @@
280 height: size;
281 width: size;
282 radius: "medium"
283- color: buttonColor
284+ backgroundColor: buttonColor
285 //border.color: Qt.darker(buttonColor,1.5)
286
287 Text {
288
289=== modified file 'components/HighscoresTab.qml'
290--- components/HighscoresTab.qml 2015-07-17 11:48:07 +0000
291+++ components/HighscoresTab.qml 2016-02-28 17:36:02 +0000
292@@ -1,16 +1,13 @@
293-import QtQuick 2.3
294-import Ubuntu.Components 1.2
295-//import Ubuntu.Components.ListItems 1.0 as ListItem
296+import QtQuick 2.4
297+import Ubuntu.Components 1.3
298 import QtQuick.LocalStorage 2.0
299-import Ubuntu.Components.Popups 1.0
300+import Ubuntu.Components.Popups 1.3
301 import Ubuntu.Layouts 1.0
302 import "../js/localStorage.js" as Settings
303 import "../components"
304-//import Ubuntu.HUD 1.0 as HUD
305-import Ubuntu.Unity.Action 1.1 as UnityActions
306-import UserMetrics 0.1
307
308-Page {
309+Tab {
310+ id: highScoresTab
311
312 function appendModel(item)
313 {
314@@ -27,40 +24,94 @@
315 for (var i = 0; i < highscoresModel.count; i++)
316 {
317 if (highscoresModel.get(i).firstname === firstName &&
318- highscoresModel.get(i).lastname === lastName )
319+ highscoresModel.get(i).lastname === lastName )
320 highscoresModel.remove(i);
321 }
322 }
323
324- BottomEdge {
325- z:2
326- hintIconName: "delete"
327- actions: [
328- RadialAction {
329- iconName: "contact"
330- iconColor: UbuntuColors.orange
331- onTriggered: {
332- Settings.deleteScoresWithProfileId(currentUserId)
333- highscoresModel.clearModelProfileId(currentUserId);
334- }
335- },
336- RadialAction {
337- iconName: "contact-group"
338- iconColor: UbuntuColors.orange
339- onTriggered: {
340- Settings.deleteAllScores();
341- highscoresModel.clear();
342- }
343+ Page {
344+ id: highScoresPage
345+
346+ header: PageHeader {
347+ title: i18n.tr("About")
348+ leadingActionBar {
349+ numberOfSlots: 0
350+ actions: tabsList.actions
351 }
352- ]
353- }
354-
355- head.actions: [
356- Action {
357- objectName: "allusersbutton"
358- text: "All\nusers"
359- iconSource: Qt.resolvedUrl("../icons/all-users.svg")
360- onTriggered: {
361+
362+ trailingActionBar.actions: [
363+ Action {
364+ objectName: "allusersbutton"
365+ text: "All\nusers"
366+ iconSource: Qt.resolvedUrl("../icons/all-users.svg")
367+ onTriggered: {
368+ var allScores = Settings.getAllScores()
369+ highscoresModel.clear();
370+ highscoresHeaderText = i18n.tr("<b>Best scores for all players</b>");
371+ for(var i = 0; i < allScores.length; i++) {
372+ var rowItem = allScores[i];
373+ //print("ROW ",rowItem)
374+ var firstName = Settings.getUserFirstName(rowItem[1]);
375+ var lastName = Settings.getUserLastName(rowItem[1]);
376+ //res.push([dbItem.first_name, dbItem.last_name, dbItem.score])
377+ highscoresModel.append({ 'id': rowItem[0],
378+ 'firstname': firstName,
379+ 'lastname': lastName,
380+ 'score': rowItem[2] });
381+ }
382+ }
383+ },
384+ Action {
385+ text: "Current\nuser"
386+ objectName: "currentuserbutton"
387+ iconSource: Qt.resolvedUrl("../icons/single-user.svg")
388+ onTriggered: {
389+ var firstName = Settings.getUserFirstName(currentUserId);
390+ var lastName = Settings.getUserLastName(currentUserId);
391+ //print(firstName, lastName)
392+ // TRANSLATORS: %1 is user's first name and %2 is last name
393+ highscoresHeaderText = "<b>" + i18n.tr("Best scores for %1 %2").arg(firstName).arg(lastName) + "</b>"
394+ var allScores = Settings.getAllScoresForUser(currentUserId)
395+ highscoresModel.clear();
396+ for(var i = 0; i < allScores.length; i++) {
397+ var rowItem = allScores[i];
398+ //res.push([dbItem.first_name, dbItem.last_name, dbItem.score])
399+ highscoresModel.append({'firstname': firstName,
400+ 'lastname': lastName,
401+ 'score': rowItem[1] });
402+ }
403+ }
404+ }
405+ ]
406+ }
407+
408+ BottomEdge {
409+ z:2
410+ hintIconName: "delete"
411+ actions: [
412+ RadialAction {
413+ iconName: "contact"
414+ iconColor: UbuntuColors.orange
415+ onTriggered: {
416+ Settings.deleteScoresWithProfileId(currentUserId)
417+ highscoresModel.clearModelProfileId(currentUserId);
418+ }
419+ },
420+ RadialAction {
421+ iconName: "contact-group"
422+ iconColor: UbuntuColors.orange
423+ onTriggered: {
424+ Settings.deleteAllScores();
425+ highscoresModel.clear();
426+ }
427+ }
428+ ]
429+ }
430+
431+ ListModel {
432+ id: highscoresModel
433+
434+ onDataChanged: {
435 var allScores = Settings.getAllScores()
436 highscoresModel.clear();
437 highscoresHeaderText = i18n.tr("<b>Best scores for all players</b>");
438@@ -76,91 +127,37 @@
439 'score': rowItem[2] });
440 }
441 }
442- },
443- Action {
444- text: "Current\nuser"
445- objectName: "currentuserbutton"
446- iconSource: Qt.resolvedUrl("../icons/single-user.svg")
447- onTriggered: {
448- var firstName = Settings.getUserFirstName(currentUserId);
449- var lastName = Settings.getUserLastName(currentUserId);
450- //print(firstName, lastName)
451- // TRANSLATORS: %1 is user's first name and %2 is last name
452- highscoresHeaderText = "<b>" + i18n.tr("Best scores for %1 %2").arg(firstName).arg(lastName) + "</b>"
453- var allScores = Settings.getAllScoresForUser(currentUserId)
454- highscoresModel.clear();
455- for(var i = 0; i < allScores.length; i++) {
456- var rowItem = allScores[i];
457- //res.push([dbItem.first_name, dbItem.last_name, dbItem.score])
458- highscoresModel.append({'firstname': firstName,
459- 'lastname': lastName,
460- 'score': rowItem[1] });
461- }
462- }
463- }
464-
465- //locked: true
466- //opened: true
467- ]
468-
469-
470- ListModel {
471- id: highscoresModel
472-
473- onDataChanged: {
474- var allScores = Settings.getAllScores()
475- highscoresModel.clear();
476- highscoresHeaderText = i18n.tr("<b>Best scores for all players</b>");
477- for(var i = 0; i < allScores.length; i++) {
478- var rowItem = allScores[i];
479- //print("ROW ",rowItem)
480- var firstName = Settings.getUserFirstName(rowItem[1]);
481- var lastName = Settings.getUserLastName(rowItem[1]);
482- //res.push([dbItem.first_name, dbItem.last_name, dbItem.score])
483- highscoresModel.append({ 'id': rowItem[0],
484- 'firstname': firstName,
485- 'lastname': lastName,
486- 'score': rowItem[2] });
487- }
488- }
489-
490- /*ListElement {
491- firstname: "Bill"
492- lastname: "Smith"
493- score: "120"
494- }
495- ListElement {
496- firstname: "John"
497- lastname: "Brown"
498- score: "130"
499- }*/
500- }
501- Column {
502- anchors.fill: parent
503- clip: true
504+ }
505+
506 UbuntuListView {
507 id: highScoresListView
508+
509+ anchors {
510+ top: highScoresPage.header.bottom
511+ topMargin: units.gu(2)
512+ left: parent.left
513+ right: parent.right
514+ bottom: parent.bottom
515+ }
516+
517 model: highscoresModel
518- width: parent.width
519- height:parent.height
520
521 header: Label {
522 id: highscoresHeader
523 objectName: "highscoreslabel"
524 text: highscoresHeaderText
525 height: units.gu(5)
526+ anchors.left: parent.left
527+ anchors.leftMargin: units.gu(2)
528 }
529
530 delegate: ListItem {
531- Label {
532- anchors.left: parent.left
533- anchors.leftMargin: units.gu(1)
534- text: (index+1) + ". " + firstname + " " + lastname
535- }
536- Label {
537- anchors.right: parent.right
538- anchors.rightMargin: units.gu(1)
539- text: score
540+ ListItemLayout {
541+ title.text: "%1. %2 %3".arg(index+1).arg(firstname).arg(lastname)
542+ Label {
543+ SlotsLayout.position: SlotsLayout.Last
544+ text: score
545+ }
546 }
547
548 leadingActions: ListItemActions {
549@@ -168,17 +165,14 @@
550 Action {
551 iconName: "delete"
552 onTriggered: {
553- //print(index, id, firstname);
554 Settings.deleteScoreWithId(id);
555 highscoresModel.remove(index,1);
556 }
557 }
558 ]
559 }
560- //value: score
561 }
562 }
563 }
564 }
565
566-
567
568=== modified file 'components/ManageProfileDialog.qml'
569--- components/ManageProfileDialog.qml 2014-10-06 12:41:09 +0000
570+++ components/ManageProfileDialog.qml 2016-02-28 17:36:02 +0000
571@@ -1,6 +1,6 @@
572-import QtQuick 2.3
573-import Ubuntu.Components 1.1
574-import Ubuntu.Components.Popups 1.0
575+import QtQuick 2.4
576+import Ubuntu.Components 1.3
577+import Ubuntu.Components.Popups 1.3
578 import "../js/localStorage.js" as Settings
579 import QtQuick.LocalStorage 2.0
580
581
582=== modified file 'components/NewGameSelectionButton.qml'
583--- components/NewGameSelectionButton.qml 2014-10-06 12:41:09 +0000
584+++ components/NewGameSelectionButton.qml 2016-02-28 17:36:02 +0000
585@@ -1,6 +1,6 @@
586-import QtQuick 2.3
587-import Ubuntu.Components 1.1
588-import Ubuntu.Components.Popups 1.0
589+import QtQuick 2.4
590+import Ubuntu.Components 1.3
591+import Ubuntu.Components.Popups 1.3
592
593 UbuntuShape {
594 id: gameDifficultyButton
595
596=== modified file 'components/RadialAction.qml'
597--- components/RadialAction.qml 2015-07-16 11:29:03 +0000
598+++ components/RadialAction.qml 2016-02-28 17:36:02 +0000
599@@ -1,5 +1,5 @@
600 import QtQuick 2.0
601-import Ubuntu.Components 1.1
602+import Ubuntu.Components 1.3
603
604 Action {
605 property string iconName: "add"
606
607=== added file 'components/SettingsTab.qml'
608--- components/SettingsTab.qml 1970-01-01 00:00:00 +0000
609+++ components/SettingsTab.qml 2016-02-28 17:36:02 +0000
610@@ -0,0 +1,359 @@
611+import QtQuick 2.4
612+import Ubuntu.Components 1.3
613+import QtQuick.LocalStorage 2.0
614+import Ubuntu.Components.Popups 1.3
615+import Ubuntu.Layouts 1.0
616+import "../js/localStorage.js" as Settings
617+
618+Tab {
619+ id: settingsTab;
620+ objectName: "settingsTab"
621+
622+ property alias disableHintsChecked: disableHints.checked;
623+ property alias disableVibrationsChecked: disableVibrations.checked;
624+ property alias difficultyIndex: difficultySelector.selectedIndex;
625+ property alias themeIndex: themeSelector.selectedIndex;
626+
627+ page: Page {
628+ id: settingsPage
629+ objectName: "settingsPage"
630+
631+ anchors.fill: parent
632+
633+ header: PageHeader {
634+ flickable: flickableSettings
635+ title: i18n.tr("Settings")
636+ leadingActionBar {
637+ numberOfSlots: 0
638+ actions: tabsList.actions
639+ }
640+ }
641+
642+ Component {
643+ id: profileSelector
644+ Dialog {
645+ objectName: "selectProfileDialog"
646+ title: i18n.tr("Select profile")
647+
648+ Column{
649+ height: mainColumnSettings.height*2/3
650+ ListView {
651+
652+ id: profileListView
653+ objectName: "profileListView"
654+ clip: true
655+ width: parent.width
656+ height: parent.height - units.gu(12)
657+ model: profilesModel
658+
659+ delegate: ListItem {
660+ height: selectProfileLayout.height + divider.height
661+ ListItemLayout {
662+ id: selectProfileLayout
663+ title.text: firstname + " " + lastname
664+ ProgressionSlot {}
665+ }
666+ onClicked: {
667+ currentUserId = profileId;
668+ hide()
669+ }
670+ }
671+ }
672+
673+ SudokuDialogButton{
674+ anchors.horizontalCenter: parent.horizontalCenter
675+ id:cancelButton
676+ buttonText: i18n.tr("Cancel")
677+ width: parent.width/2;
678+ size: units.gu(5)
679+ buttonColor: sudokuBlocksGrid.dialogButtonColor1
680+ textColor: sudokuBlocksGrid.dialogButtonTextColor
681+ //border.color: "transparent"
682+ onTriggered: {
683+ hide()
684+ }
685+ }
686+
687+ }
688+ }
689+ }
690+
691+ Component {
692+ id: manageProfileSelector
693+ Dialog {
694+ objectName: "manageProfileDialog"
695+ title: i18n.tr("Select profile")
696+
697+ Column{
698+ height: mainColumnSettings.height*2/3
699+ ListView {
700+ id: manageProfileListView
701+ objectName: "manageProfileListView"
702+ clip: true
703+ width: parent.width
704+ height: parent.height - units.gu(12)
705+ model: profilesModel
706+
707+ delegate:ListItem {
708+ height: manageProfileLayout.height + divider.height
709+ ListItemLayout {
710+ id: manageProfileLayout
711+ title.text: firstname + " " + lastname
712+ ProgressionSlot {}
713+ }
714+ onClicked: {
715+ hide()
716+ editUserId = profileId
717+ PopupUtils.open(manageProfileDialog, selectorProfile)
718+ }
719+ }
720+ }
721+ SudokuDialogButton{
722+
723+ anchors.horizontalCenter: parent.horizontalCenter
724+ id:cancelButton
725+ objectName: "cancelButton"
726+ buttonText: i18n.tr("Cancel")
727+ width: parent.width/2;
728+ size: units.gu(5)
729+ buttonColor: sudokuBlocksGrid.dialogButtonColor1
730+ textColor: sudokuBlocksGrid.dialogButtonTextColor
731+ //border.color: "transparent"
732+ onTriggered: {
733+ hide()
734+ }
735+ }
736+ }
737+ }
738+ }
739+
740+ ListModel{
741+ id: profilesModel
742+ }
743+
744+ Flickable {
745+ id: flickableSettings
746+ objectName: "settingsContainer"
747+
748+ anchors.fill: parent
749+ contentHeight: mainColumnSettings.height
750+
751+ Column {
752+ id: mainColumnSettings;
753+
754+ height: childrenRect.height
755+ width: parent.width
756+ spacing: units.gu(1)
757+
758+ ListItem {
759+ height: sudokuSettingsLayout.height + divider.height
760+ ListItemLayout {
761+ id: sudokuSettingsLayout
762+ title.text: i18n.tr("Sudoku settings")
763+ title.font.weight: Font.DemiBold
764+ }
765+ }
766+
767+ OptionSelector {
768+ objectName: "difficultySelector"
769+ id: difficultySelector
770+ text: i18n.tr("Default Difficulty")
771+ width: parent.width - units.gu(4)
772+ anchors.horizontalCenter: parent.horizontalCenter
773+ model: [i18n.tr("Easy"), i18n.tr("Moderate"), i18n.tr("Hard"), i18n.tr("Ultra Hard"), i18n.tr("Always ask")]
774+ onSelectedIndexChanged: {
775+ //print(difficultySelector.selectedIndex)
776+ switch(difficultySelector.selectedIndex) {
777+ case 0:
778+ var randomnumber = Math.floor(Math.random()*9);
779+ randomnumber += 31;
780+ sudokuBlocksGrid.createNewGame(81 - randomnumber);
781+ Settings.setSetting("Difficulty", selectedIndex)
782+ sudokuBlocksGrid.gameDifficulty = 0
783+ break;
784+ case 1:
785+ var randomnumber = Math.floor(Math.random()*4);
786+ randomnumber += 26;
787+ sudokuBlocksGrid.createNewGame(81 - randomnumber);
788+ Settings.setSetting("Difficulty", selectedIndex)
789+ sudokuBlocksGrid.gameDifficulty = 1
790+ break;
791+ case 2:
792+ var randomnumber = Math.floor(Math.random()*4);
793+ randomnumber += 21;
794+ sudokuBlocksGrid.createNewGame(81 - randomnumber);
795+ Settings.setSetting("Difficulty", selectedIndex)
796+ sudokuBlocksGrid.gameDifficulty = 2
797+ break;
798+ case 3:
799+ var randomnumber = Math.floor(Math.random()*3);
800+ randomnumber += 17;
801+ sudokuBlocksGrid.createNewGame(81 - randomnumber);
802+ Settings.setSetting("Difficulty", selectedIndex)
803+ sudokuBlocksGrid.gameDifficulty = 3
804+ break;
805+ case 4:
806+ Settings.setSetting("Difficulty", selectedIndex)
807+ break;
808+ }
809+ }
810+
811+ }
812+
813+ OptionSelector {
814+ objectName: "themeSelector"
815+ id: themeSelector
816+ text: i18n.tr("Theme")
817+ model: ["UbuntuColours", "Simple"]
818+ width: parent.width - units.gu(4)
819+ anchors.horizontalCenter: parent.horizontalCenter
820+ onSelectedIndexChanged: {
821+ var newColorScheme = null;
822+ if (selectedIndex == 0)
823+ {
824+ //print("Ubuntu")
825+ var result = Settings.setSetting("ColorTheme", selectedIndex);
826+ //print(result);
827+ sudokuBlocksGrid.changeColorScheme("ColorSchemeUbuntu.qml");
828+ }
829+ if (selectedIndex == 1)
830+ {
831+ //print("Simple")
832+ var result = Settings.setSetting("ColorTheme", selectedIndex);
833+ //print(result);
834+ sudokuBlocksGrid.changeColorScheme("ColorSchemeSimple.qml");
835+ }
836+ }
837+ Component.onCompleted: selectedIndex = 0
838+ }
839+
840+ ListItem {
841+ objectName: "hintsSwitchClickable"
842+ height: hintsSettingsLayout.height + divider.height
843+
844+ ListItemLayout {
845+ id: hintsSettingsLayout
846+ title.text: i18n.tr("Hints")
847+
848+ Switch {
849+ id: disableHints
850+ objectName: "hintsSwitch"
851+ checked: disableHintsChecked
852+ SlotsLayout.position: SlotsLayout.Last
853+ onCheckedChanged: {
854+ Settings.setSetting("DisableHints", checked ? "true":"false")
855+ }
856+ }
857+ }
858+ }
859+
860+ ListItem {
861+ objectName: "vibrationsSwitchClickable"
862+ height: vibrationsSettingsLayout.height + divider.height
863+
864+ ListItemLayout {
865+ id: vibrationsSettingsLayout
866+ title.text: i18n.tr("Vibration Alerts")
867+
868+ Switch {
869+ id: disableVibrations
870+ objectName: "vibrationsSwitch"
871+ checked: disableVibrationsChecked
872+ SlotsLayout.position: SlotsLayout.Last
873+ onCheckedChanged: {
874+ Settings.setSetting("DisableVibrations", checked ? "true":"false")
875+ }
876+ }
877+ }
878+ }
879+
880+ ListItem {
881+ height: profileSettingsLayout.height + divider.height
882+ ListItemLayout {
883+ id: profileSettingsLayout
884+ title.text: i18n.tr("Profiles settings")
885+ title.font.weight: Font.DemiBold
886+ }
887+ }
888+
889+ SingleValueListItem {
890+ id: selectorProfile
891+ objectName: "Current profile"
892+ title.text: i18n.tr("Current profile")
893+ value: {
894+ if(currentUserId==-1)
895+ return i18n.tr("None")
896+ else
897+ return Settings.getUserFirstName(currentUserId)+" "+Settings.getUserLastName(currentUserId);
898+
899+ }
900+ Component.onCompleted: currentUserId = Settings.getSetting("currentUserId")
901+
902+ onClicked: {
903+ var allProfiles = new Array();
904+ allProfiles = Settings.getAllProfiles()
905+
906+ profilesModel.clear()
907+
908+ for(var i = 0; i < allProfiles.length; i++)
909+ {
910+ profilesModel.append({"profileId":allProfiles[i].id,"lastname":allProfiles[i].lastname, "firstname":allProfiles[i].firstname})
911+ }
912+ PopupUtils.open(profileSelector, selectorProfile)
913+ }
914+ }
915+
916+ AddProfileDialog{
917+ id:addProfileDialog
918+ }
919+
920+ ManageProfileDialog{
921+ id:manageProfileDialog
922+ }
923+
924+ ListItem {
925+ id: addSingleValue
926+ objectName: "Add profile"
927+ height: addSingleValueLayout.height + divider.height
928+ ListItemLayout {
929+ id: addSingleValueLayout
930+ title.text: i18n.tr("Add profile")
931+ ProgressionSlot {}
932+ }
933+ onClicked: {
934+ PopupUtils.open(addProfileDialog, addSingleValue);
935+ }
936+ }
937+
938+ ListItem {
939+ id: manageProfileSingleValue
940+ objectName: "Manage profiles"
941+ height: manageProfileSingleValueLayout.height + divider.height
942+ ListItemLayout {
943+ id: manageProfileSingleValueLayout
944+ title.text: i18n.tr("Manage profiles")
945+ ProgressionSlot {}
946+ }
947+ onClicked: {
948+ var allProfiles = new Array();
949+ allProfiles = Settings.getAllProfiles()
950+
951+ profilesModel.clear()
952+
953+ for(var i = 0; i < allProfiles.length; i++)
954+ {
955+ profilesModel.append({"profileId":allProfiles[i].id,"lastname":allProfiles[i].lastname, "firstname":allProfiles[i].firstname})
956+ }
957+
958+ PopupUtils.open(manageProfileSelector, manageProfileSingleValue)
959+ }
960+ }
961+ }
962+ }
963+
964+ Scrollbar {
965+ flickableItem: flickableSettings
966+ align: Qt.AlignTrailing
967+ }
968+ }
969+}
970
971=== added file 'components/SingleValueListItem.qml'
972--- components/SingleValueListItem.qml 1970-01-01 00:00:00 +0000
973+++ components/SingleValueListItem.qml 2016-02-28 17:36:02 +0000
974@@ -0,0 +1,22 @@
975+import QtQuick 2.4
976+import Ubuntu.Components 1.3
977+
978+ListItem {
979+ id: customListItem
980+
981+ property alias title: customItemLayout.title
982+ property alias value: _value.text
983+
984+ ListItemLayout {
985+ id: customItemLayout
986+
987+ title.text: " "
988+
989+ Label {
990+ id: _value
991+ SlotsLayout.position: SlotsLayout.Trailing;
992+ }
993+
994+ ProgressionSlot {}
995+ }
996+}
997
998=== modified file 'components/SudokuBlocksGrid.qml'
999--- components/SudokuBlocksGrid.qml 2015-07-16 15:00:01 +0000
1000+++ components/SudokuBlocksGrid.qml 2016-02-28 17:36:02 +0000
1001@@ -1,6 +1,6 @@
1002-import QtQuick 2.3
1003-import Ubuntu.Components 1.1
1004-import Ubuntu.Components.Popups 1.0
1005+import QtQuick 2.4
1006+import Ubuntu.Components 1.3
1007+import Ubuntu.Components.Popups 1.3
1008 import "../js/SudokuCU.js" as SudokuCU
1009 import QtFeedback 5.0
1010
1011@@ -120,13 +120,9 @@
1012 colorScheme.dialogButtonColor2 = temp.dialogButtonColor2;
1013 colorScheme.dialogButtonTextColor = temp.dialogButtonTextColor;
1014
1015- colorScheme.headerColor = temp.headerColor;
1016 colorScheme.backgroundColor = temp.backgroundColor;
1017- colorScheme.footerColor = temp.footerColor;
1018
1019- mainView.headerColor = colorScheme.headerColor;
1020 mainView.backgroundColor = colorScheme.backgroundColor;
1021- mainView.footerColor = colorScheme.footerColor;
1022
1023 for (var i = 0; i < 9; i++) {
1024 for (var j = 0; j < 9; j++) {
1025
1026=== modified file 'components/SudokuButton.qml'
1027--- components/SudokuButton.qml 2014-10-06 12:41:09 +0000
1028+++ components/SudokuButton.qml 2016-02-28 17:36:02 +0000
1029@@ -1,5 +1,5 @@
1030-import QtQuick 2.3
1031-import Ubuntu.Components 1.1
1032+import QtQuick 2.4
1033+import Ubuntu.Components 1.3
1034
1035 Rectangle {
1036 id: button
1037
1038=== modified file 'components/SudokuButtonsGrid.qml'
1039--- components/SudokuButtonsGrid.qml 2015-07-16 15:00:01 +0000
1040+++ components/SudokuButtonsGrid.qml 2016-02-28 17:36:02 +0000
1041@@ -1,6 +1,6 @@
1042-import QtQuick 2.3
1043-import Ubuntu.Components 1.1
1044-import Ubuntu.Components.Popups 1.0
1045+import QtQuick 2.4
1046+import Ubuntu.Components 1.3
1047+import Ubuntu.Components.Popups 1.3
1048
1049 Repeater {
1050
1051@@ -132,7 +132,7 @@
1052 }
1053
1054 Component.onCompleted: {
1055- switch(difficultySelector.selectedIndex) {
1056+ switch(settingsTab.difficultyIndex) {
1057 case 0:
1058 var randomnumber = Math.floor(Math.random()*9);
1059 randomnumber += 31;
1060
1061=== modified file 'components/SudokuDialogButton.qml'
1062--- components/SudokuDialogButton.qml 2014-10-06 12:41:09 +0000
1063+++ components/SudokuDialogButton.qml 2016-02-28 17:36:02 +0000
1064@@ -1,5 +1,5 @@
1065-import QtQuick 2.3
1066-import Ubuntu.Components 1.1
1067+import QtQuick 2.4
1068+import Ubuntu.Components 1.3
1069
1070 DialogButton {
1071 id: dialogButton
1072
1073=== added file 'components/TabsList.qml'
1074--- components/TabsList.qml 1970-01-01 00:00:00 +0000
1075+++ components/TabsList.qml 2016-02-28 17:36:02 +0000
1076@@ -0,0 +1,36 @@
1077+import QtQuick 2.4
1078+import Ubuntu.Components 1.3
1079+
1080+ActionList {
1081+ id: tabsList
1082+
1083+ children: [
1084+ Action {
1085+ text: i18n.tr("Sudoku")
1086+ onTriggered: {
1087+ tabs.selectedTabIndex = 0
1088+ }
1089+ },
1090+
1091+ Action {
1092+ text: i18n.tr("Scores")
1093+ onTriggered: {
1094+ tabs.selectedTabIndex = 1
1095+ }
1096+ },
1097+
1098+ Action {
1099+ text: i18n.tr("Settings")
1100+ onTriggered: {
1101+ tabs.selectedTabIndex = 2
1102+ }
1103+ },
1104+
1105+ Action {
1106+ text: i18n.tr("About")
1107+ onTriggered: {
1108+ tabs.selectedTabIndex = 3
1109+ }
1110+ }
1111+ ]
1112+}
1113
1114=== modified file 'debian/changelog'
1115--- debian/changelog 2014-05-02 10:20:04 +0000
1116+++ debian/changelog 2016-02-28 17:36:02 +0000
1117@@ -1,3 +1,12 @@
1118+sudoku-app (1.6) UNRELEASED; urgency=medium
1119+
1120+ * Migrated to Ubuntu.Components 1.3
1121+ * Updated framework to 15.04.3-qml
1122+ * Updated to QtQuick 2.4
1123+ * Removed unused comments, deprecated imports and unused actions
1124+
1125+ -- Nekhelesh <krnekhelesh@nik90-laptop> Sun, 28 Feb 2016 18:34:26 +0100
1126+
1127 sudoku-app (1.1) raring; urgency=medium
1128
1129 * Add -qt5 command line option (LP: #1288885)
1130
1131=== modified file 'po/com.ubuntu.sudoku.pot'
1132--- po/com.ubuntu.sudoku.pot 2015-07-17 11:48:07 +0000
1133+++ po/com.ubuntu.sudoku.pot 2016-02-28 17:36:02 +0000
1134@@ -8,7 +8,7 @@
1135 msgstr ""
1136 "Project-Id-Version: sudoku-app\n"
1137 "Report-Msgid-Bugs-To: \n"
1138-"POT-Creation-Date: 2015-07-17 13:47+0200\n"
1139+"POT-Creation-Date: 2016-02-28 22:53+0530\n"
1140 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
1141 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
1142 "Language-Team: LANGUAGE <LL@li.org>\n"
1143@@ -18,15 +18,20 @@
1144 "Content-Transfer-Encoding: 8bit\n"
1145 "Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
1146
1147-#: ../components/AboutTab.qml:103
1148+#: ../components/AboutTab.qml:17 ../components/HighscoresTab.qml:36
1149+#: ../components/TabsList.qml:30
1150+msgid "About"
1151+msgstr ""
1152+
1153+#: ../components/AboutTab.qml:111
1154 msgid "Author(s): "
1155 msgstr ""
1156
1157-#: ../components/AboutTab.qml:113
1158+#: ../components/AboutTab.qml:121
1159 msgid "Contact: "
1160 msgstr ""
1161
1162-#: ../components/AboutTab.qml:139
1163+#: ../components/AboutTab.qml:147
1164 msgid "Version: "
1165 msgstr ""
1166
1167@@ -43,7 +48,7 @@
1168 msgstr ""
1169
1170 #: ../components/AddProfileDialog.qml:53
1171-#: ../components/ManageProfileDialog.qml:69 ../sudoku-app.qml:354
1172+#: ../components/ManageProfileDialog.qml:69 ../sudoku-app.qml:192
1173 msgid "OK"
1174 msgstr ""
1175
1176@@ -62,9 +67,9 @@
1177 msgstr ""
1178
1179 #: ../components/AddProfileDialog.qml:85
1180-#: ../components/ManageProfileDialog.qml:127
1181-#: ../components/SudokuBlocksGrid.qml:492 ../sudoku-app.qml:507
1182-#: ../sudoku-app.qml:881 ../sudoku-app.qml:933
1183+#: ../components/ManageProfileDialog.qml:127 ../components/SettingsTab.qml:66
1184+#: ../components/SettingsTab.qml:116 ../components/SudokuBlocksGrid.qml:488
1185+#: ../sudoku-app.qml:343
1186 msgid "Cancel"
1187 msgstr ""
1188
1189@@ -89,14 +94,13 @@
1190 msgid "Hinted blocks"
1191 msgstr ""
1192
1193-#: ../components/HighscoresTab.qml:66 ../components/HighscoresTab.qml:113
1194-#: ../sudoku-app.qml:24 ../sudoku-app.qml:153 ../sudoku-app.qml:207
1195-#: ../sudoku-app.qml:244
1196+#: ../components/HighscoresTab.qml:50 ../components/HighscoresTab.qml:117
1197+#: ../sudoku-app.qml:21 ../sudoku-app.qml:49 ../sudoku-app.qml:82
1198 msgid "<b>Best scores for all players</b>"
1199 msgstr ""
1200
1201 #. TRANSLATORS: %1 is user's first name and %2 is last name
1202-#: ../components/HighscoresTab.qml:89 ../sudoku-app.qml:176
1203+#: ../components/HighscoresTab.qml:73
1204 #, qt-format
1205 msgid "Best scores for %1 %2"
1206 msgstr ""
1207@@ -109,215 +113,171 @@
1208 msgid "Delete"
1209 msgstr ""
1210
1211-#: ../components/SudokuBlocksGrid.qml:334
1212+#: ../components/SettingsTab.qml:25 ../components/TabsList.qml:23
1213+msgid "Settings"
1214+msgstr ""
1215+
1216+#: ../components/SettingsTab.qml:36 ../components/SettingsTab.qml:85
1217+msgid "Select profile"
1218+msgstr ""
1219+
1220+#: ../components/SettingsTab.qml:152
1221+msgid "Sudoku settings"
1222+msgstr ""
1223+
1224+#: ../components/SettingsTab.qml:160
1225+msgid "Default Difficulty"
1226+msgstr ""
1227+
1228+#: ../components/SettingsTab.qml:163 ../sudoku-app.qml:272
1229+msgid "Easy"
1230+msgstr ""
1231+
1232+#: ../components/SettingsTab.qml:163 ../sudoku-app.qml:291
1233+msgid "Moderate"
1234+msgstr ""
1235+
1236+#: ../components/SettingsTab.qml:163 ../sudoku-app.qml:308
1237+msgid "Hard"
1238+msgstr ""
1239+
1240+#: ../components/SettingsTab.qml:163
1241+msgid "Ultra Hard"
1242+msgstr ""
1243+
1244+#: ../components/SettingsTab.qml:163
1245+msgid "Always ask"
1246+msgstr ""
1247+
1248+#: ../components/SettingsTab.qml:206
1249+msgid "Theme"
1250+msgstr ""
1251+
1252+#: ../components/SettingsTab.qml:236
1253+msgid "Hints"
1254+msgstr ""
1255+
1256+#: ../components/SettingsTab.qml:256
1257+msgid "Vibration Alerts"
1258+msgstr ""
1259+
1260+#: ../components/SettingsTab.qml:274
1261+msgid "Profiles settings"
1262+msgstr ""
1263+
1264+#: ../components/SettingsTab.qml:282
1265+msgid "Current profile"
1266+msgstr ""
1267+
1268+#: ../components/SettingsTab.qml:285
1269+msgid "None"
1270+msgstr ""
1271+
1272+#: ../components/SettingsTab.qml:320
1273+msgid "Add profile"
1274+msgstr ""
1275+
1276+#: ../components/SettingsTab.qml:334
1277+msgid "Manage profiles"
1278+msgstr ""
1279+
1280+#: ../components/SudokuBlocksGrid.qml:330
1281 msgid "Please pick a number"
1282 msgstr ""
1283
1284-#: ../components/SudokuBlocksGrid.qml:395
1285+#: ../components/SudokuBlocksGrid.qml:391
1286 msgid "Clear"
1287 msgstr ""
1288
1289-#: ../components/SudokuBlocksGrid.qml:465
1290-#, qt-format
1291-msgid ""
1292-"You are a cheat...\n"
1293-"But we give you\n"
1294-"%1 point."
1295-msgid_plural ""
1296-"You are a cheat...\n"
1297-"But we give you\n"
1298-"%1 points."
1299-msgstr[0] ""
1300-msgstr[1] ""
1301-
1302-#: ../components/SudokuBlocksGrid.qml:472
1303-#, qt-format
1304-msgid ""
1305-"Congratulations!\n"
1306-"We give you\n"
1307-"%1 point."
1308-msgid_plural ""
1309-"Congratulations!\n"
1310-"We give you\n"
1311-"%1 points."
1312-msgstr[0] ""
1313-msgstr[1] ""
1314-
1315-#: ../js/localStorage.js:11 ../sudoku-app.qml:688
1316+#: ../components/SudokuBlocksGrid.qml:461
1317+#, qt-format
1318+msgid ""
1319+"You are a cheat...\n"
1320+"But we give you\n"
1321+"%1 point."
1322+msgid_plural ""
1323+"You are a cheat...\n"
1324+"But we give you\n"
1325+"%1 points."
1326+msgstr[0] ""
1327+msgstr[1] ""
1328+
1329+#: ../components/SudokuBlocksGrid.qml:468
1330+#, qt-format
1331+msgid ""
1332+"Congratulations!\n"
1333+"We give you\n"
1334+"%1 point."
1335+msgid_plural ""
1336+"Congratulations!\n"
1337+"We give you\n"
1338+"%1 points."
1339+msgstr[0] ""
1340+msgstr[1] ""
1341+
1342+#: ../components/TabsList.qml:9 ../js/localStorage.js:11 ../sudoku-app.qml:590
1343 #: com.ubuntu.sudoku_sudoku.desktop.in.in.h:1
1344 msgid "Sudoku"
1345 msgstr ""
1346
1347+#: ../components/TabsList.qml:16
1348+msgid "Scores"
1349+msgstr ""
1350+
1351 #: ../js/localStorage.js:12
1352 msgid "User"
1353 msgstr ""
1354
1355-#: ../sudoku-app.qml:50 ../sudoku-app.qml:51 ../sudoku-app.qml:763
1356-msgid "New game"
1357-msgstr ""
1358-
1359-#: ../sudoku-app.qml:58 ../sudoku-app.qml:59
1360-msgid "Reveal hint"
1361-msgstr ""
1362-
1363-#: ../sudoku-app.qml:67 ../sudoku-app.qml:68
1364-msgid "Show settings"
1365-msgstr ""
1366-
1367-#: ../sudoku-app.qml:75 ../sudoku-app.qml:76
1368-msgid "Change difficulty to Easy"
1369-msgstr ""
1370-
1371-#: ../sudoku-app.qml:88 ../sudoku-app.qml:89
1372-msgid "Change difficulty to Moderate"
1373-msgstr ""
1374-
1375-#: ../sudoku-app.qml:101 ../sudoku-app.qml:102
1376-msgid "Change difficulty to Hard"
1377-msgstr ""
1378-
1379-#: ../sudoku-app.qml:114 ../sudoku-app.qml:115
1380-msgid "Change difficulty to Ultra Hard"
1381-msgstr ""
1382-
1383-#: ../sudoku-app.qml:127 ../sudoku-app.qml:128
1384-msgid "Change theme to Simple"
1385-msgstr ""
1386-
1387-#: ../sudoku-app.qml:137 ../sudoku-app.qml:138
1388-msgid "Change theme to UbuntuColors"
1389-msgstr ""
1390-
1391-#: ../sudoku-app.qml:147 ../sudoku-app.qml:148
1392-msgid "Show scores for all users"
1393-msgstr ""
1394-
1395-#: ../sudoku-app.qml:168 ../sudoku-app.qml:169
1396-msgid "Show scores for current user"
1397-msgstr ""
1398-
1399-#: ../sudoku-app.qml:233
1400+#: ../sudoku-app.qml:75
1401 msgid ""
1402 "You are a cheat... \n"
1403 "But we give you\n"
1404 msgstr ""
1405
1406-#: ../sudoku-app.qml:235
1407+#: ../sudoku-app.qml:77
1408 msgid "point."
1409 msgid_plural "points."
1410 msgstr[0] ""
1411 msgstr[1] ""
1412
1413-#: ../sudoku-app.qml:341
1414+#: ../sudoku-app.qml:179
1415 msgid "Sudoku games played today"
1416 msgstr ""
1417
1418-#: ../sudoku-app.qml:342
1419+#: ../sudoku-app.qml:180
1420 msgid "No Sudoku games played today"
1421 msgstr ""
1422
1423-#: ../sudoku-app.qml:371
1424+#: ../sudoku-app.qml:209
1425 msgid "New Game"
1426 msgstr ""
1427
1428-#: ../sudoku-app.qml:372
1429+#: ../sudoku-app.qml:210
1430 msgid "Select difficulty level"
1431 msgstr ""
1432
1433-#: ../sudoku-app.qml:436 ../sudoku-app.qml:982
1434-msgid "Easy"
1435-msgstr ""
1436-
1437-#: ../sudoku-app.qml:455 ../sudoku-app.qml:982
1438-msgid "Moderate"
1439-msgstr ""
1440-
1441-#: ../sudoku-app.qml:472 ../sudoku-app.qml:982
1442-msgid "Hard"
1443-msgstr ""
1444-
1445-#: ../sudoku-app.qml:489
1446+#: ../sudoku-app.qml:325
1447 msgid ""
1448 "Ultra\n"
1449 "Hard"
1450 msgstr ""
1451
1452-#: ../sudoku-app.qml:744
1453+#: ../sudoku-app.qml:577
1454 msgid "You are a cheat..."
1455 msgstr ""
1456
1457-#: ../sudoku-app.qml:744
1458+#: ../sudoku-app.qml:577
1459 msgid "Congratulations!"
1460 msgstr ""
1461
1462-#: ../sudoku-app.qml:780
1463+#: ../sudoku-app.qml:600
1464+msgid "New game"
1465+msgstr ""
1466+
1467+#: ../sudoku-app.qml:616
1468 msgid "Show hint"
1469 msgstr ""
1470
1471-#: ../sudoku-app.qml:820
1472-msgid "Scores"
1473-msgstr ""
1474-
1475-#: ../sudoku-app.qml:830
1476-msgid "Settings"
1477-msgstr ""
1478-
1479-#: ../sudoku-app.qml:852 ../sudoku-app.qml:900
1480-msgid "Select profile"
1481-msgstr ""
1482-
1483-#: ../sudoku-app.qml:973
1484-msgid "<b>Sudoku settings</b>"
1485-msgstr ""
1486-
1487-#: ../sudoku-app.qml:979
1488-msgid "Default Difficulty"
1489-msgstr ""
1490-
1491-#: ../sudoku-app.qml:982
1492-msgid "Ultra Hard"
1493-msgstr ""
1494-
1495-#: ../sudoku-app.qml:982
1496-msgid "Always ask"
1497-msgstr ""
1498-
1499-#: ../sudoku-app.qml:1024
1500-msgid "Theme"
1501-msgstr ""
1502-
1503-#: ../sudoku-app.qml:1050
1504-msgid "Hints"
1505-msgstr ""
1506-
1507-#: ../sudoku-app.qml:1066
1508-msgid "Vibration Alerts"
1509-msgstr ""
1510-
1511-#: ../sudoku-app.qml:1083
1512-msgid "<b>Profiles settings</b>"
1513-msgstr ""
1514-
1515-#: ../sudoku-app.qml:1087
1516-msgid "Current profile"
1517-msgstr ""
1518-
1519-#: ../sudoku-app.qml:1091
1520-msgid "None"
1521-msgstr ""
1522-
1523-#: ../sudoku-app.qml:1127
1524-msgid "Add profile"
1525-msgstr ""
1526-
1527-#: ../sudoku-app.qml:1136
1528-msgid "Manage profiles"
1529-msgstr ""
1530-
1531-#: ../sudoku-app.qml:1168
1532-msgid "About"
1533-msgstr ""
1534-
1535 #: com.ubuntu.sudoku_sudoku.desktop.in.in.h:2
1536 msgid "Sudoku Game for Ubuntu Touch."
1537 msgstr ""
1538
1539=== modified file 'sudoku-app.qml'
1540--- sudoku-app.qml 2015-07-17 11:48:07 +0000
1541+++ sudoku-app.qml 2016-02-28 17:36:02 +0000
1542@@ -1,14 +1,11 @@
1543-import QtQuick 2.3
1544-import Ubuntu.Components 1.1
1545-import Ubuntu.Components.ListItems 1.0 as ListItem
1546+import QtQuick 2.4
1547+import UserMetrics 0.1
1548+import Ubuntu.Layouts 1.0
1549+import Ubuntu.Components 1.3
1550 import QtQuick.LocalStorage 2.0
1551-import Ubuntu.Components.Popups 1.0
1552-import Ubuntu.Layouts 1.0
1553+import Ubuntu.Components.Popups 1.3
1554 import "js/localStorage.js" as Settings
1555 import "components"
1556-//import Ubuntu.HUD 1.0 as HUD
1557-import Ubuntu.Unity.Action 1.1 as UnityActions
1558-import UserMetrics 0.1
1559
1560 MainView {
1561 id: mainView
1562@@ -32,163 +29,8 @@
1563
1564 width: units.gu(41);
1565 height: units.gu(70);
1566-
1567- //headerColor: sudokuBlocksGrid.headerColor
1568- //backgroundColor: sudokuBlocksGrid.backgroundColor
1569- //footerColor: sudokuBlocksGrid.footerColor
1570-
1571- /*HUD.HUD {
1572- applicationIdentifier: "sudoku-app" // this has to match the .desktop file!
1573- HUD.Context {*/
1574-
1575 StateSaver.properties: "width, height"
1576
1577- useDeprecatedToolbar: false
1578-
1579- actions: [
1580- Action {
1581- text: i18n.tr("New game")
1582- keywords: i18n.tr("New game")
1583- onTriggered: {
1584- tabs.selectedTabIndex = 0
1585- createNewGame()
1586- }
1587- },
1588- Action {
1589- text: i18n.tr("Reveal hint")
1590- keywords: i18n.tr("Reveal hint")
1591- enabled: disableHints.checked
1592- onTriggered: {
1593- tabs.selectedTabIndex = 0
1594- revealHint()
1595- }
1596- },
1597- Action {
1598- text: i18n.tr("Show settings")
1599- keywords: i18n.tr("Show settings")
1600- onTriggered: {
1601- tabs.selectedTabIndex = 2
1602- revealHint()
1603- }
1604- },
1605- Action {
1606- text: i18n.tr("Change difficulty to Easy")
1607- keywords: i18n.tr("Change difficulty to Easy")
1608- onTriggered: {
1609- tabs.selectedTabIndex = 0
1610- difficultySelector.selectedIndex = 0
1611- var randomnumber = Math.floor(Math.random()*9);
1612- randomnumber += 31;
1613- sudokuBlocksGrid.createNewGame(81 - randomnumber);
1614- Settings.setSetting("Difficulty", 0)
1615- createNewGame()
1616- }
1617- },
1618- Action {
1619- text: i18n.tr("Change difficulty to Moderate")
1620- keywords: i18n.tr("Change difficulty to Moderate")
1621- onTriggered: {
1622- tabs.selectedTabIndex = 0
1623- difficultySelector.selectedIndex = 1
1624- var randomnumber = Math.floor(Math.random()*4);
1625- randomnumber += 26;
1626- sudokuBlocksGrid.createNewGame(81 - randomnumber);
1627- Settings.setSetting("Difficulty", 1)
1628- createNewGame()
1629- }
1630- },
1631- Action {
1632- text: i18n.tr("Change difficulty to Hard")
1633- keywords: i18n.tr("Change difficulty to Hard")
1634- onTriggered: {
1635- tabs.selectedTabIndex = 0
1636- difficultySelector.selectedIndex = 2
1637- var randomnumber = Math.floor(Math.random()*4);
1638- randomnumber += 21;
1639- sudokuBlocksGrid.createNewGame(81 - randomnumber);
1640- Settings.setSetting("Difficulty", 2)
1641- createNewGame()
1642- }
1643- },
1644- Action {
1645- text: i18n.tr("Change difficulty to Ultra Hard")
1646- keywords: i18n.tr("Change difficulty to Ultra Hard")
1647- onTriggered: {
1648- tabs.selectedTabIndex = 0
1649- difficultySelector.selectedIndex = 3
1650- var randomnumber = Math.floor(Math.random()*3);
1651- randomnumber += 17;
1652- sudokuBlocksGrid.createNewGame(81 - randomnumber);
1653- Settings.setSetting("Difficulty", 3)
1654- createNewGame()
1655- }
1656- },
1657- Action {
1658- text: i18n.tr("Change theme to Simple")
1659- keywords: i18n.tr("Change theme to Simple")
1660- onTriggered: {
1661- //print("Simple")
1662- var result = Settings.setSetting("ColorTheme", 1);
1663- //print(result);
1664- sudokuBlocksGrid.changeColorScheme("ColorSchemeSimple.qml");
1665- }
1666- },
1667- Action {
1668- text: i18n.tr("Change theme to UbuntuColors")
1669- keywords: i18n.tr("Change theme to UbuntuColors")
1670- onTriggered: {
1671- print("UbuntuColors")
1672- var result = Settings.setSetting("ColorTheme", 0);
1673- //print(result);
1674- sudokuBlocksGrid.changeColorScheme("ColorSchemeUbuntu.qml");
1675- }
1676- },
1677- Action {
1678- text: i18n.tr("Show scores for all users")
1679- keywords: i18n.tr("Show scores for all users")
1680- onTriggered: {
1681- tabs.selectedTabIndex = 1
1682- var allScores = Settings.getAllScores()
1683- highscoresModel.clear();
1684- highscoresHeaderText = i18n.tr("<b>Best scores for all players</b>");
1685- for(var i = 0; i < allScores.length; i++) {
1686- var rowItem = allScores[i];
1687- //print("ROW ",rowItem)
1688- var firstName = Settings.getUserFirstName(rowItem[1]);
1689- var lastName = Settings.getUserLastName(rowItem[1]);
1690- //res.push([dbItem.first_name, dbItem.last_name, dbItem.score])
1691- highscoresModel.append({ 'id': rowItem[0],
1692- 'firstname': firstName,
1693- 'lastname': lastName,
1694- 'score': rowItem[2] });
1695- }
1696- }
1697- },
1698- Action {
1699- text: i18n.tr("Show scores for current user")
1700- keywords: i18n.tr("Show scores for current user")
1701- onTriggered: {
1702- tabs.selectedTabIndex = 1
1703- var firstName = Settings.getUserFirstName(currentUserId);
1704- var lastName = Settings.getUserLastName(currentUserId);
1705- //print(firstName, lastName)
1706- // TRANSLATORS: %1 is user's first name and %2 is last name
1707- highscoresHeaderText = "<b>" + i18n.tr("Best scores for %1 %2").arg(firstName).arg(lastName) + "</b>"
1708- var allScores = Settings.getAllScoresForUser(currentUserId)
1709- highscoresModel.clear();
1710- for(var i = 0; i < allScores.length; i++) {
1711- var rowItem = allScores[i];
1712- //res.push([dbItem.first_name, dbItem.last_name, dbItem.score])
1713- highscoresModel.append({'firstname': firstName,
1714- 'lastname': lastName,
1715- 'score': rowItem[1] });
1716- }
1717- }
1718- }
1719- ]
1720- //}
1721- //}
1722-
1723 onCurrentUserIdChanged: {
1724 Settings.setSetting("currentUserId", currentUserId)
1725 }
1726@@ -214,7 +56,7 @@
1727 /*highscoresModel.append({'firstname': firstName,
1728 'lastname': lastName,
1729 'score': rowItem[1] });*/
1730- hsPage.appendModel({ 'id': rowItem[0],
1731+ highscoresTab.appendModel({ 'id': rowItem[0],
1732 'firstname': firstName,
1733 'lastname': lastName,
1734 'score': rowItem[2] });
1735@@ -223,7 +65,7 @@
1736 }
1737
1738 function revealHint() {
1739- if(disableHints.checked)
1740+ if(settingsTab.disableHintsChecked)
1741 {
1742 sudokuBlocksGrid.revealHint();
1743 sudokuBlocksGrid.checkIfCheating = true;
1744@@ -234,13 +76,9 @@
1745 + sudokuBlocksGrid.calculateScore()
1746 + " " + i18n.tr("point.","points.",1)
1747
1748- // print (sudokuBlocksGrid.numberOfActions)
1749- // print (sudokuBlocksGrid.numberOfHints)
1750- // print (sudokuBlocksGrid.gameSeconds)
1751- // print (sudokuBlocksGrid.gameDifficulty)
1752 var allScores = Settings.getAllScores()
1753 //highscoresModel.clear();
1754- hsPage.clearModel()
1755+ highscoresTab.clearModel()
1756 highscoresHeaderText = i18n.tr("<b>Best scores for all players</b>");
1757 for(var i = 0; i < allScores.length; i++) {
1758 var rowItem = allScores[i];
1759@@ -251,7 +89,7 @@
1760 /*highscoresModel.append({'firstname': firstName,
1761 'lastname': lastName,
1762 'score': rowItem[1] });*/
1763- hsPage.appendModel({ 'id': rowItem[0],
1764+ highscoresTab.appendModel({ 'id': rowItem[0],
1765 'firstname': firstName,
1766 'lastname': lastName,
1767 'score': rowItem[2] });
1768@@ -263,7 +101,7 @@
1769 }
1770
1771 function createNewGame() {
1772- switch(difficultySelector.selectedIndex) {
1773+ switch(settingsTab.difficultyIndex) {
1774 case 0:
1775 var randomnumber = Math.floor(Math.random()*9);
1776 randomnumber += 31;
1777@@ -419,8 +257,6 @@
1778 }
1779 }
1780
1781-
1782-
1783 Column {
1784 spacing: units.gu(5)
1785
1786@@ -624,7 +460,7 @@
1787 if (settingsTab.difficultyIndex < 0)
1788 settingsTab.difficultyIndex = 0
1789 //print(settingsTab.difficultyIndex)
1790- //print(Settings.getSetting("DisableHints"));
1791+ //print(Settings.getSetting("settingsTab.disableHints"));
1792 settingsTab.disableHintsChecked = Settings.getSetting("DisableHints") == "true" ? true : false;
1793 settingsTab.disableVibrationsChecked = Settings.getSetting("DisableVibrations") == "true" ? true : false;
1794 settingsTab.themeIndex = parseInt(Settings.getSetting("ColorTheme"));
1795@@ -658,7 +494,7 @@
1796 /*highscoresModel.append({'firstname': firstName,
1797 'lastname': lastName,
1798 'score': rowItem[1] });*/
1799- hsPage.appendModel({ 'id': rowItem[0],
1800+ highscoresTab.appendModel({ 'id': rowItem[0],
1801 'firstname': firstName,
1802 'lastname': lastName,
1803 'score': rowItem[2] })
1804@@ -670,7 +506,7 @@
1805 {
1806 currentUserId = Settings.getSetting("currentUserId")
1807 }
1808- if (difficultySelector.selectedIndex == 4) {
1809+ if (settingsTab.difficultyIndex === 4) {
1810 PopupUtils.open(newGameComponent)
1811 }
1812
1813@@ -680,13 +516,15 @@
1814 id: tabs
1815 anchors.fill: parent
1816
1817+ TabsList {
1818+ id: tabsList
1819+ }
1820+
1821 // First tab begins here
1822 Tab {
1823 id: mainTab;
1824 objectName: "MainTab"
1825
1826- title: i18n.tr("Sudoku")
1827-
1828 Timer {
1829 id: winTimer;
1830 interval: 2000;
1831@@ -694,7 +532,7 @@
1832 repeat: false;
1833 onTriggered: {
1834 gameFinishedRectangle.visible = false;
1835- switch(difficultySelector.selectedIndex) {
1836+ switch(settingsTab.difficultyIndex) {
1837 case 0:
1838 var randomnumber = Math.floor(Math.random()*9);
1839 randomnumber += 31;
1840@@ -725,18 +563,13 @@
1841
1842 UbuntuShape {
1843 id: gameFinishedRectangle;
1844- color: "black";
1845+ backgroundColor: "black";
1846 opacity: 0.8
1847- //border.color: sudokuBlocksGrid.defaultBorderColor;
1848 width: mainView.width
1849 radius: "medium"
1850 height: mainView.height*1.3
1851 z: 100;
1852 visible: false;
1853- //x: mainView.width / 2 - width/2;
1854- //y: mainView.weight / 2 - height/2;
1855- //anchors.verticalCenter: mainView.verticalCenter;
1856- //anchors.horizontalCenter: mainView.verticalCenter;
1857 anchors.centerIn: parent;
1858 //y: units.gu(5);
1859 Label {
1860@@ -751,421 +584,78 @@
1861 }
1862
1863 page: Page {
1864+ id: mainPage
1865+
1866+ header: PageHeader {
1867+ title: i18n.tr("Sudoku")
1868+
1869+ leadingActionBar {
1870+ numberOfSlots: 0
1871+ actions: tabsList.actions
1872+ }
1873+
1874+ trailingActionBar.actions: [
1875+ Action {
1876+ objectName: "newgamebutton"
1877+ text: i18n.tr("New game");
1878+ iconSource: Qt.resolvedUrl("icons/new_game_ubuntu.svg")
1879+ onTriggered: {
1880+ if(gameFinishedRectangle.visible) gameFinishedRectangle.visible = false;
1881+ //createNewGame()
1882+ if (settingsTab.difficultyIndex == 4)
1883+ PopupUtils.open(newGameComponent)
1884+ else {
1885+ createNewGame()
1886+ }
1887+ }
1888+ },
1889+ Action {
1890+ objectName: "hintbutton"
1891+ id: revealHintAction
1892+ iconSource: Qt.resolvedUrl("icons/hint.svg")
1893+ text: i18n.tr("Show hint");
1894+ enabled: settingsTab.disableHintsChecked
1895+ onTriggered: {
1896+ revealHint()
1897+ }
1898+ }
1899+ ]
1900+ }
1901
1902 BottomEdgeSlide {
1903 z:2
1904 hintIconName: "help-contents"
1905 }
1906
1907- head.actions: [
1908- Action {
1909- objectName: "newgamebutton"
1910- text: i18n.tr("New game");
1911- iconSource: Qt.resolvedUrl("icons/new_game_ubuntu.svg")
1912- onTriggered: {
1913- if(gameFinishedRectangle.visible) gameFinishedRectangle.visible = false;
1914- //print("new block distance:", blockDistance);
1915- //createNewGame()
1916- if (settingsTab.difficultyIndex == 4)
1917- PopupUtils.open(newGameComponent)
1918- else {
1919- createNewGame()
1920- }
1921- }
1922- },
1923- Action {
1924- objectName: "hintbutton"
1925- id: revealHintAction
1926- iconSource: Qt.resolvedUrl("icons/hint.svg")
1927- text: i18n.tr("Show hint");
1928- enabled: disableHints.checked;
1929- onTriggered: {
1930- revealHint()
1931- }
1932- }
1933- ]
1934-
1935- //Column {
1936- // id: mainColumn;
1937- //width: mainView.width;
1938- //height: mainView.height;
1939- //anchors.left: parent.left;
1940- //anchors.leftMargin: units.dp(3)
1941- //anchors.fill: parent
1942- //spacing: units.gu(5)
1943-
1944 SudokuBlocksGrid {
1945 id: sudokuBlocksGrid;
1946 objectName: "blockgrid"
1947- //x: units.dp(3)
1948 x: !mainView.wideAspect() ? 0.5*(mainView.width-9*sudokuBlocksGrid.blockSize-
1949 22*sudokuBlocksGrid.blockDistance) :
1950 0.25*(mainView.width-9*sudokuBlocksGrid.blockSize-
1951 22*sudokuBlocksGrid.blockDistance)
1952
1953- y: !mainView.wideAspect() ? units.gu(1) : mainView.height*0.05
1954+ y: !mainView.wideAspect() ? mainPage.header.height : mainView.height*0.05
1955
1956 }
1957-
1958- //}
1959 }
1960-
1961 }
1962
1963 // Highscores Tab
1964-
1965- Tab {
1966+ HighscoresTab {
1967 id: highscoresTab
1968 objectName: "highscoresTab"
1969- title: i18n.tr("Scores")
1970- page: HighscoresTab{ id: hsPage }
1971 }
1972
1973-
1974-
1975 // settingsTab
1976- Tab {
1977- id: settingsTab;
1978+ SettingsTab {
1979+ id: settingsTab
1980 objectName: "settingsTab"
1981- title: i18n.tr("Settings")
1982-
1983- property alias disableHintsChecked: disableHints.checked;
1984- property alias disableVibrationsChecked: disableVibrations.checked;
1985- property alias difficultyIndex: difficultySelector.selectedIndex;
1986- property alias themeIndex: themeSelector.selectedIndex;
1987-
1988- page: Page {
1989- objectName: "settingsPage"
1990-
1991- anchors {
1992- left: parent.left
1993- right: parent.right
1994- top: parent.top
1995- }
1996- height: mainView.height
1997-
1998-
1999- Component {
2000- id: profileSelector
2001- Dialog {
2002- objectName: "selectProfileDialog"
2003- title: i18n.tr("Select profile")
2004-
2005- Column{
2006- height: mainColumnSettings.height*2/3
2007- ListView {
2008-
2009- id: profileListView
2010- objectName: "profileListView"
2011- clip: true
2012- width: parent.width
2013- height: parent.height - units.gu(12)
2014- model: profilesModel
2015-
2016- delegate:
2017- ListItem.Standard {
2018- text: firstname + " " + lastname
2019- progression: true
2020- onTriggered: {
2021- //console.log("clicked "+index)
2022- currentUserId = profileId;
2023- hide()
2024- }
2025- }
2026-
2027- }
2028-
2029- SudokuDialogButton{
2030- anchors.horizontalCenter: parent.horizontalCenter
2031- id:cancelButton
2032- buttonText: i18n.tr("Cancel")
2033- width: parent.width/2;
2034- size: units.gu(5)
2035- buttonColor: sudokuBlocksGrid.dialogButtonColor1
2036- textColor: sudokuBlocksGrid.dialogButtonTextColor
2037- //border.color: "transparent"
2038- onTriggered: {
2039- hide()
2040- }
2041- }
2042-
2043- }
2044- }
2045- }
2046-
2047- Component {
2048- id: manageProfileSelector
2049- Dialog {
2050- objectName: "manageProfileDialog"
2051- title: i18n.tr("Select profile")
2052-
2053- Column{
2054- height: mainColumnSettings.height*2/3
2055- ListView {
2056- id: manageProfileListView
2057- objectName: "manageProfileListView"
2058- clip: true
2059- width: parent.width
2060- height: parent.height - units.gu(12)
2061- model: profilesModel
2062-
2063- delegate:
2064-
2065- ListItem.Standard {
2066- text: firstname + " " + lastname
2067-
2068- progression: true
2069- onTriggered: {
2070- hide()
2071- editUserId = profileId
2072- PopupUtils.open(manageProfileDialog, selectorProfile)
2073- }
2074- }
2075-
2076-
2077-
2078- }
2079- SudokuDialogButton{
2080-
2081- anchors.horizontalCenter: parent.horizontalCenter
2082- id:cancelButton
2083- objectName: "cancelButton"
2084- buttonText: i18n.tr("Cancel")
2085- width: parent.width/2;
2086- size: units.gu(5)
2087- buttonColor: sudokuBlocksGrid.dialogButtonColor1
2088- textColor: sudokuBlocksGrid.dialogButtonTextColor
2089- //border.color: "transparent"
2090- onTriggered: {
2091- hide()
2092- }
2093- }
2094- }
2095- }
2096- }
2097-
2098- ListModel{
2099- id: profilesModel
2100- }
2101-
2102- //id: mainColumnSettings;
2103- //width: settingsTab.width;
2104- //height: settingsTab.height;
2105- //anchors.fill: parent
2106- //anchors.horizontalCenter: parent.horizontalCenter;
2107- //spacing: units.gu(1)
2108- Flickable {
2109- id: flickableSettings
2110- anchors.fill: parent
2111- //height: parent.height - units.gu(10)
2112- //width: parent.width
2113- flickableDirection: Flickable.VerticalFlick
2114- //clip: true
2115- objectName: "settingsContainer"
2116- Column {
2117- id: mainColumnSettings;
2118- //anchors.fill: parent
2119- height: parent.height
2120- width: parent.width
2121- spacing: units.gu(1)
2122-
2123- ListItem.Header {
2124- text: i18n.tr("<b>Sudoku settings</b>")
2125- }
2126-
2127- OptionSelector {
2128- objectName: "difficultySelector"
2129- id: difficultySelector
2130- text: i18n.tr("Default Difficulty")
2131- width: parent.width - units.gu(4)
2132- anchors.horizontalCenter: parent.horizontalCenter
2133- model: [i18n.tr("Easy"), i18n.tr("Moderate"), i18n.tr("Hard"), i18n.tr("Ultra Hard"), i18n.tr("Always ask")]
2134- onSelectedIndexChanged: {
2135- //print(difficultySelector.selectedIndex)
2136- switch(difficultySelector.selectedIndex) {
2137- case 0:
2138- var randomnumber = Math.floor(Math.random()*9);
2139- randomnumber += 31;
2140- sudokuBlocksGrid.createNewGame(81 - randomnumber);
2141- Settings.setSetting("Difficulty", selectedIndex)
2142- sudokuBlocksGrid.gameDifficulty = 0
2143- break;
2144- case 1:
2145- var randomnumber = Math.floor(Math.random()*4);
2146- randomnumber += 26;
2147- sudokuBlocksGrid.createNewGame(81 - randomnumber);
2148- Settings.setSetting("Difficulty", selectedIndex)
2149- sudokuBlocksGrid.gameDifficulty = 1
2150- break;
2151- case 2:
2152- var randomnumber = Math.floor(Math.random()*4);
2153- randomnumber += 21;
2154- sudokuBlocksGrid.createNewGame(81 - randomnumber);
2155- Settings.setSetting("Difficulty", selectedIndex)
2156- sudokuBlocksGrid.gameDifficulty = 2
2157- break;
2158- case 3:
2159- var randomnumber = Math.floor(Math.random()*3);
2160- randomnumber += 17;
2161- sudokuBlocksGrid.createNewGame(81 - randomnumber);
2162- Settings.setSetting("Difficulty", selectedIndex)
2163- sudokuBlocksGrid.gameDifficulty = 3
2164- break;
2165- case 4:
2166- Settings.setSetting("Difficulty", selectedIndex)
2167- break;
2168- }
2169- }
2170-
2171- }
2172- OptionSelector {
2173- objectName: "themeSelector"
2174- id: themeSelector
2175- text: i18n.tr("Theme")
2176- model: ["UbuntuColours", "Simple"]
2177- width: parent.width - units.gu(4)
2178- anchors.horizontalCenter: parent.horizontalCenter
2179- onSelectedIndexChanged: {
2180- var newColorScheme = null;
2181- if (selectedIndex == 0)
2182- {
2183- //print("Ubuntu")
2184- var result = Settings.setSetting("ColorTheme", selectedIndex);
2185- //print(result);
2186- sudokuBlocksGrid.changeColorScheme("ColorSchemeUbuntu.qml");
2187- }
2188- if (selectedIndex == 1)
2189- {
2190- //print("Simple")
2191- var result = Settings.setSetting("ColorTheme", selectedIndex);
2192- //print(result);
2193- sudokuBlocksGrid.changeColorScheme("ColorSchemeSimple.qml");
2194- }
2195- }
2196- Component.onCompleted: selectedIndex = 0
2197- }
2198-
2199- ListItem.Standard {
2200- objectName: "hintsSwitchClickable"
2201- text: i18n.tr("Hints")
2202- width: parent.width
2203- control: Switch {
2204- objectName: "hintsSwitch"
2205- id: disableHints
2206- anchors.horizontalCenter: parent.horizontalCenter
2207- anchors.verticalCenter: parent.verticalCenter
2208- checked: disableHintsChecked
2209- onCheckedChanged: {
2210- var result = Settings.setSetting("DisableHints", checked ? "true":"false");
2211- //print(result);
2212- }
2213- }
2214- }
2215- ListItem.Standard {
2216- objectName: "vibrationsSwitchClickable"
2217- text: i18n.tr("Vibration Alerts")
2218- width: parent.width
2219- control: Switch {
2220- objectName: "vibrationsSwitch"
2221- id: disableVibrations
2222- anchors.horizontalCenter: parent.horizontalCenter
2223- anchors.verticalCenter: parent.verticalCenter
2224- checked: disableVibrationsChecked
2225- onCheckedChanged: {
2226- var result = Settings.setSetting("DisableVibrations", checked ? "true":"false");
2227- //print(result);
2228- }
2229- }
2230- }
2231- ListItem.Divider {}
2232-
2233- ListItem.Header {
2234- text: i18n.tr("<b>Profiles settings</b>")
2235- }
2236- ListItem.SingleValue {
2237- objectName: "Current profile"
2238- text: i18n.tr("Current profile")
2239- id: selectorProfile
2240- value: {
2241- if(currentUserId==-1)
2242- return i18n.tr("None")
2243- else
2244- return Settings.getUserFirstName(currentUserId)+" "+Settings.getUserLastName(currentUserId);
2245-
2246- }
2247-
2248- Component.onCompleted:
2249- currentUserId = Settings.getSetting("currentUserId")
2250-
2251- onClicked: {
2252-
2253- var allProfiles = new Array();
2254- allProfiles = Settings.getAllProfiles()
2255-
2256- profilesModel.clear()
2257-
2258- for(var i = 0; i < allProfiles.length; i++)
2259- {
2260- profilesModel.append({"profileId":allProfiles[i].id,"lastname":allProfiles[i].lastname, "firstname":allProfiles[i].firstname})
2261- }
2262- PopupUtils.open(profileSelector, selectorProfile)
2263- }
2264- }
2265-
2266- AddProfileDialog{
2267- id:addProfileDialog
2268- }
2269-
2270- ManageProfileDialog{
2271- id:manageProfileDialog
2272- }
2273-
2274-
2275- ListItem.SingleValue {
2276- objectName: "Add profile"
2277- id:addSingleValue
2278- text: i18n.tr("Add profile")
2279- onClicked: {
2280- PopupUtils.open(addProfileDialog, addSingleValue);
2281- }
2282- }
2283-
2284- ListItem.SingleValue {
2285- objectName: "Manage profiles"
2286- id:manageProfileSingleValue
2287- text: i18n.tr("Manage profiles")
2288- onClicked: {
2289-
2290- var allProfiles = new Array();
2291- allProfiles = Settings.getAllProfiles()
2292-
2293- profilesModel.clear()
2294-
2295- for(var i = 0; i < allProfiles.length; i++)
2296- {
2297- profilesModel.append({"profileId":allProfiles[i].id,"lastname":allProfiles[i].lastname, "firstname":allProfiles[i].firstname})
2298- }
2299-
2300- PopupUtils.open(manageProfileSelector, manageProfileSingleValue)
2301- }
2302- }
2303- }
2304- }
2305-
2306- Scrollbar {
2307- flickableItem: flickableSettings
2308- align: Qt.AlignTrailing
2309- }
2310- }
2311-
2312-
2313 }
2314
2315-
2316 AboutTab {
2317 id: aboutTab
2318 objectName: "aboutTab"
2319- title: i18n.tr("About")
2320 }
2321 }
2322 }

Subscribers

People subscribed via source and target branches