Status: | Superseded |
---|---|
Proposed branch: | lp:~fcole90/u-draw/u-draw |
Merge into: | lp:u-draw |
Diff against target: |
1933 lines (+1762/-0) (has conflicts) 25 files modified
Makefile (+21/-0) components/ColorChooser.qml (+208/-0) components/ColorItem.qml (+16/-0) components/DrawingSheet.qml (+122/-0) components/DrawingTool.qml (+36/-0) components/FineTuneChooser.qml (+117/-0) components/HelloComponent.qml (+14/-0) components/UbuntuIconButton.qml (+12/-0) js/Behaviours.js (+131/-0) manifest.json (+14/-0) tests/autopilot/U-Draw/__init__.py (+131/-0) tests/autopilot/U-Draw/main/__init__.py (+1/-0) tests/autopilot/U-Draw/main/test_main.py (+23/-0) tests/autopilot/run (+11/-0) tests/unit/tst_hellocomponent.qml (+49/-0) uDraw.desktop (+8/-0) uDraw.json (+6/-0) uDraw.qml (+39/-0) uDraw.qmlproject (+46/-0) uDraw.qmlproject.user (+134/-0) uDraw.qmlproject~ (+46/-0) ui/DrawTab.qml (+391/-0) ui/DrawTabTools.qml (+142/-0) ui/NoteTab.qml (+6/-0) ui/TestingTab.qml (+38/-0) Conflict adding file Makefile. Moved existing file to Makefile.moved. Conflict adding file components. Moved existing file to components.moved. Conflict adding file graphics. Moved existing file to graphics.moved. Conflict adding file manifest.json. Moved existing file to manifest.json.moved. Conflict adding file tests. Moved existing file to tests.moved. Conflict adding file ui. Moved existing file to ui.moved. |
To merge this branch: | bzr merge lp:~fcole90/u-draw/u-draw |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
fcole90 | Approve | ||
Review via email: mp+185691@code.launchpad.net |
This proposal has been superseded by a proposal from 2013-09-16.
Commit message
First stable release: 1.0
Description of the change
To post a comment you must log in.
Revision history for this message
fcole90 (fcole90) : | # |
review:
Approve
lp:~fcole90/u-draw/u-draw
updated
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === added file 'Makefile' |
2 | --- Makefile 1970-01-01 00:00:00 +0000 |
3 | +++ Makefile 2013-09-15 23:59:30 +0000 |
4 | @@ -0,0 +1,21 @@ |
5 | +# More information: https://wiki.ubuntu.com/Touch/Testing |
6 | +# |
7 | +# Notes for autopilot tests: |
8 | +# ----------------------------------------------------------- |
9 | +# In order to run autopilot tests: |
10 | +# sudo apt-add-repository ppa:autopilot/ppa |
11 | +# sudo apt-get update |
12 | +# sudo apt-get install python-autopilot autopilot-qt |
13 | +############################################################# |
14 | + |
15 | +all: |
16 | + |
17 | +autopilot: |
18 | + chmod +x tests/autopilot/run |
19 | + tests/autopilot/run |
20 | + |
21 | +check: |
22 | + qmltestrunner -input tests/unit |
23 | + |
24 | +run: |
25 | + /usr/bin/qmlscene $@ U-Draw.qml |
26 | |
27 | === renamed file 'Makefile' => 'Makefile.moved' |
28 | === added directory 'components' |
29 | === renamed directory 'components' => 'components.moved' |
30 | === added file 'components/ColorChooser.qml' |
31 | --- components/ColorChooser.qml 1970-01-01 00:00:00 +0000 |
32 | +++ components/ColorChooser.qml 2013-09-15 23:59:30 +0000 |
33 | @@ -0,0 +1,208 @@ |
34 | +import QtQuick 2.0 |
35 | +import Ubuntu.Components 0.1 |
36 | +import Ubuntu.Components.Popups 0.1 |
37 | + |
38 | + |
39 | +Component { |
40 | + id: colorsSheet |
41 | + |
42 | + |
43 | + |
44 | + ComposerSheet { |
45 | + id: sheet |
46 | + title: i18n.tr("Palette") |
47 | + height: units.gu(55) |
48 | + width: units.gu(99) |
49 | + |
50 | + |
51 | + |
52 | + Column |
53 | + { |
54 | + anchors.horizontalCenter: parent.horizontalCenter |
55 | + width: parent.width |
56 | + spacing: units.gu(2) |
57 | + Row{ |
58 | + spacing: units.gu(2) |
59 | + anchors.horizontalCenter: parent.horizontalCenter |
60 | + |
61 | + UbuntuShape{ |
62 | + width: units.gu(14) |
63 | + height: units.gu(3) |
64 | + color: canvas.currentColor |
65 | + |
66 | + } |
67 | + |
68 | + UbuntuShape{ |
69 | + width: units.gu(14) |
70 | + height: units.gu(3) |
71 | + color: canvas.bufferColor |
72 | + |
73 | + } |
74 | + |
75 | + |
76 | + } |
77 | + |
78 | + Rectangle{ |
79 | + id: separator1 |
80 | + color: "darkgray" |
81 | + width: parent.width |
82 | + height: units.gu(1) |
83 | + } |
84 | + |
85 | + Grid{ |
86 | + anchors.horizontalCenter: parent.horizontalCenter |
87 | + rows: 6 |
88 | + columns: 5 |
89 | + spacing: units.gu(2) |
90 | + |
91 | + //Row 1 |
92 | + ColorItem{ |
93 | + color: "red" |
94 | + } |
95 | + |
96 | + ColorItem{ |
97 | + color: "yellow" |
98 | + } |
99 | + |
100 | + ColorItem{ |
101 | + color: "green" |
102 | + } |
103 | + |
104 | + ColorItem{ |
105 | + color: "blue" |
106 | + } |
107 | + |
108 | + ColorItem{ |
109 | + color: "magenta" |
110 | + } |
111 | + |
112 | + //Row2 |
113 | + |
114 | + ColorItem{ |
115 | + color: "salmon" |
116 | + } |
117 | + |
118 | + ColorItem{ |
119 | + color: "orange" |
120 | + } |
121 | + |
122 | + ColorItem{ |
123 | + color: "aquamarine" |
124 | + } |
125 | + |
126 | + ColorItem{ |
127 | + color: "cyan" |
128 | + } |
129 | + |
130 | + ColorItem{ |
131 | + color: "pink" |
132 | + } |
133 | + |
134 | + //Row3 |
135 | + |
136 | + ColorItem{ |
137 | + color: "orangered" |
138 | + } |
139 | + |
140 | + ColorItem{ |
141 | + color: "gold" |
142 | + } |
143 | + |
144 | + ColorItem{ |
145 | + color: "forestgreen" |
146 | + } |
147 | + |
148 | + ColorItem{ |
149 | + color: "royalblue" |
150 | + } |
151 | + |
152 | + ColorItem{ |
153 | + color: "purple" |
154 | + } |
155 | + |
156 | + //Row 4 |
157 | + |
158 | + ColorItem{ |
159 | + color: "crimson" |
160 | + } |
161 | + |
162 | + ColorItem{ |
163 | + color: "goldenrod" |
164 | + } |
165 | + |
166 | + ColorItem{ |
167 | + color: "olive" |
168 | + } |
169 | + |
170 | + ColorItem{ |
171 | + color: "slateblue" |
172 | + } |
173 | + |
174 | + ColorItem{ |
175 | + color: "indigo" |
176 | + } |
177 | + //Row 5 |
178 | + |
179 | + ColorItem{ |
180 | + color: "sienna" |
181 | + } |
182 | + |
183 | + ColorItem{ |
184 | + color: UbuntuColors.orange |
185 | + } |
186 | + |
187 | + ColorItem{ |
188 | + color: "teal" |
189 | + } |
190 | + |
191 | + ColorItem{ |
192 | + color: "midnightblue" |
193 | + } |
194 | + |
195 | + ColorItem{ |
196 | + color: UbuntuColors.lightAubergine |
197 | + } |
198 | + |
199 | + //Row6 |
200 | + |
201 | + ColorItem{ |
202 | + color: "black" |
203 | + } |
204 | + |
205 | + ColorItem{ |
206 | + color: "gray" |
207 | + } |
208 | + |
209 | + ColorItem{ |
210 | + color: "darkgray" |
211 | + } |
212 | + |
213 | + ColorItem{ |
214 | + color: "silver" |
215 | + } |
216 | + |
217 | + |
218 | + ColorItem{ |
219 | + color: "white" |
220 | + } |
221 | + |
222 | + |
223 | + |
224 | + } |
225 | + //End of grid |
226 | + |
227 | + |
228 | + } |
229 | + |
230 | + |
231 | + |
232 | + |
233 | + onCancelClicked: PopupUtils.close(sheet) |
234 | + onConfirmClicked: { |
235 | + canvas.currentColor = canvas.bufferColor |
236 | + PopupUtils.close(sheet) |
237 | + } |
238 | + } |
239 | +} |
240 | + |
241 | + |
242 | |
243 | === added file 'components/ColorItem.qml' |
244 | --- components/ColorItem.qml 1970-01-01 00:00:00 +0000 |
245 | +++ components/ColorItem.qml 2013-09-15 23:59:30 +0000 |
246 | @@ -0,0 +1,16 @@ |
247 | +import QtQuick 2.0 |
248 | +import Ubuntu.Components 0.1 |
249 | + |
250 | +UbuntuShape { |
251 | + width: units.gu(4) |
252 | + height: units.gu(3) |
253 | + color: "blue" |
254 | + |
255 | + |
256 | + MouseArea { |
257 | + anchors.fill: parent |
258 | + onClicked: { |
259 | + canvas.bufferColor = color |
260 | + } |
261 | + } |
262 | +} |
263 | |
264 | === added file 'components/DrawingSheet.qml' |
265 | --- components/DrawingSheet.qml 1970-01-01 00:00:00 +0000 |
266 | +++ components/DrawingSheet.qml 2013-09-15 23:59:30 +0000 |
267 | @@ -0,0 +1,122 @@ |
268 | +import QtQuick 2.0 |
269 | +import Ubuntu.Components 0.1 |
270 | + |
271 | + |
272 | +Canvas{ |
273 | + |
274 | + id: canvas |
275 | + width: units.gu(30) |
276 | + height: units.gu(60) |
277 | + smooth: true |
278 | + antialiasing: true |
279 | + renderStrategy: Canvas.Threaded //Needed to save() |
280 | + |
281 | + // property string lastImage: "../temp/last.png" |
282 | + // property bool loaded: false |
283 | + |
284 | + property int strokeWidth: units.dp(2) |
285 | + property color currentColor: "silver" |
286 | + property color bufferColor: canvas.currentColor |
287 | + property real currentOpacity: 1.0 |
288 | + property real currentStroke: 1 |
289 | + property color backgroundColor: "white" |
290 | + |
291 | + |
292 | + // property variant dataBackup: [] |
293 | + // property int index: 0 |
294 | +/* |
295 | + function saveOnData(){ |
296 | + var maxLen = 25 |
297 | + var data = canvas.toDataURL() |
298 | + |
299 | + var myArray = new Array |
300 | + if (dataBackup){ |
301 | + myArray = dataBackup |
302 | + } |
303 | + |
304 | + if (myArray.length>maxLen-1){ |
305 | + myArray.shift() |
306 | + } |
307 | + |
308 | + if (data) { |
309 | + myArray.push(data) |
310 | + index = myArray.length - 1 |
311 | + console.log("Data stored, index=" + index) |
312 | + console.log(myArray[index]) |
313 | + |
314 | + } |
315 | + |
316 | + |
317 | + dataBackup = myArray |
318 | + |
319 | + |
320 | + } |
321 | + |
322 | + |
323 | + |
324 | + |
325 | +*/ |
326 | + |
327 | + |
328 | + |
329 | + |
330 | + //property rect canvasArea: "0, 0, 25x25" |
331 | + |
332 | + onPaint: { |
333 | + var ctx = canvas.getContext('2d') |
334 | + |
335 | + |
336 | + |
337 | + |
338 | + ctx.rect(0, 0, width, height) |
339 | + ctx.fillStyle = backgroundColor |
340 | + ctx.fill() |
341 | + console.log("Painted background") |
342 | + |
343 | + |
344 | + toolBox.initialization.call() |
345 | + |
346 | + |
347 | + |
348 | + } |
349 | + MouseArea{ |
350 | + id: position |
351 | + anchors.fill: parent |
352 | + property alias px: position.mouseX |
353 | + property alias py: position.mouseY |
354 | + property bool isPressed: false |
355 | + |
356 | + onPressed: { |
357 | + isPressed = true |
358 | + console.log("position pressing and holding") |
359 | + } |
360 | + |
361 | + onReleased: { |
362 | + isPressed = false |
363 | + canvas.bufferX = -1 |
364 | + canvas.bufferY = -1 |
365 | + console.log("position released and buffer resetted") |
366 | + canvas.save("../temp/last.png") |
367 | + // canvas.saveOnData() |
368 | + |
369 | + |
370 | + |
371 | + } |
372 | + // Changing positions invokes canvas to paint |
373 | + onPositionChanged: { |
374 | + //(isPressed){ |
375 | + canvas.requestPaint() |
376 | + console.log("Position at (" + px + "," + py + ")") |
377 | + // } |
378 | + |
379 | + } |
380 | + |
381 | + } |
382 | + |
383 | + property alias px: position.mouseX |
384 | + property alias py: position.mouseY |
385 | + property int bufferX: -1 |
386 | + property int bufferY: -1 |
387 | + property alias isPressed: position.isPressed |
388 | + |
389 | +} |
390 | |
391 | === added file 'components/DrawingTool.qml' |
392 | --- components/DrawingTool.qml 1970-01-01 00:00:00 +0000 |
393 | +++ components/DrawingTool.qml 2013-09-15 23:59:30 +0000 |
394 | @@ -0,0 +1,36 @@ |
395 | +import QtQuick 2.0 |
396 | +import Ubuntu.Components 0.1 |
397 | + |
398 | +UbuntuShape{ |
399 | + id:tool |
400 | + width: units.gu(7) |
401 | + height: units.gu(7) |
402 | + |
403 | + anchors.horizontalCenter: parent.horizontalCenter |
404 | + |
405 | + Image{ |
406 | + id: halo |
407 | + anchors.fill: parent |
408 | + source: "../graphics/halo.png" |
409 | + visible: false |
410 | + } |
411 | + |
412 | + property alias halo: halo.visible |
413 | + |
414 | + color: "gray" |
415 | + property string name: "" |
416 | + MouseArea{ |
417 | + anchors.fill: parent |
418 | + onClicked:{ |
419 | + console.log("DrawingTool '" + name + "' Clicked") |
420 | + toolBox.selection.call() |
421 | + tool.state = "on" |
422 | + |
423 | + } |
424 | + } |
425 | + |
426 | + onStateChanged: { |
427 | + if (state=="on") |
428 | + console.log("DrawingTool '" + name + "' enabled") |
429 | + } |
430 | +} |
431 | |
432 | === added file 'components/FineTuneChooser.qml' |
433 | --- components/FineTuneChooser.qml 1970-01-01 00:00:00 +0000 |
434 | +++ components/FineTuneChooser.qml 2013-09-15 23:59:30 +0000 |
435 | @@ -0,0 +1,117 @@ |
436 | +import QtQuick 2.0 |
437 | +import Ubuntu.Components 0.1 |
438 | +import Ubuntu.Components.Popups 0.1 |
439 | +import Ubuntu.Components.ListItems 0.1 as ListItem |
440 | + |
441 | +Component { |
442 | + id: popoverComponent |
443 | + |
444 | + Popover { |
445 | + id: popover |
446 | + |
447 | + |
448 | + Column { |
449 | + id: containerLayout |
450 | + anchors { |
451 | + left: parent.left |
452 | + top: parent.top |
453 | + right: parent.right |
454 | + } |
455 | + ListItem.Header { |
456 | + height: units.gu(8) |
457 | + text: "Fine tune" |
458 | + } |
459 | + ListItem.Standard { |
460 | + anchors.horizontalCenter: parent.horizontalCenter |
461 | + |
462 | + Row{ |
463 | + spacing: units.gu(1) |
464 | + anchors.horizontalCenter: parent.horizontalCenter |
465 | + anchors.verticalCenter: parent.verticalCenter |
466 | + Text { |
467 | + anchors.verticalCenter: parent.verticalCenter |
468 | + text: i18n.tr("Opacity") |
469 | + |
470 | + } |
471 | + Slider{ |
472 | + width: units.gu(15) |
473 | + height: units.gu(5) |
474 | + id: opacitySlider |
475 | + function formatValue(v) { return v.toFixed(2) } |
476 | + minimumValue: 0 |
477 | + maximumValue: 100 |
478 | + value: 100 |
479 | + live: true |
480 | + |
481 | + onValueChanged: { |
482 | + canvas.currentOpacity = formatValue(value)/100 |
483 | + } |
484 | + |
485 | + |
486 | + } |
487 | + TextField { |
488 | + height: units.gu(5) |
489 | + objectName: "textfield_standard" |
490 | + text: canvas.currentOpacity*100 |
491 | + width: units.gu(10) |
492 | + onTextChanged: { |
493 | + if (text!=""){ |
494 | + opacitySlider.value = text |
495 | + } |
496 | + } |
497 | + |
498 | + |
499 | + |
500 | + } |
501 | + } |
502 | + } |
503 | + |
504 | + ListItem.Standard { |
505 | + anchors.horizontalCenter: parent.horizontalCenter |
506 | + |
507 | + Row{ |
508 | + spacing: units.gu(1) |
509 | + anchors.horizontalCenter: parent.horizontalCenter |
510 | + anchors.verticalCenter: parent.verticalCenter |
511 | + Text { |
512 | + anchors.verticalCenter: parent.verticalCenter |
513 | + text: i18n.tr("Stroke") |
514 | + |
515 | + } |
516 | + Slider{ |
517 | + width: units.gu(15) |
518 | + height: units.gu(5) |
519 | + id: strokeSlider |
520 | + function formatValue(v) { return v.toFixed(2) } |
521 | + minimumValue: 0 |
522 | + maximumValue: 100 |
523 | + value: 100 |
524 | + live: true |
525 | + |
526 | + onValueChanged: { |
527 | + canvas.currentStroke = formatValue(value) |
528 | + } |
529 | + |
530 | + |
531 | + } |
532 | + TextField { |
533 | + height: units.gu(5) |
534 | + objectName: "textfield_standard" |
535 | + text: canvas.currentStroke |
536 | + width: units.gu(10) |
537 | + onTextChanged: { |
538 | + if (text!=""){ |
539 | + strokeSlider.value = text |
540 | + } |
541 | + } |
542 | + |
543 | + |
544 | + |
545 | + } |
546 | + } |
547 | + } |
548 | + |
549 | + |
550 | + } |
551 | + } |
552 | + } |
553 | |
554 | === added file 'components/HelloComponent.qml' |
555 | --- components/HelloComponent.qml 1970-01-01 00:00:00 +0000 |
556 | +++ components/HelloComponent.qml 2013-09-15 23:59:30 +0000 |
557 | @@ -0,0 +1,14 @@ |
558 | +import QtQuick 2.0 |
559 | +import Ubuntu.Components 0.1 |
560 | + |
561 | +UbuntuShape { |
562 | + width: 200 |
563 | + height: width |
564 | + |
565 | + property alias text : myText.text |
566 | + |
567 | + Label { |
568 | + id: myText |
569 | + anchors.centerIn: parent |
570 | + } |
571 | +} |
572 | |
573 | === added file 'components/UbuntuIconButton.qml' |
574 | --- components/UbuntuIconButton.qml 1970-01-01 00:00:00 +0000 |
575 | +++ components/UbuntuIconButton.qml 2013-09-15 23:59:30 +0000 |
576 | @@ -0,0 +1,12 @@ |
577 | +import QtQuick 2.0 |
578 | +import Ubuntu.Components 0.1 |
579 | + |
580 | +Button{ |
581 | + id:shapeButton |
582 | + width: units.gu(7) |
583 | + height: units.gu(7) |
584 | + anchors.horizontalCenter: parent.horizontalCenter |
585 | + color: "gray" |
586 | + |
587 | + |
588 | +} |
589 | |
590 | === added directory 'graphics' |
591 | === renamed directory 'graphics' => 'graphics.moved' |
592 | === added file 'graphics/brush@30.png' |
593 | Binary files graphics/brush@30.png 1970-01-01 00:00:00 +0000 and graphics/brush@30.png 2013-09-15 23:59:30 +0000 differ |
594 | === added file 'graphics/finetune@10.png' |
595 | Binary files graphics/finetune@10.png 1970-01-01 00:00:00 +0000 and graphics/finetune@10.png 2013-09-15 23:59:30 +0000 differ |
596 | === added file 'graphics/finger@30.png' |
597 | Binary files graphics/finger@30.png 1970-01-01 00:00:00 +0000 and graphics/finger@30.png 2013-09-15 23:59:30 +0000 differ |
598 | === added file 'graphics/halo@30.png' |
599 | Binary files graphics/halo@30.png 1970-01-01 00:00:00 +0000 and graphics/halo@30.png 2013-09-15 23:59:30 +0000 differ |
600 | === added file 'graphics/palette@30.png' |
601 | Binary files graphics/palette@30.png 1970-01-01 00:00:00 +0000 and graphics/palette@30.png 2013-09-15 23:59:30 +0000 differ |
602 | === added file 'graphics/pencil@30.png' |
603 | Binary files graphics/pencil@30.png 1970-01-01 00:00:00 +0000 and graphics/pencil@30.png 2013-09-15 23:59:30 +0000 differ |
604 | === added file 'graphics/rubber@30.png' |
605 | Binary files graphics/rubber@30.png 1970-01-01 00:00:00 +0000 and graphics/rubber@30.png 2013-09-15 23:59:30 +0000 differ |
606 | === added file 'graphics/toolbarIcon@8.png' |
607 | Binary files graphics/toolbarIcon@8.png 1970-01-01 00:00:00 +0000 and graphics/toolbarIcon@8.png 2013-09-15 23:59:30 +0000 differ |
608 | === added file 'graphics/toolbarImageAddImageIcon@8.png' |
609 | Binary files graphics/toolbarImageAddImageIcon@8.png 1970-01-01 00:00:00 +0000 and graphics/toolbarImageAddImageIcon@8.png 2013-09-15 23:59:30 +0000 differ |
610 | === added file 'graphics/toolbarImageDeleteIcon@8.png' |
611 | Binary files graphics/toolbarImageDeleteIcon@8.png 1970-01-01 00:00:00 +0000 and graphics/toolbarImageDeleteIcon@8.png 2013-09-15 23:59:30 +0000 differ |
612 | === added file 'graphics/toolbarImageIcon@8.png' |
613 | Binary files graphics/toolbarImageIcon@8.png 1970-01-01 00:00:00 +0000 and graphics/toolbarImageIcon@8.png 2013-09-15 23:59:30 +0000 differ |
614 | === added file 'graphics/toolbarImageSaveIcon@8.png' |
615 | Binary files graphics/toolbarImageSaveIcon@8.png 1970-01-01 00:00:00 +0000 and graphics/toolbarImageSaveIcon@8.png 2013-09-15 23:59:30 +0000 differ |
616 | === added file 'graphics/toolbarSaveIcon@8.png' |
617 | Binary files graphics/toolbarSaveIcon@8.png 1970-01-01 00:00:00 +0000 and graphics/toolbarSaveIcon@8.png 2013-09-15 23:59:30 +0000 differ |
618 | === added directory 'js' |
619 | === added file 'js/Behaviours.js' |
620 | --- js/Behaviours.js 1970-01-01 00:00:00 +0000 |
621 | +++ js/Behaviours.js 2013-09-15 23:59:30 +0000 |
622 | @@ -0,0 +1,131 @@ |
623 | +function pencilBehaviour() { |
624 | + if (canvas.isPressed){ |
625 | + var ctx = canvas.getContext('2d') |
626 | + if ((canvas.bufferX != -1) || (canvas.bufferY != -1)){ |
627 | + |
628 | + ctx.globalCompositeOperation = "source-atop" |
629 | + ctx.beginPath() |
630 | + ctx.moveTo(canvas.bufferX, canvas.bufferY) |
631 | + ctx.lineTo(canvas.px, canvas.py) |
632 | + ctx.closePath() |
633 | + //Invastigate to understand why globalAlpha gains opacity [SOLVED]: caused by missing beginPath() |
634 | + ctx.globalAlpha = canvas.currentOpacity |
635 | + ctx.lineCap = "round" |
636 | + ctx.lineJoin = "round" |
637 | + ctx.strokeStyle = canvas.currentColor |
638 | + ctx.lineWidth = canvas.currentStroke |
639 | + ctx.stroke() |
640 | + console.log("pencil invoking canvas") |
641 | + |
642 | + //Buffers are needed to draw a line from buffer to current position |
643 | + canvas.bufferX = canvas.px |
644 | + canvas.bufferY = canvas.py |
645 | + |
646 | + |
647 | + } |
648 | + else{ |
649 | + //Buffers are needed to draw a line from buffer to current position |
650 | + canvas.bufferX = canvas.px |
651 | + canvas.bufferY = canvas.py |
652 | + } |
653 | + } |
654 | +} |
655 | + |
656 | + |
657 | +function brushBehaviour() { |
658 | + if (canvas.isPressed){ |
659 | + var ctx = canvas.getContext('2d') |
660 | + var gradient = ctx.createRadialGradient(canvas.px, canvas.py, canvas.currentStroke/3, canvas.px, canvas.py, canvas.currentStroke) |
661 | + gradient.addColorStop(0, canvas.currentColor) |
662 | + gradient.addColorStop(0.6, "transparent") |
663 | + |
664 | + |
665 | + ctx.globalCompositeOperation = "source-atop" |
666 | + |
667 | + ctx.beginPath() |
668 | + ctx.arc(canvas.px, canvas.py, canvas.currentStroke, 0, 2 * Math.PI, false) |
669 | + ctx.closePath() |
670 | + //Invastigate to understand why globalAlpha gains opacity [SOLVED]: caused by missing beginPath() |
671 | + ctx.globalAlpha = canvas.currentOpacity |
672 | + ctx.fillStyle = gradient |
673 | + ctx.fill() |
674 | + |
675 | + console.log("brush invoking canvas") |
676 | + |
677 | + //Buffers are needed to draw a line from buffer to current position |
678 | + |
679 | + |
680 | + } |
681 | +} |
682 | + |
683 | +function fingerBehaviour() { |
684 | + if (canvas.isPressed){ |
685 | + var ctx = canvas.getContext('2d') |
686 | + var gradient = ctx.createRadialGradient(canvas.px, canvas.py, canvas.currentStroke*2/3, canvas.px, canvas.py, canvas.currentStroke) |
687 | + gradient.addColorStop(0.5, canvas.currentColor) |
688 | + gradient.addColorStop(1, "transparent") |
689 | + |
690 | + |
691 | + |
692 | + ctx.globalCompositeOperation = "source-atop" |
693 | + |
694 | + ctx.beginPath() |
695 | + ctx.arc(canvas.px, canvas.py, canvas.currentStroke, 0, 2 * Math.PI, false) |
696 | + ctx.closePath() |
697 | + |
698 | + ctx.globalAlpha = canvas.currentOpacity |
699 | + ctx.fillStyle = gradient |
700 | + ctx.fill() |
701 | + ctx.closePath() |
702 | + |
703 | + console.log("finger invoking canvas") |
704 | + |
705 | + //Subtractive center gradient |
706 | + if ((canvas.bufferX != -1) || (canvas.bufferY != -1)){ |
707 | + ctx.beginPath() |
708 | + ctx.moveTo(canvas.bufferX, canvas.bufferY) |
709 | + ctx.lineTo(canvas.px, canvas.py) |
710 | + ctx.closePath() |
711 | + |
712 | + ctx.globalAlpha = canvas.currentOpacity |
713 | + ctx.lineCap = "round" |
714 | + ctx.lineJoin = "round" |
715 | + ctx.strokeStyle = canvas.backgroundColor |
716 | + ctx.lineWidth = canvas.currentStroke*2*0.8 |
717 | + ctx.stroke() |
718 | + |
719 | + } |
720 | + |
721 | + canvas.bufferX = canvas.px |
722 | + canvas.bufferY = canvas.py |
723 | + |
724 | + |
725 | + } |
726 | +} |
727 | + |
728 | + |
729 | +function rubberBehaviour() { |
730 | + if (canvas.isPressed){ |
731 | + var ctx = canvas.getContext('2d') |
732 | + var gradient = ctx.createRadialGradient(canvas.px, canvas.py, canvas.currentStroke/3, canvas.px, canvas.py, canvas.currentStroke) |
733 | + gradient.addColorStop(0, canvas.backgroundColor) |
734 | + gradient.addColorStop(0.8, "transparent") |
735 | + |
736 | + |
737 | + ctx.globalCompositeOperation = "source-atop" |
738 | + |
739 | + ctx.beginPath() |
740 | + ctx.arc(canvas.px, canvas.py, canvas.currentStroke, 0, 2 * Math.PI, false) |
741 | + ctx.closePath() |
742 | + |
743 | + ctx.globalAlpha = canvas.currentOpacity |
744 | + ctx.fillStyle = gradient |
745 | + ctx.fill() |
746 | + |
747 | + console.log("brush invoking canvas") |
748 | + |
749 | + //Buffers are needed to draw a line from buffer to current position |
750 | + |
751 | + |
752 | + } |
753 | +} |
754 | |
755 | === added file 'manifest.json' |
756 | --- manifest.json 1970-01-01 00:00:00 +0000 |
757 | +++ manifest.json 2013-09-15 23:59:30 +0000 |
758 | @@ -0,0 +1,14 @@ |
759 | +{ |
760 | + "description": "description of U-Draw", |
761 | + "framework": "ubuntu-sdk-13.10", |
762 | + "hooks": { |
763 | + "U-Draw": { |
764 | + "apparmor": "uDraw.json", |
765 | + "desktop": "uDraw.desktop" |
766 | + } |
767 | + }, |
768 | + "maintainer": "fcole90 <fcole90@gmail.com>", |
769 | + "name": "com.ubuntu.developer.fcole90.uDraw", |
770 | + "title": "uDraw", |
771 | + "version": "1.0" |
772 | +} |
773 | |
774 | === renamed file 'manifest.json' => 'manifest.json.moved' |
775 | === added directory 'pictures' |
776 | === added directory 'temp' |
777 | === added file 'temp/last.png' |
778 | Binary files temp/last.png 1970-01-01 00:00:00 +0000 and temp/last.png 2013-09-15 23:59:30 +0000 differ |
779 | === added directory 'tests' |
780 | === renamed directory 'tests' => 'tests.moved' |
781 | === added directory 'tests/autopilot' |
782 | === added directory 'tests/autopilot/U-Draw' |
783 | === added file 'tests/autopilot/U-Draw/__init__.py' |
784 | --- tests/autopilot/U-Draw/__init__.py 1970-01-01 00:00:00 +0000 |
785 | +++ tests/autopilot/U-Draw/__init__.py 2013-09-15 23:59:30 +0000 |
786 | @@ -0,0 +1,131 @@ |
787 | +# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- |
788 | + |
789 | +"""Ubuntu Touch App autopilot tests.""" |
790 | + |
791 | +from os import remove |
792 | +import os.path |
793 | +from tempfile import mktemp |
794 | +import subprocess |
795 | + |
796 | +from autopilot.input import Mouse, Touch, Pointer |
797 | +from autopilot.matchers import Eventually |
798 | +from autopilot.platform import model |
799 | +from testtools.matchers import Is, Not, Equals |
800 | +from autopilot.testcase import AutopilotTestCase |
801 | + |
802 | +def get_module_include_path(): |
803 | + return os.path.abspath( |
804 | + os.path.join( |
805 | + os.path.dirname(__file__), |
806 | + '..', |
807 | + '..', |
808 | + '..', |
809 | + '..', |
810 | + 'modules') |
811 | + ) |
812 | + |
813 | + |
814 | +class UbuntuTouchAppTestCase(AutopilotTestCase): |
815 | + """A common test case class that provides several useful methods for the tests.""" |
816 | + |
817 | + if model() == 'Desktop': |
818 | + scenarios = [ |
819 | + ('with mouse', dict(input_device_class=Mouse)) |
820 | + ] |
821 | + else: |
822 | + scenarios = [ |
823 | + ('with touch', dict(input_device_class=Touch)) |
824 | + ] |
825 | + |
826 | + @property |
827 | + def main_window(self): |
828 | + return MainWindow(self.app) |
829 | + |
830 | + |
831 | + def setUp(self): |
832 | + self.pointing_device = Pointer(self.input_device_class.create()) |
833 | + super(UbuntuTouchAppTestCase, self).setUp() |
834 | + self.launch_test_qml() |
835 | + |
836 | + |
837 | + def launch_test_qml(self): |
838 | + # If the test class has defined a 'test_qml' class attribute then we |
839 | + # write it to disk and launch it inside the QML Scene. If not, then we |
840 | + # silently do nothing (presumably the test has something else planned). |
841 | + arch = subprocess.check_output(["dpkg-architecture", |
842 | + "-qDEB_HOST_MULTIARCH"]).strip() |
843 | + if hasattr(self, 'test_qml') and isinstance(self.test_qml, basestring): |
844 | + qml_path = mktemp(suffix='.qml') |
845 | + open(qml_path, 'w').write(self.test_qml) |
846 | + self.addCleanup(remove, qml_path) |
847 | + |
848 | + self.app = self.launch_test_application( |
849 | + "/usr/lib/" + arch + "/qt5/bin/qmlscene", |
850 | + "-I", get_module_include_path(), |
851 | + qml_path, |
852 | + app_type='qt') |
853 | + |
854 | + if hasattr(self, 'test_qml_file') and isinstance(self.test_qml_file, basestring): |
855 | + qml_path = self.test_qml_file |
856 | + self.app = self.launch_test_application( |
857 | + "/usr/lib/" + arch + "/qt5/bin/qmlscene", |
858 | + "-I", get_module_include_path(), |
859 | + qml_path, |
860 | + app_type='qt') |
861 | + |
862 | + self.assertThat(self.get_qml_view().visible, Eventually(Equals(True))) |
863 | + |
864 | + |
865 | + def get_qml_view(self): |
866 | + """Get the main QML view""" |
867 | + |
868 | + return self.app.select_single("QQuickView") |
869 | + |
870 | + def get_mainview(self): |
871 | + """Get the QML MainView""" |
872 | + |
873 | + mainView = self.app.select_single("MainView") |
874 | + self.assertThat(mainView, Not(Is(None))) |
875 | + return mainView |
876 | + |
877 | + |
878 | + def get_object(self,objectName): |
879 | + """Get a object based on the objectName""" |
880 | + |
881 | + obj = self.app.select_single(objectName=objectName) |
882 | + self.assertThat(obj, Not(Is(None))) |
883 | + return obj |
884 | + |
885 | + |
886 | + def mouse_click(self,objectName): |
887 | + """Move mouse on top of the object and click on it""" |
888 | + |
889 | + obj = self.get_object(objectName) |
890 | + self.pointing_device.move_to_object(obj) |
891 | + self.pointing_device.click() |
892 | + |
893 | + |
894 | + def mouse_press(self,objectName): |
895 | + """Move mouse on top of the object and press mouse button (without releasing it)""" |
896 | + |
897 | + obj = self.get_object(objectName) |
898 | + self.pointing_device.move_to_object(obj) |
899 | + self.pointing_device.press() |
900 | + |
901 | + |
902 | + def mouse_release(self): |
903 | + """Release mouse button""" |
904 | + |
905 | + self.pointing_device.release() |
906 | + |
907 | + |
908 | + def type_string(self, string): |
909 | + """Type a string with keyboard""" |
910 | + |
911 | + self.keyboard.type(string) |
912 | + |
913 | + |
914 | + def type_key(self, key): |
915 | + """Type a single key with keyboard""" |
916 | + |
917 | + self.keyboard.key(key) |
918 | |
919 | === added directory 'tests/autopilot/U-Draw/main' |
920 | === added file 'tests/autopilot/U-Draw/main/__init__.py' |
921 | --- tests/autopilot/U-Draw/main/__init__.py 1970-01-01 00:00:00 +0000 |
922 | +++ tests/autopilot/U-Draw/main/__init__.py 2013-09-15 23:59:30 +0000 |
923 | @@ -0,0 +1,1 @@ |
924 | +""" A main.qml test suite """ |
925 | |
926 | === added file 'tests/autopilot/U-Draw/main/test_main.py' |
927 | --- tests/autopilot/U-Draw/main/test_main.py 1970-01-01 00:00:00 +0000 |
928 | +++ tests/autopilot/U-Draw/main/test_main.py 2013-09-15 23:59:30 +0000 |
929 | @@ -0,0 +1,23 @@ |
930 | +# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- |
931 | + |
932 | +"""Tests for the Hello World""" |
933 | + |
934 | +from autopilot.matchers import Eventually |
935 | +from textwrap import dedent |
936 | +from testtools.matchers import Is, Not, Equals |
937 | +from testtools import skip |
938 | +import os |
939 | +from U-Draw import UbuntuTouchAppTestCase |
940 | + |
941 | + |
942 | +class MainTests(UbuntuTouchAppTestCase): |
943 | + """Generic tests for the Hello World""" |
944 | + |
945 | + test_qml_file = "%s/%s.qml" % (os.path.dirname(os.path.realpath(__file__)),"../../../../U-Draw") |
946 | + |
947 | + def test_0_can_select_mainView(self): |
948 | + """Must be able to select the mainview.""" |
949 | + |
950 | + mainView = self.get_mainview() |
951 | + self.assertThat(mainView.visible,Eventually(Equals(True))) |
952 | + |
953 | |
954 | === added file 'tests/autopilot/run' |
955 | --- tests/autopilot/run 1970-01-01 00:00:00 +0000 |
956 | +++ tests/autopilot/run 2013-09-15 23:59:30 +0000 |
957 | @@ -0,0 +1,11 @@ |
958 | +#!/bin/bash |
959 | + |
960 | +if [[ -z `which autopilot` ]]; then |
961 | + echo "Autopilot is not installed. Skip" |
962 | + exit |
963 | +fi |
964 | + |
965 | +SCRIPTPATH=`dirname $0` |
966 | +pushd ${SCRIPTPATH} |
967 | +autopilot run U-Draw |
968 | +popd |
969 | |
970 | === added directory 'tests/unit' |
971 | === added file 'tests/unit/tst_hellocomponent.qml' |
972 | --- tests/unit/tst_hellocomponent.qml 1970-01-01 00:00:00 +0000 |
973 | +++ tests/unit/tst_hellocomponent.qml 2013-09-15 23:59:30 +0000 |
974 | @@ -0,0 +1,49 @@ |
975 | +import QtQuick 2.0 |
976 | +import QtTest 1.0 |
977 | +import Ubuntu.Components 0.1 |
978 | +import "../../components" |
979 | + |
980 | +// See more details @ http://qt-project.org/doc/qt-5.0/qtquick/qml-testcase.html |
981 | + |
982 | +// Execute tests with: |
983 | +// qmltestrunner |
984 | + |
985 | +Item { |
986 | + // The objects |
987 | + HelloComponent { |
988 | + id: objectUnderTest |
989 | + } |
990 | + |
991 | + TestCase { |
992 | + name: "HelloComponent" |
993 | + |
994 | + function init() { |
995 | + console.debug(">> init"); |
996 | + compare("",objectUnderTest.text,"text was not empty on init"); |
997 | + console.debug("<< init"); |
998 | + } |
999 | + |
1000 | + function cleanup() { |
1001 | + console.debug(">> cleanup"); |
1002 | + console.debug("<< cleanup"); |
1003 | + } |
1004 | + |
1005 | + function initTestCase() { |
1006 | + console.debug(">> initTestCase"); |
1007 | + console.debug("<< initTestCase"); |
1008 | + } |
1009 | + |
1010 | + function cleanupTestCase() { |
1011 | + console.debug(">> cleanupTestCase"); |
1012 | + console.debug("<< cleanupTestCase"); |
1013 | + } |
1014 | + |
1015 | + function test_canReadAndWriteText() { |
1016 | + var expected = "Hello World"; |
1017 | + |
1018 | + objectUnderTest.text = expected; |
1019 | + |
1020 | + compare(expected,objectUnderTest.text,"expected did not equal result"); |
1021 | + } |
1022 | + } |
1023 | +} |
1024 | |
1025 | === added file 'uDraw.desktop' |
1026 | --- uDraw.desktop 1970-01-01 00:00:00 +0000 |
1027 | +++ uDraw.desktop 2013-09-15 23:59:30 +0000 |
1028 | @@ -0,0 +1,8 @@ |
1029 | +[Desktop Entry] |
1030 | +Name=U-Draw |
1031 | +Comment=My project description |
1032 | +Exec=/usr/bin/qmlscene $@ /usr/share/U-Draw/U-Draw.qml |
1033 | +Icon=qmlscene |
1034 | +Terminal=false |
1035 | +Type=Application |
1036 | +X-Ubuntu-Touch=true |
1037 | |
1038 | === added file 'uDraw.json' |
1039 | --- uDraw.json 1970-01-01 00:00:00 +0000 |
1040 | +++ uDraw.json 2013-09-15 23:59:30 +0000 |
1041 | @@ -0,0 +1,6 @@ |
1042 | +{ |
1043 | + "policy_groups": [ |
1044 | + "location" |
1045 | + ], |
1046 | + "policy_version": 1 |
1047 | +} |
1048 | |
1049 | === added file 'uDraw.qml' |
1050 | --- uDraw.qml 1970-01-01 00:00:00 +0000 |
1051 | +++ uDraw.qml 2013-09-15 23:59:30 +0000 |
1052 | @@ -0,0 +1,39 @@ |
1053 | +import QtQuick 2.0 |
1054 | +import Ubuntu.Components 0.1 |
1055 | +import "ui" |
1056 | + |
1057 | +/*! |
1058 | + \brief MainView with Tabs element. |
1059 | + First Tab has a single Label and |
1060 | + second Tab has a single ToolbarAction. |
1061 | +*/ |
1062 | + |
1063 | +MainView { |
1064 | + // objectName for functional testing purposes (autopilot-qt5) |
1065 | + objectName: "mainView" |
1066 | + |
1067 | + // Note! applicationName needs to match the .desktop filename |
1068 | + applicationName: "U-Draw" |
1069 | + |
1070 | + /* |
1071 | + This property enables the application to change orientation |
1072 | + when the device is rotated. The default is false. |
1073 | + */ |
1074 | + //automaticOrientation: true |
1075 | + |
1076 | + width: units.gu(100) |
1077 | + height: units.gu(75) |
1078 | + |
1079 | + Tabs { |
1080 | + id: tabs |
1081 | + |
1082 | + DrawTab { |
1083 | + objectName: "Draw" |
1084 | + } |
1085 | +/* |
1086 | + NoteTab{ |
1087 | + objectName: "Notes" |
1088 | + } |
1089 | +*/ |
1090 | + } |
1091 | +} |
1092 | |
1093 | === added file 'uDraw.qmlproject' |
1094 | --- uDraw.qmlproject 1970-01-01 00:00:00 +0000 |
1095 | +++ uDraw.qmlproject 2013-09-15 23:59:30 +0000 |
1096 | @@ -0,0 +1,46 @@ |
1097 | +/* File generated by Qt Creator (with Ubuntu Plugin), version 2.7.1 */ |
1098 | + |
1099 | +import QmlProject 1.1 |
1100 | + |
1101 | +Project { |
1102 | + mainFile: "uDraw.qml" |
1103 | + |
1104 | + /* Include .qml, .js, and image files from current directory and subdirectories */ |
1105 | + QmlFiles { |
1106 | + directory: "." |
1107 | + } |
1108 | + JavaScriptFiles { |
1109 | + directory: "." |
1110 | + } |
1111 | + ImageFiles { |
1112 | + directory: "." |
1113 | + } |
1114 | + Files { |
1115 | + filter: "*.desktop" |
1116 | + } |
1117 | + Files { |
1118 | + filter: "Makefile" |
1119 | + } |
1120 | + Files { |
1121 | + directory: "html" |
1122 | + filter: "*" |
1123 | + } |
1124 | + Files { |
1125 | + directory: "img/" |
1126 | + filter: "*" |
1127 | + } |
1128 | + Files { |
1129 | + directory: "css/" |
1130 | + filter: "*" |
1131 | + } |
1132 | + Files { |
1133 | + directory: "tests/" |
1134 | + filter: "*" |
1135 | + } |
1136 | + Files { |
1137 | + directory: "debian" |
1138 | + filter: "*" |
1139 | + } |
1140 | + /* List of plugin directories passed to QML runtime */ |
1141 | + importPaths: [ "." ,"/usr/bin","/usr/lib/x86_64-linux-gnu/qt5/qml" ] |
1142 | +} |
1143 | |
1144 | === added file 'uDraw.qmlproject.user' |
1145 | --- uDraw.qmlproject.user 1970-01-01 00:00:00 +0000 |
1146 | +++ uDraw.qmlproject.user 2013-09-15 23:59:30 +0000 |
1147 | @@ -0,0 +1,134 @@ |
1148 | +<?xml version="1.0" encoding="UTF-8"?> |
1149 | +<!DOCTYPE QtCreatorProject> |
1150 | +<!-- Written by QtCreator 2.7.1, 2013-09-16T01:11:30. --> |
1151 | +<qtcreator> |
1152 | + <data> |
1153 | + <variable>ProjectExplorer.Project.ActiveTarget</variable> |
1154 | + <value type="int">0</value> |
1155 | + </data> |
1156 | + <data> |
1157 | + <variable>ProjectExplorer.Project.EditorSettings</variable> |
1158 | + <valuemap type="QVariantMap"> |
1159 | + <value type="bool" key="EditorConfiguration.AutoIndent">true</value> |
1160 | + <value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value> |
1161 | + <value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value> |
1162 | + <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0"> |
1163 | + <value type="QByteArray" key="language">Cpp</value> |
1164 | + <valuemap type="QVariantMap" key="value"> |
1165 | + <value type="QString" key="CurrentPreferences">CppGlobal</value> |
1166 | + </valuemap> |
1167 | + </valuemap> |
1168 | + <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1"> |
1169 | + <value type="QByteArray" key="language">QmlJS</value> |
1170 | + <valuemap type="QVariantMap" key="value"> |
1171 | + <value type="QString" key="CurrentPreferences">QmlJSGlobal</value> |
1172 | + </valuemap> |
1173 | + </valuemap> |
1174 | + <value type="int" key="EditorConfiguration.CodeStyle.Count">2</value> |
1175 | + <value type="QByteArray" key="EditorConfiguration.Codec">UTF-8</value> |
1176 | + <value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value> |
1177 | + <value type="int" key="EditorConfiguration.IndentSize">4</value> |
1178 | + <value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value> |
1179 | + <value type="bool" key="EditorConfiguration.MouseNavigation">true</value> |
1180 | + <value type="int" key="EditorConfiguration.PaddingMode">1</value> |
1181 | + <value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value> |
1182 | + <value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value> |
1183 | + <value type="bool" key="EditorConfiguration.SpacesForTabs">true</value> |
1184 | + <value type="int" key="EditorConfiguration.TabKeyBehavior">0</value> |
1185 | + <value type="int" key="EditorConfiguration.TabSize">8</value> |
1186 | + <value type="bool" key="EditorConfiguration.UseGlobal">true</value> |
1187 | + <value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value> |
1188 | + <value type="bool" key="EditorConfiguration.addFinalNewLine">true</value> |
1189 | + <value type="bool" key="EditorConfiguration.cleanIndentation">true</value> |
1190 | + <value type="bool" key="EditorConfiguration.cleanWhitespace">true</value> |
1191 | + <value type="bool" key="EditorConfiguration.inEntireDocument">false</value> |
1192 | + </valuemap> |
1193 | + </data> |
1194 | + <data> |
1195 | + <variable>ProjectExplorer.Project.PluginSettings</variable> |
1196 | + <valuemap type="QVariantMap"/> |
1197 | + </data> |
1198 | + <data> |
1199 | + <variable>ProjectExplorer.Project.Target.0</variable> |
1200 | + <valuemap type="QVariantMap"> |
1201 | + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop</value> |
1202 | + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop</value> |
1203 | + <value type="QByteArray" key="ProjectExplorer.ProjectConfiguration.Id">{a67867ed-7c03-4e7a-955b-bfadb85b6463}</value> |
1204 | + <value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">-1</value> |
1205 | + <value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value> |
1206 | + <value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value> |
1207 | + <value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">0</value> |
1208 | + <valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0"> |
1209 | + <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> |
1210 | + <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value> |
1211 | + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value> |
1212 | + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
1213 | + <value type="QByteArray" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value> |
1214 | + </valuemap> |
1215 | + <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value> |
1216 | + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy locally</value> |
1217 | + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
1218 | + <value type="QByteArray" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value> |
1219 | + </valuemap> |
1220 | + <value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value> |
1221 | + <valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/> |
1222 | + <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0"> |
1223 | + <value type="bool" key="Analyzer.Project.UseGlobal">true</value> |
1224 | + <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/> |
1225 | + <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value> |
1226 | + <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value> |
1227 | + <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value> |
1228 | + <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value> |
1229 | + <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value> |
1230 | + <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value> |
1231 | + <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value> |
1232 | + <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value> |
1233 | + <value type="int" key="Analyzer.Valgrind.NumCallers">25</value> |
1234 | + <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/> |
1235 | + <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value> |
1236 | + <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value> |
1237 | + <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds"> |
1238 | + <value type="int">0</value> |
1239 | + <value type="int">1</value> |
1240 | + <value type="int">2</value> |
1241 | + <value type="int">3</value> |
1242 | + <value type="int">4</value> |
1243 | + <value type="int">5</value> |
1244 | + <value type="int">6</value> |
1245 | + <value type="int">7</value> |
1246 | + <value type="int">8</value> |
1247 | + <value type="int">9</value> |
1248 | + <value type="int">10</value> |
1249 | + <value type="int">11</value> |
1250 | + <value type="int">12</value> |
1251 | + <value type="int">13</value> |
1252 | + <value type="int">14</value> |
1253 | + </valuelist> |
1254 | + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName"></value> |
1255 | + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">QML Scene</value> |
1256 | + <value type="QByteArray" key="ProjectExplorer.ProjectConfiguration.Id">QmlProjectManager.QmlRunConfiguration.QmlScene</value> |
1257 | + <value type="QString" key="QmlProjectManager.QmlRunConfiguration.MainScript">CurrentFile</value> |
1258 | + <value type="QString" key="QmlProjectManager.QmlRunConfiguration.QDeclarativeViewerArguments"></value> |
1259 | + <valuelist type="QVariantList" key="QmlProjectManager.QmlRunConfiguration.UserEnvironmentChanges"/> |
1260 | + <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value> |
1261 | + <value type="bool" key="RunConfiguration.UseCppDebugger">false</value> |
1262 | + <value type="bool" key="RunConfiguration.UseMultiProcess">false</value> |
1263 | + <value type="bool" key="RunConfiguration.UseQmlDebugger">true</value> |
1264 | + <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">false</value> |
1265 | + </valuemap> |
1266 | + <value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value> |
1267 | + </valuemap> |
1268 | + </data> |
1269 | + <data> |
1270 | + <variable>ProjectExplorer.Project.TargetCount</variable> |
1271 | + <value type="int">1</value> |
1272 | + </data> |
1273 | + <data> |
1274 | + <variable>ProjectExplorer.Project.Updater.EnvironmentId</variable> |
1275 | + <value type="QString">{bd4b52d6-7419-4e8e-b3cb-b9f86e55364e}</value> |
1276 | + </data> |
1277 | + <data> |
1278 | + <variable>ProjectExplorer.Project.Updater.FileVersion</variable> |
1279 | + <value type="int">12</value> |
1280 | + </data> |
1281 | +</qtcreator> |
1282 | |
1283 | === added file 'uDraw.qmlproject~' |
1284 | --- uDraw.qmlproject~ 1970-01-01 00:00:00 +0000 |
1285 | +++ uDraw.qmlproject~ 2013-09-15 23:59:30 +0000 |
1286 | @@ -0,0 +1,46 @@ |
1287 | +/* File generated by Qt Creator (with Ubuntu Plugin), version 2.7.1 */ |
1288 | + |
1289 | +import QmlProject 1.1 |
1290 | + |
1291 | +Project { |
1292 | + mainFile: "U-Draw.qml" |
1293 | + |
1294 | + /* Include .qml, .js, and image files from current directory and subdirectories */ |
1295 | + QmlFiles { |
1296 | + directory: "." |
1297 | + } |
1298 | + JavaScriptFiles { |
1299 | + directory: "." |
1300 | + } |
1301 | + ImageFiles { |
1302 | + directory: "." |
1303 | + } |
1304 | + Files { |
1305 | + filter: "*.desktop" |
1306 | + } |
1307 | + Files { |
1308 | + filter: "Makefile" |
1309 | + } |
1310 | + Files { |
1311 | + directory: "html" |
1312 | + filter: "*" |
1313 | + } |
1314 | + Files { |
1315 | + directory: "img/" |
1316 | + filter: "*" |
1317 | + } |
1318 | + Files { |
1319 | + directory: "css/" |
1320 | + filter: "*" |
1321 | + } |
1322 | + Files { |
1323 | + directory: "tests/" |
1324 | + filter: "*" |
1325 | + } |
1326 | + Files { |
1327 | + directory: "debian" |
1328 | + filter: "*" |
1329 | + } |
1330 | + /* List of plugin directories passed to QML runtime */ |
1331 | + importPaths: [ "." ,"/usr/bin","/usr/lib/x86_64-linux-gnu/qt5/qml" ] |
1332 | +} |
1333 | |
1334 | === added file 'uDraw64.png' |
1335 | Binary files uDraw64.png 1970-01-01 00:00:00 +0000 and uDraw64.png 2013-09-15 23:59:30 +0000 differ |
1336 | === added directory 'ui' |
1337 | === renamed directory 'ui' => 'ui.moved' |
1338 | === added file 'ui/DrawTab.qml' |
1339 | --- ui/DrawTab.qml 1970-01-01 00:00:00 +0000 |
1340 | +++ ui/DrawTab.qml 2013-09-15 23:59:30 +0000 |
1341 | @@ -0,0 +1,391 @@ |
1342 | +import QtQuick 2.0 |
1343 | +import Ubuntu.Components 0.1 |
1344 | +import Ubuntu.Layouts 0.1 |
1345 | +import Ubuntu.Components.Popups 0.1 |
1346 | +import Ubuntu.Components.ListItems 0.1 as ListItem |
1347 | +import "../js/Behaviours.js" as Behaviours |
1348 | +import "../components" |
1349 | + |
1350 | +Tab { |
1351 | + title: i18n.tr("Draw") |
1352 | + |
1353 | + page: Page { |
1354 | + |
1355 | + |
1356 | + |
1357 | + Rectangle { |
1358 | + id: container |
1359 | + color: Theme.palette.normal.background |
1360 | + width: parent.width - (toolBox.width + anchors.leftMargin + rightMargin) |
1361 | + height: parent.height |
1362 | + anchors.left: parent.left |
1363 | + anchors.leftMargin: units.gu(1) |
1364 | + property real rightMargin: units.gu(1) |
1365 | + |
1366 | + DrawingSheet{ |
1367 | + id: canvas |
1368 | + anchors.centerIn: parent |
1369 | + |
1370 | + |
1371 | + } |
1372 | + |
1373 | + |
1374 | + } |
1375 | + |
1376 | + Rectangle { |
1377 | + id: toolBox |
1378 | + color: "darkgray" |
1379 | + width: units.gu(8) |
1380 | + height: parent.height |
1381 | + anchors.right: parent.right |
1382 | + signal initialization |
1383 | + signal selection |
1384 | + |
1385 | + onSelection: { |
1386 | + console.log("Deselecting tools..") |
1387 | + pencil.state = "off" |
1388 | + brush.state = "off" |
1389 | + finger.state = "off" |
1390 | + rubber.state = "off" |
1391 | + |
1392 | + } |
1393 | + |
1394 | + onInitialization: { |
1395 | + console.log("Initialization...") |
1396 | + pencil.state = "on" |
1397 | + } |
1398 | + |
1399 | + Column{ |
1400 | + id: column |
1401 | + anchors.centerIn: parent |
1402 | + spacing: units.gu(1) |
1403 | + |
1404 | + |
1405 | + DrawingTool{ |
1406 | + id: pencil |
1407 | + name: "pencil" |
1408 | + |
1409 | + image: Image { |
1410 | + source: "../graphics/pencil@30.png" |
1411 | + fillMode: Image.PreserveAspectCrop |
1412 | + } |
1413 | + |
1414 | + onStateChanged: { |
1415 | + if (state == "off"){ |
1416 | + canvas.currentStroke = 1 |
1417 | + } |
1418 | + } |
1419 | + |
1420 | + states: [ |
1421 | + State { |
1422 | + name: "on" |
1423 | + PropertyChanges { |
1424 | + target: canvas |
1425 | + |
1426 | + onPaint: { |
1427 | + Behaviours.pencilBehaviour() |
1428 | + } |
1429 | + } |
1430 | + PropertyChanges { |
1431 | + target: pencil |
1432 | + halo: true |
1433 | + |
1434 | + } |
1435 | + }, |
1436 | + State { |
1437 | + name: "off" |
1438 | + PropertyChanges { |
1439 | + target: pencil |
1440 | + halo: false |
1441 | + |
1442 | + } |
1443 | + |
1444 | + }, |
1445 | + State { |
1446 | + name: "delete" |
1447 | + PropertyChanges { |
1448 | + target: canvas |
1449 | + |
1450 | + onPaint: { |
1451 | + var ctx = canvas.getContext('2d') |
1452 | + |
1453 | + ctx.rect(0, 0, width, height) |
1454 | + ctx.fillStyle = backgroundColor |
1455 | + ctx.fill() |
1456 | + console.log("Painted background") |
1457 | + toolBox.initialization.call() |
1458 | + } |
1459 | + } |
1460 | + |
1461 | + } |
1462 | + ] |
1463 | + } |
1464 | + |
1465 | + DrawingTool{ |
1466 | + id: brush |
1467 | + name: "brush" |
1468 | + |
1469 | + |
1470 | + image: Image { |
1471 | + source: "../graphics/brush@30.png" |
1472 | + fillMode: Image.PreserveAspectCrop |
1473 | + } |
1474 | + |
1475 | + onStateChanged: { |
1476 | + if (state == "on"){ |
1477 | + canvas.currentStroke = 5 |
1478 | + } |
1479 | + } |
1480 | + |
1481 | + states: [ |
1482 | + State { |
1483 | + name: "on" |
1484 | + PropertyChanges { |
1485 | + target: canvas |
1486 | + onPaint: { |
1487 | + Behaviours.brushBehaviour() |
1488 | + } |
1489 | + } |
1490 | + PropertyChanges { |
1491 | + target: brush |
1492 | + halo: true |
1493 | + |
1494 | + } |
1495 | + }, |
1496 | + State { |
1497 | + name: "off" |
1498 | + PropertyChanges { |
1499 | + target: brush |
1500 | + halo: false |
1501 | + |
1502 | + } |
1503 | + |
1504 | + } |
1505 | + ] |
1506 | + |
1507 | + } |
1508 | + |
1509 | + DrawingTool{ |
1510 | + id: finger |
1511 | + name: "finger" |
1512 | + |
1513 | + |
1514 | + image: Image { |
1515 | + source: "../graphics/finger@30.png" |
1516 | + fillMode: Image.PreserveAspectCrop |
1517 | + } |
1518 | + |
1519 | + onStateChanged: { |
1520 | + if (state == "on"){ |
1521 | + canvas.currentStroke = 25 |
1522 | + } |
1523 | + } |
1524 | + |
1525 | + states: [ |
1526 | + State { |
1527 | + name: "on" |
1528 | + PropertyChanges { |
1529 | + target: canvas |
1530 | + onPaint: { |
1531 | + Behaviours.fingerBehaviour() |
1532 | + } |
1533 | + } |
1534 | + PropertyChanges { |
1535 | + target: finger |
1536 | + halo: true |
1537 | + |
1538 | + } |
1539 | + }, |
1540 | + State { |
1541 | + name: "off" |
1542 | + PropertyChanges { |
1543 | + target: finger |
1544 | + halo: false |
1545 | + |
1546 | + } |
1547 | + |
1548 | + } |
1549 | + ] |
1550 | + |
1551 | + } |
1552 | + |
1553 | + DrawingTool{ |
1554 | + id: rubber |
1555 | + name: "rubber" |
1556 | + |
1557 | + |
1558 | + image: Image { |
1559 | + source: Qt.resolvedUrl("../graphics/rubber@30.png") |
1560 | + fillMode: Image.PreserveAspectCrop |
1561 | + } |
1562 | + |
1563 | + onStateChanged: { |
1564 | + if (state == "on"){ |
1565 | + canvas.currentStroke = 22 |
1566 | + } |
1567 | + } |
1568 | + |
1569 | + states: [ |
1570 | + State { |
1571 | + name: "on" |
1572 | + PropertyChanges { |
1573 | + target: canvas |
1574 | + onPaint: { |
1575 | + Behaviours.rubberBehaviour() |
1576 | + } |
1577 | + } |
1578 | + PropertyChanges { |
1579 | + target: rubber |
1580 | + halo: true |
1581 | + |
1582 | + } |
1583 | + }, |
1584 | + State { |
1585 | + name: "off" |
1586 | + PropertyChanges { |
1587 | + target: rubber |
1588 | + halo: false |
1589 | + |
1590 | + } |
1591 | + |
1592 | + } |
1593 | + ] |
1594 | + |
1595 | + } |
1596 | + |
1597 | + ColorChooser{ |
1598 | + id: colors |
1599 | + } |
1600 | + |
1601 | + UbuntuShape{ |
1602 | + id: paletteTool |
1603 | + |
1604 | + width: units.gu(7) |
1605 | + height: units.gu(7) |
1606 | + anchors.horizontalCenter: parent.horizontalCenter |
1607 | + MouseArea{ |
1608 | + anchors.fill: parent |
1609 | + onClicked: PopupUtils.open(colors) |
1610 | + } |
1611 | + image: Image { |
1612 | + source: Qt.resolvedUrl("../graphics/palette.png") |
1613 | + fillMode: Image.PreserveAspectCrop |
1614 | + } |
1615 | + } |
1616 | + |
1617 | + FineTuneChooser{ |
1618 | + id: popoverComponent |
1619 | + } |
1620 | + |
1621 | + UbuntuIconButton { |
1622 | + id: popoverButton |
1623 | + UbuntuShape{ |
1624 | + anchors.fill: parent |
1625 | + image: Image { |
1626 | + source: Qt.resolvedUrl("../graphics/finetune.png") |
1627 | + fillMode: Image.PreserveAspectCrop |
1628 | + } |
1629 | + |
1630 | + |
1631 | + } |
1632 | + |
1633 | + onClicked: PopupUtils.open(popoverComponent, popoverButton) |
1634 | + } |
1635 | + |
1636 | + |
1637 | + /* |
1638 | + UbuntuIconButton{ |
1639 | + id: back |
1640 | + state: "off" |
1641 | + property bool fake: false |
1642 | + property variant rememberSelection: ["off","off","off","off"] |
1643 | + onClicked:{ |
1644 | + console.log("back clicked") |
1645 | + rememberSelection[0] = pencil.state |
1646 | + rememberSelection[1] = brush.state |
1647 | + rememberSelection[2] = finger.state |
1648 | + rememberSelection[3] = rubber.state |
1649 | + toolBox.selection.call() |
1650 | + var myArray = new Array |
1651 | + myArray = canvas.dataBackup |
1652 | + console.log(myArray[canvas.index]) |
1653 | + canvas.imageBackup = canvas.loadImage(myArray[canvas.index]) |
1654 | + back.state = "on" |
1655 | + |
1656 | + |
1657 | + } |
1658 | + |
1659 | + onStateChanged: { |
1660 | + if (back.state=="on"){ |
1661 | + canvas.requestPaint() |
1662 | + console.log("Reverting image..") |
1663 | + |
1664 | + } |
1665 | + else{ |
1666 | + pencil.state = rememberSelection[0] |
1667 | + brush.state = rememberSelection[1] |
1668 | + finger.state = rememberSelection[2] |
1669 | + rubber.state = rememberSelection[3] |
1670 | + |
1671 | + } |
1672 | + } |
1673 | + |
1674 | + UbuntuShape{ |
1675 | + anchors.fill: parent |
1676 | + image: Image { |
1677 | + source: "../graphics/brush@30.png" |
1678 | + fillMode: Image.PreserveAspectCrop |
1679 | + } |
1680 | + } |
1681 | + |
1682 | + |
1683 | + |
1684 | + states: [ |
1685 | + State { |
1686 | + name: "on" |
1687 | + PropertyChanges { |
1688 | + target: canvas |
1689 | + onPaint: { |
1690 | + var ctx = canvas.getContext('2d') |
1691 | + var myArray = new Array |
1692 | + myArray = canvas.dataBackup |
1693 | + ctx.drawImage(myArray[canvas.index], 0, 0) |
1694 | + console.log("Image reverted") |
1695 | + } |
1696 | + } |
1697 | + PropertyChanges { |
1698 | + target: back |
1699 | + fake: true |
1700 | + |
1701 | + } |
1702 | + |
1703 | + }, |
1704 | + State { |
1705 | + name: "off" |
1706 | + PropertyChanges { |
1707 | + target: back |
1708 | + fake: false |
1709 | + |
1710 | + } |
1711 | + |
1712 | + } |
1713 | + |
1714 | + |
1715 | + ] |
1716 | + |
1717 | + }*/ |
1718 | + |
1719 | + |
1720 | + } |
1721 | + |
1722 | + } |
1723 | + |
1724 | + //This must be the last element |
1725 | + tools: DrawTabTools { |
1726 | + objectName: "DrawTabTools" |
1727 | + } |
1728 | + |
1729 | + } |
1730 | + // End of Page |
1731 | +} |
1732 | +//End of Tab |
1733 | |
1734 | === added file 'ui/DrawTabTools.qml' |
1735 | --- ui/DrawTabTools.qml 1970-01-01 00:00:00 +0000 |
1736 | +++ ui/DrawTabTools.qml 2013-09-15 23:59:30 +0000 |
1737 | @@ -0,0 +1,142 @@ |
1738 | +import QtQuick 2.0 |
1739 | +import Ubuntu.Components 0.1 |
1740 | +import Ubuntu.Components.Popups 0.1 |
1741 | +import Qt.labs.folderlistmodel 1.0 |
1742 | + |
1743 | +ToolbarItems { |
1744 | + ToolbarButton { |
1745 | + iconSource: Qt.resolvedUrl("../graphics/toolbarSaveIcon.png") |
1746 | + text: i18n.tr("Save") |
1747 | + |
1748 | + onTriggered: { |
1749 | + if (1){ |
1750 | + PopupUtils.open(saveDialogComponent, null) |
1751 | + } |
1752 | + } |
1753 | + } |
1754 | + |
1755 | + ToolbarButton { |
1756 | + iconSource: Qt.resolvedUrl("../graphics/toolbarImageDeleteIcon.png") |
1757 | + text: i18n.tr("Delete") |
1758 | + |
1759 | + onTriggered: { |
1760 | + if (1){ |
1761 | + PopupUtils.open(clearDialogComponent, null) |
1762 | + } |
1763 | + } |
1764 | + } |
1765 | + |
1766 | + Component { |
1767 | + id: saveDialogComponent |
1768 | + Dialog { |
1769 | + id: saveDialog |
1770 | + title: "Save your draw!" |
1771 | + text: "How do you want to call your picture?" |
1772 | + |
1773 | + |
1774 | + Column{ |
1775 | + |
1776 | + |
1777 | + /*FolderListModel { |
1778 | + id: progModel |
1779 | + folder: "../pictures" |
1780 | + //nameFilters: ["*.png"] |
1781 | + } |
1782 | + */ |
1783 | + UbuntuShape{ |
1784 | + width: parent.width |
1785 | + height: units.gu(20) |
1786 | + color: "white" |
1787 | + |
1788 | + FolderListModel{ |
1789 | + id: fileModel |
1790 | + folder: "../pictures" |
1791 | + nameFilters: ["*.png","*.jpg","*.jpeg"] |
1792 | + |
1793 | + } |
1794 | + |
1795 | + Component { |
1796 | + id: fileDelegate |
1797 | + Text{ |
1798 | + text: fileName |
1799 | + MouseArea{ |
1800 | + anchors.fill: parent |
1801 | + onClicked: { |
1802 | + imageName.text = text |
1803 | + } |
1804 | + } |
1805 | + } |
1806 | + } |
1807 | + |
1808 | + ListView { |
1809 | + anchors.fill: parent |
1810 | + id: listFiles |
1811 | + model: fileModel |
1812 | + delegate: fileDelegate |
1813 | + } |
1814 | + } |
1815 | + |
1816 | + } |
1817 | + |
1818 | + |
1819 | + |
1820 | + TextField{ |
1821 | + id: imageName |
1822 | + text: "mycanvas.png" |
1823 | + |
1824 | + } |
1825 | + |
1826 | + Button { |
1827 | + text: "Cancel" |
1828 | + gradient: UbuntuColors.greyGradient |
1829 | + onClicked: PopupUtils.close(saveDialog) |
1830 | + } |
1831 | + Button { |
1832 | + text: "Save" |
1833 | + |
1834 | + onClicked: { |
1835 | + PopupUtils.close(saveDialog) |
1836 | + var extension = "" |
1837 | + if ((imageName.text.search(".png")==-1)||(imageName.text.search(".jpg")==-1)(imageName.text.search(".jpeg")==-1)) { |
1838 | + extension = ".png" |
1839 | + } |
1840 | + |
1841 | + if (canvas.save("../pictures/" + imageName.text + extension)){ |
1842 | + console.log("Canvas saved as " + imageName.text + extension) |
1843 | + } |
1844 | + } |
1845 | + |
1846 | + } |
1847 | + } |
1848 | + } |
1849 | + |
1850 | + Component { |
1851 | + id: clearDialogComponent |
1852 | + Dialog { |
1853 | + id: clearDialog |
1854 | + title: "Delete canvas" |
1855 | + text: "Are you sure that you want to delete your canvas?" |
1856 | + |
1857 | + Button { |
1858 | + text: "Cancel" |
1859 | + gradient: UbuntuColors.greyGradient |
1860 | + onClicked: PopupUtils.close(clearDialog) |
1861 | + } |
1862 | + Button { |
1863 | + text: "Clear" |
1864 | + onClicked: { |
1865 | + PopupUtils.close(clearDialog) |
1866 | + toolBox.selection.call() |
1867 | + pencil.state = "delete" |
1868 | + canvas.requestPaint() |
1869 | + |
1870 | + } |
1871 | + |
1872 | + } |
1873 | + } |
1874 | + |
1875 | + } |
1876 | + |
1877 | +} |
1878 | + |
1879 | + |
1880 | |
1881 | === added file 'ui/NoteTab.qml' |
1882 | --- ui/NoteTab.qml 1970-01-01 00:00:00 +0000 |
1883 | +++ ui/NoteTab.qml 2013-09-15 23:59:30 +0000 |
1884 | @@ -0,0 +1,6 @@ |
1885 | +import QtQuick 2.0 |
1886 | + |
1887 | +Rectangle { |
1888 | + width: 100 |
1889 | + height: 62 |
1890 | +} |
1891 | |
1892 | === added file 'ui/TestingTab.qml' |
1893 | --- ui/TestingTab.qml 1970-01-01 00:00:00 +0000 |
1894 | +++ ui/TestingTab.qml 2013-09-15 23:59:30 +0000 |
1895 | @@ -0,0 +1,38 @@ |
1896 | +import QtQuick 2.0 |
1897 | +import Ubuntu.Components 0.1 |
1898 | +import Qt.labs.folderlistmodel 1.0 |
1899 | + |
1900 | +Tab{ |
1901 | + title: "Test" |
1902 | + |
1903 | + page: Page{ |
1904 | + |
1905 | + Item{ |
1906 | + width:200 |
1907 | + height:250 |
1908 | + |
1909 | + FolderListModel{ |
1910 | + id: fileModel |
1911 | + folder: "../pictures" |
1912 | + nameFilters: ["*.png","*.jpg","*.jpeg"] |
1913 | + |
1914 | + } |
1915 | + |
1916 | + Component { |
1917 | + id: fileDelegate |
1918 | + Text{ |
1919 | + text: fileName |
1920 | + } |
1921 | + } |
1922 | + |
1923 | + ListView { |
1924 | + anchors.fill: parent |
1925 | + id: listFiles |
1926 | + model: fileModel |
1927 | + delegate: fileDelegate |
1928 | + } |
1929 | + } |
1930 | + |
1931 | + } |
1932 | + |
1933 | +} |