Merge lp:~lukas-kde/unity8/convergedIndicators into lp:unity8

Proposed by Lukáš Tinkl on 2015-11-20
Status: Merged
Approved by: Albert Astals Cid on 2015-12-02
Approved revision: 2050
Merged at revision: 2087
Proposed branch: lp:~lukas-kde/unity8/convergedIndicators
Merge into: lp:unity8
Diff against target: 443 lines (+76/-40)
16 files modified
plugins/Unity/Indicators/CMakeLists.txt (+2/-1)
plugins/Unity/Indicators/actionrootstate.h (+1/-1)
plugins/Unity/Indicators/indicator.cpp (+2/-3)
plugins/Unity/Indicators/indicator.h (+1/-1)
plugins/Unity/Indicators/indicatorsmanager.cpp (+31/-15)
plugins/Unity/Indicators/indicatorsmanager.h (+4/-1)
plugins/Unity/Indicators/indicatorsmodel.cpp (+5/-5)
plugins/Unity/Indicators/indicatorsmodel.h (+1/-1)
plugins/Unity/Indicators/menucontentactivator.h (+1/-1)
plugins/Unity/Indicators/modelprinter.h (+1/-1)
plugins/Unity/Platform/CMakeLists.txt (+2/-0)
plugins/Unity/Platform/platform.cpp (+13/-4)
plugins/Unity/Platform/platform.h (+7/-1)
qml/Components/VolumeControl.qml (+2/-2)
qml/Shell.qml (+2/-2)
tests/plugins/Unity/Indicators/CMakeLists.txt (+1/-1)
To merge this branch: bzr merge lp:~lukas-kde/unity8/convergedIndicators
Reviewer Review Type Date Requested Status
Albert Astals Cid (community) 2015-11-20 Approve on 2015-12-02
PS Jenkins bot continuous-integration Needs Fixing on 2015-12-02
Review via email: mp+278170@code.launchpad.net

Commit Message

Indicators convergence: use the "phone" profile everywhere

Description of the Change

Indicators: use the "phone" profile everywhere

Objective: functionality available does not change when switching the UI mode. Cf. https://docs.google.com/presentation/d/1W6QO7ARTD4C3bNrgTCWIEvFpYZrAWD3hDUM8mInmHmM

There are 2 notable exceptions:
1) session indicator: enabled conditionally, typically when running in a multisession/multiuser environment
2) battery/power indicator: we still use the "desktop" profile on a PC as we can't (yet) control the brightness

Additionally, cleanup the code a bit.

To post a comment you must log in.
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Continuous integration, rev:2046
http://jenkins.qa.ubuntu.com/job/unity8-ci/6802/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-vivid-touch/5387
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-xenial-touch/217/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity-phablet-qmluitests-vivid/1513
    FAILURE: http://jenkins.qa.ubuntu.com/job/unity8-qmluitest-xenial-amd64/215/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-vivid-amd64-ci/1408
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-vivid-i386-ci/1408
    FAILURE: http://jenkins.qa.ubuntu.com/job/unity8-xenial-amd64-ci/215/console
    FAILURE: http://jenkins.qa.ubuntu.com/job/unity8-xenial-i386-ci/214/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-vivid-touch/4259
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-vivid-armhf/5401
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-vivid-armhf/5401/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/25468
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-xenial-touch/68/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-xenial-armhf/216
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-xenial-armhf/216/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/25467

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/unity8-ci/6802/rebuild

review: Needs Fixing (continuous-integration)
Albert Astals Cid (aacid) wrote :

Text conflict in plugins/Unity/Platform/platform.cpp
1 conflicts encountered.

2047. By Lukáš Tinkl on 2015-11-30

merge trunk, resolve conflicts

Lukáš Tinkl (lukas-kde) wrote :

> Text conflict in plugins/Unity/Platform/platform.cpp
> 1 conflicts encountered.

Fixed

PS Jenkins bot (ps-jenkins) wrote :

FAILED: Continuous integration, rev:2047
http://jenkins.qa.ubuntu.com/job/unity8-ci/6831/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-vivid-touch/5486
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-xenial-touch/246/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity-phablet-qmluitests-vivid/1542
    FAILURE: http://jenkins.qa.ubuntu.com/job/unity8-qmluitest-xenial-amd64/245/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-vivid-amd64-ci/1437
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-vivid-i386-ci/1437
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-xenial-amd64-ci/244
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-xenial-i386-ci/243
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-vivid-touch/4316
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-vivid-armhf/5500
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-vivid-armhf/5500/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/25626
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-xenial-touch/87/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-xenial-armhf/245
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-xenial-armhf/245/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/25625

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/unity8-ci/6831/rebuild

review: Needs Fixing (continuous-integration)
Albert Astals Cid (aacid) wrote :

Some questions:

* The "indicator-keyboard" blacklist seems unrelated, no? Is this that we even get in the "phone" profile?

* Why move m_iface creation to init()?

* Do we want to keep the qDebug from init()

* If m_iface and m_seatIface are only to be in init() maybe we can make them function variables instead of class members and save some memory?

* Why do we need "property variant muteActionObject: indicators.indicatorsModel.profile === "desktop" ? action("mute") : action("silent-mode")" if the profile is always "phone"?

review: Needs Information
Lukáš Tinkl (lukas-kde) wrote :

> Some questions:
>
> * The "indicator-keyboard" blacklist seems unrelated, no? Is this that we even
> get in the "phone" profile?

Right, that's probably not needed now that we'll always use the "phone" mode

> * Why move m_iface creation to init()?

To decouple the DBUS related stuff from the constructor

> * Do we want to keep the qDebug from init()

Nope, I'll make it a qCDebug()

> * If m_iface and m_seatIface are only to be in init() maybe we can make them
> function variables instead of class members and save some memory?

Good point yeah

> * Why do we need "property variant muteActionObject:
> indicators.indicatorsModel.profile === "desktop" ? action("mute") : action
> ("silent-mode")" if the profile is always "phone"?

Yup, still not sure about the fate of the sound-indicator, for example currently the "Silent mode" when running on a PC doesn't mute the sound at all...

2048. By Lukáš Tinkl on 2015-12-01

address review issues

remove debug, use local variables, nuke unneeded keyboard quirk

Lukáš Tinkl (lukas-kde) wrote :

All the issues pointed out should be addressed

2049. By Lukáš Tinkl on 2015-12-01

drop unused include

PS Jenkins bot (ps-jenkins) wrote :

FAILED: Continuous integration, rev:2049
http://jenkins.qa.ubuntu.com/job/unity8-ci/6861/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-vivid-touch/5539
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-xenial-touch/276/console
    FAILURE: http://jenkins.qa.ubuntu.com/job/unity-phablet-qmluitests-vivid/1572/console
    FAILURE: http://jenkins.qa.ubuntu.com/job/unity8-qmluitest-xenial-amd64/275/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-vivid-amd64-ci/1467
    FAILURE: http://jenkins.qa.ubuntu.com/job/unity8-vivid-i386-ci/1467/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-xenial-amd64-ci/274
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-xenial-i386-ci/273
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-vivid-touch/4336
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-vivid-armhf/5553
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-vivid-armhf/5553/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/25686
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-xenial-touch/96/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-xenial-armhf/275
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-xenial-armhf/275/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/25685

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/unity8-ci/6861/rebuild

review: Needs Fixing (continuous-integration)
Albert Astals Cid (aacid) wrote :

Triggered a CI rebuild.

Albert Astals Cid (aacid) wrote :

After testing this i see i get an empty "indicator-keyboard", i guess my suggestion that it'd be gone because we are in "phone" mode is wrong and we just load all the indicators installed in the PC.

So unless we're going to fix it i guess you should bring back the blackilist with a big "TODO FIXME".

What do you think?

review: Needs Information
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Continuous integration, rev:2049
http://jenkins.qa.ubuntu.com/job/unity8-ci/6862/
Executed test runs:
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-vivid-touch/5542
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-xenial-touch/277/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity-phablet-qmluitests-vivid/1573
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/unity8-qmluitest-xenial-amd64/276
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-vivid-amd64-ci/1468
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-vivid-i386-ci/1468
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-xenial-amd64-ci/275
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-xenial-i386-ci/274
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-vivid-touch/4339
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-vivid-armhf/5556
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-vivid-armhf/5556/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/25701
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-xenial-touch/97/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-xenial-armhf/276
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-xenial-armhf/276/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/25700

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/unity8-ci/6862/rebuild

review: Needs Fixing (continuous-integration)
2050. By Lukáš Tinkl on 2015-12-02

reinstate the keyboard-indicator filtering

looks like this is always loaded

