Merge lp:~nick-dedekind/ubuntu-settings-components/indicator-polishing into lp:~registry/ubuntu-settings-components/trunk

Proposed by Nick Dedekind
Status: Superseded
Proposed branch: lp:~nick-dedekind/ubuntu-settings-components/indicator-polishing
Merge into: lp:~registry/ubuntu-settings-components/trunk
Diff against target: 4201 lines (+2004/-1265)
47 files modified
CMakeLists.txt (+24/-0)
Ubuntu/Settings/Components/ActionTextField.qml (+34/-32)
Ubuntu/Settings/Components/CMakeLists.txt (+0/-2)
Ubuntu/Settings/Components/Calendar.qml (+1/-1)
Ubuntu/Settings/Components/IconVisual.qml (+1/-1)
Ubuntu/Settings/Components/MessageHeader.qml (+95/-133)
Ubuntu/Settings/Components/QuickReply.qml (+2/-2)
Ubuntu/Settings/Components/artwork/CMakeLists.txt (+0/-2)
Ubuntu/Settings/Components/qmldir (+1/-1)
Ubuntu/Settings/Menus/AccessPointMenu.qml (+12/-74)
Ubuntu/Settings/Menus/ButtonMenu.qml (+14/-12)
Ubuntu/Settings/Menus/CMakeLists.txt (+0/-2)
Ubuntu/Settings/Menus/EventMenu.qml (+0/-1)
Ubuntu/Settings/Menus/GroupedMessageMenu.qml (+26/-30)
Ubuntu/Settings/Menus/MediaPlayerMenu.qml (+16/-13)
Ubuntu/Settings/Menus/PlaybackItemMenu.qml (+51/-42)
Ubuntu/Settings/Menus/ProgressBarMenu.qml (+18/-10)
Ubuntu/Settings/Menus/ProgressValueMenu.qml (+8/-7)
Ubuntu/Settings/Menus/SimpleMessageMenu.qml (+48/-29)
Ubuntu/Settings/Menus/SimpleTextMessageMenu.qml (+0/-99)
Ubuntu/Settings/Menus/SnapDecisionMenu.qml (+64/-126)
Ubuntu/Settings/Menus/StandardMenu.qml (+14/-2)
Ubuntu/Settings/Menus/SwitchMenu.qml (+36/-36)
Ubuntu/Settings/Menus/TextMessageMenu.qml (+1/-2)
Ubuntu/Settings/Menus/TransferMenu.qml (+10/-7)
Ubuntu/Settings/Menus/UserSessionMenu.qml (+8/-1)
Ubuntu/Settings/Menus/artwork/CMakeLists.txt (+0/-2)
Ubuntu/Settings/Menus/artwork/default_app.svg (+0/-42)
Ubuntu/Settings/Menus/artwork/secure.svg (+0/-71)
Ubuntu/Settings/Menus/qmldir (+1/-3)
cmake/modules/QmlTest.cmake (+79/-7)
examples/CMakeLists.txt (+2/-0)
examples/MessageComponents.qml (+113/-0)
examples/OtherComponents.qml (+234/-0)
examples/SettingsComponents.qml (+28/-253)
examples/TransferComponents.qml (+81/-0)
tests/CMakeLists.txt (+1/-0)
tests/qmltests/CMakeLists.txt (+3/-2)
tests/qmltests/Menus/tst_AccessPointMenu.qml (+2/-20)
tests/qmltests/Menus/tst_SimpleMessageMenu.qml (+57/-51)
tests/qmltests/Menus/tst_SnapDecisionMenu.qml (+77/-91)
tests/qmltests/Menus/tst_TextMessageMenu.qml (+63/-56)
tests/uqmlscene/CMakeLists.txt (+22/-0)
tests/uqmlscene/MouseTouchAdaptor.cpp (+153/-0)
tests/uqmlscene/MouseTouchAdaptor.h (+49/-0)
tests/uqmlscene/README (+1/-0)
tests/uqmlscene/main.cpp (+554/-0)
To merge this branch: bzr merge lp:~nick-dedekind/ubuntu-settings-components/indicator-polishing
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Needs Fixing
Registry Administrators Pending
Review via email: mp+228701@code.launchpad.net

This proposal has been superseded by a proposal from 2014-07-31.

Commit message

Visual changes for indicator RTM polishing sprint

Description of the change

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
82. By Nick Dedekind

added missing files

83. By Nick Dedekind

made tryTEST_TARGET work

84. By Nick Dedekind

removed old files

85. By Nick Dedekind

removed old artwork

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
86. By Nick Dedekind

added uqmlscene

87. By Nick Dedekind

merged uqmlscene branch

88. By Nick Dedekind

version bumped

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
89. By Nick Dedekind

rebased

90. By Nick Dedekind

fixed runtests.sh for changes in folder structure

91. By Nick Dedekind

rebased

92. By Nick Dedekind

MP review changes

93. By Nick Dedekind

updated sdk to 1.1

94. By Nick Dedekind

updated for changes to listitem.empty

95. By Nick Dedekind

removed highlight on select. done by listitem

96. By Nick Dedekind

few tweaks

97. By Nick Dedekind

removed USC.IconVisual. fixed binding loops

98. By Nick Dedekind

Added UbuntuShapeForItem for colorizing framed theme icons

99. By Nick Dedekind

Added click slot

100. By Nick Dedekind

checkable made same as switch menu

101. By Nick Dedekind

merged with trunk

102. By Nick Dedekind

fixed color overlay alignment

103. By Nick Dedekind

use image instead of shape for player icon

104. By Nick Dedekind

fixed up media player menu

105. By Nick Dedekind

fixed layout bugs in media player item

106. By Nick Dedekind

MediaPlayerMenu.running -> showTrack

107. By Nick Dedekind

fixed tests for running change

108. By Nick Dedekind

