on xenial help sign in
Merge from trunk
1274c66Michael Terry
.bzrignore+1−4
@@ -3,8 +3,5 @@
3# QtCreator project files
3# QtCreator project files
4/*.user
4/*.user
5# Eclipse project files
5# Eclipse project files
6−/.project
7−/.cproject
8−/.settings
6+.settings
9−/.pydevproject
10message.txt
7message.txt
CMakeLists.txt+11−103
@@ -69,17 +69,6 @@ if(SHELL_PLUGINDIR STREQUAL "")
69 message(FATAL_ERROR "Could not determine plugin import dir.")
69 message(FATAL_ERROR "Could not determine plugin import dir.")
70endif()
70endif()
71
71
72−configure_file(paths.h.in ${CMAKE_CURRENT_BINARY_DIR}/paths.h @ONLY)
73−
74−pkg_check_modules(UNITY-MIR REQUIRED unity-mir)
75−
76−include_directories(
77− ${CMAKE_CURRENT_BINARY_DIR}
78− ${CMAKE_CURRENT_SOURCE_DIR}
79− ${Qt5Gui_PRIVATE_INCLUDE_DIRS}
80− ${UNITY-MIR_INCLUDE_DIRS}
81− )
82−
83set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden")
72set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden")
84
73
85set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -fno-permissive -pedantic -Wall -Wextra")
74set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -fno-permissive -pedantic -Wall -Wextra")
@@ -109,103 +98,22 @@ declare_autopilot_test(shell unity8.shell ${CMAKE_SOURCE_DIR}/tests/autopilot/)
109set(SHELL_APP unity8)
98set(SHELL_APP unity8)
110set(GREETER_APP unity8-greeter)
99set(GREETER_APP unity8-greeter)
111
100
112−set(shell_app_HDRS
101+include_directories(
113− )
102+ ${CMAKE_SOURCE_DIR}/include
114−
103+ ${CMAKE_BINARY_DIR}/include
115−set(COMMON_SRCS
116− ApplicationArguments.h
117− main.cpp
118− MouseTouchAdaptor.cpp
119− )
120−add_executable(${SHELL_APP}
121− ${shellapplication_MOC_SRCS}
122− ${COMMON_SRCS}
123− )
124−add_executable(${GREETER_APP}
125− ${greeterapplication_MOC_SRCS}
126− ${COMMON_SRCS}
127− )
128−
129−set_target_properties(${SHELL_APP} PROPERTIES
130− COMPILE_DEFINITIONS "APP_NAME=\"Unity 8\";QML_FILE=\"Shell.qml\";INDICATOR_PROFILE=\"phone\""
131− )
132−set_target_properties(${GREETER_APP} PROPERTIES
133− COMPILE_DEFINITIONS "APP_NAME=\"Unity 8 Greeter\";QML_FILE=\"GreeterShell.qml\";INDICATOR_PROFILE=\"phone_greeter\""
134− )
135−
136−qt5_use_modules(${SHELL_APP} Qml Quick Test)
137−qt5_use_modules(${GREETER_APP} Qml Quick Test)
138−pkg_check_modules(XCB REQUIRED xcb)
139−
140−if (NOT "${XCB_INCLUDE_DIRS}" STREQUAL "")
141− set_target_properties(${SHELL_APP} PROPERTIES INCLUDE_DIRECTORIES ${XCB_INCLUDE_DIRS})
142−endif()
143−
144−set(COMMON_LIBS
145− ${Qt5Qml_LIBRARIES}
146− ${Qt5Quick_LIBRARIES}
147− ${XCB_LDFLAGS}
148− ${CMAKE_DL_LIBS}
149− )
150−target_link_libraries(${SHELL_APP}
151− ${COMMON_LIBS}
152− )
153−target_link_libraries(${GREETER_APP}
154− ${COMMON_LIBS}
155− )
156−
157−# install binaries
158−install(TARGETS ${SHELL_APP} ${GREETER_APP}
159− RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
160− )
161−
162−# install top level qml and js files
163−file(GLOB QML_JS_FILES *.qml *.js)
164−
165−install(FILES ${QML_JS_FILES}
166− DESTINATION ${SHELL_APP_DIR}
167− )
104+)
168
105
169# add subdirectories to build
106# add subdirectories to build
107+add_subdirectory(include)
108+add_subdirectory(src)
109+add_subdirectory(qml)
170add_subdirectory(tests)
110add_subdirectory(tests)
171add_subdirectory(plugins)
111add_subdirectory(plugins)
172−add_subdirectory(src)
173
112
174−# install subdirectories
113+#
175−set(QML_DIRS
114+# Data files
176− Bottombar
115+#
177− Components
116+add_subdirectory(data)
178− Dash
179− graphics
180− Greeter
181− Hud
182− Panel
183− Launcher
184− SideStage
185− Notifications
186− )
187−
188−install(DIRECTORY ${QML_DIRS}
189− DESTINATION ${SHELL_APP_DIR}
190− )
191−
192−# generate desktop file
193−configure_file(${SHELL_APP}.desktop.in ${CMAKE_CURRENT_BINARY_DIR}/${SHELL_APP}.desktop @ONLY)
194−configure_file(${GREETER_APP}.desktop.in ${CMAKE_CURRENT_BINARY_DIR}/${GREETER_APP}.desktop @ONLY)
195−
196−# install desktop file
197−install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${SHELL_APP}.desktop
198− DESTINATION ${CMAKE_INSTALL_DATADIR}/applications
199− )
200−install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${GREETER_APP}.desktop
201− DESTINATION ${CMAKE_INSTALL_DATADIR}/lightdm/greeters
202− )
203−install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/51-${GREETER_APP}.conf
204− DESTINATION ${CMAKE_INSTALL_DATADIR}/lightdm/lightdm.conf.d
205− )
206−install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${GREETER_APP}-wrapper
207− DESTINATION ${CMAKE_INSTALL_BINDIR}
208− )
209
117
210#
118#
211# Translation
119# Translation
CODING+41−2
@@ -1,7 +1,7 @@
1Building Unity 8
1Building Unity 8
2================
2================
3
3
4−Only Ubuntu 13.10 (saucy) is supported as a developement environment.
4+Only Ubuntu 14.04 (trusty) is supported as a developement environment.
5
5
6download source
6download source
7---------------
7---------------
@@ -68,7 +68,7 @@ Notes
68
68
69Running Unity 8 on devices
69Running Unity 8 on devices
70==========================
70==========================
71−- Ubuntu Touch builds are currently only available in 13.10 flavour
71+- Ubuntu Touch builds are currently only available in 14.04 flavour
72- supported hardware should match one of those listed here
72- supported hardware should match one of those listed here
73 https://wiki.ubuntu.com/Touch/Devices#Running_fine
73 https://wiki.ubuntu.com/Touch/Devices#Running_fine
74- follow the Ubuntu Touch install instructions for your chosen device
74- follow the Ubuntu Touch install instructions for your chosen device
@@ -127,3 +127,42 @@ Unity 8.
127If using VIM, make sure you install some syntax highlighting for QML, like
127If using VIM, make sure you install some syntax highlighting for QML, like
128https://github.com/peterhoeg/vim-qml
128https://github.com/peterhoeg/vim-qml
129
129
130+Running tests
131+=============
132+
133+Tests are run from the build directory (which will be ./builddir if you used
134+the ./build script).
135+
136+To run the tests that do not require any graphical capability and therefore
137+are pretty fast run:
138+
139+$ make test
140+
141+or, alternatively:
142+
143+$ ctest
144+
145+To run all graphical tests, which can take a couple of minutes:
146+
147+$ make qmluitests
148+
149+To run the tests for a single component/class:
150+
151+$ make testComponentName
152+
153+So, for the DragHandle component that would be:
154+
155+$ make testDragHandle
156+
157+To run a test application that allow you to manually test or to simply try out
158+a given component:
159+
160+$ make tryComponentName
161+
162+So to try out, for instance, the DragHandle component, you would do:
163+
164+$ make tryDragHandle
165+
166+NB: Manual test or interation doesn't make sense for all components or classes,
167+particularly the non-graphical ones. In such cases no "tryFoo" make target is
168+provided.
Notifications/Notification.qmldeleted−295
@@ -1,295 +0,0 @@
1−/*
2− * Copyright (C) 2013 Canonical, Ltd.
3− *
4− * This program is free software; you can redistribute it and/or modify
5− * it under the terms of the GNU General Public License as published by
6− * the Free Software Foundation; version 3.
7− *
8− * This program is distributed in the hope that it will be useful,
9− * but WITHOUT ANY WARRANTY; without even the implied warranty of
10− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11− * GNU General Public License for more details.
12− *
13− * You should have received a copy of the GNU General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− */
16−
17−import QtQuick 2.0
18−import Ubuntu.Components 0.1
19−import Unity.Notifications 1.0
20−import QMenuModel 0.1
21−import Utils 0.1
22−
23−UbuntuShape {
24− id: notification
25−
26− property alias iconSource: icon.fileSource
27− property alias secondaryIconSource: secondaryIcon.source
28− property alias summary: summaryLabel.text
29− property alias body: bodyLabel.text
30− property var actions
31− property var notificationId
32− property var type
33− property var hints
34− property var notification
35−
36− objectName: "background"
37− implicitHeight: type != Notification.PlaceHolder ? contentColumn.height + contentColumn.spacing * 2 : 0
38− color: Qt.rgba(0.132, 0.117, 0.109, 0.97)
39− opacity: 0
40− radius: "medium"
41−
42− clip: true
43− visible: type != Notification.PlaceHolder
44−
45− UnityMenuModelPaths {
46− id: paths
47−
48− source: hints["x-canonical-private-menu-model"]
49−
50− busNameHint: "busName"
51− actionsHint: "actions"
52− menuObjectPathHint: "menuPath"
53− }
54−
55− UnityMenuModel {
56− id: unityMenuModel
57−
58− busName: paths.busName
59− actions: paths.actions
60− menuObjectPath: paths.menuObjectPath
61− }
62−
63− Behavior on implicitHeight {
64− id: heightBehavior
65−
66− enabled: false
67− UbuntuNumberAnimation {
68− duration: UbuntuAnimation.SnapDuration
69− }
70− }
71−
72− // delay enabling height behavior until the add transition is complete
73− onOpacityChanged: if (opacity == 1) heightBehavior.enabled = true
74−
75− MouseArea {
76− id: interactiveArea
77−
78− anchors.fill: contentColumn
79− objectName: "interactiveArea"
80− enabled: notification.type == Notification.Interactive
81− onClicked: notification.notification.invokeAction(actionRepeater.itemAt(0).actionId)
82− }
83−
84− Column {
85− id: contentColumn
86−
87− anchors {
88− left: parent.left
89− right: parent.right
90− top: parent.top
91− margins: spacing
92− }
93−
94− spacing: units.gu(1)
95−
96− Row {
97− id: topRow
98−
99− spacing: contentColumn.spacing
100− anchors {
101− left: parent.left
102− right: parent.right
103− }
104−
105− ShapedIcon {
106− id: icon
107−
108− objectName: "icon"
109− width: units.gu(6)
110− height: units.gu(6)
111− shaped: notification.hints["x-canonical-non-shaped-icon"] == "true" ? false : true
112− visible: iconSource !== undefined && iconSource != ""
113− }
114−
115− Image {
116− id: secondaryIcon
117−
118− objectName: "secondaryIcon"
119− width: units.gu(2)
120− height: units.gu(2)
121− visible: source !== undefined && source != ""
122− fillMode: Image.PreserveAspectCrop
123− }
124−
125− Column {
126− id: labelColumn
127− width: parent.width - x
128−
129− anchors.verticalCenter: (icon.visible && !bodyLabel.visible) ? icon.verticalCenter : undefined
130−
131− Label {
132− id: summaryLabel
133−
134− objectName: "summaryLabel"
135− anchors {
136− left: parent.left
137− right: parent.right
138− }
139− fontSize: "medium"
140− font.bold: true
141− color: Theme.palette.selected.backgroundText
142− elide: Text.ElideRight
143− }
144−
145− Label {
146− id: bodyLabel
147−
148− objectName: "bodyLabel"
149− anchors {
150− left: parent.left
151− right: parent.right
152− }
153− visible: body != ""
154− fontSize: "small"
155− color: Theme.palette.selected.backgroundText
156− opacity: 0.6
157− wrapMode: Text.WordWrap
158− maximumLineCount: 10
159− elide: Text.ElideRight
160− }
161− }
162− }
163−
164− Column {
165− objectName: "dialogListView"
166− spacing: units.gu(2)
167−
168− visible: count > 0
169−
170− anchors.left: parent.left; anchors.right: parent.right
171−
172− Repeater {
173− model: unityMenuModel
174−
175− NotificationMenuItemFactory {
176− anchors.left: parent.left; anchors.right: parent.right
177−
178− menuModel: unityMenuModel
179− menuData: model
180− menuIndex: index
181− }
182− }
183− }
184−
185− Item {
186− id: buttonRow
187−
188− objectName: "buttonRow"
189− anchors {
190− left: parent.left
191− right: parent.right
192− }
193− visible: notification.type == Notification.SnapDecision && actionRepeater.count > 0
194− height: units.gu(5)
195−
196− property real buttonWidth: (width - contentColumn.spacing) / 2
197− property bool expanded
198−
199− Button {
200− id: leftButton
201−
202− objectName: "button1"
203− width: parent.expanded ? parent.width : parent.buttonWidth
204− anchors {
205− top: parent.top
206− bottom: parent.bottom
207− }
208− text: notification.type == Notification.SnapDecision && actionRepeater.count >= 2 ? actionRepeater.itemAt(1).actionLabel : ""
209− gradient: UbuntuColors.greyGradient
210− onClicked: {
211− if (actionRepeater.count > 2) {
212− buttonRow.expanded = !buttonRow.expanded
213− } else {
214− notification.notification.invokeAction(actionRepeater.itemAt(1).actionId)
215− }
216− }
217−
218− Behavior on width {
219− UbuntuNumberAnimation {
220− duration: UbuntuAnimation.SnapDuration
221− }
222− }
223− }
224−
225− Button {
226− id: rightButton
227−
228− objectName: "button0"
229− anchors {
230− left: leftButton.right
231− leftMargin: contentColumn.spacing
232− right: parent.right
233− }
234− text: notification.type == Notification.SnapDecision && actionRepeater.count >= 1 ? actionRepeater.itemAt(0).actionLabel : ""
235− anchors {
236− top: parent.top
237− bottom: parent.bottom
238− }
239− gradient: notification.hints["x-canonical-private-button-tint"] == "true" ? UbuntuColors.orangeGradient : UbuntuColors.greyGradient
240− visible: width > 0
241− onClicked: notification.notification.invokeAction(actionRepeater.itemAt(0).actionId)
242− }
243− }
244−
245− Column {
246− objectName: "buttonColumn"
247− spacing: contentColumn.spacing
248− anchors {
249− left: parent.left
250− right: parent.right
251− }
252−
253− // calculate initial position before Column takes over
254− y: buttonRow.y + buttonRow.height + contentColumn.spacing
255−
256− visible: notification.type == Notification.SnapDecision
257− height: buttonRow.expanded ? implicitHeight : 0
258−
259− Repeater {
260− id: actionRepeater
261−
262− model: notification.actions
263− delegate: Loader {
264− id: loader
265−
266− property string actionId: id
267− property string actionLabel: label
268−
269− anchors {
270− left: parent.left
271− right: parent.right
272− }
273−
274− Component {
275− id: actionButton
276−
277− Button {
278− objectName: "button" + index
279− anchors {
280− left: parent.left
281− right: parent.right
282− }
283−
284− text: loader.actionLabel
285− height: units.gu(5)
286− gradient: UbuntuColors.greyGradient
287− onClicked: notification.notification.invokeAction(loader.actionId)
288− }
289− }
290− sourceComponent: (index == 0 || index == 1) ? undefined : actionButton
291− }
292− }
293− }
294− }
295−}
51-unity8-greeter.conf → data/51-unity8-greeter.confrenamed

The content is the same.

data/CMakeLists.txtnew file+17
@@ -0,0 +1,17 @@
1+# generate desktop file
2+configure_file(${SHELL_APP}.desktop.in ${CMAKE_CURRENT_BINARY_DIR}/${SHELL_APP}.desktop @ONLY)
3+configure_file(${GREETER_APP}.desktop.in ${CMAKE_CURRENT_BINARY_DIR}/${GREETER_APP}.desktop @ONLY)
4+
5+# install desktop file
6+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${SHELL_APP}.desktop
7+ DESTINATION ${CMAKE_INSTALL_DATADIR}/applications
8+ )
9+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${GREETER_APP}.desktop
10+ DESTINATION ${CMAKE_INSTALL_DATADIR}/lightdm/greeters
11+ )
12+install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/51-${GREETER_APP}.conf
13+ DESTINATION ${CMAKE_INSTALL_DATADIR}/lightdm/lightdm.conf.d
14+ )
15+install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${GREETER_APP}-wrapper
16+ DESTINATION ${CMAKE_INSTALL_BINDIR}
17+ )
unity8-greeter-wrapper → data/unity8-greeter-wrapperrenamed

The content is the same.

unity8-greeter.desktop.in → data/unity8-greeter.desktop.inrenamed

The content is the same.

unity8.desktop.in → data/unity8.desktop.inrenamed

The content is the same.

data/unity8.overridenew file+1
@@ -0,0 +1 @@
1+kill timeout 30
debian/changelog+26
@@ -1,3 +1,29 @@
1+unity8 (7.84+14.04.20131212-0ubuntu1) trusty; urgency=low
2+
3+ [ Michał Sawicz ]
4+ * Add PyDev project files for autopilot tests. Also tweak .bzrignore
5+ to not ignore generic Eclipse project definitions.
6+ * Retry unlocking the greeter three times.
7+ * Reduce code duplication and clean up CMakeLists and includes in
8+ indicator tests.
9+
10+ [ Nick Dedekind ]
11+ * Replaced indicator page dynamic menuSelected binding with Connection
12+ to listview selectedIndex property. (LP: #1243146)
13+ * Indicators close when menu items are activated. (LP: #1238182)
14+ * Fixed up connections for changes to model data. (LP: #1253810)
15+
16+ [ Albert Astals ]
17+ * dashItemSelected -> showDashHome Because we are not using the index
18+ at all in the upper layers.
19+ * Fix filtering colllapsing/expanding again Also the delegate creation
20+ range stuff flows up->down not down->up so rearrange the bindings.
21+
22+ [ Ubuntu daily release ]
23+ * Automatic snapshot from revision 590
24+
25+ -- Ubuntu daily release <ps-jenkins@lists.canonical.com> Thu, 12 Dec 2013 21:41:19 +0000
26+
1unity8 (7.84+14.04.20131206.1-0ubuntu1) trusty; urgency=low
27unity8 (7.84+14.04.20131206.1-0ubuntu1) trusty; urgency=low
2
28
3 [ Michal Hruby ]
29 [ Michal Hruby ]
debian/unity8-autopilot.install+1
@@ -1 +1,2 @@
1usr/lib/python*/*/unity*
1usr/lib/python*/*/unity*
2+data/unity8.override usr/share/upstart/sessions
debian/unity8-private.install+1−1
@@ -1,7 +1,7 @@
1usr/lib/*/unity8/qml/AccountsService
1usr/lib/*/unity8/qml/AccountsService
2usr/lib/*/unity8/qml/HudClient
2usr/lib/*/unity8/qml/HudClient
3usr/lib/*/unity8/qml/LightDM
3usr/lib/*/unity8/qml/LightDM
4−usr/lib/*/unity8/qml/ListViewWithPageHeader
4+usr/lib/*/unity8/qml/DashViews
5usr/lib/*/unity8/qml/Powerd
5usr/lib/*/unity8/qml/Powerd
6usr/lib/*/unity8/qml/SessionBroadcast
6usr/lib/*/unity8/qml/SessionBroadcast
7usr/lib/*/unity8/qml/SessionManager
7usr/lib/*/unity8/qml/SessionManager
include/CMakeLists.txtnew file+1
@@ -0,0 +1 @@
1+configure_file(paths.h.in ${CMAKE_CURRENT_BINARY_DIR}/paths.h @ONLY)
paths.h.in → include/paths.h.inrenamed+42−3
@@ -23,6 +23,8 @@
23// Qt
23// Qt
24#include <QtCore/QCoreApplication>
24#include <QtCore/QCoreApplication>
25#include <QtCore/QDir>
25#include <QtCore/QDir>
26+#include <QtGui/QIcon>
27+#include <QtQml/QQmlEngine>
26#include <QStandardPaths>
28#include <QStandardPaths>
27
29
28inline bool isRunningInstalled() {
30inline bool isRunningInstalled() {
@@ -39,11 +41,11 @@ inline QString translationDirectory() {
39 }
41 }
40}
42}
41
43
42−inline QString shellAppDirectory() {
44+inline QString qmlDirectory() {
43 if (isRunningInstalled()) {
45 if (isRunningInstalled()) {
44 return QString("@CMAKE_INSTALL_PREFIX@/@SHELL_APP_DIR@/");
46 return QString("@CMAKE_INSTALL_PREFIX@/@SHELL_APP_DIR@/");
45 } else {
47 } else {
46− return QString("@CMAKE_SOURCE_DIR@/");
48+ return QString("@CMAKE_SOURCE_DIR@/qml/");
47 }
49 }
48}
50}
49
51
@@ -77,7 +79,7 @@ inline QStringList shellDataDirs() {
77 }
79 }
78 else {
80 else {
79 // append so by default we use xdg files.
81 // append so by default we use xdg files.
80− dirs.append(shellAppDirectory());
82+ dirs.append(qmlDirectory());
81 }
83 }
82 return dirs;
84 return dirs;
83}
85}
@@ -86,4 +88,41 @@ inline QString sourceDirectory() {
86 return QString("@CMAKE_SOURCE_DIR@/");
88 return QString("@CMAKE_SOURCE_DIR@/");
87}
89}
88
90
91+inline void prependImportPaths(QQmlEngine *engine, const QStringList &paths)
92+{
93+ QStringList importPathList = engine->importPathList();
94+ for (int i = paths.count() -1; i >= 0; i--) {
95+ // don't duplicate
96+ const QString& path = paths[i];
97+ QStringList::iterator iter = qFind(importPathList.begin(), importPathList.end(), path);
98+ if (iter == importPathList.end()) {
99+ engine->addImportPath(path);
100+ }
101+ }
102+}
103+
104+/* When you append and import path to the list of import paths it will be the *last*
105+ place where Qt will search for QML modules.
106+ The usual QQmlEngine::addImportPath() actually prepends the given path.*/
107+inline void appendImportPaths(QQmlEngine *engine, const QStringList &paths)
108+{
109+ QStringList importPathList = engine->importPathList();
110+ Q_FOREACH(const QString& path, paths) {
111+ // don't duplicate
112+ QStringList::iterator iter = qFind(importPathList.begin(), importPathList.end(), path);
113+ if (iter == importPathList.end()) {
114+ importPathList.append(path);
115+ }
116+ }
117+ engine->setImportPathList(importPathList);
118+}
119+
120+inline void resolveIconTheme() {
121+ const char *ubuntuIconTheme = getenv("UBUNTU_ICON_THEME");
122+ if (ubuntuIconTheme == NULL) {
123+ ubuntuIconTheme = "ubuntu-mobile";
124+ }
125+ QIcon::setThemeName(ubuntuIconTheme);
126+}
127+
89#endif
128#endif
plugins/CMakeLists.txt+1−1
@@ -1,7 +1,7 @@
1add_subdirectory(AccountsService)
1add_subdirectory(AccountsService)
2add_subdirectory(HudClient)
2add_subdirectory(HudClient)
3add_subdirectory(LightDM)
3add_subdirectory(LightDM)
4−add_subdirectory(ListViewWithPageHeader)
4+add_subdirectory(DashViews)
5add_subdirectory(Powerd)
5add_subdirectory(Powerd)
6add_subdirectory(SessionBroadcast)
6add_subdirectory(SessionBroadcast)
7add_subdirectory(SessionManager)
7add_subdirectory(SessionManager)
plugins/ListViewWithPageHeader/CMakeLists.txt → plugins/DashViews/CMakeLists.txtrenamed+6−5
@@ -24,19 +24,20 @@ remove_definitions(-DQT_NO_KEYWORDS)
24set(QMLPLUGIN_SRC
24set(QMLPLUGIN_SRC
25 plugin.cpp
25 plugin.cpp
26 listviewwithpageheader.cpp
26 listviewwithpageheader.cpp
27+ verticaljournal.cpp
27 )
28 )
28
29
29−add_library(ListViewWithPageHeader-qml MODULE
30+add_library(DashViews-qml MODULE
30 ${QMLPLUGIN_SRC}
31 ${QMLPLUGIN_SRC}
31 )
32 )
32
33
33−target_link_libraries(ListViewWithPageHeader-qml
34+target_link_libraries(DashViews-qml
34 ${Qt5Gui_LIBRARIES}
35 ${Qt5Gui_LIBRARIES}
35 ${Qt5Quick_LIBRARIES}
36 ${Qt5Quick_LIBRARIES}
36 )
37 )
37
38
38−qt5_use_modules(ListViewWithPageHeader-qml Qml Quick)
39+qt5_use_modules(DashViews-qml Qml Quick)
39
40
40# export the qmldir qmltypes and plugin files
41# export the qmldir qmltypes and plugin files
41−export_qmlfiles(ListViewWithPageHeader ListViewWithPageHeader)
42+export_qmlfiles(DashViews DashViews)
42−export_qmlplugin(ListViewWithPageHeader 0.1 ListViewWithPageHeader TARGETS ListViewWithPageHeader-qml)
43+export_qmlplugin(DashViews 0.1 DashViews TARGETS DashViews-qml)
plugins/ListViewWithPageHeader/listviewwithpageheader.cpp → plugins/DashViews/listviewwithpageheader.cpprenamed

The content is the same.

plugins/ListViewWithPageHeader/listviewwithpageheader.h → plugins/DashViews/listviewwithpageheader.hrenamed

The content is the same.