Lukáš Tinkl (lukas-kde) wrote :

> After testing this i see i get an empty "indicator-keyboard", i guess my
> suggestion that it'd be gone because we are in "phone" mode is wrong and we
> just load all the indicators installed in the PC.
>
> So unless we're going to fix it i guess you should bring back the blackilist
> with a big "TODO FIXME".
>
> What do you think?

Ye, I re-added the filter

PS Jenkins bot (ps-jenkins) wrote :

FAILED: Continuous integration, rev:2050
http://jenkins.qa.ubuntu.com/job/unity8-ci/6865/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-vivid-touch/5545
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-xenial-touch/280/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity-phablet-qmluitests-vivid/1576
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/unity8-qmluitest-xenial-amd64/279
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-vivid-amd64-ci/1471
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-vivid-i386-ci/1471
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-xenial-amd64-ci/278
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-xenial-i386-ci/277
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-vivid-touch/4342
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-vivid-armhf/5559
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-vivid-armhf/5559/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/25709
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-xenial-touch/99/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-xenial-armhf/279
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-xenial-armhf/279/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/25708

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/unity8-ci/6865/rebuild

review: Needs Fixing (continuous-integration)
Albert Astals Cid (aacid) wrote :

 * Did you perform an exploratory manual test run of the code change and any related functionality?
Yes

 * Did CI run pass? If not, please explain why.
Yes, Vivid

 * Did you make sure that the branch does not contain spurious tags?
