Merge lp:~fredoust/sudoku-app/fix-bug-1202084 into lp:sudoku-app

Proposed by Frédéric Delgado on 2013-07-21
Status: Merged
Approved by: Dinko Osmankovic on 2013-07-21
Approved revision: 90
Merged at revision: 91
Proposed branch: lp:~fredoust/sudoku-app/fix-bug-1202084
Merge into: lp:sudoku-app
Diff against target: 679 lines (+341/-325)
1 file modified
sudoku-app.qml (+341/-325)
To merge this branch: bzr merge lp:~fredoust/sudoku-app/fix-bug-1202084
Reviewer Review Type Date Requested Status
Ubuntu Phone Apps Jenkins Bot continuous-integration 2013-07-21 Approve on 2013-07-21
Dinko Osmankovic 2013-07-21 Approve on 2013-07-21
Review via email: mp+176065@code.launchpad.net

Commit message

fix for bug 1202084 by changing defaultSheet to dialog with cancel button

Description of the change

fix for bug 1202084 by changing defaultSheet to dialog with cancel button

To post a comment you must log in.
review: Approve
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'sudoku-app.qml'
2--- sudoku-app.qml 2013-07-19 14:06:01 +0000
3+++ sudoku-app.qml 2013-07-21 16:06:26 +0000
4@@ -441,334 +441,350 @@
5
6 Component {
7 id: profileSelector
8- DefaultSheet {
9- title: i18n.tr("Select profile")
10- contentsHeight: mainView.height
11-
12- /*
13- Column {
14- anchors {
15- top: parent.top
16- left: parent.left
17- right: parent.right
18- }
19- height: mainColumnSettings.height
20-
21- ListItem.Header {
22- id: header
23- text: i18n.tr("Select profile")
24- }
25- */
26-
27-
28-
29- ListView {
30- height: mainColumnSettings.height
31- id: profileListView
32- clip: true
33- width: parent.width
34- // height: parent.height - header.height
35- model: profilesModel
36-
37- delegate:
38- ListItem.Standard {
39-
40- text: firstname + " " + lastname
41- progression: true
42- onTriggered: {
43- console.log("clicked "+index)
44- currentUserId = profileId;
45- hide()
46- }
47- }
48-
49- }
50- }
51- // }
52- }
53-
54- Component {
55- id: manageProfileSelector
56- DefaultSheet {
57- title: i18n.tr("Select profile")
58- contentsHeight: mainView.height
59-
60-
61-
62- ListView {
63- id: manageProfileListView
64- clip: true
65- width: parent.width
66- height: mainColumnSettings.height
67- model: profilesModel
68-
69- delegate:
70-
71- ListItem.Standard {
72-
73- text: firstname + " " + lastname
74-
75- progression: true
76- onTriggered: {
77- hide()
78- editUserId = profileId
79- PopupUtils.open(manageProfileDialog, selectorProfile)
80- }
81- }
82-
83-
84-
85- }
86- }
87- }
88-
89- ListModel{
90- id: profilesModel
91- }
92-
93- id: mainColumnSettings;
94- //width: settingsTab.width;
95- //height: settingsTab.height;
96- anchors.fill: parent
97- //anchors.horizontalCenter: parent.horizontalCenter;
98- spacing: units.gu(1)
99-
100- ListItem.Header {
101- text: i18n.tr("<b>Sudoku settings</b>")
102- }
103-
104- ListItem.ValueSelector {
105- objectName: "difficultySelector"
106- id: difficultySelector
107- text: i18n.tr("Difficulty")
108- values: [i18n.tr("Easy"), i18n.tr("Moderate"), i18n.tr("Hard"), i18n.tr("Ultra Hard")]
109- onSelectedIndexChanged: {
110- //print(difficultySelector.selectedIndex)
111- switch(difficultySelector.selectedIndex) {
112- case 0:
113- var randomnumber = Math.floor(Math.random()*9);
114- randomnumber += 31;
115- sudokuBlocksGrid.createNewGame(81 - randomnumber);
116- Settings.setSetting("Difficulty", selectedIndex)
117- break;
118- case 1:
119- var randomnumber = Math.floor(Math.random()*4);
120- randomnumber += 26;
121- sudokuBlocksGrid.createNewGame(81 - randomnumber);
122- Settings.setSetting("Difficulty", selectedIndex)
123- break;
124- case 2:
125- var randomnumber = Math.floor(Math.random()*4);
126- randomnumber += 21;
127- sudokuBlocksGrid.createNewGame(81 - randomnumber);
128- Settings.setSetting("Difficulty", selectedIndex)
129- break;
130- case 3:
131- var randomnumber = Math.floor(Math.random()*3);
132- randomnumber += 17;
133- sudokuBlocksGrid.createNewGame(81 - randomnumber);
134- Settings.setSetting("Difficulty", selectedIndex)
135- break;
136- }
137- }
138-
139- }
140- ListItem.ValueSelector {
141- id: themeSelector
142- text: i18n.tr("Theme")
143- values: ["UbuntuColours", "Simple"]
144- onSelectedIndexChanged: {
145- var newColorScheme = null;
146- if (selectedIndex == 0)
147- {
148- //print("Ubuntu")
149- var result = Settings.setSetting("ColorTheme", selectedIndex);
150- //print(result);
151- sudokuBlocksGrid.changeColorScheme("ColorSchemeUbuntu.qml");
152- }
153- if (selectedIndex == 1)
154- {
155- //print("Simple")
156- var result = Settings.setSetting("ColorTheme", selectedIndex);
157- //print(result);
158- sudokuBlocksGrid.changeColorScheme("ColorSchemeSimple.qml");
159- }
160- }
161- }
162-
163- ListItem.Standard {
164- objectName: "hintsSwitchClickable"
165- text: i18n.tr("Hints")
166- width: parent.width
167- control: Switch {
168- objectName: "hintsSwitch"
169- id: disableHints
170+ Dialog {
171+ title: i18n.tr("Select profile")
172+
173+
174+
175+ Column{
176+ height: mainColumnSettings.height
177+ ListView {
178+
179+ id: profileListView
180+ clip: true
181+ width: parent.width
182+ height: parent.height - units.gu(12)
183+ model: profilesModel
184+
185+ delegate:
186+ ListItem.Standard {
187+
188+ text: firstname + " " + lastname
189+ progression: true
190+ onTriggered: {
191+ console.log("clicked "+index)
192+ currentUserId = profileId;
193+ hide()
194+ }
195+ }
196+
197+ }
198+
199+ SudokuDialogButton{
200+
201+ anchors.horizontalCenter: parent.horizontalCenter
202+ id:cancelButton
203+ buttonText: i18n.tr("Cancel")
204+ width: parent.width/2;
205+ size: units.gu(5)
206+ buttonColor: sudokuBlocksGrid.dialogButtonColor1
207+ textColor: sudokuBlocksGrid.dialogButtonTextColor
208+ //border.color: "transparent"
209+ onTriggered: {
210+ hide()
211+ }
212+ }
213+
214+ }
215+ }
216+ }
217+
218+ Component {
219+ id: manageProfileSelector
220+ Dialog {
221+ title: i18n.tr("Select profile")
222+
223+ Column{
224+ height: mainColumnSettings.height
225+ ListView {
226+ id: manageProfileListView
227+ clip: true
228+ width: parent.width
229+ height: parent.height - units.gu(12)
230+ model: profilesModel
231+
232+ delegate:
233+
234+ ListItem.Standard {
235+
236+ text: firstname + " " + lastname
237+
238+ progression: true
239+ onTriggered: {
240+ hide()
241+ editUserId = profileId
242+ PopupUtils.open(manageProfileDialog, selectorProfile)
243+ }
244+ }
245+
246+
247+
248+ }
249+ SudokuDialogButton{
250+
251+ anchors.horizontalCenter: parent.horizontalCenter
252+ id:cancelButton
253+ buttonText: i18n.tr("Cancel")
254+ width: parent.width/2;
255+ size: units.gu(5)
256+ buttonColor: sudokuBlocksGrid.dialogButtonColor1
257+ textColor: sudokuBlocksGrid.dialogButtonTextColor
258+ //border.color: "transparent"
259+ onTriggered: {
260+ hide()
261+ }
262+ }
263+ }
264+ }
265+ }
266+
267+ ListModel{
268+ id: profilesModel
269+ }
270+
271+ id: mainColumnSettings;
272+ //width: settingsTab.width;
273+ //height: settingsTab.height;
274+ anchors.fill: parent
275+ //anchors.horizontalCenter: parent.horizontalCenter;
276+ spacing: units.gu(1)
277+
278+ ListItem.Header {
279+ text: i18n.tr("<b>Sudoku settings</b>")
280+ }
281+
282+ ListItem.ValueSelector {
283+ objectName: "difficultySelector"
284+ id: difficultySelector
285+ text: i18n.tr("Difficulty")
286+ values: [i18n.tr("Easy"), i18n.tr("Moderate"), i18n.tr("Hard"), i18n.tr("Ultra Hard")]
287+ onSelectedIndexChanged: {
288+ //print(difficultySelector.selectedIndex)
289+ switch(difficultySelector.selectedIndex) {
290+ case 0:
291+ var randomnumber = Math.floor(Math.random()*9);
292+ randomnumber += 31;
293+ sudokuBlocksGrid.createNewGame(81 - randomnumber);
294+ Settings.setSetting("Difficulty", selectedIndex)
295+ break;
296+ case 1:
297+ var randomnumber = Math.floor(Math.random()*4);
298+ randomnumber += 26;
299+ sudokuBlocksGrid.createNewGame(81 - randomnumber);
300+ Settings.setSetting("Difficulty", selectedIndex)
301+ break;
302+ case 2:
303+ var randomnumber = Math.floor(Math.random()*4);
304+ randomnumber += 21;
305+ sudokuBlocksGrid.createNewGame(81 - randomnumber);
306+ Settings.setSetting("Difficulty", selectedIndex)
307+ break;
308+ case 3:
309+ var randomnumber = Math.floor(Math.random()*3);
310+ randomnumber += 17;
311+ sudokuBlocksGrid.createNewGame(81 - randomnumber);
312+ Settings.setSetting("Difficulty", selectedIndex)
313+ break;
314+ }
315+ }
316+
317+ }
318+ ListItem.ValueSelector {
319+ id: themeSelector
320+ text: i18n.tr("Theme")
321+ values: ["UbuntuColours", "Simple"]
322+ onSelectedIndexChanged: {
323+ var newColorScheme = null;
324+ if (selectedIndex == 0)
325+ {
326+ //print("Ubuntu")
327+ var result = Settings.setSetting("ColorTheme", selectedIndex);
328+ //print(result);
329+ sudokuBlocksGrid.changeColorScheme("ColorSchemeUbuntu.qml");
330+ }
331+ if (selectedIndex == 1)
332+ {
333+ //print("Simple")
334+ var result = Settings.setSetting("ColorTheme", selectedIndex);
335+ //print(result);
336+ sudokuBlocksGrid.changeColorScheme("ColorSchemeSimple.qml");
337+ }
338+ }
339+ }
340+
341+ ListItem.Standard {
342+ objectName: "hintsSwitchClickable"
343+ text: i18n.tr("Hints")
344+ width: parent.width
345+ control: Switch {
346+ objectName: "hintsSwitch"
347+ id: disableHints
348+ anchors.horizontalCenter: parent.horizontalCenter
349+ anchors.verticalCenter: parent.verticalCenter
350+ checked: disableHintsChecked
351+ onCheckedChanged: {
352+ var result = Settings.setSetting("DisableHints", checked ? "true":"false");
353+ //print(result);
354+ }
355+ }
356+ }
357+ ListItem.Header {
358+ text: i18n.tr("<b>Profiles settings</b>")
359+ }
360+ ListItem.SingleValue {
361+ text: "Current profile"
362+ id: selectorProfile
363+ value: {
364+ if(currentUserId==-1)
365+ return i18n.tr("None")
366+ else
367+ return Settings.getUserFirstName(currentUserId)+" "+Settings.getUserLastName(currentUserId);
368+
369+ }
370+
371+ onClicked: {
372+
373+ var allProfiles = new Array();
374+ allProfiles = Settings.getAllProfiles()
375+
376+ profilesModel.clear()
377+
378+ for(var i = 0; i < allProfiles.length; i++)
379+ {
380+ profilesModel.append({"profileId":allProfiles[i].id,"lastname":allProfiles[i].lastname, "firstname":allProfiles[i].firstname})
381+ }
382+ PopupUtils.open(profileSelector, selectorProfile)
383+ }
384+ }
385+
386+ AddProfileDialog{
387+ id:addProfileDialog
388+ }
389+
390+ ManageProfileDialog{
391+ id:manageProfileDialog
392+ }
393+
394+
395+ ListItem.SingleValue {
396+ id:addSingleValue
397+ text: i18n.tr("Add profile")
398+ onClicked: {
399+ PopupUtils.open(addProfileDialog, addSingleValue);
400+ }
401+ }
402+
403+ ListItem.SingleValue {
404+ id:manageProfileSingleValue
405+ text: i18n.tr("Manage profiles")
406+ onClicked: {
407+
408+ var allProfiles = new Array();
409+ allProfiles = Settings.getAllProfiles()
410+
411+ profilesModel.clear()
412+
413+ for(var i = 0; i < allProfiles.length; i++)
414+ {
415+ profilesModel.append({"profileId":allProfiles[i].id,"lastname":allProfiles[i].lastname, "firstname":allProfiles[i].firstname})
416+ }
417+
418+ PopupUtils.open(manageProfileSelector, manageProfileSingleValue)
419+ }
420+ }
421+
422+
423+ }
424+ }
425+
426+
427+ }
428+
429+ Tab {
430+ id: aboutTab;
431+ objectName: "aboutTab"
432+ title: i18n.tr("About")
433+ page: Page {
434+
435+ Column {
436+ id: aboutColumn;
437+ spacing: 5;
438+ //anchors.fill: parent
439+ anchors.horizontalCenter: parent.horizontalCenter;
440+ y: units.gu(8);
441+ Image {
442+ objectName: "aboutImage"
443+ property real maxWidth: units.gu(100)
444 anchors.horizontalCenter: parent.horizontalCenter
445- anchors.verticalCenter: parent.verticalCenter
446- checked: disableHintsChecked
447- onCheckedChanged: {
448- var result = Settings.setSetting("DisableHints", checked ? "true":"false");
449- //print(result);
450- }
451- }
452- }
453- ListItem.Header {
454- text: i18n.tr("<b>Profiles settings</b>")
455- }
456- ListItem.SingleValue {
457- text: "Current profile"
458- id: selectorProfile
459- value: {
460- if(currentUserId==-1)
461- return i18n.tr("None")
462- else
463- return Settings.getUserFirstName(currentUserId)+" "+Settings.getUserLastName(currentUserId);
464-
465- }
466-
467- onClicked: {
468-
469- var allProfiles = new Array();
470- allProfiles = Settings.getAllProfiles()
471-
472- profilesModel.clear()
473-
474- for(var i = 0; i < allProfiles.length; i++)
475- {
476- profilesModel.append({"profileId":allProfiles[i].id,"lastname":allProfiles[i].lastname, "firstname":allProfiles[i].firstname})
477- }
478- PopupUtils.open(profileSelector, selectorProfile)
479- }
480- }
481-
482- AddProfileDialog{
483- id:addProfileDialog
484- }
485-
486- ManageProfileDialog{
487- id:manageProfileDialog
488- }
489-
490-
491- ListItem.SingleValue {
492- id:addSingleValue
493- text: i18n.tr("Add profile")
494- onClicked: {
495- PopupUtils.open(addProfileDialog, addSingleValue);
496- }
497- }
498-
499- ListItem.SingleValue {
500- id:manageProfileSingleValue
501- text: i18n.tr("Manage profiles")
502- onClicked: {
503-
504- var allProfiles = new Array();
505- allProfiles = Settings.getAllProfiles()
506-
507- profilesModel.clear()
508-
509- for(var i = 0; i < allProfiles.length; i++)
510- {
511- profilesModel.append({"profileId":allProfiles[i].id,"lastname":allProfiles[i].lastname, "firstname":allProfiles[i].firstname})
512- }
513-
514- PopupUtils.open(manageProfileSelector, manageProfileSingleValue)
515- }
516- }
517-
518-
519- }
520- }
521-
522-
523- }
524-
525- Tab {
526- id: aboutTab;
527- objectName: "aboutTab"
528- title: i18n.tr("About")
529- page: Page {
530-
531- Column {
532- id: aboutColumn;
533- spacing: 5;
534- //anchors.fill: parent
535- anchors.horizontalCenter: parent.horizontalCenter;
536- y: units.gu(8);
537- Image {
538- objectName: "aboutImage"
539- property real maxWidth: units.gu(100)
540- anchors.horizontalCenter: parent.horizontalCenter
541- width: Math.min(mainView.width, maxWidth)/1.75
542- //height: width
543- source: "icons/sudoko-vector-about.svg"
544- smooth: true
545- fillMode: Image.PreserveAspectFit
546-
547- }
548- Row {
549- //anchors.horizontalCenter: parent.horizontalCenter;
550- anchors.left: aboutColumn.left
551- Label {
552- objectName: "authorLabel"
553- text: i18n.tr("Author(s): ")
554-
555- }
556- Label {
557- objectName: "authors"
558- font.bold: true;
559- text: "Dinko Osmankovic\nFr\u00e9d\u00e9ric Delgado\nGeorgi Karavasilev"
560- }
561- }
562- Row {
563- anchors.horizontalCenter: parent.horizontalCenter;
564- Label {
565- objectName: "contactLabel"
566- text: i18n.tr("Contact: ")
567- }
568- Label {
569- objectName: "contacts"
570- font.bold: true;
571- text: "Dinko Osmankovic\nFrédéric Delgado\nGeorgi Karavasilev"
572- }
573- }
574- Row {
575- id: homepage;
576- anchors.horizontalCenter: parent.horizontalCenter;
577- Label {
578- objectName: "urlLabel"
579- font.bold: true;
580- text: "<a href=\"https://launchpad.net/sudoku-app\">https://launchpad.net/sudoku-app</a>"
581- onLinkActivated: Qt.openUrlExternally(link)
582- }
583- }
584- }
585- Row {
586- anchors.horizontalCenter: parent.horizontalCenter;
587- anchors.top: aboutColumn.bottom;
588- anchors.topMargin: units.gu(5);
589- Label {
590- objectName: "versionLabel"
591- text: i18n.tr("Version: ")
592- }
593- Label {
594- objectName: "version"
595- font.bold: true;
596- text: "0.4"
597- }
598- }
599- Row {
600- anchors.horizontalCenter: parent.horizontalCenter;
601- anchors.top: aboutColumn.bottom;
602- anchors.topMargin: units.gu(8);
603- Label {
604- objectName: "yearLabel"
605- font.bold: true;
606- text: "2013"
607+ width: Math.min(mainView.width, maxWidth)/1.75
608+ //height: width
609+ source: "icons/sudoko-vector-about.svg"
610+ smooth: true
611+ fillMode: Image.PreserveAspectFit
612+
613+ }
614+ Row {
615+ //anchors.horizontalCenter: parent.horizontalCenter;
616+ anchors.left: aboutColumn.left
617+ Label {
618+ objectName: "authorLabel"
619+ text: i18n.tr("Author(s): ")
620+
621+ }
622+ Label {
623+ objectName: "authors"
624+ font.bold: true;
625+ text: "Dinko Osmankovic\nFr\u00e9d\u00e9ric Delgado\nGeorgi Karavasilev"
626+ }
627+ }
628+ Row {
629+ anchors.horizontalCenter: parent.horizontalCenter;
630+ Label {
631+ objectName: "contactLabel"
632+ text: i18n.tr("Contact: ")
633+ }
634+ Label {
635+ objectName: "contacts"
636+ font.bold: true;
637+ text: "Dinko Osmankovic\nFrédéric Delgado\nGeorgi Karavasilev"
638+ }
639+ }
640+ Row {
641+ id: homepage;
642+ anchors.horizontalCenter: parent.horizontalCenter;
643+ Label {
644+ objectName: "urlLabel"
645+ font.bold: true;
646+ text: "<a href=\"https://launchpad.net/sudoku-app\">https://launchpad.net/sudoku-app</a>"
647+ onLinkActivated: Qt.openUrlExternally(link)
648+ }
649+ }
650+ }
651+ Row {
652+ anchors.horizontalCenter: parent.horizontalCenter;
653+ anchors.top: aboutColumn.bottom;
654+ anchors.topMargin: units.gu(5);
655+ Label {
656+ objectName: "versionLabel"
657+ text: i18n.tr("Version: ")
658+ }
659+ Label {
660+ objectName: "version"
661+ font.bold: true;
662+ text: "0.4"
663+ }
664+ }
665+ Row {
666+ anchors.horizontalCenter: parent.horizontalCenter;
667+ anchors.top: aboutColumn.bottom;
668+ anchors.topMargin: units.gu(8);
669+ Label {
670+ objectName: "yearLabel"
671+ font.bold: true;
672+ text: "2013"
673+ }
674 }
675 }
676 }
677 }
678 }
679-}

Subscribers

People subscribed via source and target branches