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

Proposed by Frédéric Delgado
Status: Merged
Approved by: Dinko Osmankovic
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 Approve
Dinko Osmankovic Approve
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.
Revision history for this message
Dinko Osmankovic (dinko-metalac) :
review: Approve
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-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 'sudoku-app.qml'
--- sudoku-app.qml 2013-07-19 14:06:01 +0000
+++ sudoku-app.qml 2013-07-21 16:06:26 +0000
@@ -441,334 +441,350 @@
441441
442 Component {442 Component {
443 id: profileSelector443 id: profileSelector
444 DefaultSheet {444 Dialog {
445 title: i18n.tr("Select profile")445 title: i18n.tr("Select profile")
446 contentsHeight: mainView.height446
447447
448 /*448
449 Column {449 Column{
450 anchors {450 height: mainColumnSettings.height
451 top: parent.top451 ListView {
452 left: parent.left452
453 right: parent.right453 id: profileListView
454 }454 clip: true
455 height: mainColumnSettings.height455 width: parent.width
456456 height: parent.height - units.gu(12)
457 ListItem.Header {457 model: profilesModel
458 id: header458
459 text: i18n.tr("Select profile")459 delegate:
460 }460 ListItem.Standard {
461 */461
462462 text: firstname + " " + lastname
463463 progression: true
464464 onTriggered: {
465 ListView {465 console.log("clicked "+index)
466 height: mainColumnSettings.height466 currentUserId = profileId;
467 id: profileListView467 hide()
468 clip: true468 }
469 width: parent.width469 }
470 // height: parent.height - header.height470
471 model: profilesModel471 }
472472
473 delegate:473 SudokuDialogButton{
474 ListItem.Standard {474
475475 anchors.horizontalCenter: parent.horizontalCenter
476 text: firstname + " " + lastname476 id:cancelButton
477 progression: true477 buttonText: i18n.tr("Cancel")
478 onTriggered: {478 width: parent.width/2;
479 console.log("clicked "+index)479 size: units.gu(5)
480 currentUserId = profileId;480 buttonColor: sudokuBlocksGrid.dialogButtonColor1
481 hide()481 textColor: sudokuBlocksGrid.dialogButtonTextColor
482 }482 //border.color: "transparent"
483 }483 onTriggered: {
484484 hide()
485 }485 }
486 }486 }
487 // }487
488 }488 }
489489 }
490 Component {490 }
491 id: manageProfileSelector491
492 DefaultSheet {492 Component {
493 title: i18n.tr("Select profile")493 id: manageProfileSelector
494 contentsHeight: mainView.height494 Dialog {
495495 title: i18n.tr("Select profile")
496496
497497 Column{
498 ListView {498 height: mainColumnSettings.height
499 id: manageProfileListView499 ListView {
500 clip: true500 id: manageProfileListView
501 width: parent.width501 clip: true
502 height: mainColumnSettings.height502 width: parent.width
503 model: profilesModel503 height: parent.height - units.gu(12)
504504 model: profilesModel
505 delegate:505
506506 delegate:
507 ListItem.Standard {507
508508 ListItem.Standard {
509 text: firstname + " " + lastname509
510510 text: firstname + " " + lastname
511 progression: true511
512 onTriggered: {512 progression: true
513 hide()513 onTriggered: {
514 editUserId = profileId514 hide()
515 PopupUtils.open(manageProfileDialog, selectorProfile)515 editUserId = profileId
516 }516 PopupUtils.open(manageProfileDialog, selectorProfile)
517 }517 }
518518 }
519519
520520
521 }521
522 }522 }
523 }523 SudokuDialogButton{
524524
525 ListModel{525 anchors.horizontalCenter: parent.horizontalCenter
526 id: profilesModel526 id:cancelButton
527 }527 buttonText: i18n.tr("Cancel")
528528 width: parent.width/2;
529 id: mainColumnSettings;529 size: units.gu(5)
530 //width: settingsTab.width;530 buttonColor: sudokuBlocksGrid.dialogButtonColor1
531 //height: settingsTab.height;531 textColor: sudokuBlocksGrid.dialogButtonTextColor
532 anchors.fill: parent532 //border.color: "transparent"
533 //anchors.horizontalCenter: parent.horizontalCenter;533 onTriggered: {
534 spacing: units.gu(1)534 hide()
535535 }
536 ListItem.Header {536 }
537 text: i18n.tr("<b>Sudoku settings</b>")537 }
538 }538 }
539539 }
540 ListItem.ValueSelector {540
541 objectName: "difficultySelector"541 ListModel{
542 id: difficultySelector542 id: profilesModel
543 text: i18n.tr("Difficulty")543 }
544 values: [i18n.tr("Easy"), i18n.tr("Moderate"), i18n.tr("Hard"), i18n.tr("Ultra Hard")]544
545 onSelectedIndexChanged: {545 id: mainColumnSettings;
546 //print(difficultySelector.selectedIndex)546 //width: settingsTab.width;
547 switch(difficultySelector.selectedIndex) {547 //height: settingsTab.height;
548 case 0:548 anchors.fill: parent
549 var randomnumber = Math.floor(Math.random()*9);549 //anchors.horizontalCenter: parent.horizontalCenter;
550 randomnumber += 31;550 spacing: units.gu(1)
551 sudokuBlocksGrid.createNewGame(81 - randomnumber);551
552 Settings.setSetting("Difficulty", selectedIndex)552 ListItem.Header {
553 break;553 text: i18n.tr("<b>Sudoku settings</b>")
554 case 1:554 }
555 var randomnumber = Math.floor(Math.random()*4);555
556 randomnumber += 26;556 ListItem.ValueSelector {
557 sudokuBlocksGrid.createNewGame(81 - randomnumber);557 objectName: "difficultySelector"
558 Settings.setSetting("Difficulty", selectedIndex)558 id: difficultySelector
559 break;559 text: i18n.tr("Difficulty")
560 case 2:560 values: [i18n.tr("Easy"), i18n.tr("Moderate"), i18n.tr("Hard"), i18n.tr("Ultra Hard")]
561 var randomnumber = Math.floor(Math.random()*4);561 onSelectedIndexChanged: {
562 randomnumber += 21;562 //print(difficultySelector.selectedIndex)
563 sudokuBlocksGrid.createNewGame(81 - randomnumber);563 switch(difficultySelector.selectedIndex) {
564 Settings.setSetting("Difficulty", selectedIndex)564 case 0:
565 break;565 var randomnumber = Math.floor(Math.random()*9);
566 case 3:566 randomnumber += 31;
567 var randomnumber = Math.floor(Math.random()*3);567 sudokuBlocksGrid.createNewGame(81 - randomnumber);
568 randomnumber += 17;568 Settings.setSetting("Difficulty", selectedIndex)
569 sudokuBlocksGrid.createNewGame(81 - randomnumber);569 break;
570 Settings.setSetting("Difficulty", selectedIndex)570 case 1:
571 break;571 var randomnumber = Math.floor(Math.random()*4);
572 }572 randomnumber += 26;
573 }573 sudokuBlocksGrid.createNewGame(81 - randomnumber);
574574 Settings.setSetting("Difficulty", selectedIndex)
575 }575 break;
576 ListItem.ValueSelector {576 case 2:
577 id: themeSelector577 var randomnumber = Math.floor(Math.random()*4);
578 text: i18n.tr("Theme")578 randomnumber += 21;
579 values: ["UbuntuColours", "Simple"]579 sudokuBlocksGrid.createNewGame(81 - randomnumber);
580 onSelectedIndexChanged: {580 Settings.setSetting("Difficulty", selectedIndex)
581 var newColorScheme = null;581 break;
582 if (selectedIndex == 0)582 case 3:
583 {583 var randomnumber = Math.floor(Math.random()*3);
584 //print("Ubuntu")584 randomnumber += 17;
585 var result = Settings.setSetting("ColorTheme", selectedIndex);585 sudokuBlocksGrid.createNewGame(81 - randomnumber);
586 //print(result);586 Settings.setSetting("Difficulty", selectedIndex)
587 sudokuBlocksGrid.changeColorScheme("ColorSchemeUbuntu.qml");587 break;
588 }588 }
589 if (selectedIndex == 1)589 }
590 {590
591 //print("Simple")591 }
592 var result = Settings.setSetting("ColorTheme", selectedIndex);592 ListItem.ValueSelector {
593 //print(result);593 id: themeSelector
594 sudokuBlocksGrid.changeColorScheme("ColorSchemeSimple.qml");594 text: i18n.tr("Theme")
595 }595 values: ["UbuntuColours", "Simple"]
596 }596 onSelectedIndexChanged: {
597 }597 var newColorScheme = null;
598598 if (selectedIndex == 0)
599 ListItem.Standard {599 {
600 objectName: "hintsSwitchClickable"600 //print("Ubuntu")
601 text: i18n.tr("Hints")601 var result = Settings.setSetting("ColorTheme", selectedIndex);
602 width: parent.width602 //print(result);
603 control: Switch {603 sudokuBlocksGrid.changeColorScheme("ColorSchemeUbuntu.qml");
604 objectName: "hintsSwitch"604 }
605 id: disableHints605 if (selectedIndex == 1)
606 {
607 //print("Simple")
608 var result = Settings.setSetting("ColorTheme", selectedIndex);
609 //print(result);
610 sudokuBlocksGrid.changeColorScheme("ColorSchemeSimple.qml");
611 }
612 }
613 }
614
615 ListItem.Standard {
616 objectName: "hintsSwitchClickable"
617 text: i18n.tr("Hints")
618 width: parent.width
619 control: Switch {
620 objectName: "hintsSwitch"
621 id: disableHints
622 anchors.horizontalCenter: parent.horizontalCenter
623 anchors.verticalCenter: parent.verticalCenter
624 checked: disableHintsChecked
625 onCheckedChanged: {
626 var result = Settings.setSetting("DisableHints", checked ? "true":"false");
627 //print(result);
628 }
629 }
630 }
631 ListItem.Header {
632 text: i18n.tr("<b>Profiles settings</b>")
633 }
634 ListItem.SingleValue {
635 text: "Current profile"
636 id: selectorProfile
637 value: {
638 if(currentUserId==-1)
639 return i18n.tr("None")
640 else
641 return Settings.getUserFirstName(currentUserId)+" "+Settings.getUserLastName(currentUserId);
642
643 }
644
645 onClicked: {
646
647 var allProfiles = new Array();
648 allProfiles = Settings.getAllProfiles()
649
650 profilesModel.clear()
651
652 for(var i = 0; i < allProfiles.length; i++)
653 {
654 profilesModel.append({"profileId":allProfiles[i].id,"lastname":allProfiles[i].lastname, "firstname":allProfiles[i].firstname})
655 }
656 PopupUtils.open(profileSelector, selectorProfile)
657 }
658 }
659
660 AddProfileDialog{
661 id:addProfileDialog
662 }
663
664 ManageProfileDialog{
665 id:manageProfileDialog
666 }
667
668
669 ListItem.SingleValue {
670 id:addSingleValue
671 text: i18n.tr("Add profile")
672 onClicked: {
673 PopupUtils.open(addProfileDialog, addSingleValue);
674 }
675 }
676
677 ListItem.SingleValue {
678 id:manageProfileSingleValue
679 text: i18n.tr("Manage profiles")
680 onClicked: {
681
682 var allProfiles = new Array();
683 allProfiles = Settings.getAllProfiles()
684
685 profilesModel.clear()
686
687 for(var i = 0; i < allProfiles.length; i++)
688 {
689 profilesModel.append({"profileId":allProfiles[i].id,"lastname":allProfiles[i].lastname, "firstname":allProfiles[i].firstname})
690 }
691
692 PopupUtils.open(manageProfileSelector, manageProfileSingleValue)
693 }
694 }
695
696
697 }
698 }
699
700
701 }
702
703 Tab {
704 id: aboutTab;
705 objectName: "aboutTab"
706 title: i18n.tr("About")
707 page: Page {
708
709 Column {
710 id: aboutColumn;
711 spacing: 5;
712 //anchors.fill: parent
713 anchors.horizontalCenter: parent.horizontalCenter;
714 y: units.gu(8);
715 Image {
716 objectName: "aboutImage"
717 property real maxWidth: units.gu(100)
606 anchors.horizontalCenter: parent.horizontalCenter718 anchors.horizontalCenter: parent.horizontalCenter
607 anchors.verticalCenter: parent.verticalCenter719 width: Math.min(mainView.width, maxWidth)/1.75
608 checked: disableHintsChecked720 //height: width
609 onCheckedChanged: {721 source: "icons/sudoko-vector-about.svg"
610 var result = Settings.setSetting("DisableHints", checked ? "true":"false");722 smooth: true
611 //print(result);723 fillMode: Image.PreserveAspectFit
612 }724
613 }725 }
614 }726 Row {
615 ListItem.Header {727 //anchors.horizontalCenter: parent.horizontalCenter;
616 text: i18n.tr("<b>Profiles settings</b>")728 anchors.left: aboutColumn.left
617 }729 Label {
618 ListItem.SingleValue {730 objectName: "authorLabel"
619 text: "Current profile"731 text: i18n.tr("Author(s): ")
620 id: selectorProfile732
621 value: {733 }
622 if(currentUserId==-1)734 Label {
623 return i18n.tr("None")735 objectName: "authors"
624 else736 font.bold: true;
625 return Settings.getUserFirstName(currentUserId)+" "+Settings.getUserLastName(currentUserId);737 text: "Dinko Osmankovic\nFr\u00e9d\u00e9ric Delgado\nGeorgi Karavasilev"
626738 }
627 }739 }
628740 Row {
629 onClicked: {741 anchors.horizontalCenter: parent.horizontalCenter;
630742 Label {
631 var allProfiles = new Array();743 objectName: "contactLabel"
632 allProfiles = Settings.getAllProfiles()744 text: i18n.tr("Contact: ")
633745 }
634 profilesModel.clear()746 Label {
635747 objectName: "contacts"
636 for(var i = 0; i < allProfiles.length; i++)748 font.bold: true;
637 {749 text: "Dinko Osmankovic\nFrédéric Delgado\nGeorgi Karavasilev"
638 profilesModel.append({"profileId":allProfiles[i].id,"lastname":allProfiles[i].lastname, "firstname":allProfiles[i].firstname})750 }
639 }751 }
640 PopupUtils.open(profileSelector, selectorProfile)752 Row {
641 }753 id: homepage;
642 }754 anchors.horizontalCenter: parent.horizontalCenter;
643755 Label {
644 AddProfileDialog{756 objectName: "urlLabel"
645 id:addProfileDialog757 font.bold: true;
646 }758 text: "<a href=\"https://launchpad.net/sudoku-app\">https://launchpad.net/sudoku-app</a>"
647759 onLinkActivated: Qt.openUrlExternally(link)
648 ManageProfileDialog{760 }
649 id:manageProfileDialog761 }
650 }762 }
651763 Row {
652764 anchors.horizontalCenter: parent.horizontalCenter;
653 ListItem.SingleValue {765 anchors.top: aboutColumn.bottom;
654 id:addSingleValue766 anchors.topMargin: units.gu(5);
655 text: i18n.tr("Add profile")767 Label {
656 onClicked: {768 objectName: "versionLabel"
657 PopupUtils.open(addProfileDialog, addSingleValue);769 text: i18n.tr("Version: ")
658 }770 }
659 }771 Label {
660772 objectName: "version"
661 ListItem.SingleValue {773 font.bold: true;
662 id:manageProfileSingleValue774 text: "0.4"
663 text: i18n.tr("Manage profiles")775 }
664 onClicked: {776 }
665777 Row {
666 var allProfiles = new Array();778 anchors.horizontalCenter: parent.horizontalCenter;
667 allProfiles = Settings.getAllProfiles()779 anchors.top: aboutColumn.bottom;
668780 anchors.topMargin: units.gu(8);
669 profilesModel.clear()781 Label {
670782 objectName: "yearLabel"
671 for(var i = 0; i < allProfiles.length; i++)783 font.bold: true;
672 {784 text: "2013"
673 profilesModel.append({"profileId":allProfiles[i].id,"lastname":allProfiles[i].lastname, "firstname":allProfiles[i].firstname})785 }
674 }
675
676 PopupUtils.open(manageProfileSelector, manageProfileSingleValue)
677 }
678 }
679
680
681 }
682 }
683
684
685 }
686
687 Tab {
688 id: aboutTab;
689 objectName: "aboutTab"
690 title: i18n.tr("About")
691 page: Page {
692
693 Column {
694 id: aboutColumn;
695 spacing: 5;
696 //anchors.fill: parent
697 anchors.horizontalCenter: parent.horizontalCenter;
698 y: units.gu(8);
699 Image {
700 objectName: "aboutImage"
701 property real maxWidth: units.gu(100)
702 anchors.horizontalCenter: parent.horizontalCenter
703 width: Math.min(mainView.width, maxWidth)/1.75
704 //height: width
705 source: "icons/sudoko-vector-about.svg"
706 smooth: true
707 fillMode: Image.PreserveAspectFit
708
709 }
710 Row {
711 //anchors.horizontalCenter: parent.horizontalCenter;
712 anchors.left: aboutColumn.left
713 Label {
714 objectName: "authorLabel"
715 text: i18n.tr("Author(s): ")
716
717 }
718 Label {
719 objectName: "authors"
720 font.bold: true;
721 text: "Dinko Osmankovic\nFr\u00e9d\u00e9ric Delgado\nGeorgi Karavasilev"
722 }
723 }
724 Row {
725 anchors.horizontalCenter: parent.horizontalCenter;
726 Label {
727 objectName: "contactLabel"
728 text: i18n.tr("Contact: ")
729 }
730 Label {
731 objectName: "contacts"
732 font.bold: true;
733 text: "Dinko Osmankovic\nFrédéric Delgado\nGeorgi Karavasilev"
734 }
735 }
736 Row {
737 id: homepage;
738 anchors.horizontalCenter: parent.horizontalCenter;
739 Label {
740 objectName: "urlLabel"
741 font.bold: true;
742 text: "<a href=\"https://launchpad.net/sudoku-app\">https://launchpad.net/sudoku-app</a>"
743 onLinkActivated: Qt.openUrlExternally(link)
744 }
745 }
746 }
747 Row {
748 anchors.horizontalCenter: parent.horizontalCenter;
749 anchors.top: aboutColumn.bottom;
750 anchors.topMargin: units.gu(5);
751 Label {
752 objectName: "versionLabel"
753 text: i18n.tr("Version: ")
754 }
755 Label {
756 objectName: "version"
757 font.bold: true;
758 text: "0.4"
759 }
760 }
761 Row {
762 anchors.horizontalCenter: parent.horizontalCenter;
763 anchors.top: aboutColumn.bottom;
764 anchors.topMargin: units.gu(8);
765 Label {
766 objectName: "yearLabel"
767 font.bold: true;
768 text: "2013"
769 }786 }
770 }787 }
771 }788 }
772 }789 }
773 }790 }
774}

Subscribers

People subscribed via source and target branches