Yes

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plugins/Unity/Indicators/CMakeLists.txt'
2--- plugins/Unity/Indicators/CMakeLists.txt 2015-01-20 16:21:07 +0000
3+++ plugins/Unity/Indicators/CMakeLists.txt 2015-12-02 12:03:29 +0000
4@@ -29,6 +29,7 @@
5 sharedunitymenumodel.cpp
6 unitymenumodelcache.cpp
7 unitymenumodelstack.cpp
8+ ${CMAKE_SOURCE_DIR}/plugins/Unity/Platform/platform.cpp
9 )
10 add_definitions(-DUNITYINDICATORS_LIBRARY)
11
12@@ -42,6 +43,6 @@
13 ${QMENUMODEL_LDFLAGS}
14 )
15
16-qt5_use_modules(IndicatorsQml Core Qml Quick)
17+qt5_use_modules(IndicatorsQml Core Qml Quick DBus)
18
19 add_unity8_plugin(Unity.Indicators 0.1 Unity/Indicators TARGETS IndicatorsQml)
20
21=== modified file 'plugins/Unity/Indicators/actionrootstate.h'
22--- plugins/Unity/Indicators/actionrootstate.h 2014-11-11 10:45:41 +0000
23+++ plugins/Unity/Indicators/actionrootstate.h 2015-12-02 12:03:29 +0000
24@@ -30,7 +30,7 @@
25 Q_PROPERTY(QString actionName READ actionName WRITE setActionName NOTIFY actionNameChanged)
26
27 public:
28- ActionRootState(QObject *parent = 0);
29+ ActionRootState(QObject *parent = nullptr);
30
31 QDBusActionGroup *actionGroup() const;
32 void setActionGroup(QDBusActionGroup *actionGroup);
33
34=== modified file 'plugins/Unity/Indicators/indicator.cpp'
35--- plugins/Unity/Indicators/indicator.cpp 2015-09-14 09:11:08 +0000
36+++ plugins/Unity/Indicators/indicator.cpp 2015-12-02 12:03:29 +0000
37@@ -44,10 +44,9 @@
38
39 setId(settings.value(QStringLiteral("Indicator Service/Name")).toString());
40
41- QString actionObjectPath = settings.value(QStringLiteral("Indicator Service/ObjectPath")).toString();
42+ const QString actionObjectPath = settings.value(QStringLiteral("Indicator Service/ObjectPath")).toString();
43
44 QVariantMap properties;
45- properties.clear();
46 properties.insert(QStringLiteral("busType"), 1);
47 properties.insert(QStringLiteral("busName"), busName);
48 properties.insert(QStringLiteral("actionsObjectPath"), actionObjectPath);
49@@ -87,7 +86,7 @@
50 pos = m_settings.value(QStringLiteral("Indicator Service/Position"), QVariant::fromValue(0));
51 setPosition(pos.toInt());
52
53- QString menuObjectPath = m_settings.value(profile + "/ObjectPath").toString();
54+ const QString menuObjectPath = m_settings.value(profile + "/ObjectPath").toString();
55 QVariantMap map = m_properties.toMap();
56 map.insert(QStringLiteral("menuObjectPath"), menuObjectPath);
57 setIndicatorProperties(map);
58
59=== modified file 'plugins/Unity/Indicators/indicator.h'
60--- plugins/Unity/Indicators/indicator.h 2014-10-08 14:10:37 +0000
61+++ plugins/Unity/Indicators/indicator.h 2015-12-02 12:03:29 +0000
62@@ -32,7 +32,7 @@
63 public:
64 typedef QSharedPointer<Indicator> Ptr;
65
66- Indicator(QObject *parent = 0);
67+ Indicator(QObject *parent = nullptr);
68 virtual ~Indicator();
69
70 void init(const QString& busName, const QSettings& settings);
71
72=== modified file 'plugins/Unity/Indicators/indicatorsmanager.cpp'
73--- plugins/Unity/Indicators/indicatorsmanager.cpp 2015-09-14 09:41:55 +0000
74+++ plugins/Unity/Indicators/indicatorsmanager.cpp 2015-12-02 12:03:29 +0000
75@@ -51,20 +51,19 @@
76 IndicatorsManager::~IndicatorsManager()
77 {
78 unload();
79-
80 }
81
82 void IndicatorsManager::load()
83 {
84 unload();
85
86- QStringList xdgLocations = shellDataDirs();//QStandardPaths::standardLocations(QStandardPaths::GenericDataLocation);
87+ const QStringList xdgLocations = shellDataDirs();
88
89 m_fsWatcher.reset(new QFileSystemWatcher(this));
90
91 Q_FOREACH(const QString& xdgLocation, xdgLocations)
92 {
93- QString indicator_path = QDir::cleanPath(xdgLocation + "/unity/indicators");
94+ const QString indicator_path = QDir::cleanPath(xdgLocation + "/unity/indicators");
95 QDir indicator_dir(indicator_path);
96 if (indicator_dir.exists())
97 {
98@@ -103,7 +102,7 @@
99 {
100 startVerify(dir.canonicalPath());
101
102- QFileInfoList indicator_files = dir.entryInfoList(QStringList(), QDir::Files|QDir::NoDotAndDotDot);
103+ const QFileInfoList indicator_files = dir.entryInfoList(QStringList(), QDir::Files|QDir::NoDotAndDotDot);
104 Q_FOREACH(const QFileInfo& indicator_file, indicator_files)
105 {
106 loadFile(indicator_file);
107@@ -115,26 +114,30 @@
108 void IndicatorsManager::loadFile(const QFileInfo& file_info)
109 {
110 QSettings indicator_settings(file_info.absoluteFilePath(), QSettings::IniFormat, this);
111- QString name = indicator_settings.value(QStringLiteral("Indicator Service/Name")).toString();
112-
113- auto iter = m_indicatorsData.find(name);
114- if (iter != m_indicatorsData.end())
115+ const QString name = indicator_settings.value(QStringLiteral("Indicator Service/Name")).toString();
116+
117+ if (m_platform.isPC() && name == "indicator-keyboard") {
118+ return; // convergence: skip this indicator until it works in Mir
119+ }
120+
121+ auto iter = m_indicatorsData.constFind(name);
122+ if (iter != m_indicatorsData.constEnd())
123 {
124- QString newFileInfoDir = QDir::cleanPath(file_info.canonicalPath());
125+ const QString newFileInfoDir = QDir::cleanPath(file_info.canonicalPath());
126 IndicatorData* currentData = (*iter);
127 currentData->m_verified = true;
128
129 int file_info_location = -1;
130 int current_data_location = -1;
131
132- QString currentDataDir = QDir::cleanPath(currentData->m_fileInfo.canonicalPath());
133+ const QString currentDataDir = QDir::cleanPath(currentData->m_fileInfo.canonicalPath());
134
135 // if we've already got this indicator, we need to make sure we're not overwriting data which is
136 // from a lower priority standard path
137 QStringList xdgLocations = shellDataDirs();
138 for (int i = 0; i < xdgLocations.size(); i++)
139 {
140- QString indicatorDir = QDir::cleanPath(xdgLocations[i] + "/unity/indicators");
141+ const QString indicatorDir = QDir::cleanPath(xdgLocations[i] + "/unity/indicators");
142
143 if (newFileInfoDir == indicatorDir)
144 {
145@@ -194,7 +197,7 @@
146 {
147 if (!data->m_verified)
148 {
149- QString name = data->m_name;
150+ const QString name = data->m_name;
151 Q_EMIT indicatorAboutToBeUnloaded(name);
152
153 delete data;
154@@ -253,7 +256,7 @@
155 {
156 if (!data->m_verified)
157 {
158- QString name = data->m_name;
159+ const QString name = data->m_name;
160 Q_EMIT indicatorAboutToBeUnloaded(name);
161
162 delete data;
163@@ -271,7 +274,7 @@
164 return Indicator::Ptr();
165 }
166
167- IndicatorData *data = m_indicatorsData[indicator_name];
168+ IndicatorData *data = m_indicatorsData.value(indicator_name);
169 if (data->m_indicator)
170 {
171 return data->m_indicator;
172@@ -281,7 +284,20 @@
173 data->m_indicator = new_indicator;
174 QSettings settings(data->m_fileInfo.absoluteFilePath(), QSettings::IniFormat, this);
175 new_indicator->init(data->m_fileInfo.fileName(), settings);
176- new_indicator->setProfile(m_profile);
177+
178+ // convergence:
179+ // 1) enable session indicator conditionally, typically when running in a multisession/multiuser environment
180+ // 2) on a PC, switch the battery/power indicator to desktop mode,
181+ // can't control brightness for now and phone-on-desktop broken (FIXME)
182+ //
183+ // The rest of the indicators respect their default profile (which is "phone", even on desktop PCs)
184+ if ((new_indicator->identifier() == QStringLiteral("indicator-session") && m_platform.isMultiSession())
185+ || (new_indicator->identifier() == QStringLiteral("indicator-power") && m_platform.isPC())) {
186+ new_indicator->setProfile("desktop");
187+ } else {
188+ new_indicator->setProfile(m_profile);
189+ }
190+
191 QObject::connect(this, &IndicatorsManager::profileChanged, new_indicator.data(), &Indicator::setProfile);
192 return new_indicator;
193 }
194
195=== modified file 'plugins/Unity/Indicators/indicatorsmanager.h'
196--- plugins/Unity/Indicators/indicatorsmanager.h 2015-09-14 09:41:55 +0000
197+++ plugins/Unity/Indicators/indicatorsmanager.h 2015-12-02 12:03:29 +0000
198@@ -21,6 +21,7 @@
199
200 #include "indicator.h"
201 #include "unityindicatorsglobal.h"
202+#include "../Platform/platform.h"
203
204 #include <QObject>
205 #include <QFileSystemWatcher>
206@@ -34,7 +35,7 @@
207 Q_PROPERTY(bool loaded READ isLoaded NOTIFY loadedChanged)
208 Q_PROPERTY(QString profile READ profile WRITE setProfile NOTIFY profileChanged)
209 public:
210- explicit IndicatorsManager(QObject* parent = 0);
211+ explicit IndicatorsManager(QObject* parent = nullptr);
212 ~IndicatorsManager();
213
214 Q_INVOKABLE void load();
215@@ -75,6 +76,8 @@
216 QSharedPointer<QFileSystemWatcher> m_fsWatcher;
217 bool m_loaded;
218 QString m_profile;
219+
220+ Platform m_platform;
221 };
222
223 #endif // INDICATORS_MANAGER_H
224
225=== modified file 'plugins/Unity/Indicators/indicatorsmodel.cpp'
226--- plugins/Unity/Indicators/indicatorsmodel.cpp 2015-08-19 13:56:21 +0000
227+++ plugins/Unity/Indicators/indicatorsmodel.cpp 2015-12-02 12:03:29 +0000
228@@ -236,7 +236,7 @@
229 return 1;
230 }
231
232-Q_INVOKABLE QVariant IndicatorsModel::data(int row, int role) const
233+QVariant IndicatorsModel::data(int row, int role) const
234 {
235 return data(index(row, 0), role);
236 }
237@@ -247,26 +247,26 @@
238 if (!index.isValid() || index.row() >= m_indicators.size())
239 return QVariant();
240
241- Indicator::Ptr indicator = m_indicators[index.row()];
242+ Indicator::Ptr indicator = m_indicators.at(index.row());
243
244 switch (role)
245 {
246 case IndicatorsModelRole::Identifier:
247 if (indicator)
248 {
249- return QVariant(indicator->identifier());
250+ return indicator->identifier();
251 }
252 break;
253 case IndicatorsModelRole::Position:
254 if (indicator)
255 {
256- return QVariant(indicator->position());
257+ return indicator->position();
258 }
259 break;
260 case IndicatorsModelRole::IndicatorProperties:
261 if (indicator)
262 {
263- return QVariant(indicator->indicatorProperties());
264+ return indicator->indicatorProperties();
265 }
266 break;
267 default:
268
269=== modified file 'plugins/Unity/Indicators/indicatorsmodel.h'
270--- plugins/Unity/Indicators/indicatorsmodel.h 2015-04-30 09:31:51 +0000
271+++ plugins/Unity/Indicators/indicatorsmodel.h 2015-12-02 12:03:29 +0000
272@@ -38,7 +38,7 @@
273
274 public:
275
276- IndicatorsModel(QObject *parent=0);
277+ IndicatorsModel(QObject *parent=nullptr);
278 ~IndicatorsModel();
279
280 Q_INVOKABLE void load();
281
282=== modified file 'plugins/Unity/Indicators/menucontentactivator.h'
283--- plugins/Unity/Indicators/menucontentactivator.h 2014-08-26 08:14:44 +0000
284+++ plugins/Unity/Indicators/menucontentactivator.h 2015-12-02 12:03:29 +0000
285@@ -34,7 +34,7 @@
286 AbstractTimer(QObject *parent) : QObject(parent), m_isRunning(false) {}
287 virtual int interval() const = 0;
288 virtual void setInterval(int msecs) = 0;
289- virtual void start() { m_isRunning = true; };
290+ virtual void start() { m_isRunning = true; }
291 virtual void stop() { m_isRunning = false; }
292 bool isRunning() const { return m_isRunning; }
293 Q_SIGNALS:
294
295=== modified file 'plugins/Unity/Indicators/modelprinter.h'
296--- plugins/Unity/Indicators/modelprinter.h 2015-09-14 09:11:08 +0000
297+++ plugins/Unity/Indicators/modelprinter.h 2015-12-02 12:03:29 +0000
298@@ -32,7 +32,7 @@
299 Q_PROPERTY(UnityMenuModel* model READ sourceModel WRITE setSourceModel NOTIFY modelChanged)
300 Q_PROPERTY(QString text READ text NOTIFY textChanged)
301 public:
302- ModelPrinter(QObject* parent=0);
303+ ModelPrinter(QObject* parent=nullptr);
304
305 void setSourceModel(UnityMenuModel* sourceModel);
306 UnityMenuModel* sourceModel() const;
307
308=== modified file 'plugins/Unity/Platform/CMakeLists.txt'
309--- plugins/Unity/Platform/CMakeLists.txt 2015-10-09 12:36:14 +0000
310+++ plugins/Unity/Platform/CMakeLists.txt 2015-12-02 12:03:29 +0000
311@@ -1,3 +1,5 @@
312+find_package(Qt5DBus REQUIRED)
313+
314 set(platformplugin_SRCS
315 platform.cpp
316 plugin.cpp)
317
318=== modified file 'plugins/Unity/Platform/platform.cpp'
319--- plugins/Unity/Platform/platform.cpp 2015-11-20 15:01:39 +0000
320+++ plugins/Unity/Platform/platform.cpp 2015-12-02 12:03:29 +0000
321@@ -20,16 +20,20 @@
322
323 Platform::Platform(QObject *parent)
324 : QObject(parent)
325- , m_iface(QStringLiteral("org.freedesktop.hostname1"), QStringLiteral("/org/freedesktop/hostname1"), QStringLiteral("org.freedesktop.hostname1"),
326- QDBusConnection::systemBus(), this)
327 {
328 QMetaObject::invokeMethod(this, "init");
329 }
330
331 void Platform::init()
332 {
333- m_chassis = m_iface.property("Chassis").toString();
334- m_isPC = (m_chassis == QLatin1String("desktop") || m_chassis == QLatin1String("laptop") || m_chassis == QLatin1String("server"));
335+ QDBusInterface iface("org.freedesktop.hostname1", "/org/freedesktop/hostname1", "org.freedesktop.hostname1",
336+ QDBusConnection::systemBus(), this);
337+ QDBusInterface seatIface("org.freedesktop.login1", "/org/freedesktop/login1/seat/self", "org.freedesktop.login1.Seat",
338+ QDBusConnection::systemBus(), this);
339+
340+ m_chassis = iface.property("Chassis").toString();
341+ m_isPC = (m_chassis == "desktop" || m_chassis == "laptop" || m_chassis == "server");
342+ m_isMultiSession = seatIface.property("CanMultiSession").toBool() && seatIface.property("CanGraphical").toBool();
343 }
344
345 QString Platform::chassis() const
346@@ -41,3 +45,8 @@
347 {
348 return m_isPC;
349 }
350+
351+bool Platform::isMultiSession() const
352+{
353+ return m_isMultiSession;
354+}
355
356=== modified file 'plugins/Unity/Platform/platform.h'
357--- plugins/Unity/Platform/platform.h 2015-10-09 12:36:14 +0000
358+++ plugins/Unity/Platform/platform.h 2015-12-02 12:03:29 +0000
359@@ -38,6 +38,10 @@
360 * Whether the machine is an ordinary PC (desktop, laptop or server)
361 */
362 Q_PROPERTY(bool isPC READ isPC CONSTANT)
363+ /**
364+ * Whether the system is capable of running multiple (graphical) sessions
365+ */
366+ Q_PROPERTY(bool isMultiSession READ isMultiSession CONSTANT)
367
368 public:
369 Platform(QObject *parent = nullptr);
370@@ -46,13 +50,15 @@
371 QString chassis() const;
372 bool isPC() const;
373
374+ bool isMultiSession() const;
375+
376 private Q_SLOTS:
377 void init();
378
379 private:
380- QDBusInterface m_iface;
381 QString m_chassis;
382 bool m_isPC;
383+ bool m_isMultiSession;
384 };
385
386 #endif // PLATFORM_H
387
388=== modified file 'qml/Components/VolumeControl.qml'
389--- qml/Components/VolumeControl.qml 2015-09-14 07:47:24 +0000
390+++ qml/Components/VolumeControl.qml 2015-12-02 12:03:29 +0000
391@@ -36,7 +36,7 @@
392 GlobalShortcut {
393 id: muteShortcut
394 shortcut: Qt.Key_VolumeMute
395- Keys.onPressed: toggleMute()
396+ onTriggered: toggleMute()
397 }
398
399 QMenuModel.QDBusActionGroup {
400@@ -46,7 +46,7 @@
401 objectPath: "/com/canonical/indicator/sound"
402
403 property variant actionObject: action("volume")
404- property variant muteActionObject: action("mute")
405+ property variant muteActionObject: indicators.indicatorsModel.profile === "desktop" ? action("mute") : action("silent-mode")
406 property variant indicatorsAction: action("indicator-shown")
407 }
408
409
410=== modified file 'qml/Shell.qml'
411--- qml/Shell.qml 2015-11-26 13:28:43 +0000
412+++ qml/Shell.qml 2015-12-02 12:03:29 +0000
413@@ -516,7 +516,7 @@
414
415 indicatorsModel: Indicators.IndicatorsModel {
416 // tablet and phone both use the same profile
417- profile: shell.usageScenario === "desktop" ? "desktop" : "phone"
418+ profile: "phone"
419 Component.onCompleted: load();
420 }
421 }
422@@ -525,7 +525,7 @@
423 greeterShown: greeter.shown
424 }
425
426- property bool topmostApplicationIsFullscreen:
427+ readonly property bool topmostApplicationIsFullscreen:
428 ApplicationManager.focusedApplicationId &&
429 ApplicationManager.findApplication(ApplicationManager.focusedApplicationId).fullscreen
430
431
432=== modified file 'tests/plugins/Unity/Indicators/CMakeLists.txt'
433--- tests/plugins/Unity/Indicators/CMakeLists.txt 2015-04-29 22:05:49 +0000
434+++ tests/plugins/Unity/Indicators/CMakeLists.txt 2015-12-02 12:03:29 +0000
435@@ -21,7 +21,7 @@
436 ${TEST}Test.cpp
437 ${test_ADDITIONAL_CPPS}
438 )
439- qt5_use_modules(${TEST}Exec Test Core Qml)
440+ qt5_use_modules(${TEST}Exec Test Core Qml DBus)
441 target_link_libraries(${TEST}Exec
442 ${test_ADDITIONAL_LIBS}
443 ${GLIB_LIBRARIES}

Subscribers

People subscribed via source and target branches