on xenial help sign in
Started simplification of indicators client
fa85355Nick Dedekind
Panel/MenuContent.qml+1−4
@@ -94,7 +94,7 @@ Rectangle {
94
94
95 width: menus.width
95 width: menus.width
96 height: menus.height
96 height: menus.height
97− sourceComponent: component
97+ source: component
98 visible: content.__shown
98 visible: content.__shown
99 onVisibleChanged: {
99 onVisibleChanged: {
100 // Reset the indicator states
100 // Reset the indicator states
@@ -106,9 +106,6 @@ Rectangle {
106
106
107 onStatusChanged: {
107 onStatusChanged: {
108 if (status == Loader.Ready) {
108 if (status == Loader.Ready) {
109− if (indicatorsModel.widgetsMap && item.hasOwnProperty("widgetsMap")) {
110− item["widgetsMap"] = indicatorsModel.widgetsMap
111− }
112 for(var pName in initialProperties) {
109 for(var pName in initialProperties) {
113 if (item.hasOwnProperty(pName)) {
110 if (item.hasOwnProperty(pName)) {
114 item[pName] = initialProperties[pName]
111 item[pName] = initialProperties[pName]
plugins/IndicatorsClient/CMakeLists.txt+6−41
@@ -17,6 +17,7 @@ endif()
17
17
18add_subdirectory(indicators)
18add_subdirectory(indicators)
19add_subdirectory(client)
19add_subdirectory(client)
20+add_subdirectory(qml)
20
21
21if(NETWORK_PLUGIN_ENABLED)
22if(NETWORK_PLUGIN_ENABLED)
22 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DNETWORK_PLUGIN_ENABLED" )
23 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DNETWORK_PLUGIN_ENABLED" )
@@ -38,32 +39,18 @@ set(IndicatorsClientQML_SOURCES
38 indicatorsmanager.cpp
39 indicatorsmanager.cpp
39 indicatorsmodel.cpp
40 indicatorsmodel.cpp
40 plugin.cpp
41 plugin.cpp
41− widgetsmap.cpp
42)
42)
43
43
44−set(IndicatorsClientQML_QML
44+set(IndicatorsClientQML_RESOURCES
45− qml/BasicMenu.qml
45+ resources/indicatorclient.qrc
46− qml/ButtonMenu.qml
47− qml/DBusActionState.qml
48− qml/DivMenu.qml
49− qml/FactoryMenu.qml
50− qml/HLine.qml
51− qml/Menu.qml
52− qml/PluginItem.qml
53− qml/RemoveBackground.qml
54− qml/SectionMenu.qml
55− qml/SliderMenu.qml
56− qml/SwitchMenu.qml
57− qml/TextMenu.qml
58− qml/ProgressMenu.qml
59)
46)
60
47
61−set(IndicatorsClientQM_RESOURCES
48+qt5_add_resources(IndicatorsClientQML_RESOURCES_RCC
62− indicatorsclient.qrc
49+ ${IndicatorsClientQML_RESOURCES}
63)
50)
64
51
65add_library(IndicatorsClientQml SHARED
52add_library(IndicatorsClientQml SHARED
66− ${IndicatorsClientQML_RCC}
53+ ${IndicatorsClientQML_RESOURCES_RCC}
67 ${IndicatorsClientQML_SOURCES}
54 ${IndicatorsClientQML_SOURCES}
68)
55)
69# Because this is an internal support library, we want
56# Because this is an internal support library, we want
@@ -85,25 +72,3 @@ target_link_libraries(IndicatorsClientQml
85)
72)
86
73
87qt5_use_modules(IndicatorsClientQml Qml)
74qt5_use_modules(IndicatorsClientQml Qml)
88−
89−# copy qmldir file into build directory for shadow builds
90−file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/qmldir"
91− DESTINATION ${CMAKE_CURRENT_BINARY_DIR}
92−)
93−
94−# copy qmldir file into build directory for shadow builds
95−file(COPY ${IndicatorsClientQML_QML}
96− DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/qml
97− )
98−
99−install(TARGETS IndicatorsClientQml
100− DESTINATION ${SHELL_APP_DIR}/plugins/IndicatorsClient
101−)
102−
103−install(FILES qmldir
104− DESTINATION ${SHELL_APP_DIR}/plugins/IndicatorsClient
105−)
106−
107−install(FILES ${IndicatorsClientQML_QML}
108− DESTINATION ${SHELL_APP_DIR}/plugins/IndicatorsClient/qml
109−)
plugins/IndicatorsClient/client/indicatorsclient.h−1
@@ -25,7 +25,6 @@
25#include <QQuickView>
25#include <QQuickView>
26
26
27class PluginManager;
27class PluginManager;
28−class WidgetsMap;
29
28
30class IndicatorsClient : public QObject
29class IndicatorsClient : public QObject
31{
30{
plugins/IndicatorsClient/client/qml/IndicatorsList.qml−1
@@ -67,7 +67,6 @@ Page {
67 onClicked: {
67 onClicked: {
68 if (progression) {
68 if (progression) {
69 var props = model.initialProperties
69 var props = model.initialProperties
70− props["widgetsMap"] = indicators.widgetsMap
71
70
72 var page = Qt.createComponent("IndicatorsPage.qml")
71 var page = Qt.createComponent("IndicatorsPage.qml")
73 pages.push(page.createObject(pages), {"initialProperties" : props, "component" : model.component})
72 pages.push(page.createObject(pages), {"initialProperties" : props, "component" : model.component})
plugins/IndicatorsClient/indicatorclientinterface.h+1−16
@@ -34,7 +34,6 @@ class IndicatorClientInterface
34{
34{
35public:
35public:
36 typedef QMap<QString, QVariant> PropertiesMap;
36 typedef QMap<QString, QVariant> PropertiesMap;
37− typedef QMap<QString, QUrl> WidgetsMap;
38
37
39 typedef std::shared_ptr<IndicatorClientInterface> Ptr;
38 typedef std::shared_ptr<IndicatorClientInterface> Ptr;
40
39
@@ -104,13 +103,6 @@ public:
104 */
103 */
105 virtual bool visible() const = 0;
104 virtual bool visible() const = 0;
106
105
107− /**
108− * @brief Used to retrieve the current plugin accessible name
109− * @return The accessible name is plugin name as seen by assistive technologies
110− */
111− virtual QString accessibleName() const = 0;
112−
113−
114 /**
106 /**
115 * @brief Used to retrieve the current plugin priority
107 * @brief Used to retrieve the current plugin priority
116 * @return The priorty value for the plugin, this will be used to arrange the plugin on the indicator panel
108 * @return The priorty value for the plugin, this will be used to arrange the plugin on the indicator panel
@@ -124,7 +116,7 @@ public:
124 * @param parent The parent of the returned object
116 * @param parent The parent of the returned object
125 * @return A new \l QDeclarativeComponent with the initial plugin view
117 * @return A new \l QDeclarativeComponent with the initial plugin view
126 */
118 */
127− virtual QQmlComponent *component(QQmlEngine *engine, QObject *parent=0) = 0;
119+ virtual QUrl componentSource() const = 0;
128
120
129 /**
121 /**
130 * @brief Used during the plugin Component instanciation to set the initial properties
122 * @brief Used during the plugin Component instanciation to set the initial properties
@@ -132,13 +124,6 @@ public:
132 */
124 */
133
125
134 virtual PropertiesMap initialProperties() = 0;
126 virtual PropertiesMap initialProperties() = 0;
135−
136− /**
137− * @brief The plugin should implement this function to return the custom widgets
138− * implemente by the plugin
139− * @return The map with the widget name and url: {'WifiAccessPointItem' : 'wifi-widget.qml'}
140− */
141− virtual WidgetsMap widgets() = 0;
142};
127};
143
128
144#endif
129#endif
plugins/IndicatorsClient/indicators/common/CMakeLists.txt−8
@@ -4,14 +4,6 @@ set(INDICATORCLIENT_COMMON_SRC
4 indicatorclient_common.cpp
4 indicatorclient_common.cpp
5)
5)
6
6
7−set(INDICATORCLIENT_COMMON_RESOURCES
8− indicatorclient_common.qrc
9−)
10−
11−qt5_add_resources(INDICATORCLIENT_COMMON_RESOURCES_RCC
12− ${INDICATORCLIENT_COMMON_RESOURCES}
13−)
14−
15add_library(indicatorclient_common STATIC
7add_library(indicatorclient_common STATIC
16 ${INDICATORCLIENT_COMMON_RESOURCES_RCC}
8 ${INDICATORCLIENT_COMMON_RESOURCES_RCC}
17 ${INDICATORCLIENT_COMMON_SRC}
9 ${INDICATORCLIENT_COMMON_SRC}
plugins/IndicatorsClient/indicators/common/indicatorclient_common.cpp+2−46
@@ -55,8 +55,6 @@ IndicatorClientCommon::~IndicatorClientCommon()
55
55
56void IndicatorClientCommon::init(const QSettings& settings)
56void IndicatorClientCommon::init(const QSettings& settings)
57{
57{
58− Q_INIT_RESOURCE(indicatorclient_common);
59−
60 setId(settings.value("Indicator Service/Name").toString());
58 setId(settings.value("Indicator Service/Name").toString());
61 QString dbusService = settings.value("Indicator Service/DBusName").toString();
59 QString dbusService = settings.value("Indicator Service/DBusName").toString();
62 QString objectPath = settings.value("Indicator Service/ObjectPath").toString();
60 QString objectPath = settings.value("Indicator Service/ObjectPath").toString();
@@ -140,7 +138,6 @@ void IndicatorClientCommon::updateState(const QVariant &state)
140 setLabel(states[0].toString());
138 setLabel(states[0].toString());
141 setIcon(QUrl(states[1].toString()));
139 setIcon(QUrl(states[1].toString()));
142 setVisible(states[2].toBool());
140 setVisible(states[2].toBool());
143− setAccessibleName(states[3].toString());
144 return;
141 return;
145 }
142 }
146 }
143 }
@@ -148,7 +145,6 @@ void IndicatorClientCommon::updateState(const QVariant &state)
148 setLabel("");
145 setLabel("");
149 setIcon(QUrl());
146 setIcon(QUrl());
150 setVisible(false);
147 setVisible(false);
151− setAccessibleName("");
152}
148}
153
149
154void IndicatorClientCommon::shutdown()
150void IndicatorClientCommon::shutdown()
@@ -235,19 +231,6 @@ void IndicatorClientCommon::setPriority(int priority)
235 }
231 }
236}
232}
237
233
238−QString IndicatorClientCommon::accessibleName() const
239−{
240− return m_accessibleName;
241−}
242−
243−void IndicatorClientCommon::setAccessibleName(const QString &accesibleName)
244−{
245− if (accesibleName != m_accessibleName) {
246− m_accessibleName = accesibleName;
247− Q_EMIT accessibleNameChanged(m_accessibleName);
248− }
249−}
250−
251bool IndicatorClientCommon::visible() const
234bool IndicatorClientCommon::visible() const
252{
235{
253 return m_visible;
236 return m_visible;
@@ -279,39 +262,12 @@ QDBusActionGroup *IndicatorClientCommon::actionGroup() const
279 return m_actionGroup;
262 return m_actionGroup;
280}
263}
281
264
282−QQmlComponent *IndicatorClientCommon::createComponent(QQmlEngine *engine, QObject *parent) const
265+QUrl IndicatorClientCommon::componentSource() const
283{
266{
284− return new QQmlComponent(engine, QUrl("qrc:/indicatorsclient/qml/commonplugin.qml"), parent);
267+ return QUrl("qrc:/indicatorsclient/qml/CommonIndicator.qml");
285−}
286−
287−QQmlComponent *IndicatorClientCommon::component(QQmlEngine *engine, QObject *parent)
288−{
289− if (m_component == 0) {
290− m_component = createComponent(engine, parent);
291− }
292− return m_component;
293}
268}
294
269
295IndicatorClientInterface::PropertiesMap IndicatorClientCommon::initialProperties()
270IndicatorClientInterface::PropertiesMap IndicatorClientCommon::initialProperties()
296{
271{
297 return m_initialProperties;
272 return m_initialProperties;
298}
273}
299−
300−IndicatorClientInterface::WidgetsMap IndicatorClientCommon::widgets()
301−{
302− // Register all basic/native widgets
303− static WidgetsMap w;
304− if (w.isEmpty()) {
305− //TODO: use a generic name for volumecontrol widget (Slider)
306− w.insert("unity.widgets.systemsettings.tablet.volumecontrol", QUrl("SliderMenu.qml"));
307− w.insert("unity.widgets.systemsettings.tablet.switch", QUrl("SwitchMenu.qml"));
308−
309− w.insert("com.canonical.indicator.button", QUrl("ButtonMenu.qml"));
310− w.insert("com.canonical.indicator.div", QUrl("DivMenu.qml"));
311− w.insert("com.canonical.indicator.section", QUrl("MenuSection.qml"));
312− w.insert("com.canonical.indicator.progress", QUrl("ProgressMenu.qml"));
313− w.insert("com.canonical.indicator.slider", QUrl("SliderMenu.qml"));
314− w.insert("com.canonical.indicator.switch", QUrl("SwitchMenu.qml"));
315− }
316− return w;
317−}
plugins/IndicatorsClient/indicators/common/indicatorclient_common.h+1−8
@@ -36,7 +36,6 @@ class IndicatorClientCommon : public QObject, public IndicatorClientInterface
36 Q_PROPERTY(QString label READ label NOTIFY labelChanged)
36 Q_PROPERTY(QString label READ label NOTIFY labelChanged)
37 Q_PROPERTY(QString description READ description NOTIFY descriptionChanged)
37 Q_PROPERTY(QString description READ description NOTIFY descriptionChanged)
38 Q_PROPERTY(QUrl icon READ icon NOTIFY iconChanged)
38 Q_PROPERTY(QUrl icon READ icon NOTIFY iconChanged)
39− Q_PROPERTY(QString accessibleName READ accessibleName NOTIFY accessibleNameChanged)
40 Q_PROPERTY(bool visible READ visible NOTIFY visibleChanged)
39 Q_PROPERTY(bool visible READ visible NOTIFY visibleChanged)
41 Q_PROPERTY(int priority READ priority NOTIFY priorityChanged)
40 Q_PROPERTY(int priority READ priority NOTIFY priorityChanged)
42
41
@@ -52,13 +51,11 @@ public:
52 QString title() const;
51 QString title() const;
53 bool visible() const;
52 bool visible() const;
54 QString description() const;
53 QString description() const;
55− QString accessibleName() const;
56 QString label() const;
54 QString label() const;
57 int priority() const;
55 int priority() const;
58
56
59− QQmlComponent *component(QQmlEngine *engine, QObject *parent=0);
57+ QUrl componentSource() const;
60 PropertiesMap initialProperties();
58 PropertiesMap initialProperties();
61− WidgetsMap widgets();
62
59
63Q_SIGNALS:
60Q_SIGNALS:
64 void identifierChanged(const QString &identifier);
61 void identifierChanged(const QString &identifier);
@@ -66,7 +63,6 @@ Q_SIGNALS:
66 void titleChanged(const QString &title);
63 void titleChanged(const QString &title);
67 void visibleChanged(bool visible);
64 void visibleChanged(bool visible);
68 void descriptionChanged(const QString &description);
65 void descriptionChanged(const QString &description);
69− void accessibleNameChanged(const QString &assesibleName);
70 void labelChanged(const QString &label);
66 void labelChanged(const QString &label);
71 void priorityChanged(int priority);
67 void priorityChanged(int priority);
72
68
@@ -78,11 +74,9 @@ protected:
78 void setTitle(const QString &title);
74 void setTitle(const QString &title);
79 void setDescription(const QString &description);
75 void setDescription(const QString &description);
80 void setVisible(bool visible);
76 void setVisible(bool visible);
81− void setAccessibleName(const QString &accessibleName);
82 void setLabel(const QString &title);
77 void setLabel(const QString &title);
83 void setPriority(int priority);
78 void setPriority(int priority);
84 virtual bool parseRootElement(const QString &type, QMap<int, QVariant> data);
79 virtual bool parseRootElement(const QString &type, QMap<int, QVariant> data);
85− virtual QQmlComponent *createComponent(QQmlEngine *engine, QObject *parent=0) const;
86 QDBusActionGroup *actionGroup() const;
80 QDBusActionGroup *actionGroup() const;
87
81
88private Q_SLOTS:
82private Q_SLOTS:
@@ -94,7 +88,6 @@ private:
94 QUrl m_icon;
88 QUrl m_icon;
95 QString m_title;
89 QString m_title;
96 QString m_description;
90 QString m_description;
97− QString m_accessibleName;
98 QString m_label;
91 QString m_label;
99 bool m_visible;
92 bool m_visible;
100 int m_priority;
93 int m_priority;
plugins/IndicatorsClient/indicators/common/indicatorclient_common.qrcdeleted−5
@@ -1,5 +0,0 @@
1−<RCC>
2− <qresource prefix="/indicatorsclient">
3− <file>qml/commonplugin.qml</file>
4− </qresource>
5−</RCC>
plugins/IndicatorsClient/indicators/common/qml/commonplugin.qmldeleted−24
@@ -1,24 +0,0 @@
1−/*
2− * Copyright 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 Lesser 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 Lesser General Public License for more details.
12− *
13− * You should have received a copy of the GNU Lesser General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− *
16− * Authors:
17− * Renato Araujo Oliveira Filho <renato@canonical.com>
18− */
19−
20−import IndicatorsClient 0.1 as IndicatorsClient
21−
22−IndicatorsClient.PluginItem {
23− anchors.fill: parent
24−}
plugins/IndicatorsClient/indicators/datetime/CMakeLists.txt−5
@@ -2,12 +2,7 @@ set(INDICATORCLIENT_DATETIME_SRC
2 indicatorclient_datetime.cpp
2 indicatorclient_datetime.cpp
3)
3)
4
4
5−qt5_add_resources(INDICATORCLIENT_DATETIME_RESOURCES_RCC
6− indicatorclient_datetime.qrc
7−)
8−
9add_library(indicatorclient_datetime STATIC
5add_library(indicatorclient_datetime STATIC
10− ${INDICATORCLIENT_DATETIME_RESOURCES_RCC}
11 ${INDICATORCLIENT_DATETIME_SRC}
6 ${INDICATORCLIENT_DATETIME_SRC}
12)
7)
13
8
plugins/IndicatorsClient/indicators/datetime/artwork/time_and_date@18.pngdeleted

Binary file not shown.

plugins/IndicatorsClient/indicators/datetime/indicatorclient_datetime.cpp+2−4
@@ -46,7 +46,6 @@ IndicatorClientDateTime::~IndicatorClientDateTime()
46void IndicatorClientDateTime::init(const QSettings& settings)
46void IndicatorClientDateTime::init(const QSettings& settings)
47{
47{
48 IndicatorClientCommon::init(settings);
48 IndicatorClientCommon::init(settings);
49− Q_INIT_RESOURCE(indicatorclient_datetime);
50
49
51 m_timer.start(1000 * 10);
50 m_timer.start(1000 * 10);
52}
51}
@@ -105,15 +104,14 @@ void IndicatorClientDateTime::updateTimeFormat(const QVariant &state)
105 m_format = states[0].toString();
104 m_format = states[0].toString();
106 setIcon(QUrl(states[1].toString()));
105 setIcon(QUrl(states[1].toString()));
107 setVisible(states[2].toBool());
106 setVisible(states[2].toBool());
108− setAccessibleName(states[3].toString());
109 onTimeout();
107 onTimeout();
110 }
108 }
111 }
109 }
112}
110}
113
111
114−QQmlComponent *IndicatorClientDateTime::createComponent(QQmlEngine *engine, QObject *parent) const
112+QUrl IndicatorClientDateTime::componentSource() const
115{
113{
116− return new QQmlComponent(engine, QUrl("qrc:/indicatorsclient/datetime/qml/ClockPage.qml"), parent);
114+ return QUrl("qrc:/indicatorsclient/qml/DatetimeIndicator.qml");
117}
115}
118
116
119void IndicatorClientDateTime::onTimeout()
117void IndicatorClientDateTime::onTimeout()
plugins/IndicatorsClient/indicators/datetime/indicatorclient_datetime.h+1−1
@@ -38,7 +38,7 @@ public:
38 void shutdown();
38 void shutdown();
39 QString dateTime() const;
39 QString dateTime() const;
40 bool parseRootElement(const QString &type, QMap<int, QVariant> data);
40 bool parseRootElement(const QString &type, QMap<int, QVariant> data);
41− QQmlComponent *createComponent(QQmlEngine *engine, QObject *parent=0) const;
41+ QUrl componentSource() const;
42
42
43private Q_SLOTS:
43private Q_SLOTS:
44 void onTimeout();
44 void onTimeout();
plugins/IndicatorsClient/indicators/datetime/indicatorclient_datetime.qrcdeleted−6
@@ -1,6 +0,0 @@
1−<RCC>
2− <qresource prefix="/indicatorsclient/datetime">
3− <file>qml/ClockPage.qml</file>
4− <file>artwork/time_and_date@18.png</file>
5− </qresource>
6−</RCC>
plugins/IndicatorsClient/indicators/datetime/qml/ClockPage.qmldeleted−98
@@ -1,98 +0,0 @@
1−/*
2− * Copyright 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 Lesser 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 Lesser General Public License for more details.
12− *
13− * You should have received a copy of the GNU Lesser General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− *
16− * Authors:
17− * Renato Araujo Oliveira Filho <renato@canonical.com>
18− * Ubo Riboni <ugo.riboni@canonical.com>
19− */
20−
21−import QtQuick 2.0
22−import Ubuntu.Components 0.1
23−
24−Flickable {
25− id: page
26−
27− contentHeight: image.height
28−
29− Image {
30− id: image
31− anchors {
32− left: parent.left
33− right: parent.right
34− }
35− source: "qrc:/indicatorsclient/datetime/artwork/time_and_date@18.png"
36− fillMode: Image.PreserveAspectFit
37− }
38−
39− Item {
40− anchors {
41− top: parent.top
42− topMargin: units.gu(5)
43− left: parent.left
44− right: parent.right
45− }
46−
47− height: units.gu(30)
48−
49− Label {
50− id: __time
51− anchors {
52− horizontalCenter: parent.horizontalCenter
53− verticalCenter: parent.verticalCenter
54− }
55−
56− text: ""
57− color: "#f3f3e7"
58− font.weight: Font.Light
59− font.pixelSize: units.gu(6)
60− }
61−
62− Label {
63− id: __date
64−
65− anchors {
66− left: parent.left
67− leftMargin: units.gu(2)
68− bottom: parent.bottom
69− bottomMargin: units.gu(1.5)
70− }
71− text: ""
72− color: "#f3f3e7"
73− fontSize: "small"
74− }
75− }
76−
77− Timer {
78− interval: 1000 * 60 // one minute
79− running: true
80− repeat: true
81− onTriggered: updateTime();
82−
83− Component.onCompleted: updateTime();
84− }
85−
86− function updateTime() {
87− var dt = new Date()
88− var time = Qt.formatTime(dt)
89− var space = time.indexOf(" ")
90− __time.text = time.substr(0, space > 0 ? space : 5)
91− __date.text = Qt.formatDateTime(dt, "dddd,\ndd MMMM")
92− }
93−
94− // Make it compatible with the PluginItem interface
95− function start() {}
96− function stop() {}
97− function reset() {}
98−}
plugins/IndicatorsClient/indicators/messaging/CMakeLists.txt−5
@@ -2,12 +2,7 @@ set(INDICATORCLIENT_MESSAGING_SRC
2 indicatorclient_messaging.cpp
2 indicatorclient_messaging.cpp
3)
3)
4
4
5−qt5_add_resources(INDICATORCLIENT_MESSAGING_RESOURCES_RCC
6− indicatorclient_messaging.qrc
7−)
8−
9add_library(indicatorclient_messaging STATIC
5add_library(indicatorclient_messaging STATIC
10− ${INDICATORCLIENT_MESSAGING_RESOURCES_RCC}
11 ${INDICATORCLIENT_MESSAGING_SRC}
6 ${INDICATORCLIENT_MESSAGING_SRC}
12)
7)
13
8
plugins/IndicatorsClient/indicators/messaging/artwork/default_app.svgdeleted−42
@@ -1,42 +0,0 @@
1−<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2−<!-- Created with Inkscape (http://www.inkscape.org/) -->
3−<svg id="svg15137" xmlns="http://www.w3.org/2000/svg" height="48" width="48" version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink">
4− <defs id="defs15139">
5− <radialGradient id="radialGradient2612" gradientUnits="userSpaceOnUse" cy="4.625" cx="62.625" gradientTransform="matrix(1 0 0 .34118 0 3.0471)" r="10.625">
6− <stop id="stop8840" offset="0"/>
7− <stop id="stop8842" style="stop-opacity:0" offset="1"/>
8− </radialGradient>
9− <linearGradient id="linearGradient15133" y2=".24326" gradientUnits="userSpaceOnUse" x2="62.2" gradientTransform="matrix(2.1499 0 0 2.1499 -110.12 31.935)" y1="-12.489" x1="62.2">
10− <stop id="stop4875" style="stop-color:#fff" offset="0"/>
11− <stop id="stop4877" style="stop-color:#fff;stop-opacity:0" offset="1"/>
12− </linearGradient>
13− <radialGradient id="radialGradient15127" gradientUnits="userSpaceOnUse" cy="-8.7256" cx="62.2" gradientTransform="matrix(2.4129 0 0 2.413 -126.48 34.231)" r="9.7553">
14− <stop id="stop8649" style="stop-color:#8fb1dc" offset="0"/>
15− <stop id="stop8651" style="stop-color:#3465a4" offset="1"/>
16− </radialGradient>
17− <radialGradient id="radialGradient2418" gradientUnits="userSpaceOnUse" cy="24.149" cx="17.814" gradientTransform="matrix(-2.644 0 2.9365e-8 2.5344 78.725 -37.986)" r="9.125">
18− <stop id="stop4847" style="stop-color:#fff" offset="0"/>
19− <stop id="stop4849" style="stop-color:#b6b6b6" offset="1"/>
20− </radialGradient>
21− <radialGradient id="radialGradient5145" gradientUnits="userSpaceOnUse" cy="13.067" cx="23.86" gradientTransform="matrix(-1.5425 0 0 -.84553 60.718 23.829)" r="18.098">
22− <stop id="stop14112" style="stop-color:#557695" offset="0"/>
23− <stop id="stop14114" style="stop-color:#15395c" offset="1"/>
24− </radialGradient>
25− <radialGradient id="radialGradient5147" gradientUnits="userSpaceOnUse" cy="-3.442" cx="62.225" gradientTransform="matrix(1.1035 0 0 1.0265 -4.1555 -1.8158)" r="10.081">
26− <stop id="stop14118" style="stop-color:#9e9e9e" offset="0"/>
27− <stop id="stop14120" style="stop-color:#9e9e9e;stop-opacity:0" offset="1"/>
28− </radialGradient>
29− </defs>
30− <g id="layer1">
31− <path id="path8836" style="opacity:.4;fill-rule:evenodd;fill:url(#radialGradient2612)" d="m73.25 4.625a10.625 3.625 0 1 1 -21.25 0 10.625 3.625 0 1 1 21.25 0z" transform="matrix(2.1647 0 0 2.5637 -111.56 26.85)"/>
32− <g id="g15122" transform="translate(.79042 -.78563)">
33− <path id="path6495" style="stroke:#204a87;fill:url(#radialGradient15127)" d="m43.505 24.387c0 10.99-8.9091 19.899-19.897 19.899-10.989 0-19.898-8.9091-19.898-19.899 0-10.989 8.9086-19.897 19.898-19.897 10.988 0 19.897 8.9081 19.897 19.897z"/>
34− <path id="path6534" style="stroke:url(#radialGradient5147);stroke-width:1.1035;fill:url(#radialGradient5145)" d="m23.726 5.3141c-1.5283 0.12067-3.0328 0.36544-4.4919 0.84567-1.23 0.48843 0.88689-0.42988-0.37486-0.60468-0.75942-0.12994-1.0776 0.65251-1.7561 0.67046-0.7741 0.023841-1.3048 0.71572-2.0319 0.79898-0.26187 1.4432-0.59924-0.56894-0.83949 0.13173 0.19047 0.7212-0.07796 1.1928-0.63582 1.6119-0.60156 0.68249-0.03584 1.2934 0.54212 0.69395 0.2775-0.83446 1.1825-1.7618 2.0655-1.2049 0.8837 0.48448 1.7582 1.6525 2.4938 0.40935-0.75488-0.090735-1.0462-0.73637-1.4079-1.2096-0.40023 0.031761-2.0794-0.32019-1.0059-0.24024 0.5284-0.17249 1.549-0.68558 1.9239-0.66537-0.94013 0.49026 0.35015 0.81268 0.73202 1.2035 0.68671 0.20357 0.99776 1.0757 0.37414 1.527-0.80181 0.4162 0.05573 1.1017 0.221 1.6748 0.12828 0.99827 0.99623 0.43282 1.2716-0.18046 0.39803-1.1153 1.6733-1.0767 2.5958-1.5522 1.008-0.51754 1.0248-0.53575 1.5034 0.20195 0.36764 0.21151 1.5947-0.55825 0.78901-0.929-0.68957 0.03713-1.142 0.46029-0.56364-0.60801 0.13915-0.57404 0.6791-1.3235 0.58092-1.7937-0.662-0.2603-1.324-0.5207-1.986-0.7811zm-9.3732 3.6945c0.35612 0.3643 1.5564 1.0234 1.4368 0.11255-0.14419-0.61744-1.0418-0.62308-1.4368-0.11255zm18.165-0.44471c-0.82412 0.16922-1.6412 0.35467-2.292 0.92363 0.19457 0.7853-0.8341 0.89786-1.2851 1.3281-0.12036 0.25242-0.02467 1.8403 0.51105 1.1573 0.58162-0.77246 0.83368 0.40868 1.4478 0.52687 0.4451-0.14324 0.5002-1.1438 0.33275-1.6043 0.28525-0.46984 0.75058-1.1195 1.3539-1.0659-0.37419 0.57099-0.80163 2.0315 0.3911 1.4345 0.34518-0.006-0.93958 0.75452-1.0166 1.273-0.48258 0.51284-0.9934 0.90587-1.6905 0.50847-0.33355-0.28162-0.50305-1.0992-0.71414-0.17566 0.43341 0.73252-1.089 0.04718-1.0514 1.0356-0.31972 0.61514-0.89623 0.8671-1.563 0.91149 0.24198 0.19141 1.1924 1.3314 0.24953 1.1701-0.60352 0.06628-1.4857 0.40701-1.2414 1.1653-0.27486 0.9444 0.4249 0.70654 0.85522 1.2977 0.70116-0.19916 1.1488-0.62908 1.2634-1.3621 0.65618-0.19273 0.73557-0.93195 1.456-0.91702 0.7182-0.40381 0.88559 0.73738 1.5587 0.82181 0.07058 0.4087-0.33464 1.281 0.45659 0.4693 0.76441-0.55387-0.79512-1.2716-0.30963-1.4066 0.69099 0.22071 0.94006 0.87671 1.051 1.519 0.56306 0.9634 0.70185 0.44404 0.74672-0.40362 0.87723-0.39439 1.1473 1.641 2.3881 1.1397 0.92678 0.19174 0.59949 0.8304-0.01904 1.2203-0.50066 0.47112-1.3382 0.17338-1.9265-0.01558-0.56472-0.27756-1.3196-0.24813-1.6214 0.38347-0.46529-0.21764-0.94642-0.91135-1.4178-1.3118-1.1647-0.5139-2.4314-0.07571-3.5919 0.23946-0.99563 1.1632-2.1949 2.219-2.6236 3.7359-0.62778 0.63853 0.54336 1.0082-0.24392 1.556-0.6428 0.51279 0.10805 1.1629 0.2458 1.7527 0.60445 0.74395 1.6306 3.0723 2.5708 2.1452 0.52705-0.80245 0.81963 0.61582 1.4399-0.30194 0.4952-0.39949 0.9695 0.45802 1.6897 0.14331 0.69372 0.4284 0.56095 1.0433 0.27484 1.6928 0.15583 0.54087 0.93098 0.9344 0.62978 1.6677-0.27366 0.68309 0.58312 1.201 0.41038 1.7987-0.5748 1.1512-0.43928 2.5747 0.09386 3.7157 0.42668 1.0325 0.67699 2.1484 0.64366 3.2692 0.74277 0.2222 1.1367-0.72912 1.8776-0.51313 0.72333 0.09324 0.99191-0.82974 1.5008-1.2158 0.56704-0.46747-0.07223-1.1873 0.82794-1.5185 0.87331-0.42523-1.106-1.0213 0.0152-1.4024 0.46515-0.51761 1.4132-0.69776 1.6008-1.3735-0.33834-1.0398-0.21797-2.1801-0.16738-3.2436 0.32552-0.84167 0.72975-1.6312 1.4262-2.2272 0.28082-0.92669 0.94924-1.7777 0.88942-2.7709-1.6476 0.50399-1.1482-0.21491-0.22962-0.87318 0.63508-0.42199 1.4051-0.84564 1.7006-1.5617 0.14435-0.81048-0.45227-2.1297-1.0079-0.90496-0.24511-0.4707-1.1542-0.71744-1.113-1.3307-0.17659-1.2625 0.34462-0.14427 0.86051 0.10789 1.1146-0.60521 1.6818 1.7766 2.3893 0.35503-0.618-4.471-3.052-8.528-6.34-11.567-0.571-1.0949-0.921 0.75-1.501 0.68-0.464-0.485-1.33-1.1394-0.122-0.914 1.034-0.3028 0.333-0.7027-0.425-0.6842-0.574-0.0697-1.101-0.2706-1.635-0.4789zm-20.56 0.4447c-0.275 1.3534-2.0109 1.1954-2.6162 2.5304-2.9783 3.153-4.8166 7.302-5.32 11.598 0.26584 1.0071 1.1105 1.4908 1.9601 1.9373 0.72184 0.41932 1.7801 0.2342 2.1848 1.1124 0.45187 0.36983 0.93948 1.0997 1.5856 0.87722 0.93664-0.09099 0.36019 0.85823 0.19973 1.3392-0.059277 0.607-0.80778 0.99372-0.52016 1.5778-0.24136 0.66166-0.43304 1.3177 0.10262 1.8906 0.45551 0.83988 0.82632 1.7478 1.6708 2.2751 0.59217 0.49728 1.2625 1.1553 1.0304 1.9974-0.12338 0.68167 0.04306 1.3099 0.3725 1.908-0.11816 0.67146-0.36073 1.3584-0.4105 2.0183 0.87949 0.62206 2.6705 2.0606 2.8031 0.49489 0.50176-0.45161 0.5321-1.1784 1.3743-1.1804 0.3909-0.47777 0.52549-1.2283 0.81706-1.8117-0.42572-0.5384 0.16631-1.3697 0.8046-1.3477 0.81594 0.06128 0.78593-0.89448 1.1111-1.4232-0.0073-0.77224-0.38892-1.6471 0.30542-2.227 0.52242-0.47344 0.46827-1.1675 0.5498-1.8097-1.171-0.7244-2.712-1.0911-3.6386-2.0687-0.18364-0.76504-0.7598-1.0229-1.4925-1.0784-0.30936-0.43256-0.25697-1.4628-0.79753-1.5131-0.69628 0.13369-1.3857 0.24089-1.8917-0.3644-0.573-0.776-1.069 0.2-1.593 0.546-0.492 0.856-1.8683-0.043-1.7038-1.007 0.4839-1.334-1.6425 0.148-0.7699-1.425 0.4151-1.715-0.7067-0.396-1.2952-0.011-0.71822 0.0081-0.98953-0.70747-0.86146-1.3625-0.091117-0.78733 0.48283-1.1877 1.0669-1.5822 0.78161 0.12038 0.97989-0.56085 1.5654-0.4722 0.73603-0.03767 1.0049 0.66782 1.4232 1.1357 0.17514-0.66797-0.18345-1.6152 0.55606-1.9879 0.56414-0.42781 1.137-0.84927 1.2721-1.5904 0.13304-0.77598 1.2893-0.46761 1.4837-1.2526 0.26877-0.8206 1.5114-0.15823 1.7899-0.96804 0.8733-0.82086-0.27242-0.57178-0.89854-0.59806-1.2353 0.12695 0.1228-0.32763 0.58598-0.58155 0.68608 0.09073 1.3195-0.13384 1.9499-0.37629 0.08445 0.85843 0.24597 1.3112 0.68417 0.30788-0.85421-0.20211-0.11618-1.0402-0.95973-1.2614-0.66764 0.04697 0.0066-1.4189-0.81571-1.2577-1.0697 0.70782-0.11401-0.50251-0.9854-0.66347-0.68736-0.74222-0.85436 0.47657-1.2276 0.9183 0.24207 0.84702-0.79095 0.66525-0.97976 1.3606-0.41814 1.2534-0.24143-0.08931-0.74055-0.41035-0.61653-0.24732-1.3592-0.3784-1.3637-1.1899 0.82658-0.60512 2.0667-0.96189 2.5994-1.9148 0.3095-0.74008-0.26215-1.1445-0.96618-1.0889l-0.000005-2e-7zm14.675 1.642c-0.12491 0.65746 0.5475 1.009 0.30788 1.7104-0.21487 0.76842-0.27728 1.3789 0.68289 0.93046 0.99668-0.51183 0.36052-0.90148-0.03867-1.5728-0.27187-0.44613-0.24574-1.275-0.9521-1.0681zm-0.75259 1.0947c-0.79414-0.24012-0.61745 1.4493-0.12164 1.0118 0.7276-0.17916 0.23703-0.5252 0.12164-1.0118zm10.023 8.9969c0.95184 0.84444 1.277 2.0946 1.8858 3.1596 0.90428 0.39972 0.0415 1.0795 0.44521 1.5712 0.84897 0.92228-1.1752 0.24516-0.90606-0.67899-0.1971-1.2139-1.0559-2.044-1.4678-3.1045-0.04294-0.3526-0.38552-0.71788 0.04284-0.94732z"/>
35− <path id="path8655" style="opacity:.4;stroke:url(#linearGradient15133);fill:none" d="m42.409 24.387c0 10.384-8.4184 18.803-18.801 18.803-10.384 0-18.802-8.4184-18.802-18.803 0-10.384 8.418-18.801 18.802-18.801 10.383 0 18.801 8.4175 18.801 18.801z"/>
36− </g>
37− <g id="g2414" transform="matrix(.99991 -.013701 .013701 .99991 -.28870 .53585)">
38− <path id="path3970" style="stroke-linejoin:round;fill-rule:evenodd;stroke:#666;fill:url(#radialGradient2418)" d="m30.5 20.937 17 16.5-7.75 0.25s3.25 6.75 3.25 6.75c1 3-3.5 4.125-4.25 1.875l-3-6.75-5.5 5.875 0.25-24.5z"/>
39− <path id="path4853" style="opacity:.4;stroke:#fff;fill:none" d="m31.657 23.379 13.476 13.186-6.9219 0.27746l3.8721 7.7566c0.40273 1.6501-2.0283 2.4126-2.5071 1.1529l-3.6831-7.845-4.4247 4.7083 0.18907-19.236z"/>
40− </g>
41− </g>
42−</svg>
plugins/IndicatorsClient/indicators/messaging/artwork/default_contact.pngdeleted

Binary file not shown.

plugins/IndicatorsClient/indicators/messaging/artwork/message_sms01_54px.pngdeleted

Binary file not shown.

plugins/IndicatorsClient/indicators/messaging/indicatorclient_messaging.cpp+2−15
@@ -37,25 +37,12 @@ IndicatorClientMessaging::~IndicatorClientMessaging()
37void IndicatorClientMessaging::init(const QSettings& settings)
37void IndicatorClientMessaging::init(const QSettings& settings)
38{
38{
39 IndicatorClientCommon::init(settings);
39 IndicatorClientCommon::init(settings);
40− Q_INIT_RESOURCE(indicatorclient_messaging);
41
40
42 m_initialProperties.insert("emptyText", "You have no more outstanding messages.");
41 m_initialProperties.insert("emptyText", "You have no more outstanding messages.");
43 m_initialProperties.insert("highlightFollowsCurrentItem", false);
42 m_initialProperties.insert("highlightFollowsCurrentItem", false);
44}
43}
45
44
46−QQmlComponent *IndicatorClientMessaging::createComponent(QQmlEngine *engine, QObject *parent) const
45+QUrl IndicatorClientMessaging::componentSource() const
47{
46{
48− return new QQmlComponent(engine, QUrl("qrc:/indicatorsclient/messaging/qml/messagingplugin.qml"), parent);
47+ return QUrl("qrc:/indicatorsclient/qml/MessagingIndicator.qml");
49}
48}
50−
51−IndicatorClientInterface::WidgetsMap IndicatorClientMessaging::widgets()
52−{
53− static WidgetsMap w;
54− if (w.isEmpty()) {
55− w.insert("com.canonical.indicator.messages.messageitem", QUrl("qrc:/indicatorsclient/messaging/qml/MessageItem.qml"));
56− w.insert("com.canonical.indicator.messages.snapdecision", QUrl("qrc:/indicatorsclient/messaging/qml/MessageItem.qml"));
57− w.insert("com.canonical.indicator.messages.sourceitem", QUrl("qrc:/indicatorsclient/messaging/qml/GroupedMessage.qml"));
58− }
59− return w;
60−}
61−
plugins/IndicatorsClient/indicators/messaging/indicatorclient_messaging.h+1−2
@@ -31,8 +31,7 @@ public:
31 ~IndicatorClientMessaging();
31 ~IndicatorClientMessaging();
32
32
33 void init(const QSettings& settings);
33 void init(const QSettings& settings);
34− QQmlComponent* createComponent(QQmlEngine *engine, QObject *parent) const;
34+ QUrl componentSource() const;
35− WidgetsMap widgets();
36};
35};
37
36
38#endif
37#endif
plugins/IndicatorsClient/indicators/messaging/indicatorclient_messaging.qrcdeleted−19
@@ -1,19 +0,0 @@
1−<RCC>
2− <qresource prefix="/indicatorsclient/messaging">
3− <file>qml/ActionButton.qml</file>
4− <file>qml/ActionTextField.qml</file>
5− <file>qml/HeroMessageHeader.qml</file>
6− <file>qml/HeroMessage.qml</file>
7− <file>qml/MessageItem.qml</file>
8− <file>qml/TextMessage.qml</file>
9− <file>qml/SimpleTextMessage.qml</file>
10− <file>qml/SnapDecision.qml</file>
11− <file>qml/QuickReply.qml</file>
12− <file>qml/GroupedMessage.qml</file>
13− <file>qml/utils.js</file>
14− <file>artwork/default_contact.png</file>
15− <file>artwork/default_app.svg</file>
16− <file>artwork/message_sms01_54px.png</file>
17− <file>qml/messagingplugin.qml</file>
18− </qresource>
19−</RCC>
plugins/IndicatorsClient/indicators/messaging/qml/messagingplugin.qmldeleted−32
@@ -1,32 +0,0 @@
1−/*
2− * Copyright 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 Lesser 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 Lesser General Public License for more details.
12− *
13− * You should have received a copy of the GNU Lesser General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− *
16− * Authors:
17− * Renato Araujo Oliveira Filho <renato.filho@canonical.com>
18− */
19−
20−import IndicatorsClient 0.1 as IndicatorsClient
21−import QtQuick 2.0
22−import Ubuntu.Components 0.1
23−
24−IndicatorsClient.PluginItem {
25− anchors.fill: parent
26−
27− function stop() {
28− // never stops the service
29− // this will keep all objects in memory, consume more memory
30− // but will optimize the menu contruction on the screen
31− }
32−}
plugins/IndicatorsClient/indicators/network/CMakeLists.txt−5
@@ -4,12 +4,7 @@ set(INDICATORCLIENT_NETWORK_SRC
4 secret-agent.c
4 secret-agent.c
5)
5)
6
6
7−qt5_add_resources(INDICATORCLIENT_NETWORK_RESOURCES_RCC
8− indicatorclient_network.qrc
9−)
10−
11add_library(indicatorclient_network
7add_library(indicatorclient_network
12− ${INDICATORCLIENT_NETWORK_RESOURCES_RCC}
13 ${INDICATORCLIENT_NETWORK_SRC}
8 ${INDICATORCLIENT_NETWORK_SRC}
14)
9)
15
10
plugins/IndicatorsClient/indicators/network/indicatorclient_network.cpp+2−14
@@ -46,26 +46,14 @@ IndicatorClientNetwork::~IndicatorClientNetwork()
46void IndicatorClientNetwork::init(const QSettings& settings)
46void IndicatorClientNetwork::init(const QSettings& settings)
47{
47{
48 IndicatorClientCommon::init(settings);
48 IndicatorClientCommon::init(settings);
49− Q_INIT_RESOURCE(indicatorclient_network);
50
49
51 qmlRegisterType<NetworkAgent>("NetworkSettings", 0, 1, "NetworkAgent");
50 qmlRegisterType<NetworkAgent>("NetworkSettings", 0, 1, "NetworkAgent");
52 setIcon(QUrl("image://gicon/wifi-none"));
51 setIcon(QUrl("image://gicon/wifi-none"));
53}
52}
54
53
55−QQmlComponent *IndicatorClientNetwork::createComponent(QQmlEngine *engine, QObject *parent) const
54+QUrl IndicatorClientNetwork::componentSource() const
56{
55{
57− return new QQmlComponent(engine, QUrl("qrc:/indicatorclient/network/qml/NetworkPage.qml"), parent);
56+ return QUrl("qrc:/indicatorsclient/qml/NetworkIndicator.qml");
58−}
59−
60−IndicatorClientInterface::WidgetsMap IndicatorClientNetwork::widgets()
61−{
62− static WidgetsMap w;
63− if (w.isEmpty()) {
64− w.insert("unity.widget.systemsettings.tablet.sectiontitle", QUrl("qrc:/indicatorclient/network/qml/WifiSection.qml"));
65− w.insert("unity.widgets.systemsettings.tablet.wifisection", QUrl("qrc:/indicatorclient/network/qml/WifiSection.qml"));
66− w.insert("unity.widgets.systemsettings.tablet.accesspoint", QUrl("qrc:/indicatorclient/network/qml/Accesspoint.qml"));
67− }
68− return w;
69}
57}
70
58
71bool IndicatorClientNetwork::parseRootElement(const QString &type, QMap<int, QVariant> data)
59bool IndicatorClientNetwork::parseRootElement(const QString &type, QMap<int, QVariant> data)
plugins/IndicatorsClient/indicators/network/indicatorclient_network.h+1−2
@@ -33,8 +33,7 @@ public:
33 ~IndicatorClientNetwork();
33 ~IndicatorClientNetwork();
34
34
35 void init(const QSettings& settings);
35 void init(const QSettings& settings);
36− QQmlComponent *createComponent(QQmlEngine *engine, QObject *parent=0) const;
36+ QUrl componentSource() const;
37− WidgetsMap widgets();
38 bool parseRootElement(const QString &type, QMap<int, QVariant> data);
37 bool parseRootElement(const QString &type, QMap<int, QVariant> data);
39
38
40private Q_SLOTS:
39private Q_SLOTS:
plugins/IndicatorsClient/indicators/network/indicatorclient_network.qrcdeleted−8
@@ -1,8 +0,0 @@
1−<RCC>
2− <qresource prefix="/indicatorclient/network">
3− <file>qml/WifiSection.qml</file>
4− <file>qml/Accesspoint.qml</file>
5− <file>qml/NetworkPage.qml</file>
6− <file>qml/PasswordDialog.qml</file>
7− </qresource>
8−</RCC>
plugins/IndicatorsClient/indicators/network/qml/NetworkPage.qmldeleted−71
@@ -1,71 +0,0 @@
1−/*
2− * Copyright 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 Lesser 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 Lesser General Public License for more details.
12− *
13− * You should have received a copy of the GNU Lesser General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− *
16− * Authors:
17− * Renato Araujo Oliveira Filho <renato@canonical.com>
18− */
19−
20−import IndicatorsClient 0.1 as IndicatorsClient
21−import Ubuntu.Components 0.1
22−import NetworkSettings 0.1
23−
24−PageStack {
25− id: _network
26−
27− property alias title: _mainPage.title
28− property alias emptyText: _pluginItem.emptyText
29− property alias widgetsMap : _pluginItem.widgetsMap
30− property alias busType: _pluginItem.busType
31− property alias busName: _pluginItem.busName
32− property alias objectPath: _pluginItem.objectPath
33−
34− __showHeader: false
35− anchors.fill: parent
36−
37− Page {
38− id: _mainPage
39−
40− IndicatorsClient.PluginItem {
41− id: _pluginItem
42− anchors.fill: parent
43− }
44− }
45−
46− NetworkAgent {
47− id: networkAgent
48−
49− onSecretRequested: {
50− _network.push(Qt.createComponent("PasswordDialog.qml"),
51− {"agent" : networkAgent, "token" : token})
52− }
53− }
54−
55− function start()
56− {
57− push(_mainPage)
58− _pluginItem.start()
59− }
60−
61− function stop()
62− {
63− clear()
64− _pluginItem.stop()
65− }
66−
67− function reset()
68− {
69− _pluginItem.reset()
70− }
71−}
plugins/IndicatorsClient/indicators/power/CMakeLists.txt−5
@@ -2,12 +2,7 @@ set(INDICATORCLIENT_POWER_SRC
2 indicatorclient_power.cpp
2 indicatorclient_power.cpp
3)
3)
4
4
5−qt5_add_resources(INDICATORCLIENT_POWER_RESOURCES_RCC
6− indicatorclient_power.qrc
7−)
8−
9add_library(indicatorclient_power STATIC
5add_library(indicatorclient_power STATIC
10− ${INDICATORCLIENT_POWER_RESOURCES_RCC}
11 ${INDICATORCLIENT_POWER_SRC}
6 ${INDICATORCLIENT_POWER_SRC}
12)
7)
13
8
plugins/IndicatorsClient/indicators/power/indicatorclient_power.cpp−1
@@ -30,5 +30,4 @@ IndicatorClientPower::IndicatorClientPower(QObject *parent)
30void IndicatorClientPower::init(const QSettings& settings)
30void IndicatorClientPower::init(const QSettings& settings)
31{
31{
32 IndicatorClientCommon::init(settings);
32 IndicatorClientCommon::init(settings);
33− Q_INIT_RESOURCE(indicatorclient_power);
34}
33}
plugins/IndicatorsClient/indicators/power/indicatorclient_power.qrcdeleted−4
@@ -1,4 +0,0 @@
1−<RCC>
2− <qresource prefix="/indicatorclient/power">
3− </qresource>
4−</RCC>
plugins/IndicatorsClient/indicators/sound/CMakeLists.txt−9
@@ -2,16 +2,7 @@ set(INDICATORCLIENT_SOUND_SRC
2 indicatorclient_sound.cpp
2 indicatorclient_sound.cpp
3)
3)
4
4
5−set(INDICATORCLIENT_SOUND_RESOURCES
6− indicatorclient_sound.qrc
7−)
8−
9−qt5_add_resources(INDICATORCLIENT_SOUND_RESOURCES_RCC
10− ${INDICATORCLIENT_SOUND_RESOURCES}
11−)
12−
13add_library(indicatorclient_sound STATIC
5add_library(indicatorclient_sound STATIC
14− ${INDICATORCLIENT_SOUND_RESOURCES_RCC}
15 ${INDICATORCLIENT_SOUND_SRC}
6 ${INDICATORCLIENT_SOUND_SRC}
16)
7)
17
8
plugins/IndicatorsClient/indicators/sound/indicatorclient_sound.cpp−1
@@ -31,5 +31,4 @@ IndicatorClientSound::IndicatorClientSound(QObject *parent)
31void IndicatorClientSound::init(const QSettings& settings)
31void IndicatorClientSound::init(const QSettings& settings)
32{
32{
33 IndicatorClientCommon::init(settings);
33 IndicatorClientCommon::init(settings);
34− Q_INIT_RESOURCE(indicatorclient_sound);
35}
34}
plugins/IndicatorsClient/indicators/sound/indicatorclient_sound.qrcdeleted−4
@@ -1,4 +0,0 @@
1−<RCC>
2− <qresource prefix="/soundplugin">
3− </qresource>
4−</RCC>
plugins/IndicatorsClient/indicatorsmodel.cpp+1−22
@@ -19,7 +19,6 @@
19
19
20#include "indicatorsmodel.h"
20#include "indicatorsmodel.h"
21#include "indicatorsmanager.h"
21#include "indicatorsmanager.h"
22−#include "widgetsmap.h"
23#include "indicatorclientinterface.h"
22#include "indicatorclientinterface.h"
24
23
25#include <QQmlContext>
24#include <QQmlContext>
@@ -60,7 +59,6 @@ IndicatorsModel::IndicatorsModel(QObject *parent)
60 m_manager = new IndicatorsManager(this);
59 m_manager = new IndicatorsManager(this);
61 QObject::connect(m_manager, SIGNAL(indicatorLoaded(const QString&)), this, SLOT(onIndicatorLoaded(const QString&)));
60 QObject::connect(m_manager, SIGNAL(indicatorLoaded(const QString&)), this, SLOT(onIndicatorLoaded(const QString&)));
62 QObject::connect(m_manager, SIGNAL(indicatorAboutToBeUnloaded(const QString&)), this, SLOT(onIndicatorAboutToBeUnloaded(const QString&)));
61 QObject::connect(m_manager, SIGNAL(indicatorAboutToBeUnloaded(const QString&)), this, SLOT(onIndicatorAboutToBeUnloaded(const QString&)));
63− m_widgetsMap = new WidgetsMap;
64
62
65 QObject::connect(this, SIGNAL(rowsInserted(const QModelIndex &, int, int)), this, SIGNAL(countChanged()));
63 QObject::connect(this, SIGNAL(rowsInserted(const QModelIndex &, int, int)), this, SIGNAL(countChanged()));
66 QObject::connect(this, SIGNAL(rowsRemoved(const QModelIndex &, int, int)), this, SIGNAL(countChanged()));
64 QObject::connect(this, SIGNAL(rowsRemoved(const QModelIndex &, int, int)), this, SIGNAL(countChanged()));
@@ -72,7 +70,6 @@ IndicatorsModel::~IndicatorsModel()
72{
70{
73 disconnect(m_manager, 0, 0, 0);
71 disconnect(m_manager, 0, 0, 0);
74 m_manager->deleteLater();
72 m_manager->deleteLater();
75− m_widgetsMap->deleteLater();
76}
73}
77
74
78/*!
75/*!
@@ -107,15 +104,6 @@ int IndicatorsModel::count() const
107 return rowCount();
104 return rowCount();
108}
105}
109
106
110−/*!
111− \qmlproperty WidgetsMap IndicatorsModel::widgetsMap
112− This property holds the map for all new widgets registered by dynamically loaded plugins.
113−*/
114−WidgetsMap* IndicatorsModel::widgetsMap() const
115−{
116− return m_widgetsMap;
117−}
118−
119/*!
107/*!
120 \qmlmethod IndicatorsModel::unload()
108 \qmlmethod IndicatorsModel::unload()
121
109
@@ -123,7 +111,6 @@ WidgetsMap* IndicatorsModel::widgetsMap() const
123*/
111*/
124void IndicatorsModel::load()
112void IndicatorsModel::load()
125{
113{
126− m_widgetsMap->clear();
127 m_plugins.clear();
114 m_plugins.clear();
128 m_manager->load();
115 m_manager->load();
129}
116}
@@ -135,7 +122,6 @@ void IndicatorsModel::load()
135*/
122*/
136void IndicatorsModel::unload()
123void IndicatorsModel::unload()
137{
124{
138− m_widgetsMap->clear();
139 m_manager->unload();
125 m_manager->unload();
140}
126}
141
127
@@ -151,8 +137,6 @@ void IndicatorsModel::onIndicatorLoaded(const QString& indicator)
151
137
152 beginInsertRows(QModelIndex(), insert_pos, insert_pos);
138 beginInsertRows(QModelIndex(), insert_pos, insert_pos);
153
139
154− m_widgetsMap->append(plugin->widgets());
155−
156 QObject* obj = dynamic_cast<QObject*>(plugin.get());
140 QObject* obj = dynamic_cast<QObject*>(plugin.get());
157 if (obj)
141 if (obj)
158 {
142 {
@@ -165,8 +149,6 @@ void IndicatorsModel::onIndicatorLoaded(const QString& indicator)
165 m_plugins.insert(i, plugin);
149 m_plugins.insert(i, plugin);
166
150
167 endInsertRows();
151 endInsertRows();
168−
169− Q_EMIT widgetsMapChanged(m_widgetsMap);
170}
152}
171
153
172/*! \internal */
154/*! \internal */
@@ -301,10 +283,7 @@ QVariant IndicatorsModel::data(const QModelIndex &index, int role) const
301 }
283 }
302 case QMLComponent:
284 case QMLComponent:
303 if (plugin) {
285 if (plugin) {
304− QQmlContext *context = QQmlEngine::contextForObject(this);
286+ return plugin->componentSource();
305− if (context) {
306− attribute = QVariant::fromValue<QQmlComponent*>(plugin->component(context->parentContext()->engine()));
307− }
308 }
287 }
309 break;
288 break;
310 case InitialProperties:
289 case InitialProperties:
plugins/IndicatorsClient/indicatorsmodel.h−6
@@ -26,13 +26,11 @@
26#include <QAbstractListModel>
26#include <QAbstractListModel>
27#include <QQmlEngine>
27#include <QQmlEngine>
28
28
29−class WidgetsMap;
30class IndicatorsManager;
29class IndicatorsManager;
31
30
32class IndicatorsModel : public QAbstractListModel
31class IndicatorsModel : public QAbstractListModel
33{
32{
34 Q_OBJECT
33 Q_OBJECT
35− Q_PROPERTY(WidgetsMap* widgetsMap READ widgetsMap NOTIFY widgetsMapChanged)
36 Q_PROPERTY(int count READ count NOTIFY countChanged)
34 Q_PROPERTY(int count READ count NOTIFY countChanged)
37
35
38public:
36public:
@@ -50,8 +48,6 @@ public:
50 IndicatorsModel(QObject *parent=0);
48 IndicatorsModel(QObject *parent=0);
51 ~IndicatorsModel();
49 ~IndicatorsModel();
52
50
53− WidgetsMap* widgetsMap() const;
54−
55 Q_INVOKABLE void load();
51 Q_INVOKABLE void load();
56 Q_INVOKABLE void unload();
52 Q_INVOKABLE void unload();
57
53
@@ -65,7 +61,6 @@ public:
65 int rowCount(const QModelIndex &parent = QModelIndex()) const;
61 int rowCount(const QModelIndex &parent = QModelIndex()) const;
66
62
67Q_SIGNALS:
63Q_SIGNALS:
68− void widgetsMapChanged(WidgetsMap *widgetsMap);
69 void countChanged();
64 void countChanged();
70
65
71private Q_SLOTS:
66private Q_SLOTS:
@@ -78,7 +73,6 @@ private Q_SLOTS:
78
73
79private:
74private:
80 IndicatorsManager *m_manager;
75 IndicatorsManager *m_manager;
81− WidgetsMap* m_widgetsMap;
82 QList<IndicatorClientInterface::Ptr> m_plugins;
76 QList<IndicatorClientInterface::Ptr> m_plugins;
83
77
84 void notifyDataChanged(QObject *sender, int role);
78 void notifyDataChanged(QObject *sender, int role);
plugins/IndicatorsClient/plugin.cpp+2−2
@@ -25,13 +25,13 @@
25// local
25// local
26#include "flatmenuproxymodel.h"
26#include "flatmenuproxymodel.h"
27#include "indicatorsmanager.h"
27#include "indicatorsmanager.h"
28−#include "widgetsmap.h"
29#include "indicatorsmodel.h"
28#include "indicatorsmodel.h"
30
29
31void IndicatorsClientPlugin::registerTypes(const char *uri)
30void IndicatorsClientPlugin::registerTypes(const char *uri)
32{
31{
32+ Q_INIT_RESOURCE(indicatorclient);
33+
33 qmlRegisterType<IndicatorsManager>(uri, 0, 1, "IndicatorsManager");
34 qmlRegisterType<IndicatorsManager>(uri, 0, 1, "IndicatorsManager");
34− qmlRegisterUncreatableType<WidgetsMap>(uri, 0, 1, "WidgetsMap", "WidgetsMap must be created by PluginModel");
35 qmlRegisterType<FlatMenuProxyModel>(uri, 0, 1, "FlatMenuProxyModel");
35 qmlRegisterType<FlatMenuProxyModel>(uri, 0, 1, "FlatMenuProxyModel");
36 qmlRegisterType<IndicatorsModel>(uri, 0, 1, "IndicatorsModel");
36 qmlRegisterType<IndicatorsModel>(uri, 0, 1, "IndicatorsModel");
37}
37}
plugins/IndicatorsClient/qml/FactoryMenu.qml+48−43
@@ -18,6 +18,7 @@
18 */
18 */
19
19
20import QtQuick 2.0
20import QtQuick 2.0
21+import IndicatorsClient 0.1 as IndicatorsClient
21
22
22Item {
23Item {
23 id: __menuFactory
24 id: __menuFactory
@@ -25,66 +26,70 @@ Item {
25 property QtObject menu
26 property QtObject menu
26 property QtObject listView
27 property QtObject listView
27 property QtObject actionGroup
28 property QtObject actionGroup
28− property variant widgetsMap
29 property bool isCurrentItem
29 property bool isCurrentItem
30− readonly property bool empty: (__loader.source !== "" && __loader.status == Loader.Ready) ? __loader.item.state === "EMPTY" : true
30+ readonly property bool empty: (__loader.object !== undefined) ? __loader.object.state === "EMPTY" : true
31
31
32 signal selectItem(int targetIndex)
32 signal selectItem(int targetIndex)
33
33
34− implicitHeight: (__loader.status === Loader.Ready) ? __loader.item.implicitHeight : 0
34+ property var _map: {
35− Loader {
35+ "unity.widgets.systemsettings.tablet.volumecontrol" : "IndicatorsClient.SliderMenu",
36+ "unity.widgets.systemsettings.tablet.switch" : "IndicatorsClient.SwitchMenu",
37+ "unity.widgets.systemsettings.tablet.switch" : "IndicatorsClient.DashApps",
38+
39+ "com.canonical.indicator.button" : "IndicatorsClient.ButtonMenu",
40+ "com.canonical.indicator.div" : "IndicatorsClient.DivMenu",
41+ "com.canonical.indicator.section" : "IndicatorsClient.MenuSection",
42+ "com.canonical.indicator.progress" : "IndicatorsClient.ProgressMenu",
43+ "com.canonical.indicator.slider" : "IndicatorsClient.SliderMenu",
44+ "com.canonical.indicator.switch" : "IndicatorsClient.SwitchMenu",
45+
46+ "com.canonical.indicator.messages.messageitem" : "IndicatorsClient.Messaging.MessageItem",
47+ "com.canonical.indicator.messages.snapdecision" : "IndicatorsClient.Messaging.SnapDecision",
48+ "com.canonical.indicator.messages.sourceitem" : "IndicatorsClient.Messaging.GroupedMessage",
49+
50+ "unity.widget.systemsettings.tablet.sectiontitle" : "IndicatorsClient.Network.WifiSection",
51+ "unity.widgets.systemsettings.tablet.wifisection" : "IndicatorsClient.Network.WifiSection",
52+ "unity.widgets.systemsettings.tablet.accesspoint" : "IndicatorsClient.Network.Accesspoint",
53+ }
54+
55+ function get_qml_string(type) {
56+ return "import QtQuick 2.0; import IndicatorsClient 0.1 as IndicatorsClient; " + type + " {}";
57+ }
58+
59+ QtObject {
36 id: __loader
60 id: __loader
37− anchors.fill: parent
61+
38− asynchronous: true
62+ property var object: {
39− source: {
40− if (!__menuFactory.menu || !__menuFactory.menu.extra || !__menuFactory.widgetsMap) {
63+ if (!__menuFactory.menu || !__menuFactory.menu.extra) {
41− return ''
64+ return undefined
42 }
65 }
43
66
67+ var tmp_object = undefined
44 var widgetType = __menuFactory.menu.extra.canonical_type
68 var widgetType = __menuFactory.menu.extra.canonical_type
45− var sourceFile = null
46 if (widgetType) {
69 if (widgetType) {
47− sourceFile = __menuFactory.widgetsMap.find(widgetType)
70+ var component_type = _map[widgetType]
71+ if (component_type != undefined) {
72+ tmp_object = Qt.createQmlObject(get_qml_string(component_type), __menuFactory)
73+ }
48 }
74 }
49− if (!sourceFile) {
75+ if (tmp_object == undefined) {
50 if (widgetType === "com.canonical.indicator.root") {
76 if (widgetType === "com.canonical.indicator.root") {
51− sourceFile == ""
77+ tmp_object = undefined
52 // Try discovery the item based on the basic properties
78 // Try discovery the item based on the basic properties
53 } else if (menu.hasSection) {
79 } else if (menu.hasSection) {
54− sourceFile = "SectionMenu.qml"
80+ tmp_object = Qt.createQmlObject(get_qml_string("IndicatorsClient.SectionMenu"), __menuFactory)
55 } else {
81 } else {
56− sourceFile = "Menu.qml"
82+ tmp_object = Qt.createQmlObject(get_qml_string("IndicatorsClient.Menu"), __menuFactory)
57 }
83 }
58 }
84 }
59− return sourceFile
85+ if (tmp_object != undefined) {
60− }
61− onStatusChanged: {
62− if (status == Loader.Ready) {
63− item.listViewIsCurrentItem = __menuFactory.isCurrentItem
86+ tmp_object.listViewIsCurrentItem = Qt.binding(function() { return isCurrentItem; });
87+ tmp_object.actionGroup = Qt.binding(function() { return __menuFactory.actionGroup; });
88+ tmp_object.menu = Qt.binding(function() { return __menuFactory.menu; });
64 }
89 }
65− }
90+ return tmp_object
66−
67− // Binding all properties for the item, to make sure that any change in the
68− // property will be propagated to the __loader.item at any time
69− Binding {
70− target: __loader.item
71− property: "listViewIsCurrentItem"
72− value: isCurrentItem
73− when: (__loader.status == Loader.Ready)
74− }
75−
76− Binding {
77− target: __loader.item
78− property: "actionGroup"
79− value: __menuFactory.actionGroup
80− when: (__loader.status == Loader.Ready)
81− }
82−
83− Binding {
84− target: __loader.item
85− property: "menu"
86− value: __menuFactory.menu
87− when: (__loader.status == Loader.Ready)
88 }
91 }
89 }
92 }
93+
94+ implicitHeight: __loader.object ? __loader.object.implicitHeight : 0
90}
95}
plugins/IndicatorsClient/qml/PluginItem.qml−2
@@ -30,7 +30,6 @@ Item {
30 property string device: "phone"
30 property string device: "phone"
31 property string title
31 property string title
32 property alias emptyText: emptyLabel.text
32 property alias emptyText: emptyLabel.text
33− property variant widgetsMap : null
34 property int busType
33 property int busType
35 property string busName
34 property string busName
36 property string objectPath
35 property string objectPath
@@ -153,7 +152,6 @@ Item {
153 anchors.left: parent.left
152 anchors.left: parent.left
154 anchors.right: parent.right
153 anchors.right: parent.right
155 height: implicitHeight
154 height: implicitHeight
156− widgetsMap: main ? main.widgetsMap : null
157 menu: model
155 menu: model
158
156
159 onSelectItem: item.ListView.view.currentIndex = targetIndex
157 onSelectItem: item.ListView.view.currentIndex = targetIndex
plugins/IndicatorsClient/qml/SectionMenu.qml−1
@@ -26,7 +26,6 @@ BasicMenu {
26
26
27 property string label: menu && menu.label ? menu.label : ""
27 property string label: menu && menu.label ? menu.label : ""
28 property bool busy: false
28 property bool busy: false
29− property variant _widgetsMap : widgetsMap
30 property int count: menu && menu.linkSection ? menu.linkSection.count : 0
29 property int count: menu && menu.linkSection ? menu.linkSection.count : 0
31
30
32 color: "#221e1b"
31 color: "#221e1b"
plugins/IndicatorsClient/indicators/messaging/qml/ActionButton.qml → plugins/IndicatorsClient/qml/messaging/ActionButton.qmlrenamed

The content is the same.

plugins/IndicatorsClient/indicators/messaging/qml/ActionTextField.qml → plugins/IndicatorsClient/qml/messaging/ActionTextField.qmlrenamed

The content is the same.

plugins/IndicatorsClient/indicators/messaging/qml/GroupedMessage.qml → plugins/IndicatorsClient/qml/messaging/GroupedMessage.qmlrenamed+1−1
@@ -40,7 +40,7 @@ IndicatorsClient.RemovableMenu {
40 height: units.gu(6)
40 height: units.gu(6)
41 width: units.gu(6)
41 width: units.gu(6)
42 image: Image {
42 image: Image {
43− source: menu && (menu.extra.canonical_icon.length > 0) ? "image://gicon/" + encodeURI(menu.extra.canonical_icon) : "qrc:/indicatorsclient/messaging/artwork/default_app.svg"
43+ source: menu && (menu.extra.canonical_icon.length > 0) ? "image://gicon/" + encodeURI(menu.extra.canonical_icon) : "qrc:/indicatorsclient/artwork/messaging/default_app.svg"
44 fillMode: Image.PreserveAspectFit
44 fillMode: Image.PreserveAspectFit
45 }
45 }
46 }
46 }
plugins/IndicatorsClient/indicators/messaging/qml/HeroMessage.qml → plugins/IndicatorsClient/qml/messaging/HeroMessage.qmlrenamed+1−1
@@ -43,7 +43,7 @@ IndicatorsClient.BasicMenu {
43 anchors.left: parent.left
43 anchors.left: parent.left
44 anchors.right: parent.right
44 anchors.right: parent.right
45
45
46− avatar: menu && (menu.extra.canonical_icon.length > 0) ? "image://gicon/" + encodeURI(menu.extra.canonical_icon) : "qrc:/indicatorsclient/messaging/artwork/default_contact.png"
46+ avatar: menu && (menu.extra.canonical_icon.length > 0) ? "image://gicon/" + encodeURI(menu.extra.canonical_icon) : "qrc:/indicatorsclient/artwork/messaging/default_contact.png"
47 icon: menu && (menu.extra.canonical_app_icon.length > 0) ? "image://gicon/" + encodeURI(menu.extra.canonical_app_icon) : ""
47 icon: menu && (menu.extra.canonical_app_icon.length > 0) ? "image://gicon/" + encodeURI(menu.extra.canonical_app_icon) : ""
48 appIcon: icon
48 appIcon: icon
49
49
plugins/IndicatorsClient/indicators/messaging/qml/HeroMessageHeader.qml → plugins/IndicatorsClient/qml/messaging/HeroMessageHeader.qmlrenamed

The content is the same.

plugins/IndicatorsClient/indicators/messaging/qml/MessageItem.qml → plugins/IndicatorsClient/qml/messaging/MessageItem.qmlrenamed

The content is the same.

plugins/IndicatorsClient/indicators/messaging/qml/QuickReply.qml → plugins/IndicatorsClient/qml/messaging/QuickReply.qmlrenamed+1−1
@@ -47,7 +47,7 @@ Item {
47 width: units.gu(2)
47 width: units.gu(2)
48 height: width
48 height: width
49 fillMode: Image.PreserveAspectFit
49 fillMode: Image.PreserveAspectFit
50− source: "qrc:/indicatorsclient/messaging/artwork/message_sms01_54px.png"
50+ source: "qrc:/indicatorsclient/artwork/messaging/message_sms01_54px.png"
51 }
51 }
52
52
53 Label {
53 Label {
plugins/IndicatorsClient/indicators/messaging/qml/SimpleTextMessage.qml → plugins/IndicatorsClient/qml/messaging/SimpleTextMessage.qmlrenamed

The content is the same.

plugins/IndicatorsClient/indicators/messaging/qml/SnapDecision.qml → plugins/IndicatorsClient/qml/messaging/SnapDecision.qmlrenamed

The content is the same.

plugins/IndicatorsClient/indicators/messaging/qml/TextMessage.qml → plugins/IndicatorsClient/qml/messaging/TextMessage.qmlrenamed

The content is the same.

plugins/IndicatorsClient/indicators/messaging/qml/utils.js → plugins/IndicatorsClient/qml/messaging/utils.jsrenamed

The content is the same.

plugins/IndicatorsClient/indicators/network/qml/Accesspoint.qml → plugins/IndicatorsClient/qml/network/Accesspoint.qmlrenamed

The content is the same.

plugins/IndicatorsClient/indicators/network/qml/PasswordDialog.qml → plugins/IndicatorsClient/qml/network/PasswordPage.qmlrenamed

The content is the same.

plugins/IndicatorsClient/indicators/network/qml/WifiSection.qml → plugins/IndicatorsClient/qml/network/WifiSection.qmlrenamed

The content is the same.

plugins/IndicatorsClient/qmldirdeleted−18
@@ -1,18 +0,0 @@
1−plugin IndicatorsClientQml
2−
3−BasicMenu 0.1 qml/BasicMenu.qml
4−ButtonMenu 0.1 qml/ButtonMenu.qml
5−DBusActionState 0.1 qml/DBusActionState.qml
6−DivMenu 0.1 qml/DivMenu.qml
7−FactoryMenu 0.1 qml/FactoryMenu.qml
8−HLine 0.1 qml/HLine.qml
9−Menu 0.1 qml/Menu.qml
10−PluginItem 0.1 qml/PluginItem.qml
11−RemovableMenu 0.1 qml/RemovableMenu.qml
12−SectionMenu 0.1 qml/SectionMenu.qml
13−SliderMenu 0.1 qml/SliderMenu.qml
14−SwitchMenu 0.1 qml/SwitchMenu.qml
15−TextMenu 0.1 qml/TextMenu.qml
16−ProgressMenu 0.1 qml/ProgressMenu.qml
17−
18−internal RemoveBackground qml/RemoveBackground.qml
plugins/IndicatorsClient/widgetsmap.cppdeleted−82
@@ -1,82 +0,0 @@
1−/*
2− * Copyright 2012 Canonical Ltd.
3− *
4− * This program is free software; you can redistribute it and/or modify
5− * it under the terms of the GNU Lesser 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 Lesser General Public License for more details.
12− *
13− * You should have received a copy of the GNU Lesser General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− *
16− * Authors:
17− * Renato Araujo Oliveira Filho <renato@canonical.com>
18− */
19−
20−#include "widgetsmap.h"
21−
22−/*!
23− \qmltype WidgetsMap
24− \inherits QObject
25−
26− \brief The WidgetsMap class defines a auxiliary map class with all widgets registered by the plugins.
27−
28− \b {This component is under heavy development.}
29−
30− \code
31− PluginModel {
32− id: menuModel
33− baseDir: "/usr/share/indicators"
34− }
35−
36− ListView {
37− id: view
38− model: menuModel
39− delegate: menuModel.widgetsMap.find("myWidget")
40− Component.onCompleted: menuModel.load()
41− }
42− \endcode
43−*/
44−WidgetsMap::WidgetsMap(QObject *parent)
45− :QObject(parent)
46−{
47−}
48−
49−/*! \internal */
50−void WidgetsMap::append(WidgetsMapType types)
51−{
52− Q_FOREACH(QString key, types.keys()) {
53− m_map.insert(key, types[key]);
54− }
55−}
56−
57−/*! \internal */
58−void WidgetsMap::clear()
59−{
60− m_map.clear();
61−}
62−
63−/*!
64− \qmlmethod WidgetsMap::map()
65−
66− Return a QVariantMap with the WidgetsMap contents.
67−*/
68−WidgetsMapType WidgetsMap::map() const
69−{
70− return m_map;
71−}
72−
73−/*!
74− \qmlmethod WidgetsMap::find(QString widgetType)
75−
76− Look for a widgetType registered by any plugin and return the file that represent
77− this type, or a empty QUrl if the type does not exists.
78−*/
79−QUrl WidgetsMap::find(const QString &widget) const
80−{
81− return m_map[widget];
82−}
plugins/IndicatorsClient/widgetsmap.hdeleted−46
@@ -1,46 +0,0 @@
1−/*
2− * Copyright 2012 Canonical Ltd.
3− *
4− * This program is free software; you can redistribute it and/or modify
5− * it under the terms of the GNU Lesser 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 Lesser General Public License for more details.
12− *
13− * You should have received a copy of the GNU Lesser General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− *
16− * Authors:
17− * Renato Araujo Oliveira Filho <renato@canonical.com>
18− */
19−
20−#ifndef WIDGETSMAP_H
21−#define WIDGETSMAP_H
22−
23−#include <QObject>
24−#include <QMap>
25−#include <QString>
26−#include <QUrl>
27−
28−typedef QMap<QString, QUrl> WidgetsMapType;
29−
30−class WidgetsMap : public QObject
31−{
32− Q_OBJECT
33−public:
34− WidgetsMap(QObject *parent=0);
35−
36− void append(WidgetsMapType types);
37− void clear();
38−
39− Q_INVOKABLE WidgetsMapType map() const;
40− Q_INVOKABLE QUrl find(const QString &widget) const;
41−
42−private:
43− WidgetsMapType m_map;
44−};
45−
46−#endif
tests/autopilot/indicators_client/emulators/__init__.py+7−2
@@ -5,7 +5,7 @@
5# under the terms of the GNU General Public License version 3, as published
5# under the terms of the GNU General Public License version 3, as published
6# by the Free Software Foundation.
6# by the Free Software Foundation.
7
7
8−from autopilot.introspection.dbus import DBusIntrospectionObject
8+from autopilot.introspection.dbus import CustomEmulatorBase
9from autopilot.input import Mouse, Touch, Pointer
9from autopilot.input import Mouse, Touch, Pointer
10from autopilot.platform import model
10from autopilot.platform import model
11
11
@@ -13,7 +13,7 @@ from time import sleep
13
13
14from autopilot.introspection.dbus import IntrospectableObjectMetaclass
14from autopilot.introspection.dbus import IntrospectableObjectMetaclass
15
15
16−class IndicatorsIntrospectionObject(DBusIntrospectionObject):
16+class IndicatorsEmulatorBase(CustomEmulatorBase):
17
17
18 """A common class that provides introspection and other helpers to indictors."""
18 """A common class that provides introspection and other helpers to indictors."""
19
19
@@ -29,3 +29,8 @@ class IndicatorsIntrospectionObject(DBusIntrospectionObject):
29 def setUp(self):
29 def setUp(self):
30 self.pointing_device = Pointer(self.input_device_class.create())
30 self.pointing_device = Pointer(self.input_device_class.create())
31 super(IndicatorsTestCase, self).setUp()
31 super(IndicatorsTestCase, self).setUp()
32+
33+
34+ def plop(self):
35+ print type(CustomEmulatorBase)
36+ print "PLOP"
tests/autopilot/indicators_client/emulators/common.py+37−4
@@ -5,10 +5,43 @@
5# under the terms of the GNU General Public License version 3, as published
5# under the terms of the GNU General Public License version 3, as published
6# by the Free Software Foundation.
6# by the Free Software Foundation.
7
7
8−from indicators_client.emulators import IndicatorsIntrospectionObject
8+from indicators_client.emulators import IndicatorsEmulatorBase
9
9
10−class SwitchMenu(IndicatorsIntrospectionObject):
10+class SwitchMenu(IndicatorsEmulatorBase):
11 """A switch menu control."""
11 """A switch menu control."""
12
12
13−class Switch(IndicatorsIntrospectionObject):
13+ def setUp(self):
14+ print "PLOP"
15+ super(IndicatorsEmulatorBase, self).setUp()
16+
17+ def switch(self):
18+ self.plop()
19+ ab_switch = self.select_single("CheckBox");
20+ self.assertThat(ab_switch, NotEquals(None))
21+
22+ self.pointing_device.move_to_object(ab_switch)
23+ self.pointing_device.click()
24+
25+class SliderMenu(IndicatorsEmulatorBase):
14− """A switch control."""
26+ """A slider menu control."""
27+
28+ def set_value(self, new_value):
29+ brightness_slider = self.select_single("Slider");
30+ self.assertThat(brightness_slider, NotEquals(None))
31+
32+ self.pointing_device.move_to_object(brightness_slider)
33+
34+ old_ab_value = brightness_slider.value
35+ pixel_ratio = brightness_slider.width / (brightness_slider.maximumValue - brightness_slider.minimumValue)
36+ print pixel_ratio
37+
38+ while True:
39+
40+ pixels_to_move = int(pixel_ratio * (new_value - old_ab_value) / 15)
41+ if pixels_to_move == 0:
42+ break;
43+ print pixels_to_move
44+
45+ self.pointing_device.drag(self.pointing_device.x, self.pointing_device.y, self.pointing_device.x + pixels_to_move, self.pointing_device.y)
46+
47+ old_ab_value = brightness_slider.value
tests/autopilot/indicators_client/emulators/main_window.py−2
@@ -5,8 +5,6 @@
5# under the terms of the GNU General Public License version 3, as published
5# under the terms of the GNU General Public License version 3, as published
6# by the Free Software Foundation.
6# by the Free Software Foundation.
7
7
8−from indicators_client.emulators import IndicatorsIntrospectionObject
9−
10class MainWindow(object):
8class MainWindow(object):
11 """An emulator class that makes it easy to interact with the shell"""
9 """An emulator class that makes it easy to interact with the shell"""
12
10
tests/autopilot/indicators_client/tests/__init__.py+3−1
@@ -15,6 +15,7 @@ from autopilot.matchers import Eventually
15from autopilot.platform import model
15from autopilot.platform import model
16from testtools.matchers import Equals
16from testtools.matchers import Equals
17
17
18+from indicators_client.emulators import IndicatorsEmulatorBase
18from indicators_client.emulators.main_window import MainWindow
19from indicators_client.emulators.main_window import MainWindow
19from logging import getLogger
20from logging import getLogger
20import sys
21import sys
@@ -46,7 +47,8 @@ class IndicatorsTestCase(AutopilotTestCase):
46 def launch_test_local(self):
47 def launch_test_local(self):
47 os.environ['LD_LIBRARY_PATH'] = "../../../unity_build/build/lib"
48 os.environ['LD_LIBRARY_PATH'] = "../../../unity_build/build/lib"
48 os.environ['QML2_IMPORT_PATH'] = "../../builddir/plugins:../../builddir/tests/mocks"
49 os.environ['QML2_IMPORT_PATH'] = "../../builddir/plugins:../../builddir/tests/mocks"
49− self.app = self.launch_test_application("../../builddir/plugins/IndicatorsClient/client/indicators-client")
50+ self.app = self.launch_test_application("../../builddir/plugins/IndicatorsClient/client/indicators-client",
51+ emulator_base=IndicatorsEmulatorBase)
50
52
51 def skipWrapper(*args, **kwargs):
53 def skipWrapper(*args, **kwargs):
52 pass
54 pass
tests/autopilot/indicators_client/tests/test_power.py+5−37
@@ -11,6 +11,7 @@ from testtools.matchers import Equals, NotEquals
11from autopilot.matchers import Eventually
11from autopilot.matchers import Eventually
12
12
13from indicators_client.tests import IndicatorsTestCase
13from indicators_client.tests import IndicatorsTestCase
14+from indicators_client.emulators.common import SwitchMenu, SliderMenu
14from time import sleep
15from time import sleep
15import random
16import random
16import math
17import math
@@ -33,48 +34,15 @@ class TestDisplayMenus(IndicatorsTestCase):
33 # self.main_window.get_indicators_client().reset()
34 # self.main_window.get_indicators_client().reset()
34 super(TestDisplayMenus, self).tearDown()
35 super(TestDisplayMenus, self).tearDown()
35
36
36−
37− # START SECTION
38− # We need to move these to emulators once autopilot supports emulators for
39− # applications started with AutopilotTestCase.launch_test_application
40−
41− def switch_auto_brightness(self, auto_brightness):
42− ab_switch = auto_brightness.select_single("CheckBox");
43− self.assertThat(ab_switch, NotEquals(None))
44−
45− self.pointing_device.move_to_object(ab_switch)
46− self.pointing_device.click()
47−
48− def set_brightness_to_value(self, brightness_menu, new_value):
49− brightness_slider = brightness_menu.select_single("Slider");
50− self.assertThat(brightness_slider, NotEquals(None))
51−
52− self.pointing_device.move_to_object(brightness_slider)
53−
54− old_ab_value = brightness_slider.value
55− pixel_ratio = brightness_slider.width / (brightness_slider.maximumValue - brightness_slider.minimumValue)
56− print pixel_ratio
57−
58− while True:
59−
60− pixels_to_move = int(pixel_ratio * (new_value - old_ab_value) / 15)
61− if pixels_to_move == 0:
62− break;
63− print pixels_to_move
64−
65− self.pointing_device.drag(self.pointing_device.x, self.pointing_device.y, self.pointing_device.x + pixels_to_move, self.pointing_device.y)
66−
67− old_ab_value = brightness_slider.value
68−
69 def test_auto_bright_switch(self):
37 def test_auto_bright_switch(self):
70 """Test the auto-bright switch"""
38 """Test the auto-bright switch"""
71
39
72 auto_brightness = self.app.select_single("SwitchMenu", objectName="auto-brightness")
40 auto_brightness = self.app.select_single("SwitchMenu", objectName="auto-brightness")
73 self.assertThat(auto_brightness, NotEquals(None))
41 self.assertThat(auto_brightness, NotEquals(None))
74
42
75− old_ab_value = auto_brightness.checked
43+ # old_ab_value = auto_brightness.checked
76
44
77− self.switch_auto_brightness(auto_brightness)
45+ auto_brightness.switch()
78
46
79 # TODO - should check backend when it's introspectable.
47 # TODO - should check backend when it's introspectable.
80 self.assertThat(auto_brightness.checked, Eventually(NotEquals(old_ab_value)))
48 self.assertThat(auto_brightness.checked, Eventually(NotEquals(old_ab_value)))
@@ -92,10 +60,10 @@ class TestDisplayMenus(IndicatorsTestCase):
92 if (abs(desired_value - old_ab_value) >= (brightness_menu.maximumValue - brightness_menu.minimumValue)/4):
60 if (abs(desired_value - old_ab_value) >= (brightness_menu.maximumValue - brightness_menu.minimumValue)/4):
93 break;
61 break;
94
62
95− self.set_brightness_to_value(brightness_menu, desired_value)
63+ brightness_menu.set_value(desired_value)
96
64
97 # TODO - should check backend when it's introspectable.
65 # TODO - should check backend when it's introspectable.
98− self.assertThat(auto_brightness.value, Eventually(NotEquals(old_ab_value)))
66+ self.assertThat(brightness_menu.value, Eventually(NotEquals(old_ab_value)))
99
67
100
68
101
69
tests/plugins/IndicatorsClient/fakeindicator.h−8
@@ -41,14 +41,6 @@ public:
41 int initializedCount() const { return m_initializedCount; }
41 int initializedCount() const { return m_initializedCount; }
42 void shutdown() { m_initializedCount--; }
42 void shutdown() { m_initializedCount--; }
43
43
44− IndicatorClientInterface::WidgetsMap widgets()
45− {
46− WidgetsMap w;
47− w.insert("com.canonical.button", QUrl("Button.qml"));
48− w.insert("com.canonical.label", QUrl("Label.qml"));
49− return w;
50− }
51−
52 private:
44 private:
53 int m_initializedCount;
45 int m_initializedCount;
54};
46};
tests/plugins/IndicatorsClient/indicatorsmanagertest.cpp−5
@@ -80,11 +80,6 @@ private Q_SLOTS:
80 QCOMPARE(indicator->description(), QString());
80 QCOMPARE(indicator->description(), QString());
81 QCOMPARE(indicator->priority(), 1);
81 QCOMPARE(indicator->priority(), 1);
82
82
83− IndicatorClientInterface::WidgetsMap widgets = indicator->widgets();
84− QCOMPARE(widgets.count(), 2);
85− QCOMPARE(widgets["com.canonical.button"], QUrl("Button.qml"));
86− QCOMPARE(widgets["com.canonical.label"], QUrl("Label.qml"));
87−
88 // Check that the initial properties have been set.
83 // Check that the initial properties have been set.
89 IndicatorClientInterface::PropertiesMap props = indicator->initialProperties();
84 IndicatorClientInterface::PropertiesMap props = indicator->initialProperties();
90 QCOMPARE(props.count(), 4);
85 QCOMPARE(props.count(), 4);
tests/qmltests/plugins/Ubuntu/ChewieUI/fake_chewie_plugin.cpp−1
@@ -25,6 +25,5 @@ void FakeChewieQmlPlugin::registerTypes(const char *uri)
25// g_type_init();
25// g_type_init();
26// #endif
26// #endif
27
27
28− qmlRegisterUncreatableType<WidgetsMap>(uri, 0, 1, "WidgetsMap", "WidgetsMap must be created by PluginModel");
29 qmlRegisterType<PluginModel>(uri, 0, 1, "PluginModel");
28 qmlRegisterType<PluginModel>(uri, 0, 1, "PluginModel");
30}
29}
tests/qmltests/plugins/Ubuntu/ChewieUI/fake_pluginmodel.cpp−13
@@ -55,8 +55,6 @@ const QList<Indicator> indicator_list = QList<Indicator>()
55PluginModel::PluginModel(QObject *parent)
55PluginModel::PluginModel(QObject *parent)
56 : QAbstractListModel(parent)
56 : QAbstractListModel(parent)
57{
57{
58− m_widgetsMap = new WidgetsMap;
59−
60 QObject::connect(this, SIGNAL(rowsInserted(const QModelIndex &, int, int)), this, SIGNAL(countChanged()));
58 QObject::connect(this, SIGNAL(rowsInserted(const QModelIndex &, int, int)), this, SIGNAL(countChanged()));
61 QObject::connect(this, SIGNAL(rowsRemoved(const QModelIndex &, int, int)), this, SIGNAL(countChanged()));
59 QObject::connect(this, SIGNAL(rowsRemoved(const QModelIndex &, int, int)), this, SIGNAL(countChanged()));
62 QObject::connect(this, SIGNAL(modelReset()), this, SIGNAL(countChanged()));
60 QObject::connect(this, SIGNAL(modelReset()), this, SIGNAL(countChanged()));
@@ -65,7 +63,6 @@ PluginModel::PluginModel(QObject *parent)
65/*! \internal */
63/*! \internal */
66PluginModel::~PluginModel()
64PluginModel::~PluginModel()
67{
65{
68− delete m_widgetsMap;
69}
66}
70
67
71/*!
68/*!
@@ -100,15 +97,6 @@ int PluginModel::count() const
100 return rowCount();
97 return rowCount();
101}
98}
102
99
103−/*!
104− \qmlproperty WidgetsMap PluginModel::widgetsMap
105− This property holds the map for all new widgets registered by dynamically loaded plugins.
106−*/
107−WidgetsMap* PluginModel::widgetsMap() const
108−{
109− return m_widgetsMap;
110−}
111−
112/*!
100/*!
113 \qmlmethod PluginModel::load()
101 \qmlmethod PluginModel::load()
114
102
@@ -126,7 +114,6 @@ void PluginModel::load()
126*/
114*/
127void PluginModel::unload()
115void PluginModel::unload()
128{
116{
129− m_widgetsMap->clear();
130}
117}
131
118
132/*! \internal */
119/*! \internal */
tests/qmltests/plugins/Ubuntu/ChewieUI/fake_pluginmodel.h−30
@@ -23,35 +23,9 @@
23#include <QAbstractListModel>
23#include <QAbstractListModel>
24#include <QQmlEngine>
24#include <QQmlEngine>
25
25
26−
27−class WidgetsMap : public QObject
28−{
29− Q_OBJECT
30−public:
31− WidgetsMap(QObject *parent=0)
32− : QObject(parent)
33− {}
34−
35− void append(QMap<QString, QUrl> types)
36− {
37− Q_FOREACH(QString key, types.keys()) {
38− m_map.insert(key, types[key]);
39− }
40− }
41− void clear() { m_map.clear(); }
42−
43− Q_INVOKABLE QMap<QString, QUrl> map() const { return m_map; }
44− Q_INVOKABLE QUrl find(const QString &widget) const { return m_map[widget]; }
45−
46−private:
47− QMap<QString, QUrl> m_map;
48−};
49−
50−
51class PluginModel : public QAbstractListModel
26class PluginModel : public QAbstractListModel
52{
27{
53 Q_OBJECT
28 Q_OBJECT
54− Q_PROPERTY(WidgetsMap* widgetsMap READ widgetsMap NOTIFY widgetsMapChanged)
55 Q_PROPERTY(int count READ count NOTIFY countChanged)
29 Q_PROPERTY(int count READ count NOTIFY countChanged)
56
30
57public:
31public:
@@ -68,8 +42,6 @@ public:
68 PluginModel(QObject *parent=0);
42 PluginModel(QObject *parent=0);
69 ~PluginModel();
43 ~PluginModel();
70
44
71− WidgetsMap* widgetsMap() const;
72−
73 Q_INVOKABLE void load();
45 Q_INVOKABLE void load();
74 Q_INVOKABLE void unload();
46 Q_INVOKABLE void unload();
75
47
@@ -83,11 +55,9 @@ public:
83 int rowCount(const QModelIndex &parent = QModelIndex()) const;
55 int rowCount(const QModelIndex &parent = QModelIndex()) const;
84
56
85Q_SIGNALS:
57Q_SIGNALS:
86− void widgetsMapChanged(WidgetsMap *widgetsMap);
87 void countChanged();
58 void countChanged();
88
59
89private:
60private:
90− WidgetsMap* m_widgetsMap;
91 int count() const;
61 int count() const;
92};
62};
93
63