plugins/ListViewWithPageHeader/plugin.cpp → plugins/DashViews/plugin.cpprenamed+4−2
@@ -18,12 +18,14 @@
18#include "plugin.h"
18#include "plugin.h"
19
19
20#include "listviewwithpageheader.h"
20#include "listviewwithpageheader.h"
21+#include "verticaljournal.h"
21
22
22#include <QAbstractItemModel>
23#include <QAbstractItemModel>
23
24
24−void ListViewWithPageHeaderPlugin::registerTypes(const char *uri)
25+void DashViewsPlugin::registerTypes(const char *uri)
25{
26{
26− Q_ASSERT(uri == QLatin1String("ListViewWithPageHeader"));
27+ Q_ASSERT(uri == QLatin1String("DashViews"));
27 qmlRegisterType<QAbstractItemModel>();
28 qmlRegisterType<QAbstractItemModel>();
28 qmlRegisterType<ListViewWithPageHeader>(uri, 0, 1, "ListViewWithPageHeader");
29 qmlRegisterType<ListViewWithPageHeader>(uri, 0, 1, "ListViewWithPageHeader");
30+ qmlRegisterType<VerticalJournal>(uri, 0, 1, "VerticalJournal");
29}
31}
plugins/ListViewWithPageHeader/plugin.h → plugins/DashViews/plugin.hrenamed+3−3
@@ -15,13 +15,13 @@
15 *
15 *
16 */
16 */
17
17
18−#ifndef LISTVIEWWITHPAGEHEADER_PLUGIN_H
18+#ifndef DASHVIEWS_PLUGIN_H
19−#define LISTVIEWWITHPAGEHEADER_PLUGIN_H
19+#define DASHVIEWS_PLUGIN_H
20
20
21#include <QtQml/QQmlEngine>
21#include <QtQml/QQmlEngine>
22#include <QtQml/QQmlExtensionPlugin>
22#include <QtQml/QQmlExtensionPlugin>
23
23
24−class ListViewWithPageHeaderPlugin : public QQmlExtensionPlugin
24+class DashViewsPlugin : public QQmlExtensionPlugin
25{
25{
26 Q_OBJECT
26 Q_OBJECT
27 Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
27 Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
plugins/DashViews/qmldirnew file+3
@@ -0,0 +1,3 @@
1+module DashViews
2+plugin DashViews-qml
3+typeinfo plugin.qmltypes
plugins/DashViews/verticaljournal.cppnew file+609
@@ -0,0 +1,609 @@
1+/*
2+ * Copyright (C) 2013 Canonical, Ltd.
3+ *
4+ * This program is free software; you can redistribute it and/or modify
5+ * it under the terms of the GNU General Public License as published by
6+ * the Free Software Foundation; version 3.
7+ *
8+ * This program is distributed in the hope that it will be useful,
9+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
10+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+ * GNU General Public License for more details.
12+ *
13+ * You should have received a copy of the GNU General Public License
14+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
15+ */
16+
17+/*
18+ * The implementation is centered around m_columnVisibleItems
19+ * that holds a vector of lists. There's a list for each of the
20+ * columns the view has. In the list the items of the column are
21+ * ordered as they appear topdown in the view. m_indexColumnMap is
22+ * used when re-building the list up since given a position
23+ * in the middle of the list and the need to create the previous does
24+ * not give us enough information to know in which column we have
25+ * to position the item so that when we reach the item the view is
26+ * correctly layouted at 0 for all the columns
27+ */
28+#include "verticaljournal.h"
29+
30+#include <qqmlengine.h>
31+#pragma GCC diagnostic push
32+#pragma GCC diagnostic ignored "-pedantic"
33+#if (QT_VERSION < QT_VERSION_CHECK(5, 1, 0))
34+#include <private/qquickvisualdatamodel_p.h>
35+#else
36+#include <private/qqmldelegatemodel_p.h>
37+#include <qqmlinfo.h>
38+#endif
39+#include <private/qquickitem_p.h>
40+#pragma GCC diagnostic pop
41+
42+static const qreal bufferRatio = 0.5;
43+
44+VerticalJournal::VerticalJournal()
45+ : m_delegateModel(nullptr)
46+ , m_asyncRequestedIndex(-1)
47+ , m_columnWidth(0)
48+ , m_columnSpacing(0)
49+ , m_rowSpacing(0)
50+ , m_delegateCreationBegin(0)
51+ , m_delegateCreationEnd(0)
52+ , m_delegateCreationBeginValid(false)
53+ , m_delegateCreationEndValid(false)
54+ , m_needsRelayout(false)
55+ , m_delegateValidated(false)
56+ , m_implicitHeightDirty(false)
57+{
58+ connect(this, SIGNAL(widthChanged()), this, SLOT(relayout()));
59+ connect(this, SIGNAL(heightChanged()), this, SLOT(onHeightChanged()));
60+}
61+
62+QAbstractItemModel *VerticalJournal::model() const
63+{
64+ return m_delegateModel ? m_delegateModel->model().value<QAbstractItemModel *>() : nullptr;
65+}
66+
67+void VerticalJournal::setModel(QAbstractItemModel *model)
68+{
69+ if (model != this->model()) {
70+ if (!m_delegateModel) {
71+ createDelegateModel();
72+ } else {
73+#if (QT_VERSION < QT_VERSION_CHECK(5, 1, 0))
74+ disconnect(m_delegateModel, SIGNAL(modelUpdated(QQuickChangeSet,bool)), this, SLOT(onModelUpdated(QQuickChangeSet,bool)));
75+ }
76+ m_delegateModel->setModel(QVariant::fromValue<QAbstractItemModel *>(model));
77+ connect(m_delegateModel, SIGNAL(modelUpdated(QQuickChangeSet,bool)), this, SLOT(onModelUpdated(QQuickChangeSet,bool)));
78+#else
79+ disconnect(m_delegateModel, SIGNAL(modelUpdated(QQmlChangeSet,bool)), this, SLOT(onModelUpdated(QQmlChangeSet,bool)));
80+ }
81+ m_delegateModel->setModel(QVariant::fromValue<QAbstractItemModel *>(model));
82+ connect(m_delegateModel, SIGNAL(modelUpdated(QQmlChangeSet,bool)), this, SLOT(onModelUpdated(QQmlChangeSet,bool)));
83+#endif
84+
85+ cleanupExistingItems();
86+
87+ Q_EMIT modelChanged();
88+ polish();
89+ }
90+}
91+
92+QQmlComponent *VerticalJournal::delegate() const
93+{
94+ return m_delegateModel ? m_delegateModel->delegate() : nullptr;
95+}
96+
97+void VerticalJournal::setDelegate(QQmlComponent *delegate)
98+{
99+ if (delegate != this->delegate()) {
100+ if (!m_delegateModel) {
101+ createDelegateModel();
102+ }
103+
104+ cleanupExistingItems();
105+
106+ m_delegateModel->setDelegate(delegate);
107+
108+ Q_EMIT delegateChanged();
109+ m_delegateValidated = false;
110+ polish();
111+ }
112+}
113+
114+qreal VerticalJournal::columnWidth() const
115+{
116+ return m_columnWidth;
117+}
118+
119+void VerticalJournal::setColumnWidth(qreal columnWidth)
120+{
121+ if (columnWidth != m_columnWidth) {
122+ m_columnWidth = columnWidth;
123+ Q_EMIT columnWidthChanged();
124+
125+ if (isComponentComplete()) {
126+ Q_FOREACH(const auto &column, m_columnVisibleItems) {
127+ Q_FOREACH(const ViewItem &item, column) {
128+ item.m_item->setWidth(columnWidth);
129+ }
130+ }
131+ relayout();
132+ }
133+ }
134+}
135+
136+qreal VerticalJournal::columnSpacing() const
137+{
138+ return m_columnSpacing;
139+}
140+
141+void VerticalJournal::setColumnSpacing(qreal columnSpacing)
142+{
143+ if (columnSpacing != m_columnSpacing) {
144+ m_columnSpacing = columnSpacing;
145+ Q_EMIT columnSpacingChanged();
146+
147+ if (isComponentComplete()) {
148+ relayout();
149+ }
150+ }
151+}
152+
153+qreal VerticalJournal::rowSpacing() const
154+{
155+ return m_rowSpacing;
156+}
157+
158+void VerticalJournal::setRowSpacing(qreal rowSpacing)
159+{
160+ if (rowSpacing != m_rowSpacing) {
161+ m_rowSpacing = rowSpacing;
162+ Q_EMIT rowSpacingChanged();
163+
164+ if (isComponentComplete()) {
165+ relayout();
166+ }
167+ }
168+}
169+
170+qreal VerticalJournal::delegateCreationBegin() const
171+{
172+ return m_delegateCreationBegin;
173+}
174+
175+void VerticalJournal::setDelegateCreationBegin(qreal begin)
176+{
177+ m_delegateCreationBeginValid = true;
178+ if (m_delegateCreationBegin == begin)
179+ return;
180+ m_delegateCreationBegin = begin;
181+ if (isComponentComplete()) {
182+ polish();
183+ }
184+ emit delegateCreationBeginChanged();
185+}
186+
187+void VerticalJournal::resetDelegateCreationBegin()
188+{
189+ m_delegateCreationBeginValid = false;
190+ if (m_delegateCreationBegin == 0)
191+ return;
192+ m_delegateCreationBegin = 0;
193+ if (isComponentComplete()) {
194+ polish();
195+ }
196+ emit delegateCreationBeginChanged();
197+}
198+
199+qreal VerticalJournal::delegateCreationEnd() const
200+{
201+ return m_delegateCreationEnd;
202+}
203+
204+void VerticalJournal::setDelegateCreationEnd(qreal end)
205+{
206+ m_delegateCreationEndValid = true;
207+ if (m_delegateCreationEnd == end)
208+ return;
209+ m_delegateCreationEnd = end;
210+ if (isComponentComplete()) {
211+ polish();
212+ }
213+ emit delegateCreationEndChanged();
214+}
215+
216+void VerticalJournal::resetDelegateCreationEnd()
217+{
218+ m_delegateCreationEndValid = false;
219+ if (m_delegateCreationEnd == 0)
220+ return;
221+ m_delegateCreationEnd = 0;
222+ if (isComponentComplete()) {
223+ polish();
224+ }
225+ emit delegateCreationEndChanged();
226+}
227+
228+void VerticalJournal::createDelegateModel()
229+{
230+#if (QT_VERSION < QT_VERSION_CHECK(5, 1, 0))
231+ m_delegateModel = new QQuickVisualDataModel(qmlContext(this), this);
232+ connect(m_delegateModel, SIGNAL(createdItem(int,QQuickItem*)), this, SLOT(itemCreated(int,QQuickItem*)));
233+#else
234+ m_delegateModel = new QQmlDelegateModel(qmlContext(this), this);
235+ connect(m_delegateModel, SIGNAL(createdItem(int,QObject*)), this, SLOT(itemCreated(int,QObject*)));
236+#endif
237+ if (isComponentComplete())
238+ m_delegateModel->componentComplete();
239+}
240+
241+void VerticalJournal::refill()
242+{
243+ if (!isComponentComplete()) {
244+ return;
245+ }
246+
247+ const bool delegateRangesValid = m_delegateCreationBeginValid && m_delegateCreationEndValid;
248+ const qreal from = delegateRangesValid ? m_delegateCreationBegin : 0;
249+ const qreal to = delegateRangesValid ? m_delegateCreationEnd : from + height();
250+ const qreal buffer = (to - from) * bufferRatio;
251+ const qreal bufferFrom = from - buffer;
252+ const qreal bufferTo = to + buffer;
253+
254+ bool added = addVisibleItems(from, to, false);
255+ bool removed = removeNonVisibleItems(bufferFrom, bufferTo);
256+ added |= addVisibleItems(bufferFrom, bufferTo, true);
257+
258+ if (added || removed) {
259+ m_implicitHeightDirty = true;
260+ }
261+}
262+
263+void VerticalJournal::findBottomModelIndexToAdd(int *modelIndex, qreal *yPos)
264+{
265+ *modelIndex = 0;
266+ *yPos = std::numeric_limits<qreal>::max();
267+
268+ Q_FOREACH(const auto &column, m_columnVisibleItems) {
269+ if (!column.isEmpty()) {
270+ const ViewItem &item = column.last();
271+ *yPos = qMin(*yPos, item.y() + item.height() + m_rowSpacing);
272+ *modelIndex = qMax(*modelIndex, item.m_modelIndex + 1);
273+ } else {
274+ *yPos = 0;
275+ }
276+ }
277+}
278+
279+void VerticalJournal::findTopModelIndexToAdd(int *modelIndex, qreal *yPos)
280+{
281+ *modelIndex = INT_MAX;
282+ *yPos = std::numeric_limits<qreal>::lowest();
283+ int columnToAddTo = -1;
284+
285+ // Find the topmost free column
286+ for (int i = 0; i < m_columnVisibleItems.count(); ++i) {
287+ const auto &column = m_columnVisibleItems[i];
288+ if (!column.isEmpty()) {
289+ const ViewItem &item = column.first();
290+ const auto itemTopPos = item.y() - m_rowSpacing;
291+ if (itemTopPos > *yPos) {
292+ *yPos = itemTopPos;
293+ *modelIndex = item.m_modelIndex - 1;
294+ columnToAddTo = i;
295+ }
296+ }
297+ }
298+
299+ if (*modelIndex > 0) {
300+ Q_ASSERT(m_indexColumnMap.contains(*modelIndex));
301+ while (m_indexColumnMap[*modelIndex] != columnToAddTo) {
302+ // We found out that we have to add to columnToAddTo
303+ // and thought that we had to add *modelIndex, but history tells
304+ // it is not correct, so find up from *modelIndex until we found the index
305+ // that has to end up in columnToAddTo
306+ *modelIndex = *modelIndex - 1;
307+ Q_ASSERT(m_indexColumnMap.contains(*modelIndex));
308+ }
309+ }
310+}
311+
312+bool VerticalJournal::addVisibleItems(qreal fillFrom, qreal fillTo, bool asynchronous)
313+{
314+ if (!delegate())
315+ return false;
316+
317+ if (m_delegateModel->count() == 0)
318+ return false;
319+
320+ int modelIndex;
321+ qreal yPos;
322+ findBottomModelIndexToAdd(&modelIndex, &yPos);
323+ bool changed = false;
324+ while (modelIndex < m_delegateModel->count() && yPos <= fillTo) {
325+ if (!createItem(modelIndex, asynchronous))
326+ break;
327+
328+ changed = true;
329+ findBottomModelIndexToAdd(&modelIndex, &yPos);
330+ }
331+
332+ findTopModelIndexToAdd(&modelIndex, &yPos);
333+ while (modelIndex >= 0 && yPos > fillFrom) {
334+ if (!createItem(modelIndex, asynchronous))
335+ break;
336+
337+ changed = true;
338+ findTopModelIndexToAdd(&modelIndex, &yPos);
339+ }
340+
341+ return changed;
342+}
343+
344+bool VerticalJournal::removeNonVisibleItems(qreal bufferFrom, qreal bufferTo)
345+{
346+ bool changed = false;
347+
348+ for (int i = 0; i < m_columnVisibleItems.count(); ++i) {
349+ QList<ViewItem> &column = m_columnVisibleItems[i];
350+ while (!column.isEmpty() && column.first().y() + column.first().height() < bufferFrom) {
351+ releaseItem(column.takeFirst());
352+ changed = true;
353+ }
354+
355+ while (!column.isEmpty() && column.last().y() > bufferTo) {
356+ releaseItem(column.takeLast());
357+ changed = true;
358+ }
359+ }
360+
361+ return changed;
362+}
363+
364+QQuickItem *VerticalJournal::createItem(int modelIndex, bool asynchronous)
365+{
366+ if (asynchronous && m_asyncRequestedIndex != -1)
367+ return nullptr;
368+
369+ m_asyncRequestedIndex = -1;
370+#if (QT_VERSION < QT_VERSION_CHECK(5, 1, 0))
371+ QQuickItem *item = m_delegateModel->item(modelIndex, asynchronous);
372+#else
373+ QObject* object = m_delegateModel->object(modelIndex, asynchronous);
374+ QQuickItem *item = qmlobject_cast<QQuickItem*>(object);
375+#endif
376+ if (!item) {
377+#if (QT_VERSION < QT_VERSION_CHECK(5, 1, 0))
378+ m_asyncRequestedIndex = modelIndex;
379+#else
380+ if (object) {
381+ m_delegateModel->release(object);
382+ if (!m_delegateValidated) {
383+ m_delegateValidated = true;
384+ QObject* delegateObj = delegate();
385+ qmlInfo(delegateObj ? delegateObj : this) << "Delegate must be of Item type";
386+ }
387+ } else {
388+ m_asyncRequestedIndex = modelIndex;
389+ }
390+#endif
391+ return nullptr;
392+ } else {
393+ if (item->width() != m_columnWidth) {
394+ qWarning() << "Item" << modelIndex << "width is not the one that the columnWidth mandates, resetting it";
395+ item->setWidth(m_columnWidth);
396+ }
397+ positionItem(modelIndex, item);
398+ return item;
399+ }
400+}
401+
402+void VerticalJournal::positionItem(int modelIndex, QQuickItem *item)
403+{
404+ // Check if we add it to the bottom of existing column items
405+ const QList<ViewItem> &firstColumn = m_columnVisibleItems[0];
406+ qreal columnToAddY = !firstColumn.isEmpty() ? firstColumn.last().y() + firstColumn.last().height() : -m_rowSpacing;
407+ int columnToAddTo = 0;
408+ for (int i = 1; i < m_columnVisibleItems.count(); ++i) {
409+ const QList<ViewItem> &column = m_columnVisibleItems[i];
410+ const qreal iY = !column.isEmpty() ? column.last().y() + column.last().height() : -m_rowSpacing;
411+ if (iY < columnToAddY) {
412+ columnToAddTo = i;
413+ columnToAddY = iY;
414+ }
415+ }
416+
417+ const QList<ViewItem> &columnToAdd = m_columnVisibleItems[columnToAddTo];
418+ if (columnToAdd.isEmpty() || columnToAdd.last().m_modelIndex < modelIndex) {
419+ item->setX(columnToAddTo * (m_columnWidth + m_columnSpacing));
420+ item->setY(columnToAddY + m_rowSpacing);
421+
422+ m_columnVisibleItems[columnToAddTo] << ViewItem(item, modelIndex);
423+ m_indexColumnMap[modelIndex] = columnToAddTo;
424+ } else {
425+ Q_ASSERT(m_indexColumnMap.contains(modelIndex));
426+ columnToAddTo = m_indexColumnMap[modelIndex];
427+ columnToAddY = m_columnVisibleItems[columnToAddTo].first().y();
428+
429+ item->setX(columnToAddTo * (m_columnWidth + m_columnSpacing));
430+ item->setY(columnToAddY - m_rowSpacing - item->height());
431+
432+ m_columnVisibleItems[columnToAddTo].prepend(ViewItem(item, modelIndex));
433+ }
434+}
435+
436+void VerticalJournal::cleanupExistingItems()
437+{
438+ // Cleanup the existing items
439+ for (int i = 0; i < m_columnVisibleItems.count(); ++i) {
440+ QList<ViewItem> &column = m_columnVisibleItems[i];
441+ Q_FOREACH(const ViewItem &item, column)
442+ releaseItem(item);
443+ column.clear();
444+ }
445+ m_indexColumnMap.clear();
446+}
447+
448+void VerticalJournal::releaseItem(const ViewItem &item)
449+{
450+#if (QT_VERSION < QT_VERSION_CHECK(5, 1, 0))
451+ QQuickVisualModel::ReleaseFlags flags = m_delegateModel->release(item.m_item);
452+ if (flags & QQuickVisualModel::Destroyed) {
453+#else
454+ QQmlDelegateModel::ReleaseFlags flags = m_delegateModel->release(item.m_item);
455+ if (flags & QQmlDelegateModel::Destroyed) {
456+#endif
457+ item.m_item->setParentItem(nullptr);
458+ }
459+}
460+
461+void VerticalJournal::calculateImplicitHeight()
462+{
463+ m_implicitHeightDirty = false;
464+
465+ int lastModelIndex = -1;
466+ qreal bottomMostY = 0;
467+ Q_FOREACH(const auto &column, m_columnVisibleItems) {
468+ if (!column.isEmpty()) {
469+ const ViewItem &item = column.last();
470+ lastModelIndex = qMax(lastModelIndex, item.m_modelIndex);
471+ bottomMostY = qMax(bottomMostY, item.y() + item.height());
472+ }
473+ }
474+ if (lastModelIndex >= 0) {
475+ const double averageHeight = bottomMostY / (lastModelIndex + 1);
476+ setImplicitHeight(bottomMostY + averageHeight * (model()->rowCount() - lastModelIndex - 1));
477+ } else {
478+ setImplicitHeight(0);
479+ }
480+}
481+
482+#if (QT_VERSION < QT_VERSION_CHECK(5, 1, 0))
483+void VerticalJournal::itemCreated(int modelIndex, QQuickItem *item)
484+{
485+#else
486+void VerticalJournal::itemCreated(int modelIndex, QObject *object)
487+{
488+ QQuickItem *item = qmlobject_cast<QQuickItem*>(object);
489+ if (!item) {
490+ qWarning() << "VerticalJournal::itemCreated got a non item for index" << modelIndex;
491+ return;
492+ }
493+#endif
494+ item->setParentItem(this);
495+ if (modelIndex == m_asyncRequestedIndex) {
496+ createItem(modelIndex, false);
497+ m_implicitHeightDirty = true;
498+ polish();
499+ }
500+}
501+
502+#if (QT_VERSION < QT_VERSION_CHECK(5, 1, 0))
503+void VerticalJournal::onModelUpdated(const QQuickChangeSet &changeSet, bool reset)
504+#else
505+void VerticalJournal::onModelUpdated(const QQmlChangeSet &changeSet, bool reset)
506+#endif
507+{
508+ if (reset) {
509+ cleanupExistingItems();
510+ } else {
511+#if (QT_VERSION < QT_VERSION_CHECK(5, 1, 0))
512+ Q_FOREACH(const QQuickChangeSet::Remove &remove, changeSet.removes()) {
513+#else
514+ Q_FOREACH(const QQmlChangeSet::Remove &remove, changeSet.removes()) {
515+#endif
516+ for (int i = remove.count - 1; i >= 0; --i) {
517+ const int indexToRemove = remove.index + i;
518+ // Since we only support removing from the end, indexToRemove
519+ // must refer to the last item of one of the columns.
520+ bool found = false;
521+ for (int i = 0; !found && i < m_columnVisibleItems.count(); ++i) {
522+ QList<ViewItem> &column = m_columnVisibleItems[i];
523+ if (!column.isEmpty() && column.last().m_modelIndex == indexToRemove) {
524+ releaseItem(column.takeLast());
525+ found = true;
526+ }
527+ }
528+ Q_ASSERT(found);
529+ }
530+ }
531+ }
532+ polish();
533+}
534+
535+
536+void VerticalJournal::relayout()
537+{
538+ m_needsRelayout = true;
539+ polish();
540+}
541+
542+void VerticalJournal::onHeightChanged()
543+{
544+ polish();
545+}
546+
547+void VerticalJournal::updatePolish()
548+{
549+ if (!model())
550+ return;
551+
552+ if (m_needsRelayout) {
553+ m_implicitHeightDirty = true;
554+
555+ QList<ViewItem> allItems;
556+ Q_FOREACH(const auto &column, m_columnVisibleItems)
557+ allItems << column;
558+
559+ qSort(allItems);
560+
561+ const int nColumns = qMax(1., floor((double)(width() + m_columnSpacing) / (m_columnWidth + m_columnSpacing)));
562+ m_columnVisibleItems.resize(nColumns);
563+ m_indexColumnMap.clear();
564+ for (int i = 0; i < nColumns; ++i)
565+ m_columnVisibleItems[i].clear();
566+
567+ // If the first of allItems doesn't contain index 0 we need to drop them
568+ // all since we can't consistently relayout without the first item being there
569+
570+ if (!allItems.isEmpty()) {
571+ if (allItems.first().m_modelIndex == 0) {
572+ Q_FOREACH(const ViewItem &item, allItems)
573+ positionItem(item.m_modelIndex, item.m_item);
574+ } else {
575+ Q_FOREACH(const ViewItem &item, allItems)
576+ releaseItem(item);
577+ }
578+ }
579+
580+ m_needsRelayout = false;
581+ }
582+
583+ refill();
584+
585+ const bool delegateRangesValid = m_delegateCreationBeginValid && m_delegateCreationEndValid;
586+ const qreal from = delegateRangesValid ? m_delegateCreationBegin : 0;
587+ const qreal to = delegateRangesValid ? m_delegateCreationEnd : from + height();
588+ Q_FOREACH(const auto &column, m_columnVisibleItems) {
589+ Q_FOREACH(const ViewItem &item, column) {
590+ QQuickItemPrivate::get(item.m_item)->setCulled(item.y() + item.height() <= from || item.y() >= to);
591+ }
592+ }
593+
594+ if (m_implicitHeightDirty) {
595+ calculateImplicitHeight();
596+ }
597+}
598+
599+void VerticalJournal::componentComplete()
600+{
601+ if (m_delegateModel)
602+ m_delegateModel->componentComplete();
603+
604+ QQuickItem::componentComplete();
605+
606+ m_needsRelayout = true;
607+
608+ polish();
609+}
plugins/DashViews/verticaljournal.hnew file+182
@@ -0,0 +1,182 @@
1+/*
2+ * Copyright (C) 2013 Canonical, Ltd.
3+ *
4+ * This program is free software; you can redistribute it and/or modify
5+ * it under the terms of the GNU General Public License as published by
6+ * the Free Software Foundation; version 3.
7+ *
8+ * This program is distributed in the hope that it will be useful,
9+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
10+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+ * GNU General Public License for more details.
12+ *
13+ * You should have received a copy of the GNU General Public License
14+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
15+ */
16+
17+#ifndef VERTICALJOURNAL_H
18+#define VERTICALJOURNAL_H
19+
20+#include <QQuickItem>
21+
22+class QAbstractItemModel;
23+class QQmlComponent;
24+#if (QT_VERSION < QT_VERSION_CHECK(5, 1, 0))
25+class QQuickChangeSet;
26+class QQuickVisualDataModel;
27+#else
28+class QQmlChangeSet;
29+class QQmlDelegateModel;
30+#endif
31+
32+ /** A vertical journal is a view that creates delegates
33+ * based on a model and layouts them in columns following
34+ * a top-left most position rule.
35+ *
36+ * The number of columns is calculated using the width of
37+ * the view itself, the columnWidth (i.e. the width of each individual delegate)
38+ * and the columnSpacing between columns.
39+ *
40+ * All delegates are forced to columnWidth if they don't have it.
41+ *
42+ * The first nColumns items are layouted at row 0 from column 0
43+ * to column nColumns-1 in order. After that every new item
44+ * is positioned in the column which provides the free topmost
45+ * position as possible. If more than one column tie in providing
46+ * the topmost free position the leftmost column will be used.
47+ *
48+ * Example:
49+ *
50+ * +-----+ +-----+ +-----+
51+ * | | | 2 | | |
52+ * | | | | | |
53+ * | 1 | +-----+ | 3 |
54+ * | | +-----+ | |
55+ * | | | | +-----+
56+ * +-----+ | 4 | +-----+
57+ * +-----+ | | | 5 |
58+ * | 6 | +-----+ | |
59+ * | | +-----+
60+ * +-----+
61+ *
62+ */
63+ class VerticalJournal : public QQuickItem
64+{
65+ Q_OBJECT
66+
67+ Q_PROPERTY(QAbstractItemModel *model READ model WRITE setModel NOTIFY modelChanged)
68+ Q_PROPERTY(QQmlComponent *delegate READ delegate WRITE setDelegate NOTIFY delegateChanged)
69+ Q_PROPERTY(qreal columnWidth READ columnWidth WRITE setColumnWidth NOTIFY columnWidthChanged)
70+ Q_PROPERTY(qreal columnSpacing READ columnSpacing WRITE setColumnSpacing NOTIFY columnSpacingChanged)
71+ Q_PROPERTY(qreal rowSpacing READ rowSpacing WRITE setRowSpacing NOTIFY rowSpacingChanged)
72+ Q_PROPERTY(qreal delegateCreationBegin READ delegateCreationBegin
73+ WRITE setDelegateCreationBegin
74+ NOTIFY delegateCreationBeginChanged
75+ RESET resetDelegateCreationBegin)
76+ Q_PROPERTY(qreal delegateCreationEnd READ delegateCreationEnd
77+ WRITE setDelegateCreationEnd
78+ NOTIFY delegateCreationEndChanged
79+ RESET resetDelegateCreationEnd)
80+
81+friend class VerticalJournalTest;
82+
83+public:
84+ VerticalJournal();
85+
86+ QAbstractItemModel *model() const;
87+ void setModel(QAbstractItemModel *model);
88+
89+ QQmlComponent *delegate() const;
90+ void setDelegate(QQmlComponent *delegate);
91+
92+ qreal columnWidth() const;
93+ void setColumnWidth(qreal columnWidth);
94+
95+ qreal columnSpacing() const;
96+ void setColumnSpacing(qreal columnSpacing);
97+
98+ qreal rowSpacing() const;
99+ void setRowSpacing(qreal rowSpacing);
100+
101+ qreal delegateCreationBegin() const;
102+ void setDelegateCreationBegin(qreal);
103+ void resetDelegateCreationBegin();
104+
105+ qreal delegateCreationEnd() const;
106+ void setDelegateCreationEnd(qreal);
107+ void resetDelegateCreationEnd();
108+
109+Q_SIGNALS:
110+ void modelChanged();
111+ void delegateChanged();
112+ void columnWidthChanged();
113+ void columnSpacingChanged();
114+ void rowSpacingChanged();
115+ void delegateCreationBeginChanged();
116+ void delegateCreationEndChanged();
117+
118+protected:
119+ void updatePolish();
120+ void componentComplete();
121+
122+private Q_SLOTS:
123+#if (QT_VERSION < QT_VERSION_CHECK(5, 1, 0))
124+ void itemCreated(int modelIndex, QQuickItem *item);
125+ void onModelUpdated(const QQuickChangeSet &changeSet, bool reset);
126+#else
127+ void itemCreated(int modelIndex, QObject *object);
128+ void onModelUpdated(const QQmlChangeSet &changeSet, bool reset);
129+#endif
130+ void relayout();
131+ void onHeightChanged();
132+
133+private:
134+ class ViewItem
135+ {
136+ public:
137+ ViewItem(QQuickItem *item, int modelIndex) : m_item(item), m_modelIndex(modelIndex) {}
138+ qreal x() const { return m_item->x(); }
139+ qreal y() const { return m_item->y(); }
140+ qreal height() const { return m_item->height(); }
141+ bool operator<(const ViewItem &v) const { return m_modelIndex < v.m_modelIndex; }
142+
143+ QQuickItem *m_item;
144+ int m_modelIndex;
145+ };
146+
147+ void createDelegateModel();
148+ void refill();
149+ void findBottomModelIndexToAdd(int *modelIndex, qreal *yPos);
150+ void findTopModelIndexToAdd(int *modelIndex, qreal *yPos);
151+ bool addVisibleItems(qreal fillFrom, qreal fillTo, bool asynchronous);
152+ bool removeNonVisibleItems(qreal bufferFrom, qreal bufferTo);
153+ QQuickItem *createItem(int modelIndex, bool asynchronous);
154+ void positionItem(int modelIndex, QQuickItem *item);
155+ void cleanupExistingItems();
156+ void releaseItem(const ViewItem &item);
157+ void calculateImplicitHeight();
158+
159+#if (QT_VERSION < QT_VERSION_CHECK(5, 1, 0))
160+ QQuickVisualDataModel *m_delegateModel;
161+#else
162+ QQmlDelegateModel *m_delegateModel;
163+#endif
164+
165+ // Index we are waiting because we requested it asynchronously
166+ int m_asyncRequestedIndex;
167+
168+ QVector<QList<ViewItem>> m_columnVisibleItems;
169+ QHash<int, int> m_indexColumnMap;
170+ int m_columnWidth;
171+ int m_columnSpacing;
172+ int m_rowSpacing;
173+ qreal m_delegateCreationBegin;
174+ qreal m_delegateCreationEnd;
175+ bool m_delegateCreationBeginValid;
176+ bool m_delegateCreationEndValid;
177+ bool m_needsRelayout;
178+ bool m_delegateValidated;
179+ bool m_implicitHeightDirty;
180+};
181+
182+#endif
plugins/LightDM/CMakeLists.txt+1
@@ -9,6 +9,7 @@ pkg_check_modules(LIBUSERMETRICSOUTPUT REQUIRED libusermetricsoutput-1)
9include_directories(
9include_directories(
10 ${CMAKE_CURRENT_SOURCE_DIR}
10 ${CMAKE_CURRENT_SOURCE_DIR}
11 ${CMAKE_CURRENT_BINARY_DIR}
11 ${CMAKE_CURRENT_BINARY_DIR}
12+ ${CMAKE_SOURCE_DIR}/plugins/Utils
12 ${LIBLIGHTDM_INCLUDE_DIRS}
13 ${LIBLIGHTDM_INCLUDE_DIRS}
13 ${LIBUSERMETRICSOUTPUT_INCLUDE_DIRS}
14 ${LIBUSERMETRICSOUTPUT_INCLUDE_DIRS}
14)
15)
plugins/LightDM/UsersModel.h+1−1
@@ -23,7 +23,7 @@
23#ifndef UNITY_USERSMODEL_H
23#ifndef UNITY_USERSMODEL_H
24#define UNITY_USERSMODEL_H
24#define UNITY_USERSMODEL_H
25
25
26−#include "plugins/Utils/qsortfilterproxymodelqml.h"
26+#include <qsortfilterproxymodelqml.h>
27#include <QtCore/QObject>
27#include <QtCore/QObject>
28
28
29class UsersModel : public QSortFilterProxyModelQML
29class UsersModel : public QSortFilterProxyModelQML
plugins/ListViewWithPageHeader/qmldirdeleted−3
@@ -1,3 +0,0 @@
1−module ListViewWithPageHeader
2−plugin ListViewWithPageHeader-qml
3−typeinfo plugin.qmltypes
plugins/Unity/Indicators/CMakeLists.txt−1
@@ -36,7 +36,6 @@ set(IndicatorsQML_SOURCES
36 unitymenumodelcache.cpp
36 unitymenumodelcache.cpp
37 unitymenumodelstack.cpp
37 unitymenumodelstack.cpp
38 visibleindicatorsmodel.cpp
38 visibleindicatorsmodel.cpp
39− timeformatter.cpp
40)
39)
41add_definitions(-DUNITYINDICATORS_LIBRARY)
40add_definitions(-DUNITYINDICATORS_LIBRARY)
42
41
plugins/Unity/Indicators/Messaging/qml/MessageMenuItemFactory.qml+82−47
@@ -24,12 +24,39 @@ import Unity.Indicators 0.1 as Indicators
24import QMenuModel 0.1 as QMenuModel
24import QMenuModel 0.1 as QMenuModel
25
25
26Indicators.BaseMenuItem {
26Indicators.BaseMenuItem {
27− id: menuItem
27+ id: messageFactoryItem
28− property var actionsDescription: menu ? menu.ext.xCanonicalMessageActions : undefined
28+ property var menuModel: null
29+ property QtObject menuData: null
30+ property int menuIndex: -1
29
31
30− implicitHeight: contents.status == Loader.Ready ? contents.item.implicitHeight : 0
32+ property var extendedData: menuData && menuData.ext || undefined
33+ property var actionsDescription: getExtendedProperty(extendedData, "xCanonicalMessageActions", undefined)
34+
35+ onMenuModelChanged: {
36+ loadAttributes();
37+ }
38+ onMenuIndexChanged: {
39+ loadAttributes();
40+ }
31
41
32− property var model: null
42+ function loadAttributes() {
43+ if (!menuModel || menuIndex == undefined) return;
44+
45+ menuModel.loadExtendedAttributes(menuIndex, {'x-canonical-time': 'int64',
46+ 'x-canonical-text': 'string',
47+ 'x-canonical-message-actions': 'variant',
48+ 'icon': 'icon',
49+ 'x-canonical-app-icon': 'icon'});
50+ }
51+
52+ function getExtendedProperty(object, propertyName, defaultValue) {
53+ if (object && object.hasOwnProperty(propertyName)) {
54+ return object[propertyName];
55+ }
56+ return defaultValue;
57+ }
58+
59+ implicitHeight: contents.status == Loader.Ready ? contents.item.implicitHeight : 0
33
60
34 Loader {
61 Loader {
35 id: contents
62 id: contents
@@ -41,93 +68,101 @@ Indicators.BaseMenuItem {
41 id: simpleTextMessage
68 id: simpleTextMessage
42 SimpleTextMessage {
69 SimpleTextMessage {
43 // text
70 // text
44− title: menu && menu.label ? menu.label : ""
71+ title: menuData && menuData.label || ""
45− time: menu ? menu.ext.xCanonicalTime : 0
72+ time: getExtendedProperty(extendedData, "xCanonicalTime", 0)
46− message: menu && menu.ext.xCanonicalText ? menu.ext.xCanonicalText : ""
73+ message: getExtendedProperty(extendedData, "xCanonicalText", "")
47 // icons
74 // icons
48− avatar: menu && menu.ext.icon !== undefined ? menu.ext.icon : "qrc:/indicators/artwork/messaging/default_contact.png"
75+ avatar: getExtendedProperty(extendedData, "icon", "qrc:/indicators/artwork/messaging/default_contact.png")
49− appIcon: menu && menu.ext.xCanonicalAppIcon !== undefined ? menu.ext.xCanonicalAppIcon : "qrc:/indicators/artwork/messaging/default_app.svg"
76+ appIcon: getExtendedProperty(extendedData, "xCanonicalAppIcon", "qrc:/indicators/artwork/messaging/default_app.svg")
50
77
51 onActivateApp: {
78 onActivateApp: {
52− menuItem.model.activate(modelIndex, true);
79+ menuModel.activate(menuIndex, true);
80+ shell.hideIndicatorMenu(UbuntuAnimation.FastDuration);
53 }
81 }
54 onDismiss: {
82 onDismiss: {
55− menuItem.model.activate(modelIndex, false);
83+ menuModel.activate(menuIndex, false);
56 }
84 }
57
85
58− menuSelected: menuItem.menuSelected
86+ menuSelected: messageFactoryItem.menuSelected
59− onSelectMenu: menuItem.selectMenu()
87+ onSelectMenu: messageFactoryItem.selectMenu()
60− onDeselectMenu: menuItem.deselectMenu()
88+ onDeselectMenu: messageFactoryItem.deselectMenu()
61 }
89 }
62 }
90 }
63 Component {
91 Component {
64 id: textMessage
92 id: textMessage
65 TextMessage {
93 TextMessage {
94+ property var replyActionDescription: actionsDescription && actionsDescription.length > 0 ? actionsDescription[0] : undefined
95+
66 property var replyAction: QMenuModel.UnityMenuAction {
96 property var replyAction: QMenuModel.UnityMenuAction {
67− model: menuItem.model
97+ model: menuModel
68− index: modelIndex
98+ index: menuIndex
69− name: menu && actionsDescription[0].name ? actionsDescription[0].name : ""
99+ name: getExtendedProperty(replyActionDescription, "name", "")
70 }
100 }
71
101
72 // text
102 // text
73− title: menu && menu.label ? menu.label : ""
103+ title: menuData && menuData.label || ""
74− time: menu ? menu.ext.xCanonicalTime : 0
104+ time: getExtendedProperty(extendedData, "xCanonicalTime", 0)
75− message: menu && menu.ext.xCanonicalText ? menu.ext.xCanonicalText : ""
105+ message: getExtendedProperty(extendedData, "xCanonicalText", "")
76− replyButtonText: actionsDescription && actionsDescription[0].label ? actionsDescription[0].label : "Send"
106+ replyButtonText: getExtendedProperty(replyActionDescription, "label", "Send")
77 // icons
107 // icons
78− avatar: menu && menu.ext.icon !== undefined ? menu.ext.icon : "qrc:/indicators/artwork/messaging/default_contact.png"
108+ avatar: getExtendedProperty(extendedData, "icon", "qrc:/indicators/artwork/messaging/default_contact.png")
79− appIcon: menu && menu.ext.xCanonicalAppIcon !== undefined ? menu.ext.xCanonicalAppIcon : "qrc:/indicators/artwork/messaging/default_app.svg"
109+ appIcon: getExtendedProperty(extendedData, "xCanonicalAppIcon", "qrc:/indicators/artwork/messaging/default_app.svg")
80 // actions
110 // actions
81 replyEnabled: replyAction.valid && replyAction.enabled
111 replyEnabled: replyAction.valid && replyAction.enabled
82
112
83 onActivateApp: {
113 onActivateApp: {
84− menuItem.model.activate(modelIndex, true);
114+ menuModel.activate(menuIndex, true);
115+ shell.hideIndicatorMenu(UbuntuAnimation.FastDuration);
85 }
116 }
86 onDismiss: {
117 onDismiss: {
87− menuItem.model.activate(modelIndex, false);
118+ menuModel.activate(menuIndex, false);
88 }
119 }
89 onReply: {
120 onReply: {
90 replyAction.activate(value);
121 replyAction.activate(value);
91 }
122 }
92
123
93− menuSelected: menuItem.menuSelected
124+ menuSelected: messageFactoryItem.menuSelected
94− onSelectMenu: menuItem.selectMenu()
125+ onSelectMenu: messageFactoryItem.selectMenu()
95− onDeselectMenu: menuItem.deselectMenu()
126+ onDeselectMenu: messageFactoryItem.deselectMenu()
96 }
127 }
97 }
128 }
98 Component {
129 Component {
99 id: snapDecision
130 id: snapDecision
100 SnapDecision {
131 SnapDecision {
132+ property var activateActionDescription: actionsDescription && actionsDescription.length > 0 ? actionsDescription[0] : undefined
133+ property var replyActionDescription: actionsDescription && actionsDescription.length > 1 ? actionsDescription[1] : undefined
134+
101 property var activateAction: QMenuModel.UnityMenuAction {
135 property var activateAction: QMenuModel.UnityMenuAction {
102− model: menuItem.model
136+ model: menuModel
103− index: modelIndex
137+ index: menuIndex
104− name: menu && actionsDescription[0].name ? actionsDescription[0].name : ""
138+ name: getExtendedProperty(activateActionDescription, "name", "")
105 }
139 }
106 property var replyAction: QMenuModel.UnityMenuAction {
140 property var replyAction: QMenuModel.UnityMenuAction {
107− model: menuItem.model
141+ model: menuModel
108− index: modelIndex
142+ index: menuIndex
109− name: menu && actionsDescription[1].name ? actionsDescription[1].name : ""
143+ name: getExtendedProperty(replyActionDescription, "name", "")
110 }
144 }
111
145
112 // text
146 // text
113− title: menu && menu.label ? menu.label : ""
147+ title: menuData && menuData.label || ""
114− time: menu ? menu.ext.xCanonicalTime : ""
148+ time: getExtendedProperty(extendedData, "xCanonicalTime", 0)
115− message: menu && menu.ext.xCanonicalText ? menu.ext.xCanonicalText : ""
149+ message: getExtendedProperty(extendedData, "xCanonicalText", "")
116− actionButtonText: actionsDescription && actionsDescription[0].label ? actionsDescription[0].label : "Call back"
150+ actionButtonText: getExtendedProperty(activateActionDescription, "label", "Call back")
117− replyButtonText: actionsDescription && actionsDescription[1].label ? actionsDescription[1].label : "Send"
151+ replyButtonText: getExtendedProperty(replyActionDescription, "label", "Send")
118− replyMessages: actionsDescription && actionsDescription[1]["parameter-hint"] ? actionsDescription[1]["parameter-hint"] : ""
152+ replyMessages: getExtendedProperty(replyActionDescription, "parameter-hint", "")
119 // icons
153 // icons
120− avatar: menu && menu.ext.icon !== undefined ? menu.ext.icon : "qrc:/indicators/artwork/messaging/default_contact.png"
154+ avatar: getExtendedProperty(extendedData, "icon", "qrc:/indicators/artwork/messaging/default_contact.png")
121− appIcon: menu && menu.ext.xCanonicalAppIcon !== undefined ? menu.ext.xCanonicalAppIcon : "qrc:/indicators/artwork/messaging/default_app.svg"
155+ appIcon: getExtendedProperty(extendedData, "xCanonicalAppIcon", "qrc:/indicators/artwork/messaging/default_app.svg")
122 // actions
156 // actions
123 activateEnabled: activateAction.valid && activateAction.enabled
157 activateEnabled: activateAction.valid && activateAction.enabled
124 replyEnabled: replyAction.valid && replyAction.enabled
158 replyEnabled: replyAction.valid && replyAction.enabled
125
159
126 onActivateApp: {
160 onActivateApp: {
127− menuItem.model.activate(modelIndex, true);
161+ menuModel.activate(menuIndex, true);
162+ shell.hideIndicatorMenu(UbuntuAnimation.FastDuration);
128 }
163 }
129 onDismiss: {
164 onDismiss: {
130− menuItem.model.activate(modelIndex, false);
165+ menuModel.activate(menuIndex, false);
131 }
166 }
132 onActivate: {
167 onActivate: {
133 activateAction.activate();
168 activateAction.activate();
@@ -136,9 +171,9 @@ Indicators.BaseMenuItem {
136 replyAction.activate(value);
171 replyAction.activate(value);
137 }
172 }
138
173
139− menuSelected: menuItem.menuSelected
174+ menuSelected: messageFactoryItem.menuSelected
140− onSelectMenu: menuItem.selectMenu()
175+ onSelectMenu: messageFactoryItem.selectMenu()
141− onDeselectMenu: menuItem.deselectMenu()
176+ onDeselectMenu: messageFactoryItem.deselectMenu()
142 }
177 }
143 }
178 }
144 }
179 }
plugins/Unity/Indicators/Messaging/qml/SimpleTextMessage.qml+2−1
@@ -21,6 +21,7 @@
21import QtQuick 2.0
21import QtQuick 2.0
22import Ubuntu.Components 0.1
22import Ubuntu.Components 0.1
23import Unity.Indicators 0.1
23import Unity.Indicators 0.1
24+import Utils 0.1 as Utils
24
25
25HeroMessage {
26HeroMessage {
26 id: __heroMessage
27 id: __heroMessage
@@ -50,7 +51,7 @@ HeroMessage {
50 opacity: 0.0
51 opacity: 0.0
51 enabled: false
52 enabled: false
52
53
53− TimeFormatter {
54+ Utils.TimeFormatter {
54 id: timeFormatter
55 id: timeFormatter
55 time: __heroMessage.time
56 time: __heroMessage.time
56 format: "hh:mm - MMM dd"
57 format: "hh:mm - MMM dd"
plugins/Unity/Indicators/Messaging/qml/SnapDecision.qml+2−2
@@ -20,8 +20,8 @@
20
20
21import QtQuick 2.0
21import QtQuick 2.0
22import Ubuntu.Components 0.1
22import Ubuntu.Components 0.1
23−import Unity.Indicators 0.1 as Indicators
24import Unity.Indicators 0.1
23import Unity.Indicators 0.1
24+import Utils 0.1 as Utils
25
25
26HeroMessage {
26HeroMessage {
27 id: snapDecision
27 id: snapDecision
@@ -59,7 +59,7 @@ HeroMessage {
59 height: units.gu(4)
59 height: units.gu(4)
60 opacity: 0.0
60 opacity: 0.0
61
61
62− TimeFormatter {
62+ Utils.TimeFormatter {
63 id: timeFormatter
63 id: timeFormatter
64 time: snapDecision.time
64 time: snapDecision.time
65 format: "hh:mm - MMM dd"
65 format: "hh:mm - MMM dd"
plugins/Unity/Indicators/indicatorsmanager.cpp+1−1
@@ -24,7 +24,7 @@
24#include <upstart.h>
24#include <upstart.h>
25#include <nih/alloc.h>
25#include <nih/alloc.h>
26
26
27−#include "paths.h"
27+#include <paths.h>
28
28
29const QString default_profile = "phone";
29const QString default_profile = "phone";
30
30
plugins/Unity/Indicators/indicatorsmodel.cpp+4−3
@@ -21,7 +21,8 @@
21#include "indicatorsmanager.h"
21#include "indicatorsmanager.h"
22#include "indicator.h"
22#include "indicator.h"
23#include "indicators.h"
23#include "indicators.h"
24+
24−#include "paths.h"
25+#include <paths.h>
25
26
26#include <QQmlContext>
27#include <QQmlContext>
27#include <QQmlEngine>
28#include <QQmlEngine>
@@ -248,9 +249,9 @@ QVariant IndicatorsModel::data(const QModelIndex &index, int role) const
248 }
249 }
249 break;
250 break;
250 case IndicatorsModelRole::WidgetSource:
251 case IndicatorsModelRole::WidgetSource:
251− return shellAppDirectory()+"/Panel/Indicators/DefaultIndicatorWidget.qml";
252+ return qmlDirectory()+"/Panel/Indicators/DefaultIndicatorWidget.qml";
252 case IndicatorsModelRole::PageSource:
253 case IndicatorsModelRole::PageSource:
253− return shellAppDirectory()+"/Panel/Indicators/DefaultIndicatorPage.qml";
254+ return qmlDirectory()+"/Panel/Indicators/DefaultIndicatorPage.qml";
254 default:
255 default:
255 break;
256 break;
256 }
257 }
plugins/Unity/Indicators/plugin.cpp−2
@@ -33,7 +33,6 @@
33#include "unitymenumodelcache.h"
33#include "unitymenumodelcache.h"
34#include "unitymenumodelstack.h"
34#include "unitymenumodelstack.h"
35#include "visibleindicatorsmodel.h"
35#include "visibleindicatorsmodel.h"
36−#include "timeformatter.h"
37
36
38static QObject* menuModelCacheSingleton(QQmlEngine* engine, QJSEngine* scriptEngine) {
37static QObject* menuModelCacheSingleton(QQmlEngine* engine, QJSEngine* scriptEngine) {
39 Q_UNUSED(engine);
38 Q_UNUSED(engine);
@@ -52,7 +51,6 @@ void Indicators2Plugin::registerTypes(const char *uri)
52 qmlRegisterType<RootActionState>(uri, 0, 1, "RootActionState");
51 qmlRegisterType<RootActionState>(uri, 0, 1, "RootActionState");
53 qmlRegisterType<ModelPrinter>(uri, 0, 1, "ModelPrinter");
52 qmlRegisterType<ModelPrinter>(uri, 0, 1, "ModelPrinter");
54 qmlRegisterType<VisibleIndicatorsModel>(uri, 0, 1, "VisibleIndicatorsModel");
53 qmlRegisterType<VisibleIndicatorsModel>(uri, 0, 1, "VisibleIndicatorsModel");
55− qmlRegisterType<TimeFormatter>(uri, 0, 1, "TimeFormatter");
56
54
57 qmlRegisterSingletonType<UnityMenuModelCache>(uri, 0, 1, "UnityMenuModelCache", menuModelCacheSingleton);
55 qmlRegisterSingletonType<UnityMenuModelCache>(uri, 0, 1, "UnityMenuModelCache", menuModelCacheSingleton);
58
56
plugins/Unity/Indicators/qml/IndicatorPage.qml+6−4
@@ -144,9 +144,11 @@ IndicatorBase {
144 item.selectMenu.connect(function() { mainMenu.selectedIndex = index; });
144 item.selectMenu.connect(function() { mainMenu.selectedIndex = index; });
145 item.deselectMenu.connect(function() { mainMenu.selectedIndex = -1; });
145 item.deselectMenu.connect(function() { mainMenu.selectedIndex = -1; });
146 }
146 }
147−
148− if (item.hasOwnProperty("menu")) {
147+ if (item.hasOwnProperty("menuData")) {
149− item.menu = Qt.binding(function() { return model; });
148+ item.menuData = Qt.binding(function() { return model; });
149+ }
150+ if (item.hasOwnProperty("menuIndex")) {
151+ item.menuIndex = Qt.binding(function() { return modelIndex; });
150 }
152 }
151 }
153 }
152
154
@@ -172,7 +174,7 @@ IndicatorBase {
172
174
173 MenuItemFactory {
175 MenuItemFactory {
174 id: factory
176 id: factory
175− model: mainMenu.model
177+ menuModel: mainMenu.model ? mainMenu.model : null
176 }
178 }
177
179
178 Components.Label {
180 Components.Label {
plugins/Unity/Indicators/qml/MenuItemFactory.qml+138−85
@@ -22,11 +22,12 @@ import Unity.Indicators 0.1 as Indicators
22import Unity.Indicators.Network 0.1 as ICNetwork
22import Unity.Indicators.Network 0.1 as ICNetwork
23import Unity.Indicators.Messaging 0.1 as ICMessaging
23import Unity.Indicators.Messaging 0.1 as ICMessaging
24import QMenuModel 0.1 as QMenuModel
24import QMenuModel 0.1 as QMenuModel
25+import Ubuntu.Components 0.1
25
26
26Item {
27Item {
27 id: menuFactory
28 id: menuFactory
28
29
29− property var model: null
30+ property var menuModel: null
30
31
31 property var _map: {
32 property var _map: {
32 "unity.widgets.systemsettings.tablet.volumecontrol" : sliderMenu,
33 "unity.widgets.systemsettings.tablet.volumecontrol" : sliderMenu,
@@ -49,38 +50,55 @@ Item {
49 "unity.widgets.systemsettings.tablet.accesspoint" : accessPoint,
50 "unity.widgets.systemsettings.tablet.accesspoint" : accessPoint,
50 }
51 }
51
52
53+ function getExtendedProperty(object, propertyName, defaultValue) {
54+ if (object && object.hasOwnProperty(propertyName)) {
55+ return object[propertyName];
56+ }
57+ return defaultValue;
58+ }
59+
52 Component { id: divMenu; Indicators.DivMenuItem {} }
60 Component { id: divMenu; Indicators.DivMenuItem {} }
53
61
54 Component {
62 Component {
55 id: sliderMenu;
63 id: sliderMenu;
56 Indicators.SliderMenuItem {
64 Indicators.SliderMenuItem {
57− property QtObject menu: null
65+ property QtObject menuData: null
66+ property var menuModel: menuFactory.menuModel
67+ property int menuIndex: -1
68+ property var extendedData: menuData && menuData.ext || undefined
58
69
59− text: menu && menu.label ? menu.label : ""
70+ text: menuData && menuData.label || ""
60− icon: menu && menu.icon ? menu.icon : ""
71+ iconSource: menuData && menuData.icon || ""
61− minIcon: menu && menu.ext.minIcon ? menu.ext.minIcon : ""
72+ minIcon: getExtendedProperty(extendedData, "minIcon", "")
62− maxIcon: menu && menu.ext.maxIcon ? menu.ext.maxIcon : ""
73+ maxIcon: getExtendedProperty(extendedData, "maxIcon", "")
63
74
64− minimumValue: menu.ext.minValue ? menu.ext.minValue : 0.0
75+ minimumValue: getExtendedProperty(extendedData, "minValue", 0.0)
65 maximumValue: {
76 maximumValue: {
66− var maximum = menu.ext.maxValue ? menu.ext.maxValue : 1.0
77+ var maximum = getExtendedProperty(extendedData, "maxValue", 1.0);
67 if (maximum <= minimumValue) {
78 if (maximum <= minimumValue) {
68 return minimumValue + 1;
79 return minimumValue + 1;
69 }
80 }
70 return maximum;
81 return maximum;
71 }
82 }
72− value: menu ? menu.actionState : 0.0
83+ value: menuData && menuData.actionState || 0.0
73− enabled: menu ? menu.sensitive : false
84+ enabled: menuData && menuData.sensitive || false
74
85
75− Component.onCompleted: {
86+ onMenuModelChanged: {
76− model.loadExtendedAttributes(modelIndex, {'min-value': 'double',
87+ loadAttributes();
77− 'max-value': 'double',
88+ }
78− 'min-icon': 'icon',
89+ onMenuIndexChanged: {
79− 'max-icon': 'icon'});
90+ loadAttributes();
80 }
91 }
81−
82 onChangeState: {
92 onChangeState: {
83− model.changeState(modelIndex, value);
93+ menuModel.changeState(menuIndex, value);
94+ }
95+
96+ function loadAttributes() {
97+ if (!menuModel || menuIndex == undefined) return;
98+ menuModel.loadExtendedAttributes(menuIndex, {'min-value': 'double',
99+ 'max-value': 'double',
100+ 'min-icon': 'icon',
101+ 'max-icon': 'icon'});
84 }
102 }
85 }
103 }
86 }
104 }
@@ -88,50 +106,57 @@ Item {
88 Component {
106 Component {
89 id: buttonMenu;
107 id: buttonMenu;
90 Indicators.ButtonMenuItem {
108 Indicators.ButtonMenuItem {
91− property QtObject menu: null
109+ property QtObject menuData: null
110+ property var menuModel: menuFactory.menuModel
111+ property int menuIndex: -1
92
112
93− text: menu && menu.label ? menu.label : ""
113+ text: menuData && menuData.label || ""
94− enabled: menu ? menu.sensitive : false
114+ enabled: menuData && menuData.sensitive || false
95
115
96 onActivate: {
116 onActivate: {
97− model.activate(modelIndex);
117+ menuModel.activate(menuIndex);
118+ shell.hideIndicatorMenu(UbuntuAnimation.FastDuration);
98 }
119 }
99 }
120 }
100 }
121 }
101 Component {
122 Component {
102 id: sectionMenu;
123 id: sectionMenu;
103 Indicators.SectionMenuItem {
124 Indicators.SectionMenuItem {
104− property QtObject menu: null
125+ property QtObject menuData: null
126+ property var menuIndex: undefined
105
127
106− text: menu && menu.label ? menu.label : ""
128+ text: menuData && menuData.label || ""
107 }
129 }
108 }
130 }
109
131
110 Component {
132 Component {
111 id: progressMenu;
133 id: progressMenu;
112 Indicators.ProgressMenuItem {
134 Indicators.ProgressMenuItem {
113− property QtObject menu: null
135+ property QtObject menuData: null
136+ property int menuIndex: -1
114
137
115− text: menu && menu.label ? menu.label : ""
138+ text: menuData && menuData.label || ""
116− icon: menu ? menu.icon : ""
139+ iconSource: menuData && menuData.icon || ""
117− value : menu ? menu.actionState : 0.0
140+ value : menuData && menuData.actionState || 0.0
118− enabled: menu ? menu.sensitive : false
141+ enabled: menuData && menuData.sensitive || false
119 }
142 }
120 }
143 }
121
144
122 Component {
145 Component {
123 id: standardMenu;
146 id: standardMenu;
124 Indicators.StandardMenuItem {
147 Indicators.StandardMenuItem {
125− property QtObject menu: null
148+ property QtObject menuData: null
149+ property int menuIndex: -1
126
150
127− text: menu && menu.label ? menu.label : ""
151+ text: menuData && menuData.label || ""
128− icon: menu && menu.icon ? menu.icon : ""
152+ iconSource: menuData && menuData.icon || ""
153+ enabled: menuData && menuData.sensitive || false
129− checkable: menu ? (menu.isCheck || menu.isRadio) : false
154+ checkable: menuData ? (menuData.isCheck || menuData.isRadio) : false
130− checked: checkable ? menu.isToggled : false
155+ checked: checkable ? menuData.isToggled : false
131− enabled: menu ? menu.sensitive : false
132
156
133 onActivate: {
157 onActivate: {
134− model.activate(modelIndex);
158+ menuModel.activate(menuIndex);
159+ shell.hideIndicatorMenu(UbuntuAnimation.BriskDuration);
135 }
160 }
136 }
161 }
137 }
162 }
@@ -139,15 +164,17 @@ Item {
139 Component {
164 Component {
140 id: switchMenu;
165 id: switchMenu;
141 Indicators.SwitchMenuItem {
166 Indicators.SwitchMenuItem {
142− property QtObject menu: null
167+ property QtObject menuData: null
168+ property int menuIndex: -1
143
169
144− text: menu && menu.label ? menu.label : ""
170+ text: menuData && menuData.label || ""
145− icon: menu && menu.icon ? menu.icon : ""
171+ iconSource: menuData && menuData.icon || ""
172+ enabled: menuData && menuData.sensitive || false
146− checked: menu ? menu.isToggled : false
173+ checked: menuData ? menuData.isToggled : false
147− enabled: menu ? menu.sensitive : false
148
174
149 onActivate: {
175 onActivate: {
150− model.activate(modelIndex);
176+ menuModel.activate(menuIndex);
177+ shell.hideIndicatorMenu(UbuntuAnimation.BriskDuration);
151 }
178 }
152 }
179 }
153 }
180 }
@@ -155,13 +182,24 @@ Item {
155 Component {
182 Component {
156 id: wifiSection;
183 id: wifiSection;
157 Indicators.SectionMenuItem {
184 Indicators.SectionMenuItem {
158− property QtObject menu: null
185+ property QtObject menuData: null
186+ property var menuModel: menuFactory.menuModel
187+ property int menuIndex: -1
188+ property var extendedData: menuData && menuData.ext || undefined
189+
190+ text: menuData && menuData.label || ""
191+ busy: getExtendedProperty(extendedData, "xCanonicalBusyAction", false)
159
192
160− text: menu && menu.label ? menu.label : ""
193+ onMenuModelChanged: {
161− busy: menu ? menu.ext.xCanonicalBusyAction : false
194+ loadAttributes();
195+ }
196+ onMenuIndexChanged: {
197+ loadAttributes();
198+ }
162
199
163− Component.onCompleted: {
200+ function loadAttributes() {
201+ if (!menuModel || menuIndex == undefined) return;
164− model.loadExtendedAttributes(modelIndex, {'x-canonical-busy-action': 'bool'});
202+ menuModel.loadExtendedAttributes(menuIndex, {'x-canonical-busy-action': 'bool'})
165 }
203 }
166 }
204 }
167 }
205 }
@@ -169,27 +207,40 @@ Item {
169 Component {
207 Component {
170 id: accessPoint;
208 id: accessPoint;
171 ICNetwork.AccessPoint {
209 ICNetwork.AccessPoint {
172− property QtObject menu: null
210+ property QtObject menuData: null
211+ property var menuModel: menuFactory.menuModel
212+ property int menuIndex: -1
213+ property var extendedData: menuData && menuData.ext || undefined
214+
173 property var strengthAction: QMenuModel.UnityMenuAction {
215 property var strengthAction: QMenuModel.UnityMenuAction {
174− model: menuFactory.model ? menuFactory.model : null
216+ model: menuModel
175− index: modelIndex
217+ index: menuIndex
176− name: menu ? menu.ext.xCanonicalWifiApStrengthAction : ""
218+ name: getExtendedProperty(extendedData, "xCanonicalWifiApStrengthAction", "")
177 }
219 }
178
220
179− text: menu && menu.label ? menu.label : ""
221+ text: menuData && menuData.label || ""
222+ enabled: menuData && menuData.sensitive || false
180− secure: menu ? menu.ext.xCanonicalWifiApIsSecure : false
223+ secure: getExtendedProperty(extendedData, "xCanonicalWifiApIsSecure", false)
181− adHoc: menu ? menu.ext.xCanonicalWifiApIsAdhoc : false
224+ adHoc: getExtendedProperty(extendedData, "xCanonicalWifiApIsAdhoc", false)
182− checked: menu ? menu.isToggled : false
225+ checked: menuData ? menuData.isToggled : false
183 signalStrength: strengthAction.valid ? strengthAction.state : 0
226 signalStrength: strengthAction.valid ? strengthAction.state : 0
184− enabled: menu ? menu.sensitive : false
185
227
186− Component.onCompleted: {
228+ onMenuModelChanged: {
187− model.loadExtendedAttributes(modelIndex, {'x-canonical-wifi-ap-is-adhoc': 'bool',
229+ loadAttributes();
188− 'x-canonical-wifi-ap-is-secure': 'bool',
230+ }
189− 'x-canonical-wifi-ap-strength-action': 'string'});
231+ onMenuIndexChanged: {
232+ loadAttributes();
190 }
233 }
191 onActivate: {
234 onActivate: {
192− model.activate(modelIndex);
235+ menuModel.activate(menuIndex);
236+ shell.hideIndicatorMenu(UbuntuAnimation.BriskDuration);
237+ }
238+
239+ function loadAttributes() {
240+ if (!menuModel || menuIndex == undefined) return;
241+ menuModel.loadExtendedAttributes(menuIndex, {'x-canonical-wifi-ap-is-adhoc': 'bool',
242+ 'x-canonical-wifi-ap-is-secure': 'bool',
243+ 'x-canonical-wifi-ap-strength-action': 'string'});
193 }
244 }
194 }
245 }
195 }
246 }
@@ -197,37 +248,40 @@ Item {
197 Component {
248 Component {
198 id: messageItem
249 id: messageItem
199 ICMessaging.MessageMenuItemFactory {
250 ICMessaging.MessageMenuItemFactory {
200−
251+ menuModel: menuFactory.menuModel
201− property QtObject menu: null
202− model: menuFactory.model ? menuFactory.model : null
203−
204− Component.onCompleted: {
205− model.loadExtendedAttributes(modelIndex, {'x-canonical-time': 'int64',
206− 'x-canonical-text': 'string',
207− 'x-canonical-message-actions': 'variant',
208− 'icon': 'icon',
209− 'x-canonical-app-icon': 'icon'});
210− }
211 }
252 }
212 }
253 }
213
254
214 Component {
255 Component {
215 id: groupedMessage
256 id: groupedMessage
216 ICMessaging.GroupedMessage {
257 ICMessaging.GroupedMessage {
217− property QtObject menu: null
258+ property QtObject menuData: null
218−
259+ property var menuModel: menuFactory.menuModel
219− title: menu && menu.label ? menu.label : ""
260+ property int menuIndex: -1
220− count: menu && menu.actionState[0] ? menu.actionState[0] : "0"
261+ property var extendedData: menuData && menuData.ext || undefined
262+
263+ title: menuData && menuData.label || ""
221− appIcon: menu && menu.ext.icon !== undefined ? menu.ext.icon : "qrc:/indicators/artwork/messaging/default_app.svg"
264+ appIcon: getExtendedProperty(extendedData, "icon", "qrc:/indicators/artwork/messaging/default_app.svg")
222−
265+ count: menuData && menuData.actionState.length > 0 ? menuData.actionState[0] : "0"
223− Component.onCompleted: {
266+ enabled: menuData && menuData.sensitive || false
224− model.loadExtendedAttributes(modelIndex, {'icon': 'icon'});
267+
268+ onMenuModelChanged: {
269+ loadAttributes();
270+ }
271+ onMenuIndexChanged: {
272+ loadAttributes();
225 }
273 }
226 onActivateApp: {
274 onActivateApp: {
227− model.activate(modelIndex, true);
275+ menuModel.activate(menuIndex, true);
276+ shell.hideIndicatorMenu(UbuntuAnimation.FastDuration);
228 }
277 }
229 onDismiss: {
278 onDismiss: {
230− model.activate(modelIndex, false);
279+ menuModel.activate(menuIndex, false);
280+ }
281+
282+ function loadAttributes() {
283+ if (!menuModel || menuIndex == undefined) return;
284+ menuModel.loadExtendedAttributes(modelIndex, {'icon': 'icon'});
231 }
285 }
232 }
286 }
233 }
287 }
@@ -238,10 +292,9 @@ Item {
238 if (component !== undefined) {
292 if (component !== undefined) {
239 return component;
293 return component;
240 }
294 }
241− } else {
295+ }
242− if (modelData.isSeparator) {
296+ if (modelData.isSeparator) {
243− return divMenu;
297+ return divMenu;
244− }
245 }
298 }
246 return standardMenu;
299 return standardMenu;
247 }
300 }
plugins/Utils/CMakeLists.txt+1
@@ -16,6 +16,7 @@ set(QMLPLUGIN_SRC
16 mediaartcache.cpp
16 mediaartcache.cpp
17 qlimitproxymodelqml.cpp
17 qlimitproxymodelqml.cpp
18 qsortfilterproxymodelqml.cpp
18 qsortfilterproxymodelqml.cpp
19+ timeformatter.cpp
19 unitymenumodelpaths.cpp
20 unitymenumodelpaths.cpp
20 plugin.cpp
21 plugin.cpp
21 )
22 )
plugins/Utils/plugin.cpp+3
@@ -30,6 +30,7 @@
30#include "bottombarvisibilitycommunicatorshell.h"
30#include "bottombarvisibilitycommunicatorshell.h"
31#include "qlimitproxymodelqml.h"
31#include "qlimitproxymodelqml.h"
32#include "qsortfilterproxymodelqml.h"
32#include "qsortfilterproxymodelqml.h"
33+#include "timeformatter.h"
33#include "unitymenumodelpaths.h"
34#include "unitymenumodelpaths.h"
34
35
35static const char* BOTTOM_BAR_VISIBILITY_COMMUNICATOR_DBUS_PATH = "/BottomBarVisibilityCommunicator";
36static const char* BOTTOM_BAR_VISIBILITY_COMMUNICATOR_DBUS_PATH = "/BottomBarVisibilityCommunicator";
@@ -42,6 +43,8 @@ void UtilsPlugin::registerTypes(const char *uri)
42 qmlRegisterType<QLimitProxyModelQML>(uri, 0, 1, "LimitProxyModel");
43 qmlRegisterType<QLimitProxyModelQML>(uri, 0, 1, "LimitProxyModel");
43 qmlRegisterType<QSortFilterProxyModelQML>(uri, 0, 1, "SortFilterProxyModel");
44 qmlRegisterType<QSortFilterProxyModelQML>(uri, 0, 1, "SortFilterProxyModel");
44 qmlRegisterType<UnityMenuModelPaths>(uri, 0, 1, "UnityMenuModelPaths");
45 qmlRegisterType<UnityMenuModelPaths>(uri, 0, 1, "UnityMenuModelPaths");
46+ qmlRegisterType<TimeFormatter>(uri, 0, 1, "TimeFormatter");
47+ qmlRegisterType<GDateTimeFormatter>(uri, 0, 1, "GDateTimeFormatter");
45 qmlRegisterUncreatableType<BottomBarVisibilityCommunicatorShell>(uri, 0, 1, "BottomBarVisibilityCommunicatorShell", "Can't create BottomBarVisibilityCommunicatorShell");
48 qmlRegisterUncreatableType<BottomBarVisibilityCommunicatorShell>(uri, 0, 1, "BottomBarVisibilityCommunicatorShell", "Can't create BottomBarVisibilityCommunicatorShell");
46}
49}
47
50
plugins/Unity/Indicators/timeformatter.cpp → plugins/Utils/timeformatter.cpprenamed+30−1
@@ -167,6 +167,35 @@ void TimeFormatter::setTime(qint64 time)
167
167
168void TimeFormatter::update()
168void TimeFormatter::update()
169{
169{
170− priv->timeString = QDateTime::fromMSecsSinceEpoch(priv->time / 1000).toString(priv->format);
170+ priv->timeString = formatTime();
171 Q_EMIT timeStringChanged(priv->timeString);
171 Q_EMIT timeStringChanged(priv->timeString);
172}
172}
173+
174+QString TimeFormatter::formatTime() const
175+{
176+ return QDateTime::fromMSecsSinceEpoch(time() / 1000).toString(format());
177+}
178+
179+GDateTimeFormatter::GDateTimeFormatter(QObject* parent)
180+: TimeFormatter(parent)
181+{
182+}
183+
184+QString GDateTimeFormatter::formatTime() const
185+{
186+ gchar* time_string;
187+ GDateTime* datetime;
188+ QByteArray formatBytes = format().toUtf8();
189+
190+ datetime = g_date_time_new_from_unix_local(time());
191+ if (!datetime) {
192+ return "";
193+ }
194+
195+ time_string = g_date_time_format(datetime, formatBytes.constData());
196+ QString formattedTime(QString::fromUtf8(time_string));
197+
198+ g_free(time_string);
199+ g_date_time_unref(datetime);
200+ return formattedTime;
201+}
plugins/Unity/Indicators/timeformatter.h → plugins/Utils/timeformatter.hrenamed+15−3
@@ -19,10 +19,10 @@
19#ifndef TIME_FORMATTER_H
19#ifndef TIME_FORMATTER_H
20#define TIME_FORMATTER_H
20#define TIME_FORMATTER_H
21
21
22−#include "unityindicatorsglobal.h"
23#include <QObject>
22#include <QObject>
24
23
24+// TODO - bug #1260728
25−class UNITYINDICATORS_EXPORT TimeFormatter : public QObject
25+class TimeFormatter : public QObject
26{
26{
27 Q_OBJECT
27 Q_OBJECT
28 Q_PROPERTY(QString format READ format WRITE setFormat NOTIFY formatChanged)
28 Q_PROPERTY(QString format READ format WRITE setFormat NOTIFY formatChanged)
@@ -31,7 +31,7 @@ class UNITYINDICATORS_EXPORT TimeFormatter : public QObject
31
31
32public:
32public:
33 TimeFormatter(QObject *parent = 0);
33 TimeFormatter(QObject *parent = 0);
34− ~TimeFormatter();
34+ virtual ~TimeFormatter();
35
35
36 QString format() const;
36 QString format() const;
37 QString timeString() const;
37 QString timeString() const;
@@ -47,8 +47,20 @@ Q_SIGNALS:
47 void timeStringChanged(const QString &timeString);
47 void timeStringChanged(const QString &timeString);
48 void timeChanged(qint64 time);
48 void timeChanged(qint64 time);
49
49
50+protected:
51+ virtual QString formatTime() const;
52+
50private:
53private:
51 struct TimeFormatterPrivate *priv;
54 struct TimeFormatterPrivate *priv;
52};
55};
53
56
57+class GDateTimeFormatter : public TimeFormatter
58+{
59+public:
60+ GDateTimeFormatter(QObject *parent = 0);
61+
62+protected:
63+ virtual QString formatTime() const;
64+};
65+
54#endif
66#endif
po/ast.po+6−6
@@ -8,15 +8,15 @@ msgstr ""
8"Project-Id-Version: unity8\n"
8"Project-Id-Version: unity8\n"
9"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
9"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
10"POT-Creation-Date: 2013-11-29 09:21+0100\n"
10"POT-Creation-Date: 2013-11-29 09:21+0100\n"
11−"PO-Revision-Date: 2013-10-03 14:02+0000\n"
11+"PO-Revision-Date: 2013-12-11 20:45+0000\n"
12"Last-Translator: ivarela <ivarela@ubuntu.com>\n"
12"Last-Translator: ivarela <ivarela@ubuntu.com>\n"
13"Language-Team: Asturian <ast@li.org>\n"
13"Language-Team: Asturian <ast@li.org>\n"
14"MIME-Version: 1.0\n"
14"MIME-Version: 1.0\n"
15"Content-Type: text/plain; charset=UTF-8\n"
15"Content-Type: text/plain; charset=UTF-8\n"
16"Content-Transfer-Encoding: 8bit\n"
16"Content-Transfer-Encoding: 8bit\n"
17"Plural-Forms: nplurals=2; plural=n != 1;\n"
17"Plural-Forms: nplurals=2; plural=n != 1;\n"
18−"X-Launchpad-Export-Date: 2013-11-30 05:33+0000\n"
18+"X-Launchpad-Export-Date: 2013-12-12 06:02+0000\n"
19−"X-Generator: Launchpad (build 16856)\n"
19+"X-Generator: Launchpad (build 16869)\n"
20
20
21#: Components/EdgeDemoOverlay.qml:151
21#: Components/EdgeDemoOverlay.qml:151
22msgid "Skip intro"
22msgid "Skip intro"
@@ -141,7 +141,7 @@ msgstr "Falando…"
141
141
142#: Notifications/NotificationMenuItemFactory.qml:89
142#: Notifications/NotificationMenuItemFactory.qml:89
143msgid "Show password"
143msgid "Show password"
144−msgstr ""
144+msgstr "Amosar contraseña"
145
145
146#: Panel/SearchIndicator.qml:27
146#: Panel/SearchIndicator.qml:27
147msgid "Search"
147msgid "Search"
@@ -150,11 +150,11 @@ msgstr "Guetar"
150#: plugins/Unity/Launcher/launcheritem.cpp:43
150#: plugins/Unity/Launcher/launcheritem.cpp:43
151#: plugins/Unity/Launcher/launcheritem.cpp:73
151#: plugins/Unity/Launcher/launcheritem.cpp:73
152msgid "Lock to Launcher"
152msgid "Lock to Launcher"
153−msgstr ""
153+msgstr "Caltener nel Llanzador"
154
154
155#: plugins/Unity/Launcher/launcheritem.cpp:73
155#: plugins/Unity/Launcher/launcheritem.cpp:73
156msgid "Unlock from Launcher"
156msgid "Unlock from Launcher"
157−msgstr ""
157+msgstr "Nun caltener nel llanzador"
158
158
159#: Shell.qml:439
159#: Shell.qml:439
160#, qt-format
160#, qt-format
po/my.po+10−10
@@ -8,15 +8,15 @@ msgstr ""
8"Project-Id-Version: unity\n"
8"Project-Id-Version: unity\n"
9"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
9"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
10"POT-Creation-Date: 2013-11-29 09:21+0100\n"
10"POT-Creation-Date: 2013-11-29 09:21+0100\n"
11−"PO-Revision-Date: 2013-10-09 11:35+0000\n"
11+"PO-Revision-Date: 2013-12-12 11:12+0000\n"
12"Last-Translator: Pyae Sone <Unknown>\n"
12"Last-Translator: Pyae Sone <Unknown>\n"
13"Language-Team: Burmese <my@li.org>\n"
13"Language-Team: Burmese <my@li.org>\n"
14"MIME-Version: 1.0\n"
14"MIME-Version: 1.0\n"
15"Content-Type: text/plain; charset=UTF-8\n"
15"Content-Type: text/plain; charset=UTF-8\n"
16"Content-Transfer-Encoding: 8bit\n"
16"Content-Transfer-Encoding: 8bit\n"
17"Plural-Forms: nplurals=1; plural=0;\n"
17"Plural-Forms: nplurals=1; plural=0;\n"
18−"X-Launchpad-Export-Date: 2013-11-30 05:33+0000\n"
18+"X-Launchpad-Export-Date: 2013-12-13 06:46+0000\n"
19−"X-Generator: Launchpad (build 16856)\n"
19+"X-Generator: Launchpad (build 16869)\n"
20
20
21#: Components/EdgeDemoOverlay.qml:151
21#: Components/EdgeDemoOverlay.qml:151
22msgid "Skip intro"
22msgid "Skip intro"
@@ -104,16 +104,16 @@ msgstr "မှတ်ချက်များ-"
104
104
105#: Greeter/Lockscreen.qml:149
105#: Greeter/Lockscreen.qml:149
106msgid "Emergency Call"
106msgid "Emergency Call"
107−msgstr ""
107+msgstr "အရေးပေါ်ခေါ်မည်"
108
108
109#: Greeter/PassphraseLockscreen.qml:59
109#: Greeter/PassphraseLockscreen.qml:59
110#, qt-format
110#, qt-format
111msgid "Hello %1"
111msgid "Hello %1"
112−msgstr ""
112+msgstr "ဟဲလို %1"
113
113
114#: Greeter/PassphraseLockscreen.qml:59
114#: Greeter/PassphraseLockscreen.qml:59
115msgid "Hello"
115msgid "Hello"
116−msgstr ""
116+msgstr "ဟဲလို"
117
117
118#: Hud/HudParametrizedActionsPage.qml:132
118#: Hud/HudParametrizedActionsPage.qml:132
119msgid "Confirm"
119msgid "Confirm"
@@ -137,7 +137,7 @@ msgstr "ပြောနေသည်"
137
137
138#: Notifications/NotificationMenuItemFactory.qml:89
138#: Notifications/NotificationMenuItemFactory.qml:89
139msgid "Show password"
139msgid "Show password"
140−msgstr ""
140+msgstr "စကားဝှက်ကိုပြ"
141
141
142#: Panel/SearchIndicator.qml:27
142#: Panel/SearchIndicator.qml:27
143msgid "Search"
143msgid "Search"
@@ -146,13 +146,13 @@ msgstr "ရှာဖွေ"
146#: plugins/Unity/Launcher/launcheritem.cpp:43
146#: plugins/Unity/Launcher/launcheritem.cpp:43
147#: plugins/Unity/Launcher/launcheritem.cpp:73
147#: plugins/Unity/Launcher/launcheritem.cpp:73
148msgid "Lock to Launcher"
148msgid "Lock to Launcher"
149−msgstr ""
149+msgstr "Launcher တွင်ထားမည်"
150
150
151#: plugins/Unity/Launcher/launcheritem.cpp:73
151#: plugins/Unity/Launcher/launcheritem.cpp:73
152msgid "Unlock from Launcher"
152msgid "Unlock from Launcher"
153−msgstr ""
153+msgstr "Launcher မှဖြုတ်မည်"
154
154
155#: Shell.qml:439
155#: Shell.qml:439
156#, qt-format
156#, qt-format
157msgid "Please enter %1"
157msgid "Please enter %1"
158−msgstr ""
158+msgstr "%1ကိုရိုက်ထည့်ပါ"
po/tr.po+7−7
@@ -8,15 +8,15 @@ msgstr ""
8"Project-Id-Version: unity\n"
8"Project-Id-Version: unity\n"
9"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
9"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
10"POT-Creation-Date: 2013-11-29 09:21+0100\n"
10"POT-Creation-Date: 2013-11-29 09:21+0100\n"
11−"PO-Revision-Date: 2013-10-01 13:21+0000\n"
11+"PO-Revision-Date: 2013-12-12 16:06+0000\n"
12−"Last-Translator: Volkan Gezer <Unknown>\n"
12+"Last-Translator: Arda Ünlü <aarda.uunlu@gmail.com>\n"
13"Language-Team: Turkish <tr@li.org>\n"
13"Language-Team: Turkish <tr@li.org>\n"
14"MIME-Version: 1.0\n"
14"MIME-Version: 1.0\n"
15"Content-Type: text/plain; charset=UTF-8\n"
15"Content-Type: text/plain; charset=UTF-8\n"
16"Content-Transfer-Encoding: 8bit\n"
16"Content-Transfer-Encoding: 8bit\n"
17"Plural-Forms: nplurals=2; plural=n != 1;\n"
17"Plural-Forms: nplurals=2; plural=n != 1;\n"
18−"X-Launchpad-Export-Date: 2013-11-30 05:33+0000\n"
18+"X-Launchpad-Export-Date: 2013-12-13 06:46+0000\n"
19−"X-Generator: Launchpad (build 16856)\n"
19+"X-Generator: Launchpad (build 16869)\n"
20
20
21#: Components/EdgeDemoOverlay.qml:151
21#: Components/EdgeDemoOverlay.qml:151
22msgid "Skip intro"
22msgid "Skip intro"
@@ -138,7 +138,7 @@ msgstr "Konuşuyor..."
138
138
139#: Notifications/NotificationMenuItemFactory.qml:89
139#: Notifications/NotificationMenuItemFactory.qml:89
140msgid "Show password"
140msgid "Show password"
141−msgstr ""
141+msgstr "Parolayı göster"
142
142
143#: Panel/SearchIndicator.qml:27
143#: Panel/SearchIndicator.qml:27
144msgid "Search"
144msgid "Search"
@@ -147,11 +147,11 @@ msgstr "Ara"
147#: plugins/Unity/Launcher/launcheritem.cpp:43
147#: plugins/Unity/Launcher/launcheritem.cpp:43
148#: plugins/Unity/Launcher/launcheritem.cpp:73
148#: plugins/Unity/Launcher/launcheritem.cpp:73
149msgid "Lock to Launcher"
149msgid "Lock to Launcher"
150−msgstr ""
150+msgstr "Başlatıcıya Sabitle"
151
151
152#: plugins/Unity/Launcher/launcheritem.cpp:73
152#: plugins/Unity/Launcher/launcheritem.cpp:73
153msgid "Unlock from Launcher"
153msgid "Unlock from Launcher"
154−msgstr ""
154+msgstr "Başlatıcıdan Ayır"
155
155
156#: Shell.qml:439
156#: Shell.qml:439
157#, qt-format
157#, qt-format
Bottombar/Bottombar.qml → qml/Bottombar/Bottombar.qmlrenamed

The content is the same.

Bottombar/HudButton.qml → qml/Bottombar/HudButton.qmlrenamed

The content is the same.

Bottombar/graphics/hud@20.png → qml/Bottombar/graphics/hud@20.pngrenamed

Binary file not shown.

Bottombar/graphics/hud_invoke_button_active@20.png → qml/Bottombar/graphics/hud_invoke_button_active@20.pngrenamed

Binary file not shown.

qml/CMakeLists.txtnew file+22
@@ -0,0 +1,22 @@
1+file(GLOB QML_JS_FILES *.qml *.js)
2+
3+install(FILES ${QML_JS_FILES}
4+ DESTINATION ${SHELL_APP_DIR}
5+ )
6+
7+set(QML_DIRS
8+ Bottombar
9+ Components
10+ Dash
11+ graphics
12+ Greeter
13+ Hud
14+ Panel
15+ Launcher
16+ SideStage
17+ Notifications
18+ )
19+
20+install(DIRECTORY ${QML_DIRS}
21+ DESTINATION ${SHELL_APP_DIR}
22+ )
Components/AnimationControllerWithSignals.qml → qml/Components/AnimationControllerWithSignals.qmlrenamed

The content is the same.

Components/ApplicationManagerWrapper.qml → qml/Components/ApplicationManagerWrapper.qmlrenamed

The content is the same.

Components/ApplicationScreenshot.qml → qml/Components/ApplicationScreenshot.qmlrenamed

The content is the same.

Components/ApplicationsModelStageFiltered.qml → qml/Components/ApplicationsModelStageFiltered.qmlrenamed

The content is the same.

Components/BaseCarouselDelegate.qml → qml/Components/BaseCarouselDelegate.qmlrenamed

The content is the same.

Components/BasicShell.qml → qml/Components/BasicShell.qmlrenamed+1−1
@@ -29,7 +29,7 @@ FocusScope {
29
29
30 property real edgeSize: units.gu(2)
30 property real edgeSize: units.gu(2)
31
31
32− property url defaultBackground: shell.width >= units.gu(60) ? "../graphics/tablet_background.jpg" : "../graphics/phone_background.jpg"
32+ property url defaultBackground: Qt.resolvedUrl(shell.width >= units.gu(60) ? "../graphics/tablet_background.jpg" : "../graphics/phone_background.jpg")
33 property url background
33 property url background
34 property url backgroundSource
34 property url backgroundSource
35 property url backgroundFallbackSource
35 property url backgroundFallbackSource
Components/Carousel.qml → qml/Components/Carousel.qmlrenamed

The content is the same.

Components/Circle.qml → qml/Components/Circle.qmlrenamed

The content is the same.

Components/DragHandle.qml → qml/Components/DragHandle.qmlrenamed

The content is the same.

Components/DraggingArea.qml → qml/Components/DraggingArea.qmlrenamed

The content is the same.

Components/EdgeDemo.qml → qml/Components/EdgeDemo.qmlrenamed

The content is the same.

Components/EdgeDemoOverlay.qml → qml/Components/EdgeDemoOverlay.qmlrenamed

The content is the same.

Components/EdgeDragArea.qml → qml/Components/EdgeDragArea.qmlrenamed

The content is the same.

Components/EdgeDragEvaluator.qml → qml/Components/EdgeDragEvaluator.qmlrenamed

The content is the same.

Components/FilterGrid.qml → qml/Components/FilterGrid.qmlrenamed

The content is the same.

Components/LazyImage.qml → qml/Components/LazyImage.qmlrenamed

The content is the same.

Components/ListItems/Base.qml → qml/Components/ListItems/Base.qmlrenamed

The content is the same.

Components/ListItems/Header.qml → qml/Components/ListItems/Header.qmlrenamed

The content is the same.

Components/ListItems/Highlight.qml → qml/Components/ListItems/Highlight.qmlrenamed

The content is the same.

Components/ListItems/ThinDivider.qml → qml/Components/ListItems/ThinDivider.qmlrenamed

The content is the same.

Components/ListItems/VerticalThinDivider.qml → qml/Components/ListItems/VerticalThinDivider.qmlrenamed

The content is the same.

Components/ListItems/graphics/ListItemDividerHorizontal@18.png → qml/Components/ListItems/graphics/ListItemDividerHorizontal@18.pngrenamed

Binary file not shown.

Components/ListItems/graphics/ListItemDividerVertical@18.png → qml/Components/ListItems/graphics/ListItemDividerVertical@18.pngrenamed

Binary file not shown.

Components/OpenEffect.qml → qml/Components/OpenEffect.qmlrenamed

The content is the same.

Components/PageHeader.qml → qml/Components/PageHeader.qmlrenamed

The content is the same.

Components/PinPadButton.qml → qml/Components/PinPadButton.qmlrenamed

The content is the same.

Components/RatingStars.qml → qml/Components/RatingStars.qmlrenamed

The content is the same.

Components/ResponsiveFlowView.qml → qml/Components/ResponsiveFlowView.qmlrenamed

The content is the same.

Components/ResponsiveGridView.qml → qml/Components/ResponsiveGridView.qmlrenamed

The content is the same.

Components/Revealer.qml → qml/Components/Revealer.qmlrenamed

The content is the same.

Components/SearchHistoryModel.qml → qml/Components/SearchHistoryModel.qmlrenamed

The content is the same.

Components/Showable.qml → qml/Components/Showable.qmlrenamed

The content is the same.

Components/Stage.qml → qml/Components/Stage.qmlrenamed

The content is the same.

Components/StandardAnimation.qml → qml/Components/StandardAnimation.qmlrenamed

The content is the same.

Components/Tile.qml → qml/Components/Tile.qmlrenamed

The content is the same.

Components/TileStyle.qml → qml/Components/TileStyle.qmlrenamed

The content is the same.

Components/UbuntuShapeForItem.qml → qml/Components/UbuntuShapeForItem.qmlrenamed

The content is the same.

Components/VolumeControl.qml → qml/Components/VolumeControl.qmlrenamed

The content is the same.

Components/WrongPasswordAnimation.qml → qml/Components/WrongPasswordAnimation.qmlrenamed

The content is the same.

Components/carousel.js → qml/Components/carousel.jsrenamed

The content is the same.

Components/graphics/PageHeaderBaseDivider@18.png → qml/Components/graphics/PageHeaderBaseDivider@18.pngrenamed

Binary file not shown.

Components/graphics/PageHeaderBaseDivider@18.sci → qml/Components/graphics/PageHeaderBaseDivider@18.scirenamed

The content is the same.

Components/graphics/close@20.png → qml/Components/graphics/close@20.pngrenamed

Binary file not shown.

Components/graphics/icon_star_off@20.png → qml/Components/graphics/icon_star_off@20.pngrenamed

Binary file not shown.

Components/graphics/icon_star_on@20.png → qml/Components/graphics/icon_star_on@20.pngrenamed

Binary file not shown.

Components/graphics/non-selected@18.png → qml/Components/graphics/non-selected@18.pngrenamed

Binary file not shown.

Components/graphics/non-selected@18.sci → qml/Components/graphics/non-selected@18.scirenamed

The content is the same.

Dash/Apps/AppPreview.qml → qml/Dash/Apps/AppPreview.qmlrenamed

The content is the same.

Dash/Apps/CloseIcon.qml → qml/Dash/Apps/CloseIcon.qmlrenamed

The content is the same.

Dash/Apps/DashPluginFilterGrid.qml → qml/Dash/Apps/DashPluginFilterGrid.qmlrenamed

The content is the same.

Dash/Apps/FrequentlyUsedAppsModel.qml → qml/Dash/Apps/FrequentlyUsedAppsModel.qmlrenamed

The content is the same.

Dash/Apps/RunningApplicationTile.qml → qml/Dash/Apps/RunningApplicationTile.qmlrenamed

The content is the same.

Dash/Apps/RunningApplicationsGrid.qml → qml/Dash/Apps/RunningApplicationsGrid.qmlrenamed

The content is the same.

Dash/Apps/graphics/close_btn@9.png → qml/Dash/Apps/graphics/close_btn@9.pngrenamed

Binary file not shown.

Dash/Dash.qml → qml/Dash/Dash.qmlrenamed

The content is the same.

Dash/DashApps.qml → qml/Dash/DashApps.qmlrenamed

The content is the same.

Dash/DashBar.qml → qml/Dash/DashBar.qmlrenamed

The content is the same.

Dash/DashCarousel.qml → qml/Dash/DashCarousel.qmlrenamed

The content is the same.

Dash/DashContent.qml → qml/Dash/DashContent.qmlrenamed

The content is the same.

Dash/DashFilterGrid.qml → qml/Dash/DashFilterGrid.qmlrenamed+3−2
@@ -35,8 +35,6 @@ DashRenderer {
35 rows: filter ? filterGrid.collapsedRowCount : filterGrid.uncollapsedRowCount
35 rows: filter ? filterGrid.collapsedRowCount : filterGrid.uncollapsedRowCount
36 currentItem: filterGrid.currentItem
36 currentItem: filterGrid.currentItem
37 expandable: filterGrid.expandable
37 expandable: filterGrid.expandable
38− delegateCreationBegin: filterGrid.delegateCreationBegin
39− delegateCreationEnd: filterGrid.delegateCreationEnd
40 height: filterGrid.height
38 height: filterGrid.height
41 margins: filterGrid.margins
39 margins: filterGrid.margins
42 uncollapsedHeight: filterGrid.uncollapsedHeight
40 uncollapsedHeight: filterGrid.uncollapsedHeight
@@ -56,9 +54,12 @@ DashRenderer {
56 model: dashFilterGrid.model
54 model: dashFilterGrid.model
57 filter: dashFilterGrid.filter
55 filter: dashFilterGrid.filter
58 highlightIndex: dashFilterGrid.highlightIndex
56 highlightIndex: dashFilterGrid.highlightIndex
57+ delegateCreationBegin: dashFilterGrid.delegateCreationBegin
58+ delegateCreationEnd: dashFilterGrid.delegateCreationEnd
59
59
60 onFilterChanged: {
60 onFilterChanged: {
61 dashFilterGrid.filter = filter
61 dashFilterGrid.filter = filter
62+ filter = Qt.binding(function() { return dashFilterGrid.filter })
62 }
63 }
63 }
64 }
64}
65}
Dash/DashHome.qml → qml/Dash/DashHome.qmlrenamed

The content is the same.

Dash/DashPreview.qml → qml/Dash/DashPreview.qmlrenamed

The content is the same.

Dash/DashPreviewPlaceholder.qml → qml/Dash/DashPreviewPlaceholder.qmlrenamed

The content is the same.

Dash/DashRenderer.qml → qml/Dash/DashRenderer.qmlrenamed+2−2
@@ -38,9 +38,9 @@ Item {
38
38
39 property int uncollapsedHeight: height
39 property int uncollapsedHeight: height
40
40
41− property real delegateCreationBegin
41+ property var delegateCreationBegin: undefined
42
42
43− property real delegateCreationEnd
43+ property var delegateCreationEnd: undefined
44
44
45 property real verticalSpacing: 0
45 property real verticalSpacing: 0
46
46
Dash/Generic/FlatTileStyle.qml → qml/Dash/Generic/FlatTileStyle.qmlrenamed

The content is the same.

Dash/Generic/GenericCarousel.qml → qml/Dash/Generic/GenericCarousel.qmlrenamed

The content is the same.

Dash/Generic/GenericFilterGrid.qml → qml/Dash/Generic/GenericFilterGrid.qmlrenamed

The content is the same.

Dash/Generic/GenericFilterGridPotrait.qml → qml/Dash/Generic/GenericFilterGridPotrait.qmlrenamed

The content is the same.

Dash/Generic/GenericPreview.qml → qml/Dash/Generic/GenericPreview.qmlrenamed

The content is the same.

Dash/Generic/WeatherFilterGrid.qml → qml/Dash/Generic/WeatherFilterGrid.qmlrenamed

The content is the same.

Dash/GenericScopeView.qml → qml/Dash/GenericScopeView.qmlrenamed

The content is the same.

Dash/Movie/MoviePreview.qml → qml/Dash/Movie/MoviePreview.qmlrenamed

The content is the same.

Dash/Music/CarouselDelegateMusic.qml → qml/Dash/Music/CarouselDelegateMusic.qmlrenamed

The content is the same.

Dash/Music/MusicCarousel.qml → qml/Dash/Music/MusicCarousel.qmlrenamed

The content is the same.

Dash/Music/MusicFilterGrid.qml → qml/Dash/Music/MusicFilterGrid.qmlrenamed

The content is the same.

Dash/Music/MusicPreview.qml → qml/Dash/Music/MusicPreview.qmlrenamed

The content is the same.

Dash/Music/MusicTileStyle.qml → qml/Dash/Music/MusicTileStyle.qmlrenamed

The content is the same.

Dash/Music/graphics/music_progress_bg.png → qml/Dash/Music/graphics/music_progress_bg.pngrenamed

Binary file not shown.

Dash/PreviewDelegateMapper.qml → qml/Dash/PreviewDelegateMapper.qmlrenamed

The content is the same.

Dash/Previews/Header.qml → qml/Dash/Previews/Header.qmlrenamed

The content is the same.

Dash/Previews/Reviews.qml → qml/Dash/Previews/Reviews.qmlrenamed

The content is the same.

Dash/ScopeDelegateMapper.qml → qml/Dash/ScopeDelegateMapper.qmlrenamed

The content is the same.

Dash/ScopeListView.qml → qml/Dash/ScopeListView.qmlrenamed+1−1
@@ -15,7 +15,7 @@
15 */
15 */
16
16
17import QtQuick 2.0
17import QtQuick 2.0
18−import ListViewWithPageHeader 0.1
18+import DashViews 0.1
19import SessionManager 0.1
19import SessionManager 0.1
20
20
21ListViewWithPageHeader {
21ListViewWithPageHeader {
Dash/SearchableResultModel.qml → qml/Dash/SearchableResultModel.qmlrenamed

The content is the same.

Dash/Video/CarouselDelegateVideo.qml → qml/Dash/Video/CarouselDelegateVideo.qmlrenamed

The content is the same.

Dash/Video/VideoCarousel.qml → qml/Dash/Video/VideoCarousel.qmlrenamed

The content is the same.

Dash/Video/VideoFilterGrid.qml → qml/Dash/Video/VideoFilterGrid.qmlrenamed

The content is the same.

Dash/Video/VideoTileStyle.qml → qml/Dash/Video/VideoTileStyle.qmlrenamed

The content is the same.

Dash/Video/graphics/icon_button_amazon@20.png → qml/Dash/Video/graphics/icon_button_amazon@20.pngrenamed

Binary file not shown.

Dash/Video/graphics/icon_button_u1@20.png → qml/Dash/Video/graphics/icon_button_u1@20.pngrenamed

Binary file not shown.

Dash/Video/graphics/movie_icon_holder@27.png → qml/Dash/Video/graphics/movie_icon_holder@27.pngrenamed

Binary file not shown.

Dash/graphics/header_handlearrow2@20.png → qml/Dash/graphics/header_handlearrow2@20.pngrenamed

Binary file not shown.

Dash/graphics/header_handlearrow@20.png → qml/Dash/graphics/header_handlearrow@20.pngrenamed

Binary file not shown.

Dash/graphics/icon_clear@20.png → qml/Dash/graphics/icon_clear@20.pngrenamed

Binary file not shown.

Dash/graphics/icon_listview_clear@20.png → qml/Dash/graphics/icon_listview_clear@20.pngrenamed

Binary file not shown.

Dash/graphics/icon_search_active@20.png → qml/Dash/graphics/icon_search_active@20.pngrenamed

Binary file not shown.

Dash/graphics/icon_search_inactive@20.png → qml/Dash/graphics/icon_search_inactive@20.pngrenamed

Binary file not shown.

Dash/graphics/phone/screenshots/browser@12.png → qml/Dash/graphics/phone/screenshots/browser@12.pngrenamed

Binary file not shown.

Dash/graphics/phone/screenshots/camera@12.png → qml/Dash/graphics/phone/screenshots/camera@12.pngrenamed

Binary file not shown.

Dash/graphics/phone/screenshots/facebook@12.png → qml/Dash/graphics/phone/screenshots/facebook@12.pngrenamed

Binary file not shown.

Dash/graphics/phone/screenshots/gallery@12.png → qml/Dash/graphics/phone/screenshots/gallery@12.pngrenamed

Binary file not shown.

Dash/graphics/phone/screenshots/map@12.png → qml/Dash/graphics/phone/screenshots/map@12.pngrenamed

Binary file not shown.

Dash/graphics/phone/screenshots/music@12.png → qml/Dash/graphics/phone/screenshots/music@12.pngrenamed

Binary file not shown.

Dash/graphics/phone/screenshots/phone@12.png → qml/Dash/graphics/phone/screenshots/phone@12.pngrenamed

Binary file not shown.

Dash/graphics/phone/screenshots/settings@12.png → qml/Dash/graphics/phone/screenshots/settings@12.pngrenamed

Binary file not shown.

Dash/graphics/phone/screenshots/twitter@12.png → qml/Dash/graphics/phone/screenshots/twitter@12.pngrenamed

Binary file not shown.

Dash/graphics/play_button@18.png → qml/Dash/graphics/play_button@18.pngrenamed

Binary file not shown.

Dash/graphics/play_button_active@18.png → qml/Dash/graphics/play_button_active@18.pngrenamed

Binary file not shown.

Dash/graphics/play_button_active_big@20.png → qml/Dash/graphics/play_button_active_big@20.pngrenamed

Binary file not shown.

Dash/graphics/play_button_big@20.png → qml/Dash/graphics/play_button_big@20.pngrenamed

Binary file not shown.

Dash/graphics/tablet/icon_close_preview@20.png → qml/Dash/graphics/tablet/icon_close_preview@20.pngrenamed

Binary file not shown.

Dash/graphics/tooltip_arrow@27.png → qml/Dash/graphics/tooltip_arrow@27.pngrenamed

Binary file not shown.

Greeter/Clock.qml → qml/Greeter/Clock.qmlrenamed

The content is the same.

Greeter/Dot.qml → qml/Greeter/Dot.qmlrenamed

The content is the same.

Greeter/Gradient.js → qml/Greeter/Gradient.jsrenamed

The content is the same.

Greeter/Greeter.qml → qml/Greeter/Greeter.qmlrenamed

The content is the same.

Greeter/GreeterContent.qml → qml/Greeter/GreeterContent.qmlrenamed

The content is the same.

Greeter/GreeterEdgeDemo.qml → qml/Greeter/GreeterEdgeDemo.qmlrenamed

The content is the same.

Greeter/Infographics.qml → qml/Greeter/Infographics.qmlrenamed

The content is the same.

Greeter/Lockscreen.qml → qml/Greeter/Lockscreen.qmlrenamed+2−2
@@ -30,9 +30,9 @@ Showable {
30 // In case the Lockscreen can show a greeter message, this is the username
30 // In case the Lockscreen can show a greeter message, this is the username
31 property string username: ""
31 property string username: ""
32
32
33− // As the numeric PIN pad doesn't have a OK button by design, we need to auto-confirm on a certain length.
33+ // Set this to a value greater 0 to enable auto-confirm behavior for the lockscreen.
34 // This is ignored by the alphaNumeric lockscreen as that one is confirmed with pressing enter on the OSK.
34 // This is ignored by the alphaNumeric lockscreen as that one is confirmed with pressing enter on the OSK.
35− property int pinLength: 4
35+ property int pinLength: -1
36
36
37 property url background: ""
37 property url background: ""
38
38
Greeter/LoginList.qml → qml/Greeter/LoginList.qmlrenamed

The content is the same.

Greeter/ObjectPositioner.qml → qml/Greeter/ObjectPositioner.qmlrenamed

The content is the same.

Greeter/PassphraseLockscreen.qml → qml/Greeter/PassphraseLockscreen.qmlrenamed

The content is the same.

Greeter/PinLockscreen.qml → qml/Greeter/PinLockscreen.qmlrenamed

The content is the same.

Greeter/graphics/dot_empty.png → qml/Greeter/graphics/dot_empty.pngrenamed

Binary file not shown.

Greeter/graphics/dot_filled.png → qml/Greeter/graphics/dot_filled.pngrenamed

Binary file not shown.

Greeter/graphics/dot_pointer.png → qml/Greeter/graphics/dot_pointer.pngrenamed

Binary file not shown.

Greeter/graphics/icon_arrow.png → qml/Greeter/graphics/icon_arrow.pngrenamed

Binary file not shown.

Greeter/graphics/infographic_circle_back.png → qml/Greeter/graphics/infographic_circle_back.pngrenamed

Binary file not shown.

GreeterShell.qml → qml/GreeterShell.qmlrenamed+1
@@ -58,6 +58,7 @@ BasicShell {
58 x: required ? 0 : - width
58 x: required ? 0 : - width
59 width: parent.width
59 width: parent.width
60 height: parent.height - panel.panelHeight
60 height: parent.height - panel.panelHeight
61+ pinLength: 4
61
62
62 onEntered: LightDM.Greeter.respond(passphrase);
63 onEntered: LightDM.Greeter.respond(passphrase);
63 onCancel: greeter.show()
64 onCancel: greeter.show()
Hud/Hud.qml → qml/Hud/Hud.qmlrenamed

The content is the same.

Hud/HudParametrizedActionsPage.qml → qml/Hud/HudParametrizedActionsPage.qmlrenamed

The content is the same.

Hud/Result.qml → qml/Hud/Result.qmlrenamed

The content is the same.

Hud/ResultList.qml → qml/Hud/ResultList.qmlrenamed

The content is the same.

Hud/SearchBar.qml → qml/Hud/SearchBar.qmlrenamed

The content is the same.

Hud/ShowingAnimation.qml → qml/Hud/ShowingAnimation.qmlrenamed

The content is the same.

Hud/SliderLabel.qml → qml/Hud/SliderLabel.qmlrenamed

The content is the same.

Hud/SoundAmplitudeDelegate.qml → qml/Hud/SoundAmplitudeDelegate.qmlrenamed

The content is the same.

Hud/SoundAmplitudeVisual.qml → qml/Hud/SoundAmplitudeVisual.qmlrenamed

The content is the same.

Hud/ToolBar.qml → qml/Hud/ToolBar.qmlrenamed

The content is the same.

Hud/ToolBarIcon.qml → qml/Hud/ToolBarIcon.qmlrenamed

The content is the same.

Hud/graphics/divider@20.png → qml/Hud/graphics/divider@20.pngrenamed

Binary file not shown.

Hud/graphics/divider@20.sci → qml/Hud/graphics/divider@20.scirenamed

The content is the same.

Hud/graphics/dropshadow_right@20.png → qml/Hud/graphics/dropshadow_right@20.pngrenamed

Binary file not shown.

Hud/graphics/help@20.png → qml/Hud/graphics/help@20.pngrenamed

Binary file not shown.

Hud/graphics/hud_bg@20.png → qml/Hud/graphics/hud_bg@20.pngrenamed

Binary file not shown.

Hud/graphics/hud_handlearrow@20.png → qml/Hud/graphics/hud_handlearrow@20.pngrenamed

Binary file not shown.

Hud/graphics/hud_handlebar@20.png → qml/Hud/graphics/hud_handlebar@20.pngrenamed

Binary file not shown.

Hud/graphics/icon_arrow@20.png → qml/Hud/graphics/icon_arrow@20.pngrenamed

Binary file not shown.

Hud/graphics/icon_clear@20.png → qml/Hud/graphics/icon_clear@20.pngrenamed

Binary file not shown.

Hud/graphics/icon_search@20.png → qml/Hud/graphics/icon_search@20.pngrenamed

Binary file not shown.

Hud/graphics/microphone@20.png → qml/Hud/graphics/microphone@20.pngrenamed

Binary file not shown.

Hud/graphics/popup_triangle@20.png → qml/Hud/graphics/popup_triangle@20.pngrenamed

Binary file not shown.

Hud/graphics/settings@20.png → qml/Hud/graphics/settings@20.pngrenamed

Binary file not shown.

Hud/graphics/undo@20.png → qml/Hud/graphics/undo@20.pngrenamed

Binary file not shown.

Hud/graphics/view-fullscreen@20.png → qml/Hud/graphics/view-fullscreen@20.pngrenamed

Binary file not shown.

Launcher/FoldingLauncherDelegate.qml → qml/Launcher/FoldingLauncherDelegate.qmlrenamed

The content is the same.

Launcher/Launcher.qml → qml/Launcher/Launcher.qmlrenamed

The content is the same.

Launcher/LauncherDelegate.qml → qml/Launcher/LauncherDelegate.qmlrenamed

The content is the same.

Launcher/LauncherPanel.qml → qml/Launcher/LauncherPanel.qmlrenamed

The content is the same.

Launcher/graphics/focused_app_arrow@30.png → qml/Launcher/graphics/focused_app_arrow@30.pngrenamed

Binary file not shown.

Launcher/graphics/highlight@18.png → qml/Launcher/graphics/highlight@18.pngrenamed

Binary file not shown.

Launcher/graphics/home@18.png → qml/Launcher/graphics/home@18.pngrenamed

Binary file not shown.

Launcher/graphics/launcher_bg@30.png → qml/Launcher/graphics/launcher_bg@30.pngrenamed

Binary file not shown.

Launcher/graphics/launcher_bg@30.sci → qml/Launcher/graphics/launcher_bg@30.scirenamed

The content is the same.

Launcher/graphics/non-selected@18.png → qml/Launcher/graphics/non-selected@18.pngrenamed

Binary file not shown.

Launcher/graphics/non-selected@18.sci → qml/Launcher/graphics/non-selected@18.scirenamed

The content is the same.

Launcher/graphics/notification@30.png → qml/Launcher/graphics/notification@30.pngrenamed

Binary file not shown.

Launcher/graphics/notification@30.sci → qml/Launcher/graphics/notification@30.scirenamed

The content is the same.

Launcher/graphics/progressbar-fill@30.png → qml/Launcher/graphics/progressbar-fill@30.pngrenamed

Binary file not shown.

Launcher/graphics/progressbar-fill@30.sci → qml/Launcher/graphics/progressbar-fill@30.scirenamed

The content is the same.

Launcher/graphics/progressbar-trough@30.png → qml/Launcher/graphics/progressbar-trough@30.pngrenamed

Binary file not shown.

Launcher/graphics/progressbar-trough@30.sci → qml/Launcher/graphics/progressbar-trough@30.scirenamed

The content is the same.

Launcher/graphics/quicklist_tooltip@30.png → qml/Launcher/graphics/quicklist_tooltip@30.pngrenamed

Binary file not shown.

Launcher/graphics/selected@18.png → qml/Launcher/graphics/selected@18.pngrenamed

Binary file not shown.

Launcher/graphics/selected@18.sci → qml/Launcher/graphics/selected@18.scirenamed

The content is the same.

Launcher/graphics/triangle@18.png → qml/Launcher/graphics/triangle@18.pngrenamed

Binary file not shown.

qml/Notifications/Notification.qmlnew file+325
@@ -0,0 +1,325 @@
1+/*
2+ * Copyright (C) 2013 Canonical, Ltd.
3+ *
4+ * This program is free software; you can redistribute it and/or modify
5+ * it under the terms of the GNU General Public License as published by
6+ * the Free Software Foundation; version 3.
7+ *
8+ * This program is distributed in the hope that it will be useful,
9+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
10+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+ * GNU General Public License for more details.
12+ *
13+ * You should have received a copy of the GNU General Public License
14+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
15+ */
16+
17+import QtQuick 2.0
18+import Ubuntu.Components 0.1
19+import Unity.Notifications 1.0
20+import QMenuModel 0.1
21+import Utils 0.1
22+
23+Item {
24+ id: notification
25+
26+ property alias iconSource: icon.fileSource
27+ property alias secondaryIconSource: secondaryIcon.source
28+ property alias summary: summaryLabel.text
29+ property alias body: bodyLabel.text
30+ property var actions
31+ property var notificationId
32+ property var type
33+ property var hints
34+ property var notification
35+ property color color
36+ property bool fullscreen
37+
38+ fullscreen: false
39+ objectName: "background"
40+ implicitHeight: type != Notification.PlaceHolder ? (fullscreen ? notificationList.fullHeight : contentColumn.height + contentColumn.spacing * 4) : 0
41+
42+ color: Qt.rgba(0.132, 0.117, 0.109, 0.97)
43+ opacity: 0
44+
45+ clip: fullscreen ? false : true
46+ visible: type != Notification.PlaceHolder
47+
48+ UbuntuShape {
49+ id: shapedBack
50+
51+ visible: !fullscreen
52+ anchors.fill: parent
53+ anchors.margins: notificationList.margin
54+ color: parent.color
55+ opacity: parent.opacity
56+ radius: "medium"
57+ }
58+
59+ Rectangle {
60+ id: nonShapedBack
61+
62+ visible: fullscreen
63+ anchors.fill: parent
64+ color: parent.color
65+ opacity: parent.opacity
66+ }
67+
68+ Item {
69+ id: contents
70+ anchors.fill: fullscreen ? nonShapedBack : shapedBack
71+
72+ UnityMenuModelPaths {
73+ id: paths
74+
75+ source: hints["x-canonical-private-menu-model"]
76+
77+ busNameHint: "busName"
78+ actionsHint: "actions"
79+ menuObjectPathHint: "menuPath"
80+ }
81+
82+ UnityMenuModel {
83+ id: unityMenuModel
84+
85+ busName: paths.busName
86+ actions: paths.actions
87+ menuObjectPath: paths.menuObjectPath
88+ }
89+
90+ Behavior on implicitHeight {
91+ id: heightBehavior
92+
93+ enabled: false
94+ UbuntuNumberAnimation {
95+ duration: UbuntuAnimation.SnapDuration
96+ }
97+ }
98+
99+ // delay enabling height behavior until the add transition is complete
100+ onOpacityChanged: if (opacity == 1) heightBehavior.enabled = true
101+
102+ MouseArea {
103+ id: interactiveArea
104+
105+ anchors.fill: contentColumn
106+ objectName: "interactiveArea"
107+ enabled: notification.type == Notification.Interactive
108+ onClicked: notification.notification.invokeAction(actionRepeater.itemAt(0).actionId)
109+ }
110+
111+ Column {
112+ id: contentColumn
113+
114+ anchors {
115+ left: parent.left
116+ right: parent.right
117+ top: parent.top
118+ margins: fullscreen ? 0 : spacing
119+ }
120+
121+ spacing: units.gu(1)
122+
123+ Row {
124+ id: topRow
125+
126+ spacing: contentColumn.spacing
127+ anchors {
128+ left: parent.left
129+ right: parent.right
130+ }
131+
132+ ShapedIcon {
133+ id: icon
134+
135+ objectName: "icon"
136+ width: units.gu(6)
137+ height: units.gu(6)
138+ shaped: notification.hints["x-canonical-non-shaped-icon"] == "true" ? false : true
139+ visible: iconSource !== undefined && iconSource != ""
140+ }
141+
142+ Image {
143+ id: secondaryIcon
144+
145+ objectName: "secondaryIcon"
146+ width: units.gu(2)
147+ height: units.gu(2)
148+ visible: source !== undefined && source != ""
149+ fillMode: Image.PreserveAspectCrop
150+ }
151+
152+ Column {
153+ id: labelColumn
154+ width: parent.width - x
155+
156+ anchors.verticalCenter: (icon.visible && !bodyLabel.visible) ? icon.verticalCenter : undefined
157+
158+ Label {
159+ id: summaryLabel
160+
161+ objectName: "summaryLabel"
162+ anchors {
163+ left: parent.left
164+ right: parent.right
165+ }
166+ fontSize: "medium"
167+ font.bold: true
168+ color: Theme.palette.selected.backgroundText
169+ elide: Text.ElideRight
170+ }
171+
172+ Label {
173+ id: bodyLabel
174+
175+ objectName: "bodyLabel"
176+ anchors {
177+ left: parent.left
178+ right: parent.right
179+ }
180+ visible: body != ""
181+ fontSize: "small"
182+ color: Theme.palette.selected.backgroundText
183+ opacity: 0.6
184+ wrapMode: Text.WordWrap
185+ maximumLineCount: 10
186+ elide: Text.ElideRight
187+ }
188+ }
189+ }
190+
191+ Column {
192+ objectName: "dialogListView"
193+ spacing: units.gu(2)
194+
195+ visible: count > 0
196+
197+ anchors.left: parent.left; anchors.right: parent.right
198+ anchors.top: fullscreen ? parent.top : undefined
199+ anchors.bottom: fullscreen ? parent.bottom : undefined
200+
201+ Repeater {
202+ model: unityMenuModel
203+
204+ NotificationMenuItemFactory {
205+ anchors.left: parent.left; anchors.right: parent.right
206+
207+ menuModel: unityMenuModel
208+ menuData: model
209+ menuIndex: index
210+ }
211+ }
212+ }
213+
214+ Item {
215+ id: buttonRow
216+
217+ objectName: "buttonRow"
218+ anchors {
219+ left: parent.left
220+ right: parent.right
221+ }
222+ visible: notification.type == Notification.SnapDecision && actionRepeater.count > 0
223+ height: units.gu(5)
224+
225+ property real buttonWidth: (width - contentColumn.spacing) / 2
226+ property bool expanded
227+
228+ Button {
229+ id: leftButton
230+
231+ objectName: "button1"
232+ width: parent.expanded ? parent.width : parent.buttonWidth
233+ anchors {
234+ top: parent.top
235+ bottom: parent.bottom
236+ }
237+ text: notification.type == Notification.SnapDecision && actionRepeater.count >= 2 ? actionRepeater.itemAt(1).actionLabel : ""
238+ gradient: UbuntuColors.greyGradient
239+ onClicked: {
240+ if (actionRepeater.count > 2) {
241+ buttonRow.expanded = !buttonRow.expanded
242+ } else {
243+ notification.notification.invokeAction(actionRepeater.itemAt(1).actionId)
244+ }
245+ }
246+
247+ Behavior on width {
248+ UbuntuNumberAnimation {
249+ duration: UbuntuAnimation.SnapDuration
250+ }
251+ }
252+ }
253+
254+ Button {
255+ id: rightButton
256+
257+ objectName: "button0"
258+ anchors {
259+ left: leftButton.right
260+ leftMargin: contentColumn.spacing
261+ right: parent.right
262+ }
263+ text: notification.type == Notification.SnapDecision && actionRepeater.count >= 1 ? actionRepeater.itemAt(0).actionLabel : ""
264+ anchors {
265+ top: parent.top
266+ bottom: parent.bottom
267+ }
268+ gradient: notification.hints["x-canonical-private-button-tint"] == "true" ? UbuntuColors.orangeGradient : UbuntuColors.greyGradient
269+ visible: width > 0
270+ onClicked: notification.notification.invokeAction(actionRepeater.itemAt(0).actionId)
271+ }
272+ }
273+
274+ Column {
275+ objectName: "buttonColumn"
276+ spacing: contentColumn.spacing
277+ anchors {
278+ left: parent.left
279+ right: parent.right
280+ }
281+
282+ // calculate initial position before Column takes over
283+ y: buttonRow.y + buttonRow.height + contentColumn.spacing
284+
285+ visible: notification.type == Notification.SnapDecision && buttonRow.expanded
286+ height: buttonRow.expanded ? implicitHeight : 0
287+
288+ Repeater {
289+ id: actionRepeater
290+
291+ model: notification.actions
292+ delegate: Loader {
293+ id: loader
294+
295+ property string actionId: id
296+ property string actionLabel: label
297+
298+ anchors {
299+ left: parent.left
300+ right: parent.right
301+ }
302+
303+ Component {
304+ id: actionButton
305+
306+ Button {
307+ objectName: "button" + index
308+ anchors {
309+ left: parent.left
310+ right: parent.right
311+ }
312+
313+ text: loader.actionLabel
314+ height: units.gu(5)
315+ gradient: UbuntuColors.greyGradient
316+ onClicked: notification.notification.invokeAction(loader.actionId)
317+ }
318+ }
319+ sourceComponent: (index == 0 || index == 1) ? undefined : actionButton
320+ }
321+ }
322+ }
323+ }
324+ }
325+}
Notifications/NotificationMenuItemFactory.qml → qml/Notifications/NotificationMenuItemFactory.qmlrenamed+9−2
@@ -28,7 +28,6 @@ Loader {
28 property QtObject menuModel: null
28 property QtObject menuModel: null
29 property QtObject menuData: null
29 property QtObject menuData: null
30 property int menuIndex
30 property int menuIndex
31− property var notification
32
31
33 property var _map: {
32 property var _map: {
34 "com.canonical.snapdecision.textfield": textfield,
33 "com.canonical.snapdecision.textfield": textfield,
@@ -44,6 +43,10 @@ Loader {
44 }
43 }
45 }
44 }
46
45
46+ Component.onCompleted: {
47+ notification.fullscreen = menuData.type == "com.canonical.snapdecision.pinlock"
48+ }
49+
47 Component {
50 Component {
48 id: textfield
51 id: textfield
49
52
@@ -94,8 +97,12 @@ Loader {
94
97
95 Component {
98 Component {
96 id: pinLock
99 id: pinLock
97− PinLockscreen {
100+
101+ Lockscreen {
98 anchors.left: parent.left; anchors.right: parent.right
102 anchors.left: parent.left; anchors.right: parent.right
103+ height: notificationList.fullHeight
104+ placeholderText: i18n.tr("Please enter SIM PIN")
105+ background: shell.background
99
106
100 onEntered: {
107 onEntered: {
101 menuModel.changeState(menuIndex, passphrase);
108 menuModel.changeState(menuIndex, passphrase);
Notifications/Notifications.qml → qml/Notifications/Notifications.qmlrenamed+3−1
@@ -24,7 +24,9 @@ ListView {
24 objectName: "notificationList"
24 objectName: "notificationList"
25 interactive: false
25 interactive: false
26
26
27− spacing: units.gu(.5)
27+ property real margin
28+ property real fullHeight
29+
28 delegate: Notification {
30 delegate: Notification {
29 objectName: "notification" + index
31 objectName: "notification" + index
30 anchors {
32 anchors {
Notifications/ShapedIcon.qml → qml/Notifications/ShapedIcon.qmlrenamed

The content is the same.

Panel/IndicatorItem.qml → qml/Panel/IndicatorItem.qmlrenamed

The content is the same.

Panel/IndicatorRow.qml → qml/Panel/IndicatorRow.qmlrenamed

The content is the same.

Panel/Indicators.qml → qml/Panel/Indicators.qmlrenamed

The content is the same.

Panel/Indicators/DefaultIndicatorPage.qml → qml/Panel/Indicators/DefaultIndicatorPage.qmlrenamed

The content is the same.

Panel/Indicators/DefaultIndicatorWidget.qml → qml/Panel/Indicators/DefaultIndicatorWidget.qmlrenamed

The content is the same.

Panel/Indicators/client/IndicatorsClient.qml → qml/Panel/Indicators/client/IndicatorsClient.qmlrenamed

The content is the same.

Panel/Indicators/client/IndicatorsList.qml → qml/Panel/Indicators/client/IndicatorsList.qmlrenamed

The content is the same.

Panel/Indicators/client/IndicatorsPage.qml → qml/Panel/Indicators/client/IndicatorsPage.qmlrenamed

The content is the same.

Panel/Indicators/client/IndicatorsTree.qml → qml/Panel/Indicators/client/IndicatorsTree.qmlrenamed

The content is the same.

Panel/MenuContent.qml → qml/Panel/MenuContent.qmlrenamed

The content is the same.

Panel/Panel.qml → qml/Panel/Panel.qmlrenamed+22
@@ -31,6 +31,28 @@ Item {
31
31
32 signal searchClicked
32 signal searchClicked
33
33
34+ function hideIndicatorMenu(delay) {
35+ if (delay !== undefined) {
36+ hideTimer.interval = delay;
37+ hideTimer.start();
38+ } else {
39+ indicatorsMenu.hide();
40+ }
41+ }
42+
43+ Timer {
44+ id: hideTimer
45+ running: false
46+ onTriggered: {
47+ indicatorsMenu.hide();
48+ }
49+ }
50+
51+ Connections {
52+ target: indicatorsMenu
53+ onShown: hideTimer.stop()
54+ }
55+
34 PanelBackground {
56 PanelBackground {
35 id: panelBackground
57 id: panelBackground
36 anchors {
58 anchors {
Panel/PanelBackground.qml → qml/Panel/PanelBackground.qmlrenamed

The content is the same.

Panel/PanelSeparatorLine.qml → qml/Panel/PanelSeparatorLine.qmlrenamed

The content is the same.

Panel/SearchIndicator.qml → qml/Panel/SearchIndicator.qmlrenamed

The content is the same.

Panel/graphics/Battery@18.png → qml/Panel/graphics/Battery@18.pngrenamed

Binary file not shown.

Panel/graphics/Bluetooth@18.png → qml/Panel/graphics/Bluetooth@18.pngrenamed

Binary file not shown.

Panel/graphics/Clock@18.png → qml/Panel/graphics/Clock@18.pngrenamed

Binary file not shown.

Panel/graphics/Location@18.png → qml/Panel/graphics/Location@18.pngrenamed

Binary file not shown.

Panel/graphics/Messages@18.png → qml/Panel/graphics/Messages@18.pngrenamed

Binary file not shown.

Panel/graphics/Network@18.png → qml/Panel/graphics/Network@18.pngrenamed

Binary file not shown.

Panel/graphics/Sound@18.png → qml/Panel/graphics/Sound@18.pngrenamed

Binary file not shown.

Panel/graphics/Sync@18.png → qml/Panel/graphics/Sync@18.pngrenamed

Binary file not shown.

Panel/graphics/System@18.png → qml/Panel/graphics/System@18.pngrenamed

Binary file not shown.

Panel/graphics/Time@18.png → qml/Panel/graphics/Time@18.pngrenamed

Binary file not shown.

Panel/graphics/VerticalDivider@18.png → qml/Panel/graphics/VerticalDivider@18.pngrenamed

Binary file not shown.

Panel/graphics/handle@12.png → qml/Panel/graphics/handle@12.pngrenamed

Binary file not shown.

Panel/graphics/handle@12.sci → qml/Panel/graphics/handle@12.scirenamed

The content is the same.

Panel/graphics/rectangular_dropshadow@30.png → qml/Panel/graphics/rectangular_dropshadow@30.pngrenamed

Binary file not shown.

Panel/graphics/rectangular_dropshadow@30.sci → qml/Panel/graphics/rectangular_dropshadow@30.scirenamed

The content is the same.

Panel/graphics/search@12.png → qml/Panel/graphics/search@12.pngrenamed

Binary file not shown.

Panel/graphics/time_and_date@18.png → qml/Panel/graphics/time_and_date@18.pngrenamed

Binary file not shown.

Shell.qml → qml/Shell.qmlrenamed+8−3
@@ -412,6 +412,10 @@ BasicShell {
412 stages.hide()
412 stages.hide()
413 }
413 }
414
414
415+ function hideIndicatorMenu(delay) {
416+ panel.hideIndicatorMenu(delay);
417+ }
418+
415 Item {
419 Item {
416 id: overlay
420 id: overlay
417
421
@@ -535,13 +539,14 @@ BasicShell {
535 id: notifications
539 id: notifications
536
540
537 model: NotificationBackend.Model
541 model: NotificationBackend.Model
542+ margin: units.gu(1)
543+ fullHeight: parent.height - panel.panelHeight
544+
538 anchors {
545 anchors {
539 top: parent.top
546 top: parent.top
540 right: parent.right
547 right: parent.right
541 bottom: parent.bottom
548 bottom: parent.bottom
542− leftMargin: units.gu(1)
543− rightMargin: units.gu(1)
544− topMargin: panel.panelHeight + units.gu(1)
549+ topMargin: panel.panelHeight
545 }
550 }
546 states: [
551 states: [
547 State {
552 State {
SideStage/SideStage.qml → qml/SideStage/SideStage.qmlrenamed

The content is the same.

SideStage/SidestageHandle.qml → qml/SideStage/SidestageHandle.qmlrenamed

The content is the same.

SideStage/graphics/sidestage_handle@20.png → qml/SideStage/graphics/sidestage_handle@20.pngrenamed

Binary file not shown.

SideStage/graphics/sidestage_handle@20.sci → qml/SideStage/graphics/sidestage_handle@20.scirenamed

The content is the same.

graphics/12_10_background_wide@12.png → qml/graphics/12_10_background_wide@12.pngrenamed

Binary file not shown.

graphics/applicationIcons/browser@18.png → qml/graphics/applicationIcons/browser@18.pngrenamed

Binary file not shown.

graphics/applicationIcons/calendar@18.png → qml/graphics/applicationIcons/calendar@18.pngrenamed

Binary file not shown.

graphics/applicationIcons/camera@18.png → qml/graphics/applicationIcons/camera@18.pngrenamed

Binary file not shown.

graphics/applicationIcons/contacts-app@18.png → qml/graphics/applicationIcons/contacts-app@18.pngrenamed

Binary file not shown.

graphics/applicationIcons/dash@18.png → qml/graphics/applicationIcons/dash@18.pngrenamed

Binary file not shown.

graphics/applicationIcons/evernote@18.png → qml/graphics/applicationIcons/evernote@18.pngrenamed

Binary file not shown.

graphics/applicationIcons/facebook@18.png → qml/graphics/applicationIcons/facebook@18.pngrenamed

Binary file not shown.

graphics/applicationIcons/gallery@18.png → qml/graphics/applicationIcons/gallery@18.pngrenamed

Binary file not shown.

graphics/applicationIcons/gmail@18.png → qml/graphics/applicationIcons/gmail@18.pngrenamed

Binary file not shown.

graphics/applicationIcons/map@18.png → qml/graphics/applicationIcons/map@18.pngrenamed

Binary file not shown.

graphics/applicationIcons/messages-app@18.png → qml/graphics/applicationIcons/messages-app@18.pngrenamed

Binary file not shown.

graphics/applicationIcons/notepad@18.png → qml/graphics/applicationIcons/notepad@18.pngrenamed

Binary file not shown.

graphics/applicationIcons/phone-app@18.png → qml/graphics/applicationIcons/phone-app@18.pngrenamed

Binary file not shown.

graphics/applicationIcons/pinterest@18.png → qml/graphics/applicationIcons/pinterest@18.pngrenamed

Binary file not shown.

graphics/applicationIcons/soundcloud@18.png → qml/graphics/applicationIcons/soundcloud@18.pngrenamed

Binary file not shown.

graphics/applicationIcons/system-settings@18.png → qml/graphics/applicationIcons/system-settings@18.pngrenamed

Binary file not shown.

graphics/applicationIcons/twitter@18.png → qml/graphics/applicationIcons/twitter@18.pngrenamed

Binary file not shown.

graphics/applicationIcons/weather@18.png → qml/graphics/applicationIcons/weather@18.pngrenamed

Binary file not shown.

graphics/applicationIcons/wikipedia@18.png → qml/graphics/applicationIcons/wikipedia@18.pngrenamed

Binary file not shown.

graphics/applicationIcons/youtube@18.png → qml/graphics/applicationIcons/youtube@18.pngrenamed

Binary file not shown.

graphics/avatars/amanda@12.png → qml/graphics/avatars/amanda@12.pngrenamed

Binary file not shown.

graphics/avatars/anna_olsson@12.png → qml/graphics/avatars/anna_olsson@12.pngrenamed

Binary file not shown.

graphics/avatars/funky@12.png → qml/graphics/avatars/funky@12.pngrenamed

Binary file not shown.

graphics/clock@18.png → qml/graphics/clock@18.pngrenamed

Binary file not shown.

graphics/phone_background.jpg → qml/graphics/phone_background.jpgrenamed

Binary file not shown.

graphics/tablet_background.jpg → qml/graphics/tablet_background.jpgrenamed

Binary file not shown.

run+2−2
@@ -3,7 +3,7 @@
3. /etc/environment
3. /etc/environment
4export QML2_IMPORT_PATH
4export QML2_IMPORT_PATH
5
5
6−QML_PHONE_SHELL_PATH=./builddir/unity8
6+QML_PHONE_SHELL_PATH=./builddir/src/unity8
7GDB=false
7GDB=false
8FAKE=false
8FAKE=false
9PINLOCK=false
9PINLOCK=false
@@ -36,7 +36,7 @@ do
36 -p|--pinlock) PINLOCK=true;;
36 -p|--pinlock) PINLOCK=true;;
37 -k|--keylock) KEYLOCK=true;;
37 -k|--keylock) KEYLOCK=true;;
38 -g|--gdb) GDB=true;;
38 -g|--gdb) GDB=true;;
39− -G|--greeter) QML_PHONE_SHELL_PATH=./builddir/unity8-greeter;;
39+ -G|--greeter) QML_PHONE_SHELL_PATH=./builddir/src/unity8-greeter;;
40 -h|--help) usage;;
40 -h|--help) usage;;
41 -m|--nomousetouch) MOUSE_TOUCH=false;;
41 -m|--nomousetouch) MOUSE_TOUCH=false;;
42 --) shift;break;;
42 --) shift;break;;
runtests.sh+1−13
@@ -26,19 +26,7 @@
26# floating point operations and xml writing is natively supported.
26# floating point operations and xml writing is natively supported.
27
27
28
28
29−if test -e Shell.qml; then
29+SRCDIR=`dirname "$(readlink -f "$0")"`
30− echo In-source build detected.
31− SRCDIR=`pwd`
32−elif test -e ../Shell.qml; then
33− echo Out-of-source build detected. Found source dir at ..
34− SRCDIR=`pwd`/..
35−else
36− echo Out-of-source build detected. Source dir not found at ..
37− echo Only in-source builds or out-of-source builds with source dir at .. are supported.
38− exit 1
39−fi
40−
41−cd $SRCDIR
42
30
43file_list=""
31file_list=""
44
32
ApplicationArguments.h → src/ApplicationArguments.hrenamed

The content is the same.

src/CMakeLists.txt+39
@@ -1 +1,40 @@
1+pkg_check_modules(UNITY-MIR REQUIRED unity-mir)
2+
3+include_directories(
4+ ${Qt5Gui_PRIVATE_INCLUDE_DIRS}
5+ ${UNITY-MIR_INCLUDE_DIRS}
6+)
7+
8+set(COMMON_SRCS
9+ ApplicationArguments.h
10+ main.cpp
11+ MouseTouchAdaptor.cpp
12+ )
13+add_executable(${SHELL_APP} ${COMMON_SRCS})
14+add_executable(${GREETER_APP} ${COMMON_SRCS})
15+
16+set_target_properties(${SHELL_APP} PROPERTIES
17+ COMPILE_DEFINITIONS "APP_NAME=\"Unity 8\";QML_FILE=\"Shell.qml\";INDICATOR_PROFILE=\"phone\""
18+ )
19+set_target_properties(${GREETER_APP} PROPERTIES
20+ COMPILE_DEFINITIONS "APP_NAME=\"Unity 8 Greeter\";QML_FILE=\"GreeterShell.qml\";INDICATOR_PROFILE=\"phone_greeter\""
21+ )
22+
23+qt5_use_modules(${SHELL_APP} Gui Qml Quick Test)
24+qt5_use_modules(${GREETER_APP} Gui Qml Quick Test)
25+pkg_check_modules(XCB REQUIRED xcb)
26+
27+if (NOT "${XCB_INCLUDE_DIRS}" STREQUAL "")
28+ set_target_properties(${SHELL_APP} PROPERTIES INCLUDE_DIRECTORIES ${XCB_INCLUDE_DIRS})
29+ set_target_properties(${GREETER_APP} PROPERTIES INCLUDE_DIRECTORIES ${XCB_INCLUDE_DIRS})
30+
31+ target_link_libraries(${SHELL_APP} ${XCB_LDFLAGS})
32+ target_link_libraries(${GREETER_APP} ${XCB_LDFLAGS})
33+endif()
34+
35+# install binaries
36+install(TARGETS ${SHELL_APP} ${GREETER_APP}
37+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
38+ )
39+
1add_subdirectory(Panel)
40add_subdirectory(Panel)
MouseTouchAdaptor.cpp → src/MouseTouchAdaptor.cpprenamed

The content is the same.

MouseTouchAdaptor.h → src/MouseTouchAdaptor.hrenamed

The content is the same.

src/Panel/Indicators/client/CMakeLists.txt−4
@@ -14,10 +14,6 @@ add_executable(${INDICATORS_CLIENT_APP}
14 ${INDICATORS_CLIENT_HEADERS}
14 ${INDICATORS_CLIENT_HEADERS}
15)
15)
16
16
17−include_directories(
18− ${CMAKE_BINARY_DIR}
19−)
20−
21qt5_use_modules(${INDICATORS_CLIENT_APP} Core Widgets Quick)
17qt5_use_modules(${INDICATORS_CLIENT_APP} Core Widgets Quick)
22set_target_properties(${INDICATORS_CLIENT_APP} PROPERTIES COMPILE_FLAGS -fPIC)
18set_target_properties(${INDICATORS_CLIENT_APP} PROPERTIES COMPILE_FLAGS -fPIC)
23
19
src/Panel/Indicators/client/indicatorsclient.cpp+3−37
@@ -19,48 +19,14 @@
19 */
19 */
20
20
21#include "indicatorsclient.h"
21#include "indicatorsclient.h"
22+
22−#include "paths.h"
23+#include <paths.h>
23
24
24#include <QQuickView>
25#include <QQuickView>
25#include <QQmlContext>
26#include <QQmlContext>
26#include <QQmlEngine>
27#include <QQmlEngine>
27#include <QDebug>
28#include <QDebug>
28
29
29−namespace {
30−
31−void prependImportPaths(QQmlEngine *engine, const QStringList &paths)
32−{
33− QStringList importPathList = engine->importPathList();
34− for (int i = paths.count()-1; i >= 0; i--) {
35− importPathList.prepend(paths[i]);
36− }
37− engine->setImportPathList(importPathList);
38−}
39−
40−/* When you append and import path to the list of import paths it will be the *last*
41− place where Qt will search for QML modules.
42− The usual QQmlEngine::addImportPath() actually prepends the given path.*/
43−void appendImportPaths(QQmlEngine *engine, const QStringList &paths)
44−{
45− QStringList importPathList = engine->importPathList();
46− Q_FOREACH(const QString& path, paths) {
47− // don't duplicate
48− QStringList::iterator iter = qFind(importPathList.begin(), importPathList.end(), path);
49− if (iter == importPathList.end()) {
50− importPathList.append(path);
51− }
52− }
53− engine->setImportPathList(importPathList);
54−}
55−
56−void resolveIconTheme() {
57− QString ubuntuIconTheme = getenv("UBUNTU_ICON_THEME");
58− if (ubuntuIconTheme.isEmpty()) {
59− QIcon::setThemeName("ubuntu-mobile");
60− }
61−}
62−} // namespace
63−
64IndicatorsClient::IndicatorsClient(int &argc, char **argv)
30IndicatorsClient::IndicatorsClient(int &argc, char **argv)
65 : QObject(0),
31 : QObject(0),
66 m_view(0)
32 m_view(0)
@@ -71,7 +37,7 @@ IndicatorsClient::IndicatorsClient(int &argc, char **argv)
71 QStringList args = m_application->arguments();
37 QStringList args = m_application->arguments();
72
38
73 m_view = new QQuickView;
39 m_view = new QQuickView;
74− m_view->engine()->setBaseUrl(QUrl::fromLocalFile(::shellAppDirectory()+"Panel/Indicators/client/"));
40+ m_view->engine()->setBaseUrl(QUrl::fromLocalFile(::qmlDirectory()+"Panel/Indicators/client/"));
75 prependImportPaths(m_view->engine(), ::overrideImportPaths());
41 prependImportPaths(m_view->engine(), ::overrideImportPaths());
76 appendImportPaths(m_view->engine(), ::fallbackImportPaths());
42 appendImportPaths(m_view->engine(), ::fallbackImportPaths());
77
43
main.cpp → src/main.cpprenamed+3−43
@@ -19,7 +19,6 @@
19
19
20// Qt
20// Qt
21#include <QtQuick/QQuickView>
21#include <QtQuick/QQuickView>
22−#include <QtGui/QIcon>
23#include <QtGui/QGuiApplication>
22#include <QtGui/QGuiApplication>
24#include <QtGui/QScreen>
23#include <QtGui/QScreen>
25#include <QtQml/QQmlEngine>
24#include <QtQml/QQmlEngine>
@@ -32,51 +31,12 @@
32#include <csignal>
31#include <csignal>
33
32
34// local
33// local
35−#include "paths.h"
34+#include <paths.h>
36#include "MouseTouchAdaptor.h"
35#include "MouseTouchAdaptor.h"
37#include "ApplicationArguments.h"
36#include "ApplicationArguments.h"
38
37
39#include <unity-mir/qmirserver.h>
38#include <unity-mir/qmirserver.h>
40
39
41−namespace {
42−
43−void prependImportPaths(QQmlEngine *engine, const QStringList &paths)
44−{
45− QStringList importPathList = engine->importPathList();
46− for (int i = paths.count() -1; i >= 0; i--) {
47− // don't duplicate
48− const QString& path = paths[i];
49− QStringList::iterator iter = qFind(importPathList.begin(), importPathList.end(), path);
50− if (iter == importPathList.end()) {
51− engine->addImportPath(path);
52− }
53− }
54−}
55−
56−/* When you append and import path to the list of import paths it will be the *last*
57− place where Qt will search for QML modules.
58− The usual QQmlEngine::addImportPath() actually prepends the given path.*/
59−void appendImportPaths(QQmlEngine *engine, const QStringList &paths)
60−{
61− QStringList importPathList = engine->importPathList();
62− Q_FOREACH(const QString& path, paths) {
63− // don't duplicate
64− QStringList::iterator iter = qFind(importPathList.begin(), importPathList.end(), path);
65− if (iter == importPathList.end()) {
66− importPathList.append(path);
67− }
68− }
69− engine->setImportPathList(importPathList);
70−}
71−
72−void resolveIconTheme() {
73− const char *ubuntuIconTheme = getenv("UBUNTU_ICON_THEME");
74− if (ubuntuIconTheme == NULL) {
75− ubuntuIconTheme = "ubuntu-mobile";
76− }
77− QIcon::setThemeName(ubuntuIconTheme);
78−}
79−} // namespace {
80
40
81int startShell(int argc, const char** argv, void* server)
41int startShell(int argc, const char** argv, void* server)
82{
42{
@@ -130,7 +90,7 @@ int startShell(int argc, const char** argv, void* server)
130 QQuickView* view = new QQuickView();
90 QQuickView* view = new QQuickView();
131 view->setResizeMode(QQuickView::SizeRootObjectToView);
91 view->setResizeMode(QQuickView::SizeRootObjectToView);
132 view->setTitle("Qml Phone Shell");
92 view->setTitle("Qml Phone Shell");
133− view->engine()->setBaseUrl(QUrl::fromLocalFile(::shellAppDirectory()));
93+ view->engine()->setBaseUrl(QUrl::fromLocalFile(::qmlDirectory()));
134 view->rootContext()->setContextProperty("applicationArguments", &qmlArgs);
94 view->rootContext()->setContextProperty("applicationArguments", &qmlArgs);
135 if (args.contains(QLatin1String("-frameless"))) {
95 if (args.contains(QLatin1String("-frameless"))) {
136 view->setFlags(Qt::FramelessWindowHint);
96 view->setFlags(Qt::FramelessWindowHint);
@@ -153,7 +113,7 @@ int startShell(int argc, const char** argv, void* server)
153 nativeInterface->setProperty("ubuntuSessionType", 1);
113 nativeInterface->setProperty("ubuntuSessionType", 1);
154 view->setProperty("role", 2); // INDICATOR_ACTOR_ROLE
114 view->setProperty("role", 2); // INDICATOR_ACTOR_ROLE
155
115
156− QUrl source(QML_FILE);
116+ QUrl source(::qmlDirectory()+QML_FILE);
157 prependImportPaths(view->engine(), ::overrideImportPaths());
117 prependImportPaths(view->engine(), ::overrideImportPaths());
158 appendImportPaths(view->engine(), ::fallbackImportPaths());
118 appendImportPaths(view->engine(), ::fallbackImportPaths());
159
119
tests/autopilot/.projectnew file+17
@@ -0,0 +1,17 @@
1+<?xml version="1.0" encoding="UTF-8"?>
2+<projectDescription>
3+ <name>Unity8 Autopilot</name>
4+ <comment></comment>
5+ <projects>
6+ </projects>
7+ <buildSpec>
8+ <buildCommand>
9+ <name>org.python.pydev.PyDevBuilder</name>
10+ <arguments>
11+ </arguments>
12+ </buildCommand>
13+ </buildSpec>
14+ <natures>
15+ <nature>org.python.pydev.pythonNature</nature>
16+ </natures>
17+</projectDescription>
tests/autopilot/.pydevprojectnew file+8
@@ -0,0 +1,8 @@
1+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2+<?eclipse-pydev version="1.0"?><pydev_project>
3+<pydev_pathproperty name="org.python.pydev.PROJECT_SOURCE_PATH">
4+<path>/Unity8 Autopilot</path>
5+</pydev_pathproperty>
6+<pydev_property name="org.python.pydev.PYTHON_PROJECT_VERSION">python 2.7</pydev_property>
7+<pydev_property name="org.python.pydev.PYTHON_PROJECT_INTERPRETER">Default</pydev_property>
8+</pydev_project>
tests/autopilot/unity8/application_lifecycle/tests/test_application_lifecycle.py+1
@@ -21,6 +21,7 @@
21
21
22from __future__ import absolute_import
22from __future__ import absolute_import
23
23
24+from unity8.process_helpers import unlock_unity
24from unity8.shell import disable_qml_mocking
25from unity8.shell import disable_qml_mocking
25from unity8.shell.tests import UnityTestCase, _get_device_emulation_scenarios
26from unity8.shell.tests import UnityTestCase, _get_device_emulation_scenarios
26
27
tests/autopilot/unity8/shell/tests/test_lock_screen.py+1
@@ -20,6 +20,7 @@
20
20
21from __future__ import absolute_import
21from __future__ import absolute_import
22
22
23+from unity8.process_helpers import unlock_unity
23from unity8.shell import with_lightdm_mock
24from unity8.shell import with_lightdm_mock
24from unity8.shell.tests import UnityTestCase, _get_device_emulation_scenarios
25from unity8.shell.tests import UnityTestCase, _get_device_emulation_scenarios
25
26
tests/autopilot/unity8/shell/tests/test_notifications.py+1−1
@@ -64,7 +64,7 @@ class NotificationsBase(UnityTestCase):
64 def _get_notifications_list(self):
64 def _get_notifications_list(self):
65 main_view = self.main_window.get_qml_view()
65 main_view = self.main_window.get_qml_view()
66 return main_view.select_single(
66 return main_view.select_single(
67− "QQuickListView",
67+ "Notifications",
68 objectName='notificationList'
68 objectName='notificationList'
69 )
69 )
70
70
tests/mocks/Unity/Application/ApplicationManager.cpp+4−3
@@ -16,7 +16,8 @@
16
16
17#include "ApplicationManager.h"
17#include "ApplicationManager.h"
18#include "ApplicationInfo.h"
18#include "ApplicationInfo.h"
19+
19−#include "paths.h"
20+#include <paths.h>
20
21
21#include <QDir>
22#include <QDir>
22#include <QGuiApplication>
23#include <QGuiApplication>
@@ -273,7 +274,7 @@ void ApplicationManager::generateQmlStrings(ApplicationInfo *application)
273 " smooth: true\n"
274 " smooth: true\n"
274 " fillMode: Image.PreserveAspectCrop\n"
275 " fillMode: Image.PreserveAspectCrop\n"
275 "}").arg(topMargin)
276 "}").arg(topMargin)
276− .arg(shellAppDirectory())
277+ .arg(qmlDirectory())
277 .arg(application->icon().toString());
278 .arg(application->icon().toString());
278 application->setWindowQml(windowQml);
279 application->setWindowQml(windowQml);
279
280
@@ -284,7 +285,7 @@ void ApplicationManager::generateQmlStrings(ApplicationInfo *application)
284 " source: \"file://%1/Dash/graphics/phone/screenshots/%2.png\"\n"
285 " source: \"file://%1/Dash/graphics/phone/screenshots/%2.png\"\n"
285 " smooth: true\n"
286 " smooth: true\n"
286 " fillMode: Image.PreserveAspectCrop\n"
287 " fillMode: Image.PreserveAspectCrop\n"
287− "}").arg(shellAppDirectory())
288+ "}").arg(qmlDirectory())
288 .arg(application->icon().toString());
289 .arg(application->icon().toString());
289 application->setImageQml(imageQml);
290 application->setImageQml(imageQml);
290}
291}
tests/mocks/Unity/Application/CMakeLists.txt−1
@@ -1,4 +1,3 @@
1−include(FindPkgConfig)
2pkg_check_modules(APPLICATION_API REQUIRED unity-shell-application)
1pkg_check_modules(APPLICATION_API REQUIRED unity-shell-application)
3
2
4set(FakeUnityApplicationQml_SOURCES
3set(FakeUnityApplicationQml_SOURCES
tests/mocks/Unity/Launcher/CMakeLists.txt−1
@@ -1,4 +1,3 @@
1−include(FindPkgConfig)
2pkg_check_modules(LAUNCHER_API REQUIRED unity-shell-launcher=3)
1pkg_check_modules(LAUNCHER_API REQUIRED unity-shell-launcher=3)
3
2
4add_definitions(-DTOP_SRCDIR="${CMAKE_SOURCE_DIR}")
3add_definitions(-DTOP_SRCDIR="${CMAKE_SOURCE_DIR}")
tests/mocks/Unity/fake_scope.cpp+2−2
@@ -16,7 +16,7 @@
16
16
17#include "fake_scope.h"
17#include "fake_scope.h"
18#include "fake_preview.h"
18#include "fake_preview.h"
19−#include "paths.h"
19+#include <paths.h>
20
20
21#include <dee.h>
21#include <dee.h>
22
22
@@ -236,7 +236,7 @@ DeeModel* create_results_model(unsigned category_count, unsigned result_count) {
236
236
237 dee_model_append(results_model,
237 dee_model_append(results_model,
238 ("uri://result."+std::to_string(i)).c_str(),
238 ("uri://result."+std::to_string(i)).c_str(),
239− (shellAppDirectory() + "graphics/applicationIcons/dash.png").toLatin1().data(),
239+ (qmlDirectory() + "graphics/applicationIcons/dash.png").toLatin1().data(),
240 category,
240 category,
241 0,
241 0,
242 "application/x-desktop",
242 "application/x-desktop",
tests/mocks/libusermetrics/CMakeLists.txt+4
@@ -8,6 +8,10 @@ add_library(MockUserMetrics SHARED ${mock_SOURCES})
8
8
9qt5_use_modules(MockUserMetrics Gui)
9qt5_use_modules(MockUserMetrics Gui)
10
10
11+include_directories(
12+ ${CMAKE_SOURCE_DIR}/plugins/Utils
13+)
14+
11set_target_properties(MockUserMetrics PROPERTIES
15set_target_properties(MockUserMetrics PROPERTIES
12 OUTPUT_NAME usermetricsoutput
16 OUTPUT_NAME usermetricsoutput
13 VERSION 1)
17 VERSION 1)
tests/mocks/libusermetrics/UserMetrics.cpp+1−1
@@ -17,7 +17,7 @@
17 */
17 */
18
18
19#include "UserMetrics.h"
19#include "UserMetrics.h"
20−#include "plugins/Utils/qvariantlistmodel.h"
20+#include <qvariantlistmodel.h>
21
21
22#include <QtCore/QDir>
22#include <QtCore/QDir>
23#include <QtCore/QString>
23#include <QtCore/QString>
tests/plugins/AccountsService/CMakeLists.txt+6−1
@@ -1,6 +1,11 @@
1+if(DEFINED ENV{DEB_BUILD_MULTIARCH})
2+ set(QDBUSXML2CPP_EXECUTABLE "/usr/lib/$ENV{DEB_BUILD_MULTIARCH}/qt5/bin/qdbusxml2cpp")
3+else()
4+ FIND_PROGRAM(QDBUSXML2CPP_EXECUTABLE qdbusxml2cpp)
5+endif()
1macro(make_dbus_class NAME INTERFACE)
6macro(make_dbus_class NAME INTERFACE)
2 if(${CMAKE_CURRENT_SOURCE_DIR}/interfaces.xml IS_NEWER_THAN ${CMAKE_CURRENT_BINARY_DIR}/${NAME}Adaptor.h)
7 if(${CMAKE_CURRENT_SOURCE_DIR}/interfaces.xml IS_NEWER_THAN ${CMAKE_CURRENT_BINARY_DIR}/${NAME}Adaptor.h)
3− execute_process(COMMAND qdbusxml2cpp -c ${NAME}Adaptor -a ${CMAKE_CURRENT_BINARY_DIR}/${NAME}Adaptor ${CMAKE_CURRENT_SOURCE_DIR}/interfaces.xml ${INTERFACE})
8+ execute_process(COMMAND ${QDBUSXML2CPP_EXECUTABLE} -c ${NAME}Adaptor -a ${CMAKE_CURRENT_BINARY_DIR}/${NAME}Adaptor ${CMAKE_CURRENT_SOURCE_DIR}/interfaces.xml ${INTERFACE})
4 endif()
9 endif()
5endmacro(make_dbus_class)
10endmacro(make_dbus_class)
6
11
tests/plugins/CMakeLists.txt+1−1
@@ -1,6 +1,6 @@
1add_subdirectory(AccountsService)
1add_subdirectory(AccountsService)
2+add_subdirectory(DashViews)
2add_subdirectory(LightDM)
3add_subdirectory(LightDM)
3−add_subdirectory(ListViewWithPageHeader)
4add_subdirectory(SessionManager)
4add_subdirectory(SessionManager)
5add_subdirectory(Ubuntu)
5add_subdirectory(Ubuntu)
6add_subdirectory(Unity)
6add_subdirectory(Unity)
tests/plugins/ListViewWithPageHeader/CMakeLists.txt → tests/plugins/DashViews/CMakeLists.txtrenamed+16−5
@@ -16,30 +16,40 @@ include_directories(
16 ${Qt5Quick_INCLUDE_DIRS}
16 ${Qt5Quick_INCLUDE_DIRS}
17 ${Qt5Quick_PRIVATE_INCLUDE_DIRS}
17 ${Qt5Quick_PRIVATE_INCLUDE_DIRS}
18 ${Qt5V8_PRIVATE_INCLUDE_DIR}
18 ${Qt5V8_PRIVATE_INCLUDE_DIR}
19− ${CMAKE_CURRENT_SOURCE_DIR}/../../../plugins/ListViewWithPageHeader
19+ ${CMAKE_CURRENT_SOURCE_DIR}/../../../plugins/DashViews
20 ${CMAKE_CURRENT_BINARY_DIR}
20 ${CMAKE_CURRENT_BINARY_DIR}
21 )
21 )
22
22
23remove_definitions(-DQT_NO_KEYWORDS)
23remove_definitions(-DQT_NO_KEYWORDS)
24
24
25−add_definitions(-DLISTVIEWWITHPAGEHEADER_FOLDER="${CMAKE_CURRENT_SOURCE_DIR}")
25+add_definitions(-DDASHVIEWSTEST_FOLDER="${CMAKE_CURRENT_SOURCE_DIR}")
26add_definitions(-DBUILT_PLUGINS_DIR="${CMAKE_BINARY_DIR}/plugins")
26add_definitions(-DBUILT_PLUGINS_DIR="${CMAKE_BINARY_DIR}/plugins")
27
27
28−add_executable(listviewwithpageheadertestExec listviewwithpageheadertest.cpp ${CMAKE_CURRENT_SOURCE_DIR}/../../../plugins/ListViewWithPageHeader/listviewwithpageheader.cpp)
28+add_executable(listviewwithpageheadertestExec listviewwithpageheadertest.cpp ${CMAKE_CURRENT_SOURCE_DIR}/../../../plugins/DashViews/listviewwithpageheader.cpp)
29qt5_use_modules(listviewwithpageheadertestExec Test Core Qml)
29qt5_use_modules(listviewwithpageheadertestExec Test Core Qml)
30target_link_libraries(listviewwithpageheadertestExec ${Qt5Gui_LIBRARIES} ${Qt5Quick_LIBRARIES})
30target_link_libraries(listviewwithpageheadertestExec ${Qt5Gui_LIBRARIES} ${Qt5Quick_LIBRARIES})
31add_custom_target(testlistviewwithpageheader ${CMAKE_CURRENT_BINARY_DIR}/listviewwithpageheadertestExec -o ${CMAKE_BINARY_DIR}/testlistviewwithpageheader.xml,xunitxml -o -,txt)
31add_custom_target(testlistviewwithpageheader ${CMAKE_CURRENT_BINARY_DIR}/listviewwithpageheadertestExec -o ${CMAKE_BINARY_DIR}/testlistviewwithpageheader.xml,xunitxml -o -,txt)
32
32
33−add_executable(listviewwithpageheadertestsectionExec listviewwithpageheadertestsection.cpp ${CMAKE_CURRENT_SOURCE_DIR}/../../../plugins/ListViewWithPageHeader/listviewwithpageheader.cpp)
33+add_executable(listviewwithpageheadertestsectionExec listviewwithpageheadertestsection.cpp ${CMAKE_CURRENT_SOURCE_DIR}/../../../plugins/DashViews/listviewwithpageheader.cpp)
34qt5_use_modules(listviewwithpageheadertestsectionExec Test Core Qml)
34qt5_use_modules(listviewwithpageheadertestsectionExec Test Core Qml)
35target_link_libraries(listviewwithpageheadertestsectionExec ${Qt5Gui_LIBRARIES} ${Qt5Quick_LIBRARIES})
35target_link_libraries(listviewwithpageheadertestsectionExec ${Qt5Gui_LIBRARIES} ${Qt5Quick_LIBRARIES})
36add_custom_target(testlistviewwithpageheadersection ${CMAKE_CURRENT_BINARY_DIR}/listviewwithpageheadertestsectionExec -o ${CMAKE_BINARY_DIR}/testlistviewwithpageheadersection.xml,xunitxml -o -,txt)
36add_custom_target(testlistviewwithpageheadersection ${CMAKE_CURRENT_BINARY_DIR}/listviewwithpageheadertestsectionExec -o ${CMAKE_BINARY_DIR}/testlistviewwithpageheadersection.xml,xunitxml -o -,txt)
37
37
38−add_executable(listviewwithpageheadertestsectionexternalmodelExec listviewwithpageheadertestsectionexternalmodel.cpp ${CMAKE_CURRENT_SOURCE_DIR}/../../../plugins/ListViewWithPageHeader/listviewwithpageheader.cpp)
38+add_executable(listviewwithpageheadertestsectionexternalmodelExec listviewwithpageheadertestsectionexternalmodel.cpp ${CMAKE_CURRENT_SOURCE_DIR}/../../../plugins/DashViews/listviewwithpageheader.cpp)
39qt5_use_modules(listviewwithpageheadertestsectionexternalmodelExec Test Core Qml)
39qt5_use_modules(listviewwithpageheadertestsectionexternalmodelExec Test Core Qml)
40target_link_libraries(listviewwithpageheadertestsectionexternalmodelExec ${Qt5Gui_LIBRARIES} ${Qt5Quick_LIBRARIES})
40target_link_libraries(listviewwithpageheadertestsectionexternalmodelExec ${Qt5Gui_LIBRARIES} ${Qt5Quick_LIBRARIES})
41add_custom_target(testlistviewwithpageheadersectionexternalmodel ${CMAKE_CURRENT_BINARY_DIR}/listviewwithpageheadertestsectionexternalmodelExec -o ${CMAKE_BINARY_DIR}/testlistviewwithpageheadersectionexternalmodel.xml,xunitxml -o -,txt)
41add_custom_target(testlistviewwithpageheadersectionexternalmodel ${CMAKE_CURRENT_BINARY_DIR}/listviewwithpageheadertestsectionexternalmodelExec -o ${CMAKE_BINARY_DIR}/testlistviewwithpageheadersectionexternalmodel.xml,xunitxml -o -,txt)
42
42
43+add_executable(verticaljournaltestExec verticaljournaltest.cpp ${CMAKE_CURRENT_SOURCE_DIR}/../../../plugins/DashViews/verticaljournal.cpp)
44+qt5_use_modules(verticaljournaltestExec Test Core Qml)
45+target_link_libraries(verticaljournaltestExec ${Qt5Gui_LIBRARIES} ${Qt5Quick_LIBRARIES})
46+add_custom_target(testVerticalJournal ${CMAKE_CURRENT_BINARY_DIR}/verticaljournaltestExec -o ${CMAKE_BINARY_DIR}/testVerticalJournal.xml,xunitxml -o -,txt)
47+
48+add_executable(verticaljournaltryExec verticaljournaltry.cpp ${CMAKE_CURRENT_SOURCE_DIR}/../../../plugins/DashViews/verticaljournal.cpp)
49+qt5_use_modules(verticaljournaltryExec Test Core Qml)
50+target_link_libraries(verticaljournaltryExec ${Qt5Gui_LIBRARIES} ${Qt5Quick_LIBRARIES})
51+add_custom_target(tryVerticalJournal ${CMAKE_CURRENT_BINARY_DIR}/verticaljournaltryExec -o ${CMAKE_BINARY_DIR}/testVerticalJournal.xml,xunitxml -o -,txt)
52+
43set(qmltest_DEFAULT_NO_ADD_TEST TRUE)
53set(qmltest_DEFAULT_NO_ADD_TEST TRUE)
44add_qml_test(. listviewwithpageheaderqml IMPORT_PATHS ${CMAKE_BINARY_DIR}/plugins)
54add_qml_test(. listviewwithpageheaderqml IMPORT_PATHS ${CMAKE_BINARY_DIR}/plugins)
45
55
@@ -47,3 +57,4 @@ add_dependencies(qmluitests testlistviewwithpageheader)
47add_dependencies(qmluitests testlistviewwithpageheadersection)
57add_dependencies(qmluitests testlistviewwithpageheadersection)
48add_dependencies(qmluitests testlistviewwithpageheadersectionexternalmodel)
58add_dependencies(qmluitests testlistviewwithpageheadersectionexternalmodel)
49add_dependencies(qmluitests testlistviewwithpageheaderqml)
59add_dependencies(qmluitests testlistviewwithpageheaderqml)
60+add_dependencies(qmluitests testVerticalJournal)
tests/plugins/ListViewWithPageHeader/listviewwithpageheadertest.cpp → tests/plugins/DashViews/listviewwithpageheadertest.cpprenamed+1−1
@@ -118,7 +118,7 @@ private Q_SLOTS:
118 {
118 {
119 view = new QQuickView();
119 view = new QQuickView();
120 view->engine()->addImportPath(BUILT_PLUGINS_DIR);
120 view->engine()->addImportPath(BUILT_PLUGINS_DIR);
121− view->setSource(QUrl::fromLocalFile(LISTVIEWWITHPAGEHEADER_FOLDER "/test.qml"));
121+ view->setSource(QUrl::fromLocalFile(DASHVIEWSTEST_FOLDER "/listviewwithpageheadertest.qml"));
122 lvwph = dynamic_cast<ListViewWithPageHeader*>(view->rootObject()->findChild<QQuickFlickable*>());
122 lvwph = dynamic_cast<ListViewWithPageHeader*>(view->rootObject()->findChild<QQuickFlickable*>());
123#if (QT_VERSION < QT_VERSION_CHECK(5, 1, 0))
123#if (QT_VERSION < QT_VERSION_CHECK(5, 1, 0))
124 model = view->rootObject()->findChild<QQuickListModel*>();
124 model = view->rootObject()->findChild<QQuickListModel*>();
tests/plugins/ListViewWithPageHeader/test.qml → tests/plugins/DashViews/listviewwithpageheadertest.qmlrenamed+1−1
@@ -15,7 +15,7 @@
15 */
15 */
16
16
17import QtQuick 2.0
17import QtQuick 2.0
18−import ListViewWithPageHeader 0.1
18+import DashViews 0.1
19
19
20Rectangle {
20Rectangle {
21 width: 300
21 width: 300
tests/plugins/ListViewWithPageHeader/listviewwithpageheadertestsection.cpp → tests/plugins/DashViews/listviewwithpageheadertestsection.cpprenamed+1−1
@@ -133,7 +133,7 @@ private Q_SLOTS:
133 {
133 {
134 view = new QQuickView();
134 view = new QQuickView();
135 view->engine()->addImportPath(BUILT_PLUGINS_DIR);
135 view->engine()->addImportPath(BUILT_PLUGINS_DIR);
136− view->setSource(QUrl::fromLocalFile(LISTVIEWWITHPAGEHEADER_FOLDER "/test_section.qml"));
136+ view->setSource(QUrl::fromLocalFile(DASHVIEWSTEST_FOLDER "/listviewwithpageheadertestsection.qml"));
137 lvwph = dynamic_cast<ListViewWithPageHeader*>(view->rootObject()->findChild<QQuickFlickable*>());
137 lvwph = dynamic_cast<ListViewWithPageHeader*>(view->rootObject()->findChild<QQuickFlickable*>());
138#if (QT_VERSION < QT_VERSION_CHECK(5, 1, 0))
138#if (QT_VERSION < QT_VERSION_CHECK(5, 1, 0))
139 model = view->rootObject()->findChild<QQuickListModel*>();
139 model = view->rootObject()->findChild<QQuickListModel*>();
tests/plugins/ListViewWithPageHeader/test_section.qml → tests/plugins/DashViews/listviewwithpageheadertestsection.qmlrenamed+1−1
@@ -15,7 +15,7 @@
15 */
15 */
16
16
17import QtQuick 2.0
17import QtQuick 2.0
18−import ListViewWithPageHeader 0.1
18+import DashViews 0.1
19
19
20Rectangle {
20Rectangle {
21 width: 300
21 width: 300
tests/plugins/ListViewWithPageHeader/listviewwithpageheadertestsectionexternalmodel.cpp → tests/plugins/DashViews/listviewwithpageheadertestsectionexternalmodel.cpprenamed+1−1
@@ -173,7 +173,7 @@ private Q_SLOTS:
173 {
173 {
174 view = new QQuickView();
174 view = new QQuickView();
175 view->engine()->addImportPath(BUILT_PLUGINS_DIR);
175 view->engine()->addImportPath(BUILT_PLUGINS_DIR);
176− view->setSource(QUrl::fromLocalFile(LISTVIEWWITHPAGEHEADER_FOLDER "/test_sectionexternalmodel.qml"));
176+ view->setSource(QUrl::fromLocalFile(DASHVIEWSTEST_FOLDER "/listviewwithpageheadertestsectionexternalmodel.qml"));
177 lvwph = dynamic_cast<ListViewWithPageHeader*>(view->rootObject()->findChild<QQuickFlickable*>());
177 lvwph = dynamic_cast<ListViewWithPageHeader*>(view->rootObject()->findChild<QQuickFlickable*>());
178 QVERIFY(lvwph);
178 QVERIFY(lvwph);
179 view->show();
179 view->show();
tests/plugins/ListViewWithPageHeader/test_sectionexternalmodel.qml → tests/plugins/DashViews/listviewwithpageheadertestsectionexternalmodel.qmlrenamed+1−1
@@ -15,7 +15,7 @@
15 */
15 */
16
16
17import QtQuick 2.0
17import QtQuick 2.0
18−import ListViewWithPageHeader 0.1
18+import DashViews 0.1
19
19
20Rectangle {
20Rectangle {
21 width: 300
21 width: 300
tests/plugins/ListViewWithPageHeader/tst_listviewwithpageheaderqml.qml → tests/plugins/DashViews/tst_listviewwithpageheaderqml.qmlrenamed+1−1
@@ -16,7 +16,7 @@
16
16
17import QtQuick 2.0
17import QtQuick 2.0
18import QtTest 1.0
18import QtTest 1.0
19−import ListViewWithPageHeader 0.1
19+import DashViews 0.1
20
20
21Rectangle {
21Rectangle {
22 width: 300
22 width: 300
tests/plugins/DashViews/verticaljournaltest.cppnew file+438
@@ -0,0 +1,438 @@
1+/*
2+ * Copyright (C) 2013 Canonical, Ltd.
3+ *
4+ * This program is free software; you can redistribute it and/or modify
5+ * it under the terms of the GNU General Public License as published by
6+ * the Free Software Foundation; version 3.
7+ *
8+ * This program is distributed in the hope that it will be useful,
9+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
10+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+ * GNU General Public License for more details.
12+ *
13+ * You should have received a copy of the GNU General Public License
14+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
15+ */
16+
17+#include <QQuickView>
18+#include <QtTestGui>
19+#include <QDebug>
20+#include <QGuiApplication>
21+#include <QQuickView>
22+#include <QtQml/qqml.h>
23+#include <QStringListModel>
24+#include <QQmlContext>
25+#include <QQmlEngine>
26+#pragma GCC diagnostic push
27+#pragma GCC diagnostic ignored "-pedantic"
28+#include <private/qquickitem_p.h>
29+#pragma GCC diagnostic pop
30+
31+#include "verticaljournal.h"
32+
33+class QHeightModel : public QAbstractListModel {
34+public:
35+ QHash<int, QByteArray> roleNames() const
36+ {
37+ QHash<int, QByteArray> roles;
38+ roles.insert(Qt::DisplayRole, "modelHeight");
39+ return roles;
40+ }
41+
42+ int rowCount(const QModelIndex & /*parent*/) const
43+ {
44+ return m_list.count();
45+ }
46+
47+ QVariant data(const QModelIndex &index, int /*role*/) const
48+ {
49+ return m_list[index.row()];
50+ }
51+
52+ QStringList stringList() const
53+ {
54+ return m_list;
55+ }
56+
57+ void setStringList(const QStringList &list)
58+ {
59+ beginResetModel();
60+ m_list = list;
61+ endResetModel();
62+ }
63+
64+ void addString(const QString& string)
65+ {
66+ beginInsertRows(QModelIndex(), m_list.count(), m_list.count());
67+ m_list << string;
68+ endInsertRows();
69+ }
70+
71+ void removeLast()
72+ {
73+ beginRemoveRows(QModelIndex(), m_list.count() - 1, m_list.count() - 1);
74+ m_list.takeLast();
75+ endRemoveRows();
76+ }
77+
78+private:
79+ QStringList m_list;
80+};
81+
82+class VerticalJournalTest : public QObject
83+{
84+ Q_OBJECT
85+
86+private:
87+ void verifyItem(const VerticalJournal::ViewItem &item, int modelIndex, qreal x, qreal y, bool visible)
88+ {
89+ QTRY_COMPARE(item.m_modelIndex, modelIndex);
90+ QTRY_COMPARE(item.x(), x);
91+ QTRY_COMPARE(item.y(), y);
92+ QTRY_COMPARE(item.height(), model->stringList()[modelIndex].toDouble());
93+ QTRY_COMPARE(QQuickItemPrivate::get(item.m_item)->culled, !visible);
94+ }
95+
96+ void checkInitialPositions()
97+ {
98+ QTRY_COMPARE(vj->m_columnVisibleItems.count(), 3);
99+ QTRY_COMPARE(vj->m_columnVisibleItems[0].count(), 5);
100+ QTRY_COMPARE(vj->m_columnVisibleItems[1].count(), 7);
101+ QTRY_COMPARE(vj->m_columnVisibleItems[2].count(), 6);
102+ verifyItem(vj->m_columnVisibleItems[0][0], 0, 0, 0, true);
103+ verifyItem(vj->m_columnVisibleItems[1][0], 1, 160, 0, true);
104+ verifyItem(vj->m_columnVisibleItems[2][0], 2, 320, 0, true);
105+ verifyItem(vj->m_columnVisibleItems[1][1], 3, 160, 60, true);
106+ verifyItem(vj->m_columnVisibleItems[1][2], 4, 160, 80, true);
107+ verifyItem(vj->m_columnVisibleItems[0][1], 5, 0, 110, true);
108+ verifyItem(vj->m_columnVisibleItems[1][3], 6, 160, 130, true);
109+ verifyItem(vj->m_columnVisibleItems[2][1], 7, 320, 135, true);
110+ verifyItem(vj->m_columnVisibleItems[0][2], 8, 0, 190, true);
111+ verifyItem(vj->m_columnVisibleItems[2][2], 9, 320, 255, true);
112+ verifyItem(vj->m_columnVisibleItems[2][3], 10, 320, 285, true);
113+ verifyItem(vj->m_columnVisibleItems[2][4], 11, 320, 315, true);
114+ verifyItem(vj->m_columnVisibleItems[1][4], 12, 160, 340, true);
115+ verifyItem(vj->m_columnVisibleItems[0][3], 13, 0, 360, true);
116+ verifyItem(vj->m_columnVisibleItems[2][5], 14, 320, 390, true);
117+ verifyItem(vj->m_columnVisibleItems[1][5], 15, 160, 430, false);
118+ verifyItem(vj->m_columnVisibleItems[0][4], 16, 0, 570, false);
119+ verifyItem(vj->m_columnVisibleItems[1][6], 17, 160, 570, false);
120+ QCOMPARE(vj->implicitHeight(), 970. + 2. * 970. / 18.);
121+ }
122+
123+private Q_SLOTS:
124+ void init()
125+ {
126+ view = new QQuickView();
127+ view->setResizeMode(QQuickView::SizeRootObjectToView);
128+ view->engine()->addImportPath(BUILT_PLUGINS_DIR);
129+
130+ model = new QHeightModel();
131+ QStringList heightList;
132+ heightList << "100" << "50" << "125" << "10" << "40" << "70" << "200" << "110" << "160" << "20" << "20" << "65" << "80" << "200" << "300" << "130" << "400" << "300" << "500" << "10";
133+ model->setStringList(heightList);
134+
135+ view->setSource(QUrl::fromLocalFile(DASHVIEWSTEST_FOLDER "/verticaljournaltest.qml"));
136+
137+ view->show();
138+ view->resize(470, 400);
139+ QTest::qWaitForWindowExposed(view);
140+
141+ vj = dynamic_cast<VerticalJournal*>(view->rootObject()->findChild<QObject*>("vj"));
142+ vj->setModel(model);
143+
144+ checkInitialPositions();
145+ }
146+
147+ void cleanup()
148+ {
149+ delete view;
150+ delete model;
151+ }
152+
153+ void testWidthResize()
154+ {
155+ view->resize(629, 400);
156+ QTRY_COMPARE(vj->width(), 629.);
157+
158+ // This is exactly the same block as above as nothing changed, just white space on the right
159+ checkInitialPositions();
160+
161+ view->resize(630, 400);
162+
163+ QTRY_COMPARE(vj->m_columnVisibleItems.count(), 4);
164+ QTRY_COMPARE(vj->m_columnVisibleItems[0].count(), 4);
165+ QTRY_COMPARE(vj->m_columnVisibleItems[1].count(), 7);
166+ QTRY_COMPARE(vj->m_columnVisibleItems[2].count(), 4);
167+ QTRY_COMPARE(vj->m_columnVisibleItems[3].count(), 5);
168+ verifyItem(vj->m_columnVisibleItems[0][0], 0, 0, 0, true);
169+ verifyItem(vj->m_columnVisibleItems[1][0], 1, 160, 0, true);
170+ verifyItem(vj->m_columnVisibleItems[2][0], 2, 320, 0, true);
171+ verifyItem(vj->m_columnVisibleItems[3][0], 3, 480, 0, true);
172+ verifyItem(vj->m_columnVisibleItems[3][1], 4, 480, 20, true);
173+ verifyItem(vj->m_columnVisibleItems[1][1], 5, 160, 60, true);
174+ verifyItem(vj->m_columnVisibleItems[3][2], 6, 480, 70, true);
175+ verifyItem(vj->m_columnVisibleItems[0][1], 7, 0, 110, true);
176+ verifyItem(vj->m_columnVisibleItems[2][1], 8, 320, 135, true);
177+ verifyItem(vj->m_columnVisibleItems[1][2], 9, 160, 140, true);
178+ verifyItem(vj->m_columnVisibleItems[1][3], 10, 160, 170, true);
179+ verifyItem(vj->m_columnVisibleItems[1][4], 11, 160, 200, true);
180+ verifyItem(vj->m_columnVisibleItems[0][2], 12, 0, 230, true);
181+ verifyItem(vj->m_columnVisibleItems[1][5], 13, 160, 275, true);
182+ verifyItem(vj->m_columnVisibleItems[3][3], 14, 480, 280, true);
183+ verifyItem(vj->m_columnVisibleItems[2][2], 15, 320, 305, true);
184+ verifyItem(vj->m_columnVisibleItems[0][3], 16, 0, 320, true);
185+ verifyItem(vj->m_columnVisibleItems[2][3], 17, 320, 445, false);
186+ verifyItem(vj->m_columnVisibleItems[1][6], 18, 160, 485, false);
187+ verifyItem(vj->m_columnVisibleItems[3][4], 19, 480, 590, false);
188+ QTRY_COMPARE(vj->implicitHeight(), 985.);
189+
190+ view->resize(470, 400);
191+
192+ // This is exactly the same block as the first again
193+ checkInitialPositions();
194+ }
195+
196+ void testColumnSpacing()
197+ {
198+ vj->setColumnSpacing(11);
199+
200+ QTRY_COMPARE(vj->m_needsRelayout, false);
201+ QTRY_COMPARE(vj->m_columnVisibleItems.count(), 2);
202+ QTRY_COMPARE(vj->m_columnVisibleItems[0].count(), 7);
203+ QTRY_COMPARE(vj->m_columnVisibleItems[1].count(), 7);
204+ verifyItem(vj->m_columnVisibleItems[0][0], 0, 0, 0, true);
205+ verifyItem(vj->m_columnVisibleItems[1][0], 1, 161, 0, true);
206+ verifyItem(vj->m_columnVisibleItems[1][1], 2, 161, 60, true);
207+ verifyItem(vj->m_columnVisibleItems[0][1], 3, 0, 110, true);
208+ verifyItem(vj->m_columnVisibleItems[0][2], 4, 0, 130, true);
209+ verifyItem(vj->m_columnVisibleItems[0][3], 5, 0, 180, true);
210+ verifyItem(vj->m_columnVisibleItems[1][2], 6, 161, 195, true);
211+ verifyItem(vj->m_columnVisibleItems[0][4], 7, 0, 260, true);
212+ verifyItem(vj->m_columnVisibleItems[0][5], 8, 0, 380, true);
213+ verifyItem(vj->m_columnVisibleItems[1][3], 9, 161, 405, false);
214+ verifyItem(vj->m_columnVisibleItems[1][4], 10, 161, 435, false);
215+ verifyItem(vj->m_columnVisibleItems[1][5], 11, 161, 465, false);
216+ verifyItem(vj->m_columnVisibleItems[1][6], 12, 161, 540, false);
217+ verifyItem(vj->m_columnVisibleItems[0][6], 13, 0, 550, false);
218+ QCOMPARE(vj->implicitHeight(), 750. + 6. * 750. / 14.);
219+
220+ vj->setColumnSpacing(10);
221+ QTRY_COMPARE(vj->m_needsRelayout, false);
222+
223+ // This is exactly the same block as the first again
224+ checkInitialPositions();
225+ }
226+
227+ void testRowSpacing()
228+ {
229+ vj->setRowSpacing(11);
230+
231+ QTRY_COMPARE(vj->m_needsRelayout, false);
232+ QTRY_COMPARE(vj->m_columnVisibleItems.count(), 3);
233+ QTRY_COMPARE(vj->m_columnVisibleItems[0].count(), 5);
234+ QTRY_COMPARE(vj->m_columnVisibleItems[1].count(), 7);
235+ QTRY_COMPARE(vj->m_columnVisibleItems[2].count(), 6);
236+ verifyItem(vj->m_columnVisibleItems[0][0], 0, 0, 0, true);
237+ verifyItem(vj->m_columnVisibleItems[1][0], 1, 160, 0, true);
238+ verifyItem(vj->m_columnVisibleItems[2][0], 2, 320, 0, true);
239+ verifyItem(vj->m_columnVisibleItems[1][1], 3, 160, 61, true);
240+ verifyItem(vj->m_columnVisibleItems[1][2], 4, 160, 82, true);
241+ verifyItem(vj->m_columnVisibleItems[0][1], 5, 0, 111, true);
242+ verifyItem(vj->m_columnVisibleItems[1][3], 6, 160, 133, true);
243+ verifyItem(vj->m_columnVisibleItems[2][1], 7, 320, 136, true);
244+ verifyItem(vj->m_columnVisibleItems[0][2], 8, 0, 192, true);
245+ verifyItem(vj->m_columnVisibleItems[2][2], 9, 320, 257, true);
246+ verifyItem(vj->m_columnVisibleItems[2][3], 10, 320, 288, true);
247+ verifyItem(vj->m_columnVisibleItems[2][4], 11, 320, 319, true);
248+ verifyItem(vj->m_columnVisibleItems[1][4], 12, 160, 344, true);
249+ verifyItem(vj->m_columnVisibleItems[0][3], 13, 0, 363, true);
250+ verifyItem(vj->m_columnVisibleItems[2][5], 14, 320, 395, true);
251+ verifyItem(vj->m_columnVisibleItems[1][5], 15, 160, 435, false);
252+ verifyItem(vj->m_columnVisibleItems[0][4], 16, 0, 574, false);
253+ verifyItem(vj->m_columnVisibleItems[1][6], 17, 160, 576, false);
254+ QCOMPARE(vj->implicitHeight(), 974. + 2. * 974. / 18.);
255+
256+ vj->setRowSpacing(10);
257+ QTRY_COMPARE(vj->m_needsRelayout, false);
258+
259+ // This is exactly the same block as the first again
260+ checkInitialPositions();
261+ }
262+
263+ void testDelegateCreationRanges()
264+ {
265+ vj->setDelegateCreationBegin(200);
266+ vj->setDelegateCreationEnd(view->height());
267+
268+ QTRY_COMPARE(vj->m_columnVisibleItems.count(), 3);
269+ QTRY_COMPARE(vj->m_columnVisibleItems[0].count(), 4);
270+ QTRY_COMPARE(vj->m_columnVisibleItems[1].count(), 4);
271+ QTRY_COMPARE(vj->m_columnVisibleItems[2].count(), 6);
272+ verifyItem(vj->m_columnVisibleItems[0][0], 0, 0, 0, false);
273+ verifyItem(vj->m_columnVisibleItems[2][0], 2, 320, 0, false);
274+ verifyItem(vj->m_columnVisibleItems[1][0], 4, 160, 80, false);
275+ verifyItem(vj->m_columnVisibleItems[0][1], 5, 0, 110, false);
276+ verifyItem(vj->m_columnVisibleItems[1][1], 6, 160, 130, true);
277+ verifyItem(vj->m_columnVisibleItems[2][1], 7, 320, 135, true);
278+ verifyItem(vj->m_columnVisibleItems[0][2], 8, 0, 190, true);
279+ verifyItem(vj->m_columnVisibleItems[2][2], 9, 320, 255, true);
280+ verifyItem(vj->m_columnVisibleItems[2][3], 10, 320, 285, true);
281+ verifyItem(vj->m_columnVisibleItems[2][4], 11, 320, 315, true);
282+ verifyItem(vj->m_columnVisibleItems[1][2], 12, 160, 340, true);
283+ verifyItem(vj->m_columnVisibleItems[0][3], 13, 0, 360, true);
284+ verifyItem(vj->m_columnVisibleItems[2][5], 14, 320, 390, true);
285+ verifyItem(vj->m_columnVisibleItems[1][3], 15, 160, 430, false);
286+ QCOMPARE(vj->implicitHeight(), 690. + 4. * 690. / 16.);
287+
288+ vj->resetDelegateCreationBegin();
289+ vj->resetDelegateCreationEnd();
290+
291+ // This is exactly the same block as the first again
292+ checkInitialPositions();
293+ }
294+
295+
296+ void testColumnWidthChange()
297+ {
298+ vj->setColumnWidth(200);
299+ QTRY_COMPARE(vj->m_columnVisibleItems.count(), 2);
300+ QTRY_COMPARE(vj->m_columnVisibleItems[0].count(), 7);
301+ QTRY_COMPARE(vj->m_columnVisibleItems[1].count(), 7);
302+ verifyItem(vj->m_columnVisibleItems[0][0], 0, 0, 0, true);
303+ verifyItem(vj->m_columnVisibleItems[1][0], 1, 210, 0, true);
304+ verifyItem(vj->m_columnVisibleItems[1][1], 2, 210, 60, true);
305+ verifyItem(vj->m_columnVisibleItems[0][1], 3, 0, 110, true);
306+ verifyItem(vj->m_columnVisibleItems[0][2], 4, 0, 130, true);
307+ verifyItem(vj->m_columnVisibleItems[0][3], 5, 0, 180, true);
308+ verifyItem(vj->m_columnVisibleItems[1][2], 6, 210, 195, true);
309+ verifyItem(vj->m_columnVisibleItems[0][4], 7, 0, 260, true);
310+ verifyItem(vj->m_columnVisibleItems[0][5], 8, 0, 380, true);
311+ verifyItem(vj->m_columnVisibleItems[1][3], 9, 210, 405, false);
312+ verifyItem(vj->m_columnVisibleItems[1][4], 10, 210, 435, false);
313+ verifyItem(vj->m_columnVisibleItems[1][5], 11, 210, 465, false);
314+ verifyItem(vj->m_columnVisibleItems[1][6], 12, 210, 540, false);
315+ verifyItem(vj->m_columnVisibleItems[0][6], 13, 0, 550, false);
316+ QCOMPARE(vj->implicitHeight(), 750. + 6. * 750. / 14.);
317+
318+ vj->setColumnWidth(150);
319+
320+ // This is exactly the same block as the first again
321+ checkInitialPositions();
322+ }
323+
324+ void testChangeModel()
325+ {
326+ QHeightModel *model2 = new QHeightModel();
327+ QStringList list2;
328+ list2 << "100" << "50" << "25" << "25" << "50" << "50";
329+ model2->setStringList(list2);
330+ vj->setModel(model2);
331+ delete model;
332+ model = model2;
333+
334+ QTRY_COMPARE(vj->m_columnVisibleItems.count(), 3);
335+ QTRY_COMPARE(vj->m_columnVisibleItems[0].count(), 1);
336+ QTRY_COMPARE(vj->m_columnVisibleItems[1].count(), 2);
337+ QTRY_COMPARE(vj->m_columnVisibleItems[2].count(), 3);
338+ verifyItem(vj->m_columnVisibleItems[0][0], 0, 0, 0, true);
339+ verifyItem(vj->m_columnVisibleItems[1][0], 1, 160, 0, true);
340+ verifyItem(vj->m_columnVisibleItems[2][0], 2, 320, 0, true);
341+ verifyItem(vj->m_columnVisibleItems[2][1], 3, 320, 35, true);
342+ verifyItem(vj->m_columnVisibleItems[1][1], 4, 160, 60, true);
343+ verifyItem(vj->m_columnVisibleItems[2][2], 5, 320, 70, true);
344+ }
345+
346+ void testModelReset()
347+ {
348+ QStringList heightList;
349+ heightList << "100" << "50" << "50" << "30";
350+ model->setStringList(heightList);
351+
352+ QTRY_COMPARE(vj->m_columnVisibleItems.count(), 3);
353+ QTRY_COMPARE(vj->m_columnVisibleItems[0].count(), 1);
354+ QTRY_COMPARE(vj->m_columnVisibleItems[1].count(), 2);
355+ QTRY_COMPARE(vj->m_columnVisibleItems[2].count(), 1);
356+ verifyItem(vj->m_columnVisibleItems[0][0], 0, 0, 0, true);
357+ verifyItem(vj->m_columnVisibleItems[1][0], 1, 160, 0, true);
358+ verifyItem(vj->m_columnVisibleItems[2][0], 2, 320, 0, true);
359+ verifyItem(vj->m_columnVisibleItems[1][1], 3, 160, 60, true);
360+ }
361+
362+ void testModelAppendRemoveLast()
363+ {
364+ QHeightModel *model2 = new QHeightModel();
365+ QStringList list2;
366+ list2 << "100" << "50" << "25" << "25" << "50" << "50";
367+ model2->setStringList(list2);
368+ vj->setModel(model2);
369+ delete model;
370+ model = model2;
371+
372+ QTRY_COMPARE(vj->m_columnVisibleItems.count(), 3);
373+ QTRY_COMPARE(vj->m_columnVisibleItems[0].count(), 1);
374+ QTRY_COMPARE(vj->m_columnVisibleItems[1].count(), 2);
375+ QTRY_COMPARE(vj->m_columnVisibleItems[2].count(), 3);
376+ verifyItem(vj->m_columnVisibleItems[0][0], 0, 0, 0, true);
377+ verifyItem(vj->m_columnVisibleItems[1][0], 1, 160, 0, true);
378+ verifyItem(vj->m_columnVisibleItems[2][0], 2, 320, 0, true);
379+ verifyItem(vj->m_columnVisibleItems[2][1], 3, 320, 35, true);
380+ verifyItem(vj->m_columnVisibleItems[1][1], 4, 160, 60, true);
381+ verifyItem(vj->m_columnVisibleItems[2][2], 5, 320, 70, true);
382+
383+ model2->addString("75");
384+
385+ QTRY_COMPARE(vj->m_columnVisibleItems.count(), 3);
386+ QTRY_COMPARE(vj->m_columnVisibleItems[0].count(), 2);
387+ QTRY_COMPARE(vj->m_columnVisibleItems[1].count(), 2);
388+ QTRY_COMPARE(vj->m_columnVisibleItems[2].count(), 3);
389+ verifyItem(vj->m_columnVisibleItems[0][0], 0, 0, 0, true);
390+ verifyItem(vj->m_columnVisibleItems[1][0], 1, 160, 0, true);
391+ verifyItem(vj->m_columnVisibleItems[2][0], 2, 320, 0, true);
392+ verifyItem(vj->m_columnVisibleItems[2][1], 3, 320, 35, true);
393+ verifyItem(vj->m_columnVisibleItems[1][1], 4, 160, 60, true);
394+ verifyItem(vj->m_columnVisibleItems[2][2], 5, 320, 70, true);
395+ verifyItem(vj->m_columnVisibleItems[0][1], 6, 0, 110, true);
396+
397+ model2->addString("50");
398+ model2->addString("50");
399+
400+ QTRY_COMPARE(vj->m_columnVisibleItems.count(), 3);
401+ QTRY_COMPARE(vj->m_columnVisibleItems[0].count(), 2);
402+ QTRY_COMPARE(vj->m_columnVisibleItems[1].count(), 3);
403+ QTRY_COMPARE(vj->m_columnVisibleItems[2].count(), 4);
404+ verifyItem(vj->m_columnVisibleItems[0][0], 0, 0, 0, true);
405+ verifyItem(vj->m_columnVisibleItems[1][0], 1, 160, 0, true);
406+ verifyItem(vj->m_columnVisibleItems[2][0], 2, 320, 0, true);
407+ verifyItem(vj->m_columnVisibleItems[2][1], 3, 320, 35, true);
408+ verifyItem(vj->m_columnVisibleItems[1][1], 4, 160, 60, true);
409+ verifyItem(vj->m_columnVisibleItems[2][2], 5, 320, 70, true);
410+ verifyItem(vj->m_columnVisibleItems[0][1], 6, 0, 110, true);
411+ verifyItem(vj->m_columnVisibleItems[1][2], 7, 160, 120, true);
412+ verifyItem(vj->m_columnVisibleItems[2][3], 8, 320, 130, true);
413+
414+ model2->removeLast();
415+
416+ QTRY_COMPARE(vj->m_columnVisibleItems.count(), 3);
417+ QTRY_COMPARE(vj->m_columnVisibleItems[0].count(), 2);
418+ QTRY_COMPARE(vj->m_columnVisibleItems[1].count(), 3);
419+ QTRY_COMPARE(vj->m_columnVisibleItems[2].count(), 3);
420+ verifyItem(vj->m_columnVisibleItems[0][0], 0, 0, 0, true);
421+ verifyItem(vj->m_columnVisibleItems[1][0], 1, 160, 0, true);
422+ verifyItem(vj->m_columnVisibleItems[2][0], 2, 320, 0, true);
423+ verifyItem(vj->m_columnVisibleItems[2][1], 3, 320, 35, true);
424+ verifyItem(vj->m_columnVisibleItems[1][1], 4, 160, 60, true);
425+ verifyItem(vj->m_columnVisibleItems[2][2], 5, 320, 70, true);
426+ verifyItem(vj->m_columnVisibleItems[0][1], 6, 0, 110, true);
427+ verifyItem(vj->m_columnVisibleItems[1][2], 7, 160, 120, true);
428+ }
429+
430+private:
431+ QQuickView *view;
432+ VerticalJournal *vj;
433+ QHeightModel *model;
434+};
435+
436+QTEST_MAIN(VerticalJournalTest)
437+
438+#include "verticaljournaltest.moc"
tests/plugins/DashViews/verticaljournaltest.qmlnew file+44
@@ -0,0 +1,44 @@
1+/*
2+ * Copyright (C) 2013 Canonical, Ltd.
3+ *
4+ * This program is free software; you can redistribute it and/or modify
5+ * it under the terms of the GNU General Public License as published by
6+ * the Free Software Foundation; version 3.
7+ *
8+ * This program is distributed in the hope that it will be useful,
9+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
10+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+ * GNU General Public License for more details.
12+ *
13+ * You should have received a copy of the GNU General Public License
14+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
15+ */
16+
17+import QtQuick 2.1
18+import DashViews 0.1
19+
20+Item {
21+
22+ VerticalJournal {
23+ id: vj
24+ objectName: "vj"
25+ anchors.fill: parent
26+ columnWidth: 150
27+ columnSpacing: 10
28+ rowSpacing: 10
29+
30+ delegate: Rectangle {
31+ property real randomValue: Math.random()
32+ width: 150
33+ color: randomValue < 0.3 ? "green" : randomValue < 0.6 ? "blue" : "red";
34+ height: modelHeight
35+ border.width: 3
36+
37+ Text {
38+ text: index + "\ny: " + parent.y + "\nheight: " + parent.height
39+ x: 10
40+ y: 10
41+ }
42+ }
43+ }
44+}
tests/plugins/DashViews/verticaljournaltry.cppnew file+90
@@ -0,0 +1,90 @@
1+/*
2+ * Copyright (C) 2013 Canonical, Ltd.
3+ *
4+ * This program is free software; you can redistribute it and/or modify
5+ * it under the terms of the GNU General Public License as published by
6+ * the Free Software Foundation; version 3.
7+ *
8+ * This program is distributed in the hope that it will be useful,
9+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
10+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+ * GNU General Public License for more details.
12+ *
13+ * You should have received a copy of the GNU General Public License
14+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
15+ */
16+
17+#include <QQuickView>
18+#include <QDebug>
19+#include <QGuiApplication>
20+#include <QQuickView>
21+#include <QtQml/qqml.h>
22+#include <QStringListModel>
23+#include <QQmlContext>
24+#include <QQmlEngine>
25+#include <QGuiApplication>
26+
27+#include "verticaljournal.h"
28+
29+class QHeightModel : public QStringListModel {
30+ Q_OBJECT
31+public:
32+ QHash<int, QByteArray> roleNames() const
33+ {
34+ QHash<int, QByteArray> roles;
35+ roles.insert(Qt::DisplayRole, "modelHeight");
36+ return roles;
37+ }
38+
39+public slots:
40+ void add(int height)
41+ {
42+ if (height <= 0) {
43+ height = 50 + 50. * qrand() / RAND_MAX ;
44+ }
45+ QStringList sl = stringList();
46+ sl << QString::number(height);
47+ setStringList(sl);
48+ }
49+
50+ void remove()
51+ {
52+ QStringList sl = stringList();
53+ if (!sl.isEmpty()) {
54+ sl.removeLast();
55+ setStringList(sl);
56+ }
57+ }
58+};
59+
60+int main(int argc, char *argv[])
61+{
62+ QGuiApplication a(argc, argv);
63+
64+ QQuickView *view = new QQuickView();
65+ view->setResizeMode(QQuickView::SizeRootObjectToView);
66+ view->engine()->addImportPath(BUILT_PLUGINS_DIR);
67+
68+ QHeightModel model;
69+ QStringList heightList;
70+ heightList << "100" << "50" << "125";
71+ model.setStringList(heightList);
72+
73+ QStringListModel listModel;
74+ listModel.setStringList(QStringList() << QString());
75+
76+ view->rootContext()->setContextProperty("listModel", &listModel);
77+ view->rootContext()->setContextProperty("vjModel", &model);
78+
79+ view->setSource(QUrl::fromLocalFile(DASHVIEWSTEST_FOLDER "/verticaljournaltry.qml"));
80+
81+ view->show();
82+ view->resize(530, 400);
83+
84+ QObject::connect(view->rootObject(), SIGNAL(add(int)), &model, SLOT(add(int)));
85+ QObject::connect(view->rootObject(), SIGNAL(remove()), &model, SLOT(remove()));
86+
87+ return a.exec();
88+}
89+
90+#include "verticaljournaltry.moc"
tests/plugins/DashViews/verticaljournaltry.qmlnew file+100
@@ -0,0 +1,100 @@
1+/*
2+ * Copyright (C) 2013 Canonical, Ltd.
3+ *
4+ * This program is free software; you can redistribute it and/or modify
5+ * it under the terms of the GNU General Public License as published by
6+ * the Free Software Foundation; version 3.
7+ *
8+ * This program is distributed in the hope that it will be useful,
9+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
10+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+ * GNU General Public License for more details.
12+ *
13+ * You should have received a copy of the GNU General Public License
14+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
15+ */
16+
17+import QtQuick 2.1
18+import DashViews 0.1
19+
20+Item {
21+ id: root
22+ signal add(int height)
23+ signal remove()
24+
25+ ListViewWithPageHeader {
26+ id: lvwph
27+ model: listModel
28+ height: parent.height
29+ width: parent.width - controls.width
30+
31+ delegate: VerticalJournal {
32+ id: vj
33+ model: vjModel
34+ columnWidth: 100
35+ columnSpacing: 10
36+ rowSpacing: 10
37+ width: parent.width
38+ height: implicitHeight > 100 ? implicitHeight : 100
39+ delegateCreationBegin: lvwph.contentY
40+ delegateCreationEnd: lvwph.contentY + lvwph.height
41+
42+ delegate: Rectangle {
43+ width: 100
44+ color: "red";
45+ height: modelHeight
46+ border.width: 3
47+
48+ Text {
49+ text: index + "\ny: " + parent.y + "\nheight: " + parent.height
50+ x: 10
51+ y: 10
52+ }
53+ }
54+ }
55+ }
56+
57+ Rectangle {
58+ id: controls
59+ height: parent.height
60+ width: 100
61+ anchors.right: parent.right
62+ color: "gray"
63+ opacity: 0.4
64+
65+ Rectangle {
66+ id: addButton
67+ height: 50
68+ width: parent.width
69+ color: "blue"
70+ Text {
71+ text: "Add"
72+ anchors.centerIn: parent
73+ }
74+ MouseArea {
75+ anchors.fill: parent
76+ onClicked: root.add(addField.text)
77+ }
78+ }
79+ TextInput {
80+ id: addField
81+ anchors.top: addButton.bottom
82+ height: 30
83+ width: parent.width
84+ }
85+ Rectangle {
86+ anchors.top: addField.bottom
87+ height: 50
88+ width: parent.width
89+ color: "red"
90+ Text {
91+ text: "Remove"
92+ anchors.centerIn: parent
93+ }
94+ MouseArea {
95+ anchors.fill: parent
96+ onClicked: root.remove()
97+ }
98+ }
99+ }
100+}
tests/plugins/Ubuntu/Gestures/CMakeLists.txt+1
@@ -3,6 +3,7 @@ include(QmlTest)
3include_directories(
3include_directories(
4 ${CMAKE_SOURCE_DIR}/plugins/Ubuntu/Gestures
4 ${CMAKE_SOURCE_DIR}/plugins/Ubuntu/Gestures
5 ${CMAKE_CURRENT_BINARY_DIR}
5 ${CMAKE_CURRENT_BINARY_DIR}
6+ ${Qt5Gui_PRIVATE_INCLUDE_DIRS}
6 )
7 )
7
8
8file(GLOB qmlFiles *.qml)
9file(GLOB qmlFiles *.qml)
tests/plugins/Unity/Indicators/CMakeLists.txt−1
@@ -40,4 +40,3 @@ indicator_test(indicatorsmodeltest ADDITIONAL_LIBS IndicatorsQml)
40indicator_test(menucontentactivatortest ADDITIONAL_CPPS ${INDICATORS_DIR}/menucontentactivator.cpp)
40indicator_test(menucontentactivatortest ADDITIONAL_CPPS ${INDICATORS_DIR}/menucontentactivator.cpp)
41indicator_test(unitymenumodelstacktest ADDITIONAL_CPPS ${TEST_DIR}/mocks/QMenuModel/unitymenumodel.cpp ${INDICATORS_DIR}/unitymenumodelstack.cpp)
41indicator_test(unitymenumodelstacktest ADDITIONAL_CPPS ${TEST_DIR}/mocks/QMenuModel/unitymenumodel.cpp ${INDICATORS_DIR}/unitymenumodelstack.cpp)
42indicator_test(rootactionstatetest ADDITIONAL_LIBS IndicatorsQml)
42indicator_test(rootactionstatetest ADDITIONAL_LIBS IndicatorsQml)
43−indicator_test(timeformattertest ADDITIONAL_LIBS IndicatorsQml)
tests/plugins/Unity/Indicators/indicatorsmanagertest.cpp+2−1
@@ -18,7 +18,8 @@
18 */
18 */
19
19
20#include "indicatorsmanager.h"
20#include "indicatorsmanager.h"
21+
21−#include "paths.h"
22+#include <paths.h>
22
23
23#include <QtTest>
24#include <QtTest>
24#include <QDebug>
25#include <QDebug>
tests/plugins/Unity/Indicators/indicatorsmodeltest.cpp+2−1
@@ -19,7 +19,8 @@
19
19
20#include "indicatorsmodel.h"
20#include "indicatorsmodel.h"
21#include "indicators.h"
21#include "indicators.h"
22+
22−#include "paths.h"
23+#include <paths.h>
23
24
24#include <QtTest>
25#include <QtTest>
25#include <QDebug>
26#include <QDebug>
tests/plugins/Unity/Indicators/menucontentactivatortest.cpp−1
@@ -18,7 +18,6 @@
18 */
18 */
19
19
20#include "menucontentactivator.h"
20#include "menucontentactivator.h"
21−#include "paths.h"
22
21
23#include <QtTest>
22#include <QtTest>
24#include <QDebug>
23#include <QDebug>
tests/plugins/Unity/Indicators/unitymenumodelstacktest.cpp−1
@@ -18,7 +18,6 @@
18 */
18 */
19
19
20#include "indicatorsmanager.h"
20#include "indicatorsmanager.h"
21−#include "paths.h"
22#include "unitymenumodelstack.h"
21#include "unitymenumodelstack.h"
23
22
24#include <QtTest>
23#include <QtTest>
tests/plugins/Utils/CMakeLists.txt+1
@@ -24,4 +24,5 @@ endmacro(run_tests)
24run_tests(
24run_tests(
25 qlimitproxymodeltest
25 qlimitproxymodeltest
26 qsortfilterproxymodeltest
26 qsortfilterproxymodeltest
27+ timeformattertest
27 )
28 )
tests/plugins/Unity/Indicators/timeformattertest.cpp → tests/plugins/Utils/timeformattertest.cpprenamed+13
@@ -48,6 +48,19 @@ private Q_SLOTS:
48
48
49 QCOMPARE(formatter.timeString(), time.toString(format));
49 QCOMPARE(formatter.timeString(), time.toString(format));
50 }
50 }
51+
52+ void testFormatStrF()
53+ {
54+ const QString format = "%d-%m-%Y %I:%M%p";
55+
56+ QDateTime time = QDateTime::currentDateTime();
57+
58+ GDateTimeFormatter formatter;
59+ formatter.setTime(time.toMSecsSinceEpoch() / 1000); // strftime in seconds since epoc
60+ formatter.setFormat(format);
61+
62+ QCOMPARE(formatter.timeString(), time.toString("dd-MM-yyyy hh:mmAP"));
63+ }
51};
64};
52
65
53QTEST_GUILESS_MAIN(TimeFormatterTest)
66QTEST_GUILESS_MAIN(TimeFormatterTest)
tests/qmltests/Components/CMakeLists.txt+1
@@ -3,6 +3,7 @@
3include_directories(
3include_directories(
4 ${CMAKE_SOURCE_DIR}/plugins/Ubuntu/Gestures
4 ${CMAKE_SOURCE_DIR}/plugins/Ubuntu/Gestures
5 ${CMAKE_CURRENT_BINARY_DIR}
5 ${CMAKE_CURRENT_BINARY_DIR}
6+ ${Qt5Gui_PRIVATE_INCLUDE_DIRS}
6 )
7 )
7
8
8set(testCommand
9set(testCommand
tests/qmltests/Components/RevealingRectangle.qml+1−1
@@ -16,7 +16,7 @@
16
16
17import QtQuick 2.0
17import QtQuick 2.0
18import Ubuntu.Components 0.1
18import Ubuntu.Components 0.1
19−import "../../../Components"
19+import "../../../qml/Components"
20
20
21Item {
21Item {
22 id: revealingRectangle
22 id: revealingRectangle
tests/qmltests/Components/tst_AnimationControllerWithSignals.qml+1−1
@@ -16,7 +16,7 @@
16
16
17import QtQuick 2.0
17import QtQuick 2.0
18import QtTest 1.0
18import QtTest 1.0
19−import "../../../Components"
19+import "../../../qml/Components"
20
20
21TestCase {
21TestCase {
22 id: testCase
22 id: testCase
tests/qmltests/Components/tst_Carousel.qml+1−1
@@ -16,7 +16,7 @@
16
16
17import QtQuick 2.0
17import QtQuick 2.0
18import QtTest 1.0
18import QtTest 1.0
19−import "../../../Components/carousel.js" as Carousel
19+import "../../../qml/Components/carousel.js" as Carousel
20
20
21TestCase {
21TestCase {
22 id: root
22 id: root
tests/qmltests/Components/tst_DragHandle.qml+1−1
@@ -15,7 +15,7 @@
15 */
15 */
16
16
17import QtQuick 2.0
17import QtQuick 2.0
18−import "../../../Components"
18+import "../../../qml/Components"
19import "tst_DragHandle"
19import "tst_DragHandle"
20import Ubuntu.Components 0.1
20import Ubuntu.Components 0.1
21import Ubuntu.Gestures 0.1
21import Ubuntu.Gestures 0.1
tests/qmltests/Components/tst_DragHandle/HorizontalShowable.qml+1−1
@@ -15,7 +15,7 @@
15 */
15 */
16
16
17import QtQuick 2.0
17import QtQuick 2.0
18−import "../../../../Components"
18+import "../../../../qml/Components"
19import Ubuntu.Components 0.1
19import Ubuntu.Components 0.1
20import Ubuntu.Gestures 0.1
20import Ubuntu.Gestures 0.1
21
21
tests/qmltests/Components/tst_DragHandle/VerticalShowable.qml+1−1
@@ -15,7 +15,7 @@
15 */
15 */
16
16
17import QtQuick 2.0
17import QtQuick 2.0
18−import "../../../../Components"
18+import "../../../../qml/Components"
19import Ubuntu.Components 0.1
19import Ubuntu.Components 0.1
20import Ubuntu.Gestures 0.1
20import Ubuntu.Gestures 0.1
21
21
tests/qmltests/Components/tst_DraggingArea.qml+1−1
@@ -16,7 +16,7 @@
16
16
17import QtQuick 2.0
17import QtQuick 2.0
18import QtTest 1.0
18import QtTest 1.0
19−import "../../../Components"
19+import "../../../qml/Components"
20
20
21/*
21/*
22 There will be a green rectangle in the center of the
22 There will be a green rectangle in the center of the
tests/qmltests/Components/tst_EdgeDemoOverlay.qml+1−1
@@ -17,7 +17,7 @@
17import QtQuick 2.0
17import QtQuick 2.0
18import QtTest 1.0
18import QtTest 1.0
19import Unity.Test 0.1 as UT
19import Unity.Test 0.1 as UT
20−import "../../../Components"
20+import "../../../qml/Components"
21
21
22Item {
22Item {
23 id: root
23 id: root
tests/qmltests/Components/tst_FilterGrid.qml+1−1
@@ -16,7 +16,7 @@
16
16
17import QtQuick 2.0
17import QtQuick 2.0
18import QtTest 1.0
18import QtTest 1.0
19−import "../../../Components"
19+import "../../../qml/Components"
20import Ubuntu.Components.ListItems 0.1 as ListItem
20import Ubuntu.Components.ListItems 0.1 as ListItem
21import Ubuntu.Components 0.1
21import Ubuntu.Components 0.1
22import Unity.Test 0.1 as UT
22import Unity.Test 0.1 as UT
tests/qmltests/Components/tst_LazyImage.qml+1−1
@@ -16,7 +16,7 @@
16
16
17import QtQuick 2.0
17import QtQuick 2.0
18import QtTest 1.0
18import QtTest 1.0
19−import "../../../Components"
19+import "../../../qml/Components"
20import Ubuntu.Components 0.1
20import Ubuntu.Components 0.1
21import Unity.Test 0.1 as UT
21import Unity.Test 0.1 as UT
22import "tst_LazyImage"
22import "tst_LazyImage"
tests/qmltests/Components/tst_LazyImage/ImageControls.qml+1−1
@@ -16,7 +16,7 @@
16
16
17import QtQuick 2.0
17import QtQuick 2.0
18import Ubuntu.Components 0.1
18import Ubuntu.Components 0.1
19−import "../../../../Components"
19+import "../../../../qml/Components"
20
20
21Row {
21Row {
22 property LazyImage image
22 property LazyImage image
tests/qmltests/Components/tst_OpenEffect.qml+1−1
@@ -16,7 +16,7 @@
16
16
17import QtQuick 2.0
17import QtQuick 2.0
18import QtTest 1.0
18import QtTest 1.0
19−import "../../../Components"
19+import "../../../qml/Components"
20
20
21TestCase {
21TestCase {
22 name: "OpenEffectTest"
22 name: "OpenEffectTest"
tests/qmltests/Components/tst_PageHeader.qml+1−1
@@ -17,7 +17,7 @@
17import QtQuick 2.0
17import QtQuick 2.0
18import QtTest 1.0
18import QtTest 1.0
19import ".."
19import ".."
20−import "../../../Components"
20+import "../../../qml/Components"
21import Ubuntu.Components 0.1
21import Ubuntu.Components 0.1
22import Unity 0.1
22import Unity 0.1
23import Unity.Test 0.1 as UT
23import Unity.Test 0.1 as UT
tests/qmltests/Components/tst_RatingStars.qml+1−1
@@ -16,7 +16,7 @@
16
16
17import QtQuick 2.0
17import QtQuick 2.0
18import QtTest 1.0
18import QtTest 1.0
19−import "../../../Components"
19+import "../../../qml/Components"
20
20
21TestCase {
21TestCase {
22 name: "RatingStars"
22 name: "RatingStars"
tests/qmltests/Components/tst_ResponsiveFlowView.qml+1−1
@@ -17,7 +17,7 @@
17import QtQuick 2.0
17import QtQuick 2.0
18import QtTest 1.0
18import QtTest 1.0
19import ".."
19import ".."
20−import "../../../Components"
20+import "../../../qml/Components"
21import Ubuntu.Components.ListItems 0.1 as ListItem
21import Ubuntu.Components.ListItems 0.1 as ListItem
22import Ubuntu.Components 0.1
22import Ubuntu.Components 0.1
23import Unity.Test 0.1 as UT
23import Unity.Test 0.1 as UT
tests/qmltests/Components/tst_ResponsiveGridView.qml+1−1
@@ -17,7 +17,7 @@
17import QtQuick 2.0
17import QtQuick 2.0
18import QtTest 1.0
18import QtTest 1.0
19import ".."
19import ".."
20−import "../../../Components"
20+import "../../../qml/Components"
21import Ubuntu.Components.ListItems 0.1 as ListItem
21import Ubuntu.Components.ListItems 0.1 as ListItem
22import Ubuntu.Components 0.1
22import Ubuntu.Components 0.1
23import Unity.Test 0.1 as UT
23import Unity.Test 0.1 as UT
tests/qmltests/Components/tst_Showable.qml+1−1
@@ -19,7 +19,7 @@ import QtTest 1.0
19import Ubuntu.Components 0.1
19import Ubuntu.Components 0.1
20import Unity.Test 0.1 as UT
20import Unity.Test 0.1 as UT
21import ".."
21import ".."
22−import "../../../Components"
22+import "../../../qml/Components"
23
23
24/*
24/*
25 There will be 3 stacked rectangles, red, green & blue. Initially they
25 There will be 3 stacked rectangles, red, green & blue. Initially they
tests/qmltests/Components/tst_Stage.qml+1−1
@@ -17,7 +17,7 @@
17import QtQuick 2.0
17import QtQuick 2.0
18import QtTest 1.0
18import QtTest 1.0
19import ".."
19import ".."
20−import "../../../Components"
20+import "../../../qml/Components"
21import Unity.Application 0.1
21import Unity.Application 0.1
22import Ubuntu.Components 0.1
22import Ubuntu.Components 0.1
23import Unity.Test 0.1 as UT
23import Unity.Test 0.1 as UT
tests/qmltests/Components/tst_Tile.qml+1−1
@@ -17,7 +17,7 @@
17import QtQuick 2.0
17import QtQuick 2.0
18import QtTest 1.0
18import QtTest 1.0
19import ".."
19import ".."
20−import "../../../Components"
20+import "../../../qml/Components"
21import Ubuntu.Components 0.1
21import Ubuntu.Components 0.1
22import Unity.Test 0.1 as UT
22import Unity.Test 0.1 as UT
23
23
tests/qmltests/Dash/Apps/tst_AppPreview.qml+1−1
@@ -17,7 +17,7 @@
17import QtQuick 2.0
17import QtQuick 2.0
18import QtTest 1.0
18import QtTest 1.0
19import Ubuntu.Components 0.1
19import Ubuntu.Components 0.1
20−import "../../../../Dash/Apps"
20+import "../../../../qml/Dash/Apps"
21import Unity.Test 0.1 as UT
21import Unity.Test 0.1 as UT
22
22
23Item {
23Item {
tests/qmltests/Dash/Apps/tst_RunningApplicationsGrid.qml+1−1
@@ -16,7 +16,7 @@
16
16
17import QtQuick 2.0
17import QtQuick 2.0
18import QtTest 1.0
18import QtTest 1.0
19−import "../../../../Dash/Apps"
19+import "../../../../qml/Dash/Apps"
20import Unity.Test 0.1 as UT
20import Unity.Test 0.1 as UT
21
21
22Item {
22Item {
tests/qmltests/Dash/Movie/tst_MoviePreview.qml+1−1
@@ -16,7 +16,7 @@
16
16
17import QtQuick 2.0
17import QtQuick 2.0
18import QtTest 1.0
18import QtTest 1.0
19−import "../../../../Dash/Movie"
19+import "../../../../qml/Dash/Movie"
20import Unity.Test 0.1 as UT
20import Unity.Test 0.1 as UT
21
21
22Item {
22Item {
tests/qmltests/Dash/Music/tst_MusicPreview.qml+1−1
@@ -16,7 +16,7 @@
16
16
17import QtQuick 2.0
17import QtQuick 2.0
18import QtTest 1.0
18import QtTest 1.0
19−import "../../../../Dash/Music"
19+import "../../../../qml/Dash/Music"
20import Unity.Test 0.1 as UT
20import Unity.Test 0.1 as UT
21import QtMultimedia 5.0
21import QtMultimedia 5.0
22
22
tests/qmltests/Dash/qml/FakeScopeView.qml+1−1
@@ -17,7 +17,7 @@
17import QtQuick 2.0
17import QtQuick 2.0
18import Unity 0.1
18import Unity 0.1
19
19
20−import "../../../../Dash"
20+import "../../../../qml/Dash"
21
21
22GenericScopeView {
22GenericScopeView {
23 id: fakeScopeView
23 id: fakeScopeView
tests/qmltests/Dash/tst_Dash.qml+6−6
@@ -16,7 +16,7 @@
16
16
17import QtQuick 2.0
17import QtQuick 2.0
18import QtTest 1.0
18import QtTest 1.0
19−import "../../../Dash"
19+import "../../../qml/Dash"
20import Ubuntu.Components 0.1
20import Ubuntu.Components 0.1
21import Unity.Test 0.1 as UT
21import Unity.Test 0.1 as UT
22
22
@@ -36,12 +36,12 @@ Item {
36 ScopeDelegateMapper {
36 ScopeDelegateMapper {
37 id: scopeDelegateMapper
37 id: scopeDelegateMapper
38 scopeDelegateMapping: {
38 scopeDelegateMapping: {
39− "MockScope1": "../tests/qmltests/Dash/qml/fake_scopeView1.qml",
39+ "MockScope1": Qt.resolvedUrl("qml/fake_scopeView1.qml"),
40− "MockScope2": "../tests/qmltests/Dash/qml/fake_scopeView2.qml",
40+ "MockScope2": Qt.resolvedUrl("qml/fake_scopeView2.qml"),
41− "home.scope": "../tests/qmltests/Dash/qml/fake_scopeView3.qml",
41+ "home.scope": Qt.resolvedUrl("qml/fake_scopeView3.qml"),
42− "applications.scope": "../tests/qmltests/Dash/qml/fake_scopeView4.qml"
42+ "applications.scope": Qt.resolvedUrl("qml/fake_scopeView4.qml")
43 }
43 }
44− genericScope: "../tests/qmltests/Dash/qml/fake_generic_scopeView.qml"
44+ genericScope: Qt.resolvedUrl("qml/fake_generic_scopeView.qml")
45 }
45 }
46
46
47 UT.UnityTestCase {
47 UT.UnityTestCase {
tests/qmltests/Dash/tst_DashBar.qml+1−1
@@ -18,7 +18,7 @@ import QtQuick 2.0
18import QtTest 1.0
18import QtTest 1.0
19import Unity 0.1
19import Unity 0.1
20import ".."
20import ".."
21−import "../../../Dash"
21+import "../../../qml/Dash"
22import Ubuntu.Components 0.1
22import Ubuntu.Components 0.1
23import Unity.Test 0.1 as UT
23import Unity.Test 0.1 as UT
24
24
tests/qmltests/Dash/tst_DashContent.qml+6−6
@@ -16,7 +16,7 @@
16
16
17import QtQuick 2.0
17import QtQuick 2.0
18import QtTest 1.0
18import QtTest 1.0
19−import "../../../Dash"
19+import "../../../qml/Dash"
20import Ubuntu.Components 0.1
20import Ubuntu.Components 0.1
21import Unity 0.1
21import Unity 0.1
22import Unity.Test 0.1 as UT
22import Unity.Test 0.1 as UT
@@ -64,12 +64,12 @@ Item {
64 ScopeDelegateMapper {
64 ScopeDelegateMapper {
65 id: scopeDelegateMapper
65 id: scopeDelegateMapper
66 scopeDelegateMapping: {
66 scopeDelegateMapping: {
67− "MockScope1": "../tests/qmltests/Dash/qml/fake_scopeView1.qml",
67+ "MockScope1": Qt.resolvedUrl("qml/fake_scopeView1.qml"),
68− "MockScope2": "../tests/qmltests/Dash/qml/fake_scopeView2.qml",
68+ "MockScope2": Qt.resolvedUrl("qml/fake_scopeView2.qml"),
69− "home.scope": "../tests/qmltests/Dash/qml/fake_scopeView3.qml",
69+ "home.scope": Qt.resolvedUrl("qml/fake_scopeView3.qml"),
70− "applications.scope": "../tests/qmltests/Dash/qml/fake_scopeView4.qml"
70+ "applications.scope": Qt.resolvedUrl("qml/fake_scopeView4.qml")
71 }
71 }
72− genericScope: "../tests/qmltests/Dash/qml/fake_generic_scopeView.qml"
72+ genericScope: Qt.resolvedUrl("qml/fake_generic_scopeView.qml")
73 }
73 }
74
74
75 function clear_scope_status() {
75 function clear_scope_status() {
tests/qmltests/Dash/tst_DashPreview.qml+1−1
@@ -17,7 +17,7 @@
17import QtQuick 2.0
17import QtQuick 2.0
18import QtTest 1.0
18import QtTest 1.0
19import ".."
19import ".."
20−import "../../../Dash"
20+import "../../../qml/Dash"
21import Ubuntu.Components 0.1
21import Ubuntu.Components 0.1
22import Unity.Test 0.1 as UT
22import Unity.Test 0.1 as UT
23
23
tests/qmltests/Dash/tst_FilterGrids.qml+3−3
@@ -16,7 +16,7 @@
16
16
17import QtQuick 2.0
17import QtQuick 2.0
18import QtTest 1.0
18import QtTest 1.0
19−import "../../../Dash/Video"
19+import "../../../qml/Dash/Video"
20import Ubuntu.Components.ListItems 0.1 as ListItem
20import Ubuntu.Components.ListItems 0.1 as ListItem
21import Ubuntu.Components 0.1
21import Ubuntu.Components 0.1
22import Unity.Test 0.1 as UT
22import Unity.Test 0.1 as UT
@@ -46,7 +46,7 @@ Rectangle {
46 Button {
46 Button {
47 anchors {left: parent.left; right: parent.right; margins: units.gu(1) }
47 anchors {left: parent.left; right: parent.right; margins: units.gu(1) }
48 text: testCase.test_clicked_signal_data()[index].tag
48 text: testCase.test_clicked_signal_data()[index].tag
49− onClicked: gridLoader.source = "../../../Dash/" + testCase.test_clicked_signal_data()[index].component
49+ onClicked: gridLoader.source = "../../../qml/Dash/" + testCase.test_clicked_signal_data()[index].component
50 }
50 }
51 }
51 }
52 }
52 }
@@ -114,7 +114,7 @@ Rectangle {
114
114
115 function test_clicked_signal(data) {
115 function test_clicked_signal(data) {
116 gridLoader.source = "";
116 gridLoader.source = "";
117− gridLoader.source = "../../../Dash/" + data.component;
117+ gridLoader.source = "../../../qml/Dash/" + data.component;
118
118
119 // Wait until the FilterGrid is loaded by the loader
119 // Wait until the FilterGrid is loaded by the loader
120 tryCompare(gridLoader, "status", Loader.Ready);
120 tryCompare(gridLoader, "status", Loader.Ready);
tests/qmltests/Dash/tst_GenericPreview.qml+1−1
@@ -16,7 +16,7 @@
16
16
17import QtQuick 2.0
17import QtQuick 2.0
18import QtTest 1.0
18import QtTest 1.0
19−import "../../../Dash/Generic"
19+import "../../../qml/Dash/Generic"
20import Unity.Test 0.1 as UT
20import Unity.Test 0.1 as UT
21
21
22Item {
22Item {
tests/qmltests/Dash/tst_GenericScopeView.qml+35−5
@@ -18,8 +18,8 @@ import QtQuick 2.0
18import QtTest 1.0
18import QtTest 1.0
19import Unity 0.1
19import Unity 0.1
20import ".."
20import ".."
21−import "../../../Dash"
21+import "../../../qml/Dash"
22−import "../../../Components"
22+import "../../../qml/Components"
23import Ubuntu.Components 0.1
23import Ubuntu.Components 0.1
24import Unity.Test 0.1 as UT
24import Unity.Test 0.1 as UT
25
25
@@ -79,14 +79,14 @@ Item {
79 var categoryListView = findChild(genericScopeView, "categoryListView");
79 var categoryListView = findChild(genericScopeView, "categoryListView");
80 categoryListView.positionAtBeginning();
80 categoryListView.positionAtBeginning();
81
81
82− var tile = findChild(genericScopeView, "delegate0");
82+ var tile = findChild(findChild(genericScopeView, "0"), "delegate0");
83 mouseClick(tile, tile.width / 2, tile.height / 2);
83 mouseClick(tile, tile.width / 2, tile.height / 2);
84 var openEffect = findChild(genericScopeView, "openEffect");
84 var openEffect = findChild(genericScopeView, "openEffect");
85 tryCompare(openEffect, "gap", 1);
85 tryCompare(openEffect, "gap", 1);
86 }
86 }
87
87
88 function checkArrowPosition(index) {
88 function checkArrowPosition(index) {
89− var tile = findChild(genericScopeView, "delegate" + index);
89+ var tile = findChild(findChild(genericScopeView, "0"), "delegate" + index);
90 var tileCenter = tile.x + tile.width/2;
90 var tileCenter = tile.x + tile.width/2;
91 var pointerArrow = findChild(genericScopeView, "pointerArrow");
91 var pointerArrow = findChild(genericScopeView, "pointerArrow");
92 var pointerArrowCenter = pointerArrow.x + pointerArrow.width/2;
92 var pointerArrowCenter = pointerArrow.x + pointerArrow.width/2;
@@ -141,7 +141,7 @@ Item {
141 categoryListView.flick(0, -units.gu(80));
141 categoryListView.flick(0, -units.gu(80));
142 tryCompare(categoryListView.flicking, false);
142 tryCompare(categoryListView.flicking, false);
143
143
144− var tile = findChild(genericScopeView, "delegate0");
144+ var tile = findChild(findChild(genericScopeView, "0"), "delegate0");
145 mouseClick(tile, tile.width / 2, tile.height - 1);
145 mouseClick(tile, tile.width / 2, tile.height - 1);
146 var openEffect = findChild(genericScopeView, "openEffect");
146 var openEffect = findChild(genericScopeView, "openEffect");
147 tryCompare(openEffect, "gap", 1);
147 tryCompare(openEffect, "gap", 1);
@@ -276,6 +276,36 @@ Item {
276 closePreview();
276 closePreview();
277 tryCompare(previewListView, "open", false);
277 tryCompare(previewListView, "open", false);
278 }
278 }
279+
280+ function test_filter_expand_expand() {
281+ // wait for the item to be there
282+ tryCompareFunction(function() { return findChild(genericScopeView, "dashSectionHeader2") != undefined; }, true);
283+
284+ var categoryListView = findChild(genericScopeView, "categoryListView");
285+ categoryListView.contentY = categoryListView.height;
286+
287+ var header2 = findChild(genericScopeView, "dashSectionHeader2")
288+ var category2 = findChild(genericScopeView, "dashCategory2")
289+ var category2FilterGrid = category2.children[0].children[0].children[0];
290+ verify(UT.Util.isInstanceOf(category2FilterGrid, "FilterGrid"));
291+
292+ waitForRendering(header2);
293+ verify(category2.expandable);
294+ verify(category2.filtered);
295+
296+ mouseClick(header2, header2.width / 2, header2.height / 2);
297+ tryCompare(category2, "filtered", false);
298+ tryCompare(category2FilterGrid, "filter", false);
299+
300+ categoryListView.positionAtBeginning();
301+
302+ var header0 = findChild(genericScopeView, "dashSectionHeader0")
303+ var category0 = findChild(genericScopeView, "dashCategory0")
304+ mouseClick(header0, header0.width / 2, header0.height / 2);
305+ tryCompare(category0, "filtered", false);
306+ tryCompare(category2, "filtered", true);
307+ tryCompare(category2FilterGrid, "filter", true);
308+ }
279 }
309 }
280 }
310 }
281}
311}
tests/qmltests/Greeter/tst_Clock.qml+1−1
@@ -17,7 +17,7 @@
17import QtQuick 2.0
17import QtQuick 2.0
18import QtTest 1.0
18import QtTest 1.0
19import ".."
19import ".."
20−import "../../../Greeter"
20+import "../../../qml/Greeter"
21import Ubuntu.Components 0.1
21import Ubuntu.Components 0.1
22import QMenuModel 0.1
22import QMenuModel 0.1
23import Unity.Test 0.1 as UT
23import Unity.Test 0.1 as UT
tests/qmltests/Greeter/tst_Infographics.qml+1−1
@@ -17,7 +17,7 @@
17import QtQuick 2.0
17import QtQuick 2.0
18import QtTest 1.0
18import QtTest 1.0
19import ".."
19import ".."
20−import "../../../Greeter"
20+import "../../../qml/Greeter"
21import Ubuntu.Components 0.1
21import Ubuntu.Components 0.1
22import Unity.Test 0.1 as UT
22import Unity.Test 0.1 as UT
23import LightDM 0.1 as LightDM
23import LightDM 0.1 as LightDM
tests/qmltests/Greeter/tst_Lockscreen.qml+1−1
@@ -17,7 +17,7 @@
17import QtQuick 2.0
17import QtQuick 2.0
18import QtTest 1.0
18import QtTest 1.0
19import ".."
19import ".."
20−import "../../../Greeter"
20+import "../../../qml/Greeter"
21import Ubuntu.Components 0.1
21import Ubuntu.Components 0.1
22import LightDM 0.1 as LightDM
22import LightDM 0.1 as LightDM
23import Unity.Test 0.1 as UT
23import Unity.Test 0.1 as UT
tests/qmltests/Greeter/tst_Phone.qml+3−1
@@ -17,7 +17,7 @@
17import QtQuick 2.0
17import QtQuick 2.0
18import QtTest 1.0
18import QtTest 1.0
19import ".."
19import ".."
20−import "../../../Greeter"
20+import "../../../qml/Greeter"
21import AccountsService 0.1
21import AccountsService 0.1
22import LightDM 0.1 as LightDM
22import LightDM 0.1 as LightDM
23import Ubuntu.Components 0.1
23import Ubuntu.Components 0.1
@@ -33,6 +33,8 @@ Item {
33 height: parent.height
33 height: parent.height
34 x: 0; y: 0
34 x: 0; y: 0
35
35
36+ background: Qt.resolvedUrl("../../../qml/graphics/phone_background.jpg")
37+
36 property int minX: 0
38 property int minX: 0
37
39
38 onXChanged: {
40 onXChanged: {
tests/qmltests/Greeter/tst_Tablet.qml+1−1
@@ -17,7 +17,7 @@
17import QtQuick 2.0
17import QtQuick 2.0
18import QtTest 1.0
18import QtTest 1.0
19import ".."
19import ".."
20−import "../../../Greeter"
20+import "../../../qml/Greeter"
21import Ubuntu.Components 0.1
21import Ubuntu.Components 0.1
22import LightDM 0.1 as LightDM
22import LightDM 0.1 as LightDM
23import Unity.Test 0.1 as UT
23import Unity.Test 0.1 as UT
tests/qmltests/Hud/tst_Hud.qml+1−1
@@ -17,7 +17,7 @@
17import QtQuick 2.0
17import QtQuick 2.0
18import QtTest 1.0
18import QtTest 1.0
19import ".."
19import ".."
20−import "../../../Hud"
20+import "../../../qml/Hud"
21import HudClient 0.1
21import HudClient 0.1
22import Unity.Test 0.1 as UT
22import Unity.Test 0.1 as UT
23
23
tests/qmltests/Hud/tst_Result.qml+1−1
@@ -17,7 +17,7 @@
17import QtQuick 2.0
17import QtQuick 2.0
18import QtTest 1.0
18import QtTest 1.0
19import ".."
19import ".."
20−import "../../../Hud"
20+import "../../../qml/Hud"
21import Unity.Test 0.1 as UT
21import Unity.Test 0.1 as UT
22
22
23Rectangle {
23Rectangle {
tests/qmltests/Launcher/tst_Launcher.qml+1−1
@@ -18,7 +18,7 @@ import QtQuick 2.0
18import QtTest 1.0
18import QtTest 1.0
19import Unity.Test 0.1 as UT
19import Unity.Test 0.1 as UT
20import ".."
20import ".."
21−import "../../../Launcher"
21+import "../../../qml/Launcher"
22import Unity.Launcher 0.1
22import Unity.Launcher 0.1
23
23
24/* Nothing is shown at first. If you drag from left edge you will bring up the
24/* Nothing is shown at first. If you drag from left edge you will bring up the
tests/qmltests/Notifications/tst_Notifications.qml+4−5
@@ -17,7 +17,7 @@
17import QtQuick 2.0
17import QtQuick 2.0
18import QtTest 1.0
18import QtTest 1.0
19import ".."
19import ".."
20−import "../../../Notifications"
20+import "../../../qml/Notifications"
21import Ubuntu.Components 0.1
21import Ubuntu.Components 0.1
22import Unity.Test 0.1
22import Unity.Test 0.1
23import Unity.Notifications 1.0
23import Unity.Notifications 1.0
@@ -140,8 +140,10 @@ Row {
140 Notifications {
140 Notifications {
141 id: notifications
141 id: notifications
142
142
143+ margin: units.gu(1)
144+ fullHeight: parent.height
145+
143 anchors.fill: parent
146 anchors.fill: parent
144− anchors.margins: units.gu(1)
145 model: mockModel
147 model: mockModel
146 }
148 }
147 }
149 }
@@ -401,9 +403,6 @@ Row {
401 actionSpy.wait()
403 actionSpy.wait()
402 compare(actionSpy.signalArguments[0][0], data.actions[0]["id"], "got wrong id for interactive action")
404 compare(actionSpy.signalArguments[0][0], data.actions[0]["id"], "got wrong id for interactive action")
403 compare(clickThroughSpy.count, 0, "click on interactive notification fell through")
405 compare(clickThroughSpy.count, 0, "click on interactive notification fell through")
404− } else {
405− mouseClick(notification, notification.width / 2, notification.height / 2)
406− clickThroughSpy.wait()
407 }
406 }
408
407
409 compare(secondaryIcon.visible, data.secondaryIconVisible, "secondary-icon visibility is incorrect")
408 compare(secondaryIcon.visible, data.secondaryIconVisible, "secondary-icon visibility is incorrect")
tests/qmltests/Panel/Indicators/tst_DefaultIndicatorWidget.qml+1−1
@@ -18,7 +18,7 @@ import QtQuick 2.0
18import QtTest 1.0
18import QtTest 1.0
19import Unity.Test 0.1 as UT
19import Unity.Test 0.1 as UT
20import QMenuModel 0.1
20import QMenuModel 0.1
21−import "../../../../Panel/Indicators"
21+import "../../../../qml/Panel/Indicators"
22
22
23Item {
23Item {
24 id: testView
24 id: testView
tests/qmltests/Panel/tst_IndicatorItem.qml+1−1
@@ -17,7 +17,7 @@
17import QtQuick 2.0
17import QtQuick 2.0
18import QtTest 1.0
18import QtTest 1.0
19import ".."
19import ".."
20−import "../../../Panel"
20+import "../../../qml/Panel"
21import Ubuntu.Components 0.1
21import Ubuntu.Components 0.1
22import Unity.Test 0.1 as UT
22import Unity.Test 0.1 as UT
23
23
tests/qmltests/Panel/tst_IndicatorRow.qml+1−1
@@ -18,7 +18,7 @@ import QtQuick 2.0
18import QtTest 1.0
18import QtTest 1.0
19import Unity.Test 0.1 as UT
19import Unity.Test 0.1 as UT
20import ".."
20import ".."
21−import "../../../Panel"
21+import "../../../qml/Panel"
22import Unity.Indicators 0.1 as Indicators
22import Unity.Indicators 0.1 as Indicators
23
23
24/*
24/*
tests/qmltests/Panel/tst_Indicators.qml+2−2
@@ -18,8 +18,8 @@ import QtQuick 2.0
18import QtTest 1.0
18import QtTest 1.0
19import Unity.Test 0.1 as UT
19import Unity.Test 0.1 as UT
20import ".."
20import ".."
21−import "../../../Panel"
21+import "../../../qml/Panel"
22−import "../../../Components"
22+import "../../../qml/Components"
23
23
24/*
24/*
25 This tests the Indicators component by using a fake model to stage data in the indicators
25 This tests the Indicators component by using a fake model to stage data in the indicators
tests/qmltests/Panel/tst_MenuContent.qml+1−1
@@ -18,7 +18,7 @@ import QtQuick 2.0
18import QtTest 1.0
18import QtTest 1.0
19import Unity.Test 0.1 as UT
19import Unity.Test 0.1 as UT
20import ".."
20import ".."
21−import "../../../Panel"
21+import "../../../qml/Panel"
22import Unity.Indicators 0.1 as Indicators
22import Unity.Indicators 0.1 as Indicators
23
23
24Item {
24Item {
tests/qmltests/Panel/tst_Panel.qml+15−1
@@ -18,7 +18,7 @@ import QtQuick 2.0
18import QtTest 1.0
18import QtTest 1.0
19import Unity.Test 0.1 as UT
19import Unity.Test 0.1 as UT
20import ".."
20import ".."
21−import "../../../Panel"
21+import "../../../qml/Panel"
22
22
23/*
23/*
24 This tests the Panel component using a fake model to stage data in the indicators
24 This tests the Panel component using a fake model to stage data in the indicators
@@ -264,5 +264,19 @@ Item {
264
264
265 compare(indicatorRow.currentItem, indicatorItemFirst, "First indicator should still be the current item");
265 compare(indicatorRow.currentItem, indicatorItemFirst, "First indicator should still be the current item");
266 }
266 }
267+
268+ function test_hideIndicatorMenu_data() {
269+ return [ {tag: "no-delay", delay: undefined },
270+ {tag: "delayed", delay: 200 }
271+ ];
272+ }
273+
274+ function test_hideIndicatorMenu(data) {
275+ panel.indicators.show();
276+ compare(panel.indicators.shown, true);
277+
278+ panel.hideIndicatorMenu(data.delay);
279+ tryCompare(panel.indicators, "shown", false);
280+ }
267 }
281 }
268}
282}
tests/qmltests/Panel/tst_SearchIndicator.qml+1−1
@@ -17,7 +17,7 @@
17import QtQuick 2.0
17import QtQuick 2.0
18import QtTest 1.0
18import QtTest 1.0
19import ".."
19import ".."
20−import "../../../Panel"
20+import "../../../qml/Panel"
21import Ubuntu.Components 0.1
21import Ubuntu.Components 0.1
22import Unity.Test 0.1 as UT
22import Unity.Test 0.1 as UT
23
23
tests/qmltests/SideStage/tst_SideStage.qml+1−1
@@ -18,7 +18,7 @@ import QtQuick 2.0
18import QtTest 1.0
18import QtTest 1.0
19import Unity.Test 0.1 as UT
19import Unity.Test 0.1 as UT
20import ".."
20import ".."
21−import "../../../SideStage"
21+import "../../../qml/SideStage"
22import Ubuntu.Components 0.1
22import Ubuntu.Components 0.1
23
23
24UT.UnityTestCase {
24UT.UnityTestCase {
tests/qmltests/tst_GreeterShell.qml+7−6
@@ -25,7 +25,7 @@ import Unity.Application 0.1
25import Unity.Test 0.1 as UT
25import Unity.Test 0.1 as UT
26import Powerd 0.1
26import Powerd 0.1
27
27
28−import "../.."
28+import "../../qml"
29
29
30Item {
30Item {
31 width: shell.width
31 width: shell.width
@@ -49,6 +49,7 @@ Item {
49
49
50 GreeterShell {
50 GreeterShell {
51 id: shell
51 id: shell
52+ defaultBackground: Qt.resolvedUrl("../../qml/graphics/phone_background.jpg")
52 }
53 }
53
54
54 UT.UnityTestCase {
55 UT.UnityTestCase {
@@ -57,13 +58,13 @@ Item {
57
58
58 function test_wallpaper_data() {
59 function test_wallpaper_data() {
59 return [
60 return [
60− {tag: "both", accounts: "tests/data/unity/backgrounds/blue.png", gsettings: "tests/data/unity/backgrounds/red.png", expected: "blue.png"},
61+ {tag: "both", accounts: "../tests/data/unity/backgrounds/blue.png", gsettings: "../tests/data/unity/backgrounds/red.png", expected: "blue.png"},
61− {tag: "accounts", accounts: "tests/data/unity/backgrounds/blue.png", gsettings: "", expected: "blue.png"},
62+ {tag: "accounts", accounts: "../tests/data/unity/backgrounds/blue.png", gsettings: "", expected: "blue.png"},
62− {tag: "gsettings", accounts: "", gsettings: "tests/data/unity/backgrounds/red.png", expected: "red.png"},
63+ {tag: "gsettings", accounts: "", gsettings: "../tests/data/unity/backgrounds/red.png", expected: "red.png"},
63 {tag: "none", accounts: "", gsettings: "", expected: shell.defaultBackground},
64 {tag: "none", accounts: "", gsettings: "", expected: shell.defaultBackground},
64 {tag: "invalid-both", accounts: "invalid", gsettings: "invalid", expected: shell.defaultBackground},
65 {tag: "invalid-both", accounts: "invalid", gsettings: "invalid", expected: shell.defaultBackground},
65− {tag: "invalid-accounts", accounts: "invalid", gsettings: "tests/data/unity/backgrounds/red.png", expected: shell.defaultBackground},
66+ {tag: "invalid-accounts", accounts: "invalid", gsettings: "../tests/data/unity/backgrounds/red.png", expected: shell.defaultBackground},
66− {tag: "invalid-gsettings", accounts: "tests/data/unity/backgrounds/blue.png", gsettings: "invalid", expected: "blue.png"},
67+ {tag: "invalid-gsettings", accounts: "../tests/data/unity/backgrounds/blue.png", gsettings: "invalid", expected: "blue.png"},
67 ]
68 ]
68 }
69 }
69
70
tests/qmltests/tst_Shell.qml+4−3
@@ -25,7 +25,7 @@ import Unity.Test 0.1 as UT
25import Powerd 0.1
25import Powerd 0.1
26import SessionManager 0.1
26import SessionManager 0.1
27
27
28−import "../.."
28+import "../../qml"
29
29
30Item {
30Item {
31 width: shell.width
31 width: shell.width
@@ -49,6 +49,7 @@ Item {
49
49
50 Shell {
50 Shell {
51 id: shell
51 id: shell
52+ defaultBackground: Qt.resolvedUrl("../../qml/graphics/phone_background.jpg")
52 }
53 }
53
54
54 UT.UnityTestCase {
55 UT.UnityTestCase {
@@ -443,8 +444,8 @@ Item {
443
444
444 function test_background_data() {
445 function test_background_data() {
445 return [
446 return [
446− {tag: "red", url: "tests/data/unity/backgrounds/red.png", expectedUrl: "tests/data/unity/backgrounds/red.png"},
447+ {tag: "red", url: Qt.resolvedUrl("../data/unity/backgrounds/red.png"), expectedUrl: "tests/data/unity/backgrounds/red.png"},
447− {tag: "blue", url: "tests/data/unity/backgrounds/blue.png", expectedUrl: "tests/data/unity/backgrounds/blue.png"},
448+ {tag: "blue", url: Qt.resolvedUrl("../data/unity/backgrounds/blue.png"), expectedUrl: "tests/data/unity/backgrounds/blue.png"},
448 {tag: "invalid", url: "invalid", expectedUrl: shell.defaultBackground},
449 {tag: "invalid", url: "invalid", expectedUrl: shell.defaultBackground},
449 {tag: "empty", url: "", expectedUrl: shell.defaultBackground}
450 {tag: "empty", url: "", expectedUrl: shell.defaultBackground}
450 ]
451 ]
tests/uqmlscene/CMakeLists.txt+6−1
@@ -1,12 +1,17 @@
1add_executable(uqmlscene
1add_executable(uqmlscene
2 ${shellapplication_MOC_SRCS}
2 ${shellapplication_MOC_SRCS}
3 main.cpp
3 main.cpp
4− ../../MouseTouchAdaptor.cpp
4+ ${CMAKE_SOURCE_DIR}/src/MouseTouchAdaptor.cpp
5 )
5 )
6
6
7qt5_use_modules(uqmlscene Qml Quick Test)
7qt5_use_modules(uqmlscene Qml Quick Test)
8pkg_check_modules(XCB REQUIRED xcb)
8pkg_check_modules(XCB REQUIRED xcb)
9
9
10+include_directories(
11+ ${CMAKE_SOURCE_DIR}/src
12+ ${Qt5Gui_PRIVATE_INCLUDE_DIRS}
13+)
14+
10if (NOT "${XCB_INCLUDE_DIRS}" STREQUAL "")
15if (NOT "${XCB_INCLUDE_DIRS}" STREQUAL "")
11 set_target_properties(uqmlscene PROPERTIES INCLUDE_DIRECTORIES ${XCB_INCLUDE_DIRS})
16 set_target_properties(uqmlscene PROPERTIES INCLUDE_DIRECTORIES ${XCB_INCLUDE_DIRS})
12endif()
17endif()
tests/uqmlscene/main.cpp+1−1
@@ -63,7 +63,7 @@
63#include <QtCore/QTranslator>
63#include <QtCore/QTranslator>
64#include <QtCore/QLibraryInfo>
64#include <QtCore/QLibraryInfo>
65
65
66−#include "../../MouseTouchAdaptor.h"
66+#include <MouseTouchAdaptor.h>
67
67
68#ifdef QML_RUNTIME_TESTING
68#ifdef QML_RUNTIME_TESTING
69class RenderStatistics
69class RenderStatistics
tests/utils/modules/Unity/Test/CMakeLists.txt+4
@@ -1,5 +1,9 @@
1add_definitions(-DQT_NO_KEYWORDS)
1add_definitions(-DQT_NO_KEYWORDS)
2
2
3+include_directories(
4+ ${Qt5Gui_PRIVATE_INCLUDE_DIRS}
5+)
6+
3set(UnityTestQML_SOURCES
7set(UnityTestQML_SOURCES
4 testutil.cpp
8 testutil.cpp
5 plugin.cpp
9 plugin.cpp