on xenial help sign in
more shuffling around. fixed tests
commitfaa9e8d941b9bd14e791be8d022436518274a266 authorNick Dedekind <nicholas.dedekind@gmail.com> dateFri 7 Jun 2013, 14:51 (13 years ago) parent60d4896
116 files changed+1115−1510
CMakeLists.txt+1 Panel/CMakeLists.txt+1 Panel/IndicatorItem.qml+5−4 Panel/IndicatorRow.qml+3−2 Panel/Indicators.qml+1−3 plugins/IndicatorsClient/resources/qml/DatetimeIndicatorIcon.qml → Panel/Indicators/DatetimeIndicatorIcon.qml+1−1 plugins/IndicatorsClient/resources/qml/DatetimeIndicatorPage.qml → Panel/Indicators/DatetimeIndicatorPage.qml+1−1 plugins/IndicatorsClient/resources/qml/DefaultIndicatorIcon.qml → Panel/Indicators/DefaultIndicatorIcon.qml+3−3 plugins/IndicatorsClient/resources/qml/DefaultIndicatorPage.qml → Panel/Indicators/DefaultIndicatorPage.qml+1−1 plugins/IndicatorsClient/indicators/sound/indicatorclient_sound.h → Panel/Indicators/MessagingIndicatorIcon.qml+6−15 plugins/IndicatorsClient/resources/qml/MessagingIndicatorPage.qml → Panel/Indicators/MessagingIndicatorPage.qml+1−1 plugins/IndicatorsClient/resources/qml/NetworkIndicatorIcon.qml → Panel/Indicators/NetworkIndicatorIcon.qml+3−3 plugins/IndicatorsClient/resources/qml/NetworkIndicatorPage.qml → Panel/Indicators/NetworkIndicatorPage.qml+12−4 plugins/IndicatorsClient/indicators/sound/indicatorclient_sound.cpp → Panel/Indicators/SoundIndicatorIcon.qml+5−13 Panel/IndicatorsDataModel.qml+68 Panel/MenuContent.qml+3−3 Panel/Menus/Overview/OverviewGrid.qml+19−24 Panel/graphics/time_and_date@18.png plugins/IndicatorsClient/client/CMakeLists.txt → Panel/indicatorsclient/CMakeLists.txt−5 plugins/IndicatorsClient/indicators/messaging/indicatorclient_messaging.h → Panel/indicatorsclient/IndicatorsClient.qml+19−15 Panel/indicatorsclient/IndicatorsList.qml+64 plugins/IndicatorsClient/indicators/messaging/indicatorclient_messaging.cpp → Panel/indicatorsclient/IndicatorsPage.qml+24−20 plugins/IndicatorsClient/client/indicatorsclient.cpp → Panel/indicatorsclient/indicatorsclient.cpp+4−1 plugins/IndicatorsClient/client/indicatorsclient.h → Panel/indicatorsclient/indicatorsclient.h plugins/IndicatorsClient/client/indicatorsclient.qrc → Panel/indicatorsclient/indicatorsclient.qrc plugins/IndicatorsClient/client/main.cpp → Panel/indicatorsclient/main.cpp plugins/IndicatorsClient/client/qml/IndicatorsClient.qml → Panel/indicatorsclient/qml/IndicatorsClient.qml plugins/IndicatorsClient/client/qml/IndicatorsList.qml → Panel/indicatorsclient/qml/IndicatorsList.qml plugins/IndicatorsClient/client/qml/IndicatorsPage.qml → Panel/indicatorsclient/qml/IndicatorsPage.qml main.cpp+6−7 paths.h.in+6−1 plugins/IndicatorsClient/CMakeLists.txt+3−9 plugins/IndicatorsClient/Network/CMakeLists.txt+30 plugins/IndicatorsClient/indicators/network/networkagent.cpp → plugins/IndicatorsClient/Network/networkagent.cpp plugins/IndicatorsClient/indicators/network/networkagent.h → plugins/IndicatorsClient/Network/networkagent.h plugins/IndicatorsClient/Network/plugin.cpp+31 plugins/IndicatorsClient/Network/plugin.h+32 plugins/IndicatorsClient/indicators/network/secret-agent.c → plugins/IndicatorsClient/Network/secret-agent.c plugins/IndicatorsClient/indicators/network/secret-agent.h → plugins/IndicatorsClient/Network/secret-agent.h plugins/IndicatorsClient/indicator.cpp+85 plugins/IndicatorsClient/indicator.h+62 plugins/IndicatorsClient/indicatorclientinterface.h−124 plugins/IndicatorsClient/indicators/CMakeLists.txt+17−6 plugins/IndicatorsClient/indicators/common/CMakeLists.txt−24 plugins/IndicatorsClient/indicators/common/indicatorclient_common.cpp−159 plugins/IndicatorsClient/indicators/common/indicatorclient_common.h−86 plugins/IndicatorsClient/indicators/datetime/CMakeLists.txt−37 plugins/IndicatorsClient/indicators/datetime/indicatorclient_datetime.cpp−58 plugins/IndicatorsClient/indicators/datetime/indicatorclient_datetime.h−49 plugins/IndicatorsClient/indicators/datetime/indicator-datetime.indicator → plugins/IndicatorsClient/indicators/indicator-datetime.indicator plugins/IndicatorsClient/indicators/messaging/indicator-messaging.indicator → plugins/IndicatorsClient/indicators/indicator-messaging.indicator plugins/IndicatorsClient/indicators/network/indicator-network.indicator → plugins/IndicatorsClient/indicators/indicator-network.indicator plugins/IndicatorsClient/indicators/power/indicator-power.indicator → plugins/IndicatorsClient/indicators/indicator-power.indicator plugins/IndicatorsClient/indicators/sound/indicator-sound.indicator → plugins/IndicatorsClient/indicators/indicator-sound.indicator plugins/IndicatorsClient/indicators/messaging/CMakeLists.txt−36 plugins/IndicatorsClient/indicators/network/CMakeLists.txt−45 plugins/IndicatorsClient/indicators/network/indicatorclient_network.cpp−57 plugins/IndicatorsClient/indicators/network/indicatorclient_network.h−40 plugins/IndicatorsClient/indicators/power/CMakeLists.txt−36 plugins/IndicatorsClient/indicators/power/indicatorclient_power.cpp−33 plugins/IndicatorsClient/indicators/power/indicatorclient_power.h−35 plugins/IndicatorsClient/indicators/sound/CMakeLists.txt−36 plugins/IndicatorsClient/indicatorsfactory.cpp−61 plugins/IndicatorsClient/indicatorsfactory.h−74 plugins/IndicatorsClient/indicatorsmanager.cpp+11−23 plugins/IndicatorsClient/indicatorsmanager.h+3−3 plugins/IndicatorsClient/indicatorsmodel.cpp+103−83 plugins/IndicatorsClient/indicatorsmodel.h+19−9 plugins/IndicatorsClient/qml/ButtonMenu.qml+1−1 plugins/IndicatorsClient/qml/DBusActionState.qml+2−2 plugins/IndicatorsClient/qml/IndicatorIcon.qml+2 plugins/IndicatorsClient/qml/ProgressMenu.qml+1−1 plugins/IndicatorsClient/qml/SliderMenu.qml+2−2 plugins/IndicatorsClient/qml/SwitchMenu.qml+1−1 plugins/IndicatorsClient/qml/TextMenu.qml+1−1 plugins/IndicatorsClient/qml/messaging/GroupedMessage.qml+1−1 plugins/IndicatorsClient/qml/messaging/HeroMessage.qml+1−1 plugins/IndicatorsClient/qml/network/AccessPoint.qml+2−2 plugins/IndicatorsClient/qml/network/qmldir+1 plugins/IndicatorsClient/resources/indicatorclient.qrc−9 plugins/Utils/CMakeLists.txt+1 plugins/Utils/applicationpaths.h+40 plugins/Utils/plugin.cpp+2 tests/autopilot/indicators_client/emulators/__init__.py+2−7 tests/autopilot/indicators_client/emulators/common.py+4−37 tests/autopilot/indicators_client/emulators/main_window.py+2 tests/autopilot/indicators_client/tests/__init__.py+1−3 tests/autopilot/indicators_client/tests/test_power.py+34−4 tests/data/unity/indicators/indicator-fake4.indicator+4 tests/plugins/IndicatorsClient/CMakeLists.txt+1−1 tests/plugins/IndicatorsClient/fakeindicator.h−62 tests/plugins/IndicatorsClient/indicatorsmanagertest.cpp+16−26 tests/plugins/IndicatorsClient/indicatorsmodeltest.cpp+38−30 tests/qmltests/CMakeLists.txt+5−5 tests/qmltests/Panel/tst_IndicatorItem.qml+13−28 tests/qmltests/Panel/tst_IndicatorRow.qml+3−1 tests/qmltests/Panel/tst_MenuContent.qml+9−8 tests/qmltests/Panel/tst_Overview.qml+5−17 tests/qmltests/plugins/CMakeLists.txt+1 tests/qmltests/plugins/IndicatorsClient/CMakeLists.txt+59 tests/qmltests/plugins/IndicatorsClient/IndicatorsModel.qml+76 tests/qmltests/plugins/IndicatorsClient/indicatorsclient_fake.qrc+14 tests/qmltests/plugins/IndicatorsClient/plugin.cpp+30 tests/qmltests/plugins/IndicatorsClient/plugin.h+32 tests/qmltests/Panel/qml/FakeMenuPlugin.qml → tests/qmltests/plugins/IndicatorsClient/qml/FakeMenuPage.qml tests/qmltests/plugins/IndicatorsClient/qml/fake_menu_icon1.qml+7 tests/qmltests/plugins/IndicatorsClient/qml/fake_menu_icon2.qml+7 tests/qmltests/plugins/IndicatorsClient/qml/fake_menu_icon3.qml+7 tests/qmltests/plugins/IndicatorsClient/qml/fake_menu_icon4.qml+7 tests/qmltests/plugins/IndicatorsClient/qml/fake_menu_icon5.qml+7 tests/qmltests/Panel/qml/fake_menu_plugin1.qml → tests/qmltests/plugins/IndicatorsClient/qml/fake_menu_page1.qml+3−2 tests/qmltests/Panel/qml/fake_menu_plugin2.qml → tests/qmltests/plugins/IndicatorsClient/qml/fake_menu_page2.qml+3−2 tests/qmltests/Panel/qml/fake_menu_plugin3.qml → tests/qmltests/plugins/IndicatorsClient/qml/fake_menu_page3.qml+3−2 tests/qmltests/Panel/qml/fake_menu_plugin4.qml → tests/qmltests/plugins/IndicatorsClient/qml/fake_menu_page4.qml+3−2 tests/qmltests/Panel/qml/fake_menu_plugin5.qml → tests/qmltests/plugins/IndicatorsClient/qml/fake_menu_page5.qml+3−2 tests/qmltests/plugins/IndicatorsClient/qmldir+5
CMakeLists.txt+1
@@ -132,6 +132,7 @@ install(FILES ${QML_JS_FILES}
132132
133133# add subdirectories to build
134134add_subdirectory(plugins)
135+add_subdirectory(Panel)
135136
136137# install subdirectories
137138set(QML_DIRS
Panel/CMakeLists.txtnew file+1
@@ -0,0 +1 @@
1+add_subdirectory(indicatorsclient)
Panel/IndicatorItem.qml+5−4
@@ -21,10 +21,10 @@ import IndicatorsClient 0.1 as IndicatorsClient
2121Item {
2222 id: indicatorItem
2323
24− property alias iconUrl: loader.source
24+ property alias iconQml: loader.source
2525 property bool highlighted: false
2626 property bool dimmed: false
27− property var initialProperties: undefined
27+ property var indicatorProperties: undefined
2828
2929 opacity: dimmed ? 0.4 : 1
3030
@@ -39,9 +39,9 @@ Item {
3939 if (status == Loader.Ready) {
4040 item.height = Qt.binding(function() { return indicatorItem.height; })
4141
42− for(var pName in initialProperties) {
42+ for(var pName in indicatorProperties) {
4343 if (item.hasOwnProperty(pName)) {
44− item[pName] = initialProperties[pName]
44+ item[pName] = indicatorProperties[pName]
4545 }
4646 }
4747 }
@@ -55,6 +55,7 @@ Item {
5555
5656 Rectangle {
5757 color: "#dd4814"
58+ objectName: "highlight"
5859 height: units.dp(2)
5960 width: parent.width
6061 anchors.top: parent.bottom
Panel/IndicatorRow.qml+3−2
@@ -60,8 +60,9 @@ Item {
6060
6161 property int ownIndex: index
6262
63− iconUrl: model.iconUrl
64− initialProperties : model.initialProperties
63+ iconQml: model.iconQml
64+
65+ indicatorProperties : model.indicatorProperties
6566 highlighted: indicatorRow.state == "reveal" || indicatorRow.state == "locked" || indicatorRow.state == "commit" ? ownIndex == indicatorRow.currentItemIndex : false
6667 dimmed: { //See FIXME in Indicators regarding the "states" change
6768 if (indicatorRow.state == "initial" || indicatorRow.state == "") {
Panel/Indicators.qml+1−3
@@ -16,7 +16,6 @@
1616
1717import QtQuick 2.0
1818import Ubuntu.Components 0.1
19−import IndicatorsClient 0.1 as IndicatorsClient
2019
2120import "../Components"
2221import "../Components/Math.js" as MathLocal
@@ -222,9 +221,8 @@ Showable {
222221
223222 }
224223
225− IndicatorsClient.IndicatorsModel {
224+ IndicatorsDataModel {
226225 id: indicatorsModel
227− Component.onCompleted: load()
228226 }
229227
230228 Connections {
plugins/IndicatorsClient/resources/qml/DatetimeIndicatorIcon.qml → Panel/Indicators/DatetimeIndicatorIcon.qmlrenamed+1−1
@@ -14,7 +14,7 @@
1414 * along with this program. If not, see <http://www.gnu.org/licenses/>.
1515 *
1616 * Authors:
17− * Renato Araujo Oliveira Filho <renato@canonical.com>
17+ * Nick Dedekind <nick.dedekind@canonical.com>
1818 */
1919
2020import QtQuick 2.0
plugins/IndicatorsClient/resources/qml/DatetimeIndicatorPage.qml → Panel/Indicators/DatetimeIndicatorPage.qmlrenamed+1−1
@@ -32,7 +32,7 @@ Flickable {
3232 left: parent.left
3333 right: parent.right
3434 }
35− source: "qrc:/indicatorsclient/artwork/datetime/time_and_date@18.png"
35+ source: "../graphics/time_and_date@18.png"
3636 fillMode: Image.PreserveAspectFit
3737 }
3838
plugins/IndicatorsClient/resources/qml/DefaultIndicatorIcon.qml → Panel/Indicators/DefaultIndicatorIcon.qmlrenamed+3−3
@@ -14,7 +14,7 @@
1414 * along with this program. If not, see <http://www.gnu.org/licenses/>.
1515 *
1616 * Authors:
17− * Renato Araujo Oliveira Filho <renato@canonical.com>
17+ * Nick Dedekind <nick.dedekind@canonical.com>
1818 */
1919
2020import QtQuick 2.0
@@ -43,8 +43,8 @@ IndicatorsClient.IndicatorIcon {
4343 id: itemImage
4444 objectName: "itemImage"
4545 visible: source != ""
46− height: units.gu(2.5)
47− width: units.gu(2.5)
46+ height: indicatorIcon.iconSize
47+ width: indicatorIcon.iconSize
4848 anchors.verticalCenter: parent.verticalCenter
4949 }
5050
plugins/IndicatorsClient/resources/qml/DefaultIndicatorPage.qml → Panel/Indicators/DefaultIndicatorPage.qmlrenamed+1−1
@@ -14,7 +14,7 @@
1414 * along with this program. If not, see <http://www.gnu.org/licenses/>.
1515 *
1616 * Authors:
17− * Renato Araujo Oliveira Filho <renato@canonical.com>
17+ * Nick Dedekind <nick.dedekind@canonical.com>
1818 */
1919
2020import QtQuick 2.0
plugins/IndicatorsClient/indicators/sound/indicatorclient_sound.h → Panel/Indicators/MessagingIndicatorIcon.qmlrenamed+6−15
@@ -14,21 +14,12 @@
1414 * along with this program. If not, see <http://www.gnu.org/licenses/>.
1515 *
1616 * Authors:
17− * Renato Araujo Oliveira Filho <renato@canonical.com>
17+ * Nick Dedekind <nick.dedekind@canonical.com>
1818 */
1919
20−#ifndef INDICATORCLIENT_SOUND_H
21−#define INDICATORCLIENT_SOUND_H
20+import QtQuick 2.0
2221
23−#include "indicatorclient_common.h"
24−
25−class IndicatorClientSound : public IndicatorClientCommon
26−{
27− Q_OBJECT
28−public:
29− IndicatorClientSound(QObject *parent=0);
30−
31− void init(const QSettings& settings);
32−};
33−
34−#endif
22+DefaultIndicatorIcon {
23+ // default the icon so we have something to show when we don't have the bus.
24+ iconSource: "image://gicon/messages"
25+}
plugins/IndicatorsClient/resources/qml/MessagingIndicatorPage.qml → Panel/Indicators/MessagingIndicatorPage.qmlrenamed+1−1
@@ -14,7 +14,7 @@
1414 * along with this program. If not, see <http://www.gnu.org/licenses/>.
1515 *
1616 * Authors:
17− * Renato Araujo Oliveira Filho <renato.filho@canonical.com>
17+ * Nick Dedekind <nick.dedekind@canonical.com>
1818 */
1919
2020import QtQuick 2.0
plugins/IndicatorsClient/resources/qml/NetworkIndicatorIcon.qml → Panel/Indicators/NetworkIndicatorIcon.qmlrenamed+3−3
@@ -14,7 +14,7 @@
1414 * along with this program. If not, see <http://www.gnu.org/licenses/>.
1515 *
1616 * Authors:
17− * Renato Araujo Oliveira Filho <renato@canonical.com>
17+ * Nick Dedekind <nick.dedekind@canonical.com>
1818 */
1919
2020import QtQuick 2.0
@@ -34,8 +34,8 @@ IndicatorsClient.IndicatorIcon {
3434 objectName: "itemImage"
3535 source: get_icon_for_signal(connectionState, signalStrength)
3636 visible: source != ""
37− height: units.gu(2.5)
38− width: units.gu(2.5)
37+ height: indicatorIcon.iconSize
38+ width: indicatorIcon.iconSize
3939 anchors {
4040 verticalCenter: parent.verticalCenter
4141 horizontalCenter: parent.horizontalCenter
plugins/IndicatorsClient/resources/qml/NetworkIndicatorPage.qml → Panel/Indicators/NetworkIndicatorPage.qmlrenamed+12−4
@@ -19,8 +19,8 @@
1919
2020import QtQuick 2.0
2121import IndicatorsClient 0.1 as IndicatorsClient
22+import IndicatorsClient.Network 0.1 as ICNetwork
2223import Ubuntu.Components 0.1
23−import NetworkSettings 0.1
2424
2525PageStack {
2626 id: _network
@@ -43,12 +43,20 @@ PageStack {
4343 }
4444 }
4545
46− NetworkAgent {
46+ Component {
47+ id: passwordPageComponent
48+
49+ ICNetwork.PasswordPage {
50+ agent: networkAgent
51+ token: token
52+ }
53+ }
54+
55+ ICNetwork.NetworkAgent {
4756 id: networkAgent
4857
4958 onSecretRequested: {
50− _network.push(Qt.createComponent("PasswordPage.qml"),
51− {"agent" : networkAgent, "token" : token})
59+ _network.push(passwordPageComponent)
5260 }
5361 }
5462
plugins/IndicatorsClient/indicators/sound/indicatorclient_sound.cpp → Panel/Indicators/SoundIndicatorIcon.qmlrenamed+5−13
@@ -14,20 +14,12 @@
1414 * along with this program. If not, see <http://www.gnu.org/licenses/>.
1515 *
1616 * Authors:
17− * Renato Araujo Oliveira Filho <renato@canonical.com>
17+ * Nick Dedekind <nick.dedekind@canonical.com>
1818 */
1919
20−#include "indicatorclient_sound.h"
20+import QtQuick 2.0
2121
22−IndicatorClientSound::IndicatorClientSound(QObject *parent)
23− : IndicatorClientCommon(parent)
24−{
25− setTitle("Sound");
26− setPriority(IndicatorPriority::SOUND);
27−}
28−
29−
30−void IndicatorClientSound::init(const QSettings& settings)
31−{
32− IndicatorClientCommon::init(settings);
22+DefaultIndicatorIcon {
23+ // default the icon so we have something to show when we don't have the bus.
24+ iconSource: "image://gicon/audio-volume-high"
3325}
Panel/IndicatorsDataModel.qmlnew file+68
@@ -0,0 +1,68 @@
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 QtQuick 2.0
21+import IndicatorsClient 0.1
22+import Utils 0.1
23+
24+IndicatorsModel {
25+ id: ic_model
26+
27+ Component.onCompleted: load()
28+
29+ property var applicationPaths: ApplicationPaths {}
30+
31+ indicatorData : {
32+ 'indicator-messaging' : {
33+ 'title': 'Messaging',
34+ 'description' : '',
35+ 'priority': 10,
36+ 'iconQml' : applicationPaths.shellAppDirectory()+'/Panel/Indicators/MessagingIndicatorIcon.qml',
37+ 'pageQml' : applicationPaths.shellAppDirectory()+'/Panel/Indicators/MessagingIndicatorPage.qml'
38+ },
39+ 'indicator-sound' : {
40+ 'title': 'Sound',
41+ 'description' : '',
42+ 'priority': 20,
43+ 'iconQml' : applicationPaths.shellAppDirectory()+'/Panel/Indicators/SoundIndicatorIcon.qml',
44+ 'pageQml' : applicationPaths.shellAppDirectory()+'/Panel/Indicators/DefaultIndicatorPage.qml'
45+ },
46+ 'indicator-network' : {
47+ 'title': 'Networks',
48+ 'description' : '',
49+ 'priority': 30,
50+ 'iconQml' : applicationPaths.shellAppDirectory()+'/Panel/Indicators/NetworkIndicatorIcon.qml',
51+ 'pageQml' : applicationPaths.shellAppDirectory()+'/Panel/Indicators/NetworkIndicatorPage.qml'
52+ },
53+ 'indicator-power' : {
54+ 'title': 'Battery',
55+ 'description' : '',
56+ 'priority': 40,
57+ 'iconQml' : applicationPaths.shellAppDirectory()+'/Panel/Indicators/DefaultIndicatorIcon.qml',
58+ 'pageQml' : applicationPaths.shellAppDirectory()+'/Panel/Indicators/DefaultIndicatorPage.qml'
59+ },
60+ 'indicator-datetime' : {
61+ 'title': 'Date and Time',
62+ 'description' : '',
63+ 'priority': 100,
64+ 'iconQml' : applicationPaths.shellAppDirectory()+'/Panel/Indicators/DatetimeIndicatorIcon.qml',
65+ 'pageQml' : applicationPaths.shellAppDirectory()+'/Panel/Indicators/DatetimeIndicatorPage.qml'
66+ }
67+ }
68+}
Panel/MenuContent.qml+3−3
@@ -94,7 +94,7 @@ Rectangle {
9494
9595 width: menus.width
9696 height: menus.height
97− source: pageUrl
97+ source: pageQml
9898 visible: content.__shown
9999 onVisibleChanged: {
100100 // Reset the indicator states
@@ -106,9 +106,9 @@ Rectangle {
106106
107107 onStatusChanged: {
108108 if (status == Loader.Ready) {
109− for(var pName in initialProperties) {
109+ for(var pName in indicatorProperties) {
110110 if (item.hasOwnProperty(pName)) {
111− item[pName] = initialProperties[pName]
111+ item[pName] = indicatorProperties[pName]
112112 }
113113 }
114114 if (contentActive && menus.visible) {
Panel/Menus/Overview/OverviewGrid.qml+19−24
@@ -56,34 +56,29 @@ Item {
5656 interactive: false
5757 delegate:
5858 AbstractButton {
59+ id: indicatorButton
5960 objectName: "overviewGridButton" + index
6061 width: grid.cellWidth
6162 height: grid.cellHeight
62− Image {
63− id: imageIcon
64− objectName: "overviewGridButtonImage"
65− source: iconSource
66− width: units.gu(4)
67− height: units.gu(4)
68− anchors {
69− centerIn: parent
70− verticalCenterOffset: -units.gu(1)
71− }
72− sourceSize.width: width
73− sourceSize.height: height
74− visible: labelIcon.text === ""
75− }
7663
77− Label {
78− id: labelIcon
79− text: label
80− color: "#f3f3e7"
81− opacity: 0.8
82− font.family: "Ubuntu"
83− fontSize: "large"
84− anchors {
85− centerIn: parent
86− verticalCenterOffset: -units.gu(1)
64+ Loader {
65+ id: loader
66+ source: iconQml
67+
68+ onStatusChanged: {
69+ item.width = units.gu(5)
70+ item.height = units.gu(5)
71+
72+ item.x = Qt.binding(function() { return indicatorButton.width/2 - item.width/2; })
73+ item.y = Qt.binding(function() { return indicatorButton.height/2 - item.height/2 - units.gu(1); })
74+
75+ if (status == Loader.Ready) {
76+ for(var pName in indicatorProperties) {
77+ if (item.hasOwnProperty(pName)) {
78+ item[pName] = indicatorProperties[pName]
79+ }
80+ }
81+ }
8782 }
8883 }
8984
Panel/graphics/time_and_date@18.pngnew file

Binary file not shown.

plugins/IndicatorsClient/client/CMakeLists.txt → Panel/indicatorsclient/CMakeLists.txtrenamed−5
@@ -9,13 +9,8 @@ set(INDICATORS_CLIENT_SRC
99set(INDICATORS_CLIENT_HEADERS
1010 indicatorsclient.h
1111)
12−
13−qt5_add_resources(INDICATORS_CLIENT_RESOURCES_RCC
14− indicatorsclient.qrc)
15−
1612add_executable(${INDICATORS_CLIENT_APP}
1713 ${INDICATORS_CLIENT_SRC}
18− ${INDICATORS_CLIENT_RESOURCES_RCC}
1914 ${INDICATORS_CLIENT_HEADERS}
2015)
2116
plugins/IndicatorsClient/indicators/messaging/indicatorclient_messaging.h → Panel/indicatorsclient/IndicatorsClient.qmlrenamed+19−15
@@ -15,24 +15,28 @@
1515 *
1616 * Authors:
1717 * Renato Araujo Oliveira Filho <renato@canonical.com>
18− * Olivier Tilloy <olivier.tilloy@canonical.com>
1918 */
2019
21−#ifndef INDICATORCLIENT_MESSAGING_H
22−#define INDICATORCLIENT_MESSAGING_H
20+import QtQuick 2.0
21+import Ubuntu.Components 0.1
22+import Ubuntu.Components.ListItems 0.1 as ListItem
2323
24−#include "indicatorclient_common.h"
24+Rectangle {
25+ color: "black"
26+ id: root
2527
26−class IndicatorClientMessaging : public IndicatorClientCommon
27−{
28− Q_OBJECT
29−public:
30− IndicatorClientMessaging(QObject *parent=0);
31− ~IndicatorClientMessaging();
28+ PageStack {
29+ id: pages
3230
33− void init(const QSettings& settings);
31+ anchors.fill: parent
32+ Component.onCompleted: root.reset()
33+ }
3434
35− QUrl pageComponentSource() const;
36−};
37−
38−#endif
35+ function reset() {
36+ pages.clear();
37+ var component = Qt.createComponent("IndicatorsList.qml")
38+ var page = component.createObject(pages)
39+ console.log(component.errorString())
40+ pages.push(page);
41+ }
42+}
Panel/indicatorsclient/IndicatorsList.qmlnew file+64
@@ -0,0 +1,64 @@
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 QtQuick 2.0
21+import Ubuntu.Components 0.1
22+import Ubuntu.Components.ListItems 0.1 as ListItem
23+import IndicatorsClient 0.1 as IndicatorsClient
24+import ".."
25+
26+Page {
27+ id: page
28+ anchors.fill: parent
29+ title: "Plugin list"
30+
31+ IndicatorsDataModel {
32+ id: indicatorsModel
33+ }
34+
35+ ListView {
36+ id: mainMenu
37+ objectName: "mainMenu"
38+ anchors.fill: parent
39+ model: indicatorsModel
40+
41+ delegate: IndicatorsClient.Menu {
42+ anchors.left: parent.left
43+ anchors.right: parent.right
44+ height: implicitHeight
45+ progression: isValid
46+ objectName: identifier
47+
48+ Label {
49+ anchors.left: parent.left
50+ anchors.leftMargin: units.gu(0.5)
51+ anchors.verticalCenter: parent.verticalCenter
52+ text: title
53+ }
54+
55+ onClicked: {
56+ if (progression) {
57+ var page = Qt.createComponent("IndicatorsPage.qml")
58+ pages.push(page.createObject(pages), {"indicatorProperties" : model.indicatorProperties, "pageQml" : model.pageQml})
59+ }
60+ }
61+ }
62+ }
63+}
64+
plugins/IndicatorsClient/indicators/messaging/indicatorclient_messaging.cpp → Panel/indicatorsclient/IndicatorsPage.qmlrenamed+24−20
@@ -15,31 +15,35 @@
1515 *
1616 * Authors:
1717 * Renato Araujo Oliveira Filho <renato@canonical.com>
18− * Olivier Tilloy <olivier.tilloy@canonical.com>
1918 */
2019
21−#include "indicatorclient_messaging.h"
20+import QtQuick 2.0
21+import Ubuntu.Components 0.1
2222
23−#include <QUrl>
24−#include <QtPlugin>
23+Page {
24+ id: _page
2525
26−IndicatorClientMessaging::IndicatorClientMessaging(QObject *parent)
27− : IndicatorClientCommon(parent)
28−{
29− setTitle("Messages");
30− setPriority(IndicatorPriority::MESSAGING);
31−}
26+ title: indicatorProperties && indicatorProperties.title ? indicatorProperties.title : ""
27+ property variant indicatorProperties
28+ property alias pageQml : page_loader.source
3229
33−IndicatorClientMessaging::~IndicatorClientMessaging()
34−{
35−}
30+ anchors.fill: parent
3631
37−void IndicatorClientMessaging::init(const QSettings& settings)
38−{
39− IndicatorClientCommon::init(settings);
40−}
32+ Loader {
33+ id: page_loader
34+ objectName: "page_loader"
35+
36+ anchors.fill: parent
4137
42−QUrl IndicatorClientMessaging::pageComponentSource() const
43−{
44− return QUrl("qrc:/indicatorsclient/qml/MessagingIndicatorPage.qml");
38+ onStatusChanged: {
39+ if (status == Loader.Ready) {
40+ for(var pName in indicatorProperties) {
41+ if (item.hasOwnProperty(pName)) {
42+ item[pName] = indicatorProperties[pName]
43+ }
44+ }
45+ item.start()
46+ }
47+ }
48+ }
4549}
plugins/IndicatorsClient/client/indicatorsclient.cpp → Panel/indicatorsclient/indicatorsclient.cpprenamed+4−1
@@ -19,6 +19,7 @@
1919 */
2020
2121#include "indicatorsclient.h"
22+#include "paths.h"
2223
2324#include <QQuickView>
2425#include <QQmlContext>
@@ -44,8 +45,10 @@ IndicatorsClient::~IndicatorsClient()
4445void IndicatorsClient::setupUI()
4546{
4647 m_view = new QQuickView;
48+ m_view->engine()->setBaseUrl(QUrl::fromLocalFile(::shellAppDirectory()+"Panel/indicatorsclient/"));
49+ m_view->engine()->addImportPath(::shellImportPath());
4750
48− m_view->setSource(QUrl("qrc:qml/IndicatorsClient.qml"));
51+ m_view->setSource(QUrl("IndicatorsClient.qml"));
4952 m_view->setResizeMode(QQuickView::SizeRootObjectToView);
5053
5154 //Usable size on desktop
plugins/IndicatorsClient/client/indicatorsclient.h → Panel/indicatorsclient/indicatorsclient.hrenamed

The content is the same.

plugins/IndicatorsClient/client/indicatorsclient.qrc → Panel/indicatorsclient/indicatorsclient.qrcrenamed

The content is the same.

plugins/IndicatorsClient/client/main.cpp → Panel/indicatorsclient/main.cpprenamed

The content is the same.

plugins/IndicatorsClient/client/qml/IndicatorsClient.qml → Panel/indicatorsclient/qml/IndicatorsClient.qmlrenamed

The content is the same.

plugins/IndicatorsClient/client/qml/IndicatorsList.qml → Panel/indicatorsclient/qml/IndicatorsList.qmlrenamed

The content is the same.

plugins/IndicatorsClient/client/qml/IndicatorsPage.qml → Panel/indicatorsclient/qml/IndicatorsPage.qmlrenamed

The content is the same.

main.cpp+6−7
@@ -22,13 +22,14 @@
2222#include <QtGui/QIcon>
2323#include <QtGui/QGuiApplication>
2424#include <QtQml/QQmlEngine>
25+#include <QtQml/QQmlContext>
2526#include <qpa/qplatformnativeinterface.h>
2627#include <QLibrary>
2728#include <libintl.h>
2829
2930// local
30−#include "paths.h"
3131#include "MouseTouchAdaptor.h"
32+#include "paths.h"
3233
3334namespace {
3435/* When you append and import path to the list of import paths it will be the *last*
@@ -88,7 +89,7 @@ int main(int argc, char** argv)
8889 QQuickView* view = new QQuickView();
8990 view->setResizeMode(QQuickView::SizeRootObjectToView);
9091 view->setTitle("Qml Phone Shell");
91− view->engine()->setBaseUrl(QUrl::fromLocalFile(shellAppDirectory()));
92+ view->engine()->setBaseUrl(QUrl::fromLocalFile(::shellAppDirectory()));
9293 if (args.contains(QLatin1String("-frameless"))) {
9394 view->setFlags(Qt::FramelessWindowHint);
9495 }
@@ -111,12 +112,10 @@ int main(int argc, char** argv)
111112 nativeInterface->setProperty("ubuntuSessionType", 1);
112113 view->setProperty("role", 2); // INDICATOR_ACTOR_ROLE
113114
114− QObject::connect(view->engine(), SIGNAL(quit()), qApp, SLOT(quit()));
115−
116115 QUrl source("Shell.qml");
117− view->engine()->addImportPath(shellAppDirectory());
118− view->engine()->addImportPath(shellImportPath());
119− appendImportPath(view->engine(), fakePluginsImportPath());
116+ view->engine()->addImportPath(::shellAppDirectory());
117+ view->engine()->addImportPath(::shellImportPath());
118+ appendImportPath(view->engine(), ::fakePluginsImportPath());
120119 view->setSource(source);
121120 view->setColor("transparent");
122121
paths.h.in+6−1
@@ -17,6 +17,9 @@
1717 * along with this program. If not, see <http://www.gnu.org/licenses/>.
1818 */
1919
20+#ifndef PATHS_H
21+#define PATHS_H
22+
2023// Qt
2124#include <QtCore/QCoreApplication>
2225#include <QtCore/QDir>
@@ -62,7 +65,7 @@ inline QString fakePluginsImportPath() {
6265
6366inline QStringList shellDataDirs() {
6467 QStringList dirs = QStandardPaths::standardLocations(QStandardPaths::GenericDataLocation);
65− if (!isRunningInstalled()) {
68+ if (!isRunningInstalled() && getenv("UNITY_TEST_ENV")==NULL) {
6669 dirs.prepend("@CMAKE_BINARY_DIR@/share");
6770 }
6871 return dirs;
@@ -71,3 +74,5 @@ inline QStringList shellDataDirs() {
7174inline QString sourceDirectory() {
7275 return QString("@CMAKE_SOURCE_DIR@/");
7376}
77+
78+#endif
plugins/IndicatorsClient/CMakeLists.txt+3−9
@@ -14,13 +14,13 @@ else()
1414 message(WARNING "Missing glib or libnm dependency for the network plugin, not building")
1515endif()
1616
17−
1817add_subdirectory(indicators)
19−add_subdirectory(client)
2018add_subdirectory(qml)
2119
2220if(NETWORK_PLUGIN_ENABLED)
2321 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DNETWORK_PLUGIN_ENABLED" )
22+
23+ add_subdirectory(Network)
2424endif()
2525
2626include_directories(
@@ -30,12 +30,11 @@ include_directories(
3030 ${Qt5Quick_INCLUDE_DIRS}
3131 ${GLIB_INCLUDE_DIRS}
3232 ${QMENUMODEL_INCLUDE_DIRS}
33− ${indicatorclient_common_SOURCE_DIR}
3433)
3534
3635set(IndicatorsClientQML_SOURCES
3736 flatmenuproxymodel.cpp
38− indicatorsfactory.cpp
37+ indicator.cpp
3938 indicatorsmanager.cpp
4039 indicatorsmodel.cpp
4140 plugin.cpp
@@ -64,11 +63,6 @@ target_link_libraries(IndicatorsClientQml
6463 ${Qt5Quick_LIBRARIES}
6564 ${GOBJECT_LDFLAGS}
6665 ${QMENUMODEL_LDFLAGS}
67− indicatorclient_datetime
68− indicatorclient_messaging
69− indicatorclient_power
70− indicatorclient_sound
71− indicatorclient_network
7266)
7367
7468qt5_use_modules(IndicatorsClientQml Qml)
plugins/IndicatorsClient/Network/CMakeLists.txtnew file+30
@@ -0,0 +1,30 @@
1+project(IndicatorsClientNetworkQml)
2+
3+set(INDICATORCLIENT_NETWORK_SRC
4+ networkagent.cpp
5+ plugin.cpp
6+ secret-agent.c
7+)
8+
9+add_library(IndicatorsClientNetworkQml MODULE
10+ ${INDICATORCLIENT_NETWORK_SRC}
11+)
12+
13+qt5_use_modules(IndicatorsClientNetworkQml Core Qml Widgets)
14+
15+set_target_properties(IndicatorsClientNetworkQml PROPERTIES COMPILE_FLAGS -fPIC)
16+
17+include_directories(
18+ ${CMAKE_CURRENT_SOURCE_DIR}
19+ ${GLIB_INCLUDE_DIRS}
20+ ${QMENUMODEL_INCLUDE_DIRS}
21+ ${LIBNM_GLIB_INCLUDE_DIRS}
22+ ${LIBNM_UTIL_INCLUDE_DIRS}
23+)
24+
25+target_link_libraries(IndicatorsClientNetworkQml
26+ ${GLIB_LIBRARIES}
27+ ${QMENUMODEL_LDFLAGS}
28+ ${LIBNM_GLIB_LIBRARIES}
29+ ${LIBNM_UTIL_LIBRARIES}
30+)
plugins/IndicatorsClient/indicators/network/networkagent.cpp → plugins/IndicatorsClient/Network/networkagent.cpprenamed

The content is the same.

plugins/IndicatorsClient/indicators/network/networkagent.h → plugins/IndicatorsClient/Network/networkagent.hrenamed

The content is the same.

plugins/IndicatorsClient/Network/plugin.cppnew file+31
@@ -0,0 +1,31 @@
1+/*
2+ * Copyright (C) 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 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+ * Author: Michał Sawicz <michal.sawicz@canonical.com>
17+ */
18+
19+// Qt
20+#include <QtQml>
21+
22+// self
23+#include "plugin.h"
24+
25+// local
26+#include "networkagent.h"
27+
28+void IndicatorsClientNetworkPlugin::registerTypes(const char *uri)
29+{
30+ qmlRegisterType<NetworkAgent>(uri, 0, 1, "NetworkAgent");
31+}
plugins/IndicatorsClient/Network/plugin.hnew file+32
@@ -0,0 +1,32 @@
1+/*
2+ * Copyright (C) 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 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+ * Author: Nick Dedekind <nick.dedekind@canonical.com>
17+ */
18+
19+#ifndef INDICATORSCLIENT_NETWORK_PLUGIN_H
20+#define INDICATORSCLIENT_NETWORK_PLUGIN_H
21+
22+#include <QtQml/QQmlExtensionPlugin>
23+
24+class IndicatorsClientNetworkPlugin : public QQmlExtensionPlugin
25+{
26+ Q_OBJECT
27+ Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
28+public:
29+ void registerTypes(const char *uri);
30+};
31+
32+#endif // INDICATORSCLIENT_NETWORK_PLUGIN_H
plugins/IndicatorsClient/indicators/network/secret-agent.c → plugins/IndicatorsClient/Network/secret-agent.crenamed

The content is the same.

plugins/IndicatorsClient/indicators/network/secret-agent.h → plugins/IndicatorsClient/Network/secret-agent.hrenamed

The content is the same.

plugins/IndicatorsClient/indicator.cppnew file+85
@@ -0,0 +1,85 @@
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+#include "indicator.h"
21+
22+#include <QUrl>
23+#include <QtPlugin>
24+#include <QResource>
25+#include <QDebug>
26+#include <QFileInfo>
27+#include <QDir>
28+#include <QQmlEngine>
29+#include <QQmlContext>
30+#include <QJsonObject>
31+
32+#include <qdbusmenumodel.h>
33+#include <qdbusactiongroup.h>
34+#include <qstateaction.h>
35+
36+Indicator::Indicator(QObject *parent)
37+ : QObject(parent)
38+{
39+}
40+
41+Indicator::~Indicator()
42+{
43+}
44+
45+void Indicator::init(const QSettings& settings)
46+{
47+ setId(settings.value("Indicator Service/Name").toString());
48+ QString dbusService = settings.value("Indicator Service/DBusName").toString();
49+ QString objectPath = settings.value("Indicator Service/ObjectPath").toString();
50+
51+ QVariantMap properties;
52+ properties.clear();
53+ properties.insert("busType", 1);
54+ properties.insert("busName", dbusService);
55+ properties.insert("objectPath", objectPath);
56+ setIndicatorProperties(properties);
57+}
58+
59+QString Indicator::identifier() const
60+{
61+ return m_identifier;
62+}
63+
64+void Indicator::setId(const QString &identifier)
65+{
66+ if (identifier != m_identifier) {
67+ m_identifier = identifier;
68+ Q_EMIT identifierChanged(m_identifier);
69+ }
70+}
71+
72+
73+QVariant Indicator::indicatorProperties() const
74+{
75+ return m_properties;
76+}
77+
78+void Indicator::setIndicatorProperties(const QVariant &properties)
79+{
80+ if (m_properties != properties)
81+ {
82+ m_properties = properties;
83+ Q_EMIT indicatorPropertiesChanged(m_properties);
84+ }
85+}
plugins/IndicatorsClient/indicator.hnew file+62
@@ -0,0 +1,62 @@
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+ * Nick Dedekind <nick.dedekind@canonical.com>
19+ */
20+
21+#ifndef INDICATOR_H
22+#define INDICATOR_H
23+
24+#include <QObject>
25+#include <QSettings>
26+#include <memory>
27+
28+class QDBusActionGroup;
29+class QDBusMenuModel;
30+class QStateAction;
31+
32+class Indicator : public QObject
33+{
34+ Q_OBJECT
35+ Q_PROPERTY(QString identifier READ identifier NOTIFY identifierChanged)
36+ Q_PROPERTY(QVariant indicatorProperties READ indicatorProperties NOTIFY indicatorPropertiesChanged)
37+
38+public:
39+ typedef std::shared_ptr<Indicator> Ptr;
40+
41+ Indicator(QObject *parent = 0);
42+ virtual ~Indicator();
43+
44+ void init(const QSettings& settings);
45+
46+ QString identifier() const;
47+ QVariant indicatorProperties() const;
48+
49+Q_SIGNALS:
50+ void identifierChanged(const QString &identifier);
51+ void indicatorPropertiesChanged(const QVariant &properties);
52+
53+protected:
54+ void setId(const QString &id);
55+ void setIndicatorProperties(const QVariant &properties);
56+
57+private:
58+ QString m_identifier;
59+ QVariant m_properties;
60+};
61+
62+#endif // INDICATOR_H
plugins/IndicatorsClient/indicatorclientinterface.hdeleted−124
@@ -1,124 +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−#ifndef INDICATORCLIENTININTERFACE_H
21−#define INDICATORCLIENTININTERFACE_H
22−
23−#include <QMap>
24−#include <QString>
25−#include <QUrl>
26−#include <QObject>
27−#include <QQmlComponent>
28−#include <QQmlEngine>
29−#include <QSettings>
30−
31−#include <memory>
32−
33−class IndicatorClientInterface
34−{
35−public:
36− typedef QMap<QString, QVariant> PropertiesMap;
37−
38− typedef std::shared_ptr<IndicatorClientInterface> Ptr;
39−
40− enum IndicatorPriority {
41− MESSAGING = 0,
42− SOUND = 10,
43− NETWORK = 20,
44− POWER = 30,
45− DATETIME = 100
46− };
47− /**
48− * @brief This fuction will be called by PluginManager after create the plugin object
49− * @param config The dbus configuration used by this plugin
50− */
51− virtual void init(const QSettings& settings) = 0;
52−
53− /**
54− * @brief This function will be called by PluginManager before destroy the plugin
55− */
56− virtual void shutdown() = 0;
57−
58− /**
59− * @brief Used to retrieve the current plugin identifier
60− * @return The identifier
61− *
62− * This function can be used to retrieve the indicator identifier
63− */
64− virtual QString identifier() const = 0;
65−
66− /**
67− * @brief Used to retrieve the current plugin title
68− * @return The title
69− *
70− * This function can be used to retrieve the indicator title which can be used as plugin name on the menu
71− */
72− virtual QString title() const = 0;
73−
74− /**
75− * @brief Used to retrieve the current plugin label
76− * @return The label
77− *
78− * This function can be used to retrieve the indicator label which can appear in the panel
79− */
80− virtual QString label() const = 0;
81−
82− /**
83− * @brief Used to retrieve the current plugin label
84− * @return The label
85− *
86− * This function can be used to retrieve the indicator description which can appear in the panel
87− */
88− virtual QString description() const = 0;
89−
90− /**
91− * @brief Used to retrieve the current plugin visibility
92− * @return The visibility
93− *
94− * This function can be used to retrieve the indicator is visible on the panel or not
95− */
96− virtual bool visible() const = 0;
97−
98− /**
99− * @brief Used to retrieve the current plugin priority
100− * @return The priorty value for the plugin, this will be used to arrange the plugin on the indicator panel
101− */
102− virtual int priority() const = 0;
103−
104− /**
105− * @brief Used to retrieve the icon component source file
106− * @return The icon component url
107− */
108− virtual QUrl iconComponentSource() const = 0;
109−
110− /**
111− * @brief Used to retrieve the plugin page component source file
112− * @return A url pointing to the component source file
113− */
114− virtual QUrl pageComponentSource() const = 0;
115−
116− /**
117− * @brief Used during the plugin Component instanciation to set the initial properties
118− * @return The map with the initial property and value: {'property-name' : property-value}
119− */
120−
121− virtual PropertiesMap initialProperties() = 0;
122−};
123−
124−#endif
plugins/IndicatorsClient/indicators/CMakeLists.txt+17−6
@@ -1,6 +1,17 @@
1−add_subdirectory(common)
2−add_subdirectory(messaging)
3−add_subdirectory(sound)
4−add_subdirectory(power)
5−add_subdirectory(datetime)
6−add_subdirectory(network)
1+set(INDICATOR_FILES
2+ ${CMAKE_CURRENT_SOURCE_DIR}/indicator-datetime.indicator
3+ ${CMAKE_CURRENT_SOURCE_DIR}/indicator-messaging.indicator
4+ ${CMAKE_CURRENT_SOURCE_DIR}/indicator-network.indicator
5+ ${CMAKE_CURRENT_SOURCE_DIR}/indicator-power.indicator
6+ ${CMAKE_CURRENT_SOURCE_DIR}/indicator-sound.indicator
7+)
8+
9+# copy indicators file into build directory for shadow builds
10+file(COPY ${INDICATOR_FILES}
11+ DESTINATION ${CMAKE_BINARY_DIR}/share/unity/indicators
12+)
13+
14+# install indicator file
15+install(FILES ${INDICATOR_FILES}
16+ DESTINATION ${CMAKE_INSTALL_DATADIR}/unity/indicators
17+)
plugins/IndicatorsClient/indicators/common/CMakeLists.txtdeleted−24
@@ -1,24 +0,0 @@
1−project(indicatorclient_common)
2−
3−set(INDICATORCLIENT_COMMON_SRC
4− indicatorclient_common.cpp
5−)
6−
7−add_library(indicatorclient_common STATIC
8− ${INDICATORCLIENT_COMMON_RESOURCES_RCC}
9− ${INDICATORCLIENT_COMMON_SRC}
10−)
11−
12−qt5_use_modules(indicatorclient_common Core Qml)
13−
14−set_target_properties(indicatorclient_common PROPERTIES COMPILE_FLAGS -fPIC)
15−
16−include_directories(
17− ${CMAKE_CURRENT_SOURCE_DIR}
18− ${QMENUMODEL_INCLUDE_DIRS}
19− ${IndicatorsClientQml_SOURCE_DIR}
20−)
21−
22−target_link_libraries(indicatorclient_common
23− ${QMENUMODEL_LDFLAGS}
24−)
plugins/IndicatorsClient/indicators/common/indicatorclient_common.cppdeleted−159
@@ -1,159 +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−#include "indicatorclient_common.h"
21−
22−#include <QUrl>
23−#include <QtPlugin>
24−#include <QResource>
25−#include <QDebug>
26−#include <QFileInfo>
27−#include <QDir>
28−#include <QQmlEngine>
29−#include <QQmlContext>
30−#include <QJsonObject>
31−
32−#include <qdbusmenumodel.h>
33−#include <qdbusactiongroup.h>
34−#include <qstateaction.h>
35−
36−//TODO: load this property dynamically
37−#define TARGET_DEVICE "phone"
38−
39−IndicatorClientCommon::IndicatorClientCommon(QObject *parent)
40− : QObject(parent),
41− m_visible(false),
42− m_priority(0)
43−{
44−}
45−
46−IndicatorClientCommon::~IndicatorClientCommon()
47−{
48− shutdown();
49−}
50−
51−void IndicatorClientCommon::init(const QSettings& settings)
52−{
53− setId(settings.value("Indicator Service/Name").toString());
54− QString dbusService = settings.value("Indicator Service/DBusName").toString();
55− QString objectPath = settings.value("Indicator Service/ObjectPath").toString();
56−
57− m_initialProperties.clear();
58− m_initialProperties.insert("title", m_title);
59− m_initialProperties.insert("busType", 1);
60− m_initialProperties.insert("busName", dbusService);
61− m_initialProperties.insert("objectPath", objectPath);
62−}
63−
64−void IndicatorClientCommon::shutdown()
65−{
66−}
67−
68−QString IndicatorClientCommon::identifier() const
69−{
70− return m_identifier;
71−}
72−
73−void IndicatorClientCommon::setId(const QString &identifier)
74−{
75− if (identifier != m_identifier) {
76− m_identifier = identifier;
77− Q_EMIT identifierChanged(m_identifier);
78− }
79−}
80−
81−QString IndicatorClientCommon::title() const
82−{
83− return m_title;
84−}
85−
86−void IndicatorClientCommon::setTitle(const QString &title)
87−{
88− if (title != m_title) {
89− m_title = title;
90− Q_EMIT titleChanged(m_title);
91− }
92−}
93−
94−QString IndicatorClientCommon::description() const
95−{
96− return m_description;
97−}
98−
99−void IndicatorClientCommon::setDescription(const QString &description)
100−{
101− if (description != m_description) {
102− m_description = description;
103− Q_EMIT titleChanged(m_description);
104− }
105−}
106−
107−int IndicatorClientCommon::priority() const
108−{
109− return m_priority;
110−}
111−
112−void IndicatorClientCommon::setPriority(int priority)
113−{
114− if (priority != m_priority) {
115− m_priority = priority;
116− Q_EMIT priorityChanged(m_priority);
117− }
118−}
119−
120−bool IndicatorClientCommon::visible() const
121−{
122− return m_visible;
123−}
124−
125−void IndicatorClientCommon::setVisible(bool visible)
126−{
127− if (visible != m_visible) {
128− m_visible = visible;
129− Q_EMIT visibleChanged(m_visible);
130− }
131−}
132−
133−QString IndicatorClientCommon::label() const
134−{
135− return m_label;
136−}
137−
138−void IndicatorClientCommon::setLabel(const QString &label)
139−{
140− if (label != m_label) {
141− m_label = label;
142− Q_EMIT labelChanged(m_label);
143− }
144−}
145−
146−QUrl IndicatorClientCommon::iconComponentSource() const
147−{
148− return QUrl("qrc:/indicatorsclient/qml/DefaultIndicatorIcon.qml");
149−}
150−
151−QUrl IndicatorClientCommon::pageComponentSource() const
152−{
153− return QUrl("qrc:/indicatorsclient/qml/DefaultIndicatorPage.qml");
154−}
155−
156−IndicatorClientInterface::PropertiesMap IndicatorClientCommon::initialProperties()
157−{
158− return m_initialProperties;
159−}
plugins/IndicatorsClient/indicators/common/indicatorclient_common.hdeleted−86
@@ -1,86 +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− * Nick Dedekind <nick.dedekind@canonical.com>
19− */
20−
21−#ifndef INDICATORCLIENT_COMMON_H
22−#define INDICATORCLIENT_COMMON_H
23−
24−#include <indicatorclientinterface.h>
25−#include <QObject>
26−
27−class QDBusActionGroup;
28−class QDBusMenuModel;
29−class QStateAction;
30−
31−class IndicatorClientCommon : public QObject, public IndicatorClientInterface
32−{
33− Q_OBJECT
34− Q_PROPERTY(QString identifier READ identifier NOTIFY identifierChanged)
35− Q_PROPERTY(QString title READ title NOTIFY titleChanged)
36− Q_PROPERTY(QString label READ label NOTIFY labelChanged)
37− Q_PROPERTY(QString description READ description NOTIFY descriptionChanged)
38− Q_PROPERTY(bool visible READ visible NOTIFY visibleChanged)
39− Q_PROPERTY(int priority READ priority NOTIFY priorityChanged)
40−
41−public:
42− IndicatorClientCommon(QObject *parent = 0);
43− ~IndicatorClientCommon();
44−
45− void init(const QSettings& settings);
46− void shutdown();
47−
48− QString identifier() const;
49− QString title() const;
50− bool visible() const;
51− QString description() const;
52− QString label() const;
53− int priority() const;
54−
55− QUrl iconComponentSource() const;
56− QUrl pageComponentSource() const;
57− PropertiesMap initialProperties();
58−
59−Q_SIGNALS:
60− void identifierChanged(const QString &identifier);
61− void titleChanged(const QString &title);
62− void visibleChanged(bool visible);
63− void descriptionChanged(const QString &description);
64− void labelChanged(const QString &label);
65− void priorityChanged(int priority);
66−
67−protected:
68− PropertiesMap m_initialProperties;
69−
70− void setId(const QString &id);
71− void setTitle(const QString &title);
72− void setDescription(const QString &description);
73− void setVisible(bool visible);
74− void setLabel(const QString &title);
75− void setPriority(int priority);
76−
77−private:
78− QString m_identifier;
79− QString m_title;
80− QString m_description;
81− QString m_label;
82− bool m_visible;
83− int m_priority;
84−};
85−
86−#endif // INDICATORCLIENT_COMMON_H
plugins/IndicatorsClient/indicators/datetime/CMakeLists.txtdeleted−37
@@ -1,37 +0,0 @@
1−set(INDICATORCLIENT_DATETIME_SRC
2− indicatorclient_datetime.cpp
3−)
4−
5−add_library(indicatorclient_datetime STATIC
6− ${INDICATORCLIENT_DATETIME_SRC}
7−)
8−
9−qt5_use_modules(indicatorclient_datetime Core Qml)
10−
11−set_target_properties(indicatorclient_datetime PROPERTIES COMPILE_FLAGS -fPIC)
12−
13−include_directories(
14− ${CMAKE_CURRENT_SOURCE_DIR}
15− ${QMENUMODEL_INCLUDE_DIRS}
16− ${indicatorclient_common_SOURCE_DIR}
17− ${IndicatorsClientQml_SOURCE_DIR}
18−)
19−
20−target_link_libraries(indicatorclient_datetime
21− indicatorclient_common
22− ${QMENUMODEL_LDFLAGS}
23−)
24−
25−set(INDICATOR_FILES
26− ${CMAKE_CURRENT_SOURCE_DIR}/indicator-datetime.indicator
27−)
28−
29−# copy indicators file into build directory for shadow builds
30−file(COPY ${INDICATOR_FILES}
31− DESTINATION ${CMAKE_BINARY_DIR}/share/unity/indicators
32−)
33−
34−# install indicator file
35−install(FILES ${INDICATOR_FILES}
36− DESTINATION ${CMAKE_INSTALL_DATADIR}/unity/indicators
37−)
plugins/IndicatorsClient/indicators/datetime/indicatorclient_datetime.cppdeleted−58
@@ -1,58 +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−#include "indicatorclient_datetime.h"
22−
23−#include <qdbusmenumodel.h>
24−#include <qdbusactiongroup.h>
25−#include <qstateaction.h>
26−#include <QDateTime>
27−#include <QDebug>
28−
29−IndicatorClientDateTime::IndicatorClientDateTime(QObject *parent)
30− : IndicatorClientCommon(parent),
31− m_action(0)
32−{
33− setTitle("Date and Time");
34− setPriority(IndicatorPriority::DATETIME);
35−}
36−
37−IndicatorClientDateTime::~IndicatorClientDateTime()
38−{
39−}
40−
41−void IndicatorClientDateTime::init(const QSettings& settings)
42−{
43− IndicatorClientCommon::init(settings);
44−}
45−
46−void IndicatorClientDateTime::shutdown()
47−{
48−}
49−
50−QUrl IndicatorClientDateTime::iconComponentSource() const
51−{
52− return QUrl("qrc:/indicatorsclient/qml/DatetimeIndicatorIcon.qml");
53−}
54−
55−QUrl IndicatorClientDateTime::pageComponentSource() const
56−{
57− return QUrl("qrc:/indicatorsclient/qml/DatetimeIndicatorPage.qml");
58−}
plugins/IndicatorsClient/indicators/datetime/indicatorclient_datetime.hdeleted−49
@@ -1,49 +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−#ifndef INDICATORCLIENT_DATETIME_H
22−#define INDICATORCLIENT_DATETIME_H
23−
24−#include "indicatorclient_common.h"
25−#include <QTimer>
26−#include <QDateTime>
27−
28−class QStateAction;
29−
30−class IndicatorClientDateTime : public IndicatorClientCommon
31−{
32− Q_OBJECT
33−public:
34− IndicatorClientDateTime(QObject *parent=0);
35− ~IndicatorClientDateTime();
36−
37− void init(const QSettings& settings);
38− void shutdown();
39−
40− QUrl iconComponentSource() const;
41− QUrl pageComponentSource() const;
42−
43−private:
44− QTimer m_timer;
45− QString m_format;
46− QStateAction *m_action;
47−};
48−
49−#endif
plugins/IndicatorsClient/indicators/datetime/indicator-datetime.indicator → plugins/IndicatorsClient/indicators/indicator-datetime.indicatorrenamed

The content is the same.

plugins/IndicatorsClient/indicators/messaging/indicator-messaging.indicator → plugins/IndicatorsClient/indicators/indicator-messaging.indicatorrenamed

The content is the same.

plugins/IndicatorsClient/indicators/network/indicator-network.indicator → plugins/IndicatorsClient/indicators/indicator-network.indicatorrenamed

The content is the same.

plugins/IndicatorsClient/indicators/power/indicator-power.indicator → plugins/IndicatorsClient/indicators/indicator-power.indicatorrenamed

The content is the same.

plugins/IndicatorsClient/indicators/sound/indicator-sound.indicator → plugins/IndicatorsClient/indicators/indicator-sound.indicatorrenamed

The content is the same.

plugins/IndicatorsClient/indicators/messaging/CMakeLists.txtdeleted−36
@@ -1,36 +0,0 @@
1−set(INDICATORCLIENT_MESSAGING_SRC
2− indicatorclient_messaging.cpp
3−)
4−
5−add_library(indicatorclient_messaging STATIC
6− ${INDICATORCLIENT_MESSAGING_SRC}
7−)
8−
9−qt5_use_modules(indicatorclient_messaging Core Qml)
10−
11−set_target_properties(indicatorclient_messaging PROPERTIES COMPILE_FLAGS -fPIC)
12−
13−include_directories(
14− ${CMAKE_CURRENT_SOURCE_DIR}
15− ${indicatorclient_common_SOURCE_DIR}
16− ${IndicatorsClientQml_SOURCE_DIR}
17−)
18−
19−target_link_libraries(indicatorclient_messaging
20− indicatorclient_common
21− ${QMENUMODEL_LDFLAGS}
22−)
23−
24−set(INDICATOR_FILES
25− ${CMAKE_CURRENT_SOURCE_DIR}/indicator-messaging.indicator
26−)
27−
28−# copy indicators file into build directory for shadow builds
29−file(COPY ${INDICATOR_FILES}
30− DESTINATION ${CMAKE_BINARY_DIR}/share/unity/indicators
31−)
32−
33−# install indicator file
34−install(FILES ${INDICATOR_FILES}
35− DESTINATION ${CMAKE_INSTALL_DATADIR}/unity/indicators
36−)
plugins/IndicatorsClient/indicators/network/CMakeLists.txtdeleted−45
@@ -1,45 +0,0 @@
1−set(INDICATORCLIENT_NETWORK_SRC
2− indicatorclient_network.cpp
3− networkagent.cpp
4− secret-agent.c
5−)
6−
7−add_library(indicatorclient_network
8− ${INDICATORCLIENT_NETWORK_SRC}
9−)
10−
11−qt5_use_modules(indicatorclient_network Core Qml Widgets)
12−
13−set_target_properties(indicatorclient_network PROPERTIES COMPILE_FLAGS -fPIC)
14−
15−include_directories(
16− ${CMAKE_CURRENT_SOURCE_DIR}
17− ${GLIB_INCLUDE_DIRS}
18− ${LIBNM_GLIB_INCLUDE_DIRS}
19− ${LIBNM_UTIL_INCLUDE_DIRS}
20− ${QMENUMODEL_INCLUDE_DIRS}
21− ${indicatorclient_common_SOURCE_DIR}
22− ${IndicatorsClientQml_SOURCE_DIR}
23−)
24−
25−target_link_libraries(indicatorclient_network
26− indicatorclient_common
27− ${GLIB_LIBRARIES}
28− ${LIBNM_GLIB_LIBRARIES}
29− ${LIBNM_UTIL_LIBRARIES}
30− ${QMENUMODEL_LDFLAGS}
31−)
32−
33−set(INDICATOR_FILES
34− ${CMAKE_CURRENT_SOURCE_DIR}/indicator-network.indicator
35−)
36−
37−# copy indicators file into build directory for shadow builds
38−file(COPY ${INDICATOR_FILES}
39− DESTINATION ${CMAKE_BINARY_DIR}/share/unity/indicators
40−)
41−
42−# install indicator file
43−install(FILES ${INDICATOR_FILES}
44− DESTINATION ${CMAKE_INSTALL_DATADIR}/unity/indicators
45−)
plugins/IndicatorsClient/indicators/network/indicatorclient_network.cppdeleted−57
@@ -1,57 +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−#include "indicatorclient_network.h"
21−#include "networkagent.h"
22−
23−#include <QUrl>
24−#include <QtQml>
25−#include <QtPlugin>
26−
27−#include <qdbusmenumodel.h>
28−#include <qdbusactiongroup.h>
29−#include <qstateaction.h>
30−
31−IndicatorClientNetwork::IndicatorClientNetwork(QObject *parent)
32− : IndicatorClientCommon(parent)
33−{
34− setTitle("Networks");
35− setPriority(IndicatorPriority::NETWORK);
36−}
37−
38−IndicatorClientNetwork::~IndicatorClientNetwork()
39−{
40−}
41−
42−void IndicatorClientNetwork::init(const QSettings& settings)
43−{
44− IndicatorClientCommon::init(settings);
45−
46− qmlRegisterType<NetworkAgent>("NetworkSettings", 0, 1, "NetworkAgent");
47−}
48−
49−QUrl IndicatorClientNetwork::iconComponentSource() const
50−{
51− return QUrl("qrc:/indicatorsclient/qml/NetworkIndicatorIcon.qml");
52−}
53−
54−QUrl IndicatorClientNetwork::pageComponentSource() const
55−{
56− return QUrl("qrc:/indicatorsclient/qml/NetworkIndicatorPage.qml");
57−}
plugins/IndicatorsClient/indicators/network/indicatorclient_network.hdeleted−40
@@ -1,40 +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−#ifndef INDICATORCLIENT_NETWORK_H
21−#define INDICATORCLIENT_NETWORK_H
22−
23−#include "indicatorclient_common.h"
24−#include <QTimer>
25−
26−class QStateAction;
27−
28−class IndicatorClientNetwork : public IndicatorClientCommon
29−{
30− Q_OBJECT
31−public:
32− IndicatorClientNetwork(QObject *parent=0);
33− ~IndicatorClientNetwork();
34−
35− void init(const QSettings& settings);
36− QUrl iconComponentSource() const;
37− QUrl pageComponentSource() const;
38−};
39−
40−#endif
plugins/IndicatorsClient/indicators/power/CMakeLists.txtdeleted−36
@@ -1,36 +0,0 @@
1−set(INDICATORCLIENT_POWER_SRC
2− indicatorclient_power.cpp
3−)
4−
5−add_library(indicatorclient_power STATIC
6− ${INDICATORCLIENT_POWER_SRC}
7−)
8−
9−qt5_use_modules(indicatorclient_power Core Qml)
10−
11−set_target_properties(indicatorclient_power PROPERTIES COMPILE_FLAGS -fPIC)
12−
13−include_directories(
14− ${CMAKE_CURRENT_SOURCE_DIR}
15− ${indicatorclient_common_SOURCE_DIR}
16− ${IndicatorsClientQml_SOURCE_DIR}
17−)
18−
19−target_link_libraries(indicatorclient_power
20− indicatorclient_common
21− ${QMENUMODEL_LDFLAGS}
22−)
23−
24−set(INDICATOR_FILES
25− ${CMAKE_CURRENT_SOURCE_DIR}/indicator-power.indicator
26−)
27−
28−# copy indicators file into build directory for shadow builds
29−file(COPY ${INDICATOR_FILES}
30− DESTINATION ${CMAKE_BINARY_DIR}/share/unity/indicators
31−)
32−
33−# install indicator file
34−install(FILES ${INDICATOR_FILES}
35− DESTINATION ${CMAKE_INSTALL_DATADIR}/unity/indicators
36−)
plugins/IndicatorsClient/indicators/power/indicatorclient_power.cppdeleted−33
@@ -1,33 +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−#include "indicatorclient_power.h"
22−
23−IndicatorClientPower::IndicatorClientPower(QObject *parent)
24− : IndicatorClientCommon(parent)
25−{
26− setTitle("Battery");
27− setPriority(IndicatorPriority::POWER);
28−}
29−
30−void IndicatorClientPower::init(const QSettings& settings)
31−{
32− IndicatorClientCommon::init(settings);
33−}
plugins/IndicatorsClient/indicators/power/indicatorclient_power.hdeleted−35
@@ -1,35 +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−#ifndef INDICATORCLIENT_POWER_H
22−#define INDICATORCLIENT_POWER_H
23−
24−#include "indicatorclient_common.h"
25−
26−class IndicatorClientPower : public IndicatorClientCommon
27−{
28− Q_OBJECT
29−public:
30− IndicatorClientPower(QObject *parent=0);
31−
32− void init(const QSettings& settings);
33−};
34−
35−#endif
plugins/IndicatorsClient/indicators/sound/CMakeLists.txtdeleted−36
@@ -1,36 +0,0 @@
1−set(INDICATORCLIENT_SOUND_SRC
2− indicatorclient_sound.cpp
3−)
4−
5−add_library(indicatorclient_sound STATIC
6− ${INDICATORCLIENT_SOUND_SRC}
7−)
8−
9−qt5_use_modules(indicatorclient_sound Core Qml)
10−
11−set_target_properties(indicatorclient_sound PROPERTIES COMPILE_FLAGS -fPIC)
12−
13−include_directories(
14− ${CMAKE_CURRENT_SOURCE_DIR}
15− ${indicatorclient_common_SOURCE_DIR}
16− ${IndicatorsClientQml_SOURCE_DIR}
17−)
18−
19−target_link_libraries(indicatorclient_sound
20− indicatorclient_common
21− ${QMENUMODEL_LDFLAGS}
22−)
23−
24−set(INDICATOR_FILES
25− ${CMAKE_CURRENT_SOURCE_DIR}/indicator-sound.indicator
26−)
27−
28−# copy indicators file into build directory for shadow builds
29−file(COPY ${INDICATOR_FILES}
30− DESTINATION ${CMAKE_BINARY_DIR}/share/unity/indicators
31−)
32−
33−# install indicator file
34−install(FILES ${INDICATOR_FILES}
35− DESTINATION ${CMAKE_INSTALL_DATADIR}/unity/indicators
36−)
plugins/IndicatorsClient/indicatorsfactory.cppdeleted−61
@@ -1,61 +0,0 @@
1−/*
2− * Copyright (C) 2013 Canonical, Ltd.
3− *
4− * Authors:
5− * Michał Sawicz <michal.sawicz@canonical.com>
6− *
7− * This program is free software; you can redistribute it and/or modify
8− * it under the terms of the GNU General Public License as published by
9− * the Free Software Foundation; version 3.
10− *
11− * This program is distributed in the hope that it will be useful,
12− * but WITHOUT ANY WARRANTY; without even the implied warranty of
13− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14− * GNU General Public License for more details.
15− *
16− * You should have received a copy of the GNU General Public License
17− * along with this program. If not, see <http://www.gnu.org/licenses/>.
18− */
19−
20−// local
21−#include "indicatorsfactory.h"
22−
23−// indicators
24−#include "indicators/datetime/indicatorclient_datetime.h"
25−#include "indicators/messaging/indicatorclient_messaging.h"
26−#include "indicators/network/indicatorclient_network.h"
27−#include "indicators/power/indicatorclient_power.h"
28−#include "indicators/sound/indicatorclient_sound.h"
29−
30−IndicatorsFactory::IndicatorsFactory()
31−{
32− registerIndicator<IndicatorClientDateTime>("indicator-datetime");
33− registerIndicator<IndicatorClientMessaging>("indicator-messaging");
34− registerIndicator<IndicatorClientNetwork>("indicator-network");
35− registerIndicator<IndicatorClientPower>("indicator-power");
36− registerIndicator<IndicatorClientSound>("indicator-sound");
37−}
38−
39−IndicatorsFactory::~IndicatorsFactory()
40−{
41− qDeleteAll(m_factoryItems);
42−}
43−
44−IndicatorsFactory& IndicatorsFactory::instance()
45−{
46− static IndicatorsFactory factory;
47− return factory;
48−}
49−
50−IndicatorClientInterface::Ptr IndicatorsFactory::create(const QString& indicator, QObject* parent)
51−{
52− if (!m_factoryItems.contains(indicator))
53− return IndicatorClientInterface::Ptr();
54− return m_factoryItems[indicator]->create(parent);
55−}
56−
57−
58−bool IndicatorsFactory::isRegistered(const QString& indicator)
59−{
60− return m_factoryItems.contains(indicator);
61−}
plugins/IndicatorsClient/indicatorsfactory.hdeleted−74
@@ -1,74 +0,0 @@
1−/*
2− * Copyright (C) 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 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− * Author: Nick Dedekind <nick.dedekind@canonical.com>
17− */
18−
19−#ifndef INDICATORS_FACTORY_H
20−#define INDICATORS_FACTORY_H
21−
22−#include <QString>
23−#include <QObject>
24−#include <QHash>
25−
26−#include "indicatorclientinterface.h"
27−
28−class IndicatorFactoryItem
29−{
30−public:
31− virtual ~IndicatorFactoryItem() {}
32− virtual IndicatorClientInterface::Ptr create(QObject* parent = 0) = 0;
33−};
34−
35−template<class TYPE>
36−class IndicatorFactoryItemTyped : public IndicatorFactoryItem
37−{
38−public:
39− IndicatorFactoryItemTyped() {}
40−
41− IndicatorClientInterface::Ptr create(QObject* parent = 0) { return std::make_shared<TYPE>(parent); }
42−};
43−
44−class IndicatorsFactory : public QObject
45−{
46− Q_OBJECT
47−public:
48− virtual ~IndicatorsFactory();
49−
50− IndicatorClientInterface::Ptr create(const QString& indicator, QObject* parent = 0);
51−
52− template<class TYPE>
53− void registerIndicator(const QString& indicator)
54− {
55− if (m_factoryItems.contains(indicator))
56− return;
57− m_factoryItems[indicator] = new IndicatorFactoryItemTyped<TYPE>();
58− Q_EMIT registered(indicator);
59− }
60−
61− bool isRegistered(const QString& indicator);
62−
63− static IndicatorsFactory& instance();
64−
65−Q_SIGNALS:
66− void registered(const QString& indicator);
67−
68−private:
69− IndicatorsFactory();
70−
71− QHash<QString, IndicatorFactoryItem*> m_factoryItems;
72−};
73−
74−#endif // INDICATORSCLIENT_PLUGIN_H
plugins/IndicatorsClient/indicatorsmanager.cpp+11−23
@@ -18,7 +18,6 @@
1818 */
1919
2020#include "indicatorsmanager.h"
21−#include "indicatorsfactory.h"
2221
2322#include <QSettings>
2423#include <QDebug>
@@ -39,7 +38,7 @@ public:
3938 QFileInfo m_fileInfo;
4039
4140 bool m_verified;
42− IndicatorClientInterface::Ptr m_obj;
41+ Indicator::Ptr m_indicator;
4342};
4443
4544IndicatorsManager::IndicatorsManager(QObject* parent)
@@ -116,13 +115,6 @@ void IndicatorsManager::load(const QFileInfo& file_info)
116115 indicator_settings.beginGroup("Indicator Service");
117116 QString name = indicator_settings.value("Name").toString();
118117
119− // don't bother loading if it's not registered.
120− if (!IndicatorsFactory::instance().isRegistered(name))
121− {
122− qWarning() << Q_FUNC_INFO << "Invalid plugin name: " << name << " - not registered in factory.";
123− return;
124− }
125−
126118 auto iter = m_indicatorsData.find(name);
127119 if (iter != m_indicatorsData.end())
128120 {
@@ -174,11 +166,6 @@ void IndicatorsManager::unload()
174166 while(iter.hasNext())
175167 {
176168 iter.next();
177− IndicatorData* data = iter.value();
178− if (data->m_obj)
179− {
180− data->m_obj->shutdown();
181− }
182169 Q_EMIT indicatorAboutToBeUnloaded(iter.key());
183170 }
184171
@@ -253,32 +240,33 @@ void IndicatorsManager::endVerify(const QString& path)
253240 }
254241}
255242
256−IndicatorClientInterface::Ptr IndicatorsManager::indicator(const QString& indicator)
243+Indicator::Ptr IndicatorsManager::indicator(const QString& indicator)
257244{
258− if (!m_indicatorsData.contains(indicator)) {
245+ if (!m_indicatorsData.contains(indicator))
246+ {
259247 qWarning() << Q_FUNC_INFO << "Invalid plugin name: " << indicator;
260248 return 0;
261249 }
262250
263251 IndicatorData *data = m_indicatorsData[indicator];
264− if (data->m_obj)
265− return data->m_obj;
252+ if (data->m_indicator)
253+ return data->m_indicator;
266254
267− IndicatorClientInterface::Ptr plugin = IndicatorsFactory::instance().create(indicator, this);
255+ Indicator::Ptr plugin = std::make_shared<Indicator>(this);
268256 if (plugin)
269257 {
270− data->m_obj = plugin;
258+ data->m_indicator = plugin;
271259 plugin->init(QSettings(data->m_fileInfo.absoluteFilePath(), QSettings::IniFormat, this));
272260 }
273261 return plugin;
274262}
275263
276−QList<IndicatorClientInterface::Ptr> IndicatorsManager::indicators()
264+QList<Indicator::Ptr> IndicatorsManager::indicators()
277265{
278− QList<IndicatorClientInterface::Ptr> list;
266+ QList<Indicator::Ptr> list;
279267 Q_FOREACH(IndicatorData* data, m_indicatorsData)
280268 {
281− IndicatorClientInterface::Ptr plugin = indicator(data->m_name);
269+ Indicator::Ptr plugin = indicator(data->m_name);
282270 list.append(plugin);
283271 }
284272 return list;
plugins/IndicatorsClient/indicatorsmanager.h+3−3
@@ -27,7 +27,7 @@
2727#include <QHash>
2828#include <QSharedPointer>
2929
30−#include "indicatorclientinterface.h"
30+#include "indicator.h"
3131
3232class IndicatorsManager : public QObject
3333{
@@ -40,9 +40,9 @@ public:
4040 Q_INVOKABLE void load();
4141 Q_INVOKABLE void unload();
4242
43− IndicatorClientInterface::Ptr indicator(const QString& indicator);
43+ Indicator::Ptr indicator(const QString& indicator);
4444
45− QList<IndicatorClientInterface::Ptr> indicators();
45+ QList<Indicator::Ptr> indicators();
4646
4747 bool isLoaded() const;
4848
plugins/IndicatorsClient/indicatorsmodel.cpp+103−83
@@ -19,18 +19,13 @@
1919
2020#include "indicatorsmodel.h"
2121#include "indicatorsmanager.h"
22−#include "indicatorclientinterface.h"
22+#include "indicator.h"
23+#include "paths.h"
2324
2425#include <QQmlContext>
2526#include <QQmlEngine>
2627#include <QDebug>
2728
28−
29−static bool comparePlugins(const IndicatorClientInterface::Ptr obj1, const IndicatorClientInterface::Ptr obj2)
30−{
31− return obj1->priority() < obj2->priority();
32−}
33−
3429/*!
3530 \qmltype IndicatorsModel
3631 \inherits QAbstractListModel
@@ -128,37 +123,40 @@ void IndicatorsModel::unload()
128123/*! \internal */
129124void IndicatorsModel::onIndicatorLoaded(const QString& indicator)
130125{
131− IndicatorClientInterface::Ptr plugin = m_manager->indicator(indicator);
126+ Indicator::Ptr plugin = m_manager->indicator(indicator);
132127 if (!plugin)
133128 return;
134129
135− QList<IndicatorClientInterface::Ptr>::iterator i = qLowerBound(m_plugins.begin(), m_plugins.end(), plugin, comparePlugins);
136− int insert_pos = qMin(i - m_plugins.begin(), m_plugins.count());
137−
138− beginInsertRows(QModelIndex(), insert_pos, insert_pos);
130+ if (m_plugins.indexOf(plugin) >= 0)
131+ return;
139132
140− QObject* obj = dynamic_cast<QObject*>(plugin.get());
141− if (obj)
142− {
143− QObject::connect(obj, SIGNAL(identifierChanged(const QString&)), this, SLOT(onIdentifierChanged()));
144− QObject::connect(obj, SIGNAL(titleChanged(const QString&)), this, SLOT(onTitleChanged()));
145− QObject::connect(obj, SIGNAL(labelChanged(const QString&)), this, SLOT(onLabelChanged()));
133+ // find the insert position
134+ int pos = 0;
135+ while (pos < count()) {
136+ // keep going while the existing priority is less.
137+ if (indicatorData(plugin, Priority).toInt() < data(index(pos), Priority).toInt())
138+ break;
139+ pos++;
146140 }
147141
148− m_plugins.insert(i, plugin);
142+ QObject::connect(plugin.get(), SIGNAL(identifierChanged(const QString&)), this, SLOT(onIdentifierChanged()));
143+ QObject::connect(plugin.get(), SIGNAL(indicatorPropertiesChanged(const QVariant&)), this, SLOT(onIndicatorPropertiesChanged()));
144+
145+ beginInsertRows(QModelIndex(), pos, pos);
149146
147+ m_plugins.insert(pos, plugin);
150148 endInsertRows();
151149}
152150
153151/*! \internal */
154152void IndicatorsModel::onIndicatorAboutToBeUnloaded(const QString& indicator)
155153{
156− IndicatorClientInterface::Ptr plugin = m_manager->indicator(indicator);
154+ Indicator::Ptr plugin = m_manager->indicator(indicator);
157155 if (!plugin)
158156 return;
159157
160158 int i = 0;
161− QMutableListIterator<IndicatorClientInterface::Ptr> iter(m_plugins);
159+ QMutableListIterator<Indicator::Ptr> iter(m_plugins);
162160 while(iter.hasNext())
163161 {
164162 if (plugin == iter.next())
@@ -179,26 +177,20 @@ void IndicatorsModel::onIdentifierChanged()
179177}
180178
181179/*! \internal */
182−void IndicatorsModel::onTitleChanged()
180+void IndicatorsModel::onIndicatorPropertiesChanged()
183181{
184− notifyDataChanged(QObject::sender(), Title);
185−}
186−
187−/*! \internal */
188−void IndicatorsModel::onLabelChanged()
189−{
190− notifyDataChanged(QObject::sender(), Label);
182+ notifyDataChanged(QObject::sender(), IndicatorProperties);
191183}
192184
193185/*! \internal */
194186void IndicatorsModel::notifyDataChanged(QObject *sender, int role)
195187{
196− IndicatorClientInterface* plugin = dynamic_cast<IndicatorClientInterface*>(sender);
188+ Indicator* plugin = qobject_cast<Indicator*>(sender);
197189 if (!plugin)
198190 return;
199191
200192 int index = 0;
201− QMutableListIterator<IndicatorClientInterface::Ptr> iter(m_plugins);
193+ QMutableListIterator<Indicator::Ptr> iter(m_plugins);
202194 while(iter.hasNext())
203195 {
204196 if (iter.next().get() == plugin)
@@ -215,14 +207,15 @@ void IndicatorsModel::notifyDataChanged(QObject *sender, int role)
215207QHash<int, QByteArray> IndicatorsModel::roleNames() const
216208{
217209 static QHash<int, QByteArray> roles;
218− if (roles.isEmpty()) {
210+ if (roles.isEmpty())
211+ {
219212 roles[Identifier] = "identifier";
213+ roles[Priority] = "priority";
220214 roles[Title] = "title";
221− roles[Label] = "label";
222215 roles[Description] = "description";
223− roles[IconUrl] = "iconUrl";
224− roles[PageUrl] = "pageUrl";
225− roles[InitialProperties] = "initialProperties";
216+ roles[IconQml] = "iconQml";
217+ roles[PageQml] = "pageQml";
218+ roles[IndicatorProperties] = "indicatorProperties";
226219 roles[IsValid] = "isValid";
227220 }
228221 return roles;
@@ -234,63 +227,69 @@ int IndicatorsModel::columnCount(const QModelIndex &) const
234227 return 1;
235228}
236229
230+/*! \internal */
231+QVariant IndicatorsModel::defaultData(Indicator::Ptr plugin, int role)
232+{
233+ switch (role)
234+ {
235+ case Priority:
236+ return 0;
237+ case Title:
238+ return plugin ? plugin->identifier() : "Unknown";
239+ case Description:
240+ return "";
241+ case IconQml:
242+ return shellAppDirectory()+"/Panel/Indicators/DefaultIndicatorIcon.qml";
243+ case PageQml:
244+ return shellAppDirectory()+"/Panel/Indicators/DefaultIndicatorPage.qml";
245+ }
246+ return QVariant();
247+}
248+
237249/*! \internal */
238250QVariant IndicatorsModel::data(const QModelIndex &index, int role) const
239251{
240252 if (!index.isValid() || index.row() >= m_plugins.size())
241253 return QVariant();
242254
243− QVariant attribute;
244−
245− IndicatorClientInterface::Ptr plugin = m_plugins[index.row()];
255+ Indicator::Ptr plugin = m_plugins[index.row()];
246256
247− switch (role) {
248− case Identifier:
249− if (plugin) {
250− attribute = QVariant(plugin->identifier());
251− }
252− break;
253− case Title:
254− if (plugin) {
255− attribute = QVariant(plugin->title());
256− }
257− break;
258− case Label:
259− if (plugin) {
260− attribute = QVariant(plugin->label());
261− }
262− break;
263− case Description:
257+ switch (role)
264258 {
265− if (plugin) {
266− attribute = QVariant(plugin->description());
267− }
268− break;
259+ case Identifier:
260+ if (plugin)
261+ {
262+ return QVariant(plugin->identifier());
263+ }
264+ break;
265+ case IndicatorProperties:
266+ if (plugin)
267+ {
268+ return QVariant(plugin->indicatorProperties());
269+ }
270+ break;
271+ case IsValid:
272+ return (plugin.get() ? true : false);
273+ case Priority:
274+ case Title:
275+ case Description:
276+ case IconQml:
277+ case PageQml:
278+ return indicatorData(plugin, role);
279+ default:
280+ break;
269281 }
270− case IconUrl:
271− if (plugin) {
272− return plugin->iconComponentSource().toString();
273− } else {
274− attribute = QVariant("No plugin");
275− }
276− break;
277− case PageUrl:
278− if (plugin) {
279− return plugin->pageComponentSource();
280− }
281− break;
282− case InitialProperties:
283− if (plugin) {
284− attribute = plugin->initialProperties();
285− }
286− break;
287− case IsValid:
288− attribute = QVariant(plugin != 0);
289− break;
290− default:
291− break;
282+ return QVariant();
283+}
284+
285+QVariant IndicatorsModel::indicatorData(const Indicator::Ptr& plugin, int role) const
286+{
287+ if (plugin && m_parsed_indicator_data.contains(plugin->identifier()))
288+ {
289+ QVariantMap data = m_parsed_indicator_data[plugin->identifier()];
290+ return data.value(roleNames()[role], QVariant());
292291 }
293− return attribute;
292+ return defaultData(plugin, role);
294293}
295294
296295/*! \internal */
@@ -304,3 +303,24 @@ int IndicatorsModel::rowCount(const QModelIndex&) const
304303{
305304 return m_plugins.count();
306305}
306+
307+void IndicatorsModel::setIndicatorData(const QVariant& data)
308+{
309+ m_indicator_data = data;
310+
311+ m_parsed_indicator_data.clear();
312+ QMap<QString, QVariant> map = data.toMap();
313+ QMapIterator<QString, QVariant> iter(map);
314+ while(iter.hasNext())
315+ {
316+ iter.next();
317+ m_parsed_indicator_data[iter.key()] = iter.value().toMap();
318+ }
319+
320+ Q_EMIT indicatorDataChanged(m_indicator_data);
321+}
322+
323+QVariant IndicatorsModel::indicatorData() const
324+{
325+ return m_indicator_data;
326+}
plugins/IndicatorsClient/indicatorsmodel.h+19−9
@@ -21,7 +21,7 @@
2121#ifndef INDICATORSMODEL_H
2222#define INDICATORSMODEL_H
2323
24−#include "indicatorclientinterface.h"
24+#include "indicator.h"
2525
2626#include <QAbstractListModel>
2727#include <QQmlEngine>
@@ -31,17 +31,19 @@ class IndicatorsManager;
3131class IndicatorsModel : public QAbstractListModel
3232{
3333 Q_OBJECT
34+ Q_ENUMS(Roles)
3435 Q_PROPERTY(int count READ count NOTIFY countChanged)
36+ Q_PROPERTY(QVariant indicatorData READ indicatorData WRITE setIndicatorData NOTIFY indicatorDataChanged)
3537
3638public:
37− enum ModelRoles {
39+ enum Roles {
3840 Identifier = 0,
41+ Priority,
3942 Title,
40− Label,
4143 Description,
42− IconUrl,
43− PageUrl,
44− InitialProperties,
44+ IconQml,
45+ PageQml,
46+ IndicatorProperties,
4547 IsValid
4648 };
4749
@@ -60,22 +62,30 @@ public:
6062 QModelIndex parent (const QModelIndex &index) const;
6163 int rowCount(const QModelIndex &parent = QModelIndex()) const;
6264
65+ void setIndicatorData(const QVariant& data);
66+ QVariant indicatorData() const;
67+
6368Q_SIGNALS:
6469 void countChanged();
70+ void indicatorDataChanged(const QVariant& data);
6571
6672private Q_SLOTS:
6773 void onIdentifierChanged();
68− void onTitleChanged();
69− void onLabelChanged();
74+ void onIndicatorPropertiesChanged();
7075 void onIndicatorLoaded(const QString& indicator);
7176 void onIndicatorAboutToBeUnloaded(const QString& indicator);
7277
7378private:
7479 IndicatorsManager *m_manager;
75− QList<IndicatorClientInterface::Ptr> m_plugins;
80+
81+ QList<Indicator::Ptr> m_plugins;
82+ QVariant m_indicator_data;
83+ QMap<QString, QVariantMap> m_parsed_indicator_data;
7684
7785 void notifyDataChanged(QObject *sender, int role);
7886 int count() const;
87+ QVariant indicatorData(const Indicator::Ptr& plugin, int role) const;
88+ static QVariant defaultData(Indicator::Ptr plugin, int role);
7989};
8090
8191#endif // INDICATORSMODEL_H
plugins/IndicatorsClient/qml/ButtonMenu.qml+1−1
@@ -21,7 +21,7 @@ import QtQuick 2.0
2121import Ubuntu.Components 0.1
2222
2323BasicMenu {
24− property variant action: menu && actionGroup ? actionGroup.action(menu.action) : undefined
24+ property variant action: menu && menu.action!="" && actionGroup ? actionGroup.action(menu.action) : null
2525
2626 color: "#221e1b"
2727 height: undefined // If we're using implicitHieght, we need to make sure height is not set.
plugins/IndicatorsClient/qml/DBusActionState.qml+2−2
@@ -46,7 +46,7 @@ Item {
4646 \preliminary
4747 The dbus action name
4848 */
49− property string action : undefined
49+ property string action : ""
5050
5151 /*!
5252 \preliminary
@@ -78,7 +78,7 @@ Item {
7878
7979 Item {
8080 id: priv
81− property variant actionObject : action && actionGroup ? actionGroup.action(action) : null
81+ property variant actionObject : action!="" && actionGroup ? actionGroup.action(action) : null
8282 property variant actionState: actionObject ? actionObject.state : undefined
8383
8484 Binding {
plugins/IndicatorsClient/qml/IndicatorIcon.qml+2
@@ -26,6 +26,7 @@ IndicatorBase {
2626 id: indicatorIcon
2727 property var action: undefined
2828 property bool started: (busType != 0) && (busName != "") && (objectPath != "")
29+ property int iconSize: height - units.gu(0.5)
2930
3031 signal actionStateChanged()
3132
@@ -43,6 +44,7 @@ IndicatorBase {
4344 onActionGroupUpdated: update_state()
4445 onModelUpdated: update_state()
4546
47+
4648 function update_state() {
4749 var data = proxyModel.get(0)
4850 if (data == undefined || data.extra == undefined) {
plugins/IndicatorsClient/qml/ProgressMenu.qml+1−1
@@ -55,7 +55,7 @@ Menu {
5555 }
5656
5757 DBusActionState {
58− action: menu ? menu.action : undefined
58+ action: menu ? menu.action : ""
5959 target: progressBar
6060 property: "value"
6161 }
plugins/IndicatorsClient/qml/SliderMenu.qml+2−2
@@ -31,7 +31,7 @@ Menu {
3131 id: slider
3232 width: _sliderMenu.text ? units.gu(20) : _sliderMenu.width - units.gu(4)
3333 anchors.verticalCenter: parent.verticalCenter
34− live: false
34+ live: false
3535 // FIXME: The interval should be [0.0 - 1.0]. Unfortunately, when
3636 // reaching the boundaries (0.0 or 1.0), the value is converted
3737 // to an integer when automatically wrapped in a variant when
@@ -59,7 +59,7 @@ Menu {
5959 }
6060
6161 DBusActionState {
62− action: menu ? menu.action : undefined
62+ action: menu ? menu.action : ""
6363 target: slider
6464 property: "value"
6565 }
plugins/IndicatorsClient/qml/SwitchMenu.qml+1−1
@@ -33,7 +33,7 @@ Menu {
3333 }
3434
3535 DBusActionState {
36− action: menu ? menu.action : undefined
36+ action: menu ? menu.action : ""
3737 target: switcher
3838 property: "checked"
3939 }
plugins/IndicatorsClient/qml/TextMenu.qml+1−1
@@ -74,7 +74,7 @@ Menu {
7474 }
7575
7676 DBusActionState {
77− action: menu ? menu.action : undefined
77+ action: menu ? menu.action : ""
7878 target: _textField
7979 property: "text"
8080 }
plugins/IndicatorsClient/qml/messaging/GroupedMessage.qml+1−1
@@ -23,7 +23,7 @@ import Ubuntu.Components 0.1
2323import IndicatorsClient 0.1 as IndicatorsClient
2424
2525IndicatorsClient.BasicMenu {
26− property variant action: menu && actionGroup ? actionGroup.action(menu.action) : undefined
26+ property variant action: menu && menu.action!="" && actionGroup ? actionGroup.action(menu.action) : null
2727 property alias count: label.text
2828
2929 color: "#221e1b"
plugins/IndicatorsClient/qml/messaging/HeroMessage.qml+1−1
@@ -26,7 +26,7 @@ IndicatorsClient.BasicMenu {
2626 id: __heroMessage
2727
2828 property variant actionsDescription: null
29− property variant action: menu && actionGroup ? actionGroup.action(menu.action) : undefined
29+ property variant action: menu && menu.action!="" && actionGroup ? actionGroup.action(menu.action) : null
3030 property alias heroMessageHeader: __heroMessageHeader
3131 property real collapsedHeight: heroMessageHeader.y + heroMessageHeader.bodyBottom + units.gu(2)
3232 property real expandedHeight: collapsedHeight
plugins/IndicatorsClient/qml/network/AccessPoint.qml+2−2
@@ -51,7 +51,7 @@ IndicatorsClient.Menu {
5151 return "image://gicon/" + imageName;
5252 }
5353
54− icon: menu && wifiApStrength ? getNetworkIcon(menu) : "image://gicon/nm-no-connection"
54+ icon: menu && wifiApStrength ? getNetworkIcon(menu) : "image://gicon/wifi-none"
5555 iconFrame: false
5656 control: CheckBox {
5757 id: checkBoxActive
@@ -62,7 +62,7 @@ IndicatorsClient.Menu {
6262 }
6363
6464 IndicatorsClient.DBusActionState {
65− action: menu ? menu.action : undefined
65+ action: menu ? menu.action : ""
6666 target: checkBoxActive
6767 property: "checked"
6868 }
plugins/IndicatorsClient/qml/network/qmldir+1
@@ -1,4 +1,5 @@
11module IndicatorsClient.Network
2+plugin IndicatorsClientNetworkQml
23
34NetworkPage 0.1 NetworkPage.qml
45AccessPoint 0.1 AccessPoint.qml
plugins/IndicatorsClient/resources/indicatorclient.qrc−9
@@ -1,16 +1,7 @@
11<RCC>
22 <qresource prefix="/indicatorsclient">
3− <file>artwork/datetime/time_and_date@18.png</file>
43 <file>artwork/messaging/default_contact.png</file>
54 <file>artwork/messaging/default_app.svg</file>
65 <file>artwork/messaging/message_sms01_54px.png</file>
7−
8− <file>qml/DefaultIndicatorIcon.qml</file>
9− <file>qml/DefaultIndicatorPage.qml</file>
10− <file>qml/DatetimeIndicatorIcon.qml</file>
11− <file>qml/DatetimeIndicatorPage.qml</file>
12− <file>qml/MessagingIndicatorPage.qml</file>
13− <file>qml/NetworkIndicatorIcon.qml</file>
14− <file>qml/NetworkIndicatorPage.qml</file>
156 </qresource>
167</RCC>
plugins/Utils/CMakeLists.txt+1
@@ -5,6 +5,7 @@ include_directories(
55)
66
77set(QMLPLUGIN_SRC
8+ applicationpaths.h
89 qlimitproxymodelqml.cpp
910 qsortfilterproxymodelqml.cpp
1011 ubuntuwindow.cpp
plugins/Utils/applicationpaths.hnew file+40
@@ -0,0 +1,40 @@
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+ * Authored by: Nick Dedekind <nick.dedekind@canonical.com>
17+ */
18+
19+
20+#ifndef APPLICATION_PATHS_H
21+#define APPLICATION_PATHS_H
22+
23+#include <QObject>
24+#include "paths.h"
25+
26+class ApplicationPaths : public QObject
27+{
28+ Q_OBJECT
29+public:
30+ ApplicationPaths(QObject*parent=0):QObject(parent) {}
31+
32+ Q_INVOKABLE bool isRunningInstalled() const { return ::isRunningInstalled(); }
33+ Q_INVOKABLE QString shellAppDirectory() const { return ::shellAppDirectory(); }
34+ Q_INVOKABLE QString shellImportPath() const { return ::shellImportPath(); }
35+ Q_INVOKABLE QString fakePluginsImportPath() const { return ::fakePluginsImportPath(); }
36+ Q_INVOKABLE QStringList shellDataDirs() const { return ::shellDataDirs(); }
37+ Q_INVOKABLE QString sourceDirectory() const { return ::sourceDirectory(); }
38+};
39+
40+#endif // APPLICATION_PATHS_H
plugins/Utils/plugin.cpp+2
@@ -24,6 +24,7 @@
2424#include "plugin.h"
2525
2626// local
27+#include "applicationpaths.h"
2728#include "qlimitproxymodelqml.h"
2829#include "qsortfilterproxymodelqml.h"
2930#include "ubuntuwindow.h"
@@ -35,4 +36,5 @@ void UtilsPlugin::registerTypes(const char *uri)
3536 qmlRegisterType<QLimitProxyModelQML>(uri, 0, 1, "LimitProxyModel");
3637 qmlRegisterType<QSortFilterProxyModelQML>(uri, 0, 1, "SortFilterProxyModel");
3738 qmlRegisterExtendedType<QQuickWindow, UbuntuWindow>(uri, 0, 1, "Window");
39+ qmlRegisterType<ApplicationPaths>(uri, 0, 1, "ApplicationPaths");
3840}
tests/autopilot/indicators_client/emulators/__init__.py+2−7
@@ -5,7 +5,7 @@
55# under the terms of the GNU General Public License version 3, as published
66# by the Free Software Foundation.
77
8−from autopilot.introspection.dbus import CustomEmulatorBase
8+from autopilot.introspection.dbus import DBusIntrospectionObject
99from autopilot.input import Mouse, Touch, Pointer
1010from autopilot.platform import model
1111
@@ -13,7 +13,7 @@ from time import sleep
1313
1414from autopilot.introspection.dbus import IntrospectableObjectMetaclass
1515
16−class IndicatorsEmulatorBase(CustomEmulatorBase):
16+class IndicatorsIntrospectionObject(DBusIntrospectionObject):
1717
1818 """A common class that provides introspection and other helpers to indictors."""
1919
@@ -29,8 +29,3 @@ class IndicatorsEmulatorBase(CustomEmulatorBase):
2929 def setUp(self):
3030 self.pointing_device = Pointer(self.input_device_class.create())
3131 super(IndicatorsTestCase, self).setUp()
32−
33−
34− def plop(self):
35− print type(CustomEmulatorBase)
36− print "PLOP"
tests/autopilot/indicators_client/emulators/common.py+4−37
@@ -5,43 +5,10 @@
55# under the terms of the GNU General Public License version 3, as published
66# by the Free Software Foundation.
77
8−from indicators_client.emulators import IndicatorsEmulatorBase
8+from indicators_client.emulators import IndicatorsIntrospectionObject
99
10−class SwitchMenu(IndicatorsEmulatorBase):
10+class SwitchMenu(IndicatorsIntrospectionObject):
1111 """A switch menu control."""
1212
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):
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
13+class Switch(IndicatorsIntrospectionObject):
14+ """A switch control."""
tests/autopilot/indicators_client/emulators/main_window.py+2
@@ -5,6 +5,8 @@
55# under the terms of the GNU General Public License version 3, as published
66# by the Free Software Foundation.
77
8+from indicators_client.emulators import IndicatorsIntrospectionObject
9+
810class MainWindow(object):
911 """An emulator class that makes it easy to interact with the shell"""
1012
tests/autopilot/indicators_client/tests/__init__.py+1−3
@@ -15,7 +15,6 @@ from autopilot.matchers import Eventually
1515from autopilot.platform import model
1616from testtools.matchers import Equals
1717
18−from indicators_client.emulators import IndicatorsEmulatorBase
1918from indicators_client.emulators.main_window import MainWindow
2019from logging import getLogger
2120import sys
@@ -47,8 +46,7 @@ class IndicatorsTestCase(AutopilotTestCase):
4746 def launch_test_local(self):
4847 os.environ['LD_LIBRARY_PATH'] = "../../../unity_build/build/lib"
4948 os.environ['QML2_IMPORT_PATH'] = "../../builddir/plugins:../../builddir/tests/mocks"
50− self.app = self.launch_test_application("../../builddir/plugins/IndicatorsClient/client/indicators-client",
51− emulator_base=IndicatorsEmulatorBase)
49+ self.app = self.launch_test_application("../../builddir/Panel/indicatorsclient/indicators-client")
5250
5351 def skipWrapper(*args, **kwargs):
5452 pass
tests/autopilot/indicators_client/tests/test_power.py+34−4
@@ -11,7 +11,6 @@ from testtools.matchers import Equals, NotEquals
1111from autopilot.matchers import Eventually
1212
1313from indicators_client.tests import IndicatorsTestCase
14−from indicators_client.emulators.common import SwitchMenu, SliderMenu
1514from time import sleep
1615import random
1716import math
@@ -34,15 +33,46 @@ class TestDisplayMenus(IndicatorsTestCase):
3433 # self.main_window.get_indicators_client().reset()
3534 super(TestDisplayMenus, self).tearDown()
3635
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+
57+ while True:
58+
59+ pixels_to_move = int(pixel_ratio * (new_value - old_ab_value) / 15)
60+ if pixels_to_move == 0:
61+ break;
62+
63+ self.pointing_device.drag(self.pointing_device.x, self.pointing_device.y, self.pointing_device.x + pixels_to_move, self.pointing_device.y)
64+
65+ old_ab_value = brightness_slider.value
66+
3767 def test_auto_bright_switch(self):
3868 """Test the auto-bright switch"""
3969
4070 auto_brightness = self.app.select_single("SwitchMenu", objectName="auto-brightness")
4171 self.assertThat(auto_brightness, NotEquals(None))
4272
43− # old_ab_value = auto_brightness.checked
73+ old_ab_value = auto_brightness.checked
4474
45− auto_brightness.switch()
75+ self.switch_auto_brightness(auto_brightness)
4676
4777 # TODO - should check backend when it's introspectable.
4878 self.assertThat(auto_brightness.checked, Eventually(NotEquals(old_ab_value)))
@@ -60,7 +90,7 @@ class TestDisplayMenus(IndicatorsTestCase):
6090 if (abs(desired_value - old_ab_value) >= (brightness_menu.maximumValue - brightness_menu.minimumValue)/4):
6191 break;
6292
63− brightness_menu.set_value(desired_value)
93+ self.set_brightness_to_value(brightness_menu, desired_value)
6494
6595 # TODO - should check backend when it's introspectable.
6696 self.assertThat(brightness_menu.value, Eventually(NotEquals(old_ab_value)))
tests/data/unity/indicators/indicator-fake4.indicatornew file+4
@@ -0,0 +1,4 @@
1+[Indicator Service]
2+Name=indicator-fake4
3+DBusName=com.canonical.indicator.fake4
4+ObjectPath=/com/canonical/indicator/fake4
tests/plugins/IndicatorsClient/CMakeLists.txt+1−1
@@ -12,7 +12,7 @@ macro(run_tests)
1212 -o -,txt)
1313 add_test(NAME ${_test} COMMAND ${testCommand})
1414 add_custom_target(${_test} ${testCommand})
15− add_executable(${_test}Exec ${_test}.cpp fakeindicator.h
15+ add_executable(${_test}Exec ${_test}.cpp
1616 )
1717 qt5_use_modules(${_test}Exec Test Core Qml)
1818 target_link_libraries(${_test}Exec
tests/plugins/IndicatorsClient/fakeindicator.hdeleted−62
@@ -1,62 +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− * Nick Dedekind <nick.dedekind@canonical.com>
19− */
20−
21−#ifndef FAKE_INDICATORCLIENT_H
22−#define FAKE_INDICATORCLIENT_H
23−
24−#include "indicatorclient_common.h"
25−
26−class FakeIndicatorClient : public IndicatorClientCommon
27−{
28− Q_OBJECT
29− Q_PROPERTY(int initializedCount READ initializedCount)
30−public:
31− FakeIndicatorClient(QObject *parent=0)
32− : IndicatorClientCommon(parent)
33− , m_initializedCount(0)
34− {
35− }
36− void init(const QSettings& settings)
37− {
38− IndicatorClientCommon::init(settings);
39− m_initializedCount++;
40− }
41− int initializedCount() const { return m_initializedCount; }
42− void shutdown() { m_initializedCount--; }
43−
44− private:
45− int m_initializedCount;
46−};
47−
48−
49−#define FAKE_INDICATOR(number, title) \
50− class FakeIndicatorClient##number : public FakeIndicatorClient \
51− { \
52− public: \
53− FakeIndicatorClient##number(QObject *parent=0) \
54− : FakeIndicatorClient(parent) \
55− { \
56− setTitle(title); \
57− setPriority(number); \
58− } \
59− };
60−
61−
62−#endif
tests/plugins/IndicatorsClient/indicatorsmanagertest.cpp+16−26
@@ -17,27 +17,26 @@
1717 * Renato Araujo Oliveira Filho <renato@canonical.com>
1818 */
1919
20−#include "fakeindicator.h"
2120#include "indicatorsmanager.h"
22−#include "indicatorsfactory.h"
2321#include "paths.h"
2422
2523#include <QtTest>
2624#include <QDebug>
2725
28−FAKE_INDICATOR(1, "Fake Title 1")
29−FAKE_INDICATOR(2, "Fake Title 2")
30−
3126class IndicatorsManagerTest : public QObject
3227{
3328 Q_OBJECT
3429private Q_SLOTS:
3530
36− void initTestCase() {
31+ void initTestCase()
32+ {
33+ setenv("UNITY_TEST_ENV", "1", 1);
3734 setenv("XDG_DATA_DIRS", (sourceDirectory() + "/tests/data").toLatin1().data(), 1);
35+ }
3836
39− IndicatorsFactory::instance().registerIndicator<FakeIndicatorClient1>("indicator-fake1");
40− IndicatorsFactory::instance().registerIndicator<FakeIndicatorClient2>("indicator-fake2");
37+ void cleanupTestCase()
38+ {
39+ unsetenv("UNITY_TEST_ENV");
4140 }
4241
4342 /*
@@ -45,7 +44,6 @@ private Q_SLOTS:
4544 */
4645 void testLoad()
4746 {
48−
4947 IndicatorsManager manager;
5048
5149 QVERIFY(!manager.isLoaded());
@@ -54,7 +52,7 @@ private Q_SLOTS:
5452 manager.load();
5553
5654 QVERIFY(manager.isLoaded());
57− QCOMPARE(manager.indicators().count(), 2);
55+ QCOMPARE(manager.indicators().count(), 4);
5856
5957 manager.unload();
6058
@@ -70,19 +68,14 @@ private Q_SLOTS:
7068 IndicatorsManager manager;
7169 manager.load();
7270
73− IndicatorClientInterface::Ptr indicator = manager.indicator("indicator-fake1");
71+ Indicator::Ptr indicator = manager.indicator("indicator-fake1");
7472 QVERIFY(indicator.get());
7573
7674 QCOMPARE(indicator->identifier(), QString("indicator-fake1"));
77− QCOMPARE(indicator->title(), QString("Fake Title 1"));
78− QCOMPARE(indicator->label(), QString());
79− QCOMPARE(indicator->description(), QString());
80− QCOMPARE(indicator->priority(), 1);
8175
8276 // Check that the initial properties have been set.
83− IndicatorClientInterface::PropertiesMap props = indicator->initialProperties();
84− QCOMPARE(props.count(), 4);
85− QCOMPARE(props["title"].toString(), QString("Fake Title 1"));
77+ QVariantMap props = indicator->indicatorProperties().toMap();
78+ QCOMPARE(props.count(), 3);
8679 QCOMPARE(props["busType"].toInt(), 1);
8780 QCOMPARE(props["busName"].toString(), QString("com.canonical.indicator.fake1"));
8881 QCOMPARE(props["objectPath"].toString(), QString("/com/canonical/indicator/fake1"));
@@ -96,13 +89,13 @@ private Q_SLOTS:
9689 IndicatorsManager manager;
9790 manager.load();
9891
99− IndicatorClientInterface::Ptr i0 = manager.indicator("indicator-fake1");
100− IndicatorClientInterface::Ptr i1 = manager.indicator("indicator-fake1");
92+ Indicator::Ptr i0 = manager.indicator("indicator-fake1");
93+ Indicator::Ptr i1 = manager.indicator("indicator-fake1");
10194 QVERIFY(i0?true:false);
10295 QVERIFY(i1?true:false);
10396 QCOMPARE(i0, i1);
10497
105− IndicatorClientInterface::Ptr i2 = manager.indicator("indicator-fake2");
98+ Indicator::Ptr i2 = manager.indicator("indicator-fake2");
10699 QVERIFY(i2?true:false);
107100 QVERIFY(i2 != i1);
108101 QVERIFY(i2 != i1);
@@ -119,14 +112,11 @@ private Q_SLOTS:
119112 QPointer<QObject> pi0;
120113 QPointer<QObject> pi1;
121114 {
122− IndicatorClientInterface::Ptr i0 = manager.indicator("indicator-fake1");
115+ Indicator::Ptr i0 = manager.indicator("indicator-fake1");
123116 pi0 = dynamic_cast<QObject*>(i0.get());
124− QCOMPARE(pi0->property("initializedCount").toInt(), 1);
125117
126− IndicatorClientInterface::Ptr i1 = manager.indicator("indicator-fake1");
118+ Indicator::Ptr i1 = manager.indicator("indicator-fake1");
127119 pi1 = dynamic_cast<QObject*>(i1.get());
128− QCOMPARE(pi0->property("initializedCount").toInt(), 1);
129− QCOMPARE(pi1->property("initializedCount").toInt(), 1);
130120
131121 manager.unload();
132122 // still alive while we have the shared pointers.
tests/plugins/IndicatorsClient/indicatorsmodeltest.cpp+38−30
@@ -17,31 +17,30 @@
1717 * Renato Araujo Oliveira Filho <renato@canonical.com>
1818 */
1919
20−#include "fakeindicator.h"
2120#include "indicatorsmodel.h"
22−#include "indicatorsfactory.h"
2321#include "paths.h"
2422
2523#include <QtTest>
2624#include <QDebug>
2725
28−FAKE_INDICATOR(1, "Fake Title 1")
29−FAKE_INDICATOR(2, "Fake Title 2")
30−
3126class IndicatorsModelTest : public QObject
3227{
3328 Q_OBJECT
3429private Q_SLOTS:
3530
36− void initTestCase() {
31+ void initTestCase()
32+ {
33+ setenv("UNITY_TEST_ENV", "1", 1);
3734 setenv("XDG_DATA_DIRS", (sourceDirectory() + "/tests/data").toLatin1().data(), 1);
35+ }
3836
39− IndicatorsFactory::instance().registerIndicator<FakeIndicatorClient1>("indicator-fake1");
40− IndicatorsFactory::instance().registerIndicator<FakeIndicatorClient2>("indicator-fake2");
37+ void cleanupTestCase()
38+ {
39+ unsetenv("UNITY_TEST_ENV");
4140 }
4241
4342 /*
44− * Test if all plugins is loaded correct
43+ * Testa that all the plugins are loaded / unloaded correctly
4544 */
4645 void testLoad()
4746 {
@@ -51,7 +50,7 @@ private Q_SLOTS:
5150
5251 model.load();
5352
54− QCOMPARE(model.property("count").toInt(), 2);
53+ QCOMPARE(model.property("count").toInt(), 4);
5554
5655 model.unload();
5756
@@ -60,31 +59,40 @@ private Q_SLOTS:
6059 }
6160
6261 /*
63− * Test if the plugin data was loaded correct
62+ * Testa that the plugin data was loaded correctly
6463 */
65− void testDataOrder()
64+ void testDataAndOrder()
6665 {
66+ // Priority order. (2, 1, 4, 3)
67+ QVariantMap map;
68+ QVariantMap map1; map1["priority"] = 1; map1["title"] = "fake1";
69+ QVariantMap map2; map2["priority"] = 0; map2["title"] = "fake2";
70+ QVariantMap map3; map3["priority"] = 3; map3["title"] = "fake3";
71+ QVariantMap map4; map4["priority"] = 2; map4["title"] = "fake4";
72+ map["indicator-fake1"] = map1;
73+ map["indicator-fake2"] = map2;
74+ map["indicator-fake3"] = map3;
75+ map["indicator-fake4"] = map4;
76+
6777 IndicatorsModel model;
78+ model.setIndicatorData(map);
6879 model.load();
6980
70− QVariantMap data = model.get(0);
71− QCOMPARE(data["title"].toString(), QString("Fake Title 1"));
72− QCOMPARE(data["label"].toString(), QString());
73− QCOMPARE(data["description"].toString(), QString());
74− // There is no QML context
75− QVERIFY(!data["component"].value<QObject*>());
76− QCOMPARE(data["isValid"].toBool(), true);
77−
78− data = model.get(1);
79− QCOMPARE(data["title"].toString(), QString("Fake Title 2"));
80− QCOMPARE(data["label"].toString(), QString());
81− QCOMPARE(data["description"].toString(), QString());
82− // There is no QML context
83− QVERIFY(!data["component"].value<QObject*>());
84− QCOMPARE(data["isValid"].toBool(), true);
85−
86− data = model.get(3);
87− QVERIFY(data.isEmpty());
81+ QCOMPARE(model.get(0)["identifier"].toString(), QString("indicator-fake2"));
82+ QCOMPARE(model.get(0)["title"].toString(), QString("fake2"));
83+ QCOMPARE(model.get(0)["indicatorProperties"].toMap()["busName"].toString(), QString("com.canonical.indicator.fake2"));
84+
85+ QCOMPARE(model.get(1)["identifier"].toString(), QString("indicator-fake1"));
86+ QCOMPARE(model.get(1)["title"].toString(), QString("fake1"));
87+ QCOMPARE(model.get(1)["indicatorProperties"].toMap()["busName"].toString(), QString("com.canonical.indicator.fake1"));
88+
89+ QCOMPARE(model.get(2)["identifier"].toString(), QString("indicator-fake4"));
90+ QCOMPARE(model.get(2)["title"].toString(), QString("fake4"));
91+ QCOMPARE(model.get(2)["indicatorProperties"].toMap()["busName"].toString(), QString("com.canonical.indicator.fake4"));
92+
93+ QCOMPARE(model.get(3)["identifier"].toString(), QString("indicator-fake3"));
94+ QCOMPARE(model.get(3)["title"].toString(), QString("fake3"));
95+ QCOMPARE(model.get(3)["indicatorProperties"].toMap()["busName"].toString(), QString("com.canonical.indicator.fake3"));
8896 }
8997};
9098
tests/qmltests/CMakeLists.txt+5−5
@@ -57,11 +57,11 @@ add_qml_test(Hud Hud)
5757add_qml_test(Hud Result)
5858add_qml_test(Launcher Launcher IMPORT_PATHS ${CMAKE_BINARY_DIR}/plugins ${qmltest_DEFAULT_IMPORT_PATHS})
5959add_qml_test(Notifications Notifications)
60−add_qml_test(Panel IndicatorRow)
61−add_qml_test(Panel Indicators)
62−add_qml_test(Panel MenuContent)
63−add_qml_test(Panel Overview)
64−add_qml_test(Panel Panel)
60+add_qml_test(Panel IndicatorRow IMPORT_PATHS ${CMAKE_BINARY_DIR}/plugins ${qmltest_DEFAULT_IMPORT_PATHS})
61+add_qml_test(Panel Indicators IMPORT_PATHS ${CMAKE_BINARY_DIR}/plugins ${qmltest_DEFAULT_IMPORT_PATHS})
62+add_qml_test(Panel MenuContent IMPORT_PATHS ${CMAKE_BINARY_DIR}/plugins ${qmltest_DEFAULT_IMPORT_PATHS})
63+add_qml_test(Panel Overview IMPORT_PATHS ${CMAKE_BINARY_DIR}/plugins ${qmltest_DEFAULT_IMPORT_PATHS})
64+add_qml_test(Panel Panel IMPORT_PATHS ${CMAKE_BINARY_DIR}/plugins ${qmltest_DEFAULT_IMPORT_PATHS})
6565add_qml_test(Panel SearchIndicator)
6666add_qml_test(Panel/Menus IndicatorMenuWindow IMPORT_PATHS ${qmltest_DEFAULT_IMPORT_PATHS})
6767add_qml_test(SideStage SideStage IMPORT_PATHS ${qmltest_DEFAULT_IMPORT_PATHS}
tests/qmltests/Panel/tst_IndicatorItem.qml+13−28
@@ -29,54 +29,39 @@ Rectangle {
2929 IndicatorItem {
3030 id: indicatorItem
3131 anchors.fill: parent
32− iconSource: "../../../Panel/graphics/Clock.png"
33− label: "Clock"
3432 }
3533
3634 UT.UnityTestCase {
3735 name: "IndicatorItem"
3836
3937 function init_test() {
40− indicatorItem.iconSource = "../../../Panel/graphics/Clock.png"
41− indicatorItem.label = "Clock"
4238 }
4339
4440 function test_dimmed() {
4541 init_test()
4642
47− var itemRow = findChild(indicatorItem, "itemRow")
4843 indicatorItem.dimmed = true
49− compare(itemRow.opacity > 0, true, "IndicatorItem opacity should not be 0")
50− compare(itemRow.opacity < 1, true, "IndicatorItem opacity should not be 1")
44+ compare(indicatorItem.opacity > 0, true, "IndicatorItem opacity should not be 0")
45+ compare(indicatorItem.opacity < 1, true, "IndicatorItem opacity should not be 1")
5146 }
5247
53− function test_empty() {
54− init_test()
55−
56− indicatorItem.iconSource = ""
57− indicatorItem.label = ""
58− compare(indicatorItem.visible, false, "IndicatorItem should not be visible")
59− }
48+ function test_highlight() {
49+ var itemHighlight = findChild(indicatorItem, "highlight")
50+ verify(itemHighlight != undefined)
6051
61− function test_noLabel() {
62− init_test()
52+ indicatorItem.highlighted = true;
53+ compare(itemHighlight.visible, true, "Indicator should be highlighted")
6354
64− var itemImage = findChild(indicatorItem, "itemImage")
65− var itemLabel = findChild(indicatorItem, "itemLabel")
66− indicatorItem.label = ""
67− compare(itemImage.visible, true, "The image should be visible")
68− compare(itemImage.width > 0, true, "The image should have a positive width")
69− compare(itemLabel.width > 0, false, "The label should not have a positive width")
55+ indicatorItem.highlighted = false;
56+ compare(itemHighlight.visible, false, "Indicator should not be highlighted")
7057 }
7158
72− function test_noImage() {
59+ function test_empty() {
7360 init_test()
7461
75− var itemImage = findChild(indicatorItem, "itemImage")
76− var itemLabel = findChild(indicatorItem, "itemLabel")
77− indicatorItem.iconSource = ""
78− compare(itemImage.visible, false, "The image should not be visible")
79− compare(itemLabel.width > 0, true, "The label should have a positive width")
62+ compare(indicatorItem.visible, false, "IndicatorItem should not be visible.")
63+ indicatorItem.iconQml = "qrc:/tests/indciatorsclient/qml/fake_menu_icon1.qml";
64+ tryCompare(indicatorItem, "visible", true)
8065 }
8166 }
8267}
tests/qmltests/Panel/tst_IndicatorRow.qml+3−1
@@ -53,6 +53,7 @@ Item {
5353
5454 IndicatorsClient.IndicatorsModel {
5555 id: indicatorModel
56+ Component.onCompleted: load()
5657 }
5758
5859 UT.UnityTestCase {
@@ -177,6 +178,7 @@ Item {
177178 }
178179
179180 function test_intial_state() {
181+ wait(1000)
180182 init_test();
181183
182184 indicatorRow.state = "initial";
@@ -241,7 +243,7 @@ Item {
241243 compare(get_indicator_item_at(4).dimmed, true, "Other indicators should dim when in locked state");
242244 }
243245
244− function test_active_overview_() {
246+ function test_active_overview() {
245247 init_test();
246248
247249 indicatorRow.overviewActive = true;
tests/qmltests/Panel/tst_MenuContent.qml+9−8
@@ -27,11 +27,11 @@ Item {
2727 height: units.gu(70)
2828
2929 property var indicator_status: {
30− 'menu_plugin1': { 'started': false, 'reset': 0 },
31− 'menu_plugin2': { 'started': false, 'reset': 0 },
32− 'menu_plugin3': { 'started': false, 'reset': 0 },
33− 'menu_plugin4': { 'started': false, 'reset': 0 },
34− 'menu_plugin5': { 'started': false, 'reset': 0 }
30+ 'menu_page1': { 'started': false, 'reset': 0 },
31+ 'menu_page2': { 'started': false, 'reset': 0 },
32+ 'menu_page3': { 'started': false, 'reset': 0 },
33+ 'menu_page4': { 'started': false, 'reset': 0 },
34+ 'menu_page5': { 'started': false, 'reset': 0 }
3535 }
3636
3737 // Dummy objects
@@ -41,6 +41,7 @@ Item {
4141
4242 IndicatorsClient.IndicatorsModel {
4343 id: indicatorsModel
44+ Component.onCompleted: load()
4445 }
4546
4647 MenuContent {
@@ -123,20 +124,20 @@ Item {
123124 }
124125
125126 function get_test_menu_objecName(index) {
126− return "menu_plugin"+(index+1);
127+ return "menu_page"+(index+1);
127128 }
128129
129130 property string test_menu_objectName : ""
130131 function current_menu_equals_test_menu() {
131132 var current_loader = menu_content_test.findChild(menuContent, "menus").currentItem
132133 if (current_loader == undefined) {
133− console.log("current_loader undefined");
134+ console.log("current_loader 'menus' undefined");
134135 return false;
135136 }
136137
137138 var menu = menu_content_test.findChild(menuContent, test_menu_objectName);
138139 if (menu == undefined) {
139− console.log("test_menu undefined");
140+ console.log("test_menu " + test_menu_objectName + " undefined");
140141 return false;
141142 }
142143
tests/qmltests/Panel/tst_Overview.qml+5−17
@@ -20,6 +20,7 @@ import ".."
2020import "../../../Panel/Menus"
2121import "../../../Components"
2222import Unity.Test 0.1 as UT
23+import IndicatorsClient 0.1
2324
2425Rectangle {
2526 id: shell
@@ -47,9 +48,9 @@ Rectangle {
4748
4849 ListModel {
4950 id: mockModel
50− ListElement {title: "foo"; label: "foo"; iconSource: "graphics/sound_on_icon.png"}
51− ListElement {title: "bar"; label: ""; iconSource: "graphics/sound_on_icon.png"}
52− ListElement {title: "baz"; label: "baz"; iconSource: "graphics/sound_on_icon.png"}
51+ ListElement {title: "fake1"; iconQml: "qrc:/tests/indciatorsclient/qml/fake_menu_icon1.qml"; indicatorProperties: ""}
52+ ListElement {title: "fake2"; iconQml: "qrc:/tests/indciatorsclient/qml/fake_menu_icon2.qml"; indicatorProperties: ""}
53+ ListElement {title: "fake3"; iconQml: "qrc:/tests/indciatorsclient/qml/fake_menu_icon3.qml"; indicatorProperties: ""}
5354 }
5455
5556 ListModel {
@@ -98,7 +99,7 @@ Rectangle {
9899 button = findChild(overview, "overviewGridButton3");
99100 compare(button, undefined, "There should only be 3 buttons... found at least 4...");
100101
101− mockModel2.append({title: "humppa", label: "", iconSource: "graphics/sound_on_icon.png"})
102+ mockModel2.append({title: "humppa", iconQml: "qrc:/tests/indciatorsclient/qml/fake_menu_icon4.qml", indicatorProperties: ""})
102103 overviewGrid.forceLayout();
103104 waitForRendering(overviewGrid);
104105
@@ -106,19 +107,6 @@ Rectangle {
106107 verify(button !== undefined, "button3 wasn't found");
107108 }
108109
109− function test_text_or_icon_data() {
110− return [
111− {tag: "text", index: 0, imageVisible: false},
112− {tag: "image", index: 1, imageVisible: true}
113− ]
114− }
115−
116− function test_text_or_icon(data) {
117− var button = findChild(overview, "overviewGridButton" + data.index);
118− var image = findChild(button, "overviewGridButtonImage");
119− compare(image.visible, data.imageVisible)
120− }
121−
122110 function test_volume_slider_data() {
123111 return [
124112 {tag: "0%", sliderPos:0},
tests/qmltests/plugins/CMakeLists.txt+1
@@ -1,3 +1,4 @@
11add_subdirectory(HudClient)
2+add_subdirectory(IndicatorsClient)
23add_subdirectory(Ubuntu)
34add_subdirectory(Unity)
tests/qmltests/plugins/IndicatorsClient/CMakeLists.txtnew file+59
@@ -0,0 +1,59 @@
1+project(IndicatorsClientFakeQml)
2+
3+find_package(Qt5Core REQUIRED)
4+find_package(Qt5Quick REQUIRED)
5+
6+include_directories(
7+ ${CMAKE_CURRENT_SOURCE_DIR}
8+ ${CMAKE_CURRENT_BINARY_DIR}
9+ ${Qt5Core_INCLUDE_DIRS}
10+ ${Qt5Quick_INCLUDE_DIRS}
11+)
12+
13+set(IndicatorsClientFakeQml_SOURCES
14+ plugin.cpp
15+)
16+
17+set(IndicatorsClientFakeQml_RESOURCES
18+ indicatorsclient_fake.qrc
19+)
20+
21+qt5_add_resources(IndicatorsClientFakeQml_RESOURCES_RCC
22+ ${IndicatorsClientFakeQml_RESOURCES}
23+)
24+
25+add_library(IndicatorsClientFakeQml SHARED
26+ ${IndicatorsClientFakeQml_RESOURCES_RCC}
27+ ${IndicatorsClientFakeQml_SOURCES}
28+)
29+# Because this is an internal support library, we want
30+# to expose all symbols in it. Consider changing this
31+# either to a static library or just using the
32+# files directly in targets.
33+set_target_properties(IndicatorsClientFakeQml PROPERTIES COMPILE_FLAGS -fvisibility=default)
34+
35+target_link_libraries(IndicatorsClientFakeQml
36+ ${Qt5Core_LIBRARIES}
37+ ${Qt5Quick_LIBRARIES}
38+ ${GOBJECT_LDFLAGS}
39+ ${QMENUMODEL_LDFLAGS}
40+)
41+
42+qt5_use_modules(IndicatorsClientFakeQml Qml)
43+
44+
45+
46+file(GLOB IndicatorsClientFake_QMLFILES
47+ *.qml
48+ qml/FakeMenuPage.qml
49+)
50+
51+# copy qmldir file into build directory for shadow builds
52+file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/qmldir"
53+ DESTINATION ${CMAKE_CURRENT_BINARY_DIR}
54+)
55+
56+# copy qmldir file into build directory for shadow builds
57+file(COPY ${IndicatorsClientFake_QMLFILES}
58+ DESTINATION ${CMAKE_CURRENT_BINARY_DIR}
59+)
tests/qmltests/plugins/IndicatorsClient/IndicatorsModel.qmlnew file+76
@@ -0,0 +1,76 @@
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+
19+ListModel {
20+
21+ property var indicatorData : undefined
22+
23+ function load() {}
24+
25+ ListElement {
26+ identifier: "indicator-fake1";
27+ priority: 0
28+ title: "Menu1";
29+ description: "";
30+ iconQml: "qrc:/tests/indciatorsclient/qml/fake_menu_icon1.qml";
31+ pageQml: "qrc:/tests/indciatorsclient/qml/fake_menu_page1.qml";
32+ indicatorProperties: "";
33+ isValid: "";
34+ }
35+ ListElement {
36+ identifier: "indicator-fake2";
37+ priority: 1
38+ title: "Menu2";
39+ description: "";
40+ iconQml: "qrc:/tests/indciatorsclient/qml/fake_menu_icon2.qml";
41+ pageQml: "qrc:/tests/indciatorsclient/qml/fake_menu_page2.qml";
42+ indicatorProperties: "";
43+ isValid: "";
44+ }
45+ ListElement {
46+ identifier: "indicator-fake3";
47+ priority: 2
48+ title: "Menu3";
49+ description: "";
50+ iconQml: "qrc:/tests/indciatorsclient/qml/fake_menu_icon3.qml";
51+ pageQml: "qrc:/tests/indciatorsclient/qml/fake_menu_page3.qml";
52+ indicatorProperties: "";
53+ isValid: "";
54+ }
55+ ListElement {
56+ identifier: "indicator-fake4";
57+ priority: 3
58+ title: "Menu4";
59+ description: "";
60+ iconQml: "qrc:/tests/indciatorsclient/qml/fake_menu_icon4.qml";
61+ pageQml: "qrc:/tests/indciatorsclient/qml/fake_menu_page4.qml";
62+ indicatorProperties: "";
63+ isValid: "";
64+ }
65+ ListElement {
66+ identifier: "indicator-fake4";
67+ priority: 4
68+ title: "Menu5";
69+ description: "";
70+ iconQml: "qrc:/tests/indciatorsclient/qml/fake_menu_icon5.qml";
71+ pageQml: "qrc:/tests/indciatorsclient/qml/fake_menu_page5.qml";
72+ indicatorProperties: "";
73+ isValid: "";
74+ }
75+
76+}
tests/qmltests/plugins/IndicatorsClient/indicatorsclient_fake.qrcnew file+14
@@ -0,0 +1,14 @@
1+<RCC>
2+ <qresource prefix="/tests/indciatorsclient">
3+ <file>qml/fake_menu_icon1.qml</file>
4+ <file>qml/fake_menu_icon2.qml</file>
5+ <file>qml/fake_menu_icon3.qml</file>
6+ <file>qml/fake_menu_icon4.qml</file>
7+ <file>qml/fake_menu_icon5.qml</file>
8+ <file>qml/fake_menu_page1.qml</file>
9+ <file>qml/fake_menu_page2.qml</file>
10+ <file>qml/fake_menu_page3.qml</file>
11+ <file>qml/fake_menu_page4.qml</file>
12+ <file>qml/fake_menu_page5.qml</file>
13+ </qresource>
14+</RCC>
tests/qmltests/plugins/IndicatorsClient/plugin.cppnew file+30
@@ -0,0 +1,30 @@
1+/*
2+ * Copyright (C) 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 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+ * Author: Michał Sawicz <michal.sawicz@canonical.com>
17+ */
18+
19+// Qt
20+#include <QtQml>
21+
22+// self
23+#include "plugin.h"
24+
25+// local
26+
27+void IndicatorsClientPlugin::registerTypes(const char *)
28+{
29+ Q_INIT_RESOURCE(indicatorsclient_fake);
30+}
tests/qmltests/plugins/IndicatorsClient/plugin.hnew file+32
@@ -0,0 +1,32 @@
1+/*
2+ * Copyright (C) 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 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+ * Author: Nick Dedekind <nick.dedekind@canonical.com>
17+ */
18+
19+#ifndef INDICATORSCLIENT_PLUGIN_H
20+#define INDICATORSCLIENT_PLUGIN_H
21+
22+#include <QtQml/QQmlExtensionPlugin>
23+
24+class IndicatorsClientPlugin : public QQmlExtensionPlugin
25+{
26+ Q_OBJECT
27+ Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
28+public:
29+ void registerTypes(const char *uri);
30+};
31+
32+#endif // INDICATORSCLIENT_PLUGIN_H
tests/qmltests/Panel/qml/FakeMenuPlugin.qml → tests/qmltests/plugins/IndicatorsClient/qml/FakeMenuPage.qmlrenamed

The content is the same.

tests/qmltests/plugins/IndicatorsClient/qml/fake_menu_icon1.qmlnew file+7
@@ -0,0 +1,7 @@
1+import QtQuick 2.0
2+
3+Rectangle {
4+ width: 40
5+ height: 40
6+ color : "red"
7+}
tests/qmltests/plugins/IndicatorsClient/qml/fake_menu_icon2.qmlnew file+7
@@ -0,0 +1,7 @@
1+import QtQuick 2.0
2+
3+Rectangle {
4+ width: 40
5+ height: 40
6+ color : "yellow"
7+}
tests/qmltests/plugins/IndicatorsClient/qml/fake_menu_icon3.qmlnew file+7
@@ -0,0 +1,7 @@
1+import QtQuick 2.0
2+
3+Rectangle {
4+ width: 40
5+ height: 40
6+ color : "blue"
7+}
tests/qmltests/plugins/IndicatorsClient/qml/fake_menu_icon4.qmlnew file+7
@@ -0,0 +1,7 @@
1+import QtQuick 2.0
2+
3+Rectangle {
4+ width: 40
5+ height: 40
6+ color : "green"
7+}
tests/qmltests/plugins/IndicatorsClient/qml/fake_menu_icon5.qmlnew file+7
@@ -0,0 +1,7 @@
1+import QtQuick 2.0
2+
3+Rectangle {
4+ width: 40
5+ height: 40
6+ color : "orange"
7+}
tests/qmltests/Panel/qml/fake_menu_plugin1.qml → tests/qmltests/plugins/IndicatorsClient/qml/fake_menu_page1.qmlrenamed+3−2
@@ -15,10 +15,11 @@
1515 */
1616
1717import QtQuick 2.0
18+import IndicatorsClient 0.1 as IndicatorsClient
1819
19−FakeMenuPlugin {
20+IndicatorsClient.FakeMenuPage {
2021 id: menu_plugin1
21− objectName: "menu_plugin1"
22+ objectName: "menu_page1"
2223
2324 Rectangle {
2425 id: contents
tests/qmltests/Panel/qml/fake_menu_plugin2.qml → tests/qmltests/plugins/IndicatorsClient/qml/fake_menu_page2.qmlrenamed+3−2
@@ -15,10 +15,11 @@
1515 */
1616
1717import QtQuick 2.0
18+import IndicatorsClient 0.1 as IndicatorsClient
1819
19−FakeMenuPlugin {
20+IndicatorsClient.FakeMenuPage {
2021 id: menu_plugin2
21− objectName: "menu_plugin2"
22+ objectName: "menu_page2"
2223
2324 Rectangle {
2425 id: contents
tests/qmltests/Panel/qml/fake_menu_plugin3.qml → tests/qmltests/plugins/IndicatorsClient/qml/fake_menu_page3.qmlrenamed+3−2
@@ -15,10 +15,11 @@
1515 */
1616
1717import QtQuick 2.0
18+import IndicatorsClient 0.1 as IndicatorsClient
1819
19−FakeMenuPlugin {
20+IndicatorsClient.FakeMenuPage {
2021 id: menu_plugin3
21− objectName: "menu_plugin3"
22+ objectName: "menu_page3"
2223
2324 Rectangle {
2425 id: contents
tests/qmltests/Panel/qml/fake_menu_plugin4.qml → tests/qmltests/plugins/IndicatorsClient/qml/fake_menu_page4.qmlrenamed+3−2
@@ -15,10 +15,11 @@
1515 */
1616
1717import QtQuick 2.0
18+import IndicatorsClient 0.1 as IndicatorsClient
1819
19−FakeMenuPlugin {
20+IndicatorsClient.FakeMenuPage {
2021 id: menu_plugin4
21− objectName: "menu_plugin4"
22+ objectName: "menu_page4"
2223
2324 Rectangle {
2425 id: contents
tests/qmltests/Panel/qml/fake_menu_plugin5.qml → tests/qmltests/plugins/IndicatorsClient/qml/fake_menu_page5.qmlrenamed+3−2
@@ -15,10 +15,11 @@
1515 */
1616
1717import QtQuick 2.0
18+import IndicatorsClient 0.1 as IndicatorsClient
1819
19−FakeMenuPlugin {
20+IndicatorsClient.FakeMenuPage {
2021 id: menu_plugin5
21− objectName: "menu_plugin5"
22+ objectName: "menu_page5"
2223
2324 Rectangle {
2425 id: contents
tests/qmltests/plugins/IndicatorsClient/qmldirnew file+5
@@ -0,0 +1,5 @@
1+module IndicatorsClient
2+plugin IndicatorsClientFakeQml
3+
4+IndicatorsModel 0.1 IndicatorsModel.qml
5+FakeMenuPage 0.1 FakeMenuPage.qml