ubuntu-touch-coreapps-reviewers team mailing list archive
-
ubuntu-touch-coreapps-reviewers team
-
Mailing list archive
-
Message #08361
[Merge] lp:~nik90/sudoku-app/uc1.3-migrate into lp:sudoku-app
Nekhelesh Ramananthan has proposed merging lp:~nik90/sudoku-app/uc1.3-migrate into lp:sudoku-app.
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
Requested reviews:
Sudoku Touch developers (sudoku-touch-dev)
Related bugs:
Bug #1550745 in Sudoku App: "Sudoku app needs to be updated to the new SDK stuff"
https://bugs.launchpad.net/sudoku-app/+bug/1550745
For more details, see:
https://code.launchpad.net/~nik90/sudoku-app/uc1.3-migrate/+merge/287387
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 and migrated it to using the new ListItemLayouts
- Removed unnecessary comments
- Removed deprecated unity hud imports
- Removed unused actions declared in suduko-app.qml
--
Your team Sudoku Touch developers is requested to review the proposed merge of lp:~nik90/sudoku-app/uc1.3-migrate into lp:sudoku-app.
=== modified file 'click/manifest.json.in'
--- click/manifest.json.in 2015-07-15 16:14:23 +0000
+++ click/manifest.json.in 2016-02-28 17:25:56 +0000
@@ -1,7 +1,7 @@
{
"architecture": "all",
"description": "Sudoku game for Ubuntu devices.",
- "framework": "ubuntu-sdk-15.04",
+ "framework": "ubuntu-sdk-15.04.3-qml",
"hooks": {
"sudoku": {
"apparmor": "sudoku.apparmor",
@@ -12,7 +12,7 @@
"maintainer": "Ubuntu Core Apps Developers <ubuntu-touch-coreapps@xxxxxxxxxxxxxxxxxxx>",
"name": "@PROJECT_NAME@",
"title": "Sudoku",
- "version": "1.1.@BZR_REVNO@",
+ "version": "1.6.@BZR_REVNO@",
"x-source": {
"vcs-bzr": "@BZR_SOURCE@",
"vcs-bzr-revno": "@BZR_REVNO@"
=== modified file 'components/AboutTab.qml'
--- components/AboutTab.qml 2015-07-16 11:29:03 +0000
+++ components/AboutTab.qml 2016-02-28 17:25:56 +0000
@@ -1,18 +1,26 @@
-import QtQuick 2.3
-import Ubuntu.Components 1.1
-import Ubuntu.Components.ListItems 1.0 as ListItem
+import QtQuick 2.4
+import Ubuntu.Components 1.3
import QtQuick.LocalStorage 2.0
-import Ubuntu.Components.Popups 1.0
+import Ubuntu.Components.Popups 1.3
import Ubuntu.Layouts 1.0
import "../js/localStorage.js" as Settings
import "../components"
-//import Ubuntu.HUD 1.0 as HUD
-import Ubuntu.Unity.Action 1.1 as UnityActions
-import UserMetrics 0.1
Tab {
+ id: aboutTab
objectName: "aboutTab"
+
page: Page {
+ id: aboutPage
+
+ header: PageHeader {
+ title: i18n.tr("About")
+ leadingActionBar {
+ numberOfSlots: 0
+ actions: tabsList.actions
+ }
+ }
+
Layouts {
id: aboutTabLayout
width: mainView.width
@@ -31,14 +39,15 @@
}
spacing: units.gu(5)
+
ItemLayout {
item: "icon"
id: iconTabletItem
property real maxWidth: units.gu(80)
width: Math.min(parent.width, maxWidth)/2
height: Math.min(parent.width, maxWidth)/2
+ }
- }
Column {
//height: iconTabletItem.height
spacing: 1
@@ -65,17 +74,15 @@
}
}
}
-
-
]
Column {
id: aboutColumn;
+
spacing: units.gu(3)
- //anchors.fill: parent
- //anchors.horizontalCenter: parent.horizontalCenter;
width: parent.width
y: units.gu(6);
+
Rectangle {
Layouts.item: "icon"
property real maxWidth: units.gu(45)
@@ -89,15 +96,16 @@
smooth: true
anchors.fill: parent
fillMode: Image.PreserveAspectFit
-
}
}
+
Grid {
anchors.horizontalCenter: parent.horizontalCenter
columns: 2
rowSpacing: units.gu(2)
columnSpacing: mainView.width/10
Layouts.item: "info"
+
Label {
objectName: "authorLabel"
text: i18n.tr("Author(s): ")
@@ -117,7 +125,6 @@
font.bold: true;
text: "dinko.metalac@xxxxxxxxx"
}
-
}
Row {
@@ -131,6 +138,7 @@
onLinkActivated: Qt.openUrlExternally(link)
}
}
+
Row {
anchors.horizontalCenter: parent.horizontalCenter;
Layouts.item: "version"
@@ -141,22 +149,20 @@
Label {
objectName: "version"
font.bold: true;
- text: "1.5"
+ text: "1.6"
}
}
+
Row {
Layouts.item: "year"
anchors.horizontalCenter: parent.horizontalCenter;
Label {
objectName: "yearLabel"
font.bold: true;
- text: "2013"
-
-
+ text: "2016"
}
}
}
-
}
}
}
=== modified file 'components/AddProfileDialog.qml'
--- components/AddProfileDialog.qml 2014-10-06 12:41:09 +0000
+++ components/AddProfileDialog.qml 2016-02-28 17:25:56 +0000
@@ -1,6 +1,6 @@
-import QtQuick 2.3
-import Ubuntu.Components 1.1
-import Ubuntu.Components.Popups 1.0
+import QtQuick 2.4
+import Ubuntu.Components 1.3
+import Ubuntu.Components.Popups 1.3
import "../js/localStorage.js" as Settings
import QtQuick.LocalStorage 2.0
=== modified file 'components/BigBlock.qml'
--- components/BigBlock.qml 2015-07-16 11:29:03 +0000
+++ components/BigBlock.qml 2016-02-28 17:25:56 +0000
@@ -1,6 +1,6 @@
-import QtQuick 2.3
-import Ubuntu.Components 1.1
-import Ubuntu.Components.Popups 1.0
+import QtQuick 2.4
+import Ubuntu.Components 1.3
+import Ubuntu.Components.Popups 1.3
import "../js/SudokuCU.js" as SudokuCU
import QtFeedback 5.0
=== modified file 'components/BottomEdge.qml'
--- components/BottomEdge.qml 2015-07-16 11:29:03 +0000
+++ components/BottomEdge.qml 2016-02-28 17:25:56 +0000
@@ -1,6 +1,6 @@
import QtQuick 2.2
import QtFeedback 5.0
-import Ubuntu.Components 1.1
+import Ubuntu.Components 1.3
Item {
id: bottomEdge
=== modified file 'components/BottomEdgeSlide.qml'
--- components/BottomEdgeSlide.qml 2015-07-16 11:29:03 +0000
+++ components/BottomEdgeSlide.qml 2016-02-28 17:25:56 +0000
@@ -1,6 +1,6 @@
import QtQuick 2.2
import QtFeedback 5.0
-import Ubuntu.Components 1.1
+import Ubuntu.Components 1.3
Item {
id: bottomEdge
=== modified file 'components/ColorSchemeDefault.qml'
--- components/ColorSchemeDefault.qml 2015-02-23 07:44:43 +0000
+++ components/ColorSchemeDefault.qml 2016-02-28 17:25:56 +0000
@@ -1,5 +1,5 @@
-import QtQuick 2.3
-import Ubuntu.Components 1.1
+import QtQuick 2.4
+import Ubuntu.Components 1.3
Item {
=== modified file 'components/ColorSchemeSimple.qml'
--- components/ColorSchemeSimple.qml 2014-11-08 11:58:23 +0000
+++ components/ColorSchemeSimple.qml 2016-02-28 17:25:56 +0000
@@ -1,5 +1,5 @@
-import QtQuick 2.3
-import Ubuntu.Components 1.1
+import QtQuick 2.4
+import Ubuntu.Components 1.3
Item {
@@ -15,8 +15,5 @@
property color dialogButtonColor2: "white"
property color dialogButtonColor3: "white"
property color dialogButtonTextColor: UbuntuColors.orange
- property color headerColor: "#2C001E"
property color backgroundColor: "#2C001E"
- property color footerColor: "#5E2750"
-
}
=== modified file 'components/ColorSchemeUbuntu.qml'
--- components/ColorSchemeUbuntu.qml 2015-02-23 07:44:43 +0000
+++ components/ColorSchemeUbuntu.qml 2016-02-28 17:25:56 +0000
@@ -1,8 +1,7 @@
-import QtQuick 2.3
-import Ubuntu.Components 1.1
+import QtQuick 2.4
+import Ubuntu.Components 1.3
Item {
-
property color defaultColor: "transparent" // "#F5F5F5";
property color defaultStartingColor : UbuntuColors.lightAubergine;
property color defaultNotAllowedColor : UbuntuColors.darkAubergine;
@@ -15,8 +14,5 @@
property color dialogButtonColor2: UbuntuColors.orange
property color dialogButtonColor3: "black"
property color dialogButtonTextColor: "white"
- property color headerColor: "#F5F5F5"
- property color backgroundColor: "#F5F5F5"
- property color footerColor: "#F5F5F5"
-
+ property color backgroundColor: "#FFFFFF"
}
=== modified file 'components/DialogButton.qml'
--- components/DialogButton.qml 2014-10-06 12:41:09 +0000
+++ components/DialogButton.qml 2016-02-28 17:25:56 +0000
@@ -1,5 +1,5 @@
-import QtQuick 2.3
-import Ubuntu.Components 1.1
+import QtQuick 2.4
+import Ubuntu.Components 1.3
UbuntuShape {
id: button
@@ -14,7 +14,7 @@
height: size;
width: size;
radius: "medium"
- color: buttonColor
+ backgroundColor: buttonColor
//border.color: Qt.darker(buttonColor,1.5)
Text {
=== modified file 'components/HighscoresTab.qml'
--- components/HighscoresTab.qml 2015-07-17 11:48:07 +0000
+++ components/HighscoresTab.qml 2016-02-28 17:25:56 +0000
@@ -1,16 +1,13 @@
-import QtQuick 2.3
-import Ubuntu.Components 1.2
-//import Ubuntu.Components.ListItems 1.0 as ListItem
+import QtQuick 2.4
+import Ubuntu.Components 1.3
import QtQuick.LocalStorage 2.0
-import Ubuntu.Components.Popups 1.0
+import Ubuntu.Components.Popups 1.3
import Ubuntu.Layouts 1.0
import "../js/localStorage.js" as Settings
import "../components"
-//import Ubuntu.HUD 1.0 as HUD
-import Ubuntu.Unity.Action 1.1 as UnityActions
-import UserMetrics 0.1
-Page {
+Tab {
+ id: highScoresTab
function appendModel(item)
{
@@ -27,40 +24,94 @@
for (var i = 0; i < highscoresModel.count; i++)
{
if (highscoresModel.get(i).firstname === firstName &&
- highscoresModel.get(i).lastname === lastName )
+ highscoresModel.get(i).lastname === lastName )
highscoresModel.remove(i);
}
}
- BottomEdge {
- z:2
- hintIconName: "delete"
- actions: [
- RadialAction {
- iconName: "contact"
- iconColor: UbuntuColors.orange
- onTriggered: {
- Settings.deleteScoresWithProfileId(currentUserId)
- highscoresModel.clearModelProfileId(currentUserId);
- }
- },
- RadialAction {
- iconName: "contact-group"
- iconColor: UbuntuColors.orange
- onTriggered: {
- Settings.deleteAllScores();
- highscoresModel.clear();
- }
+ Page {
+ id: highScoresPage
+
+ header: PageHeader {
+ title: i18n.tr("About")
+ leadingActionBar {
+ numberOfSlots: 0
+ actions: tabsList.actions
}
- ]
- }
-
- head.actions: [
- Action {
- objectName: "allusersbutton"
- text: "All\nusers"
- iconSource: Qt.resolvedUrl("../icons/all-users.svg")
- onTriggered: {
+
+ trailingActionBar.actions: [
+ Action {
+ objectName: "allusersbutton"
+ text: "All\nusers"
+ iconSource: Qt.resolvedUrl("../icons/all-users.svg")
+ onTriggered: {
+ var allScores = Settings.getAllScores()
+ highscoresModel.clear();
+ highscoresHeaderText = i18n.tr("<b>Best scores for all players</b>");
+ for(var i = 0; i < allScores.length; i++) {
+ var rowItem = allScores[i];
+ //print("ROW ",rowItem)
+ var firstName = Settings.getUserFirstName(rowItem[1]);
+ var lastName = Settings.getUserLastName(rowItem[1]);
+ //res.push([dbItem.first_name, dbItem.last_name, dbItem.score])
+ highscoresModel.append({ 'id': rowItem[0],
+ 'firstname': firstName,
+ 'lastname': lastName,
+ 'score': rowItem[2] });
+ }
+ }
+ },
+ Action {
+ text: "Current\nuser"
+ objectName: "currentuserbutton"
+ iconSource: Qt.resolvedUrl("../icons/single-user.svg")
+ onTriggered: {
+ var firstName = Settings.getUserFirstName(currentUserId);
+ var lastName = Settings.getUserLastName(currentUserId);
+ //print(firstName, lastName)
+ // TRANSLATORS: %1 is user's first name and %2 is last name
+ highscoresHeaderText = "<b>" + i18n.tr("Best scores for %1 %2").arg(firstName).arg(lastName) + "</b>"
+ var allScores = Settings.getAllScoresForUser(currentUserId)
+ highscoresModel.clear();
+ for(var i = 0; i < allScores.length; i++) {
+ var rowItem = allScores[i];
+ //res.push([dbItem.first_name, dbItem.last_name, dbItem.score])
+ highscoresModel.append({'firstname': firstName,
+ 'lastname': lastName,
+ 'score': rowItem[1] });
+ }
+ }
+ }
+ ]
+ }
+
+ BottomEdge {
+ z:2
+ hintIconName: "delete"
+ actions: [
+ RadialAction {
+ iconName: "contact"
+ iconColor: UbuntuColors.orange
+ onTriggered: {
+ Settings.deleteScoresWithProfileId(currentUserId)
+ highscoresModel.clearModelProfileId(currentUserId);
+ }
+ },
+ RadialAction {
+ iconName: "contact-group"
+ iconColor: UbuntuColors.orange
+ onTriggered: {
+ Settings.deleteAllScores();
+ highscoresModel.clear();
+ }
+ }
+ ]
+ }
+
+ ListModel {
+ id: highscoresModel
+
+ onDataChanged: {
var allScores = Settings.getAllScores()
highscoresModel.clear();
highscoresHeaderText = i18n.tr("<b>Best scores for all players</b>");
@@ -76,91 +127,37 @@
'score': rowItem[2] });
}
}
- },
- Action {
- text: "Current\nuser"
- objectName: "currentuserbutton"
- iconSource: Qt.resolvedUrl("../icons/single-user.svg")
- onTriggered: {
- var firstName = Settings.getUserFirstName(currentUserId);
- var lastName = Settings.getUserLastName(currentUserId);
- //print(firstName, lastName)
- // TRANSLATORS: %1 is user's first name and %2 is last name
- highscoresHeaderText = "<b>" + i18n.tr("Best scores for %1 %2").arg(firstName).arg(lastName) + "</b>"
- var allScores = Settings.getAllScoresForUser(currentUserId)
- highscoresModel.clear();
- for(var i = 0; i < allScores.length; i++) {
- var rowItem = allScores[i];
- //res.push([dbItem.first_name, dbItem.last_name, dbItem.score])
- highscoresModel.append({'firstname': firstName,
- 'lastname': lastName,
- 'score': rowItem[1] });
- }
- }
- }
-
- //locked: true
- //opened: true
- ]
-
-
- ListModel {
- id: highscoresModel
-
- onDataChanged: {
- var allScores = Settings.getAllScores()
- highscoresModel.clear();
- highscoresHeaderText = i18n.tr("<b>Best scores for all players</b>");
- for(var i = 0; i < allScores.length; i++) {
- var rowItem = allScores[i];
- //print("ROW ",rowItem)
- var firstName = Settings.getUserFirstName(rowItem[1]);
- var lastName = Settings.getUserLastName(rowItem[1]);
- //res.push([dbItem.first_name, dbItem.last_name, dbItem.score])
- highscoresModel.append({ 'id': rowItem[0],
- 'firstname': firstName,
- 'lastname': lastName,
- 'score': rowItem[2] });
- }
- }
-
- /*ListElement {
- firstname: "Bill"
- lastname: "Smith"
- score: "120"
- }
- ListElement {
- firstname: "John"
- lastname: "Brown"
- score: "130"
- }*/
- }
- Column {
- anchors.fill: parent
- clip: true
+ }
+
UbuntuListView {
id: highScoresListView
+
+ anchors {
+ top: highScoresPage.header.bottom
+ topMargin: units.gu(2)
+ left: parent.left
+ right: parent.right
+ bottom: parent.bottom
+ }
+
model: highscoresModel
- width: parent.width
- height:parent.height
header: Label {
id: highscoresHeader
objectName: "highscoreslabel"
text: highscoresHeaderText
height: units.gu(5)
+ anchors.left: parent.left
+ anchors.leftMargin: units.gu(2)
}
delegate: ListItem {
- Label {
- anchors.left: parent.left
- anchors.leftMargin: units.gu(1)
- text: (index+1) + ". " + firstname + " " + lastname
- }
- Label {
- anchors.right: parent.right
- anchors.rightMargin: units.gu(1)
- text: score
+ ListItemLayout {
+ title.text: "%1. %2 %3".arg(index+1).arg(firstname).arg(lastname)
+ Label {
+ SlotsLayout.position: SlotsLayout.Last
+ text: score
+ }
}
leadingActions: ListItemActions {
@@ -168,17 +165,14 @@
Action {
iconName: "delete"
onTriggered: {
- //print(index, id, firstname);
Settings.deleteScoreWithId(id);
highscoresModel.remove(index,1);
}
}
]
}
- //value: score
}
}
}
}
-
=== modified file 'components/ManageProfileDialog.qml'
--- components/ManageProfileDialog.qml 2014-10-06 12:41:09 +0000
+++ components/ManageProfileDialog.qml 2016-02-28 17:25:56 +0000
@@ -1,6 +1,6 @@
-import QtQuick 2.3
-import Ubuntu.Components 1.1
-import Ubuntu.Components.Popups 1.0
+import QtQuick 2.4
+import Ubuntu.Components 1.3
+import Ubuntu.Components.Popups 1.3
import "../js/localStorage.js" as Settings
import QtQuick.LocalStorage 2.0
=== modified file 'components/NewGameSelectionButton.qml'
--- components/NewGameSelectionButton.qml 2014-10-06 12:41:09 +0000
+++ components/NewGameSelectionButton.qml 2016-02-28 17:25:56 +0000
@@ -1,6 +1,6 @@
-import QtQuick 2.3
-import Ubuntu.Components 1.1
-import Ubuntu.Components.Popups 1.0
+import QtQuick 2.4
+import Ubuntu.Components 1.3
+import Ubuntu.Components.Popups 1.3
UbuntuShape {
id: gameDifficultyButton
=== modified file 'components/RadialAction.qml'
--- components/RadialAction.qml 2015-07-16 11:29:03 +0000
+++ components/RadialAction.qml 2016-02-28 17:25:56 +0000
@@ -1,5 +1,5 @@
import QtQuick 2.0
-import Ubuntu.Components 1.1
+import Ubuntu.Components 1.3
Action {
property string iconName: "add"
=== added file 'components/SettingsTab.qml'
--- components/SettingsTab.qml 1970-01-01 00:00:00 +0000
+++ components/SettingsTab.qml 2016-02-28 17:25:56 +0000
@@ -0,0 +1,359 @@
+import QtQuick 2.4
+import Ubuntu.Components 1.3
+import QtQuick.LocalStorage 2.0
+import Ubuntu.Components.Popups 1.3
+import Ubuntu.Layouts 1.0
+import "../js/localStorage.js" as Settings
+
+Tab {
+ id: settingsTab;
+ objectName: "settingsTab"
+
+ property alias disableHintsChecked: disableHints.checked;
+ property alias disableVibrationsChecked: disableVibrations.checked;
+ property alias difficultyIndex: difficultySelector.selectedIndex;
+ property alias themeIndex: themeSelector.selectedIndex;
+
+ page: Page {
+ id: settingsPage
+ objectName: "settingsPage"
+
+ anchors.fill: parent
+
+ header: PageHeader {
+ flickable: flickableSettings
+ title: i18n.tr("Settings")
+ leadingActionBar {
+ numberOfSlots: 0
+ actions: tabsList.actions
+ }
+ }
+
+ Component {
+ id: profileSelector
+ Dialog {
+ objectName: "selectProfileDialog"
+ title: i18n.tr("Select profile")
+
+ Column{
+ height: mainColumnSettings.height*2/3
+ ListView {
+
+ id: profileListView
+ objectName: "profileListView"
+ clip: true
+ width: parent.width
+ height: parent.height - units.gu(12)
+ model: profilesModel
+
+ delegate: ListItem {
+ height: selectProfileLayout.height + divider.height
+ ListItemLayout {
+ id: selectProfileLayout
+ title.text: firstname + " " + lastname
+ ProgressionSlot {}
+ }
+ onClicked: {
+ currentUserId = profileId;
+ hide()
+ }
+ }
+ }
+
+ SudokuDialogButton{
+ anchors.horizontalCenter: parent.horizontalCenter
+ id:cancelButton
+ buttonText: i18n.tr("Cancel")
+ width: parent.width/2;
+ size: units.gu(5)
+ buttonColor: sudokuBlocksGrid.dialogButtonColor1
+ textColor: sudokuBlocksGrid.dialogButtonTextColor
+ //border.color: "transparent"
+ onTriggered: {
+ hide()
+ }
+ }
+
+ }
+ }
+ }
+
+ Component {
+ id: manageProfileSelector
+ Dialog {
+ objectName: "manageProfileDialog"
+ title: i18n.tr("Select profile")
+
+ Column{
+ height: mainColumnSettings.height*2/3
+ ListView {
+ id: manageProfileListView
+ objectName: "manageProfileListView"
+ clip: true
+ width: parent.width
+ height: parent.height - units.gu(12)
+ model: profilesModel
+
+ delegate:ListItem {
+ height: manageProfileLayout.height + divider.height
+ ListItemLayout {
+ id: manageProfileLayout
+ title.text: firstname + " " + lastname
+ ProgressionSlot {}
+ }
+ onClicked: {
+ hide()
+ editUserId = profileId
+ PopupUtils.open(manageProfileDialog, selectorProfile)
+ }
+ }
+ }
+ SudokuDialogButton{
+
+ anchors.horizontalCenter: parent.horizontalCenter
+ id:cancelButton
+ objectName: "cancelButton"
+ buttonText: i18n.tr("Cancel")
+ width: parent.width/2;
+ size: units.gu(5)
+ buttonColor: sudokuBlocksGrid.dialogButtonColor1
+ textColor: sudokuBlocksGrid.dialogButtonTextColor
+ //border.color: "transparent"
+ onTriggered: {
+ hide()
+ }
+ }
+ }
+ }
+ }
+
+ ListModel{
+ id: profilesModel
+ }
+
+ Flickable {
+ id: flickableSettings
+ objectName: "settingsContainer"
+
+ anchors.fill: parent
+ contentHeight: mainColumnSettings.height
+
+ Column {
+ id: mainColumnSettings;
+
+ height: childrenRect.height
+ width: parent.width
+ spacing: units.gu(1)
+
+ ListItem {
+ height: sudokuSettingsLayout.height + divider.height
+ ListItemLayout {
+ id: sudokuSettingsLayout
+ title.text: i18n.tr("Sudoku settings")
+ title.font.weight: Font.DemiBold
+ }
+ }
+
+ OptionSelector {
+ objectName: "difficultySelector"
+ id: difficultySelector
+ text: i18n.tr("Default Difficulty")
+ width: parent.width - units.gu(4)
+ anchors.horizontalCenter: parent.horizontalCenter
+ model: [i18n.tr("Easy"), i18n.tr("Moderate"), i18n.tr("Hard"), i18n.tr("Ultra Hard"), i18n.tr("Always ask")]
+ onSelectedIndexChanged: {
+ //print(difficultySelector.selectedIndex)
+ switch(difficultySelector.selectedIndex) {
+ case 0:
+ var randomnumber = Math.floor(Math.random()*9);
+ randomnumber += 31;
+ sudokuBlocksGrid.createNewGame(81 - randomnumber);
+ Settings.setSetting("Difficulty", selectedIndex)
+ sudokuBlocksGrid.gameDifficulty = 0
+ break;
+ case 1:
+ var randomnumber = Math.floor(Math.random()*4);
+ randomnumber += 26;
+ sudokuBlocksGrid.createNewGame(81 - randomnumber);
+ Settings.setSetting("Difficulty", selectedIndex)
+ sudokuBlocksGrid.gameDifficulty = 1
+ break;
+ case 2:
+ var randomnumber = Math.floor(Math.random()*4);
+ randomnumber += 21;
+ sudokuBlocksGrid.createNewGame(81 - randomnumber);
+ Settings.setSetting("Difficulty", selectedIndex)
+ sudokuBlocksGrid.gameDifficulty = 2
+ break;
+ case 3:
+ var randomnumber = Math.floor(Math.random()*3);
+ randomnumber += 17;
+ sudokuBlocksGrid.createNewGame(81 - randomnumber);
+ Settings.setSetting("Difficulty", selectedIndex)
+ sudokuBlocksGrid.gameDifficulty = 3
+ break;
+ case 4:
+ Settings.setSetting("Difficulty", selectedIndex)
+ break;
+ }
+ }
+
+ }
+
+ OptionSelector {
+ objectName: "themeSelector"
+ id: themeSelector
+ text: i18n.tr("Theme")
+ model: ["UbuntuColours", "Simple"]
+ width: parent.width - units.gu(4)
+ anchors.horizontalCenter: parent.horizontalCenter
+ onSelectedIndexChanged: {
+ var newColorScheme = null;
+ if (selectedIndex == 0)
+ {
+ //print("Ubuntu")
+ var result = Settings.setSetting("ColorTheme", selectedIndex);
+ //print(result);
+ sudokuBlocksGrid.changeColorScheme("ColorSchemeUbuntu.qml");
+ }
+ if (selectedIndex == 1)
+ {
+ //print("Simple")
+ var result = Settings.setSetting("ColorTheme", selectedIndex);
+ //print(result);
+ sudokuBlocksGrid.changeColorScheme("ColorSchemeSimple.qml");
+ }
+ }
+ Component.onCompleted: selectedIndex = 0
+ }
+
+ ListItem {
+ objectName: "hintsSwitchClickable"
+ height: hintsSettingsLayout.height + divider.height
+
+ ListItemLayout {
+ id: hintsSettingsLayout
+ title.text: i18n.tr("Hints")
+
+ Switch {
+ id: disableHints
+ objectName: "hintsSwitch"
+ checked: disableHintsChecked
+ SlotsLayout.position: SlotsLayout.Last
+ onCheckedChanged: {
+ Settings.setSetting("DisableHints", checked ? "true":"false")
+ }
+ }
+ }
+ }
+
+ ListItem {
+ objectName: "vibrationsSwitchClickable"
+ height: vibrationsSettingsLayout.height + divider.height
+
+ ListItemLayout {
+ id: vibrationsSettingsLayout
+ title.text: i18n.tr("Vibration Alerts")
+
+ Switch {
+ id: disableVibrations
+ objectName: "vibrationsSwitch"
+ checked: disableVibrationsChecked
+ SlotsLayout.position: SlotsLayout.Last
+ onCheckedChanged: {
+ Settings.setSetting("DisableVibrations", checked ? "true":"false")
+ }
+ }
+ }
+ }
+
+ ListItem {
+ height: profileSettingsLayout.height + divider.height
+ ListItemLayout {
+ id: profileSettingsLayout
+ title.text: i18n.tr("Profiles settings")
+ title.font.weight: Font.DemiBold
+ }
+ }
+
+ SingleValueListItem {
+ id: selectorProfile
+ objectName: "Current profile"
+ title.text: i18n.tr("Current profile")
+ value: {
+ if(currentUserId==-1)
+ return i18n.tr("None")
+ else
+ return Settings.getUserFirstName(currentUserId)+" "+Settings.getUserLastName(currentUserId);
+
+ }
+ Component.onCompleted: currentUserId = Settings.getSetting("currentUserId")
+
+ onClicked: {
+ var allProfiles = new Array();
+ allProfiles = Settings.getAllProfiles()
+
+ profilesModel.clear()
+
+ for(var i = 0; i < allProfiles.length; i++)
+ {
+ profilesModel.append({"profileId":allProfiles[i].id,"lastname":allProfiles[i].lastname, "firstname":allProfiles[i].firstname})
+ }
+ PopupUtils.open(profileSelector, selectorProfile)
+ }
+ }
+
+ AddProfileDialog{
+ id:addProfileDialog
+ }
+
+ ManageProfileDialog{
+ id:manageProfileDialog
+ }
+
+ ListItem {
+ id: addSingleValue
+ objectName: "Add profile"
+ height: addSingleValueLayout.height + divider.height
+ ListItemLayout {
+ id: addSingleValueLayout
+ title.text: i18n.tr("Add profile")
+ ProgressionSlot {}
+ }
+ onClicked: {
+ PopupUtils.open(addProfileDialog, addSingleValue);
+ }
+ }
+
+ ListItem {
+ id: manageProfileSingleValue
+ objectName: "Manage profiles"
+ height: manageProfileSingleValueLayout.height + divider.height
+ ListItemLayout {
+ id: manageProfileSingleValueLayout
+ title.text: i18n.tr("Manage profiles")
+ ProgressionSlot {}
+ }
+ onClicked: {
+ var allProfiles = new Array();
+ allProfiles = Settings.getAllProfiles()
+
+ profilesModel.clear()
+
+ for(var i = 0; i < allProfiles.length; i++)
+ {
+ profilesModel.append({"profileId":allProfiles[i].id,"lastname":allProfiles[i].lastname, "firstname":allProfiles[i].firstname})
+ }
+
+ PopupUtils.open(manageProfileSelector, manageProfileSingleValue)
+ }
+ }
+ }
+ }
+
+ Scrollbar {
+ flickableItem: flickableSettings
+ align: Qt.AlignTrailing
+ }
+ }
+}
=== added file 'components/SingleValueListItem.qml'
--- components/SingleValueListItem.qml 1970-01-01 00:00:00 +0000
+++ components/SingleValueListItem.qml 2016-02-28 17:25:56 +0000
@@ -0,0 +1,22 @@
+import QtQuick 2.4
+import Ubuntu.Components 1.3
+
+ListItem {
+ id: customListItem
+
+ property alias title: customItemLayout.title
+ property alias value: _value.text
+
+ ListItemLayout {
+ id: customItemLayout
+
+ title.text: " "
+
+ Label {
+ id: _value
+ SlotsLayout.position: SlotsLayout.Trailing;
+ }
+
+ ProgressionSlot {}
+ }
+}
=== modified file 'components/SudokuBlocksGrid.qml'
--- components/SudokuBlocksGrid.qml 2015-07-16 15:00:01 +0000
+++ components/SudokuBlocksGrid.qml 2016-02-28 17:25:56 +0000
@@ -1,6 +1,6 @@
-import QtQuick 2.3
-import Ubuntu.Components 1.1
-import Ubuntu.Components.Popups 1.0
+import QtQuick 2.4
+import Ubuntu.Components 1.3
+import Ubuntu.Components.Popups 1.3
import "../js/SudokuCU.js" as SudokuCU
import QtFeedback 5.0
@@ -120,13 +120,9 @@
colorScheme.dialogButtonColor2 = temp.dialogButtonColor2;
colorScheme.dialogButtonTextColor = temp.dialogButtonTextColor;
- colorScheme.headerColor = temp.headerColor;
colorScheme.backgroundColor = temp.backgroundColor;
- colorScheme.footerColor = temp.footerColor;
- mainView.headerColor = colorScheme.headerColor;
mainView.backgroundColor = colorScheme.backgroundColor;
- mainView.footerColor = colorScheme.footerColor;
for (var i = 0; i < 9; i++) {
for (var j = 0; j < 9; j++) {
=== modified file 'components/SudokuButton.qml'
--- components/SudokuButton.qml 2014-10-06 12:41:09 +0000
+++ components/SudokuButton.qml 2016-02-28 17:25:56 +0000
@@ -1,5 +1,5 @@
-import QtQuick 2.3
-import Ubuntu.Components 1.1
+import QtQuick 2.4
+import Ubuntu.Components 1.3
Rectangle {
id: button
=== modified file 'components/SudokuButtonsGrid.qml'
--- components/SudokuButtonsGrid.qml 2015-07-16 15:00:01 +0000
+++ components/SudokuButtonsGrid.qml 2016-02-28 17:25:56 +0000
@@ -1,6 +1,6 @@
-import QtQuick 2.3
-import Ubuntu.Components 1.1
-import Ubuntu.Components.Popups 1.0
+import QtQuick 2.4
+import Ubuntu.Components 1.3
+import Ubuntu.Components.Popups 1.3
Repeater {
@@ -132,7 +132,7 @@
}
Component.onCompleted: {
- switch(difficultySelector.selectedIndex) {
+ switch(settingsTab.difficultyIndex) {
case 0:
var randomnumber = Math.floor(Math.random()*9);
randomnumber += 31;
=== modified file 'components/SudokuDialogButton.qml'
--- components/SudokuDialogButton.qml 2014-10-06 12:41:09 +0000
+++ components/SudokuDialogButton.qml 2016-02-28 17:25:56 +0000
@@ -1,5 +1,5 @@
-import QtQuick 2.3
-import Ubuntu.Components 1.1
+import QtQuick 2.4
+import Ubuntu.Components 1.3
DialogButton {
id: dialogButton
=== added file 'components/TabsList.qml'
--- components/TabsList.qml 1970-01-01 00:00:00 +0000
+++ components/TabsList.qml 2016-02-28 17:25:56 +0000
@@ -0,0 +1,36 @@
+import QtQuick 2.4
+import Ubuntu.Components 1.3
+
+ActionList {
+ id: tabsList
+
+ children: [
+ Action {
+ text: i18n.tr("Sudoku")
+ onTriggered: {
+ tabs.selectedTabIndex = 0
+ }
+ },
+
+ Action {
+ text: i18n.tr("Scores")
+ onTriggered: {
+ tabs.selectedTabIndex = 1
+ }
+ },
+
+ Action {
+ text: i18n.tr("Settings")
+ onTriggered: {
+ tabs.selectedTabIndex = 2
+ }
+ },
+
+ Action {
+ text: i18n.tr("About")
+ onTriggered: {
+ tabs.selectedTabIndex = 3
+ }
+ }
+ ]
+}
=== modified file 'po/com.ubuntu.sudoku.pot'
--- po/com.ubuntu.sudoku.pot 2015-07-17 11:48:07 +0000
+++ po/com.ubuntu.sudoku.pot 2016-02-28 17:25:56 +0000
@@ -8,7 +8,7 @@
msgstr ""
"Project-Id-Version: sudoku-app\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2015-07-17 13:47+0200\n"
+"POT-Creation-Date: 2016-02-28 22:53+0530\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@xxxxxx>\n"
@@ -18,15 +18,20 @@
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
-#: ../components/AboutTab.qml:103
+#: ../components/AboutTab.qml:17 ../components/HighscoresTab.qml:36
+#: ../components/TabsList.qml:30
+msgid "About"
+msgstr ""
+
+#: ../components/AboutTab.qml:111
msgid "Author(s): "
msgstr ""
-#: ../components/AboutTab.qml:113
+#: ../components/AboutTab.qml:121
msgid "Contact: "
msgstr ""
-#: ../components/AboutTab.qml:139
+#: ../components/AboutTab.qml:147
msgid "Version: "
msgstr ""
@@ -43,7 +48,7 @@
msgstr ""
#: ../components/AddProfileDialog.qml:53
-#: ../components/ManageProfileDialog.qml:69 ../sudoku-app.qml:354
+#: ../components/ManageProfileDialog.qml:69 ../sudoku-app.qml:192
msgid "OK"
msgstr ""
@@ -62,9 +67,9 @@
msgstr ""
#: ../components/AddProfileDialog.qml:85
-#: ../components/ManageProfileDialog.qml:127
-#: ../components/SudokuBlocksGrid.qml:492 ../sudoku-app.qml:507
-#: ../sudoku-app.qml:881 ../sudoku-app.qml:933
+#: ../components/ManageProfileDialog.qml:127 ../components/SettingsTab.qml:66
+#: ../components/SettingsTab.qml:116 ../components/SudokuBlocksGrid.qml:488
+#: ../sudoku-app.qml:343
msgid "Cancel"
msgstr ""
@@ -89,14 +94,13 @@
msgid "Hinted blocks"
msgstr ""
-#: ../components/HighscoresTab.qml:66 ../components/HighscoresTab.qml:113
-#: ../sudoku-app.qml:24 ../sudoku-app.qml:153 ../sudoku-app.qml:207
-#: ../sudoku-app.qml:244
+#: ../components/HighscoresTab.qml:50 ../components/HighscoresTab.qml:117
+#: ../sudoku-app.qml:21 ../sudoku-app.qml:49 ../sudoku-app.qml:82
msgid "<b>Best scores for all players</b>"
msgstr ""
#. TRANSLATORS: %1 is user's first name and %2 is last name
-#: ../components/HighscoresTab.qml:89 ../sudoku-app.qml:176
+#: ../components/HighscoresTab.qml:73
#, qt-format
msgid "Best scores for %1 %2"
msgstr ""
@@ -109,215 +113,171 @@
msgid "Delete"
msgstr ""
-#: ../components/SudokuBlocksGrid.qml:334
+#: ../components/SettingsTab.qml:25 ../components/TabsList.qml:23
+msgid "Settings"
+msgstr ""
+
+#: ../components/SettingsTab.qml:36 ../components/SettingsTab.qml:85
+msgid "Select profile"
+msgstr ""
+
+#: ../components/SettingsTab.qml:152
+msgid "Sudoku settings"
+msgstr ""
+
+#: ../components/SettingsTab.qml:160
+msgid "Default Difficulty"
+msgstr ""
+
+#: ../components/SettingsTab.qml:163 ../sudoku-app.qml:272
+msgid "Easy"
+msgstr ""
+
+#: ../components/SettingsTab.qml:163 ../sudoku-app.qml:291
+msgid "Moderate"
+msgstr ""
+
+#: ../components/SettingsTab.qml:163 ../sudoku-app.qml:308
+msgid "Hard"
+msgstr ""
+
+#: ../components/SettingsTab.qml:163
+msgid "Ultra Hard"
+msgstr ""
+
+#: ../components/SettingsTab.qml:163
+msgid "Always ask"
+msgstr ""
+
+#: ../components/SettingsTab.qml:206
+msgid "Theme"
+msgstr ""
+
+#: ../components/SettingsTab.qml:236
+msgid "Hints"
+msgstr ""
+
+#: ../components/SettingsTab.qml:256
+msgid "Vibration Alerts"
+msgstr ""
+
+#: ../components/SettingsTab.qml:274
+msgid "Profiles settings"
+msgstr ""
+
+#: ../components/SettingsTab.qml:282
+msgid "Current profile"
+msgstr ""
+
+#: ../components/SettingsTab.qml:285
+msgid "None"
+msgstr ""
+
+#: ../components/SettingsTab.qml:320
+msgid "Add profile"
+msgstr ""
+
+#: ../components/SettingsTab.qml:334
+msgid "Manage profiles"
+msgstr ""
+
+#: ../components/SudokuBlocksGrid.qml:330
msgid "Please pick a number"
msgstr ""
-#: ../components/SudokuBlocksGrid.qml:395
+#: ../components/SudokuBlocksGrid.qml:391
msgid "Clear"
msgstr ""
-#: ../components/SudokuBlocksGrid.qml:465
-#, qt-format
-msgid ""
-"You are a cheat...\n"
-"But we give you\n"
-"%1 point."
-msgid_plural ""
-"You are a cheat...\n"
-"But we give you\n"
-"%1 points."
-msgstr[0] ""
-msgstr[1] ""
-
-#: ../components/SudokuBlocksGrid.qml:472
-#, qt-format
-msgid ""
-"Congratulations!\n"
-"We give you\n"
-"%1 point."
-msgid_plural ""
-"Congratulations!\n"
-"We give you\n"
-"%1 points."
-msgstr[0] ""
-msgstr[1] ""
-
-#: ../js/localStorage.js:11 ../sudoku-app.qml:688
+#: ../components/SudokuBlocksGrid.qml:461
+#, qt-format
+msgid ""
+"You are a cheat...\n"
+"But we give you\n"
+"%1 point."
+msgid_plural ""
+"You are a cheat...\n"
+"But we give you\n"
+"%1 points."
+msgstr[0] ""
+msgstr[1] ""
+
+#: ../components/SudokuBlocksGrid.qml:468
+#, qt-format
+msgid ""
+"Congratulations!\n"
+"We give you\n"
+"%1 point."
+msgid_plural ""
+"Congratulations!\n"
+"We give you\n"
+"%1 points."
+msgstr[0] ""
+msgstr[1] ""
+
+#: ../components/TabsList.qml:9 ../js/localStorage.js:11 ../sudoku-app.qml:590
#: com.ubuntu.sudoku_sudoku.desktop.in.in.h:1
msgid "Sudoku"
msgstr ""
+#: ../components/TabsList.qml:16
+msgid "Scores"
+msgstr ""
+
#: ../js/localStorage.js:12
msgid "User"
msgstr ""
-#: ../sudoku-app.qml:50 ../sudoku-app.qml:51 ../sudoku-app.qml:763
-msgid "New game"
-msgstr ""
-
-#: ../sudoku-app.qml:58 ../sudoku-app.qml:59
-msgid "Reveal hint"
-msgstr ""
-
-#: ../sudoku-app.qml:67 ../sudoku-app.qml:68
-msgid "Show settings"
-msgstr ""
-
-#: ../sudoku-app.qml:75 ../sudoku-app.qml:76
-msgid "Change difficulty to Easy"
-msgstr ""
-
-#: ../sudoku-app.qml:88 ../sudoku-app.qml:89
-msgid "Change difficulty to Moderate"
-msgstr ""
-
-#: ../sudoku-app.qml:101 ../sudoku-app.qml:102
-msgid "Change difficulty to Hard"
-msgstr ""
-
-#: ../sudoku-app.qml:114 ../sudoku-app.qml:115
-msgid "Change difficulty to Ultra Hard"
-msgstr ""
-
-#: ../sudoku-app.qml:127 ../sudoku-app.qml:128
-msgid "Change theme to Simple"
-msgstr ""
-
-#: ../sudoku-app.qml:137 ../sudoku-app.qml:138
-msgid "Change theme to UbuntuColors"
-msgstr ""
-
-#: ../sudoku-app.qml:147 ../sudoku-app.qml:148
-msgid "Show scores for all users"
-msgstr ""
-
-#: ../sudoku-app.qml:168 ../sudoku-app.qml:169
-msgid "Show scores for current user"
-msgstr ""
-
-#: ../sudoku-app.qml:233
+#: ../sudoku-app.qml:75
msgid ""
"You are a cheat... \n"
"But we give you\n"
msgstr ""
-#: ../sudoku-app.qml:235
+#: ../sudoku-app.qml:77
msgid "point."
msgid_plural "points."
msgstr[0] ""
msgstr[1] ""
-#: ../sudoku-app.qml:341
+#: ../sudoku-app.qml:179
msgid "Sudoku games played today"
msgstr ""
-#: ../sudoku-app.qml:342
+#: ../sudoku-app.qml:180
msgid "No Sudoku games played today"
msgstr ""
-#: ../sudoku-app.qml:371
+#: ../sudoku-app.qml:209
msgid "New Game"
msgstr ""
-#: ../sudoku-app.qml:372
+#: ../sudoku-app.qml:210
msgid "Select difficulty level"
msgstr ""
-#: ../sudoku-app.qml:436 ../sudoku-app.qml:982
-msgid "Easy"
-msgstr ""
-
-#: ../sudoku-app.qml:455 ../sudoku-app.qml:982
-msgid "Moderate"
-msgstr ""
-
-#: ../sudoku-app.qml:472 ../sudoku-app.qml:982
-msgid "Hard"
-msgstr ""
-
-#: ../sudoku-app.qml:489
+#: ../sudoku-app.qml:325
msgid ""
"Ultra\n"
"Hard"
msgstr ""
-#: ../sudoku-app.qml:744
+#: ../sudoku-app.qml:577
msgid "You are a cheat..."
msgstr ""
-#: ../sudoku-app.qml:744
+#: ../sudoku-app.qml:577
msgid "Congratulations!"
msgstr ""
-#: ../sudoku-app.qml:780
+#: ../sudoku-app.qml:600
+msgid "New game"
+msgstr ""
+
+#: ../sudoku-app.qml:616
msgid "Show hint"
msgstr ""
-#: ../sudoku-app.qml:820
-msgid "Scores"
-msgstr ""
-
-#: ../sudoku-app.qml:830
-msgid "Settings"
-msgstr ""
-
-#: ../sudoku-app.qml:852 ../sudoku-app.qml:900
-msgid "Select profile"
-msgstr ""
-
-#: ../sudoku-app.qml:973
-msgid "<b>Sudoku settings</b>"
-msgstr ""
-
-#: ../sudoku-app.qml:979
-msgid "Default Difficulty"
-msgstr ""
-
-#: ../sudoku-app.qml:982
-msgid "Ultra Hard"
-msgstr ""
-
-#: ../sudoku-app.qml:982
-msgid "Always ask"
-msgstr ""
-
-#: ../sudoku-app.qml:1024
-msgid "Theme"
-msgstr ""
-
-#: ../sudoku-app.qml:1050
-msgid "Hints"
-msgstr ""
-
-#: ../sudoku-app.qml:1066
-msgid "Vibration Alerts"
-msgstr ""
-
-#: ../sudoku-app.qml:1083
-msgid "<b>Profiles settings</b>"
-msgstr ""
-
-#: ../sudoku-app.qml:1087
-msgid "Current profile"
-msgstr ""
-
-#: ../sudoku-app.qml:1091
-msgid "None"
-msgstr ""
-
-#: ../sudoku-app.qml:1127
-msgid "Add profile"
-msgstr ""
-
-#: ../sudoku-app.qml:1136
-msgid "Manage profiles"
-msgstr ""
-
-#: ../sudoku-app.qml:1168
-msgid "About"
-msgstr ""
-
#: com.ubuntu.sudoku_sudoku.desktop.in.in.h:2
msgid "Sudoku Game for Ubuntu Touch."
msgstr ""
=== modified file 'sudoku-app.qml'
--- sudoku-app.qml 2015-07-17 11:48:07 +0000
+++ sudoku-app.qml 2016-02-28 17:25:56 +0000
@@ -1,14 +1,11 @@
-import QtQuick 2.3
-import Ubuntu.Components 1.1
-import Ubuntu.Components.ListItems 1.0 as ListItem
+import QtQuick 2.4
+import UserMetrics 0.1
+import Ubuntu.Layouts 1.0
+import Ubuntu.Components 1.3
import QtQuick.LocalStorage 2.0
-import Ubuntu.Components.Popups 1.0
-import Ubuntu.Layouts 1.0
+import Ubuntu.Components.Popups 1.3
import "js/localStorage.js" as Settings
import "components"
-//import Ubuntu.HUD 1.0 as HUD
-import Ubuntu.Unity.Action 1.1 as UnityActions
-import UserMetrics 0.1
MainView {
id: mainView
@@ -32,163 +29,8 @@
width: units.gu(41);
height: units.gu(70);
-
- //headerColor: sudokuBlocksGrid.headerColor
- //backgroundColor: sudokuBlocksGrid.backgroundColor
- //footerColor: sudokuBlocksGrid.footerColor
-
- /*HUD.HUD {
- applicationIdentifier: "sudoku-app" // this has to match the .desktop file!
- HUD.Context {*/
-
StateSaver.properties: "width, height"
- useDeprecatedToolbar: false
-
- actions: [
- Action {
- text: i18n.tr("New game")
- keywords: i18n.tr("New game")
- onTriggered: {
- tabs.selectedTabIndex = 0
- createNewGame()
- }
- },
- Action {
- text: i18n.tr("Reveal hint")
- keywords: i18n.tr("Reveal hint")
- enabled: disableHints.checked
- onTriggered: {
- tabs.selectedTabIndex = 0
- revealHint()
- }
- },
- Action {
- text: i18n.tr("Show settings")
- keywords: i18n.tr("Show settings")
- onTriggered: {
- tabs.selectedTabIndex = 2
- revealHint()
- }
- },
- Action {
- text: i18n.tr("Change difficulty to Easy")
- keywords: i18n.tr("Change difficulty to Easy")
- onTriggered: {
- tabs.selectedTabIndex = 0
- difficultySelector.selectedIndex = 0
- var randomnumber = Math.floor(Math.random()*9);
- randomnumber += 31;
- sudokuBlocksGrid.createNewGame(81 - randomnumber);
- Settings.setSetting("Difficulty", 0)
- createNewGame()
- }
- },
- Action {
- text: i18n.tr("Change difficulty to Moderate")
- keywords: i18n.tr("Change difficulty to Moderate")
- onTriggered: {
- tabs.selectedTabIndex = 0
- difficultySelector.selectedIndex = 1
- var randomnumber = Math.floor(Math.random()*4);
- randomnumber += 26;
- sudokuBlocksGrid.createNewGame(81 - randomnumber);
- Settings.setSetting("Difficulty", 1)
- createNewGame()
- }
- },
- Action {
- text: i18n.tr("Change difficulty to Hard")
- keywords: i18n.tr("Change difficulty to Hard")
- onTriggered: {
- tabs.selectedTabIndex = 0
- difficultySelector.selectedIndex = 2
- var randomnumber = Math.floor(Math.random()*4);
- randomnumber += 21;
- sudokuBlocksGrid.createNewGame(81 - randomnumber);
- Settings.setSetting("Difficulty", 2)
- createNewGame()
- }
- },
- Action {
- text: i18n.tr("Change difficulty to Ultra Hard")
- keywords: i18n.tr("Change difficulty to Ultra Hard")
- onTriggered: {
- tabs.selectedTabIndex = 0
- difficultySelector.selectedIndex = 3
- var randomnumber = Math.floor(Math.random()*3);
- randomnumber += 17;
- sudokuBlocksGrid.createNewGame(81 - randomnumber);
- Settings.setSetting("Difficulty", 3)
- createNewGame()
- }
- },
- Action {
- text: i18n.tr("Change theme to Simple")
- keywords: i18n.tr("Change theme to Simple")
- onTriggered: {
- //print("Simple")
- var result = Settings.setSetting("ColorTheme", 1);
- //print(result);
- sudokuBlocksGrid.changeColorScheme("ColorSchemeSimple.qml");
- }
- },
- Action {
- text: i18n.tr("Change theme to UbuntuColors")
- keywords: i18n.tr("Change theme to UbuntuColors")
- onTriggered: {
- print("UbuntuColors")
- var result = Settings.setSetting("ColorTheme", 0);
- //print(result);
- sudokuBlocksGrid.changeColorScheme("ColorSchemeUbuntu.qml");
- }
- },
- Action {
- text: i18n.tr("Show scores for all users")
- keywords: i18n.tr("Show scores for all users")
- onTriggered: {
- tabs.selectedTabIndex = 1
- var allScores = Settings.getAllScores()
- highscoresModel.clear();
- highscoresHeaderText = i18n.tr("<b>Best scores for all players</b>");
- for(var i = 0; i < allScores.length; i++) {
- var rowItem = allScores[i];
- //print("ROW ",rowItem)
- var firstName = Settings.getUserFirstName(rowItem[1]);
- var lastName = Settings.getUserLastName(rowItem[1]);
- //res.push([dbItem.first_name, dbItem.last_name, dbItem.score])
- highscoresModel.append({ 'id': rowItem[0],
- 'firstname': firstName,
- 'lastname': lastName,
- 'score': rowItem[2] });
- }
- }
- },
- Action {
- text: i18n.tr("Show scores for current user")
- keywords: i18n.tr("Show scores for current user")
- onTriggered: {
- tabs.selectedTabIndex = 1
- var firstName = Settings.getUserFirstName(currentUserId);
- var lastName = Settings.getUserLastName(currentUserId);
- //print(firstName, lastName)
- // TRANSLATORS: %1 is user's first name and %2 is last name
- highscoresHeaderText = "<b>" + i18n.tr("Best scores for %1 %2").arg(firstName).arg(lastName) + "</b>"
- var allScores = Settings.getAllScoresForUser(currentUserId)
- highscoresModel.clear();
- for(var i = 0; i < allScores.length; i++) {
- var rowItem = allScores[i];
- //res.push([dbItem.first_name, dbItem.last_name, dbItem.score])
- highscoresModel.append({'firstname': firstName,
- 'lastname': lastName,
- 'score': rowItem[1] });
- }
- }
- }
- ]
- //}
- //}
-
onCurrentUserIdChanged: {
Settings.setSetting("currentUserId", currentUserId)
}
@@ -214,7 +56,7 @@
/*highscoresModel.append({'firstname': firstName,
'lastname': lastName,
'score': rowItem[1] });*/
- hsPage.appendModel({ 'id': rowItem[0],
+ highscoresTab.appendModel({ 'id': rowItem[0],
'firstname': firstName,
'lastname': lastName,
'score': rowItem[2] });
@@ -223,7 +65,7 @@
}
function revealHint() {
- if(disableHints.checked)
+ if(settingsTab.disableHintsChecked)
{
sudokuBlocksGrid.revealHint();
sudokuBlocksGrid.checkIfCheating = true;
@@ -234,13 +76,9 @@
+ sudokuBlocksGrid.calculateScore()
+ " " + i18n.tr("point.","points.",1)
- // print (sudokuBlocksGrid.numberOfActions)
- // print (sudokuBlocksGrid.numberOfHints)
- // print (sudokuBlocksGrid.gameSeconds)
- // print (sudokuBlocksGrid.gameDifficulty)
var allScores = Settings.getAllScores()
//highscoresModel.clear();
- hsPage.clearModel()
+ highscoresTab.clearModel()
highscoresHeaderText = i18n.tr("<b>Best scores for all players</b>");
for(var i = 0; i < allScores.length; i++) {
var rowItem = allScores[i];
@@ -251,7 +89,7 @@
/*highscoresModel.append({'firstname': firstName,
'lastname': lastName,
'score': rowItem[1] });*/
- hsPage.appendModel({ 'id': rowItem[0],
+ highscoresTab.appendModel({ 'id': rowItem[0],
'firstname': firstName,
'lastname': lastName,
'score': rowItem[2] });
@@ -263,7 +101,7 @@
}
function createNewGame() {
- switch(difficultySelector.selectedIndex) {
+ switch(settingsTab.difficultyIndex) {
case 0:
var randomnumber = Math.floor(Math.random()*9);
randomnumber += 31;
@@ -419,8 +257,6 @@
}
}
-
-
Column {
spacing: units.gu(5)
@@ -624,7 +460,7 @@
if (settingsTab.difficultyIndex < 0)
settingsTab.difficultyIndex = 0
//print(settingsTab.difficultyIndex)
- //print(Settings.getSetting("DisableHints"));
+ //print(Settings.getSetting("settingsTab.disableHints"));
settingsTab.disableHintsChecked = Settings.getSetting("DisableHints") == "true" ? true : false;
settingsTab.disableVibrationsChecked = Settings.getSetting("DisableVibrations") == "true" ? true : false;
settingsTab.themeIndex = parseInt(Settings.getSetting("ColorTheme"));
@@ -658,7 +494,7 @@
/*highscoresModel.append({'firstname': firstName,
'lastname': lastName,
'score': rowItem[1] });*/
- hsPage.appendModel({ 'id': rowItem[0],
+ highscoresTab.appendModel({ 'id': rowItem[0],
'firstname': firstName,
'lastname': lastName,
'score': rowItem[2] })
@@ -670,7 +506,7 @@
{
currentUserId = Settings.getSetting("currentUserId")
}
- if (difficultySelector.selectedIndex == 4) {
+ if (settingsTab.difficultyIndex === 4) {
PopupUtils.open(newGameComponent)
}
@@ -680,13 +516,15 @@
id: tabs
anchors.fill: parent
+ TabsList {
+ id: tabsList
+ }
+
// First tab begins here
Tab {
id: mainTab;
objectName: "MainTab"
- title: i18n.tr("Sudoku")
-
Timer {
id: winTimer;
interval: 2000;
@@ -694,7 +532,7 @@
repeat: false;
onTriggered: {
gameFinishedRectangle.visible = false;
- switch(difficultySelector.selectedIndex) {
+ switch(settingsTab.difficultyIndex) {
case 0:
var randomnumber = Math.floor(Math.random()*9);
randomnumber += 31;
@@ -725,18 +563,13 @@
UbuntuShape {
id: gameFinishedRectangle;
- color: "black";
+ backgroundColor: "black";
opacity: 0.8
- //border.color: sudokuBlocksGrid.defaultBorderColor;
width: mainView.width
radius: "medium"
height: mainView.height*1.3
z: 100;
visible: false;
- //x: mainView.width / 2 - width/2;
- //y: mainView.weight / 2 - height/2;
- //anchors.verticalCenter: mainView.verticalCenter;
- //anchors.horizontalCenter: mainView.verticalCenter;
anchors.centerIn: parent;
//y: units.gu(5);
Label {
@@ -751,421 +584,78 @@
}
page: Page {
+ id: mainPage
+
+ header: PageHeader {
+ title: i18n.tr("Sudoku")
+
+ leadingActionBar {
+ numberOfSlots: 0
+ actions: tabsList.actions
+ }
+
+ trailingActionBar.actions: [
+ Action {
+ objectName: "newgamebutton"
+ text: i18n.tr("New game");
+ iconSource: Qt.resolvedUrl("icons/new_game_ubuntu.svg")
+ onTriggered: {
+ if(gameFinishedRectangle.visible) gameFinishedRectangle.visible = false;
+ //createNewGame()
+ if (settingsTab.difficultyIndex == 4)
+ PopupUtils.open(newGameComponent)
+ else {
+ createNewGame()
+ }
+ }
+ },
+ Action {
+ objectName: "hintbutton"
+ id: revealHintAction
+ iconSource: Qt.resolvedUrl("icons/hint.svg")
+ text: i18n.tr("Show hint");
+ enabled: settingsTab.disableHintsChecked
+ onTriggered: {
+ revealHint()
+ }
+ }
+ ]
+ }
BottomEdgeSlide {
z:2
hintIconName: "help-contents"
}
- head.actions: [
- Action {
- objectName: "newgamebutton"
- text: i18n.tr("New game");
- iconSource: Qt.resolvedUrl("icons/new_game_ubuntu.svg")
- onTriggered: {
- if(gameFinishedRectangle.visible) gameFinishedRectangle.visible = false;
- //print("new block distance:", blockDistance);
- //createNewGame()
- if (settingsTab.difficultyIndex == 4)
- PopupUtils.open(newGameComponent)
- else {
- createNewGame()
- }
- }
- },
- Action {
- objectName: "hintbutton"
- id: revealHintAction
- iconSource: Qt.resolvedUrl("icons/hint.svg")
- text: i18n.tr("Show hint");
- enabled: disableHints.checked;
- onTriggered: {
- revealHint()
- }
- }
- ]
-
- //Column {
- // id: mainColumn;
- //width: mainView.width;
- //height: mainView.height;
- //anchors.left: parent.left;
- //anchors.leftMargin: units.dp(3)
- //anchors.fill: parent
- //spacing: units.gu(5)
-
SudokuBlocksGrid {
id: sudokuBlocksGrid;
objectName: "blockgrid"
- //x: units.dp(3)
x: !mainView.wideAspect() ? 0.5*(mainView.width-9*sudokuBlocksGrid.blockSize-
22*sudokuBlocksGrid.blockDistance) :
0.25*(mainView.width-9*sudokuBlocksGrid.blockSize-
22*sudokuBlocksGrid.blockDistance)
- y: !mainView.wideAspect() ? units.gu(1) : mainView.height*0.05
+ y: !mainView.wideAspect() ? mainPage.header.height : mainView.height*0.05
}
-
- //}
}
-
}
// Highscores Tab
-
- Tab {
+ HighscoresTab {
id: highscoresTab
objectName: "highscoresTab"
- title: i18n.tr("Scores")
- page: HighscoresTab{ id: hsPage }
}
-
-
// settingsTab
- Tab {
- id: settingsTab;
+ SettingsTab {
+ id: settingsTab
objectName: "settingsTab"
- title: i18n.tr("Settings")
-
- property alias disableHintsChecked: disableHints.checked;
- property alias disableVibrationsChecked: disableVibrations.checked;
- property alias difficultyIndex: difficultySelector.selectedIndex;
- property alias themeIndex: themeSelector.selectedIndex;
-
- page: Page {
- objectName: "settingsPage"
-
- anchors {
- left: parent.left
- right: parent.right
- top: parent.top
- }
- height: mainView.height
-
-
- Component {
- id: profileSelector
- Dialog {
- objectName: "selectProfileDialog"
- title: i18n.tr("Select profile")
-
- Column{
- height: mainColumnSettings.height*2/3
- ListView {
-
- id: profileListView
- objectName: "profileListView"
- clip: true
- width: parent.width
- height: parent.height - units.gu(12)
- model: profilesModel
-
- delegate:
- ListItem.Standard {
- text: firstname + " " + lastname
- progression: true
- onTriggered: {
- //console.log("clicked "+index)
- currentUserId = profileId;
- hide()
- }
- }
-
- }
-
- SudokuDialogButton{
- anchors.horizontalCenter: parent.horizontalCenter
- id:cancelButton
- buttonText: i18n.tr("Cancel")
- width: parent.width/2;
- size: units.gu(5)
- buttonColor: sudokuBlocksGrid.dialogButtonColor1
- textColor: sudokuBlocksGrid.dialogButtonTextColor
- //border.color: "transparent"
- onTriggered: {
- hide()
- }
- }
-
- }
- }
- }
-
- Component {
- id: manageProfileSelector
- Dialog {
- objectName: "manageProfileDialog"
- title: i18n.tr("Select profile")
-
- Column{
- height: mainColumnSettings.height*2/3
- ListView {
- id: manageProfileListView
- objectName: "manageProfileListView"
- clip: true
- width: parent.width
- height: parent.height - units.gu(12)
- model: profilesModel
-
- delegate:
-
- ListItem.Standard {
- text: firstname + " " + lastname
-
- progression: true
- onTriggered: {
- hide()
- editUserId = profileId
- PopupUtils.open(manageProfileDialog, selectorProfile)
- }
- }
-
-
-
- }
- SudokuDialogButton{
-
- anchors.horizontalCenter: parent.horizontalCenter
- id:cancelButton
- objectName: "cancelButton"
- buttonText: i18n.tr("Cancel")
- width: parent.width/2;
- size: units.gu(5)
- buttonColor: sudokuBlocksGrid.dialogButtonColor1
- textColor: sudokuBlocksGrid.dialogButtonTextColor
- //border.color: "transparent"
- onTriggered: {
- hide()
- }
- }
- }
- }
- }
-
- ListModel{
- id: profilesModel
- }
-
- //id: mainColumnSettings;
- //width: settingsTab.width;
- //height: settingsTab.height;
- //anchors.fill: parent
- //anchors.horizontalCenter: parent.horizontalCenter;
- //spacing: units.gu(1)
- Flickable {
- id: flickableSettings
- anchors.fill: parent
- //height: parent.height - units.gu(10)
- //width: parent.width
- flickableDirection: Flickable.VerticalFlick
- //clip: true
- objectName: "settingsContainer"
- Column {
- id: mainColumnSettings;
- //anchors.fill: parent
- height: parent.height
- width: parent.width
- spacing: units.gu(1)
-
- ListItem.Header {
- text: i18n.tr("<b>Sudoku settings</b>")
- }
-
- OptionSelector {
- objectName: "difficultySelector"
- id: difficultySelector
- text: i18n.tr("Default Difficulty")
- width: parent.width - units.gu(4)
- anchors.horizontalCenter: parent.horizontalCenter
- model: [i18n.tr("Easy"), i18n.tr("Moderate"), i18n.tr("Hard"), i18n.tr("Ultra Hard"), i18n.tr("Always ask")]
- onSelectedIndexChanged: {
- //print(difficultySelector.selectedIndex)
- switch(difficultySelector.selectedIndex) {
- case 0:
- var randomnumber = Math.floor(Math.random()*9);
- randomnumber += 31;
- sudokuBlocksGrid.createNewGame(81 - randomnumber);
- Settings.setSetting("Difficulty", selectedIndex)
- sudokuBlocksGrid.gameDifficulty = 0
- break;
- case 1:
- var randomnumber = Math.floor(Math.random()*4);
- randomnumber += 26;
- sudokuBlocksGrid.createNewGame(81 - randomnumber);
- Settings.setSetting("Difficulty", selectedIndex)
- sudokuBlocksGrid.gameDifficulty = 1
- break;
- case 2:
- var randomnumber = Math.floor(Math.random()*4);
- randomnumber += 21;
- sudokuBlocksGrid.createNewGame(81 - randomnumber);
- Settings.setSetting("Difficulty", selectedIndex)
- sudokuBlocksGrid.gameDifficulty = 2
- break;
- case 3:
- var randomnumber = Math.floor(Math.random()*3);
- randomnumber += 17;
- sudokuBlocksGrid.createNewGame(81 - randomnumber);
- Settings.setSetting("Difficulty", selectedIndex)
- sudokuBlocksGrid.gameDifficulty = 3
- break;
- case 4:
- Settings.setSetting("Difficulty", selectedIndex)
- break;
- }
- }
-
- }
- OptionSelector {
- objectName: "themeSelector"
- id: themeSelector
- text: i18n.tr("Theme")
- model: ["UbuntuColours", "Simple"]
- width: parent.width - units.gu(4)
- anchors.horizontalCenter: parent.horizontalCenter
- onSelectedIndexChanged: {
- var newColorScheme = null;
- if (selectedIndex == 0)
- {
- //print("Ubuntu")
- var result = Settings.setSetting("ColorTheme", selectedIndex);
- //print(result);
- sudokuBlocksGrid.changeColorScheme("ColorSchemeUbuntu.qml");
- }
- if (selectedIndex == 1)
- {
- //print("Simple")
- var result = Settings.setSetting("ColorTheme", selectedIndex);
- //print(result);
- sudokuBlocksGrid.changeColorScheme("ColorSchemeSimple.qml");
- }
- }
- Component.onCompleted: selectedIndex = 0
- }
-
- ListItem.Standard {
- objectName: "hintsSwitchClickable"
- text: i18n.tr("Hints")
- width: parent.width
- control: Switch {
- objectName: "hintsSwitch"
- id: disableHints
- anchors.horizontalCenter: parent.horizontalCenter
- anchors.verticalCenter: parent.verticalCenter
- checked: disableHintsChecked
- onCheckedChanged: {
- var result = Settings.setSetting("DisableHints", checked ? "true":"false");
- //print(result);
- }
- }
- }
- ListItem.Standard {
- objectName: "vibrationsSwitchClickable"
- text: i18n.tr("Vibration Alerts")
- width: parent.width
- control: Switch {
- objectName: "vibrationsSwitch"
- id: disableVibrations
- anchors.horizontalCenter: parent.horizontalCenter
- anchors.verticalCenter: parent.verticalCenter
- checked: disableVibrationsChecked
- onCheckedChanged: {
- var result = Settings.setSetting("DisableVibrations", checked ? "true":"false");
- //print(result);
- }
- }
- }
- ListItem.Divider {}
-
- ListItem.Header {
- text: i18n.tr("<b>Profiles settings</b>")
- }
- ListItem.SingleValue {
- objectName: "Current profile"
- text: i18n.tr("Current profile")
- id: selectorProfile
- value: {
- if(currentUserId==-1)
- return i18n.tr("None")
- else
- return Settings.getUserFirstName(currentUserId)+" "+Settings.getUserLastName(currentUserId);
-
- }
-
- Component.onCompleted:
- currentUserId = Settings.getSetting("currentUserId")
-
- onClicked: {
-
- var allProfiles = new Array();
- allProfiles = Settings.getAllProfiles()
-
- profilesModel.clear()
-
- for(var i = 0; i < allProfiles.length; i++)
- {
- profilesModel.append({"profileId":allProfiles[i].id,"lastname":allProfiles[i].lastname, "firstname":allProfiles[i].firstname})
- }
- PopupUtils.open(profileSelector, selectorProfile)
- }
- }
-
- AddProfileDialog{
- id:addProfileDialog
- }
-
- ManageProfileDialog{
- id:manageProfileDialog
- }
-
-
- ListItem.SingleValue {
- objectName: "Add profile"
- id:addSingleValue
- text: i18n.tr("Add profile")
- onClicked: {
- PopupUtils.open(addProfileDialog, addSingleValue);
- }
- }
-
- ListItem.SingleValue {
- objectName: "Manage profiles"
- id:manageProfileSingleValue
- text: i18n.tr("Manage profiles")
- onClicked: {
-
- var allProfiles = new Array();
- allProfiles = Settings.getAllProfiles()
-
- profilesModel.clear()
-
- for(var i = 0; i < allProfiles.length; i++)
- {
- profilesModel.append({"profileId":allProfiles[i].id,"lastname":allProfiles[i].lastname, "firstname":allProfiles[i].firstname})
- }
-
- PopupUtils.open(manageProfileSelector, manageProfileSingleValue)
- }
- }
- }
- }
-
- Scrollbar {
- flickableItem: flickableSettings
- align: Qt.AlignTrailing
- }
- }
-
-
}
-
AboutTab {
id: aboutTab
objectName: "aboutTab"
- title: i18n.tr("About")
}
}
}
Follow ups