Merge lp:~dinko-metalac/sudoku-app/keyboard-support into lp:sudoku-app
- keyboard-support
- Merge into trunk
Status: | Merged |
---|---|
Approved by: | Dinko Osmankovic |
Approved revision: | 165 |
Merged at revision: | 158 |
Proposed branch: | lp:~dinko-metalac/sudoku-app/keyboard-support |
Merge into: | lp:sudoku-app |
Diff against target: |
662 lines (+332/-141) 6 files modified
components/ColorSchemeSimple.qml (+1/-0) components/ColorSchemeUbuntu.qml (+1/-0) components/SudokuBlocksGrid.qml (+164/-115) manifest.json (+10/-10) sudoku-app.qml (+155/-16) tests/autopilot/sudoku_app/tests/test_sudoku.py (+1/-0) |
To merge this branch: | bzr merge lp:~dinko-metalac/sudoku-app/keyboard-support |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Ubuntu Phone Apps Jenkins Bot | continuous-integration | Approve | |
Review via email: mp+206891@code.launchpad.net |
Commit message
Added initial keyboard support.
Description of the change
Added initial keyboard support.
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
- 159. By Dinko Osmankovic
-
Take two on keyboard support
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
FAILED: Continuous integration, rev:159
http://
Executed test runs:
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 160. By Dinko Osmankovic
-
AP fixes
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
FAILED: Continuous integration, rev:160
http://
Executed test runs:
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 161. By Dinko Osmankovic
-
AP fixes take 2
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
FAILED: Continuous integration, rev:161
http://
Executed test runs:
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 162. By Dinko Osmankovic
-
AP fixes take 3
- 163. By Dinko Osmankovic
-
AP fixes take infinity
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
FAILED: Continuous integration, rev:162
http://
Executed test runs:
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 164. By Dinko Osmankovic
-
AP fixes take infinity
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
FAILED: Continuous integration, rev:163
http://
Executed test runs:
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
FAILED: Continuous integration, rev:164
http://
Executed test runs:
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 165. By Dinko Osmankovic
-
reverting back to ValueSelector
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
PASSED: Continuous integration, rev:165
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) : | # |
Preview Diff
1 | === modified file 'components/ColorSchemeSimple.qml' |
2 | --- components/ColorSchemeSimple.qml 2013-07-19 13:01:56 +0000 |
3 | +++ components/ColorSchemeSimple.qml 2014-02-18 16:30:57 +0000 |
4 | @@ -1,4 +1,5 @@ |
5 | import QtQuick 2.0 |
6 | +import Ubuntu.Components 0.1 |
7 | |
8 | Item { |
9 | |
10 | |
11 | === modified file 'components/ColorSchemeUbuntu.qml' |
12 | --- components/ColorSchemeUbuntu.qml 2013-07-19 13:01:56 +0000 |
13 | +++ components/ColorSchemeUbuntu.qml 2014-02-18 16:30:57 +0000 |
14 | @@ -1,4 +1,5 @@ |
15 | import QtQuick 2.0 |
16 | +import Ubuntu.Components 0.1 |
17 | |
18 | Item { |
19 | |
20 | |
21 | === modified file 'components/SudokuBlocksGrid.qml' |
22 | --- components/SudokuBlocksGrid.qml 2014-01-22 21:17:26 +0000 |
23 | +++ components/SudokuBlocksGrid.qml 2014-02-18 16:30:57 +0000 |
24 | @@ -303,12 +303,12 @@ |
25 | |
26 | Item { |
27 | |
28 | - // x: 3 |
29 | - // y: 0 |
30 | + // x: 3 |
31 | + // y: 0 |
32 | //anchors.horizontalCenter: parent.parent.horizontalCenter; |
33 | - // rows: 9; |
34 | - // columns: 9; |
35 | - // spacing: units.dp(1); |
36 | + // rows: 9; |
37 | + // columns: 9; |
38 | + // spacing: units.dp(1); |
39 | |
40 | |
41 | Component { |
42 | @@ -322,121 +322,170 @@ |
43 | |
44 | //Column { |
45 | // spacing: units.gu(5) |
46 | - //x: -units.gu(1) |
47 | - |
48 | - |
49 | - SudokuDialogButton{ |
50 | - id: clearButton |
51 | - buttonText: i18n.tr("Clear") |
52 | - width: mainView.width/mainView.height < mainView.resizeFactor ? mainView.width*2/3: units.gu(50)*2/3 |
53 | - size: units.gu(5) |
54 | - //anchors.left: parent.left; |
55 | - //anchors.horizontalCenter: parent |
56 | - buttonColor: dialogButtonColor1 |
57 | - textColor: dialogButtonTextColor |
58 | - //border.color: "transparent" |
59 | - onTriggered: { |
60 | - numberOfActions++; |
61 | - buttonsGrid.itemAt(currentX).buttonText = ""; |
62 | - var row = Math.floor(currentX/9); |
63 | - var column = currentX%9; |
64 | - //print (row, column); |
65 | - grid.setValue(column,row, 0); |
66 | - buttonsGrid.itemAt(currentX).buttonColor = defaultColor; |
67 | - buttonsGrid.itemAt(currentX).boldText = false; |
68 | - buttonsGrid.itemAt(currentX).hinted = false |
69 | - buttonsGrid.redrawGrid() |
70 | - PopupUtils.close(dialogue) |
71 | - } |
72 | - } |
73 | - |
74 | - Grid { |
75 | - columns: 3; |
76 | - x: clearButton.x + 0.5*(clearButton.width - 4*units.gu(5)) |
77 | - spacing: units.gu(2); |
78 | - //width: mainView.width/mainView.height < 0.6 ? mainView.pageWidth*2/3: units.gu(50)*2/3; |
79 | - //anchors.horizontalCenter: clearButton.horizontalCenter |
80 | - //anchors.horizontalCenter: parent |
81 | - |
82 | - Repeater { |
83 | - id: numberPickerButtons |
84 | - model:9 |
85 | - anchors.centerIn: parent |
86 | - |
87 | - |
88 | - SudokuDialogButton{ |
89 | - id: buttonPick |
90 | - buttonText: index+1; |
91 | - |
92 | - size: units.gu(5); |
93 | - |
94 | - onTriggered: { |
95 | - buttonsGrid.itemAt(currentX).buttonText = index+1 |
96 | - buttonsGrid.itemAt(currentX).hinted = false |
97 | - numberOfActions++; |
98 | - |
99 | - var row = Math.floor(currentX/9); |
100 | - var column = currentX%9; |
101 | - |
102 | - //print (row, column) |
103 | - grid.setValue(column, row, index+1); |
104 | - |
105 | - buttonsGrid.redrawGrid() |
106 | - |
107 | - PopupUtils.close(dialogue) |
108 | - |
109 | - if (checkIfGameFinished()) { |
110 | - gameFinishedRectangle.visible = true; |
111 | - //Settings.insertNewScore(currentUserId, sudokuBlocksGrid.calculateScore()) |
112 | - mainView.insertNewGameScore(currentUserId, sudokuBlocksGrid.calculateScore()) |
113 | - if (checkIfCheating) |
114 | - { |
115 | - var _str = "points."; |
116 | - if (sudokuBlocksGrid.calculateScore() == 1) |
117 | - _str = "point." |
118 | - gameFinishedText.text = i18n.tr("You are a cheat...\nBut we give you\n") |
119 | - + sudokuBlocksGrid.calculateScore() |
120 | - + " " + i18n.tr(_str) |
121 | - } |
122 | - else |
123 | - { |
124 | - var _str = "points."; |
125 | - if (sudokuBlocksGrid.calculateScore() == 1) |
126 | - _str = "point." |
127 | - gameFinishedText.text = i18n.tr("Congratulations!\nWe give you\n") |
128 | - + sudokuBlocksGrid.calculateScore() |
129 | - + " " + i18n.tr(_str) |
130 | - } |
131 | - |
132 | - //print (sudokuBlocksGrid.numberOfActions) |
133 | - //print (sudokuBlocksGrid.numberOfHints) |
134 | - //print (sudokuBlocksGrid.gameSeconds) |
135 | - //print (sudokuBlocksGrid.gameDifficulty) |
136 | - gamesPlayedMetric.increment(1); |
137 | - |
138 | - winTimer.restart(); |
139 | - } |
140 | + //x: -units.gu(1) |
141 | + Component.onCompleted: { |
142 | + mainView.dialogLoaded = 2; |
143 | + dialogue.focus = true; |
144 | + //print(dialogue.focus) |
145 | + } |
146 | + Keys.onPressed: { |
147 | + //print("Pressed: ",event.key) |
148 | + if (event.key-48 >= 1 && event.key-48 <= 9) { |
149 | + pressButton(event.key-48) |
150 | + } |
151 | + else if (event.key === Qt.Key_Escape) { |
152 | + buttonsGrid.redrawGrid() |
153 | + PopupUtils.close(dialogue) |
154 | + } |
155 | + else if (event.key == Qt.Key_C) { |
156 | + numberOfActions++; |
157 | + buttonsGrid.itemAt(currentX).buttonText = ""; |
158 | + var row = Math.floor(currentX/9); |
159 | + var column = currentX%9; |
160 | + //print (row, column); |
161 | + grid.setValue(column,row, 0); |
162 | + buttonsGrid.itemAt(currentX).buttonColor = defaultColor; |
163 | + buttonsGrid.itemAt(currentX).boldText = false; |
164 | + buttonsGrid.itemAt(currentX).hinted = false |
165 | + buttonsGrid.redrawGrid() |
166 | + PopupUtils.close(dialogue) |
167 | + } |
168 | + |
169 | + |
170 | + } |
171 | + |
172 | + function pressButton(currentDigit){ |
173 | + buttonsGrid.itemAt(currentX).buttonText = currentDigit |
174 | + buttonsGrid.itemAt(currentX).hinted = false |
175 | + numberOfActions++; |
176 | + |
177 | + var row = Math.floor(currentX/9); |
178 | + var column = currentX%9; |
179 | + |
180 | + //print (row, column) |
181 | + grid.setValue(column, row, currentDigit); |
182 | + |
183 | + buttonsGrid.redrawGrid() |
184 | + PopupUtils.close(dialogue) |
185 | + mainView.dialogLoaded = -1; |
186 | + mainView.focus = true; |
187 | + } |
188 | + |
189 | + |
190 | + SudokuDialogButton { |
191 | + id: clearButton |
192 | + buttonText: i18n.tr("Clear") |
193 | + width: mainView.width/mainView.height < mainView.resizeFactor ? mainView.width*2/3: units.gu(50)*2/3 |
194 | + size: units.gu(5) |
195 | + //anchors.left: parent.left; |
196 | + //anchors.horizontalCenter: parent |
197 | + buttonColor: dialogButtonColor1 |
198 | + textColor: dialogButtonTextColor |
199 | + //border.color: "transparent" |
200 | + onTriggered: { |
201 | + numberOfActions++; |
202 | + buttonsGrid.itemAt(currentX).buttonText = ""; |
203 | + var row = Math.floor(currentX/9); |
204 | + var column = currentX%9; |
205 | + //print (row, column); |
206 | + grid.setValue(column,row, 0); |
207 | + buttonsGrid.itemAt(currentX).buttonColor = defaultColor; |
208 | + buttonsGrid.itemAt(currentX).boldText = false; |
209 | + buttonsGrid.itemAt(currentX).hinted = false |
210 | + buttonsGrid.redrawGrid() |
211 | + PopupUtils.close(dialogue) |
212 | + //parent.pressButton(currentX); |
213 | + } |
214 | + } |
215 | + |
216 | + Grid { |
217 | + columns: 3; |
218 | + x: clearButton.x + 0.5*(clearButton.width - 4*units.gu(5)) |
219 | + spacing: units.gu(2); |
220 | + //width: mainView.width/mainView.height < 0.6 ? mainView.pageWidth*2/3: units.gu(50)*2/3; |
221 | + //anchors.horizontalCenter: clearButton.horizontalCenter |
222 | + //anchors.horizontalCenter: parent |
223 | + |
224 | + Repeater { |
225 | + id: numberPickerButtons |
226 | + model:9 |
227 | + anchors.centerIn: parent |
228 | + |
229 | + |
230 | + SudokuDialogButton{ |
231 | + id: buttonPick |
232 | + buttonText: index+1; |
233 | + |
234 | + size: units.gu(5); |
235 | + |
236 | + onTriggered: { |
237 | + //print("curr: ", index+1) |
238 | + buttonsGrid.itemAt(currentX).buttonText = index+1 |
239 | + buttonsGrid.itemAt(currentX).hinted = false |
240 | + numberOfActions++; |
241 | + |
242 | + var row = Math.floor(currentX/9); |
243 | + var column = currentX%9; |
244 | + |
245 | + //print (row, column) |
246 | + grid.setValue(column, row, index+1); |
247 | + |
248 | + buttonsGrid.redrawGrid() |
249 | + |
250 | + PopupUtils.close(dialogue) |
251 | + |
252 | + if (checkIfGameFinished()) { |
253 | + gameFinishedRectangle.visible = true; |
254 | + //Settings.insertNewScore(currentUserId, sudokuBlocksGrid.calculateScore()) |
255 | + mainView.insertNewGameScore(currentUserId, sudokuBlocksGrid.calculateScore()) |
256 | + if (checkIfCheating) |
257 | + { |
258 | + var _str = "points."; |
259 | + if (sudokuBlocksGrid.calculateScore() == 1) |
260 | + _str = "point." |
261 | + gameFinishedText.text = i18n.tr("You are a cheat...\nBut we give you\n") |
262 | + + sudokuBlocksGrid.calculateScore() |
263 | + + " " + i18n.tr(_str) |
264 | + } |
265 | + else |
266 | + { |
267 | + var _str = "points."; |
268 | + if (sudokuBlocksGrid.calculateScore() == 1) |
269 | + _str = "point." |
270 | + gameFinishedText.text = i18n.tr("Congratulations!\nWe give you\n") |
271 | + + sudokuBlocksGrid.calculateScore() |
272 | + + " " + i18n.tr(_str) |
273 | + } |
274 | + |
275 | + //print (sudokuBlocksGrid.numberOfActions) |
276 | + //print (sudokuBlocksGrid.numberOfHints) |
277 | + //print (sudokuBlocksGrid.gameSeconds) |
278 | + //print (sudokuBlocksGrid.gameDifficulty) |
279 | + gamesPlayedMetric.increment(1); |
280 | + |
281 | + winTimer.restart(); |
282 | } |
283 | } |
284 | } |
285 | } |
286 | - |
287 | - |
288 | - SudokuDialogButton{ |
289 | - buttonText: i18n.tr("Cancel") |
290 | - width: mainView.width/mainView.height < mainView.resizeFactor ? mainView.width*2/3: units.gu(50)*2/3 |
291 | - size: units.gu(5) |
292 | - //anchors.left: parent.left; |
293 | - //anchors.horizontalCenter: parent |
294 | - anchors.leftMargin: units.gu(10) |
295 | - buttonColor: dialogButtonColor2 |
296 | - textColor: dialogButtonTextColor |
297 | - //border.color: "transparent" |
298 | - onTriggered: { |
299 | - buttonsGrid.redrawGrid() |
300 | - PopupUtils.close(dialogue) |
301 | - } |
302 | + } |
303 | + |
304 | + |
305 | + SudokuDialogButton{ |
306 | + buttonText: i18n.tr("Cancel") |
307 | + width: mainView.width/mainView.height < mainView.resizeFactor ? mainView.width*2/3: units.gu(50)*2/3 |
308 | + size: units.gu(5) |
309 | + //anchors.left: parent.left; |
310 | + //anchors.horizontalCenter: parent |
311 | + anchors.leftMargin: units.gu(10) |
312 | + buttonColor: dialogButtonColor2 |
313 | + textColor: dialogButtonTextColor |
314 | + //border.color: "transparent" |
315 | + onTriggered: { |
316 | + buttonsGrid.redrawGrid() |
317 | + PopupUtils.close(dialogue) |
318 | } |
319 | + } |
320 | |
321 | //} |
322 | |
323 | |
324 | === modified file 'manifest.json' |
325 | --- manifest.json 2014-01-09 08:22:26 +0000 |
326 | +++ manifest.json 2014-02-18 16:30:57 +0000 |
327 | @@ -1,15 +1,15 @@ |
328 | { |
329 | - "description": "Sudoku game for Ubuntu devices", |
330 | - "framework": "ubuntu-sdk-13.10", |
331 | + "architecture": "all", |
332 | + "description": "description of sudoku-app", |
333 | + "framework": "ubuntu-sdk-13.10", |
334 | "hooks": { |
335 | - "sudoku": { |
336 | - "apparmor": "apparmor/sudoku.json", |
337 | + "sudoku-app": { |
338 | + "apparmor": "sudoku-app.json", |
339 | "desktop": "sudoku-app.desktop" |
340 | } |
341 | - }, |
342 | - "icon": "SudokuGameIcon.png", |
343 | - "maintainer": "Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>", |
344 | - "name": "com.ubuntu.sudoku", |
345 | - "title": "sudoku", |
346 | - "version": "1.0" |
347 | + }, |
348 | + "maintainer": "", |
349 | + "name": "com.ubuntu.developer.username.sudoku-app", |
350 | + "title": "sudoku-app", |
351 | + "version": "0.1" |
352 | } |
353 | |
354 | === modified file 'sudoku-app.qml' |
355 | --- sudoku-app.qml 2014-01-09 14:57:22 +0000 |
356 | +++ sudoku-app.qml 2014-02-18 16:30:57 +0000 |
357 | @@ -25,6 +25,8 @@ |
358 | property string alertTitle: "" |
359 | property string alertText : "" |
360 | |
361 | + property int dialogLoaded: -1; |
362 | + |
363 | property int editUserId : -1; |
364 | |
365 | width: units.gu(41); |
366 | @@ -37,6 +39,9 @@ |
367 | /*HUD.HUD { |
368 | applicationIdentifier: "sudoku-app" // this has to match the .desktop file! |
369 | HUD.Context {*/ |
370 | + |
371 | + StateSaver.properties: "width, height" |
372 | + |
373 | actions: [ |
374 | Action { |
375 | text: i18n.tr("New game") |
376 | @@ -215,10 +220,10 @@ |
377 | + sudokuBlocksGrid.calculateScore() |
378 | + " " + i18n.tr("points.") |
379 | |
380 | -// print (sudokuBlocksGrid.numberOfActions) |
381 | -// print (sudokuBlocksGrid.numberOfHints) |
382 | -// print (sudokuBlocksGrid.gameSeconds) |
383 | -// print (sudokuBlocksGrid.gameDifficulty) |
384 | + // print (sudokuBlocksGrid.numberOfActions) |
385 | + // print (sudokuBlocksGrid.numberOfHints) |
386 | + // print (sudokuBlocksGrid.gameSeconds) |
387 | + // print (sudokuBlocksGrid.gameDifficulty) |
388 | var allScores = Settings.getAllScores() |
389 | highscoresModel.clear(); |
390 | highscoresHeaderText = i18n.tr("<b>Best scores for all players</b>"); |
391 | @@ -261,6 +266,7 @@ |
392 | sudokuBlocksGrid.createNewGame(81 - randomnumber); |
393 | break; |
394 | case 4: |
395 | + mainView.dialogLoaded = 1; |
396 | PopupUtils.open(newGameComponent) |
397 | break; |
398 | } |
399 | @@ -330,18 +336,71 @@ |
400 | |
401 | Component { |
402 | id: newGameComponent |
403 | + |
404 | Dialog { |
405 | id: newGameDialogue |
406 | title: i18n.tr("New Game") |
407 | text: i18n.tr("Select difficulty level") |
408 | |
409 | + function closeDialog() { |
410 | + PopupUtils.close(newGameDialogue) |
411 | + mainView.dialogLoaded = -1; |
412 | + mainView.focus = true; |
413 | + } |
414 | + |
415 | + Component.onCompleted: { |
416 | + mainView.dialogLoaded = 1; |
417 | + newGameDialogue.focus = true; |
418 | + mainView.focus = false; |
419 | + } |
420 | + |
421 | + Keys.onPressed: { |
422 | + switch(event.key) { |
423 | + case Qt.Key_E: |
424 | + var randomnumber = Math.floor(Math.random()*9); |
425 | + randomnumber += 31; |
426 | + sudokuBlocksGrid.createNewGame(81 - randomnumber); |
427 | + sudokuBlocksGrid.gameDifficulty = 0 |
428 | + break; |
429 | + case Qt.Key_M: |
430 | + var randomnumber = Math.floor(Math.random()*4); |
431 | + randomnumber += 26; |
432 | + sudokuBlocksGrid.createNewGame(81 - randomnumber); |
433 | + sudokuBlocksGrid.gameDifficulty = 1 |
434 | + break; |
435 | + case Qt.Key_R: |
436 | + var randomnumber = Math.floor(Math.random()*4); |
437 | + randomnumber += 21; |
438 | + sudokuBlocksGrid.createNewGame(81 - randomnumber); |
439 | + sudokuBlocksGrid.gameDifficulty = 2 |
440 | + break; |
441 | + case Qt.Key_U: |
442 | + var randomnumber = Math.floor(Math.random()*3); |
443 | + randomnumber += 17; |
444 | + sudokuBlocksGrid.createNewGame(81 - randomnumber); |
445 | + sudokuBlocksGrid.gameDifficulty = 3 |
446 | + break; |
447 | + |
448 | + case Qt.Key_Escape: |
449 | + break; |
450 | + |
451 | + default: |
452 | + //console.log("No key action defined") |
453 | + break; |
454 | + } |
455 | + } |
456 | + |
457 | + |
458 | + |
459 | Column { |
460 | spacing: units.gu(5) |
461 | + |
462 | Grid { |
463 | rowSpacing: units.gu(3) |
464 | columnSpacing: units.gu(3) |
465 | columns: 2 |
466 | anchors.horizontalCenter: parent.horizontalCenter |
467 | + |
468 | NewGameSelectionButton { |
469 | id: easyGameButton |
470 | objectName: "easyGameButton" |
471 | @@ -349,15 +408,17 @@ |
472 | opacity: 0.8 |
473 | width: mainView.width/mainView.height < mainView.resizeFactor ? mainView.width/4: units.gu(50)/4; |
474 | height: width |
475 | + |
476 | onTriggered: { |
477 | //print("EASY") |
478 | var randomnumber = Math.floor(Math.random()*9); |
479 | randomnumber += 31; |
480 | sudokuBlocksGrid.createNewGame(81 - randomnumber); |
481 | - PopupUtils.close(newGameDialogue) |
482 | sudokuBlocksGrid.gameDifficulty = 0 |
483 | + newGameDialogue.closeDialog() |
484 | //toolbar.opened = false; |
485 | } |
486 | + |
487 | } |
488 | NewGameSelectionButton { |
489 | id: moderateGameButton |
490 | @@ -371,8 +432,8 @@ |
491 | var randomnumber = Math.floor(Math.random()*4); |
492 | randomnumber += 26; |
493 | sudokuBlocksGrid.createNewGame(81 - randomnumber); |
494 | - PopupUtils.close(newGameDialogue) |
495 | sudokuBlocksGrid.gameDifficulty = 1 |
496 | + newGameDialogue.closeDialog() |
497 | //toolbar.opened = false; |
498 | } |
499 | } |
500 | @@ -388,8 +449,8 @@ |
501 | var randomnumber = Math.floor(Math.random()*4); |
502 | randomnumber += 21; |
503 | sudokuBlocksGrid.createNewGame(81 - randomnumber); |
504 | - PopupUtils.close(newGameDialogue) |
505 | sudokuBlocksGrid.gameDifficulty = 2 |
506 | + newGameDialogue.closeDialog() |
507 | //toolbar.opened = false; |
508 | } |
509 | } |
510 | @@ -405,8 +466,8 @@ |
511 | var randomnumber = Math.floor(Math.random()*3); |
512 | randomnumber += 17; |
513 | sudokuBlocksGrid.createNewGame(81 - randomnumber); |
514 | - PopupUtils.close(newGameDialogue) |
515 | sudokuBlocksGrid.gameDifficulty = 3 |
516 | + newGameDialogue.closeDialog() |
517 | //toolbar.opened = false; |
518 | } |
519 | } |
520 | @@ -422,14 +483,80 @@ |
521 | anchors.horizontalCenter: parent.horizontalCenter |
522 | //border.color: "transparent" |
523 | onTriggered: { |
524 | - PopupUtils.close(newGameDialogue) |
525 | + newGameDialogue.closeDialog() |
526 | } |
527 | } |
528 | - |
529 | - } |
530 | - |
531 | - } |
532 | - } |
533 | + } |
534 | + |
535 | + } |
536 | + } |
537 | + |
538 | + focus: true |
539 | + Keys.onPressed: { |
540 | + if (mainView.dialogLoaded == -1 && mainView.focus == true) { |
541 | + switch(event.key) { |
542 | + case Qt.Key_E: |
543 | + var randomnumber = Math.floor(Math.random()*9); |
544 | + randomnumber += 31; |
545 | + sudokuBlocksGrid.createNewGame(81 - randomnumber); |
546 | + sudokuBlocksGrid.gameDifficulty = 0 |
547 | + settingsTab.difficultyIndex = 0; |
548 | + break; |
549 | + case Qt.Key_M: |
550 | + var randomnumber = Math.floor(Math.random()*4); |
551 | + randomnumber += 26; |
552 | + sudokuBlocksGrid.createNewGame(81 - randomnumber); |
553 | + sudokuBlocksGrid.gameDifficulty = 1 |
554 | + settingsTab.difficultyIndex = 1 |
555 | + break; |
556 | + case Qt.Key_R: |
557 | + var randomnumber = Math.floor(Math.random()*4); |
558 | + randomnumber += 21; |
559 | + sudokuBlocksGrid.createNewGame(81 - randomnumber); |
560 | + sudokuBlocksGrid.gameDifficulty = 2 |
561 | + settingsTab.difficultyIndex = 2 |
562 | + break; |
563 | + case Qt.Key_U: |
564 | + var randomnumber = Math.floor(Math.random()*3); |
565 | + randomnumber += 17; |
566 | + sudokuBlocksGrid.createNewGame(81 - randomnumber); |
567 | + sudokuBlocksGrid.gameDifficulty = 3 |
568 | + settingsTab.difficultyIndex = 3 |
569 | + break; |
570 | + |
571 | + case Qt.Key_H: |
572 | + // Show Hint if possible |
573 | + revealHint(); |
574 | + break; |
575 | + |
576 | + case Qt.Key_Left: |
577 | + if (tabs.selectedTabIndex > 0) { |
578 | + //print(tabs.selectedTabIndex) |
579 | + tabs.selectedTabIndex -= 1 |
580 | + } |
581 | + else |
582 | + tabs.selectedTabIndex = 3 |
583 | + break; |
584 | + |
585 | + case Qt.Key_Right: |
586 | + if (tabs.selectedTabIndex < 3) { |
587 | + //print(tabs.selectedTabIndex) |
588 | + tabs.selectedTabIndex += 1 |
589 | + } |
590 | + else |
591 | + tabs.selectedTabIndex = 0 |
592 | + break; |
593 | + |
594 | + case Qt.Key_Escape: |
595 | + break; |
596 | + |
597 | + default: |
598 | + //console.log("No key action defined") |
599 | + break; |
600 | + } |
601 | + } |
602 | + } |
603 | + |
604 | |
605 | function showAlert(title, text, caller) |
606 | { |
607 | @@ -439,6 +566,17 @@ |
608 | |
609 | } |
610 | |
611 | + function showNewGameDialog(caller) |
612 | + { |
613 | + PopupUtils.open(newGameComponent, caller) |
614 | + |
615 | + } |
616 | + function hideNewGameDialog() |
617 | + { |
618 | + PopupUtils.close(newGameComponent, caller) |
619 | + |
620 | + } |
621 | + |
622 | onHeightChanged: { |
623 | if (!gridLoaded && width/height > mainView.resizeFactor) |
624 | return; |
625 | @@ -452,6 +590,7 @@ |
626 | sudokuBlocksGrid = Qt.createComponent(Qt.resolvedUrl("SudokuBlocksGrid.qml")) |
627 | } |
628 | |
629 | + |
630 | Component.onCompleted: { |
631 | Settings.initialize(); |
632 | settingsTab.difficultyIndex = parseInt(Settings.getSetting("Difficulty")); |
633 | @@ -586,7 +725,7 @@ |
634 | //if (settingsTab.difficultyIndex == 4) |
635 | // PopupUtils.open(newGameComponent) |
636 | //else |
637 | - createNewGame() |
638 | + createNewGame() |
639 | } |
640 | } |
641 | } |
642 | @@ -887,7 +1026,7 @@ |
643 | delegate: |
644 | |
645 | ListItem.Standard { |
646 | - |
647 | + __foregroundColor: "white" |
648 | text: firstname + " " + lastname |
649 | |
650 | progression: true |
651 | |
652 | === modified file 'tests/autopilot/sudoku_app/tests/test_sudoku.py' |
653 | --- tests/autopilot/sudoku_app/tests/test_sudoku.py 2014-01-22 21:17:26 +0000 |
654 | +++ tests/autopilot/sudoku_app/tests/test_sudoku.py 2014-02-18 16:30:57 +0000 |
655 | @@ -250,6 +250,7 @@ |
656 | #select "Simple" choice of theme selector |
657 | self.assertThat(self.main_view.get_theme_selector_labelvisual, Eventually(Not(Is(None)))) |
658 | themeChoices = self.main_view.get_theme_selector_labelvisual() |
659 | + print(themeChoices) |
660 | themeChoice = filter(lambda choice: choice.text == 'Simple', themeChoices)[0] |
661 | self.pointing_device.click_object(themeChoice) |
662 | self.assertThat(lambda: self.main_view.get_theme_selector_labelvisual()[1].text, Eventually(Equals("Simple"))) |
FAILED: Continuous integration, rev:158 91.189. 93.70:8080/ job/sudoku- app-ci/ 60/ 91.189. 93.70:8080/ job/generic- mediumtests- trusty/ 1351 91.189. 93.70:8080/ job/sudoku- app-raring- amd64-ci/ 59 91.189. 93.70:8080/ job/sudoku- app-saucy- amd64-ci/ 59 91.189. 93.70:8080/ job/sudoku- app-trusty- amd64-ci/ 12
http://
Executed test runs:
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild: 91.189. 93.70:8080/ job/sudoku- app-ci/ 60/rebuild
http://