@@ -12,18 +12,7 @@
property bool portaitMode: true
property var sudoku
- onPortaitModeChanged: {
- if (portaitMode) {
- buttonsGrid.anchors.top = parent.top
- buttonsGrid.anchors.left = none
- numberGrid.anchors.top = buttonsGrid.top
- numberGrid.anchors.topMargin = Theme.paddingLarge
- } else {
-
- }
- }
-
- height: Math.max(buttonsGrid.height, numberGrid.height)
+ //height: Math.max(buttonsGrid.height, numberGrid.height)
onModeChanged: {
Global.mode = mode
@@ -59,10 +48,15 @@
Grid {
id: buttonsGrid
- anchors.left: parent.left
- rows: 3
- columns: 2
- spacing: Theme.paddingMedium
+ anchors{
+ top: parent.top
+ left: parent.left
+ right: portaitMode ? undefined : parent.right
+ }
+ rows: portaitMode ? 3 : 1
+ columns: portaitMode ? 2 : 6
+ spacing: portaitMode ? Theme.paddingMedium : Theme.paddingSmall
+ width: switchAdd.width * columns + (columns - 1) * spacing
IconSwitch {
id: switchAdd
@@ -109,10 +103,11 @@
Grid {
id: numberGrid
anchors {
+ top: portaitMode ? parent.top : buttonsGrid.bottom
+ topMargin: portaitMode ? (buttonsGrid.height - height) / 2 : Theme.paddingLarge
right: parent.right
- left: buttonsGrid.right
- leftMargin: Theme.paddingLarge
- verticalCenter: buttonsGrid.verticalCenter
+ left: portaitMode ? buttonsGrid.right : parent.left
+ leftMargin: portaitMode ? Theme.paddingLarge : 0
}
rows: 3
columns: 3
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-aenigma-0.3.8.tar.bz2/qml/pages/GamePage.qml
^
|
@@ -10,7 +10,7 @@
Page {
id: page
- allowedOrientations: Orientation.Portrait
+ allowedOrientations: Orientation.All
function reset() {
settings.gameStateData = ""
@@ -25,18 +25,9 @@
// save board thumbnail
gameBoard.grabToImage(function(result) {
result.saveToFile(StandardPaths.cache + "/bookmarks/" + sudokuGame.uuid + "_" + timestamp + ".png")
- }, Qt.size(Math.round(Screen.width * 0,75), Math.round(Screen.width * 0,75)))
+ }, Qt.size(Math.round(Screen.width * 0.75), Math.round(Screen.width * 0.75)))
}
-// DisplayBlanking {
-// preventBlanking: sudokuGame.gameState === GameState.Playing && settings.preventDisplayBlanking && app.visible
-// }
-
-// PageBusyIndicator {
-// anchors.centerIn: parent
-// running: sudokuGame.gameState === GameState.Generating
-// }
-
HarbourDisplayBlanking {
pauseRequested: sudokuGame.gameState === GameState.Playing && settings.preventDisplayBlanking && app.visible
}
@@ -47,9 +38,8 @@
running: sudokuGame.gameState === GameState.Generating
}
-
-
SilicaFlickable {
+ id: flickable
anchors.fill: parent
PullDownMenu {
@@ -118,100 +108,97 @@
RemorsePopup { id: remorse }
- contentHeight: column.height
-
- Column {
- id: column
-
- width: page.width
- spacing: Theme.paddingLarge
+ PageHeader {
+ id: pageHeader
+ //% "Sudoku board"
+ title: qsTrId("id-sudoku-board")
+ description: {
+ switch (sudokuGame.gameState) {
+ case GameState.Empty:
+ return ''
+
+ case GameState.Generating:
+ //% "Generating"
+ return qsTrId("id-generating") + "..."
+
+ case GameState.Ready:
+ case GameState.Pause:
+ case GameState.Playing:
+ //% "%n cell(s) unsolved"
+ return qsTrId("id-cells-unsolved", sudokuGame.unsolvedCellCount) + " (" + new Date(sudokuGame.elapsedTime * 1000).toISOString().substr(11, 8) + ")"
+
+ case GameState.NotCorrect:
+ //% "There are errors"
+ return qsTrId("id-has-errors")
+
+ case GameState.Solved:
+ //% "Solved"
+ return qsTrId("id-solved")
- PageHeader {
- //% "Sudoku board"
- title: qsTrId("id-sudoku-board")
- description: {
- switch (sudokuGame.gameState) {
- case GameState.Empty:
- return ''
-
- case GameState.Generating:
- //% "Generating"
- return qsTrId("id-generating") + "..."
-
- case GameState.Ready:
- case GameState.Pause:
- case GameState.Playing:
- //% "%n cell(s) unsolved"
- return qsTrId("id-cells-unsolved", sudokuGame.unsolvedCellCount)
-
- case GameState.NotCorrect:
- //% "There are errors"
- return qsTrId("id-has-errors")
-
- case GameState.Solved:
- //% "Solved"
- return qsTrId("id-solved")
-
- default:
- return ""
- }
+ default:
+ return ""
}
+ }
+ }
- Label {
- visible: sudokuGame.gameState >= GameState.Playing
- anchors{
- left: parent.left
- leftMargin: Theme.horizontalPageMargin
- bottom: parent.bottom
- bottomMargin: Theme.paddingMedium
- }
- color: Theme.highlightColor
- text: new Date(sudokuGame.elapsedTime * 1000).toISOString().substr(11, 8);
- }
+ Item {
+ id: gameArea
+
+ anchors{
+ left: pageHeader.left
+ leftMargin: Theme.horizontalPageMargin
+ top: orientation === Orientation.Portrait ? pageHeader.bottom : pageHeader.top
+ topMargin: Theme.horizontalPageMargin
}
- Item {
- x: Theme.horizontalPageMargin
- width: parent.width - 2*x
- height: width
+ width: orientation === Orientation.Portrait ? parent.width - 2*Theme.horizontalPageMargin : Screen.width - 2*Theme.horizontalPageMargin
+ height: width
- GameBoard {
- visible: sudokuGame.gameState >= GameState.Ready
- id: gameBoard
- anchors.fill: parent
+ GameBoard {
+ visible: sudokuGame.gameState >= GameState.Ready
+ id: gameBoard
+ anchors.fill: parent
- opacity: sudokuGame.gameState === GameState.Solved ? 0.1 : 1.0
- Behavior on opacity { FadeAnimator {} }
+ opacity: sudokuGame.gameState === GameState.Solved ? 0.1 : 1.0
+ Behavior on opacity { FadeAnimator {} }
- cellSize: Math.floor((width - 2*spacing) / 9)
+ cellSize: Math.floor((width - 2*spacing) / 9)
- layer.enabled: true
+ layer.enabled: true
- sudoku: sudokuGame
- }
+ sudoku: sudokuGame
+ }
- ResultBoard {
- visible: sudokuGame.gameState === GameState.Solved
- anchors.fill: parent
-
- elapsedTime: sudokuGame.elapsedTime
- hints: sudokuGame.hintsCount
- steps: sudokuGame.stepsCount
- difficulty: sudokuGame.difficulty
- }
+ ResultBoard {
+ visible: sudokuGame.gameState === GameState.Solved
+ anchors.fill: parent
+
+ elapsedTime: sudokuGame.elapsedTime
+ hints: sudokuGame.hintsCount
+ steps: sudokuGame.stepsCount
+ difficulty: sudokuGame.difficulty
}
+ }
- Controls {
- visible: sudokuGame.gameState >= GameState.Ready
- id: controlsPanel
+ Controls {
+ visible: sudokuGame.gameState >= GameState.Ready
+ id: controlsPanel
+ anchors{
+ left: orientation === Orientation.Portrait ? pageHeader.left : gameArea.right
+ leftMargin: Theme.horizontalPageMargin
+ right: pageHeader.right
+ rightMargin: Theme.horizontalPageMargin
+ top: orientation === Orientation.Portrait ? gameArea.bottom : pageHeader.bottom
+ topMargin: orientation === Orientation.Portrait ? Theme.paddingLarge : Theme.paddingLarge
+ }
|