added i18n

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'CMakeLists.txt'
2--- CMakeLists.txt 2014-06-26 13:01:19 +0000
3+++ CMakeLists.txt 2014-07-31 16:42:23 +0000
4@@ -69,8 +69,32 @@
5 endif()
6 endif()
7
8+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden")
9+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -fno-permissive -pedantic -Wall -Wextra")
10+
11+if ("${CMAKE_BUILD_TYPE}" STREQUAL "release" OR "${CMAKE_BUILD_TYPE}" STREQUAL "relwithdebinfo")
12+ option(Werror "Treat warnings as errors" ON)
13+else()
14+ option(Werror "Treat warnings as errors" OFF)
15+endif()
16+
17+if (Werror)
18+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror")
19+endif()
20+
21+file(GLOB_RECURSE QML_EXTRA_FILES
22+ ${CMAKE_SOURCE_DIR}/tests/*.qml
23+ ${CMAKE_SOURCE_DIR}/tests/*.js
24+ ${CMAKE_SOURCE_DIR}/tests/*.jpg
25+ ${CMAKE_SOURCE_DIR}/tests/*.png
26+ ${CMAKE_SOURCE_DIR}/tests/*.sci
27+ ${CMAKE_SOURCE_DIR}/tests/*.svg
28+)
29+add_custom_target(qml_fake_target SOURCES ${QML_EXTRA_FILES})
30+
31 # Tests
32 enable_testing()
33
34 add_subdirectory(Ubuntu)
35+add_subdirectory(examples)
36 add_subdirectory(tests)
37
38=== modified file 'Ubuntu/Settings/Components/ActionTextField.qml'
39--- Ubuntu/Settings/Components/ActionTextField.qml 2013-10-04 12:38:07 +0000
40+++ Ubuntu/Settings/Components/ActionTextField.qml 2014-07-31 16:42:23 +0000
41@@ -20,6 +20,7 @@
42
43 import QtQuick 2.0
44 import Ubuntu.Components 0.1
45+import QtQuick.Layouts 1.1
46
47 Item {
48 id: textField
49@@ -29,43 +30,44 @@
50
51 signal activated(var value)
52
53- TextField {
54- id: replyField
55- objectName: "replyText"
56+ implicitHeight: layout.implicitHeight
57
58+ RowLayout {
59+ id: layout
60 anchors {
61- top: parent.top
62- bottom: parent.bottom
63 left: parent.left
64- right: sendButton.left
65- rightMargin: units.gu(1)
66- }
67- placeholderText: "Reply"
68- hasClearButton: false
69-
70- onEnabledChanged: {
71- //Make sure that the component lost focus when enabled = false,
72- //otherwise it will get focus again when enable = true
73- if (!enabled) {
74- focus = false;
75- }
76- }
77- }
78-
79- Button {
80- id: sendButton
81- objectName: "sendButton"
82- anchors {
83- top: parent.top
84- bottom: parent.bottom
85 right: parent.right
86 }
87- width: units.gu(9)
88- enabled: replyField.text !== "" && textField.activateEnabled
89- color: enabled ? "#c94212" : "#bababa"
90-
91- onClicked: {
92- textField.activated(replyField.text);
93+ spacing: units.gu(1)
94+
95+ TextField {
96+ id: replyField
97+ objectName: "replyText"
98+
99+ placeholderText: "Reply"
100+ hasClearButton: false
101+
102+ Layout.fillWidth: true
103+
104+ onEnabledChanged: {
105+ //Make sure that the component lost focus when enabled = false,
106+ //otherwise it will get focus again when enable = true
107+ if (!enabled) {
108+ focus = false;
109+ }
110+ }
111+ }
112+
113+ Button {
114+ id: sendButton
115+ objectName: "sendButton"
116+ Layout.preferredWidth: units.gu(9)
117+ enabled: replyField.text !== "" && textField.activateEnabled
118+ color: enabled ? "#c94212" : "#bababa"
119+
120+ onClicked: {
121+ textField.activated(replyField.text);
122+ }
123 }
124 }
125 }
126
127=== modified file 'Ubuntu/Settings/Components/CMakeLists.txt'
128--- Ubuntu/Settings/Components/CMakeLists.txt 2014-06-27 09:35:26 +0000
129+++ Ubuntu/Settings/Components/CMakeLists.txt 2014-07-31 16:42:23 +0000
130@@ -1,3 +1,1 @@
131-add_subdirectory(artwork)
132-
133 add_usc_plugin(Ubuntu.Settings.Components 0.1 Ubuntu/Settings/Components)
134
135=== modified file 'Ubuntu/Settings/Components/Calendar.qml'
136--- Ubuntu/Settings/Components/Calendar.qml 2013-10-29 22:08:08 +0000
137+++ Ubuntu/Settings/Components/Calendar.qml 2014-07-31 16:42:23 +0000
138@@ -204,7 +204,7 @@
139
140 // Styling properties
141 property color color: Theme.palette.selected.backgroundText
142- property color todayColor: "#DD4814"
143+ property color todayColor: Theme.palette.selected.foreground
144 property string fontSize: "large"
145 property var backgroundColor: "transparent" // FIXME use color instead var when Qt will fix the bug with the binding (loses alpha)
146 property var sundayBackgroundColor: "#19AEA79F" // FIXME use color instead var when Qt will fix the bug with the binding (loses alpha)
147
148=== modified file 'Ubuntu/Settings/Components/IconVisual.qml'
149--- Ubuntu/Settings/Components/IconVisual.qml 2013-10-30 17:09:39 +0000
150+++ Ubuntu/Settings/Components/IconVisual.qml 2014-07-31 16:42:23 +0000
151@@ -54,7 +54,7 @@
152 property Image source: visible ? image : null
153 property color keyColorOut: Qt.rgba(0.0, 0.0, 0.0, 0.0)
154 property color keyColorIn: "#808080"
155- property real threshold: 0.6
156+ property real threshold: 0.1
157
158 fragmentShader: source ? "
159 varying highp vec2 qt_TexCoord0;
160
161=== renamed file 'Ubuntu/Settings/Components/HeroMessageHeader.qml' => 'Ubuntu/Settings/Components/MessageHeader.qml'
162--- Ubuntu/Settings/Components/HeroMessageHeader.qml 2013-10-04 10:10:47 +0000
163+++ Ubuntu/Settings/Components/MessageHeader.qml 2014-07-31 16:42:23 +0000
164@@ -18,147 +18,109 @@
165 * Olivier Tilloy <olivier.tilloy@canonical.com>
166 */
167
168-import QtQuick 2.0
169+import QtQuick 2.1
170 import Ubuntu.Components 0.1
171+import QtQuick.Layouts 1.1
172
173 Item {
174- id: heroMessageHeader
175+ id: messageHeader
176
177 property alias avatar: avatarImage.source
178 property alias icon: iconImage.source
179- property alias appIcon: appIconImage.source
180- property alias titleText: __titleText
181- property alias subtitleText: __subtitleText
182- property alias bodyText: __bodyText
183- property real bodyBottom: bodyText.y + bodyText.height
184-
185- signal appIconClicked()
186-
187- height: units.gu(9)
188-
189- UbuntuShape {
190- id: avatarImageContainer
191+ property alias title: titleText.text
192+ property alias time: timeText.text
193+ property alias body: bodyText.text
194+
195+ signal iconClicked()
196+
197+ implicitHeight: layout.height
198+
199+ function shakeIcon() {
200+ ani.restart();
201+ }
202+
203+ RowLayout {
204+ id: layout
205 anchors {
206- top: parent.top
207- topMargin: units.gu(2)
208 left: parent.left
209- leftMargin: units.gu(2)
210- }
211- height: units.gu(6)
212- width: units.gu(6)
213- image: Image {
214- id: avatarImage
215- objectName: "avatar"
216- fillMode: Image.PreserveAspectFit
217- }
218- }
219-
220- Image {
221- id: iconImage
222- objectName: "icon"
223- anchors {
224- top: parent.top
225- topMargin: units.gu(2)
226- left: avatarImageContainer.right
227- leftMargin: units.gu(1)
228- }
229- width: units.gu(2)
230- height: width
231- horizontalAlignment: Image.AlignHCenter
232- verticalAlignment: Image.AlignBottom
233- fillMode: Image.PreserveAspectFit
234- }
235-
236- Label {
237- id: __titleText
238- objectName: "title"
239- anchors {
240- baseline: iconImage.bottom
241- left: iconImage.right
242- leftMargin: units.gu(1)
243- right: __appIcon.left
244- rightMargin: units.gu(2)
245- }
246- elide: Text.ElideRight
247- font.weight: Font.DemiBold
248- fontSize: "medium"
249- }
250-
251- Label {
252- id: __subtitleText
253- objectName: "subtitle"
254- anchors {
255- baseline: __titleText.baseline
256- baselineOffset: units.gu(2.5)
257- left: __titleText.left
258- right: __titleText.right
259- }
260- elide: Text.ElideRight
261- fontSize: "small"
262- }
263-
264- Label {
265- id: __bodyText
266- objectName: "body"
267- anchors {
268- baseline: __subtitleText.baseline
269- baselineOffset: units.gu(2.5)
270- left: __titleText.left
271- right: parent.right
272- rightMargin: units.gu(2)
273- }
274- maximumLineCount: 2
275- wrapMode: Text.WordWrap
276- elide: Text.ElideRight
277- fontSize: "small"
278- }
279-
280- Item {
281- id: __appIcon
282- width: units.gu(7)
283- height: units.gu(7)
284- anchors {
285- top: parent.top
286- right: parent.right
287- }
288- opacity: 0.0
289- enabled: heroMessageHeader.state === "expanded"
290-
291- Image {
292- id: appIconImage
293- objectName: "appIcon"
294- height: width
295- anchors {
296- left: parent.left
297- leftMargin: units.gu(2)
298- right: parent.right
299- rightMargin: units.gu(2)
300- topMargin: units.gu(1)
301- verticalCenter: parent.verticalCenter
302- }
303- fillMode: Image.PreserveAspectFit
304- }
305-
306- MouseArea {
307- anchors.fill: parent
308- onClicked: heroMessageHeader.appIconClicked()
309- }
310- }
311-
312- states: State {
313- name: "expanded"
314-
315- PropertyChanges {
316- target: __appIcon
317- opacity: 1.0
318- }
319- }
320-
321- transitions: Transition {
322- NumberAnimation {
323- property: "opacity"
324- duration: 200
325- easing.type: Easing.OutQuad
326+ right: parent.right
327+ rightMargin: units.gu(4)
328+ }
329+ spacing: units.gu(2)
330+
331+ UbuntuShape {
332+ id: avatarImageContainer
333+ Layout.preferredHeight: units.gu(6)
334+ Layout.preferredWidth: units.gu(6)
335+ image: Image {
336+ id: avatarImage
337+ objectName: "avatar"
338+ fillMode: Image.PreserveAspectFit
339+ }
340+ }
341+
342+ ColumnLayout {
343+ Label {
344+ id: titleText
345+ objectName: "title"
346+
347+ maximumLineCount: 1
348+ elide: Text.ElideRight
349+ font.weight: Font.DemiBold
350+ fontSize: "medium"
351+
352+ Layout.fillWidth: true
353+ // calculate width with regard to the time's incursion into this layout's space.
354+ Layout.maximumWidth: parent.width - timeText.width + units.gu(3)
355+ }
356+ spacing: units.gu(0.5)
357+
358+ Label {
359+ id: bodyText
360+ objectName: "body"
361+
362+ maximumLineCount: 3
363+ wrapMode: Text.WordWrap
364+ elide: Text.ElideRight
365+ fontSize: "small"
366+
367+ Layout.fillWidth: true
368+ }
369+ }
370+ }
371+
372+ ColumnLayout {
373+ id: timeIcon
374+ anchors.right: parent.right
375+
376+ Label {
377+ id: timeText
378+ objectName: "time"
379+ elide: Text.ElideRight
380+ fontSize: "x-small"
381+ maximumLineCount: 1
382+ horizontalAlignment: Text.AlignRight
383+ }
384+ spacing: units.gu(0.5)
385+
386+ IconVisual {
387+ id: iconImage
388+ objectName: "icon"
389+ Layout.preferredHeight: units.gu(3)
390+ Layout.preferredWidth: units.gu(3)
391+ Layout.alignment: Qt.AlignRight
392+ color: Theme.palette.selected.backgroundText
393+
394+ MouseArea {
395+ anchors.fill: parent
396+ onClicked: messageHeader.iconClicked()
397+ }
398+
399+ SequentialAnimation {
400+ id: ani
401+ PropertyAnimation { target: iconImage; property: "rotation"; duration: 50; to: -20 }
402+ SpringAnimation { target: iconImage; property: "rotation"; from: -20; to: 0; mass: 0.5; spring: 15; damping: 0.1 }
403+ }
404 }
405 }
406 }
407
408=== modified file 'Ubuntu/Settings/Components/QuickReply.qml'
409--- Ubuntu/Settings/Components/QuickReply.qml 2013-10-29 17:40:23 +0000
410+++ Ubuntu/Settings/Components/QuickReply.qml 2014-07-31 16:42:23 +0000
411@@ -53,7 +53,7 @@
412 width: units.gu(2)
413 height: width
414 fillMode: Image.PreserveAspectFit
415- source: "artwork/message_sms01_54px.png"
416+ source: "image://theme/message"
417 }
418
419 Label {
420@@ -97,7 +97,7 @@
421 rightMargin: messageMargins
422 }
423 verticalAlignment: Text.AlignVCenter
424- fontSize: "medium"
425+ fontSize: "medium"v
426 text: modelData
427 }
428
429
430=== removed directory 'Ubuntu/Settings/Components/artwork'
431=== removed file 'Ubuntu/Settings/Components/artwork/CMakeLists.txt'
432--- Ubuntu/Settings/Components/artwork/CMakeLists.txt 2014-06-27 09:35:26 +0000
433+++ Ubuntu/Settings/Components/artwork/CMakeLists.txt 1970-01-01 00:00:00 +0000
434@@ -1,2 +0,0 @@
435-# export the artwork files.
436-export_qmlfiles(Ubuntu.Settings.Components.Art Ubuntu/Settings/Components/artwork DESTINATION ${QT_IMPORTS_DIR})
437
438=== removed file 'Ubuntu/Settings/Components/artwork/message_sms01_54px.png'
439Binary files Ubuntu/Settings/Components/artwork/message_sms01_54px.png 2013-10-04 09:48:04 +0000 and Ubuntu/Settings/Components/artwork/message_sms01_54px.png 1970-01-01 00:00:00 +0000 differ
440=== modified file 'Ubuntu/Settings/Components/qmldir'
441--- Ubuntu/Settings/Components/qmldir 2014-06-30 15:36:05 +0000
442+++ Ubuntu/Settings/Components/qmldir 2014-07-31 16:42:23 +0000
443@@ -2,7 +2,7 @@
444
445 ActionTextField 0.1 ActionTextField.qml
446 Calendar 0.1 Calendar.qml
447-HeroMessageHeader 0.1 HeroMessageHeader.qml
448+MessageHeader 0.1 MessageHeader.qml
449 IconVisual 0.1 IconVisual.qml
450 QuickReply 0.1 QuickReply.qml
451 StatusIcon 0.1 StatusIcon.qml
452
453=== modified file 'Ubuntu/Settings/Menus/AccessPointMenu.qml'
454--- Ubuntu/Settings/Menus/AccessPointMenu.qml 2014-05-22 23:58:14 +0000
455+++ Ubuntu/Settings/Menus/AccessPointMenu.qml 2014-07-31 16:42:23 +0000
456@@ -18,95 +18,33 @@
457 */
458
459 import QtQuick 2.0
460-import Ubuntu.Components 0.1
461+import Ubuntu.Components 1.1
462 import Ubuntu.Components.ListItems 0.1 as ListItem
463
464 ListItem.Empty {
465 id: menu
466 implicitHeight: units.gu(5.5)
467
468- property bool checked: false
469+ property bool active: false
470 property bool secure: false
471 property bool adHoc: false
472 property int signalStrength: 0
473 property alias text: label.text
474
475- __acceptEvents: false
476-
477- CheckBox {
478- id: checkbox
479- objectName: "checkBox"
480- property bool enableCheckConnection: true
481-
482- height: units.gu(3)
483- width: units.gu(3)
484-
485+ Icon {
486+ id: iconSignal
487+ objectName: "iconSignal"
488+
489+ color: active ? UbuntuColors.green : Theme.palette.selected.backgroundText
490+
491+ width: height
492+ height: Math.min(units.gu(3), parent.height - units.gu(1))
493 anchors {
494 left: parent.left
495 leftMargin: menu.__contentsMargins
496 verticalCenter: parent.verticalCenter
497 }
498
499- // need onCompleted to set the initial value
500- // can't use binding otherwise we will get feedback from connections.
501- Component.onCompleted: {
502- enableCheckConnection = false;
503- checked = menu.checked;
504- enableCheckConnection = true;
505- }
506-
507- // FIXME : should use Checkbox.toggled signal
508- // lp:~nick-dedekind/ubuntu-ui-toolkit/checkbox.toggled
509- onCheckedChanged: {
510- if (!enableCheckConnection) {
511- return;
512- }
513- var oldEnable = enableCheckConnection;
514- enableCheckConnection = false;
515-
516- menu.checked = checked;
517- menu.triggered(menu.checked);
518-
519- enableCheckConnection = oldEnable;
520- }
521-
522- Connections {
523- target: menu
524- onCheckedChanged: {
525- if (!checkbox.enableCheckConnection) {
526- return;
527- }
528- var oldEnable = checkbox.enableCheckConnection;
529- checkbox.enableCheckConnection = false;
530-
531- checkbox.checked = menu.checked;
532-
533- checkbox.enableCheckConnection = oldEnable;
534- }
535- }
536-
537- Connections {
538- target: menu.__mouseArea
539- onClicked: {
540- checkbox.clicked();
541- }
542- }
543- }
544-
545- Icon {
546- id: iconSignal
547- objectName: "iconSignal"
548-
549- color: Theme.palette.selected.backgroundText
550-
551- width: height
552- height: Math.min(units.gu(3), parent.height - units.gu(1))
553- anchors {
554- left: checkbox.right
555- leftMargin: units.gu(1)
556- verticalCenter: parent.verticalCenter
557- }
558-
559 name: {
560 var imageName = "nm-signal-100"
561
562@@ -135,7 +73,7 @@
563 rightMargin: menu.__contentsMargins
564 }
565 elide: Text.ElideRight
566- opacity: label.enabled ? 1.0 : 0.5
567+ color: active ? UbuntuColors.green : Theme.palette.selected.backgroundText
568 }
569
570 Icon {
571@@ -144,7 +82,7 @@
572 visible: secure
573 name: "network-secure"
574
575- color: Theme.palette.selected.backgroundText
576+ color: active ? UbuntuColors.green : Theme.palette.selected.backgroundText
577
578 width: height
579 height: Math.min(units.gu(3), parent.height - units.gu(1))
580
581=== modified file 'Ubuntu/Settings/Menus/ButtonMenu.qml'
582--- Ubuntu/Settings/Menus/ButtonMenu.qml 2013-10-29 17:40:23 +0000
583+++ Ubuntu/Settings/Menus/ButtonMenu.qml 2014-07-31 16:42:23 +0000
584@@ -18,17 +18,19 @@
585
586 import QtQuick 2.0
587 import Ubuntu.Components 0.1
588-import Ubuntu.Components.ListItems 0.1 as ListItem
589-
590-ListItem.Standard {
591- property alias buttonText: button.text
592-
593- iconFrame: false
594- Component.onCompleted: button.clicked.connect(clicked)
595-
596- control: Button {
597- id: button
598- objectName: "button"
599- width: Math.max(units.gu(5), implicitWidth)
600+
601+StandardMenu {
602+ id: menu
603+ property string buttonText
604+
605+ component: Component {
606+ Button {
607+ id: button
608+ objectName: "button"
609+ text: menu.buttonText
610+ width: Math.max(units.gu(5), implicitWidth)
611+
612+ onClicked: menu.clicked()
613+ }
614 }
615 }
616
617=== modified file 'Ubuntu/Settings/Menus/CMakeLists.txt'
618--- Ubuntu/Settings/Menus/CMakeLists.txt 2014-06-27 13:56:26 +0000
619+++ Ubuntu/Settings/Menus/CMakeLists.txt 2014-07-31 16:42:23 +0000
620@@ -1,7 +1,5 @@
621 project(UbuntuSettingsMenusQml)
622
623-add_subdirectory(artwork)
624-
625 find_package(Qt5Core REQUIRED)
626
627 include_directories(
628
629=== modified file 'Ubuntu/Settings/Menus/EventMenu.qml'
630--- Ubuntu/Settings/Menus/EventMenu.qml 2014-05-22 23:58:14 +0000
631+++ Ubuntu/Settings/Menus/EventMenu.qml 2014-07-31 16:42:23 +0000
632@@ -60,7 +60,6 @@
633
634 Components.Label {
635 id: dateLabel
636- color: Theme.palette.normal.backgroundText
637
638 anchors {
639 verticalCenter: parent.verticalCenter
640
641=== modified file 'Ubuntu/Settings/Menus/GroupedMessageMenu.qml'
642--- Ubuntu/Settings/Menus/GroupedMessageMenu.qml 2013-12-13 16:00:06 +0000
643+++ Ubuntu/Settings/Menus/GroupedMessageMenu.qml 2014-07-31 16:42:23 +0000
644@@ -22,41 +22,37 @@
645 import Ubuntu.Components 0.1
646 import Ubuntu.Components.ListItems 0.1 as ListItem
647
648-ListItem.Standard {
649+StandardMenu {
650 id: menu
651
652- property alias count: label.text
653+ property string count: "0"
654
655 signal dismissed()
656
657- iconSource: Qt.resolvedUrl("artwork/default_app.svg")
658-
659- control: UbuntuShape {
660- height: label.height + units.gu(2)
661- width: label.width + units.gu(2)
662- color: Theme.palette.normal.backgroundText
663- radius: "medium"
664-
665- Label {
666- id: label
667- objectName: "messageCount"
668-
669- anchors {
670- horizontalCenter: parent.horizontalCenter
671- verticalCenter: parent.verticalCenter
672- }
673- horizontalAlignment: Text.AlignRight
674- font.weight: Font.DemiBold
675- fontSize: "medium"
676- text: "0"
677-
678- color: Theme.palette.normal.foregroundText
679- }
680-
681- Connections {
682- target: menu.__mouseArea
683- onClicked: {
684- menu.clicked();
685+ iconSource: Qt.resolvedUrl("image://theme/message")
686+
687+ component: Component {
688+ UbuntuShape {
689+ height: label.implicitHeight + units.gu(2)
690+ width: label.implicitWidth + units.gu(2)
691+
692+ color: Theme.palette.normal.backgroundText
693+ radius: "medium"
694+
695+ Label {
696+ id: label
697+ objectName: "messageCount"
698+
699+ anchors {
700+ horizontalCenter: parent.horizontalCenter
701+ verticalCenter: parent.verticalCenter
702+ }
703+ horizontalAlignment: Text.AlignRight
704+ font.weight: Font.DemiBold
705+ fontSize: "medium"
706+ text: menu.count
707+
708+ color: Theme.palette.normal.foregroundText
709 }
710 }
711 }
712
713=== modified file 'Ubuntu/Settings/Menus/MediaPlayerMenu.qml'
714--- Ubuntu/Settings/Menus/MediaPlayerMenu.qml 2013-10-04 10:04:18 +0000
715+++ Ubuntu/Settings/Menus/MediaPlayerMenu.qml 2014-07-31 16:42:23 +0000
716@@ -19,6 +19,7 @@
717 import QtQuick 2.0
718 import Ubuntu.Components 0.1
719 import Ubuntu.Components.ListItems 0.1 as ListItem
720+import QtQuick.Layouts 1.1
721
722 ListItem.Empty {
723 id: menu
724@@ -35,7 +36,7 @@
725 implicitHeight: column.height + units.gu(2)
726 Behavior on implicitHeight { UbuntuNumberAnimation {} }
727
728- Column {
729+ ColumnLayout {
730 id: column
731 anchors {
732 left: parent.left
733@@ -47,17 +48,15 @@
734 }
735 height: running ? trackRow.height : playerRow.height
736
737- Row {
738+ RowLayout {
739 objectName: "player"
740 id: playerRow
741 spacing: menu.__contentsMargins
742 visible: !running
743
744- Behavior on opacity { UbuntuNumberAnimation {} }
745-
746 UbuntuShape {
747- width: units.gu(5)
748- height: width
749+ Layout.preferredHeight: units.gu(5)
750+ Layout.preferredWidth: units.gu(5)
751
752 image: Image {
753 id: playerIcon
754@@ -70,38 +69,42 @@
755 }
756 }
757
758- Row {
759+ RowLayout {
760 objectName: "albumArt"
761 id: trackRow
762 width: menu.width
763 spacing: units.gu(2)
764 visible: running
765
766- Behavior on opacity { UbuntuNumberAnimation {} }
767-
768 UbuntuShape {
769- width: units.gu(10)
770- height: width
771+ Layout.preferredHeight: units.gu(10)
772+ Layout.preferredWidth: units.gu(10)
773
774 image: Image {
775 id: albumArtImage
776 }
777 }
778
779- Column {
780- spacing: units.gu(1)
781+ ColumnLayout {
782 anchors.verticalCenter: parent.verticalCenter
783
784 Label {
785 id: songLabel
786+ elide: Text.ElideRight
787+ maximumLineCount: 1
788 }
789
790 Label {
791 id: artistLabel
792+ elide: Text.ElideRight
793+ maximumLineCount: 1
794 }
795
796 Label {
797 id: albumLabel
798+ elide: Text.ElideRight
799+ maximumLineCount: 1
800+ fontSize: "small"
801 }
802 }
803 }
804
805=== modified file 'Ubuntu/Settings/Menus/PlaybackItemMenu.qml'
806--- Ubuntu/Settings/Menus/PlaybackItemMenu.qml 2013-10-04 10:04:18 +0000
807+++ Ubuntu/Settings/Menus/PlaybackItemMenu.qml 2014-07-31 16:42:23 +0000
808@@ -17,8 +17,10 @@
809 */
810
811 import QtQuick 2.0
812+import Ubuntu.Settings.Components 0.1 as USC
813 import Ubuntu.Components 0.1
814 import Ubuntu.Components.ListItems 0.1 as ListItem
815+import QtQuick.Layouts 1.1
816
817 ListItem.Empty {
818 id: menu
819@@ -33,66 +35,73 @@
820 signal play(bool play)
821 signal previous()
822
823- implicitHeight: controlsRow.height + units.gu(2)
824-
825- Row {
826- id: controlsRow
827-
828- anchors {
829- top: parent.top
830- topMargin: units.gu(1)
831- horizontalCenter: parent.horizontalCenter
832- }
833- spacing: units.gu(2)
834-
835- Button {
836+ implicitHeight: layout.implicitHeight + units.gu(2)
837+
838+ RowLayout {
839+ id: layout
840+ anchors.centerIn: parent
841+ spacing: units.gu(3)
842+
843+ USC.IconVisual {
844 objectName: "previousButton"
845- width: units.gu(5)
846- height: width
847- onClicked: menu.previous()
848- text: ""
849+
850+ Layout.preferredWidth: units.gu(5)
851+ Layout.preferredHeight: units.gu(5)
852+
853+ source: "image://theme/media-skip-backward"
854+ color: {
855+ if (!enabled)
856+ return Theme.palette.normal.backgroundText;
857+ return prevMA.pressed ? Theme.palette.selected.foreground : Theme.palette.normal.foregroundText;
858+ }
859 enabled: canGoPrevious
860- anchors.verticalCenter: parent.verticalCenter
861
862- Icon {
863+ MouseArea {
864+ id: prevMA
865 anchors.fill: parent
866- anchors.margins: units.gu(1)
867- name: "media-skip-backward"
868- color: Theme.palette.normal.foregroundText
869+ onClicked: menu.previous()
870 }
871 }
872
873- Button {
874+ USC.IconVisual {
875 objectName: "playButton"
876- width: units.gu(6)
877- height: width
878- onClicked: menu.play(!playing)
879- text: ""
880+
881+ Layout.preferredWidth: units.gu(5)
882+ Layout.preferredHeight: units.gu(5)
883+
884+ source: playing ? "image://theme/media-playback-pause" : "image://theme/media-playback-start"
885+ color: {
886+ if (!enabled)
887+ return Theme.palette.normal.backgroundText;
888+ return playMA.pressed ? Theme.palette.selected.foreground : Theme.palette.normal.foregroundText;
889+ }
890 enabled: canPlay
891- anchors.verticalCenter: parent.verticalCenter
892
893- Icon {
894+ MouseArea {
895+ id: playMA
896 anchors.fill: parent
897- anchors.margins: units.gu(1)
898- name: playing ? "media-playback-pause" : "media-playback-start"
899- color: Theme.palette.normal.foregroundText
900+ onClicked: menu.play(!playing)
901 }
902 }
903
904- Button {
905+ USC.IconVisual {
906 objectName: "nextButton"
907- width: units.gu(5)
908- height: width
909- onClicked: menu.next()
910- text: ""
911+
912+ Layout.preferredWidth: units.gu(5)
913+ Layout.preferredHeight: units.gu(5)
914+
915+ source: "image://theme/media-skip-forward"
916+ color: {
917+ if (!enabled)
918+ return Theme.palette.normal.backgroundText;
919+ return nextMA.pressed ? Theme.palette.selected.foreground : Theme.palette.normal.foregroundText;
920+ }
921 enabled: canGoNext
922- anchors.verticalCenter: parent.verticalCenter
923
924- Icon {
925+ MouseArea {
926+ id: nextMA
927 anchors.fill: parent
928- anchors.margins: units.gu(1)
929- name: "media-skip-forward"
930- color: Theme.palette.normal.foregroundText
931+ onClicked: menu.next()
932 }
933 }
934 }
935
936=== modified file 'Ubuntu/Settings/Menus/ProgressBarMenu.qml'
937--- Ubuntu/Settings/Menus/ProgressBarMenu.qml 2013-10-04 10:04:18 +0000
938+++ Ubuntu/Settings/Menus/ProgressBarMenu.qml 2014-07-31 16:42:23 +0000
939@@ -17,17 +17,25 @@
940 */
941
942 import QtQuick 2.0
943-import Ubuntu.Components 0.1
944+import Ubuntu.Components 1.1
945 import Ubuntu.Components.ListItems 0.1 as ListItem
946
947-ListItem.Standard {
948- property alias indeterminate: progressBar.indeterminate
949- property alias minimumValue: progressBar.minimumValue
950- property alias maximumValue: progressBar.maximumValue
951- property alias value: progressBar.value
952-
953- control: ProgressBar {
954- id: progressBar
955- width: units.gu(20)
956+StandardMenu {
957+ id: menu
958+ property bool indeterminate: false
959+ property real minimumValue: 0.0
960+ property real maximumValue: 1.0
961+ property real value: 0.0
962+
963+ component: Component {
964+ ProgressBar {
965+ id: progressBar
966+ width: units.gu(20)
967+
968+ indeterminate: menu.indeterminate
969+ minimumValue: menu.minimumValue
970+ maximumValue: menu.maximumValue
971+ value: menu.value
972+ }
973 }
974 }
975
976=== modified file 'Ubuntu/Settings/Menus/ProgressValueMenu.qml'
977--- Ubuntu/Settings/Menus/ProgressValueMenu.qml 2013-10-04 10:04:18 +0000
978+++ Ubuntu/Settings/Menus/ProgressValueMenu.qml 2014-07-31 16:42:23 +0000
979@@ -19,18 +19,19 @@
980
981 import QtQuick 2.0
982 import Ubuntu.Components 0.1
983-import Ubuntu.Components.ListItems 0.1 as ListItem
984
985-ListItem.Standard {
986+StandardMenu {
987 id: menuItem
988
989 property int value : 0.0
990
991- control: Label {
992- id: progress
993- objectName: "progress"
994+ component: Component {
995+ Label {
996+ id: progress
997+ objectName: "progress"
998
999- text: menuItem.value + " %"
1000- fontSize: "medium"
1001+ text: menuItem.value + " %"
1002+ fontSize: "medium"
1003+ }
1004 }
1005 }
1006
1007=== renamed file 'Ubuntu/Settings/Menus/HeroMessageMenu.qml' => 'Ubuntu/Settings/Menus/SimpleMessageMenu.qml'
1008--- Ubuntu/Settings/Menus/HeroMessageMenu.qml 2013-10-29 17:40:23 +0000
1009+++ Ubuntu/Settings/Menus/SimpleMessageMenu.qml 2014-07-31 16:42:23 +0000
1010@@ -18,25 +18,28 @@
1011 * Olivier Tilloy <olivier.tilloy@canonical.com>
1012 */
1013
1014-import QtQuick 2.0
1015+import QtQuick 2.1
1016 import Ubuntu.Components 0.1
1017 import Ubuntu.Components.ListItems 0.1 as ListItem
1018 import Ubuntu.Settings.Components 0.1 as USC
1019+import QtQuick.Layouts 1.1
1020
1021 ListItem.Empty {
1022 id: menu
1023
1024- property alias heroMessageHeader: __heroMessageHeader
1025- property real collapsedHeight: heroMessageHeader.y + heroMessageHeader.bodyBottom + units.gu(2)
1026- property real expandedHeight: collapsedHeight
1027+ property alias title: messageHeader.title
1028+ property alias time: messageHeader.time
1029+ property alias body: messageHeader.body
1030
1031 property url avatar
1032- property url appIcon
1033+ property url icon
1034
1035- signal appActivated
1036+ signal iconActivated
1037 signal dismissed
1038
1039- implicitHeight: collapsedHeight
1040+ property alias footer: footerLoader.sourceComponent
1041+
1042+ implicitHeight: layout.height + units.gu(3)
1043
1044 Rectangle {
1045 id: background
1046@@ -47,33 +50,49 @@
1047 z: -1
1048 }
1049
1050- USC.HeroMessageHeader {
1051- id: __heroMessageHeader
1052-
1053- anchors.top: parent.top
1054- anchors.left: parent.left
1055- anchors.right: parent.right
1056-
1057- avatar: menu.avatar != "" ? menu.avatar : "artwork/default_contact.png"
1058- appIcon: menu.appIcon != "" ? menu.appIcon : "artwork/default_app.svg"
1059- icon: appIcon
1060-
1061- state: menu.state
1062-
1063- onAppIconClicked: {
1064- menu.appActivated();
1065+ ColumnLayout {
1066+ id: layout
1067+
1068+ anchors {
1069+ left: parent.left
1070+ right: parent.right
1071+ leftMargin: units.gu(2)
1072+ rightMargin: units.gu(2)
1073+ verticalCenter: parent.verticalCenter
1074+ }
1075+ spacing: units.gu(1.5)
1076+
1077+ USC.MessageHeader {
1078+ id: messageHeader
1079+ Layout.fillWidth: true
1080+ Layout.alignment: Qt.AlignTop
1081+
1082+ avatar: menu.avatar != "" ? menu.avatar : "image://theme/contact"
1083+ icon: menu.icon != "" ? menu.icon : "image://theme/message"
1084+
1085+ state: menu.state
1086+
1087+ onIconClicked: {
1088+ menu.iconActivated();
1089+ }
1090+ }
1091+
1092+ Loader {
1093+ id: footerLoader
1094+ visible: menu.state === "expanded"
1095+ asynchronous: false
1096+ Layout.fillWidth: true
1097+ Layout.fillHeight: true
1098 }
1099 }
1100
1101+ onTriggered: if (!footer || !selected) messageHeader.shakeIcon();
1102+
1103 states: State {
1104 name: "expanded"
1105- when: selected
1106+ when: selected && footerLoader.status == Loader.Ready
1107
1108 PropertyChanges {
1109- target: menu
1110- implicitHeight: menu.expandedHeight
1111- }
1112- PropertyChanges {
1113 target: background
1114 alpha: 0.05
1115 }
1116@@ -82,11 +101,11 @@
1117 transitions: Transition {
1118 ParallelAnimation {
1119 NumberAnimation {
1120- properties: "opacity,implicitHeight"
1121+ properties: "height"
1122 duration: 200
1123 easing.type: Easing.OutQuad
1124 }
1125- ColorAnimation {}
1126+ ColorAnimation { target: background}
1127 }
1128 }
1129
1130
1131=== removed file 'Ubuntu/Settings/Menus/SimpleTextMessageMenu.qml'
1132--- Ubuntu/Settings/Menus/SimpleTextMessageMenu.qml 2013-12-13 16:50:22 +0000
1133+++ Ubuntu/Settings/Menus/SimpleTextMessageMenu.qml 1970-01-01 00:00:00 +0000
1134@@ -1,99 +0,0 @@
1135-/*
1136- * Copyright 2013 Canonical Ltd.
1137- *
1138- * This program is free software; you can redistribute it and/or modify
1139- * it under the terms of the GNU Lesser General Public License as published by
1140- * the Free Software Foundation; version 3.
1141- *
1142- * This program is distributed in the hope that it will be useful,
1143- * but WITHOUT ANY WARRANTY; without even the implied warranty of
1144- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1145- * GNU Lesser General Public License for more details.
1146- *
1147- * You should have received a copy of the GNU Lesser General Public License
1148- * along with this program. If not, see <http://www.gnu.org/licenses/>.
1149- *
1150- * Authors:
1151- * Renato Araujo Oliveira Filho <renato@canonical.com>
1152- * Olivier Tilloy <olivier.tilloy@canonical.com>
1153- */
1154-
1155-import QtQuick 2.0
1156-import Ubuntu.Components 0.1
1157-
1158-HeroMessageMenu {
1159- id: menu
1160-
1161- property string title: ""
1162- property string time: ""
1163- property string message: ""
1164-
1165- property alias footer: footerLoader.sourceComponent
1166-
1167- expandedHeight: collapsedHeight + fullMessage.height
1168- heroMessageHeader.titleText.text: title
1169- heroMessageHeader.subtitleText.text: time
1170- heroMessageHeader.bodyText.text: message
1171-
1172- Item {
1173- id: fullMessage
1174-
1175- anchors {
1176- left: parent.left
1177- leftMargin: units.gu(2)
1178- right: parent.right
1179- rightMargin: units.gu(2)
1180- top: heroMessageHeader.bottom
1181- }
1182- height: childrenRect.height
1183- opacity: 0.0
1184- enabled: false
1185-
1186- Label {
1187- id: bodyText
1188- anchors {
1189- top: parent.top
1190- left: parent.left
1191- right: parent.right
1192- }
1193- wrapMode: Text.WordWrap
1194- elide: Text.ElideRight
1195- fontSize: "medium"
1196- text: heroMessageHeader.bodyText.text
1197- }
1198-
1199- Loader {
1200- id: footerLoader
1201-
1202- anchors {
1203- top: bodyText.bottom
1204- topMargin: item ? units.gu(2) : 0
1205- left: parent.left
1206- right: parent.right
1207- }
1208- height: item ? units.gu(4) : 0
1209- }
1210-
1211- states: State {
1212- name: "expanded"
1213- when: menu.state === "expanded"
1214-
1215- PropertyChanges {
1216- target: heroMessageHeader.bodyText
1217- opacity: 0.0
1218- }
1219-
1220- PropertyChanges {
1221- target: fullMessage
1222- opacity: 1.0
1223- enabled: true
1224- }
1225- }
1226- transitions: Transition {
1227- NumberAnimation {
1228- property: "opacity"
1229- duration: 200
1230- }
1231- }
1232- }
1233-}
1234
1235=== modified file 'Ubuntu/Settings/Menus/SnapDecisionMenu.qml'
1236--- Ubuntu/Settings/Menus/SnapDecisionMenu.qml 2013-10-29 17:40:23 +0000
1237+++ Ubuntu/Settings/Menus/SnapDecisionMenu.qml 2014-07-31 16:42:23 +0000
1238@@ -19,142 +19,80 @@
1239 */
1240
1241 import QtQuick 2.0
1242-import Ubuntu.Components 0.1
1243+import Ubuntu.Components 1.1
1244 import Ubuntu.Settings.Components 0.1 as USC
1245+import QtQuick.Layouts 1.1
1246
1247-HeroMessageMenu {
1248+SimpleMessageMenu {
1249 id: menu
1250
1251- property string title: ""
1252- property string time: ""
1253- property string message: ""
1254-
1255- property bool activateEnabled: true
1256- property alias actionButtonText: actionButton.text
1257+ property bool actionEnabled: true
1258+ property string actionButtonText: "Call back"
1259
1260 property bool replyEnabled: true
1261- property alias replyMessages: quickreply.messages
1262- property alias replyButtonText: quickreply.buttonText
1263-
1264- expandedHeight: collapsedHeight + buttons.height + quickreply.height
1265- heroMessageHeader.titleText.text: title
1266- heroMessageHeader.subtitleText.text: message
1267- heroMessageHeader.bodyText.text: time
1268-
1269- signal activated
1270+ property string replyButtonText: "Send"
1271+
1272+ signal actionActivated
1273 signal replied(string value)
1274
1275- Item {
1276+ footer: Item {
1277 id: buttons
1278
1279- anchors.left: parent.left
1280- anchors.leftMargin: units.gu(2)
1281- anchors.right: parent.right
1282- anchors.rightMargin: units.gu(2)
1283- anchors.top: heroMessageHeader.bottom
1284- anchors.topMargin: units.gu(1)
1285- height: units.gu(4)
1286- opacity: 0.0
1287-
1288- Button {
1289- objectName: "messageButton"
1290- text: "Message"
1291- anchors.left: parent.left
1292- anchors.top: parent.top
1293- anchors.bottom: parent.bottom
1294- width: (parent.width - units.gu(1)) / 2
1295- gradient: UbuntuColors.greyGradient
1296-
1297- onClicked: {
1298- if (quickreply.state === "") {
1299- quickreply.state = "expanded";
1300- } else {
1301- quickreply.state = "";
1302- }
1303- }
1304- }
1305-
1306- Button {
1307- id: actionButton
1308- objectName: "actionButton"
1309- text: "Call back"
1310- anchors.right: parent.right
1311- anchors.top: parent.top
1312- anchors.bottom: parent.bottom
1313- width: (parent.width - units.gu(1)) / 2
1314- enabled: menu.activateEnabled
1315-
1316- onClicked: {
1317- menu.activated();
1318- }
1319- }
1320-
1321- states: State {
1322- name: "expanded"
1323- when: menu.state === "expanded"
1324-
1325- PropertyChanges {
1326- target: buttons
1327- opacity: 1.0
1328- }
1329- }
1330- transitions: Transition {
1331- NumberAnimation {
1332- property: "opacity"
1333- duration: 200
1334- easing.type: Easing.OutQuad
1335- }
1336- }
1337- }
1338-
1339- USC.QuickReply {
1340- id: quickreply
1341-
1342- onReplied: {
1343- menu.replied(value);
1344- }
1345-
1346- messages: ""
1347- buttonText: "Send"
1348- anchors {
1349- top: buttons.bottom
1350- topMargin: units.gu(2)
1351- left: parent.left
1352- right: parent.right
1353- }
1354- height: 0
1355- opacity: 0.0
1356- enabled: false
1357- replyEnabled: menu.replyEnabled
1358- messageMargins: __contentsMargins
1359-
1360- states: State {
1361- name: "expanded"
1362-
1363- PropertyChanges {
1364- target: quickreply
1365- height: expandedHeight + units.gu(2)
1366- opacity: 1.0
1367- }
1368-
1369- PropertyChanges {
1370- target: quickreply
1371- enabled: true
1372- }
1373- }
1374-
1375- transitions: Transition {
1376- NumberAnimation {
1377- properties: "opacity,height"
1378- duration: 200
1379- easing.type: Easing.OutQuad
1380- }
1381- }
1382- }
1383-
1384- onStateChanged: {
1385- if (state === "") {
1386- quickreply.state = "";
1387+ implicitHeight: layout.implicitHeight
1388+
1389+ ColumnLayout {
1390+ id: layout
1391+ anchors {
1392+ left: parent.left
1393+ right: parent.right
1394+ }
1395+ spacing: units.gu(1)
1396+
1397+ RowLayout {
1398+ spacing: units.gu(2)
1399+
1400+ Button {
1401+ objectName: "messageButton"
1402+ text: "Message"
1403+ gradient: UbuntuColors.greyGradient
1404+ Layout.fillWidth: true
1405+
1406+ onClicked: {
1407+ if (reply.state === "") {
1408+ reply.state = "expanded";
1409+ } else {
1410+ reply.state = "";
1411+ }
1412+ }
1413+ }
1414+
1415+ Button {
1416+ id: actionButton
1417+ objectName: "actionButton"
1418+ enabled: menu.actionEnabled
1419+ text: actionButtonText
1420+ Layout.fillWidth: true
1421+
1422+ onClicked: {
1423+ menu.actionActivated();
1424+ }
1425+ }
1426+ }
1427+
1428+ USC.ActionTextField {
1429+ id: reply
1430+
1431+ Layout.fillWidth: true
1432+ Layout.fillHeight: true
1433+ visible: state == "expanded"
1434+
1435+ activateEnabled: menu.replyEnabled
1436+ buttonText: menu.replyButtonText
1437+
1438+ onActivated: {
1439+ menu.replied(value);
1440+ }
1441+ }
1442 }
1443 }
1444 }
1445
1446=== modified file 'Ubuntu/Settings/Menus/StandardMenu.qml'
1447--- Ubuntu/Settings/Menus/StandardMenu.qml 2014-07-01 12:15:17 +0000
1448+++ Ubuntu/Settings/Menus/StandardMenu.qml 2014-07-31 16:42:23 +0000
1449@@ -27,9 +27,17 @@
1450 property alias text: label.text
1451 property alias iconColor: iconVisual.color
1452 property alias component: componentLoader.sourceComponent
1453+ property alias foregroundColor: label.color
1454+ property alias backColor: overlay.color
1455+
1456+ Rectangle {
1457+ id: overlay
1458+ color: "transparent"
1459+ visible: color !== "transparent"
1460+ anchors.fill: parent
1461+ }
1462
1463 RowLayout {
1464-
1465 anchors {
1466 fill: parent
1467 leftMargin: menu.__contentsMargins
1468@@ -56,11 +64,15 @@
1469
1470 elide: Text.ElideRight
1471 maximumLineCount: 1
1472- opacity: label.enabled ? 1.0 : 0.5
1473 }
1474
1475 Loader {
1476 id: componentLoader
1477+ asynchronous: false
1478+ visible: status == Loader.Ready
1479+
1480+ Layout.preferredHeight: item ? item.height : 0
1481+ Layout.preferredWidth: item ? item.width : 0
1482 }
1483 }
1484 }
1485
1486=== modified file 'Ubuntu/Settings/Menus/SwitchMenu.qml'
1487--- Ubuntu/Settings/Menus/SwitchMenu.qml 2013-10-29 17:40:23 +0000
1488+++ Ubuntu/Settings/Menus/SwitchMenu.qml 2014-07-31 16:42:23 +0000
1489@@ -19,50 +19,50 @@
1490
1491 import QtQuick 2.0
1492 import Ubuntu.Components 0.1
1493-import Ubuntu.Components.ListItems 0.1 as ListItem
1494
1495-ListItem.Standard {
1496+StandardMenu {
1497 id: menu
1498
1499 property bool checked: false
1500- iconFrame: false
1501-
1502- control: Switch {
1503- id: switcher
1504- objectName: "switcher"
1505- property bool enableCheckConnection: true
1506-
1507- Component.onCompleted: {
1508- checked = menu.checked;
1509- }
1510-
1511- // FIXME : should use Checkbox.toggled signal
1512- // lp:~nick-dedekind/ubuntu-ui-toolkit/checkbox.toggled
1513- onCheckedChanged: {
1514- if (!enableCheckConnection) {
1515- return;
1516+
1517+ component: Component {
1518+ Switch {
1519+ id: switcher
1520+ objectName: "switcher"
1521+ property bool enableCheckConnection: true
1522+
1523+ Component.onCompleted: {
1524+ checked = menu.checked;
1525 }
1526- var oldEnable = enableCheckConnection;
1527- enableCheckConnection = false;
1528-
1529- menu.checked = checked;
1530- menu.triggered(menu.checked);
1531-
1532- enableCheckConnection = oldEnable;
1533- }
1534-
1535- Connections {
1536- target: menu
1537+
1538+ // FIXME : should use Checkbox.toggled signal
1539+ // lp:~nick-dedekind/ubuntu-ui-toolkit/checkbox.toggled
1540 onCheckedChanged: {
1541- if (!switcher.enableCheckConnection) {
1542+ if (!enableCheckConnection) {
1543 return;
1544 }
1545- var oldEnable = switcher.enableCheckConnection;
1546- switcher.enableCheckConnection = false;
1547-
1548- switcher.checked = menu.checked;
1549-
1550- switcher.enableCheckConnection = oldEnable;
1551+ var oldEnable = enableCheckConnection;
1552+ enableCheckConnection = false;
1553+
1554+ menu.checked = checked;
1555+ menu.triggered(menu.checked);
1556+
1557+ enableCheckConnection = oldEnable;
1558+ }
1559+
1560+ Connections {
1561+ target: menu
1562+ onCheckedChanged: {
1563+ if (!switcher.enableCheckConnection) {
1564+ return;
1565+ }
1566+ var oldEnable = switcher.enableCheckConnection;
1567+ switcher.enableCheckConnection = false;
1568+
1569+ switcher.checked = menu.checked;
1570+
1571+ switcher.enableCheckConnection = oldEnable;
1572+ }
1573 }
1574 }
1575 }
1576
1577=== modified file 'Ubuntu/Settings/Menus/TextMessageMenu.qml'
1578--- Ubuntu/Settings/Menus/TextMessageMenu.qml 2013-10-04 12:26:43 +0000
1579+++ Ubuntu/Settings/Menus/TextMessageMenu.qml 2014-07-31 16:42:23 +0000
1580@@ -22,7 +22,7 @@
1581 import Ubuntu.Components 0.1
1582 import Ubuntu.Settings.Components 0.1 as USC
1583
1584-SimpleTextMessageMenu {
1585+SimpleMessageMenu {
1586 id: menu
1587
1588 property bool replyEnabled: true
1589@@ -31,7 +31,6 @@
1590 signal replied(string value)
1591
1592 footer: USC.ActionTextField {
1593- anchors.fill: parent
1594
1595 activateEnabled: menu.replyEnabled
1596 buttonText: menu.replyButtonText
1597
1598=== modified file 'Ubuntu/Settings/Menus/TransferMenu.qml'
1599--- Ubuntu/Settings/Menus/TransferMenu.qml 2014-07-04 17:27:20 +0000
1600+++ Ubuntu/Settings/Menus/TransferMenu.qml 2014-07-31 16:42:23 +0000
1601@@ -15,7 +15,7 @@
1602 */
1603
1604 import QtQuick 2.0
1605-import Ubuntu.Components 0.1
1606+import Ubuntu.Components 1.1
1607 import Ubuntu.Components.ListItems 0.1 as ListItem
1608 import QtQuick.Layouts 1.1
1609
1610@@ -41,21 +41,21 @@
1611 leftMargin: menu.__contentsMargins
1612 rightMargin: menu.__contentsMargins
1613 }
1614+ spacing: units.gu(2)
1615
1616 UbuntuShape {
1617 id: imageShape
1618- Layout.preferredWidth: units.gu(5)
1619- Layout.preferredHeight: units.gu(5)
1620
1621- Layout.alignment: Qt.AlignTop
1622+ Layout.preferredWidth: units.gu(6)
1623+ Layout.preferredHeight: units.gu(6)
1624
1625 image: Image {
1626 objectName: "icon"
1627 id: icon
1628
1629 sourceSize {
1630- width: units.gu(5)
1631- height: units.gu(5)
1632+ width: units.gu(6)
1633+ height: units.gu(6)
1634 }
1635 }
1636 }
1637@@ -70,6 +70,7 @@
1638
1639 elide: Text.ElideRight
1640 maximumLineCount: 1
1641+ font.weight: Font.DemiBold
1642 }
1643
1644 ProgressBar {
1645@@ -77,8 +78,9 @@
1646 objectName: "progress"
1647 visible: menu.active
1648 value: 0.0
1649+ showProgressPercentage: false
1650
1651- Layout.preferredHeight: units.gu(2)
1652+ Layout.preferredHeight: units.gu(1)
1653 Layout.fillWidth: true
1654 }
1655
1656@@ -88,6 +90,7 @@
1657 Layout.fillWidth: true
1658 visible: menu.active
1659
1660+ fontSize: "x-small"
1661 elide: Text.ElideRight
1662 maximumLineCount: 1
1663 }
1664
1665=== modified file 'Ubuntu/Settings/Menus/UserSessionMenu.qml'
1666--- Ubuntu/Settings/Menus/UserSessionMenu.qml 2013-10-04 10:04:18 +0000
1667+++ Ubuntu/Settings/Menus/UserSessionMenu.qml 2014-07-31 16:42:23 +0000
1668@@ -38,8 +38,15 @@
1669
1670 Image {
1671 id: checkMark
1672- source: "artwork/CheckMark.png"
1673+ source: "image://theme/tick"
1674+ height: units.gu(2)
1675+ width: height
1676 anchors.centerIn: parent
1677+
1678+ sourceSize {
1679+ height: height
1680+ width: width
1681+ }
1682 }
1683 }
1684 }
1685
1686=== removed directory 'Ubuntu/Settings/Menus/artwork'
1687=== removed file 'Ubuntu/Settings/Menus/artwork/CMakeLists.txt'
1688--- Ubuntu/Settings/Menus/artwork/CMakeLists.txt 2014-06-27 09:35:26 +0000
1689+++ Ubuntu/Settings/Menus/artwork/CMakeLists.txt 1970-01-01 00:00:00 +0000
1690@@ -1,2 +0,0 @@
1691-# export the artwork files.
1692-export_qmlfiles(Ubuntu.Settings.Menus.Art Ubuntu/Settings/Menus/artwork DESTINATION ${QT_IMPORTS_DIR})
1693
1694=== removed file 'Ubuntu/Settings/Menus/artwork/CheckMark@18.png'
1695Binary files Ubuntu/Settings/Menus/artwork/CheckMark@18.png 2013-09-25 08:54:58 +0000 and Ubuntu/Settings/Menus/artwork/CheckMark@18.png 1970-01-01 00:00:00 +0000 differ
1696=== removed file 'Ubuntu/Settings/Menus/artwork/default_app.svg'
1697--- Ubuntu/Settings/Menus/artwork/default_app.svg 2013-10-04 09:48:04 +0000
1698+++ Ubuntu/Settings/Menus/artwork/default_app.svg 1970-01-01 00:00:00 +0000
1699@@ -1,42 +0,0 @@
1700-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
1701-<!-- Created with Inkscape (http://www.inkscape.org/) -->
1702-<svg id="svg15137" xmlns="http://www.w3.org/2000/svg" height="48" width="48" version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink">
1703- <defs id="defs15139">
1704- <radialGradient id="radialGradient2612" gradientUnits="userSpaceOnUse" cy="4.625" cx="62.625" gradientTransform="matrix(1 0 0 .34118 0 3.0471)" r="10.625">
1705- <stop id="stop8840" offset="0"/>
1706- <stop id="stop8842" style="stop-opacity:0" offset="1"/>
1707- </radialGradient>
1708- <linearGradient id="linearGradient15133" y2=".24326" gradientUnits="userSpaceOnUse" x2="62.2" gradientTransform="matrix(2.1499 0 0 2.1499 -110.12 31.935)" y1="-12.489" x1="62.2">
1709- <stop id="stop4875" style="stop-color:#fff" offset="0"/>
1710- <stop id="stop4877" style="stop-color:#fff;stop-opacity:0" offset="1"/>
1711- </linearGradient>
1712- <radialGradient id="radialGradient15127" gradientUnits="userSpaceOnUse" cy="-8.7256" cx="62.2" gradientTransform="matrix(2.4129 0 0 2.413 -126.48 34.231)" r="9.7553">
1713- <stop id="stop8649" style="stop-color:#8fb1dc" offset="0"/>
1714- <stop id="stop8651" style="stop-color:#3465a4" offset="1"/>
1715- </radialGradient>
1716- <radialGradient id="radialGradient2418" gradientUnits="userSpaceOnUse" cy="24.149" cx="17.814" gradientTransform="matrix(-2.644 0 2.9365e-8 2.5344 78.725 -37.986)" r="9.125">
1717- <stop id="stop4847" style="stop-color:#fff" offset="0"/>
1718- <stop id="stop4849" style="stop-color:#b6b6b6" offset="1"/>
1719- </radialGradient>
1720- <radialGradient id="radialGradient5145" gradientUnits="userSpaceOnUse" cy="13.067" cx="23.86" gradientTransform="matrix(-1.5425 0 0 -.84553 60.718 23.829)" r="18.098">
1721- <stop id="stop14112" style="stop-color:#557695" offset="0"/>
1722- <stop id="stop14114" style="stop-color:#15395c" offset="1"/>
1723- </radialGradient>
1724- <radialGradient id="radialGradient5147" gradientUnits="userSpaceOnUse" cy="-3.442" cx="62.225" gradientTransform="matrix(1.1035 0 0 1.0265 -4.1555 -1.8158)" r="10.081">
1725- <stop id="stop14118" style="stop-color:#9e9e9e" offset="0"/>
1726- <stop id="stop14120" style="stop-color:#9e9e9e;stop-opacity:0" offset="1"/>
1727- </radialGradient>
1728- </defs>
1729- <g id="layer1">
1730- <path id="path8836" style="opacity:.4;fill-rule:evenodd;fill:url(#radialGradient2612)" d="m73.25 4.625a10.625 3.625 0 1 1 -21.25 0 10.625 3.625 0 1 1 21.25 0z" transform="matrix(2.1647 0 0 2.5637 -111.56 26.85)"/>
1731- <g id="g15122" transform="translate(.79042 -.78563)">
1732- <path id="path6495" style="stroke:#204a87;fill:url(#radialGradient15127)" d="m43.505 24.387c0 10.99-8.9091 19.899-19.897 19.899-10.989 0-19.898-8.9091-19.898-19.899 0-10.989 8.9086-19.897 19.898-19.897 10.988 0 19.897 8.9081 19.897 19.897z"/>
1733- <path id="path6534" style="stroke:url(#radialGradient5147);stroke-width:1.1035;fill:url(#radialGradient5145)" d="m23.726 5.3141c-1.5283 0.12067-3.0328 0.36544-4.4919 0.84567-1.23 0.48843 0.88689-0.42988-0.37486-0.60468-0.75942-0.12994-1.0776 0.65251-1.7561 0.67046-0.7741 0.023841-1.3048 0.71572-2.0319 0.79898-0.26187 1.4432-0.59924-0.56894-0.83949 0.13173 0.19047 0.7212-0.07796 1.1928-0.63582 1.6119-0.60156 0.68249-0.03584 1.2934 0.54212 0.69395 0.2775-0.83446 1.1825-1.7618 2.0655-1.2049 0.8837 0.48448 1.7582 1.6525 2.4938 0.40935-0.75488-0.090735-1.0462-0.73637-1.4079-1.2096-0.40023 0.031761-2.0794-0.32019-1.0059-0.24024 0.5284-0.17249 1.549-0.68558 1.9239-0.66537-0.94013 0.49026 0.35015 0.81268 0.73202 1.2035 0.68671 0.20357 0.99776 1.0757 0.37414 1.527-0.80181 0.4162 0.05573 1.1017 0.221 1.6748 0.12828 0.99827 0.99623 0.43282 1.2716-0.18046 0.39803-1.1153 1.6733-1.0767 2.5958-1.5522 1.008-0.51754 1.0248-0.53575 1.5034 0.20195 0.36764 0.21151 1.5947-0.55825 0.78901-0.929-0.68957 0.03713-1.142 0.46029-0.56364-0.60801 0.13915-0.57404 0.6791-1.3235 0.58092-1.7937-0.662-0.2603-1.324-0.5207-1.986-0.7811zm-9.3732 3.6945c0.35612 0.3643 1.5564 1.0234 1.4368 0.11255-0.14419-0.61744-1.0418-0.62308-1.4368-0.11255zm18.165-0.44471c-0.82412 0.16922-1.6412 0.35467-2.292 0.92363 0.19457 0.7853-0.8341 0.89786-1.2851 1.3281-0.12036 0.25242-0.02467 1.8403 0.51105 1.1573 0.58162-0.77246 0.83368 0.40868 1.4478 0.52687 0.4451-0.14324 0.5002-1.1438 0.33275-1.6043 0.28525-0.46984 0.75058-1.1195 1.3539-1.0659-0.37419 0.57099-0.80163 2.0315 0.3911 1.4345 0.34518-0.006-0.93958 0.75452-1.0166 1.273-0.48258 0.51284-0.9934 0.90587-1.6905 0.50847-0.33355-0.28162-0.50305-1.0992-0.71414-0.17566 0.43341 0.73252-1.089 0.04718-1.0514 1.0356-0.31972 0.61514-0.89623 0.8671-1.563 0.91149 0.24198 0.19141 1.1924 1.3314 0.24953 1.1701-0.60352 0.06628-1.4857 0.40701-1.2414 1.1653-0.27486 0.9444 0.4249 0.70654 0.85522 1.2977 0.70116-0.19916 1.1488-0.62908 1.2634-1.3621 0.65618-0.19273 0.73557-0.93195 1.456-0.91702 0.7182-0.40381 0.88559 0.73738 1.5587 0.82181 0.07058 0.4087-0.33464 1.281 0.45659 0.4693 0.76441-0.55387-0.79512-1.2716-0.30963-1.4066 0.69099 0.22071 0.94006 0.87671 1.051 1.519 0.56306 0.9634 0.70185 0.44404 0.74672-0.40362 0.87723-0.39439 1.1473 1.641 2.3881 1.1397 0.92678 0.19174 0.59949 0.8304-0.01904 1.2203-0.50066 0.47112-1.3382 0.17338-1.9265-0.01558-0.56472-0.27756-1.3196-0.24813-1.6214 0.38347-0.46529-0.21764-0.94642-0.91135-1.4178-1.3118-1.1647-0.5139-2.4314-0.07571-3.5919 0.23946-0.99563 1.1632-2.1949 2.219-2.6236 3.7359-0.62778 0.63853 0.54336 1.0082-0.24392 1.556-0.6428 0.51279 0.10805 1.1629 0.2458 1.7527 0.60445 0.74395 1.6306 3.0723 2.5708 2.1452 0.52705-0.80245 0.81963 0.61582 1.4399-0.30194 0.4952-0.39949 0.9695 0.45802 1.6897 0.14331 0.69372 0.4284 0.56095 1.0433 0.27484 1.6928 0.15583 0.54087 0.93098 0.9344 0.62978 1.6677-0.27366 0.68309 0.58312 1.201 0.41038 1.7987-0.5748 1.1512-0.43928 2.5747 0.09386 3.7157 0.42668 1.0325 0.67699 2.1484 0.64366 3.2692 0.74277 0.2222 1.1367-0.72912 1.8776-0.51313 0.72333 0.09324 0.99191-0.82974 1.5008-1.2158 0.56704-0.46747-0.07223-1.1873 0.82794-1.5185 0.87331-0.42523-1.106-1.0213 0.0152-1.4024 0.46515-0.51761 1.4132-0.69776 1.6008-1.3735-0.33834-1.0398-0.21797-2.1801-0.16738-3.2436 0.32552-0.84167 0.72975-1.6312 1.4262-2.2272 0.28082-0.92669 0.94924-1.7777 0.88942-2.7709-1.6476 0.50399-1.1482-0.21491-0.22962-0.87318 0.63508-0.42199 1.4051-0.84564 1.7006-1.5617 0.14435-0.81048-0.45227-2.1297-1.0079-0.90496-0.24511-0.4707-1.1542-0.71744-1.113-1.3307-0.17659-1.2625 0.34462-0.14427 0.86051 0.10789 1.1146-0.60521 1.6818 1.7766 2.3893 0.35503-0.618-4.471-3.052-8.528-6.34-11.567-0.571-1.0949-0.921 0.75-1.501 0.68-0.464-0.485-1.33-1.1394-0.122-0.914 1.034-0.3028 0.333-0.7027-0.425-0.6842-0.574-0.0697-1.101-0.2706-1.635-0.4789zm-20.56 0.4447c-0.275 1.3534-2.0109 1.1954-2.6162 2.5304-2.9783 3.153-4.8166 7.302-5.32 11.598 0.26584 1.0071 1.1105 1.4908 1.9601 1.9373 0.72184 0.41932 1.7801 0.2342 2.1848 1.1124 0.45187 0.36983 0.93948 1.0997 1.5856 0.87722 0.93664-0.09099 0.36019 0.85823 0.19973 1.3392-0.059277 0.607-0.80778 0.99372-0.52016 1.5778-0.24136 0.66166-0.43304 1.3177 0.10262 1.8906 0.45551 0.83988 0.82632 1.7478 1.6708 2.2751 0.59217 0.49728 1.2625 1.1553 1.0304 1.9974-0.12338 0.68167 0.04306 1.3099 0.3725 1.908-0.11816 0.67146-0.36073 1.3584-0.4105 2.0183 0.87949 0.62206 2.6705 2.0606 2.8031 0.49489 0.50176-0.45161 0.5321-1.1784 1.3743-1.1804 0.3909-0.47777 0.52549-1.2283 0.81706-1.8117-0.42572-0.5384 0.16631-1.3697 0.8046-1.3477 0.81594 0.06128 0.78593-0.89448 1.1111-1.4232-0.0073-0.77224-0.38892-1.6471 0.30542-2.227 0.52242-0.47344 0.46827-1.1675 0.5498-1.8097-1.171-0.7244-2.712-1.0911-3.6386-2.0687-0.18364-0.76504-0.7598-1.0229-1.4925-1.0784-0.30936-0.43256-0.25697-1.4628-0.79753-1.5131-0.69628 0.13369-1.3857 0.24089-1.8917-0.3644-0.573-0.776-1.069 0.2-1.593 0.546-0.492 0.856-1.8683-0.043-1.7038-1.007 0.4839-1.334-1.6425 0.148-0.7699-1.425 0.4151-1.715-0.7067-0.396-1.2952-0.011-0.71822 0.0081-0.98953-0.70747-0.86146-1.3625-0.091117-0.78733 0.48283-1.1877 1.0669-1.5822 0.78161 0.12038 0.97989-0.56085 1.5654-0.4722 0.73603-0.03767 1.0049 0.66782 1.4232 1.1357 0.17514-0.66797-0.18345-1.6152 0.55606-1.9879 0.56414-0.42781 1.137-0.84927 1.2721-1.5904 0.13304-0.77598 1.2893-0.46761 1.4837-1.2526 0.26877-0.8206 1.5114-0.15823 1.7899-0.96804 0.8733-0.82086-0.27242-0.57178-0.89854-0.59806-1.2353 0.12695 0.1228-0.32763 0.58598-0.58155 0.68608 0.09073 1.3195-0.13384 1.9499-0.37629 0.08445 0.85843 0.24597 1.3112 0.68417 0.30788-0.85421-0.20211-0.11618-1.0402-0.95973-1.2614-0.66764 0.04697 0.0066-1.4189-0.81571-1.2577-1.0697 0.70782-0.11401-0.50251-0.9854-0.66347-0.68736-0.74222-0.85436 0.47657-1.2276 0.9183 0.24207 0.84702-0.79095 0.66525-0.97976 1.3606-0.41814 1.2534-0.24143-0.08931-0.74055-0.41035-0.61653-0.24732-1.3592-0.3784-1.3637-1.1899 0.82658-0.60512 2.0667-0.96189 2.5994-1.9148 0.3095-0.74008-0.26215-1.1445-0.96618-1.0889l-0.000005-2e-7zm14.675 1.642c-0.12491 0.65746 0.5475 1.009 0.30788 1.7104-0.21487 0.76842-0.27728 1.3789 0.68289 0.93046 0.99668-0.51183 0.36052-0.90148-0.03867-1.5728-0.27187-0.44613-0.24574-1.275-0.9521-1.0681zm-0.75259 1.0947c-0.79414-0.24012-0.61745 1.4493-0.12164 1.0118 0.7276-0.17916 0.23703-0.5252 0.12164-1.0118zm10.023 8.9969c0.95184 0.84444 1.277 2.0946 1.8858 3.1596 0.90428 0.39972 0.0415 1.0795 0.44521 1.5712 0.84897 0.92228-1.1752 0.24516-0.90606-0.67899-0.1971-1.2139-1.0559-2.044-1.4678-3.1045-0.04294-0.3526-0.38552-0.71788 0.04284-0.94732z"/>
1734- <path id="path8655" style="opacity:.4;stroke:url(#linearGradient15133);fill:none" d="m42.409 24.387c0 10.384-8.4184 18.803-18.801 18.803-10.384 0-18.802-8.4184-18.802-18.803 0-10.384 8.418-18.801 18.802-18.801 10.383 0 18.801 8.4175 18.801 18.801z"/>
1735- </g>
1736- <g id="g2414" transform="matrix(.99991 -.013701 .013701 .99991 -.28870 .53585)">
1737- <path id="path3970" style="stroke-linejoin:round;fill-rule:evenodd;stroke:#666;fill:url(#radialGradient2418)" d="m30.5 20.937 17 16.5-7.75 0.25s3.25 6.75 3.25 6.75c1 3-3.5 4.125-4.25 1.875l-3-6.75-5.5 5.875 0.25-24.5z"/>
1738- <path id="path4853" style="opacity:.4;stroke:#fff;fill:none" d="m31.657 23.379 13.476 13.186-6.9219 0.27746l3.8721 7.7566c0.40273 1.6501-2.0283 2.4126-2.5071 1.1529l-3.6831-7.845-4.4247 4.7083 0.18907-19.236z"/>
1739- </g>
1740- </g>
1741-</svg>
1742
1743=== removed file 'Ubuntu/Settings/Menus/artwork/default_contact.png'
1744Binary files Ubuntu/Settings/Menus/artwork/default_contact.png 2013-10-04 09:48:04 +0000 and Ubuntu/Settings/Menus/artwork/default_contact.png 1970-01-01 00:00:00 +0000 differ
1745=== removed file 'Ubuntu/Settings/Menus/artwork/secure.svg'
1746--- Ubuntu/Settings/Menus/artwork/secure.svg 2013-10-04 09:48:04 +0000
1747+++ Ubuntu/Settings/Menus/artwork/secure.svg 1970-01-01 00:00:00 +0000
1748@@ -1,71 +0,0 @@
1749-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
1750-<!-- Created with Inkscape (http://www.inkscape.org/) -->
1751-
1752-<svg
1753- xmlns:dc="http://purl.org/dc/elements/1.1/"
1754- xmlns:cc="http://creativecommons.org/ns#"
1755- xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
1756- xmlns:svg="http://www.w3.org/2000/svg"
1757- xmlns="http://www.w3.org/2000/svg"
1758- xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
1759- xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
1760- width="64"
1761- height="64"
1762- id="svg2986"
1763- version="1.1"
1764- inkscape:version="0.48.4 r9939"
1765- sodipodi:docname="secure.svg">
1766- <defs
1767- id="defs2988" />
1768- <sodipodi:namedview
1769- id="base"
1770- pagecolor="#ffffff"
1771- bordercolor="#666666"
1772- borderopacity="1.0"
1773- inkscape:pageopacity="0.0"
1774- inkscape:pageshadow="2"
1775- inkscape:zoom="7.9180415"
1776- inkscape:cx="7.5048745"
1777- inkscape:cy="29.401628"
1778- inkscape:current-layer="layer1"
1779- showgrid="true"
1780- inkscape:grid-bbox="true"
1781- inkscape:document-units="px"
1782- inkscape:snap-grids="false"
1783- inkscape:window-width="1549"
1784- inkscape:window-height="876"
1785- inkscape:window-x="51"
1786- inkscape:window-y="24"
1787- inkscape:window-maximized="1">
1788- <inkscape:grid
1789- type="xygrid"
1790- id="grid3012"
1791- empspacing="5"
1792- visible="true"
1793- enabled="true"
1794- snapvisiblegridlinesonly="true" />
1795- </sodipodi:namedview>
1796- <metadata
1797- id="metadata2991">
1798- <rdf:RDF>
1799- <cc:Work
1800- rdf:about="">
1801- <dc:format>image/svg+xml</dc:format>
1802- <dc:type
1803- rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
1804- <dc:title />
1805- </cc:Work>
1806- </rdf:RDF>
1807- </metadata>
1808- <g
1809- id="layer1"
1810- inkscape:label="Layer 1"
1811- inkscape:groupmode="layer"
1812- transform="translate(0,32)">
1813- <path
1814- inkscape:connector-curvature="0"
1815- d="M 29.999999,-18 C 25.568001,-18 22,-14.432 22,-10 v 6 h -2 c -1.107999,0 -2,0.892 -2,2 v 18 c 0,1.108 0.892001,2 2,2 h 24 c 1.108,0 2,-0.892 2,-2 V -2 c 0,-1.108 -0.892,-2 -2,-2 h -2 v -6 c 0,-4.432 -3.568001,-8 -8.000001,-8 h -4 z m 0,4 h 4 c 2.216,0 4,1.784 4,4 v 6 H 26.000001 v -6 c 0,-2.216 1.784,-4 3.999998,-4 z"
1816- style="fill:#dfdbd2;fill-rule:evenodd"
1817- id="path8" />
1818- </g>
1819-</svg>
1820
1821=== modified file 'Ubuntu/Settings/Menus/qmldir'
1822--- Ubuntu/Settings/Menus/qmldir 2014-07-04 14:06:04 +0000
1823+++ Ubuntu/Settings/Menus/qmldir 2014-07-31 16:42:23 +0000
1824@@ -14,7 +14,7 @@
1825 ProgressValueMenu 0.1 ProgressValueMenu.qml
1826 SectionMenu 0.1 SectionMenu.qml
1827 SeparatorMenu 0.1 SeparatorMenu.qml
1828-SimpleTextMessageMenu 0.1 SimpleTextMessageMenu.qml
1829+SimpleMessageMenu 0.1 SimpleMessageMenu.qml
1830 SliderMenu 0.1 SliderMenu.qml
1831 SnapDecisionMenu 0.1 SnapDecisionMenu.qml
1832 StandardMenu 0.1 StandardMenu.qml
1833@@ -23,5 +23,3 @@
1834 TimeZoneMenu 0.1 TimeZoneMenu.qml
1835 TransferMenu 0.1 TransferMenu.qml
1836 UserSessionMenu 0.1 UserSessionMenu.qml
1837-
1838-internal HeroMessageMenu HeroMessageMenu.qml
1839
1840=== modified file 'cmake/modules/QmlTest.cmake'
1841--- cmake/modules/QmlTest.cmake 2013-09-24 10:04:36 +0000
1842+++ cmake/modules/QmlTest.cmake 2014-07-31 16:42:23 +0000
1843@@ -20,12 +20,13 @@
1844 # qmltest_DEFAULT_PROPERTIES
1845
1846 find_program(qmltestrunner_exe qmltestrunner)
1847-find_program(qmlscene_exe qmlscene)
1848
1849 if(NOT qmltestrunner_exe)
1850 msg(FATAL_ERROR "Could not locate qmltestrunner.")
1851 endif()
1852
1853+set(qmlscene_exe ${CMAKE_BINARY_DIR}/tests/uqmlscene/uqmlscene)
1854+
1855 macro(add_manual_qml_test SUBPATH COMPONENT_NAME)
1856 set(options NO_ADD_TEST NO_TARGETS)
1857 set(multi_value_keywords IMPORT_PATHS TARGETS PROPERTIES ENVIRONMENT)
1858@@ -50,20 +51,29 @@
1859
1860 set(qmlscene_command
1861 env ${qmltest_ENVIRONMENT}
1862- ${qmlscene_exe} ${CMAKE_CURRENT_SOURCE_DIR}/${qmltest_FILE}.qml
1863+ ${qmlscene_exe} -qmljsdebugger=port:3768 ${CMAKE_CURRENT_SOURCE_DIR}/${qmltest_FILE}.qml
1864 ${qmlscene_imports}
1865 )
1866 add_custom_target(${qmlscene_TARGET} ${qmlscene_command})
1867
1868 endmacro(add_manual_qml_test)
1869
1870+macro(add_qml_benchmark SUBPATH COMPONENT_NAME ITERATIONS)
1871+ add_qml_test_internal(${SUBPATH} ${COMPONENT_NAME} ${ITERATIONS} ${ARGN})
1872+endmacro(add_qml_benchmark)
1873+
1874 macro(add_qml_test SUBPATH COMPONENT_NAME)
1875+ add_qml_test_internal(${SUBPATH} ${COMPONENT_NAME} 0 ${ARGN})
1876+endmacro(add_qml_test)
1877+
1878+macro(add_qml_test_internal SUBPATH COMPONENT_NAME ITERATIONS)
1879 set(options NO_ADD_TEST NO_TARGETS)
1880 set(multi_value_keywords IMPORT_PATHS TARGETS PROPERTIES ENVIRONMENT)
1881
1882 cmake_parse_arguments(qmltest "${options}" "" "${multi_value_keywords}" ${ARGN})
1883
1884 set(qmltest_TARGET test${COMPONENT_NAME})
1885+ set(qmltest_xvfb_TARGET xvfbtest${COMPONENT_NAME})
1886 set(qmltest_FILE ${SUBPATH}/tst_${COMPONENT_NAME})
1887
1888 set(qmltestrunner_imports "")
1889@@ -79,13 +89,76 @@
1890 endforeach(IMPORT_PATH)
1891 endif()
1892
1893+ string(TOLOWER "${CMAKE_GENERATOR}" cmake_generator_lower)
1894+ if(cmake_generator_lower STREQUAL "unix makefiles")
1895+ set(function_ARGS $(FUNCTION))
1896+ else()
1897+ set(function_ARGS "")
1898+ endif()
1899+
1900+ if (${ITERATIONS} GREATER 0)
1901+ set(ITERATIONS_STRING "-iterations" ${ITERATIONS})
1902+ else()
1903+ set(ITERATIONS_STRING "")
1904+ endif()
1905+
1906 set(qmltest_command
1907 env ${qmltest_ENVIRONMENT}
1908 ${qmltestrunner_exe} -input ${CMAKE_CURRENT_SOURCE_DIR}/${qmltest_FILE}.qml
1909 ${qmltestrunner_imports}
1910- -o ${CMAKE_BINARY_DIR}/${qmltest_TARGET}.xml,xunitxml
1911- -o -,txt
1912- )
1913+ ${ITERATIONS_STRING}
1914+ -o ${CMAKE_BINARY_DIR}/${qmltest_TARGET}.xml,xunitxml
1915+ -o -,txt
1916+ ${function_ARGS}
1917+ )
1918+ find_program(DPKG dpkg-architecture)
1919+ if(DPKG)
1920+ exec_program(${DPKG} ARGS "-qDEB_BUILD_MULTIARCH" OUTPUT_VARIABLE ARCH_TRIPLET )
1921+ set(LD_PRELOAD_PATH "LD_PRELOAD=/usr/lib/${ARCH_TRIPLET}/mesa/libGL.so.1")
1922+ endif()
1923+ set(qmltest_xvfb_command
1924+ env ${qmltest_ENVIRONMENT} ${LD_PRELOAD_PATH}
1925+ xvfb-run --server-args "-screen 0 1024x768x24" --auto-servernum
1926+ ${qmltestrunner_exe} -input ${CMAKE_CURRENT_SOURCE_DIR}/${qmltest_FILE}.qml
1927+ ${qmltestrunner_imports}
1928+ -o ${CMAKE_BINARY_DIR}/${qmltest_TARGET}.xml,xunitxml
1929+ -o -,txt
1930+ ${function_ARGS}
1931+ )
1932+
1933+ add_qmltest_target(${qmltest_TARGET} "${qmltest_command}" TRUE ${qmltest_NO_ADD_TEST})
1934+ add_qmltest_target(${qmltest_xvfb_TARGET} "${qmltest_xvfb_command}" ${qmltest_NO_TARGETS} TRUE)
1935+ add_manual_qml_test(${SUBPATH} ${COMPONENT_NAME} ${ARGN})
1936+endmacro(add_qml_test_internal)
1937+
1938+macro(add_binary_qml_test CLASS_NAME LD_PATH DEPS)
1939+ set(testCommand
1940+ LD_LIBRARY_PATH=${LD_PATH}
1941+ ${CMAKE_CURRENT_BINARY_DIR}/${CLASS_NAME}TestExec
1942+ -o ${CMAKE_BINARY_DIR}/${CLASSNAME}Test.xml,xunitxml
1943+ -o -,txt)
1944+
1945+ add_qmltest_target(test${CLASS_NAME} "${testCommand}" FALSE TRUE)
1946+ add_dependencies(test${CLASS_NAME} ${CLASS_NAME}TestExec ${DEPS})
1947+
1948+ find_program( HAVE_GCC gcc )
1949+ if (NOT ${HAVE_GCC} STREQUAL "")
1950+ exec_program( gcc ARGS "-dumpmachine" OUTPUT_VARIABLE ARCH_TRIPLET )
1951+ set(LD_PRELOAD_PATH "LD_PRELOAD=/usr/lib/${ARCH_TRIPLET}/mesa/libGL.so.1")
1952+ endif()
1953+ set(xvfbtestCommand
1954+ ${LD_PRELOAD_PATH}
1955+ LD_LIBRARY_PATH=${LD_PATH}
1956+ xvfb-run --server-args "-screen 0 1024x768x24" --auto-servernum
1957+ ${CMAKE_CURRENT_BINARY_DIR}/${CLASS_NAME}TestExec
1958+ -o ${CMAKE_BINARY_DIR}/${CLASS_NAME}Test.xml,xunitxml
1959+ -o -,txt)
1960+
1961+ add_qmltest_target(xvfbtest${CLASS_NAME} "${xvfbtestCommand}" FALSE TRUE)
1962+ add_dependencies(qmluitests xvfbtest${CLASS_NAME})
1963+endmacro(add_binary_qml_test)
1964+
1965+macro(add_qmltest_target qmltest_TARGET qmltest_command qmltest_NO_TARGETS qmltest_NO_ADD_TEST)
1966 add_custom_target(${qmltest_TARGET} ${qmltest_command})
1967
1968 if(NOT "${qmltest_PROPERTIES}" STREQUAL "")
1969@@ -116,5 +189,4 @@
1970 endif()
1971 endif("${qmltest_NO_TARGETS}" STREQUAL "FALSE")
1972
1973- add_manual_qml_test(${SUBPATH} ${COMPONENT_NAME} ${ARGN})
1974-endmacro(add_qml_test)
1975+endmacro(add_qmltest_target)
1976
1977=== added directory 'examples'
1978=== added file 'examples/CMakeLists.txt'
1979--- examples/CMakeLists.txt 1970-01-01 00:00:00 +0000
1980+++ examples/CMakeLists.txt 2014-07-31 16:42:23 +0000
1981@@ -0,0 +1,2 @@
1982+file(GLOB QML_JS_FILES *.qml *.js)
1983+add_custom_target( ExampleQmlFiles SOURCES ${QML_JS_FILES} )
1984
1985=== added file 'examples/MessageComponents.qml'
1986--- examples/MessageComponents.qml 1970-01-01 00:00:00 +0000
1987+++ examples/MessageComponents.qml 2014-07-31 16:42:23 +0000
1988@@ -0,0 +1,113 @@
1989+/*
1990+ * Copyright 2014 Canonical Ltd.
1991+ *
1992+ * This program is free software; you can redistribute it and/or modify
1993+ * it under the terms of the GNU Lesser General Public License as published by
1994+ * the Free Software Foundation; version 3.
1995+ *
1996+ * This program is distributed in the hope that it will be useful,
1997+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1998+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1999+ * GNU Lesser General Public License for more details.
2000+ *
2001+ * You should have received a copy of the GNU Lesser General Public License
2002+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
2003+ *
2004+ * Authored by Andrea Cimitan <andrea.cimitan@canonical.com>
2005+ */
2006+
2007+import QtQuick 2.0
2008+import Ubuntu.Components 0.1
2009+import Ubuntu.Settings.Components 0.1
2010+import Ubuntu.Settings.Menus 0.1
2011+
2012+Item {
2013+ property string title: "MessageComponents"
2014+
2015+ ListModel {
2016+ id: model
2017+ ListElement {
2018+ type: "text"
2019+ title: "Text Message"
2020+ body: "I am a little teacup, short and stout. Here is my handle, and here is my spout. Who are you talking about my spout?! This should be truncated"
2021+ time: "Sat 31 Oct, 11:00"
2022+ icon: "image://theme/message"
2023+ avatar: "artwork/farm.jpg"
2024+ }
2025+ ListElement {
2026+ type: "simple"
2027+ title: "Simple Text Message Simple"
2028+ body: "I happen to be tall and thin! But let's try a new line"
2029+ time: "Yesterday, 10:00"
2030+ icon: "image://theme/message"
2031+ avatar: "artwork/beach.jpg"
2032+ }
2033+ ListElement {
2034+ type: "snap"
2035+ title: "Snap Decision"
2036+ body: "My mother says I'm handsome!"
2037+ time: "10:30am"
2038+ icon: "image://theme/missed-call"
2039+ avatar: "artwork/night.jpg"
2040+ }
2041+ }
2042+
2043+ ListView {
2044+ model: model
2045+ anchors.fill: parent
2046+
2047+ cacheBuffer: 10000
2048+
2049+ delegate: Loader {
2050+ anchors {
2051+ left: parent.left
2052+ right: parent.right
2053+ }
2054+ asynchronous: true
2055+ sourceComponent: model.type === "simple" ? simple :
2056+ model.type === "text" ? text :
2057+ model.type === "snap" ? snap : undefined
2058+
2059+ Component {
2060+ id: simple
2061+ SimpleMessageMenu {
2062+ avatar: model.avatar
2063+ icon: model.icon
2064+ title: model.title
2065+ body: model.body
2066+ time: model.time
2067+ }
2068+ }
2069+
2070+ Component {
2071+ id: text
2072+ TextMessageMenu {
2073+ avatar: model.avatar
2074+ icon: model.icon
2075+ title: model.title
2076+ body: model.body
2077+ time: model.time
2078+
2079+ onTriggered: {
2080+ selected = !selected;
2081+ }
2082+ }
2083+ }
2084+
2085+ Component {
2086+ id: snap
2087+ SnapDecisionMenu {
2088+ avatar: model.avatar
2089+ icon: model.icon
2090+ title: model.title
2091+ body: model.body
2092+ time: model.time
2093+
2094+ onTriggered: {
2095+ selected = !selected;
2096+ }
2097+ }
2098+ }
2099+ }
2100+ }
2101+}
2102
2103=== added file 'examples/OtherComponents.qml'
2104--- examples/OtherComponents.qml 1970-01-01 00:00:00 +0000
2105+++ examples/OtherComponents.qml 2014-07-31 16:42:23 +0000
2106@@ -0,0 +1,234 @@
2107+/*
2108+ * Copyright 2013 Canonical Ltd.
2109+ *
2110+ * This program is free software; you can redistribute it and/or modify
2111+ * it under the terms of the GNU Lesser General Public License as published by
2112+ * the Free Software Foundation; version 3.
2113+ *
2114+ * This program is distributed in the hope that it will be useful,
2115+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
2116+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2117+ * GNU Lesser General Public License for more details.
2118+ *
2119+ * You should have received a copy of the GNU Lesser General Public License
2120+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
2121+ *
2122+ * Authored by Andrea Cimitan <andrea.cimitan@canonical.com>
2123+ */
2124+
2125+import QtQuick 2.0
2126+import Ubuntu.Components 0.1
2127+import Ubuntu.Settings.Components 0.1
2128+import Ubuntu.Settings.Menus 0.1
2129+
2130+Item {
2131+ property string title: "Settings Components"
2132+
2133+ ListModel {
2134+ id: mediaPlayerModel
2135+ ListElement { song: "Mine"; artist: "Taylor Swift"; album: "Speak Now"; albumArt: "../tests/artwork/speak-now.jpg"}
2136+ ListElement { song: "Stony Ground"; artist: "Richard Thompson"; album: "Electric"; albumArt: "../tests/artwork/electric.jpg"}
2137+ ListElement { song: "Los Robots"; artist: "Kraftwerk"; album: "The Man-Machine"; albumArt: "../tests/artwork/the-man-machine.jpg"}
2138+ }
2139+
2140+ ListModel {
2141+ id: timeZoneModel
2142+ ListElement { city: "San Francisco"; time: "3:00am" }
2143+ ListElement { city: "London"; time: "11:00am" }
2144+ ListElement { city: "Rome"; time: "12:00am" }
2145+ }
2146+
2147+ ListModel {
2148+ id: eventModel
2149+ ListElement { icon: "image://theme/calendar"; eventColor: "yellow"; text: "Lunch with Lola"; time: "1:10 PM" }
2150+ ListElement { icon: "image://theme/calendar"; eventColor: "green"; text: "Gym"; time: "6:30 PM" }
2151+ ListElement { icon: "image://theme/calendar"; eventColor: "red"; text: "Birthday Party"; time: "9:00 PM" }
2152+ }
2153+
2154+ Flickable {
2155+ id: flickable
2156+
2157+ anchors.fill: parent
2158+ contentWidth: column.width
2159+ contentHeight: column.height
2160+
2161+ Column {
2162+ id: column
2163+
2164+ width: flickable.width
2165+ height: childrenRect.height
2166+
2167+ StandardMenu {
2168+ text: i18n.tr("Standard Menu\nLook at me, I'm a new line.")
2169+ }
2170+
2171+ StandardMenu {
2172+ iconSource: "image://theme/calendar"
2173+ iconColor: "red"
2174+ text: i18n.tr("Standard Menu")
2175+ component: Component {
2176+ Button {
2177+ text: "Press Me"
2178+ }
2179+ }
2180+ backColor: Qt.rgba(1,1,1,0.1)
2181+ }
2182+
2183+ SliderMenu {
2184+ id: slider
2185+ text: i18n.tr("Slider")
2186+ minimumValue: 0
2187+ maximumValue: 100
2188+ value: 20
2189+
2190+ minIcon: "image://theme/audio-volume-low"
2191+ maxIcon: "image://theme/audio-volume-high"
2192+ }
2193+
2194+ ProgressBarMenu {
2195+ text: i18n.tr("ProgressBar")
2196+ value: slider.value
2197+ minimumValue: 0
2198+ maximumValue: 100
2199+ }
2200+
2201+ ProgressValueMenu {
2202+ text: i18n.tr("ProgressValue")
2203+ value: slider.value
2204+ }
2205+
2206+ ButtonMenu {
2207+ text: i18n.tr("Button")
2208+ buttonText: i18n.tr("Hello world!")
2209+ }
2210+
2211+ CheckableMenu {
2212+ text: i18n.tr("Checkable")
2213+ checked: true
2214+ }
2215+
2216+ SwitchMenu {
2217+ text: i18n.tr("Switch")
2218+ checked: true
2219+ }
2220+
2221+ SectionMenu {
2222+ text: i18n.tr("Section Starts Here")
2223+ busy: true
2224+ }
2225+
2226+ SeparatorMenu {}
2227+
2228+ CalendarMenu {
2229+ id: calendar
2230+ }
2231+
2232+ UserSessionMenu {
2233+ name: i18n.tr("Lola Chang")
2234+ iconSource: Qt.resolvedUrl("../tests/artwork/avatar.png")
2235+ active: true
2236+ }
2237+
2238+ MediaPlayerMenu {
2239+ id: mediaPlayer
2240+ property int index: 0
2241+
2242+ playerName: "Rhythmbox"
2243+ playerIcon: Qt.resolvedUrl("../tests/artwork/rhythmbox.png")
2244+ song: mediaPlayerModel.get(index).song;
2245+ artist: mediaPlayerModel.get(index).artist;
2246+ album: mediaPlayerModel.get(index).album;
2247+ albumArt: mediaPlayerModel.get(index).albumArt;
2248+ }
2249+
2250+ PlaybackItemMenu {
2251+ canPlay: true
2252+ canGoNext: mediaPlayer.index < mediaPlayerModel.count - 1
2253+ canGoPrevious: mediaPlayer.index > 0
2254+ playing: mediaPlayer.running
2255+
2256+ onPrevious: mediaPlayer.index = Math.max(mediaPlayer.index - 1, 0)
2257+ onNext: mediaPlayer.index = Math.min(mediaPlayer.index + 1, mediaPlayerModel.count - 1)
2258+ onPlay: { mediaPlayer.running = !mediaPlayer.running; }
2259+ }
2260+
2261+ AccessPointMenu {
2262+ active: true
2263+ secure: true
2264+ adHoc: false
2265+ signalStrength: 50
2266+ text: "Access Point"
2267+
2268+ onTriggered: active = !active
2269+ }
2270+
2271+ GroupedMessageMenu {
2272+ text: "Group Message"
2273+ count: "4100"
2274+ }
2275+
2276+ Column {
2277+ anchors {
2278+ left: parent.left
2279+ right: parent.right
2280+ }
2281+
2282+ Repeater {
2283+ model: timeZoneModel
2284+
2285+ TimeZoneMenu {
2286+ city: model.city
2287+ time: model.time
2288+ }
2289+ }
2290+ }
2291+
2292+ Column {
2293+ anchors {
2294+ left: parent.left
2295+ right: parent.right
2296+ }
2297+
2298+ Repeater {
2299+ model: eventModel
2300+
2301+ EventMenu {
2302+ iconSource: model.icon
2303+ text: model.text
2304+ eventColor: model.eventColor
2305+ time: model.time
2306+ }
2307+ }
2308+ }
2309+
2310+ Row {
2311+ anchors {
2312+ left: parent.left
2313+ right: parent.right
2314+ }
2315+
2316+ spacing: units.gu(1)
2317+
2318+ Label {
2319+ text: "StatusIcon"
2320+ anchors.verticalCenter: parent.verticalCenter
2321+ }
2322+
2323+ StatusIcon {
2324+ height: units.gu(5)
2325+ source: "image://theme/gps"
2326+ }
2327+
2328+ StatusIcon {
2329+ height: units.gu(5)
2330+ source: "image://theme/battery-caution"
2331+ }
2332+
2333+ StatusIcon {
2334+ height: units.gu(5)
2335+ source: "image://theme/missing,gpm-battery-000-charging"
2336+ }
2337+ }
2338+ }
2339+ }
2340+}
2341
2342=== renamed file 'SettingsComponents.qml' => 'examples/SettingsComponents.qml'
2343--- SettingsComponents.qml 2014-07-04 14:07:50 +0000
2344+++ examples/SettingsComponents.qml 2014-07-31 16:42:23 +0000
2345@@ -22,270 +22,45 @@
2346 import Ubuntu.Settings.Menus 0.1
2347
2348 MainView {
2349+ id: mainView
2350 // Note! applicationName needs to match the .desktop filename
2351 applicationName: "SettingsComponents"
2352
2353 width: units.gu(42)
2354 height: units.gu(75)
2355
2356- ListModel {
2357- id: mediaPlayerModel
2358- ListElement { song: "Mine"; artist: "Taylor Swift"; album: "Speak Now"; albumArt: "tests/artwork/speak-now.jpg"}
2359- ListElement { song: "Stony Ground"; artist: "Richard Thompson"; album: "Electric"; albumArt: "tests/artwork/electric.jpg"}
2360- ListElement { song: "Los Robots"; artist: "Kraftwerk"; album: "The Man-Machine"; albumArt: "tests/artwork/the-man-machine.jpg"}
2361- }
2362-
2363- ListModel {
2364- id: timeZoneModel
2365- ListElement { city: "San Francisco"; time: "3:00am" }
2366- ListElement { city: "London"; time: "11:00am" }
2367- ListElement { city: "Rome"; time: "12:00am" }
2368- }
2369-
2370- ListModel {
2371- id: eventModel
2372- ListElement { icon: "image://theme/calendar"; eventColor: "yellow"; text: "Lunch with Lola"; time: "1:10 PM" }
2373- ListElement { icon: "image://theme/calendar"; eventColor: "green"; text: "Gym"; time: "6:30 PM" }
2374- ListElement { icon: "image://theme/calendar"; eventColor: "red"; text: "Birthday Party"; time: "9:00 PM" }
2375+ Component.onCompleted: {
2376+ Theme.name = "Ubuntu.Components.Themes.SuruGradient"
2377+ }
2378+
2379+ ListModel {
2380+ id: pages
2381+ ListElement { source: "OtherComponents.qml" }
2382+ ListElement { source: "MessageComponents.qml" }
2383+ ListElement { source: "TransferComponents.qml" }
2384 }
2385
2386 Page {
2387- title: "SettingsComponents"
2388-
2389- Flickable {
2390- id: flickable
2391-
2392+ title: listView.currentItem ? listView.currentItem.item.title : "Components"
2393+ clip: true
2394+
2395+ ListView {
2396+ id: listView
2397+ model: pages
2398 anchors.fill: parent
2399- contentWidth: column.width
2400- contentHeight: column.height
2401-
2402- Column {
2403- id: column
2404-
2405- width: flickable.width
2406- height: childrenRect.height
2407-
2408- StandardMenu {
2409- text: i18n.tr("Standard Menu\nLook at me, I'm a new line.")
2410- }
2411-
2412- StandardMenu {
2413- iconSource: "image://theme/calendar"
2414- iconColor: "red"
2415- text: i18n.tr("Standard Menu")
2416- component: Component {
2417- Button {
2418- text: "Press Me"
2419- }
2420- }
2421- }
2422-
2423-
2424- SliderMenu {
2425- id: slider
2426- text: i18n.tr("Slider")
2427- minimumValue: 0
2428- maximumValue: 100
2429- value: 20
2430-
2431- minIcon: "image://theme/audio-volume-low"
2432- maxIcon: "image://theme/audio-volume-high"
2433- }
2434-
2435- ProgressBarMenu {
2436- text: i18n.tr("ProgressBar")
2437- value: slider.value
2438- minimumValue: 0
2439- maximumValue: 100
2440- }
2441-
2442- ProgressValueMenu {
2443- text: i18n.tr("ProgressValue")
2444- value: slider.value
2445- }
2446-
2447- ButtonMenu {
2448- text: i18n.tr("Button")
2449- buttonText: i18n.tr("Hello world!")
2450- }
2451-
2452- CheckableMenu {
2453- text: i18n.tr("Checkable")
2454- checked: true
2455- }
2456-
2457- SwitchMenu {
2458- text: i18n.tr("Switch")
2459- checked: true
2460- }
2461-
2462- SectionMenu {
2463- text: i18n.tr("Section Starts Here")
2464- busy: true
2465- }
2466-
2467- SeparatorMenu {}
2468-
2469- CalendarMenu {
2470- id: calendar
2471- }
2472-
2473- UserSessionMenu {
2474- name: i18n.tr("Lola Chang")
2475- iconSource: Qt.resolvedUrl("tests/artwork/avatar.png")
2476- active: true
2477- }
2478-
2479- MediaPlayerMenu {
2480- id: mediaPlayer
2481- property int index: 0
2482-
2483- playerName: "Rhythmbox"
2484- playerIcon: Qt.resolvedUrl("tests/artwork/rhythmbox.png")
2485- song: mediaPlayerModel.get(index).song;
2486- artist: mediaPlayerModel.get(index).artist;
2487- album: mediaPlayerModel.get(index).album;
2488- albumArt: mediaPlayerModel.get(index).albumArt;
2489- }
2490-
2491- PlaybackItemMenu {
2492- canPlay: true
2493- canGoNext: true
2494- canGoPrevious: true
2495- playing: mediaPlayer.running
2496-
2497- onPrevious: mediaPlayer.index = Math.max(mediaPlayer.index - 1, 0)
2498- onNext: mediaPlayer.index = Math.min(mediaPlayer.index + 1, mediaPlayerModel.count - 1)
2499- onPlay: { mediaPlayer.running = !mediaPlayer.running; }
2500- }
2501-
2502- TransferMenu {
2503- text: "Video Downloading"
2504- stateText: "3 minutes remaning"
2505- iconSource: "tests/artwork/speak-now.jpg"
2506- progress: 0.6
2507- active: true
2508- removable: true
2509- confirmRemoval: true
2510- }
2511-
2512- TransferMenu {
2513- text: "Video Downloading"
2514- iconSource: "tests/artwork/speak-now.jpg"
2515- progress: 0.6
2516- active: false
2517- removable: true
2518- confirmRemoval: true
2519- }
2520-
2521- AccessPointMenu {
2522- checked: true
2523- secure: true
2524- adHoc: false
2525- signalStrength: 50
2526- text: "Access Point"
2527- }
2528-
2529- GroupedMessageMenu {
2530- text: "Group Message"
2531- count: "4"
2532- }
2533-
2534- SnapDecisionMenu {
2535- title: "Snap Decision"
2536- time: "10:30am"
2537- message: "My mother says I'm handsome!"
2538-
2539- replyMessages: ["Yeah right", "Sure she did"]
2540-
2541- onTriggered: {
2542- selected = !selected;
2543- }
2544- }
2545-
2546- SimpleTextMessageMenu {
2547- title: "Simple Text Message"
2548- time: "11am"
2549- message: "I am a little teacup"
2550-
2551- onTriggered: {
2552- selected = !selected;
2553- }
2554- }
2555-
2556- TextMessageMenu {
2557- title: "Text Message"
2558- time: "11am"
2559- message: "I happen to be tall and thin!"
2560-
2561- onTriggered: {
2562- selected = !selected;
2563- }
2564- }
2565-
2566- Column {
2567- anchors {
2568- left: parent.left
2569- right: parent.right
2570- }
2571-
2572- Repeater {
2573- model: timeZoneModel
2574-
2575- TimeZoneMenu {
2576- city: model.city
2577- time: model.time
2578- }
2579- }
2580- }
2581-
2582- Column {
2583- anchors {
2584- left: parent.left
2585- right: parent.right
2586- }
2587-
2588- Repeater {
2589- model: eventModel
2590-
2591- EventMenu {
2592- iconSource: model.icon
2593- text: model.text
2594- eventColor: model.eventColor
2595- time: model.time
2596- }
2597- }
2598- }
2599-
2600- Row {
2601- anchors {
2602- left: parent.left
2603- right: parent.right
2604- }
2605-
2606- spacing: units.gu(1)
2607-
2608- Label {
2609- text: "StatusIcon"
2610- anchors.verticalCenter: parent.verticalCenter
2611- }
2612-
2613- StatusIcon {
2614- height: units.gu(5)
2615- source: "image://theme/gps"
2616- }
2617-
2618- StatusIcon {
2619- height: units.gu(5)
2620- source: "image://theme/battery-caution"
2621- }
2622-
2623- StatusIcon {
2624- height: units.gu(5)
2625- source: "image://theme/missing,gpm-battery-000-charging"
2626- }
2627- }
2628+
2629+ orientation: ListView.Horizontal
2630+ snapMode: ListView.SnapOneItem
2631+ highlightRangeMode: ListView.StrictlyEnforceRange
2632+ boundsBehavior: Flickable.StopAtBounds
2633+
2634+ delegate: Loader {
2635+ width: ListView.view.width
2636+ height: ListView.view.height
2637+
2638+ source: model.source
2639 }
2640 }
2641+
2642 }
2643 }
2644
2645=== added file 'examples/TransferComponents.qml'
2646--- examples/TransferComponents.qml 1970-01-01 00:00:00 +0000
2647+++ examples/TransferComponents.qml 2014-07-31 16:42:23 +0000
2648@@ -0,0 +1,81 @@
2649+/*
2650+* Copyright 2014 Canonical Ltd.
2651+*
2652+* This program is free software; you can redistribute it and/or modify
2653+* it under the terms of the GNU Lesser General Public License as published by
2654+* the Free Software Foundation; version 3.
2655+*
2656+* This program is distributed in the hope that it will be useful,
2657+* but WITHOUT ANY WARRANTY; without even the implied warranty of
2658+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2659+* GNU Lesser General Public License for more details.
2660+*
2661+* You should have received a copy of the GNU Lesser General Public License
2662+* along with this program. If not, see <http://www.gnu.org/licenses/>.
2663+*
2664+* Authored by Andrea Cimitan <andrea.cimitan@canonical.com>
2665+*/
2666+
2667+import QtQuick 2.0
2668+import Ubuntu.Components 0.1
2669+import Ubuntu.Settings.Components 0.1
2670+import Ubuntu.Settings.Menus 0.1
2671+
2672+Item {
2673+ property string title: "Transfer Components"
2674+
2675+ ListModel {
2676+ id: model
2677+ ListElement {
2678+ text: "File name here"
2679+ state: "Starting…"
2680+ progress: 0
2681+ image: "image://theme/video-x-generic-symbolic"
2682+ active: true
2683+ }
2684+ ListElement {
2685+ text: "proposition.pdf"
2686+ state: "10 seconds remaining"
2687+ progress: 0.7
2688+ image: "../tests/artwork/the-man-machine.jpg"
2689+ active: true
2690+ }
2691+ ListElement {
2692+ text: "electric.jpg"
2693+ state: "Failed, tap to retry"
2694+ progress: 1.0
2695+ image: "../tests/artwork/electric.jpg"
2696+ active: true
2697+ }
2698+ ListElement {
2699+ text: "clubbing-friday.jpg.jpg"
2700+ state: "no state"
2701+ progress: 0.4
2702+ image: "../tests/artwork/speak-now.jpg"
2703+ active: false
2704+ }
2705+ }
2706+
2707+ ListView {
2708+ model: model
2709+ anchors.fill: parent
2710+
2711+ cacheBuffer: 10000
2712+
2713+ delegate: Loader {
2714+ anchors {
2715+ left: parent.left
2716+ right: parent.right
2717+ }
2718+ asynchronous: true
2719+
2720+ sourceComponent: TransferMenu {
2721+ text: model.text
2722+ stateText: model.state
2723+ progress: model.progress
2724+ iconSource: model.image
2725+ active: model.active
2726+ }
2727+ }
2728+ }
2729+}
2730
2731=== added directory 'examples/artwork'
2732=== added file 'examples/artwork/beach.jpg'
2733Binary files examples/artwork/beach.jpg 1970-01-01 00:00:00 +0000 and examples/artwork/beach.jpg 2014-07-31 16:42:23 +0000 differ
2734=== added file 'examples/artwork/farm.jpg'
2735Binary files examples/artwork/farm.jpg 1970-01-01 00:00:00 +0000 and examples/artwork/farm.jpg 2014-07-31 16:42:23 +0000 differ
2736=== added file 'examples/artwork/insane.jpg'
2737Binary files examples/artwork/insane.jpg 1970-01-01 00:00:00 +0000 and examples/artwork/insane.jpg 2014-07-31 16:42:23 +0000 differ
2738=== added file 'examples/artwork/night.jpg'
2739Binary files examples/artwork/night.jpg 1970-01-01 00:00:00 +0000 and examples/artwork/night.jpg 2014-07-31 16:42:23 +0000 differ
2740=== modified file 'tests/CMakeLists.txt'
2741--- tests/CMakeLists.txt 2013-10-04 10:52:27 +0000
2742+++ tests/CMakeLists.txt 2014-07-31 16:42:23 +0000
2743@@ -8,3 +8,4 @@
2744 add_dependencies(qmltests qmluitests)
2745
2746 add_subdirectory(qmltests)
2747+add_subdirectory(uqmlscene)
2748
2749=== modified file 'tests/qmltests/CMakeLists.txt'
2750--- tests/qmltests/CMakeLists.txt 2014-07-04 14:07:50 +0000
2751+++ tests/qmltests/CMakeLists.txt 2014-07-31 16:42:23 +0000
2752@@ -3,7 +3,7 @@
2753
2754 set(qmltest_DEFAULT_TARGETS qmluitests)
2755 set(qmltest_DEFAULT_NO_ADD_TEST TRUE)
2756-set(qmltest_DEFAULT_PROPERTIES "")
2757+set(qmltest_DEFAULT_PROPERTIES ENVIRONMENT "LC_ALL=C")
2758
2759 set(qmltest_DEFAULT_IMPORT_PATHS
2760 ${CMAKE_BINARY_DIR}
2761@@ -24,7 +24,7 @@
2762 add_qml_test(Menus ProgressBarMenu)
2763 add_qml_test(Menus ProgressValueMenu)
2764 add_qml_test(Menus SectionMenu)
2765-add_qml_test(Menus SimpleTextMessageMenu)
2766+add_qml_test(Menus SimpleMessageMenu)
2767 add_qml_test(Menus SliderMenu)
2768 add_qml_test(Menus SnapDecisionMenu)
2769 add_qml_test(Menus SwitchMenu)
2770@@ -32,3 +32,4 @@
2771 add_qml_test(Menus TextMessageMenu)
2772 add_qml_test(Menus TimeZoneMenu)
2773 add_qml_test(Menus TransferMenu)
2774+
2775
2776=== modified file 'tests/qmltests/Menus/tst_AccessPointMenu.qml'
2777--- tests/qmltests/Menus/tst_AccessPointMenu.qml 2014-03-26 17:50:59 +0000
2778+++ tests/qmltests/Menus/tst_AccessPointMenu.qml 2014-07-31 16:42:23 +0000
2779@@ -47,7 +47,7 @@
2780 id: accessPoint2
2781 anchors.top: accessPoint.bottom
2782
2783- checked: true
2784+ active: true
2785 secure: true
2786 adHoc: true
2787 signalStrength: 50
2788@@ -67,7 +67,7 @@
2789 when: windowShown
2790
2791 function init() {
2792- accessPoint.checked = false;
2793+ accessPoint.active = false;
2794 accessPoint.secure = false;
2795 accessPoint.adHoc = false;
2796 accessPoint.signalStrength = 0;
2797@@ -124,23 +124,5 @@
2798 accessPoint.secure = false;
2799 compare(icon.visible, false, "Secure icon should not be visible when access point is not secure");
2800 }
2801-
2802- function test_checkBox(data) {
2803- var checkBox = UtilsJS.findChild(accessPoint, "checkBox");
2804- verify(checkBox !== undefined);
2805-
2806- accessPoint.checked = true;
2807- compare(checkBox.checked, true, "Checkbox should be checked when access point is checked");
2808-
2809- accessPoint.checked = false;
2810- compare(checkBox.checked, false, "Checkbox should not be checked when access point is not checked");
2811- }
2812-
2813- function test_checkBox_on_default_checked() {
2814- var checkBox = UtilsJS.findChild(accessPoint2, "checkBox");
2815- verify(checkBox !== undefined);
2816-
2817- compare(checkBox.checked, true, "Check box should be checked if default to checked")
2818- }
2819 }
2820 }
2821
2822=== renamed file 'tests/qmltests/Menus/tst_SimpleTextMessageMenu.qml' => 'tests/qmltests/Menus/tst_SimpleMessageMenu.qml'
2823--- tests/qmltests/Menus/tst_SimpleTextMessageMenu.qml 2013-12-13 17:51:57 +0000
2824+++ tests/qmltests/Menus/tst_SimpleMessageMenu.qml 2014-07-31 16:42:23 +0000
2825@@ -19,7 +19,6 @@
2826 import QtQuick 2.0
2827 import QtTest 1.0
2828 import Ubuntu.Test 0.1
2829-import Ubuntu.Components 0.1
2830 import Ubuntu.Settings.Menus 0.1
2831 import "../utils.js" as UtilsJS
2832
2833@@ -40,22 +39,22 @@
2834 width: flickable.width
2835 height: childrenRect.height
2836
2837- SimpleTextMessageMenu {
2838+ SimpleMessageMenu {
2839 id: messageMenu
2840 removable: false
2841
2842 title: "Text Message"
2843+ body: "I am a little teapot"
2844 time: "11:08am"
2845- message: "I am a little teapot"
2846 }
2847
2848- SimpleTextMessageMenu {
2849+ SimpleMessageMenu {
2850 id: messageMenuRemovable
2851 removable: true
2852 anchors.top: messageMenu.bottom
2853 }
2854
2855- TextMessageMenu {
2856+ SimpleMessageMenu {
2857 id: messageMenuSelected
2858 removable: true
2859 anchors.top: messageMenuRemovable.bottom
2860@@ -64,8 +63,8 @@
2861 }
2862
2863 SignalSpy {
2864- id: signalSpyActivateApp
2865- signalName: "appActivated"
2866+ id: signalSpyIconActivated
2867+ signalName: "iconActivated"
2868 target: messageMenuSelected
2869 }
2870
2871@@ -80,7 +79,7 @@
2872 when: windowShown
2873
2874 function init() {
2875- signalSpyActivateApp.clear();
2876+ signalSpyIconActivated.clear();
2877 signalSpyDismiss.clear();
2878 messageMenuSelected.selected = false;
2879 }
2880@@ -110,54 +109,61 @@
2881 function test_time(data) {
2882 messageMenu.time = data.time;
2883
2884- var subtitle = UtilsJS.findChild(messageMenu, "subtitle");
2885- verify(subtitle !== undefined, "No subtitle");
2886- compare(subtitle.text, data.time, "Time does not match set time.");
2887- }
2888-
2889- function test_appIcon_data() {
2890- return [
2891- { appIcon: Qt.resolvedUrl("../../artwork/avatar.png") },
2892- { appIcon: Qt.resolvedUrl("../../artwork/rhythmbox.png") },
2893- ];
2894- }
2895-
2896- function test_appIcon(data) {
2897- messageMenu.appIcon = data.appIcon;
2898-
2899- var appIcon = UtilsJS.findChild(messageMenu, "appIcon");
2900- verify(appIcon !== undefined, "No app icon");
2901- compare(appIcon.source, data.appIcon, "App Icon does not match set icon.");
2902- }
2903-
2904- function test_message_data() {
2905- return [
2906- { message: "This is a test." },
2907- { message: "Test is also a test." },
2908- ];
2909- }
2910-
2911- function test_message(data) {
2912- messageMenu.message = data.message;
2913+ var time = UtilsJS.findChild(messageMenu, "time");
2914+ verify(time !== undefined, "No time");
2915+ compare(time.text, data.time, "Time does not match set time.");
2916+ }
2917+
2918+ function test_avatar_data() {
2919+ return [
2920+ { avatar: Qt.resolvedUrl("../../artwork/avatar.png") },
2921+ { avatar: Qt.resolvedUrl("../../artwork/rhythmbox.png") },
2922+ ];
2923+ }
2924+
2925+ function test_avatar(data) {
2926+ messageMenu.avatar = data.avatar;
2927+
2928+ var avatar = UtilsJS.findChild(messageMenu, "avatar");
2929+ verify(avatar !== undefined, "No avatar");
2930+ compare(avatar.source, data.avatar, "Avatar does not match set avatar.");
2931+ }
2932+
2933+ function test_icon_data() {
2934+ return [
2935+ { icon: Qt.resolvedUrl("../../artwork/avatar.png") },
2936+ { icon: Qt.resolvedUrl("../../artwork/rhythmbox.png") },
2937+ ];
2938+ }
2939+
2940+ function test_icon(data) {
2941+ messageMenu.icon = data.icon;
2942+
2943+ var icon = UtilsJS.findChild(messageMenu, "icon");
2944+ verify(icon !== undefined, "No icon");
2945+ compare(icon.source, data.icon, "Icon does not match set icon.");
2946+ }
2947+
2948+ function test_body_data() {
2949+ return [
2950+ { body: "This is a test." },
2951+ { body: "Test is also a test." },
2952+ ];
2953+ }
2954+
2955+ function test_body(data) {
2956+ messageMenu.body = data.body;
2957
2958 var body = UtilsJS.findChild(messageMenu, "body");
2959 verify(body !== undefined, "No body");
2960- compare(body.text, data.message, "Message does not match set message.");
2961+ compare(body.text, data.body, "Message does not match set message.");
2962 }
2963
2964- function test_activateApp() {
2965- var appIcon = UtilsJS.findChild(messageMenuSelected, "appIcon");
2966-
2967- mouseClick(appIcon, appIcon.width * 2, appIcon.height / 2, Qt.LeftButton, Qt.NoModifier, 0);
2968- compare(signalSpyActivateApp.count, 0, "activate app should not have been triggered");
2969-
2970- messageMenuSelected.selected = false;
2971- mouseClick(appIcon, appIcon.width / 2, appIcon.height / 2, Qt.LeftButton, Qt.NoModifier, 0);
2972- compare(signalSpyActivateApp.count, 0, "activate app should not have been triggered when not selected");
2973-
2974- messageMenuSelected.selected = true;
2975- mouseClick(appIcon, appIcon.width / 2, appIcon.height / 2, Qt.LeftButton, Qt.NoModifier, 0);
2976- compare(signalSpyActivateApp.count > 0, true, "activate app should have been triggered when selected");
2977+ function test_iconActivated() {
2978+ var icon = UtilsJS.findChild(messageMenuSelected, "icon");
2979+
2980+ mouseClick(icon, icon.width / 2, icon.height / 2, Qt.LeftButton, Qt.NoModifier, 0);
2981+ compare(signalSpyIconActivated.count > 0, true, "activate icon should have been triggered");
2982 }
2983
2984 function test_dismiss() {
2985
2986=== modified file 'tests/qmltests/Menus/tst_SnapDecisionMenu.qml'
2987--- tests/qmltests/Menus/tst_SnapDecisionMenu.qml 2013-12-16 12:14:25 +0000
2988+++ tests/qmltests/Menus/tst_SnapDecisionMenu.qml 2014-07-31 16:42:23 +0000
2989@@ -45,8 +45,8 @@
2990 removable: false
2991
2992 title: "Text Message"
2993+ body: "I am a little teapot"
2994 time: "11:08am"
2995- message: "I am a little teapot"
2996 }
2997
2998 SnapDecisionMenu {
2999@@ -71,8 +71,8 @@
3000 property string textMessageReply: ""
3001
3002 SignalSpy {
3003- id: signalSpyActivateApp
3004- signalName: "appActivated"
3005+ id: signalSpyIconActivated
3006+ signalName: "iconActivated"
3007 target: messageMenuSelected
3008 }
3009
3010@@ -83,8 +83,8 @@
3011 }
3012
3013 SignalSpy {
3014- id: signalSpyActivate
3015- signalName: "activated"
3016+ id: signalSpyActionActivated
3017+ signalName: "actionActivated"
3018 target: messageMenuSelected
3019 }
3020
3021@@ -99,9 +99,9 @@
3022 when: windowShown
3023
3024 function init() {
3025- signalSpyActivateApp.clear();
3026+ signalSpyIconActivated.clear();
3027 signalSpyDismiss.clear();
3028- signalSpyActivate.clear();
3029+ signalSpyActionActivated.clear();
3030 signalSpyReply.clear();
3031 textMessageReply = "";
3032
3033@@ -109,6 +109,8 @@
3034 messageMenuSelected.selected = false;
3035 }
3036
3037+
3038+
3039 function test_title_data() {
3040 return [
3041 { title: "title1" },
3042@@ -134,39 +136,71 @@
3043 function test_time(data) {
3044 messageMenu.time = data.time;
3045
3046+ var subtitle = UtilsJS.findChild(messageMenu, "time");
3047+ verify(subtitle !== undefined, "No time");
3048+ compare(subtitle.text, data.time, "Time does not match set time.");
3049+ }
3050+
3051+ function test_avatar_data() {
3052+ return [
3053+ { avatar: Qt.resolvedUrl("../../artwork/avatar.png") },
3054+ { avatar: Qt.resolvedUrl("../../artwork/rhythmbox.png") },
3055+ ];
3056+ }
3057+
3058+ function test_avatar(data) {
3059+ messageMenu.avatar = data.avatar;
3060+
3061+ var avatar = UtilsJS.findChild(messageMenu, "avatar");
3062+ verify(avatar !== undefined, "No avatar");
3063+ compare(avatar.source, data.avatar, "Avatar does not match set avatar.");
3064+ }
3065+
3066+ function test_icon_data() {
3067+ return [
3068+ { icon: Qt.resolvedUrl("../../artwork/avatar.png") },
3069+ { icon: Qt.resolvedUrl("../../artwork/rhythmbox.png") },
3070+ ];
3071+ }
3072+
3073+ function test_icon(data) {
3074+ messageMenu.icon = data.icon;
3075+
3076+ var icon = UtilsJS.findChild(messageMenu, "icon");
3077+ verify(icon !== undefined, "No icon");
3078+ compare(icon.source, data.icon, "Icon does not match set icon.");
3079+ }
3080+
3081+ function test_body_data() {
3082+ return [
3083+ { body: "This is a test." },
3084+ { body: "Test is also a test." },
3085+ ];
3086+ }
3087+
3088+ function test_body(data) {
3089+ messageMenu.body = data.body;
3090+
3091 var body = UtilsJS.findChild(messageMenu, "body");
3092 verify(body !== undefined, "No body");
3093- compare(body.text, data.time, "Time does not match set time.");
3094- }
3095-
3096- function test_appIcon_data() {
3097- return [
3098- { appIcon: Qt.resolvedUrl("../../artwork/avatar.png") },
3099- { appIcon: Qt.resolvedUrl("../../artwork/rhythmbox.png") },
3100- ];
3101- }
3102-
3103- function test_appIcon(data) {
3104- messageMenu.appIcon = data.appIcon;
3105-
3106- var appIcon = UtilsJS.findChild(messageMenu, "appIcon");
3107- verify(appIcon !== undefined, "No app icon");
3108- compare(appIcon.source, data.appIcon, "App Icon does not match set icon.");
3109- }
3110-
3111- function test_message_data() {
3112- return [
3113- { message: "This is a test." },
3114- { message: "Test is also a test." },
3115- ];
3116- }
3117-
3118- function test_message(data) {
3119- messageMenu.message = data.message;
3120-
3121- var subtitle = UtilsJS.findChild(messageMenu, "subtitle");
3122- verify(subtitle !== undefined, "No subtitle");
3123- compare(subtitle.text, data.message, "Message does not match set message.");
3124+ compare(body.text, data.body, "Message does not match set message.");
3125+ }
3126+
3127+ function test_iconActivated() {
3128+ var icon = UtilsJS.findChild(messageMenuSelected, "icon");
3129+
3130+ mouseClick(icon, icon.width / 2, icon.height / 2, Qt.LeftButton, Qt.NoModifier, 0);
3131+ compare(signalSpyIconActivated.count > 0, true, "activate icon should have been triggered");
3132+ }
3133+
3134+ function test_dismiss() {
3135+ mouseFlick(messageMenuRemovable,
3136+ messageMenuRemovable.width / 2,
3137+ messageMenuRemovable.height / 2,
3138+ messageMenuRemovable.width,
3139+ messageMenuRemovable.height / 2,
3140+ true, true, units.gu(1), 10);
3141+ tryCompareFunction(function() { return signalSpyDismiss.count > 0; }, true);
3142 }
3143
3144 function test_replyButtonText_data() {
3145@@ -184,52 +218,27 @@
3146 compare(button.text, data.buttonText, "Button text does not match set text.");
3147 }
3148
3149- function test_activateApp() {
3150- var appIcon = UtilsJS.findChild(messageMenuSelected, "appIcon");
3151-
3152- mouseClick(appIcon, appIcon.width * 2, appIcon.height / 2, Qt.LeftButton, Qt.NoModifier, 0);
3153- compare(signalSpyActivateApp.count, 0, "activate app should not have been triggered");
3154-
3155- messageMenuSelected.selected = false;
3156- mouseClick(appIcon, appIcon.width / 2, appIcon.height / 2, Qt.LeftButton, Qt.NoModifier, 0);
3157- compare(signalSpyActivateApp.count, 0, "activate app should not have been triggered when not selected");
3158-
3159- messageMenuSelected.selected = true;
3160- mouseClick(appIcon, appIcon.width / 2, appIcon.height / 2, Qt.LeftButton, Qt.NoModifier, 0);
3161- compare(signalSpyActivateApp.count > 0, true, "activate app should have been triggered when selected");
3162- }
3163-
3164- function test_dismiss() {
3165- mouseFlick(messageMenuRemovable,
3166- messageMenuRemovable.width / 2,
3167- messageMenuRemovable.height / 2,
3168- messageMenuRemovable.width,
3169- messageMenuRemovable.height / 2,
3170- true, true, units.gu(1), 10);
3171- tryCompareFunction(function() { return signalSpyDismiss.count > 0; }, true);
3172- }
3173-
3174 function test_activateEnabled() {
3175 messageMenuSelected.selected = true;
3176- messageMenuSelected.activateEnabled = false;
3177+ messageMenuSelected.actionEnabled = false;
3178
3179 var actionButton = UtilsJS.findChild(messageMenuSelected, "actionButton");
3180 verify(actionButton !== undefined, "Action button not found");
3181
3182 compare(actionButton.enabled, false, "Action button should not be enabled when activateEnabled=false");
3183- messageMenuSelected.activateEnabled = true
3184+ messageMenuSelected.actionEnabled = true
3185 compare(actionButton.enabled, true, "Action button should be enabled when activateEnabled=true");
3186 }
3187
3188- function test_activate() {
3189+ function test_actionActivated() {
3190 messageMenuSelected.selected = true;
3191- messageMenuSelected.activateEnabled = true;
3192+ messageMenuSelected.actionEnabled = true;
3193
3194 var actionButton = UtilsJS.findChild(messageMenuSelected, "actionButton");
3195 verify(actionButton !== undefined, "Action button not found");
3196
3197 mouseClick(actionButton, actionButton.width / 2, actionButton.height / 2, Qt.LeftButton, Qt.NoModifier, 0);
3198- compare(signalSpyActivate.count > 0, true);
3199+ compare(signalSpyActionActivated.count > 0, true);
3200 }
3201
3202 function test_replyEnabled_data() {
3203@@ -286,28 +295,5 @@
3204 { tag: 'reply3', index: 2, expected: "reply3" }
3205 ]
3206 }
3207-
3208- function test_reply_with_message(data) {
3209- messageMenuSelected.selected = true;
3210- messageMenu.replyEnabled = true;
3211- messageMenuSelected.replyMessages = [ "reply1", "reply2", "reply3", "reply4" ];
3212-
3213- var messageButton = UtilsJS.findChild(messageMenuSelected, "messageButton");
3214- verify(messageButton !== undefined, "Message button not found");
3215- mouseClick(messageButton, messageButton.width / 2, messageButton.height / 2, Qt.LeftButton, Qt.NoModifier, 300);
3216-
3217- tryCompareFunction(function() { return messageMenuSelected.implicitHeight == messageMenuSelected.expandedHeight; }, true);
3218-
3219- var replyMessage = UtilsJS.findChild(messageMenuSelected, "replyMessage"+data.index);
3220- verify(replyMessage !== undefined, "Reply message not found");
3221- mouseClick(replyMessage, replyMessage.width / 2, replyMessage.height / 2, Qt.LeftButton, Qt.NoModifier, 0);
3222-
3223- var sendButton = UtilsJS.findChild(messageMenuSelected, "sendButton");
3224- verify(sendButton !== undefined, "Send button not found");
3225-
3226- mouseClick(sendButton, sendButton.width / 2, sendButton.height / 2, Qt.LeftButton, Qt.NoModifier, 0);
3227- compare(signalSpyReply.count > 0, true);
3228- compare(textMessageReply, data.expected, "Text message did not reply with correct text.");
3229- }
3230 }
3231 }
3232
3233=== modified file 'tests/qmltests/Menus/tst_TextMessageMenu.qml'
3234--- tests/qmltests/Menus/tst_TextMessageMenu.qml 2013-12-13 17:51:57 +0000
3235+++ tests/qmltests/Menus/tst_TextMessageMenu.qml 2014-07-31 16:42:23 +0000
3236@@ -45,8 +45,8 @@
3237 removable: false
3238
3239 title: "Text Message"
3240+ body: "I am a little teapot"
3241 time: "11:08am"
3242- message: "I am a little teapot"
3243 }
3244
3245 TextMessageMenu {
3246@@ -70,8 +70,8 @@
3247 property string textMessageReply: ""
3248
3249 SignalSpy {
3250- id: signalSpyActivateApp
3251- signalName: "appActivated"
3252+ id: signalSpyIconActivated
3253+ signalName: "iconActivated"
3254 target: messageMenuSelected
3255 }
3256
3257@@ -92,7 +92,7 @@
3258 when: windowShown
3259
3260 function init() {
3261- signalSpyActivateApp.clear();
3262+ signalSpyIconActivated.clear();
3263 signalSpyDismiss.clear();
3264 signalSpyReply.clear();
3265 textMessageReply = "";
3266@@ -126,39 +126,71 @@
3267 function test_time(data) {
3268 messageMenu.time = data.time;
3269
3270- var subtitle = UtilsJS.findChild(messageMenu, "subtitle");
3271- verify(subtitle !== undefined, "No subtitle");
3272+ var subtitle = UtilsJS.findChild(messageMenu, "time");
3273+ verify(subtitle !== undefined, "No time");
3274 compare(subtitle.text, data.time, "Time does not match set time.");
3275 }
3276
3277- function test_appIcon_data() {
3278- return [
3279- { appIcon: Qt.resolvedUrl("../../artwork/avatar.png") },
3280- { appIcon: Qt.resolvedUrl("../../artwork/rhythmbox.png") },
3281- ];
3282- }
3283-
3284- function test_appIcon(data) {
3285- messageMenu.appIcon = data.appIcon;
3286-
3287- var appIcon = UtilsJS.findChild(messageMenu, "appIcon");
3288- verify(appIcon !== undefined, "No app icon");
3289- compare(appIcon.source, data.appIcon, "App Icon does not match set icon.");
3290- }
3291-
3292- function test_message_data() {
3293- return [
3294- { message: "This is a test." },
3295- { message: "Test is also a test." },
3296- ];
3297- }
3298-
3299- function test_message(data) {
3300- messageMenu.message = data.message;
3301+ function test_avatar_data() {
3302+ return [
3303+ { avatar: Qt.resolvedUrl("../../artwork/avatar.png") },
3304+ { avatar: Qt.resolvedUrl("../../artwork/rhythmbox.png") },
3305+ ];
3306+ }
3307+
3308+ function test_avatar(data) {
3309+ messageMenu.avatar = data.avatar;
3310+
3311+ var avatar = UtilsJS.findChild(messageMenu, "avatar");
3312+ verify(avatar !== undefined, "No avatar");
3313+ compare(avatar.source, data.avatar, "Avatar does not match set avatar.");
3314+ }
3315+
3316+ function test_icon_data() {
3317+ return [
3318+ { icon: Qt.resolvedUrl("../../artwork/avatar.png") },
3319+ { icon: Qt.resolvedUrl("../../artwork/rhythmbox.png") },
3320+ ];
3321+ }
3322+
3323+ function test_icon(data) {
3324+ messageMenu.icon = data.icon;
3325+
3326+ var icon = UtilsJS.findChild(messageMenu, "icon");
3327+ verify(icon !== undefined, "No icon");
3328+ compare(icon.source, data.icon, "Icon does not match set icon.");
3329+ }
3330+
3331+ function test_body_data() {
3332+ return [
3333+ { body: "This is a test." },
3334+ { body: "Test is also a test." },
3335+ ];
3336+ }
3337+
3338+ function test_body(data) {
3339+ messageMenu.body = data.body;
3340
3341 var body = UtilsJS.findChild(messageMenu, "body");
3342 verify(body !== undefined, "No body");
3343- compare(body.text, data.message, "Message does not match set message.");
3344+ compare(body.text, data.body, "Message does not match set message.");
3345+ }
3346+
3347+ function test_iconActivated() {
3348+ var icon = UtilsJS.findChild(messageMenuSelected, "icon");
3349+
3350+ mouseClick(icon, icon.width / 2, icon.height / 2, Qt.LeftButton, Qt.NoModifier, 0);
3351+ compare(signalSpyIconActivated.count > 0, true, "activate icon should have been triggered");
3352+ }
3353+
3354+ function test_dismiss() {
3355+ mouseFlick(messageMenuRemovable,
3356+ messageMenuRemovable.width / 2,
3357+ messageMenuRemovable.height / 2,
3358+ messageMenuRemovable.width,
3359+ messageMenuRemovable.height / 2,
3360+ true, true, units.gu(1), 10);
3361+ tryCompareFunction(function() { return signalSpyDismiss.count > 0; }, true);
3362 }
3363
3364 function test_replyButtonText_data() {
3365@@ -176,31 +208,6 @@
3366 compare(button.text, data.buttonText, "Button text does not match set text.");
3367 }
3368
3369- function test_activateApp() {
3370- var appIcon = UtilsJS.findChild(messageMenuSelected, "appIcon");
3371-
3372- mouseClick(appIcon, appIcon.width * 2, appIcon.height / 2, Qt.LeftButton, Qt.NoModifier, 0);
3373- compare(signalSpyActivateApp.count, 0, "activate app should not have been triggered");
3374-
3375- messageMenuSelected.selected = false;
3376- mouseClick(appIcon, appIcon.width / 2, appIcon.height / 2, Qt.LeftButton, Qt.NoModifier, 0);
3377- compare(signalSpyActivateApp.count, 0, "activate app should not have been triggered when not selected");
3378-
3379- messageMenuSelected.selected = true;
3380- mouseClick(appIcon, appIcon.width / 2, appIcon.height / 2, Qt.LeftButton, Qt.NoModifier, 0);
3381- compare(signalSpyActivateApp.count > 0, true, "activate app should have been triggered when selected");
3382- }
3383-
3384- function test_dismiss() {
3385- mouseFlick(messageMenuRemovable,
3386- messageMenuRemovable.width / 2,
3387- messageMenuRemovable.height / 2,
3388- messageMenuRemovable.width,
3389- messageMenuRemovable.height / 2,
3390- true, true, units.gu(1), 10);
3391- tryCompareFunction(function() { return signalSpyDismiss.count > 0; }, true);
3392- }
3393-
3394 function test_replyEnabled_data() {
3395 return [
3396 { tag: 'disabledNoReply', enabled: false, reply: "", expected: false},
3397
3398=== added directory 'tests/uqmlscene'
3399=== added file 'tests/uqmlscene/CMakeLists.txt'
3400--- tests/uqmlscene/CMakeLists.txt 1970-01-01 00:00:00 +0000
3401+++ tests/uqmlscene/CMakeLists.txt 2014-07-31 16:42:23 +0000
3402@@ -0,0 +1,22 @@
3403+add_executable(uqmlscene
3404+ ${shellapplication_MOC_SRCS}
3405+ main.cpp
3406+ MouseTouchAdaptor.cpp
3407+ )
3408+
3409+qt5_use_modules(uqmlscene Qml Quick Test)
3410+pkg_check_modules(XCB REQUIRED xcb)
3411+
3412+include_directories(
3413+ ${Qt5Gui_PRIVATE_INCLUDE_DIRS}
3414+)
3415+
3416+if (NOT "${XCB_INCLUDE_DIRS}" STREQUAL "")
3417+ set_target_properties(uqmlscene PROPERTIES INCLUDE_DIRECTORIES ${XCB_INCLUDE_DIRS})
3418+endif()
3419+
3420+target_link_libraries(uqmlscene
3421+ ${Qt5Qml_LIBRARIES}
3422+ ${Qt5Quick_LIBRARIES}
3423+ ${XCB_LDFLAGS}
3424+ )
3425
3426=== added file 'tests/uqmlscene/MouseTouchAdaptor.cpp'
3427--- tests/uqmlscene/MouseTouchAdaptor.cpp 1970-01-01 00:00:00 +0000
3428+++ tests/uqmlscene/MouseTouchAdaptor.cpp 2014-07-31 16:42:23 +0000
3429@@ -0,0 +1,153 @@
3430+/*
3431+ * Copyright (C) 2013 Canonical, Ltd.
3432+ *
3433+ * This program is free software; you can redistribute it and/or modify
3434+ * it under the terms of the GNU General Public License as published by
3435+ * the Free Software Foundation; version 3.
3436+ *
3437+ * This program is distributed in the hope that it will be useful,
3438+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
3439+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3440+ * GNU General Public License for more details.
3441+ *
3442+ * You should have received a copy of the GNU General Public License
3443+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
3444+ *
3445+ * Authored by: Daniel d'Andrada <daniel.dandrada@canonical.com>
3446+ */
3447+
3448+#include "MouseTouchAdaptor.h"
3449+
3450+#include <qpa/qwindowsysteminterface.h>
3451+
3452+#include <QtGui/QMouseEvent>
3453+#include <QtTest/QTest>
3454+
3455+using QTest::QTouchEventSequence;
3456+
3457+namespace {
3458+Qt::MouseButton translateMouseButton(xcb_button_t detail)
3459+{
3460+ switch (detail) {
3461+ case 1: return Qt::LeftButton;
3462+ case 2: return Qt::MidButton;
3463+ case 3: return Qt::RightButton;
3464+ // Button values 4-7 are Wheel events
3465+ default: return Qt::NoButton;
3466+ }
3467+}
3468+} // end of anonymous namespace
3469+
3470+MouseTouchAdaptor::MouseTouchAdaptor()
3471+ : m_leftButtonIsPressed(false)
3472+{
3473+ m_touchDevice = new QTouchDevice;
3474+ m_touchDevice->setType(QTouchDevice::TouchScreen);
3475+ QWindowSystemInterface::registerTouchDevice(m_touchDevice);
3476+}
3477+
3478+bool MouseTouchAdaptor::nativeEventFilter(const QByteArray & eventType,
3479+ void * message, long * /*result*/)
3480+{
3481+ if (eventType != "xcb_generic_event_t") {
3482+ // wrong backend.
3483+ qWarning("MouseTouchAdaptor: XCB backend not in use. Adaptor inoperative!");
3484+ return false;
3485+ }
3486+
3487+ xcb_generic_event_t *xcbEvent = static_cast<xcb_generic_event_t *>(message);
3488+
3489+ switch (xcbEvent->response_type & ~0x80) {
3490+ case XCB_BUTTON_PRESS:
3491+ return handleButtonPress(reinterpret_cast<xcb_button_press_event_t *>(xcbEvent));
3492+ break;
3493+ case XCB_BUTTON_RELEASE:
3494+ return handleButtonRelease(reinterpret_cast<xcb_button_release_event_t *>(xcbEvent));
3495+ break;
3496+ case XCB_MOTION_NOTIFY:
3497+ return handleMotionNotify(reinterpret_cast<xcb_motion_notify_event_t *>(xcbEvent));
3498+ break;
3499+ default:
3500+ return false;
3501+ break;
3502+ };
3503+}
3504+
3505+bool MouseTouchAdaptor::handleButtonPress(xcb_button_press_event_t *pressEvent)
3506+{
3507+ Qt::MouseButton button = translateMouseButton(pressEvent->detail);
3508+
3509+ // Just eat the event if it wasn't a left mouse press
3510+ if (button != Qt::LeftButton)
3511+ return true;
3512+
3513+ QPoint windowPos(pressEvent->event_x, pressEvent->event_y);
3514+
3515+ QWindow *targetWindow = findQWindowWithXWindowID(static_cast<WId>(pressEvent->event));
3516+
3517+ QTouchEventSequence touchEvent = QTest::touchEvent(targetWindow, m_touchDevice,
3518+ false /* autoCommit */);
3519+ touchEvent.press(0 /* touchId */, windowPos);
3520+ touchEvent.commit(false /* processEvents */);
3521+
3522+ m_leftButtonIsPressed = true;
3523+ return true;
3524+}
3525+
3526+bool MouseTouchAdaptor::handleButtonRelease(xcb_button_release_event_t *releaseEvent)
3527+{
3528+ Qt::MouseButton button = translateMouseButton(releaseEvent->detail);
3529+
3530+ // Just eat the event if it wasn't a left mouse release
3531+ if (button != Qt::LeftButton)
3532+ return true;
3533+
3534+ QPoint windowPos(releaseEvent->event_x, releaseEvent->event_y);
3535+
3536+ QWindow *targetWindow = findQWindowWithXWindowID(static_cast<WId>(releaseEvent->event));
3537+
3538+ QTouchEventSequence touchEvent = QTest::touchEvent(targetWindow, m_touchDevice,
3539+ false /* autoCommit */);
3540+ touchEvent.release(0 /* touchId */, windowPos);
3541+ touchEvent.commit(false /* processEvents */);
3542+
3543+ m_leftButtonIsPressed = false;
3544+ return true;
3545+}
3546+
3547+bool MouseTouchAdaptor::handleMotionNotify(xcb_motion_notify_event_t *event)
3548+{
3549+ if (!m_leftButtonIsPressed) {
3550+ return true;
3551+ }
3552+
3553+ QPoint windowPos(event->event_x, event->event_y);
3554+
3555+ QWindow *targetWindow = findQWindowWithXWindowID(static_cast<WId>(event->event));
3556+
3557+ QTouchEventSequence touchEvent = QTest::touchEvent(targetWindow, m_touchDevice,
3558+ false /* autoCommit */);
3559+ touchEvent.move(0 /* touchId */, windowPos);
3560+ touchEvent.commit(false /* processEvents */);
3561+
3562+ return true;
3563+}
3564+
3565+QWindow *MouseTouchAdaptor::findQWindowWithXWindowID(WId windowId)
3566+{
3567+ QWindowList windowList = QGuiApplication::topLevelWindows();
3568+ QWindow *foundWindow = nullptr;
3569+
3570+ int i = 0;
3571+ while (!foundWindow && i < windowList.count()) {
3572+ QWindow *window = windowList[i];
3573+ if (window->winId() == windowId) {
3574+ foundWindow = window;
3575+ } else {
3576+ ++i;
3577+ }
3578+ }
3579+
3580+ Q_ASSERT(foundWindow);
3581+ return foundWindow;
3582+}
3583
3584=== added file 'tests/uqmlscene/MouseTouchAdaptor.h'
3585--- tests/uqmlscene/MouseTouchAdaptor.h 1970-01-01 00:00:00 +0000
3586+++ tests/uqmlscene/MouseTouchAdaptor.h 2014-07-31 16:42:23 +0000
3587@@ -0,0 +1,49 @@
3588+/*
3589+ * Copyright (C) 2013 Canonical, Ltd.
3590+ *
3591+ * This program is free software; you can redistribute it and/or modify
3592+ * it under the terms of the GNU General Public License as published by
3593+ * the Free Software Foundation; version 3.
3594+ *
3595+ * This program is distributed in the hope that it will be useful,
3596+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
3597+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3598+ * GNU General Public License for more details.
3599+ *
3600+ * You should have received a copy of the GNU General Public License
3601+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
3602+ *
3603+ * Authored by: Daniel d'Andrada <daniel.dandrada@canonical.com>
3604+ */
3605+
3606+#ifndef MOUSE_TOUCH_ADAPTOR_H
3607+#define MOUSE_TOUCH_ADAPTOR_H
3608+
3609+#include <QtCore/QAbstractNativeEventFilter>
3610+#include <QWindow>
3611+#include <xcb/xcb.h>
3612+
3613+class QMouseEvent;
3614+class QTouchDevice;
3615+
3616+// Transforms QMouseEvents into single-finger QTouchEvents.
3617+class MouseTouchAdaptor : public QAbstractNativeEventFilter {
3618+
3619+public:
3620+ MouseTouchAdaptor();
3621+
3622+ // Filters mouse events and posts the equivalent QTouchEvents.
3623+ virtual bool nativeEventFilter(const QByteArray & eventType, void *message, long *result);
3624+
3625+private:
3626+
3627+ bool handleButtonPress(xcb_button_press_event_t *pressEvent);
3628+ bool handleButtonRelease(xcb_button_release_event_t *releaseEvent);
3629+ bool handleMotionNotify(xcb_motion_notify_event_t *event);
3630+ QWindow *findQWindowWithXWindowID(WId windowId);
3631+
3632+ QTouchDevice *m_touchDevice;
3633+ bool m_leftButtonIsPressed;
3634+};
3635+
3636+#endif // MOUSE_TOUCH_ADAPTOR_H
3637
3638=== added file 'tests/uqmlscene/README'
3639--- tests/uqmlscene/README 1970-01-01 00:00:00 +0000
3640+++ tests/uqmlscene/README 2014-07-31 16:42:23 +0000
3641@@ -0,0 +1,1 @@
3642+Qt's qmlscene tool modified to use MouseTouchAdaptor. That way we can interact with touch-only components
3643
3644=== added file 'tests/uqmlscene/main.cpp'
3645--- tests/uqmlscene/main.cpp 1970-01-01 00:00:00 +0000
3646+++ tests/uqmlscene/main.cpp 2014-07-31 16:42:23 +0000
3647@@ -0,0 +1,554 @@
3648+/****************************************************************************
3649+**
3650+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
3651+** Contact: http://www.qt-project.org/legal
3652+**
3653+** This file is part of the tools applications of the Qt Toolkit.
3654+**
3655+** $QT_BEGIN_LICENSE:LGPL$
3656+** Commercial License Usage
3657+** Licensees holding valid commercial Qt licenses may use this file in
3658+** accordance with the commercial license agreement provided with the
3659+** Software or, alternatively, in accordance with the terms contained in
3660+** a written agreement between you and Digia. For licensing terms and
3661+** conditions see http://qt.digia.com/licensing. For further information
3662+** use the contact form at http://qt.digia.com/contact-us.
3663+**
3664+** GNU Lesser General Public License Usage
3665+** Alternatively, this file may be used under the terms of the GNU Lesser
3666+** General Public License version 2.1 as published by the Free Software
3667+** Foundation and appearing in the file LICENSE.LGPL included in the
3668+** packaging of this file. Please review the following information to
3669+** ensure the GNU Lesser General Public License version 2.1 requirements
3670+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
3671+**
3672+** In addition, as a special exception, Digia gives you certain additional
3673+** rights. These rights are described in the Digia Qt LGPL Exception
3674+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
3675+**
3676+** GNU General Public License Usage
3677+** Alternatively, this file may be used under the terms of the GNU
3678+** General Public License version 3.0 as published by the Free Software
3679+** Foundation and appearing in the file LICENSE.GPL included in the
3680+** packaging of this file. Please review the following information to
3681+** ensure the GNU General Public License version 3.0 requirements will be
3682+** met: http://www.gnu.org/copyleft/gpl.html.
3683+**
3684+**
3685+** $QT_END_LICENSE$
3686+**
3687+****************************************************************************/
3688+
3689+#include <QtCore/qdebug.h>
3690+#include <QtCore/qabstractanimation.h>
3691+#include <QtCore/qdir.h>
3692+#include <QtCore/qmath.h>
3693+#include <QtCore/qdatetime.h>
3694+
3695+#include <QtGui/QGuiApplication>
3696+
3697+#include <QtQml/qqml.h>
3698+#include <QtQml/qqmlengine.h>
3699+#include <QtQml/qqmlcomponent.h>
3700+#include <QtQml/qqmlcontext.h>
3701+
3702+#include <QtQuick/qquickitem.h>
3703+#include <QtQuick/qquickview.h>
3704+
3705+#ifdef QT_WIDGETS_LIB
3706+#include <QtWidgets/QApplication>
3707+#include <QtWidgets/QFileDialog>
3708+#endif
3709+
3710+#include <QtCore/QTranslator>
3711+#include <QtCore/QLibraryInfo>
3712+
3713+#include <MouseTouchAdaptor.h>
3714+
3715+#ifdef QML_RUNTIME_TESTING
3716+class RenderStatistics
3717+{
3718+public:
3719+ static void updateStats();
3720+ static void printTotalStats();
3721+private:
3722+ static QVector<qreal> timePerFrame;
3723+ static QVector<int> timesPerFrames;
3724+};
3725+
3726+QVector<qreal> RenderStatistics::timePerFrame;
3727+QVector<int> RenderStatistics::timesPerFrames;
3728+
3729+void RenderStatistics::updateStats()
3730+{
3731+ static QTime time;
3732+ static int frames;
3733+ static int lastTime;
3734+
3735+ if (frames == 0) {
3736+ time.start();
3737+ } else {
3738+ int elapsed = time.elapsed();
3739+ timesPerFrames.append(elapsed - lastTime);
3740+ lastTime = elapsed;
3741+
3742+ if (elapsed > 5000) {
3743+ qreal avgtime = elapsed / (qreal) frames;
3744+ qreal var = 0;
3745+ for (int i = 0; i < timesPerFrames.size(); ++i) {
3746+ qreal diff = timesPerFrames.at(i) - avgtime;
3747+ var += diff * diff;
3748+ }
3749+ var /= timesPerFrames.size();
3750+
3751+ qDebug("Average time per frame: %f ms (%i fps), std.dev: %f ms", avgtime, qRound(1000. / avgtime), qSqrt(var));
3752+
3753+ timePerFrame.append(avgtime);
3754+ timesPerFrames.clear();
3755+ time.start();
3756+ lastTime = 0;
3757+ frames = 0;
3758+ }
3759+ }
3760+ ++frames;
3761+}
3762+
3763+void RenderStatistics::printTotalStats()
3764+{
3765+ int count = timePerFrame.count();
3766+ if (count == 0)
3767+ return;
3768+
3769+ qreal minTime = 0;
3770+ qreal maxTime = 0;
3771+ qreal avg = 0;
3772+ for (int i = 0; i < count; ++i) {
3773+ minTime = minTime == 0 ? timePerFrame.at(i) : qMin(minTime, timePerFrame.at(i));
3774+ maxTime = qMax(maxTime, timePerFrame.at(i));
3775+ avg += timePerFrame.at(i);
3776+ }
3777+ avg /= count;
3778+
3779+ qDebug(" ");
3780+ qDebug("----- Statistics -----");
3781+ qDebug("Average time per frame: %f ms (%i fps)", avg, qRound(1000. / avg));
3782+ qDebug("Best time per frame: %f ms (%i fps)", minTime, int(1000 / minTime));
3783+ qDebug("Worst time per frame: %f ms (%i fps)", maxTime, int(1000 / maxTime));
3784+ qDebug("----------------------");
3785+ qDebug(" ");
3786+}
3787+#endif
3788+
3789+struct Options
3790+{
3791+ Options()
3792+ : originalQml(false)
3793+ , originalQmlRaster(false)
3794+ , maximized(false)
3795+ , fullscreen(false)
3796+ , transparent(false)
3797+ , clip(false)
3798+ , versionDetection(true)
3799+ , quitImmediately(false)
3800+ , resizeViewToRootItem(false)
3801+ , multisample(false)
3802+ {
3803+ }
3804+
3805+ QUrl file;
3806+ bool originalQml;
3807+ bool originalQmlRaster;
3808+ bool maximized;
3809+ bool fullscreen;
3810+ bool transparent;
3811+ bool scenegraphOnGraphicsview;
3812+ bool clip;
3813+ bool versionDetection;
3814+ bool quitImmediately;
3815+ bool resizeViewToRootItem;
3816+ bool multisample;
3817+ QString translationFile;
3818+};
3819+
3820+#if defined(QMLSCENE_BUNDLE)
3821+QFileInfoList findQmlFiles(const QString &dirName)
3822+{
3823+ QDir dir(dirName);
3824+
3825+ QFileInfoList ret;
3826+ if (dir.exists()) {
3827+ QFileInfoList fileInfos = dir.entryInfoList(QStringList() << "*.qml",
3828+ QDir::Files | QDir::AllDirs | QDir::NoDotAndDotDot);
3829+
3830+ Q_FOREACH (QFileInfo fileInfo, fileInfos) {
3831+ if (fileInfo.isDir())
3832+ ret += findQmlFiles(fileInfo.filePath());
3833+ else if (fileInfo.fileName().length() > 0 && fileInfo.fileName().at(0).isLower())
3834+ ret.append(fileInfo);
3835+ }
3836+ }
3837+
3838+ return ret;
3839+}
3840+
3841+static int displayOptionsDialog(Options *options)
3842+{
3843+ QDialog dialog;
3844+
3845+ QFormLayout *layout = new QFormLayout(&dialog);
3846+
3847+ QComboBox *qmlFileComboBox = new QComboBox(&dialog);
3848+ QFileInfoList fileInfos = findQmlFiles(":/bundle") + findQmlFiles("./qmlscene-resources");
3849+
3850+ Q_FOREACH (QFileInfo fileInfo, fileInfos)
3851+ qmlFileComboBox->addItem(fileInfo.dir().dirName() + "/" + fileInfo.fileName(), QVariant::fromValue(fileInfo));
3852+
3853+ QCheckBox *originalCheckBox = new QCheckBox(&dialog);
3854+ originalCheckBox->setText("Use original QML viewer");
3855+ originalCheckBox->setChecked(options->originalQml);
3856+
3857+ QCheckBox *fullscreenCheckBox = new QCheckBox(&dialog);
3858+ fullscreenCheckBox->setText("Start fullscreen");
3859+ fullscreenCheckBox->setChecked(options->fullscreen);
3860+
3861+ QCheckBox *maximizedCheckBox = new QCheckBox(&dialog);
3862+ maximizedCheckBox->setText("Start maximized");
3863+ maximizedCheckBox->setChecked(options->maximized);
3864+
3865+ QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel,
3866+ Qt::Horizontal,
3867+ &dialog);
3868+ QObject::connect(buttonBox, SIGNAL(accepted()), &dialog, SLOT(accept()));
3869+ QObject::connect(buttonBox, SIGNAL(rejected()), &dialog, SLOT(reject()));
3870+
3871+ layout->addRow("Qml file:", qmlFileComboBox);
3872+ layout->addWidget(originalCheckBox);
3873+ layout->addWidget(maximizedCheckBox);
3874+ layout->addWidget(fullscreenCheckBox);
3875+ layout->addWidget(buttonBox);
3876+
3877+ int result = dialog.exec();
3878+ if (result == QDialog::Accepted) {
3879+ QVariant variant = qmlFileComboBox->itemData(qmlFileComboBox->currentIndex());
3880+ QFileInfo fileInfo = variant.value<QFileInfo>();
3881+
3882+ if (fileInfo.canonicalFilePath().startsWith(":"))
3883+ options->file = QUrl("qrc" + fileInfo.canonicalFilePath());
3884+ else
3885+ options->file = QUrl::fromLocalFile(fileInfo.canonicalFilePath());
3886+ options->originalQml = originalCheckBox->isChecked();
3887+ options->maximized = maximizedCheckBox->isChecked();
3888+ options->fullscreen = fullscreenCheckBox->isChecked();
3889+ }
3890+ return result;
3891+}
3892+#endif
3893+
3894+static bool checkVersion(const QUrl &url)
3895+{
3896+ if (!qgetenv("QMLSCENE_IMPORT_NAME").isEmpty())
3897+ qWarning("QMLSCENE_IMPORT_NAME is no longer supported.");
3898+
3899+ QString fileName = url.toLocalFile();
3900+ if (fileName.isEmpty()) {
3901+ qWarning("qmlscene: filename required.");
3902+ return false;
3903+ }
3904+
3905+ QFile f(fileName);
3906+ if (!f.open(QFile::ReadOnly | QFile::Text)) {
3907+ qWarning("qmlscene: failed to check version of file '%s', could not open...",
3908+ qPrintable(fileName));
3909+ return false;
3910+ }
3911+
3912+ QRegExp quick1("^\\s*import +QtQuick +1\\.\\w*");
3913+ QRegExp qt47("^\\s*import +Qt +4\\.7");
3914+
3915+ QTextStream stream(&f);
3916+ bool codeFound= false;
3917+ while (!codeFound) {
3918+ QString line = stream.readLine();
3919+ if (line.contains("{")) {
3920+ codeFound = true;
3921+ } else {
3922+ QString import;
3923+ if (quick1.indexIn(line) >= 0)
3924+ import = quick1.cap(0).trimmed();
3925+ else if (qt47.indexIn(line) >= 0)
3926+ import = qt47.cap(0).trimmed();
3927+
3928+ if (!import.isNull()) {
3929+ qWarning("qmlscene: '%s' is no longer supported.\n"
3930+ "Use qmlviewer to load file '%s'.",
3931+ qPrintable(import),
3932+ qPrintable(fileName));
3933+ return false;
3934+ }
3935+ }
3936+ }
3937+
3938+ return true;
3939+}
3940+
3941+static void displayFileDialog(Options *options)
3942+{
3943+#if defined(QT_WIDGETS_LIB) && !defined(QT_NO_FILEDIALOG)
3944+ QString fileName = QFileDialog::getOpenFileName(0, "Open QML file", QString(), "QML Files (*.qml)");
3945+ if (!fileName.isEmpty()) {
3946+ QFileInfo fi(fileName);
3947+ options->file = QUrl::fromLocalFile(fi.canonicalFilePath());
3948+ }
3949+#else
3950+ Q_UNUSED(options);
3951+ qWarning("No filename specified...");
3952+#endif
3953+}
3954+
3955+#ifndef QT_NO_TRANSLATION
3956+static void loadTranslationFile(QTranslator &translator, const QString& directory)
3957+{
3958+ translator.load(QLatin1String("qml_" )+QLocale::system().name(), directory + QLatin1String("/i18n"));
3959+ QCoreApplication::installTranslator(&translator);
3960+}
3961+#endif
3962+
3963+static void loadDummyDataFiles(QQmlEngine &engine, const QString& directory)
3964+{
3965+ QDir dir(directory+"/dummydata", "*.qml");
3966+ QStringList list = dir.entryList();
3967+ for (int i = 0; i < list.size(); ++i) {
3968+ QString qml = list.at(i);
3969+ QFile f(dir.filePath(qml));
3970+ f.open(QIODevice::ReadOnly);
3971+ QByteArray data = f.readAll();
3972+ QQmlComponent comp(&engine);
3973+ comp.setData(data, QUrl());
3974+ QObject *dummyData = comp.create();
3975+
3976+ if(comp.isError()) {
3977+ QList<QQmlError> errors = comp.errors();
3978+ Q_FOREACH (const QQmlError &error, errors)
3979+ qWarning() << error;
3980+ }
3981+
3982+ if (dummyData) {
3983+ qWarning() << "Loaded dummy data:" << dir.filePath(qml);
3984+ qml.truncate(qml.length()-4);
3985+ engine.rootContext()->setContextProperty(qml, dummyData);
3986+ dummyData->setParent(&engine);
3987+ }
3988+ }
3989+}
3990+
3991+static QObject *s_testRootObject = nullptr;
3992+static QObject *testRootObject(QQmlEngine *engine, QJSEngine *jsEngine)
3993+{
3994+ Q_UNUSED(jsEngine);
3995+ if (!s_testRootObject) {
3996+ s_testRootObject = new QObject(engine);
3997+ }
3998+ return s_testRootObject;
3999+}
4000+
4001+static void usage()
4002+{
4003+ qWarning("Usage: uqmlscene [options] <filename>");
4004+ qWarning(" ");
4005+ qWarning(" Options:");
4006+ qWarning(" --maximized ............................... Run maximized");
4007+ qWarning(" --fullscreen .............................. Run fullscreen");
4008+ qWarning(" --transparent ............................. Make the window transparent");
4009+ qWarning(" --multisample ............................. Enable multisampling (OpenGL anti-aliasing)");
4010+ qWarning(" --no-version-detection .................... Do not try to detect the version of the .qml file");
4011+ qWarning(" --resize-to-root .......................... Resize the window to the size of the root item");
4012+ qWarning(" --quit .................................... Quit immediately after starting");
4013+ qWarning(" -I <path> ................................. Add <path> to the list of import paths");
4014+ qWarning(" -B <name> <file> .......................... Add a named bundle");
4015+ qWarning(" -translation <translationfile> ............ Set the language to run in");
4016+
4017+ qWarning(" ");
4018+ exit(1);
4019+}
4020+
4021+int main(int argc, char ** argv)
4022+{
4023+ Options options;
4024+
4025+ QStringList imports;
4026+ QList<QPair<QString, QString> > bundles;
4027+ for (int i = 1; i < argc; ++i) {
4028+ if (*argv[i] != '-' && QFileInfo(QFile::decodeName(argv[i])).exists()) {
4029+ options.file = QUrl::fromLocalFile(argv[i]);
4030+ } else {
4031+ const QString lowerArgument = QString::fromLatin1(argv[i]).toLower();
4032+ if (lowerArgument == QLatin1String("--maximized"))
4033+ options.maximized = true;
4034+ else if (lowerArgument == QLatin1String("--fullscreen"))
4035+ options.fullscreen = true;
4036+ else if (lowerArgument == QLatin1String("--transparent"))
4037+ options.transparent = true;
4038+ else if (lowerArgument == QLatin1String("--clip"))
4039+ options.clip = true;
4040+ else if (lowerArgument == QLatin1String("--no-version-detection"))
4041+ options.versionDetection = false;
4042+ else if (lowerArgument == QLatin1String("--quit"))
4043+ options.quitImmediately = true;
4044+ else if (lowerArgument == QLatin1String("-translation"))
4045+ options.translationFile = QLatin1String(argv[++i]);
4046+ else if (lowerArgument == QLatin1String("--resize-to-root"))
4047+ options.resizeViewToRootItem = true;
4048+ else if (lowerArgument == QLatin1String("--multisample"))
4049+ options.multisample = true;
4050+ else if (lowerArgument == QLatin1String("-i") && i + 1 < argc)
4051+ imports.append(QString::fromLatin1(argv[++i]));
4052+ else if (lowerArgument == QLatin1String("-b") && i + 2 < argc) {
4053+ QString name = QString::fromLatin1(argv[++i]);
4054+ QString file = QString::fromLatin1(argv[++i]);
4055+ bundles.append(qMakePair(name, file));
4056+ } else if (lowerArgument == QLatin1String("--help")
4057+ || lowerArgument == QLatin1String("-help")
4058+ || lowerArgument == QLatin1String("--h")
4059+ || lowerArgument == QLatin1String("-h"))
4060+ usage();
4061+ }
4062+ }
4063+
4064+#ifdef QT_WIDGETS_LIB
4065+ QApplication app(argc, argv);
4066+#else
4067+ QGuiApplication app(argc, argv);
4068+#endif
4069+ app.setApplicationName("Unity8 QtQmlViewer");
4070+ app.setOrganizationName("Qt Project");
4071+ app.setOrganizationDomain("qt-project.org");
4072+
4073+ MouseTouchAdaptor mouseTouchAdaptor;
4074+ app.installNativeEventFilter(&mouseTouchAdaptor);
4075+
4076+#ifndef QT_NO_TRANSLATION
4077+ QTranslator translator;
4078+ QTranslator qtTranslator;
4079+ QString sysLocale = QLocale::system().name();
4080+ if (translator.load(QLatin1String("qmlscene_") + sysLocale, QLibraryInfo::location(QLibraryInfo::TranslationsPath))) {
4081+ app.installTranslator(&translator);
4082+ if (qtTranslator.load(QLatin1String("qt_") + sysLocale, QLibraryInfo::location(QLibraryInfo::TranslationsPath))) {
4083+ app.installTranslator(&qtTranslator);
4084+ } else {
4085+ app.removeTranslator(&translator);
4086+ }
4087+ }
4088+
4089+ QTranslator qmlTranslator;
4090+ if (!options.translationFile.isEmpty()) {
4091+ if (qmlTranslator.load(options.translationFile)) {
4092+ app.installTranslator(&qmlTranslator);
4093+ } else {
4094+ qWarning() << "Could not load the translation file" << options.translationFile;
4095+ }
4096+ }
4097+#endif
4098+
4099+ if (options.file.isEmpty())
4100+#if defined(QMLSCENE_BUNDLE)
4101+ displayOptionsDialog(&options);
4102+#else
4103+ displayFileDialog(&options);
4104+#endif
4105+
4106+ int exitCode = 0;
4107+
4108+ if (!options.file.isEmpty()) {
4109+ if (!options.versionDetection || checkVersion(options.file)) {
4110+#ifndef QT_NO_TRANSLATION
4111+ QTranslator translator;
4112+#endif
4113+
4114+ // TODO: as soon as the engine construction completes, the debug service is
4115+ // listening for connections. But actually we aren't ready to debug anything.
4116+ QQmlEngine engine;
4117+ QQmlComponent *component = new QQmlComponent(&engine);
4118+ for (int i = 0; i < imports.size(); ++i)
4119+ engine.addImportPath(imports.at(i));
4120+ for (int i = 0; i < bundles.size(); ++i)
4121+ engine.addNamedBundle(bundles.at(i).first, bundles.at(i).second);
4122+ if (options.file.isLocalFile()) {
4123+ QFileInfo fi(options.file.toLocalFile());
4124+#ifndef QT_NO_TRANSLATION
4125+ loadTranslationFile(translator, fi.path());
4126+#endif
4127+ loadDummyDataFiles(engine, fi.path());
4128+ }
4129+ QObject::connect(&engine, SIGNAL(quit()), QCoreApplication::instance(), SLOT(quit()));
4130+
4131+ qmlRegisterSingletonType<QObject>("Qt.test.qtestroot", 1, 0, "QTestRootObject", testRootObject);
4132+
4133+ component->loadUrl(options.file);
4134+ if ( !component->isReady() ) {
4135+ qWarning("%s", qPrintable(component->errorString()));
4136+ return -1;
4137+ }
4138+
4139+ QObject *topLevel = component->create();
4140+ QQuickWindow *window = qobject_cast<QQuickWindow *>(topLevel);
4141+ QQuickView* qxView = 0;
4142+ if (!window) {
4143+ QQuickItem *contentItem = qobject_cast<QQuickItem *>(topLevel);
4144+ if (contentItem) {
4145+ qxView = new QQuickView(&engine, NULL);
4146+ window = qxView;
4147+ // Set window default properties; the qml can still override them
4148+ QString oname = contentItem->objectName();
4149+ window->setTitle(oname.isEmpty() ? QString::fromLatin1("qmlscene") : QString::fromLatin1("qmlscene: ") + oname);
4150+ window->setFlags(Qt::Window | Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint | Qt::WindowFullscreenButtonHint);
4151+ if (options.resizeViewToRootItem)
4152+ qxView->setResizeMode(QQuickView::SizeViewToRootObject);
4153+ else
4154+ qxView->setResizeMode(QQuickView::SizeRootObjectToView);
4155+ qxView->setContent(options.file, component, contentItem);
4156+ }
4157+ }
4158+
4159+ if (window) {
4160+ QSurfaceFormat surfaceFormat = window->requestedFormat();
4161+ if (options.multisample)
4162+ surfaceFormat.setSamples(16);
4163+ if (options.transparent) {
4164+ surfaceFormat.setAlphaBufferSize(8);
4165+ window->setClearBeforeRendering(true);
4166+ window->setColor(QColor(Qt::transparent));
4167+ window->setFlags(Qt::FramelessWindowHint);
4168+ }
4169+ window->setFormat(surfaceFormat);
4170+
4171+ if (options.fullscreen)
4172+ window->showFullScreen();
4173+ else if (options.maximized)
4174+ window->showMaximized();
4175+ else
4176+ window->show();
4177+ }
4178+
4179+ if (options.quitImmediately)
4180+ QMetaObject::invokeMethod(QCoreApplication::instance(), "quit", Qt::QueuedConnection);
4181+
4182+ // Now would be a good time to inform the debug service to start listening.
4183+
4184+ exitCode = app.exec();
4185+
4186+#ifdef QML_RUNTIME_TESTING
4187+ RenderStatistics::printTotalStats();
4188+#endif
4189+ // Ready to exit. If we created qxView, it owns the component;
4190+ // otherwise, the ownership is still right here. Nobody deletes the engine
4191+ // (which is odd since the container constructor takes the engine pointer),
4192+ // but it's stack-allocated anyway.
4193+ if (qxView)
4194+ delete qxView;
4195+ else
4196+ delete component;
4197+ }
4198+ }
4199+
4200+ return exitCode;
4201+}

Subscribers

People subscribed via source and target branches

to all changes: