on xenial help sign in
Merge remote-tracking branch 'origin/xenial_-_edge_-_wayland' into xenial_-_qt-5-12_-_wayland
commitc250d3677c52939d4bd830b8063129e48db70106 authorRodney Dawes <dobey@ubports.com> dateMon 31 Aug 2020, 14:27 (6 years ago) parent9da57c711c06cf
53 files changed+317−789
CMakeLists.txt+1 debian/control+2−4 debian/rules+7 debian/unity8-private.install−1 plugins/CMakeLists.txt−1 plugins/Lights/CMakeLists.txt−19 plugins/Lights/Lights.cpp−166 plugins/Lights/Lights.h−75 plugins/Lights/android-hardware.h−19 plugins/Lights/plugin.cpp−35 plugins/Lights/plugin.h−34 plugins/Lights/qmldir−3 plugins/Utils/CMakeLists.txt+4−2 plugins/Utils/deviceconfig.cpp+113 plugins/Utils/deviceconfigparser.h → plugins/Utils/deviceconfig.h+9−16 plugins/Utils/deviceconfigparser.cpp−176 plugins/Utils/plugin.cpp+2−2 po/unity8.pot+15−7 qml/Components/WallpaperResolver.qml → qml/Components/ImageResolver.qml qml/DeviceConfiguration.qml+26−15 qml/DisabledScreenNotice.qml+1−1 qml/Launcher/LauncherPanel.qml+14−3 qml/OrientedShell.qml+4−1 qml/Panel/Indicators/IndicatorsLight.qml+8−8 qml/Shell.qml+1−1 qml/Wizard/Pages.qml+8−5 qml/Wizard/Pages/79-system-update.qml+1 qml/Wizard/Pages/80-finished.qml+1−1 src/ApplicationArguments.h−13 src/ShellApplication.cpp−12 src/ShellApplication.h−1 src/UnityCommandLineParser.cpp−5 src/UnityCommandLineParser.h−2 tests/mocks/CMakeLists.txt+1−1 tests/mocks/Hfd/CMakeLists.txt+8 tests/mocks/Lights/Lights.cpp → tests/mocks/Hfd/Leds.cpp+12−12 tests/mocks/Lights/Lights.h → tests/mocks/Hfd/Leds.h+4−7 tests/mocks/Lights/plugin.cpp → tests/mocks/Hfd/plugin.cpp+5−5 tests/mocks/Lights/plugin.h → tests/mocks/Hfd/plugin.h+1−4 tests/mocks/Hfd/qmldir+3 tests/mocks/Lights/CMakeLists.txt−8 tests/mocks/Lights/qmldir−3 tests/mocks/Utils/CMakeLists.txt+3−1 tests/mocks/Utils/plugin.cpp+2−2 tests/plugins/Utils/CMakeLists.txt−1 tests/plugins/Utils/DeviceConfigParserTest.cpp−76 tests/qmltests/CMakeLists.txt+1−1 tests/qmltests/Components/tst_WallpaperResolver.qml → tests/qmltests/Components/tst_ImageResolver.qml+6−6 tests/qmltests/Greeter/tst_NarrowView.qml+1−1 tests/qmltests/Panel/Indicators/tst_IndicatorsLight.qml+28−28 tests/qmltests/tst_DeviceConfiguration.qml+23−2 tests/qmltests/tst_DisabledScreenNotice.qml+1−3 tests/qmltests/tst_OrientedShell.qml+1
CMakeLists.txt+1
@@ -74,6 +74,7 @@ find_package(Qt5Svg 5.6 REQUIRED)
7474find_package(Qt5Network 5.6 REQUIRED)
7575find_package(Qt5Xml 5.6 REQUIRED)
7676
77+pkg_check_modules(DEVICEINFO REQUIRED deviceinfo)
7778pkg_check_modules(APPLICATION_API REQUIRED unity-shell-application=27)
7879pkg_check_modules(GEONAMES REQUIRED geonames>=0.2)
7980pkg_check_modules(GIO REQUIRED gio-2.0>=2.32)
debian/control+2−4
@@ -3,7 +3,6 @@ Section: x11
33Priority: optional
44Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
55Build-Depends:
6− android-headers,
76 cmake,
87 cmake-extras,
98 dbus-test-runner,
@@ -14,8 +13,8 @@ Build-Depends:
1413 gdb,
1514 graphviz,
1615 gsettings-ubuntu-schemas (>= 0.0.2+14.10.20140815),
17− libandroid-properties-dev,
1816 libconnectivity-qt1-dev (>= 0.7.1),
17+ libdeviceinfo-dev,
1918 libevdev-dev,
2019 libgeonames-dev (>= 0.2),
2120 libgl1-mesa-dev[!arm64 !armhf] | libgl-dev[!arm64 !armhf],
@@ -24,7 +23,6 @@ Build-Depends:
2423 libglib2.0-dev,
2524 libgnome-desktop-3-dev,
2625 libgsettings-qt-dev,
27− libhardware-dev,
2826 liblightdm-qt5-3-dev,
2927 libpam0g-dev,
3028 libpulse-dev,
@@ -115,6 +113,7 @@ Depends:
115113 libglib2.0-bin,
116114 qmenumodel-qml (>= 0.2.11),
117115 qml-module-biometryd,
116+ qml-module-hfd,
118117 qml-module-qt-labs-folderlistmodel,
119118 qml-module-qt-labs-settings,
120119 qml-module-qtqml-statemachine,
@@ -233,7 +232,6 @@ Pre-Depends:
233232Depends:
234233 accountsservice-ubuntu-schemas (>= 0.0.7),
235234 gsettings-ubuntu-schemas (>= 0.0.2+14.10.20140815),
236− libhardware2,
237235 qml-module-qtmultimedia,
238236 qtdeclarative5-gsettings1.0,
239237 unity8-schemas,
debian/rules+7
@@ -8,6 +8,11 @@ include /usr/share/dpkg/default.mk
88export DPKG_GENSYMBOLS_CHECK_LEVEL=4
99export NO_PNG_PKG_MANGLE=1
1010
11+DEB_HOST_ARCH ?= $(shell dpkg-architecture -qDEB_HOST_ARCH)
12+
13+# Skip tests on the archs they are known to be flaky with current configuration
14+testskip_architectures := arm64
15+
1116%:
1217 dh $@ --parallel --fail-missing --with python3
1318
@@ -21,10 +26,12 @@ override_dh_auto_build:
2126 dh_auto_build -- -O all doc
2227
2328override_dh_auto_test:
29+ifneq ($(DEB_HOST_ARCH),$(findstring $(DEB_HOST_ARCH), $(testskip_architectures)))
2430 # Run the entire test battery
2531 # Parallel tests have a risk of starting xvfb on the same DISPLAY multiple times,
2632 # causing the whole battery to fail.
2733 dh_auto_test --no-parallel -- -O -k xvfballtests || true
34+endif
2835
2936override_dh_install:
3037 # install autopilot tests
debian/unity8-private.install−1
@@ -4,7 +4,6 @@ usr/lib/*/unity8/qml/Cursor
44usr/lib/*/unity8/qml/GlobalShortcut
55usr/lib/*/unity8/qml/Greeter
66usr/lib/*/unity8/qml/LightDM
7−usr/lib/*/unity8/qml/Lights
87usr/lib/*/unity8/qml/Powerd
98usr/lib/*/unity8/qml/ScreenshotDirectory
109usr/lib/*/unity8/qml/SessionBroadcast
plugins/CMakeLists.txt−1
@@ -16,7 +16,6 @@ add_subdirectory(Cursor)
1616add_subdirectory(GlobalShortcut)
1717add_subdirectory(Greeter)
1818add_subdirectory(LightDM)
19−add_subdirectory(Lights)
2019add_subdirectory(Powerd)
2120add_subdirectory(ScreenshotDirectory)
2221add_subdirectory(SessionBroadcast)
plugins/Lights/CMakeLists.txtdeleted−19
@@ -1,19 +0,0 @@
1−pkg_check_modules(ANDROID_HEADERS REQUIRED android-headers)
2−pkg_check_modules(ANDROID_HARDWARE REQUIRED libhardware)
3−
4−include_directories(
5− SYSTEM
6− ${ANDROID_HEADERS_INCLUDE_DIRS}
7−)
8−
9−add_library(Lights-qml MODULE
10− plugin.cpp
11− Lights.cpp
12− )
13−
14−target_link_libraries(Lights-qml
15− Qt5::Qml Qt5::Gui
16− ${ANDROID_HARDWARE_LIBRARIES}
17− )
18−
19−add_unity8_plugin(Lights 0.1 Lights TARGETS Lights-qml)
plugins/Lights/Lights.cppdeleted−166
@@ -1,166 +0,0 @@
1−/*
2− * Copyright (C) 2014 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: Renato Araujo Oliveira Filho <renato.filho@canonical.com>
17− */
18−
19−#include "Lights.h"
20−#include <QtCore/QDebug>
21−
22−extern "C" {
23−#include "android-hardware.h"
24−#include <string.h>
25−}
26−
27−Lights::Lights(QObject* parent)
28− : QObject(parent),
29− m_lightDevice(0),
30− m_color("blue"),
31− m_state(Lights::Off),
32− m_onMs(1000),
33− m_offMs(3000)
34−{
35−}
36−
37−Lights::~Lights()
38−{
39− if (m_lightDevice) {
40− hw_device_t* device = (hw_device_t*) m_lightDevice;
41− device->close(device);
42− }
43−}
44−
45−void Lights::setState(Lights::State newState)
46−{
47− if (!init()) {
48− qWarning() << "No lights device";
49− return;
50− }
51−
52− if (m_state != newState) {
53− if (newState == Lights::On) {
54− turnOn();
55− } else {
56− turnOff();
57− }
58−
59− m_state = newState;
60− Q_EMIT stateChanged(m_state);
61− }
62−}
63−
64−Lights::State Lights::state() const
65−{
66− return m_state;
67−}
68−
69−void Lights::setColor(const QColor &color)
70−{
71− if (m_color != color) {
72− m_color = color;
73− Q_EMIT colorChanged(m_color);
74− // FIXME: update the color if the light is already on
75− }
76−}
77−
78−QColor Lights::color() const
79−{
80− return m_color;
81−}
82−
83−int Lights::onMillisec() const
84−{
85− return m_onMs;
86−}
87−
88−void Lights::setOnMillisec(int onMs)
89−{
90− if (m_onMs != onMs) {
91− m_onMs = onMs;
92− Q_EMIT onMillisecChanged(m_onMs);
93− // FIXME: update the property if the light is already on
94− }
95−}
96−
97−int Lights::offMillisec() const
98−{
99− return m_offMs;
100−}
101−
102−void Lights::setOffMillisec(int offMs)
103−{
104− if (m_offMs != offMs) {
105− m_offMs = offMs;
106− Q_EMIT offMillisecChanged(m_offMs);
107− // FIXME: update the property if the light is already on
108− }
109−}
110−
111−bool Lights::init()
112−{
113− if (m_lightDevice) {
114− return true;
115− }
116−
117− int err;
118− hw_module_t* module;
119−
120− err = hw_get_module(LIGHTS_HARDWARE_MODULE_ID, (hw_module_t const**)&module);
121− if (err == 0) {
122− hw_device_t* device;
123− err = module->methods->open(module, LIGHT_ID_NOTIFICATIONS, &device);
124− if (err == 0) {
125− m_lightDevice = (light_device_t*)device;
126− turnOff();
127− return true;
128− } else {
129− qWarning() << "Failed to access notification lights";
130− }
131− } else {
132− qWarning() << "Failed to initialize lights hardware.";
133− }
134− return false;
135−}
136−
137−void Lights::turnOn()
138−{
139− // pulse
140− light_state_t state;
141− memset(&state, 0, sizeof(light_state_t));
142− state.color = m_color.rgba();
143− state.flashMode = LIGHT_FLASH_TIMED;
144− state.flashOnMS = m_onMs;
145− state.flashOffMS = m_offMs;
146− state.brightnessMode = BRIGHTNESS_MODE_USER;
147−
148− if (m_lightDevice->set_light(m_lightDevice, &state) != 0) {
149− qWarning() << "Failed to turn the light off";
150− }
151−}
152−
153−void Lights::turnOff()
154−{
155− light_state_t state;
156− memset(&state, 0, sizeof(light_state_t));
157− state.color = 0x00000000;
158− state.flashMode = LIGHT_FLASH_NONE;
159− state.flashOnMS = 0;
160− state.flashOffMS = 0;
161− state.brightnessMode = 0;
162−
163− if (m_lightDevice->set_light(m_lightDevice, &state) != 0) {
164− qWarning() << "Failed to turn the light off";
165− }
166−}
plugins/Lights/Lights.hdeleted−75
@@ -1,75 +0,0 @@
1−/*
2− * Copyright (C) 2014 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: Renato Araujo Oliveira Filho <renato.filho@canonical.com>
17− */
18−
19−#ifndef UNITY_LIGHTS_H
20−#define UNITY_LIGHTS_H
21−
22−#include <QtCore/QObject>
23−#include <QtGui/QColor>
24−
25−struct light_device_t;
26−
27−class Lights: public QObject
28−{
29− Q_OBJECT
30− Q_PROPERTY(State state READ state WRITE setState NOTIFY stateChanged)
31− Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged)
32− Q_PROPERTY(int onMillisec READ onMillisec WRITE setOnMillisec NOTIFY onMillisecChanged)
33− Q_PROPERTY(int offMillisec READ offMillisec WRITE setOffMillisec NOTIFY offMillisecChanged)
34−
35−public:
36− enum State {
37− Off,
38− On,
39− };
40− Q_ENUM(State)
41−
42− explicit Lights(QObject *parent = 0);
43− ~Lights();
44−
45− void setState(State newState);
46− State state() const;
47−
48− void setColor(const QColor &color);
49− QColor color() const;
50−
51− int onMillisec() const;
52− void setOnMillisec(int onMs);
53−
54− int offMillisec() const;
55− void setOffMillisec(int offMs);
56−
57−Q_SIGNALS:
58− void stateChanged(State newState);
59− void colorChanged(const QColor &color);
60− void onMillisecChanged(int onMs);
61− void offMillisecChanged(int offMs);
62−
63−private:
64− light_device_t* m_lightDevice;
65− QColor m_color;
66− State m_state;
67− int m_onMs;
68− int m_offMs;
69−
70− bool init();
71− void turnOff();
72− void turnOn();
73−};
74−
75−#endif
plugins/Lights/android-hardware.hdeleted−19
@@ -1,19 +0,0 @@
1−/*
2− * Copyright (C) 2014 Canonical, Ltd.
3− *
4− * This program is free software; you can redistribute it and/or modify
5− * it under the terms of the GNU General Public License as published by
6− * the Free Software Foundation; version 3.
7− *
8− * This program is distributed in the hope that it will be useful,
9− * but WITHOUT ANY WARRANTY; without even the implied warranty of
10− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11− * GNU General Public License for more details.
12− *
13− * You should have received a copy of the GNU General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− *
16− */
17−
18−#include <hardware/hardware.h>
19−#include <hardware/lights.h>
plugins/Lights/plugin.cppdeleted−35
@@ -1,35 +0,0 @@
1−/*
2− * Copyright (C) 2014 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: Renato Araujo Oliveira Filho <renato.filho@canonical.com>
17− */
18−
19−#include "plugin.h"
20−#include "Lights.h"
21−
22−#include <QtQml/qqml.h>
23−
24−static QObject *lights_provider(QQmlEngine *engine, QJSEngine *scriptEngine)
25−{
26− Q_UNUSED(engine)
27− Q_UNUSED(scriptEngine)
28− return new Lights();
29−}
30−
31−void LightsPlugin::registerTypes(const char *uri)
32−{
33− Q_ASSERT(uri == QLatin1String("Lights"));
34− qmlRegisterSingletonType<Lights>(uri, 0, 1, "Lights", lights_provider);
35−}
plugins/Lights/plugin.hdeleted−34
@@ -1,34 +0,0 @@
1−/*
2− * Copyright (C) 2014 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: Renato Araujo Oliveira Filho <renato.filho@canonical.com>
17− */
18−
19−#ifndef LIGHTS_PLUGIN_H
20−#define LIGHTS_PLUGIN_H
21−
22−#include <QtQml/QQmlEngine>
23−#include <QtQml/QQmlExtensionPlugin>
24−
25−class LightsPlugin : public QQmlExtensionPlugin
26−{
27− Q_OBJECT
28− Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
29−
30−public:
31− void registerTypes(const char *uri) override;
32−};
33−
34−#endif
plugins/Lights/qmldirdeleted−3
@@ -1,3 +0,0 @@
1−module Lights
2−plugin Lights-qml
3−typeinfo Lights.qmltypes
plugins/Utils/CMakeLists.txt+4−2
@@ -7,6 +7,7 @@ include_directories(
77 SYSTEM
88 ${Qt5Gui_PRIVATE_INCLUDE_DIRS}
99 ${Qt5Quick_PRIVATE_INCLUDE_DIRS}
10+ ${DEVICEINFO_INCLUDE_DIRS}
1011)
1112
1213set(QMLPLUGIN_SRC
@@ -30,7 +31,7 @@ set(QMLPLUGIN_SRC
3031 windowstatestorage.cpp
3132 timezoneFormatter.cpp
3233 inputeventgenerator.cpp
33− deviceconfigparser.cpp
34+ deviceconfig.cpp
3435 globalfunctions.cpp
3536 URLDispatcher.cpp
3637 tabfocusfence.cpp
@@ -45,7 +46,8 @@ add_library(Utils-qml SHARED
4546
4647target_link_libraries(Utils-qml
4748 Qt5::Qml Qt5::Quick Qt5::DBus Qt5::Network Qt5::Gui Qt5::Sql Qt5::Concurrent
48− )
49+ ${DEVICEINFO_LDFLAGS}
50+)
4951
5052# Because this is an internal support library, we want
5153# to expose all symbols in it. Consider changing this
plugins/Utils/deviceconfig.cppnew file+113
@@ -0,0 +1,113 @@
1+/*
2+ * Copyright 2016 Canonical Ltd.
3+ * 2019 UBports foundation.
4+ *
5+ * This program is free software; you can redistribute it and/or modify
6+ * it under the terms of the GNU Lesser General Public License as published by
7+ * the Free Software Foundation; version 3.
8+ *
9+ * This program is distributed in the hope that it will be useful,
10+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
11+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+ * GNU Lesser General Public License for more details.
13+ *
14+ * You should have received a copy of the GNU Lesser General Public License
15+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
16+ */
17+
18+#include "deviceconfig.h"
19+
20+#include <deviceinfo.h>
21+#include <QDebug>
22+
23+DeviceConfig::DeviceConfig(QObject *parent):
24+ QObject(parent),
25+ m_info(std::make_shared<DeviceInfo>())
26+{
27+}
28+
29+QString DeviceConfig::name() const
30+{
31+ return QString::fromStdString(m_info->name());
32+}
33+
34+Qt::ScreenOrientation DeviceConfig::primaryOrientation() const
35+{
36+ return stringToOrientation(m_info->primaryOrientation(), Qt::PrimaryOrientation);
37+}
38+
39+Qt::ScreenOrientations DeviceConfig::supportedOrientations() const
40+{
41+ auto values = m_info->supportedOrientations();
42+ if (values.empty()) {
43+ return Qt::PortraitOrientation
44+ | Qt::InvertedPortraitOrientation
45+ | Qt::LandscapeOrientation
46+ | Qt::InvertedLandscapeOrientation;
47+ }
48+
49+ Qt::ScreenOrientations ret = Qt::PrimaryOrientation;
50+ for (auto orientationString : values) {
51+ ret |= stringToOrientation(orientationString, Qt::PrimaryOrientation);
52+ }
53+ return ret;
54+}
55+
56+Qt::ScreenOrientation DeviceConfig::landscapeOrientation() const
57+{
58+ return stringToOrientation(m_info->landscapeOrientation(), Qt::LandscapeOrientation);
59+}
60+
61+Qt::ScreenOrientation DeviceConfig::invertedLandscapeOrientation() const
62+{
63+ return stringToOrientation(m_info->invertedLandscapeOrientation(), Qt::InvertedLandscapeOrientation);
64+}
65+
66+Qt::ScreenOrientation DeviceConfig::portraitOrientation() const
67+{
68+ return stringToOrientation(m_info->portraitOrientation(), Qt::PortraitOrientation);
69+}
70+
71+Qt::ScreenOrientation DeviceConfig::invertedPortraitOrientation() const
72+{
73+ return stringToOrientation(m_info->invertedPortraitOrientation(), Qt::InvertedPortraitOrientation);
74+}
75+
76+QString DeviceConfig::category() const
77+{
78+ QStringList supportedValues = {"phone", "tablet", "desktop"};
79+ QString value = QString::fromStdString(DeviceInfo::deviceTypeToString(m_info->deviceType()));
80+ if (!supportedValues.contains(value)) {
81+ qWarning().nospace().noquote() << "Unknown option \"" << value
82+ << ". Supported options are: " << supportedValues.join(", ") << ".";
83+ return "phone";
84+ }
85+ return value;
86+}
87+
88+Qt::ScreenOrientation DeviceConfig::stringToOrientation(const std::string &orientationString, Qt::ScreenOrientation defaultValue) const
89+{
90+ if (orientationString == "Landscape") {
91+ return Qt::LandscapeOrientation;
92+ }
93+ if (orientationString == "InvertedLandscape") {
94+ return Qt::InvertedLandscapeOrientation;
95+ }
96+ if (orientationString == "Portrait") {
97+ return Qt::PortraitOrientation;
98+ }
99+ if (orientationString == "InvertedPortrait") {
100+ return Qt::InvertedPortraitOrientation;
101+ }
102+ if (!orientationString.empty()) {
103+ // Some option we don't know. Give some hint on what went wrong.
104+ qWarning().nospace().noquote() << "Unknown option \"" << QString::fromStdString(orientationString)
105+ << ". Supported options are: Landscape, InvertedLandscape, Portrait and InvertedPortrait.";
106+ }
107+ return defaultValue;
108+}
109+
110+bool DeviceConfig::supportsMultiColorLed() const
111+{
112+ return m_info->contains("supportsMultiColorLed");
113+}
plugins/Utils/deviceconfigparser.h → plugins/Utils/deviceconfig.hrenamed+9−16
@@ -14,16 +14,16 @@
1414 * along with this program. If not, see <http://www.gnu.org/licenses/>.
1515 */
1616
17−#ifndef DEVICECONFIGPARSER_H
18−#define DEVICECONFIGPARSER_H
17+#pragma once
1918
2019#include <QObject>
21−#include <QSettings>
20+#include <memory>
2221
23−class DeviceConfigParser: public QObject
22+class DeviceInfo;
23+class DeviceConfig: public QObject
2424{
2525 Q_OBJECT
26− Q_PROPERTY(QString name READ name WRITE setName NOTIFY changed)
26+ Q_PROPERTY(QString name READ name NOTIFY changed)
2727
2828 // NOTE: When changing this properties, also update the examples in docs and data
2929 Q_PROPERTY(Qt::ScreenOrientation primaryOrientation READ primaryOrientation NOTIFY changed)
@@ -33,13 +33,12 @@ class DeviceConfigParser: public QObject
3333 Q_PROPERTY(Qt::ScreenOrientation portraitOrientation READ portraitOrientation NOTIFY changed)
3434 Q_PROPERTY(Qt::ScreenOrientation invertedPortraitOrientation READ invertedPortraitOrientation NOTIFY changed)
3535 Q_PROPERTY(QString category READ category NOTIFY changed)
36− Q_PROPERTY(bool supportsMultiColorLed READ supportsMultiColorLed NOTIFY changed)
36+ Q_PROPERTY(bool supportsMultiColorLed READ supportsMultiColorLed)
3737
3838public:
39− DeviceConfigParser(QObject *parent = nullptr);
39+ DeviceConfig(QObject *parent = nullptr);
4040
4141 QString name() const;
42− void setName(const QString &name);
4342
4443 Qt::ScreenOrientation primaryOrientation() const;
4544 Qt::ScreenOrientations supportedOrientations() const;
@@ -54,13 +53,7 @@ Q_SIGNALS:
5453 void changed();
5554
5655private:
57− QString m_name;
58− QSettings *m_config;
56+ std::shared_ptr<DeviceInfo> m_info;
5957
60− QStringList readOrientationsFromConfig(const QString &key) const;
61− QString readOrientationFromConfig(const QString &key) const;
62− Qt::ScreenOrientation stringToOrientation(const QString &orientationString, Qt::ScreenOrientation defaultValue) const;
63− bool readBoolFromConfig(const QString &key, bool defaultValue) const;
58+ Qt::ScreenOrientation stringToOrientation(const std::string &orientationString, Qt::ScreenOrientation defaultValue) const;
6459};
65−
66−#endif
plugins/Utils/deviceconfigparser.cppdeleted−176
@@ -1,176 +0,0 @@
1−/*
2− * Copyright 2016 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−
17−#include "deviceconfigparser.h"
18−
19−#include <QSettings>
20−#include <QFileInfo>
21−#include <QDebug>
22−#include <QStandardPaths>
23−
24−DeviceConfigParser::DeviceConfigParser(QObject *parent): QObject(parent)
25−{
26− // Local files have highest priority
27− QString path;
28− Q_FOREACH (const QString &standardPath, QStandardPaths::standardLocations(QStandardPaths::GenericConfigLocation)) {
29− if (QFileInfo::exists(standardPath + "/devices.conf")) {
30− path = standardPath + "/devices.conf";
31− break;
32− }
33− }
34−
35− // Check if there is an override in the device tarball (/system/etc/)
36− if (path.isEmpty() && QFileInfo::exists("/system/etc/ubuntu/devices.conf")) {
37− path = "/system/etc/ubuntu/devices.conf";
38− }
39−
40− // No higher priority files found. Use standard of /etc/
41− if (path.isEmpty()) {
42− path = "/etc/ubuntu/devices.conf";
43− }
44−
45− qDebug() << "Using" << path << "as device configuration file";
46− m_config = new QSettings(path, QSettings::IniFormat, this);
47−}
48−
49−QString DeviceConfigParser::name() const
50−{
51− return m_name;
52−}
53−
54−void DeviceConfigParser::setName(const QString &name)
55−{
56− if (m_name == name) {
57− return;
58− }
59− m_name = name;
60− Q_EMIT changed();
61−}
62−
63−Qt::ScreenOrientation DeviceConfigParser::primaryOrientation() const
64−{
65− return stringToOrientation(readOrientationFromConfig("PrimaryOrientation"), Qt::PrimaryOrientation);
66−}
67−
68−Qt::ScreenOrientations DeviceConfigParser::supportedOrientations() const
69−{
70− QStringList values = readOrientationsFromConfig("SupportedOrientations");
71− if (values.isEmpty()) {
72− return Qt::PortraitOrientation
73− | Qt::InvertedPortraitOrientation
74− | Qt::LandscapeOrientation
75− | Qt::InvertedLandscapeOrientation;
76− }
77−
78− Qt::ScreenOrientations ret = Qt::PrimaryOrientation;
79− Q_FOREACH(const QString &orientationString, values) {
80− ret |= stringToOrientation(orientationString, Qt::PrimaryOrientation);
81− }
82− return ret;
83−}
84−
85−Qt::ScreenOrientation DeviceConfigParser::landscapeOrientation() const
86−{
87− return stringToOrientation(readOrientationFromConfig("LandscapeOrientation"), Qt::LandscapeOrientation);
88−}
89−
90−Qt::ScreenOrientation DeviceConfigParser::invertedLandscapeOrientation() const
91−{
92− return stringToOrientation(readOrientationFromConfig("InvertedLandscapeOrientation"), Qt::InvertedLandscapeOrientation);
93−}
94−
95−Qt::ScreenOrientation DeviceConfigParser::portraitOrientation() const
96−{
97− return stringToOrientation(readOrientationFromConfig("PortraitOrientation"), Qt::PortraitOrientation);
98−}
99−
100−Qt::ScreenOrientation DeviceConfigParser::invertedPortraitOrientation() const
101−{
102− return stringToOrientation(readOrientationFromConfig("InvertedPortraitOrientation"), Qt::InvertedPortraitOrientation);
103−}
104−
105−QString DeviceConfigParser::category() const
106−{
107− QStringList supportedValues = {"phone", "tablet", "desktop"};
108− m_config->beginGroup(m_name);
109− QString value = m_config->value("Category", "phone").toString();
110− if (!supportedValues.contains(value)) {
111− qWarning().nospace().noquote() << "Unknown option \"" << value << "\" in " << m_config->fileName()
112− << ". Supported options are: " << supportedValues.join(", ") << ".";
113− return "phone";
114− }
115− m_config->endGroup();
116− return value;
117−}
118−
119−bool DeviceConfigParser::supportsMultiColorLed() const
120−{
121− return readBoolFromConfig("SupportsMultiColorLed", true);
122−}
123−
124−bool DeviceConfigParser::readBoolFromConfig(const QString &key, bool defaultValue) const
125−{
126− m_config->beginGroup(m_name);
127−
128− bool ret = defaultValue;
129− if (m_config->contains(key)) {
130− ret = m_config->value(key).toBool();
131− }
132−
133− m_config->endGroup();
134− return ret;
135−}
136−
137−QStringList DeviceConfigParser::readOrientationsFromConfig(const QString &key) const
138−{
139− m_config->beginGroup(m_name);
140−
141− QStringList ret;
142− if (m_config->contains(key)) {
143− ret = m_config->value(key).toStringList();
144− }
145−
146− m_config->endGroup();
147− return ret;
148−}
149−
150−QString DeviceConfigParser::readOrientationFromConfig(const QString &key) const
151−{
152− QStringList ret = readOrientationsFromConfig(key);
153− return ret.count() > 0 ? ret.first() : QString();
154−}
155−
156−Qt::ScreenOrientation DeviceConfigParser::stringToOrientation(const QString &orientationString, Qt::ScreenOrientation defaultValue) const
157−{
158− if (orientationString == "Landscape") {
159− return Qt::LandscapeOrientation;
160− }
161− if (orientationString == "InvertedLandscape") {
162− return Qt::InvertedLandscapeOrientation;
163− }
164− if (orientationString == "Portrait") {
165− return Qt::PortraitOrientation;
166− }
167− if (orientationString == "InvertedPortrait") {
168− return Qt::InvertedPortraitOrientation;
169− }
170− if (!orientationString.isEmpty()) {
171− // Some option we don't know. Give some hint on what went wrong.
172− qWarning().nospace().noquote() << "Unknown option \"" << orientationString << "\" in " << m_config->fileName()
173− << ". Supported options are: Landscape, InvertedLandscape, Portrait and InvertedPortrait.";
174− }
175− return defaultValue;
176−}
plugins/Utils/plugin.cpp+2−2
@@ -36,7 +36,7 @@
3636#include "timezoneFormatter.h"
3737#include "applicationsfiltermodel.h"
3838#include "inputeventgenerator.h"
39−#include "deviceconfigparser.h"
39+#include "deviceconfig.h"
4040#include "globalfunctions.h"
4141#include "URLDispatcher.h"
4242#include "appdrawerproxymodel.h"
@@ -83,7 +83,7 @@ void UtilsPlugin::registerTypes(const char *uri)
8383 qmlRegisterType<ActiveFocusLogger>(uri, 0, 1, "ActiveFocusLogger");
8484 qmlRegisterType<ApplicationsFilterModel>(uri, 0, 1, "ApplicationsFilterModel");
8585 qmlRegisterType<InputEventGenerator>(uri, 0, 1, "InputEventGenerator");
86− qmlRegisterType<DeviceConfigParser>(uri, 0, 1, "DeviceConfigParser");
86+ qmlRegisterType<DeviceConfig>(uri, 0, 1, "DeviceConfig");
8787 qmlRegisterSingletonType<GlobalFunctions>(uri, 0, 1, "Functions", createGlobalFunctions);
8888 qmlRegisterType<URLDispatcher>(uri, 0, 1, "URLDispatcher");
8989 qmlRegisterType<AppDrawerProxyModel>(uri, 0, 1, "AppDrawerProxyModel");
po/unity8.pot+15−7
@@ -8,7 +8,7 @@ msgid ""
88msgstr ""
99"Project-Id-Version: unity8\n"
1010"Report-Msgid-Bugs-To: \n"
11−"POT-Creation-Date: 2020-04-15 12:15-0500\n"
11+"POT-Creation-Date: 2020-05-03 09:34-0500\n"
1212"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
1313"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
1414"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -50,16 +50,16 @@ msgstr ""
5050msgid "Guest Session"
5151msgstr ""
5252
53−#: plugins/Unity/Launcher/launcheritem.cpp:49
54−#: plugins/Unity/Launcher/launcheritem.cpp:123
53+#: plugins/Unity/Launcher/launcheritem.cpp:48
54+#: plugins/Unity/Launcher/launcheritem.cpp:122
5555msgid "Pin shortcut"
5656msgstr ""
5757
58−#: plugins/Unity/Launcher/launcheritem.cpp:55
58+#: plugins/Unity/Launcher/launcheritem.cpp:54
5959msgid "Quit"
6060msgstr ""
6161
62−#: plugins/Unity/Launcher/launcheritem.cpp:123
62+#: plugins/Unity/Launcher/launcheritem.cpp:122
6363msgid "Unpin shortcut"
6464msgstr ""
6565
@@ -427,10 +427,18 @@ msgstr ""
427427msgid "Select desktop environment"
428428msgstr ""
429429
430−#: qml/Launcher/Drawer.qml:249
430+#: qml/Launcher/Drawer.qml:250
431431msgid "Search…"
432432msgstr ""
433433
434+#: qml/Launcher/PullToRefreshScopeStyle.qml:56
435+msgid "Pull to refresh…"
436+msgstr ""
437+
438+#: qml/Launcher/PullToRefreshScopeStyle.qml:61
439+msgid "Release to refresh…"
440+msgstr ""
441+
434442#: qml/Notifications/NotificationMenuItemFactory.qml:124
435443msgid "Show password"
436444msgstr ""
@@ -688,7 +696,7 @@ msgid "Welcome Back"
688696msgstr ""
689697
690698#: qml/Wizard/Pages/80-finished.qml:91
691−msgid "Welcome to Ubuntu"
699+msgid "Welcome to Ubuntu Touch"
692700msgstr ""
693701
694702#: qml/Wizard/Pages/80-finished.qml:106
qml/Components/WallpaperResolver.qml → qml/Components/ImageResolver.qmlrenamed

The content is the same.

qml/DeviceConfiguration.qml+26−15
@@ -20,11 +20,13 @@ import Utils 0.1
2020QtObject {
2121 id: root
2222
23+ // This allows to override device name, used for convergence
24+ // to set screens to desktop "mode"
25+ property var overrideName: false
26+
2327 readonly property int useNativeOrientation: -1
2428
25− // The only writable property in the API
26− // all other properties are set according to the device name
27− property alias name: priv.state
29+ readonly property alias name: priv.name;
2830
2931 readonly property alias primaryOrientation: priv.primaryOrientation
3032 readonly property alias supportedOrientations: priv.supportedOrientations
@@ -35,26 +37,29 @@ QtObject {
3537
3638 readonly property alias category: priv.category
3739
38− readonly property alias supportsMultiColorLed: priv.supportsMultiColorLed
40+ readonly property var deviceConfig: DeviceConfig {}
3941
40− readonly property var deviceConfigParser: DeviceConfigParser {
41− name: root.name
42+ readonly property var binding: Binding {
43+ target: priv
44+ property: "state"
45+ value: root.overrideName ? overrideName : deviceConfig.name
4246 }
4347
4448 readonly property var priv: StateGroup {
4549 id: priv
4650
47− property int primaryOrientation: deviceConfigParser.primaryOrientation == Qt.PrimaryOrientation ?
48− root.useNativeOrientation : deviceConfigParser.primaryOrientation
51+ property int primaryOrientation: deviceConfig.primaryOrientation == Qt.PrimaryOrientation ?
52+ root.useNativeOrientation : deviceConfig.primaryOrientation
4953
50− property int supportedOrientations: deviceConfigParser.supportedOrientations
54+ property int supportedOrientations: deviceConfig.supportedOrientations
5155
52− property int landscapeOrientation: deviceConfigParser.landscapeOrientation
53− property int invertedLandscapeOrientation: deviceConfigParser.invertedLandscapeOrientation
54− property int portraitOrientation: deviceConfigParser.portraitOrientation
55− property int invertedPortraitOrientation: deviceConfigParser.invertedPortraitOrientation
56− property string category: deviceConfigParser.category
57− property bool supportsMultiColorLed: deviceConfigParser.supportsMultiColorLed
56+ property int landscapeOrientation: deviceConfig.landscapeOrientation
57+ property int invertedLandscapeOrientation: deviceConfig.invertedLandscapeOrientation
58+ property int portraitOrientation: deviceConfig.portraitOrientation
59+ property int invertedPortraitOrientation: deviceConfig.invertedPortraitOrientation
60+ property string category: deviceConfig.category
61+ property string name: deviceConfig.name
62+ property bool supportsMultiColorLed: deviceConfig.supportsMultiColorLed
5863
5964 states: [
6065 State {
@@ -70,6 +75,7 @@ QtObject {
7075 portraitOrientation: Qt.PortraitOrientation
7176 invertedPortraitOrientation: Qt.InvertedPortraitOrientation
7277 category: "phone"
78+ name: "mako"
7379 }
7480 },
7581 State {
@@ -85,6 +91,7 @@ QtObject {
8591 portraitOrientation: Qt.PortraitOrientation
8692 invertedPortraitOrientation: Qt.InvertedPortraitOrientation
8793 category: "phone"
94+ name: "krillin"
8895 }
8996 },
9097 State {
@@ -102,6 +109,7 @@ QtObject {
102109 invertedPortraitOrientation: Qt.InvertedPortraitOrientation
103110 supportsMultiColorLed: false
104111 category: "phone"
112+ name: "arale"
105113 }
106114 },
107115 State {
@@ -118,6 +126,7 @@ QtObject {
118126 portraitOrientation: Qt.PortraitOrientation
119127 invertedPortraitOrientation: Qt.InvertedPortraitOrientation
120128 category: "tablet"
129+ name: "manta"
121130 }
122131 },
123132 State {
@@ -134,6 +143,7 @@ QtObject {
134143 portraitOrientation: Qt.PortraitOrientation
135144 invertedPortraitOrientation: Qt.InvertedPortraitOrientation
136145 category: "tablet"
146+ name: "flo"
137147 }
138148 },
139149 State {
@@ -147,6 +157,7 @@ QtObject {
147157 portraitOrientation: Qt.PortraitOrientation
148158 invertedPortraitOrientation: Qt.InvertedPortraitOrientation
149159 category: "desktop"
160+ name: "desktop"
150161 }
151162 },
152163 State {
qml/DisabledScreenNotice.qml+1−1
@@ -27,10 +27,10 @@ Item {
2727 // For testing
2828 property var screen: Screen
2929 property var orientationLock: OrientationLock
30+ property alias overrideDeviceName: deviceConfiguration.overrideName
3031
3132 DeviceConfiguration {
3233 id: deviceConfiguration
33− name: applicationArguments.deviceName
3434 }
3535
3636 Item {
qml/Launcher/LauncherPanel.qml+14−3
@@ -90,16 +90,27 @@ Rectangle {
9090 color: UbuntuColors.orange
9191 readonly property bool highlighted: root.highlightIndex == -1;
9292
93− Icon {
93+ Image {
9494 objectName: "dashItem"
9595 width: parent.width * .6
9696 height: width
9797 anchors.centerIn: parent
98− source: "graphics/home.svg"
99− color: "white"
98+ source: homeIconResolver.background
10099 rotation: root.rotation
101100 }
102101
102+ ImageResolver {
103+ id: homeIconResolver
104+ objectName: "homeIconResolver"
105+
106+ readonly property url defaultHomeIcon: "graphics/home.svg"
107+
108+ candidates: [
109+ "file:///custom/graphics/homebutton.svg",
110+ defaultHomeIcon
111+ ]
112+ }
113+
103114 AbstractButton {
104115 id: dashItem
105116 anchors.fill: parent
qml/OrientedShell.qml+4−1
@@ -33,10 +33,13 @@ Item {
3333 implicitHeight: units.gu(71)
3434
3535 onWidthChanged: calculateUsageMode();
36+ property var overrideDeviceName: screens.count > 1 ? "desktop" : false
3637
3738 DeviceConfiguration {
3839 id: deviceConfiguration
39− name: applicationArguments.deviceName
40+
41+ // Override for convergence to set scale etc for second monitor
42+ overrideName: root.overrideDeviceName
4043 }
4144
4245 property alias orientations: d.orientations
qml/Panel/Indicators/IndicatorsLight.qml+8−8
@@ -20,7 +20,7 @@
2020
2121import QtQuick 2.4
2222import Powerd 0.1
23−import Lights 0.1
23+import Hfd 0.1
2424import QMenuModel 0.1 as QMenuModel
2525import Unity.Indicators 0.1 as Indicators
2626import Wizard 0.1
@@ -171,9 +171,9 @@ console.log("no support for Multicolor LED. " + indicatorState)
171171 }
172172
173173 // HACK: led is only updated after turn on so first always turn off
174− Lights.state = Lights.Off
174+ Leds.state = Leds.Off
175175 if (indicatorState != "INDICATOR_OFF")
176− Lights.state = Lights.On
176+ Leds.state = Leds.On
177177 }
178178
179179 // Existence of unread notifications is determined by checking for a specific icon name in a dbus signal.
@@ -213,23 +213,23 @@ console.log("no support for Multicolor LED. " + indicatorState)
213213 }
214214 }
215215
216− Component.onCompleted: Lights.state = Lights.Off
217− Component.onDestruction: Lights.state = Lights.Off
216+ Component.onCompleted: Leds.state = Lights.Off
217+ Component.onDestruction: Leds.state = Leds.Off
218218
219219 property var _colorBinding: Binding {
220− target: Lights
220+ target: Leds
221221 property: "color"
222222 value: root.color
223223 }
224224
225225 property var _onMillisecBinding: Binding {
226− target: Lights
226+ target: Leds
227227 property: "onMillisec"
228228 value: root.onMillisec
229229 }
230230
231231 property var _offMillisecBinding: Binding {
232− target: Lights
232+ target: Leds
233233 property: "offMillisec"
234234 value: root.offMillisec
235235 }
qml/Shell.qml+1−1
@@ -157,7 +157,7 @@ StyledItem {
157157
158158 property real edgeSize: units.gu(settings.edgeDragWidth)
159159
160− WallpaperResolver {
160+ ImageResolver {
161161 id: wallpaperResolver
162162 objectName: "wallpaperResolver"
163163
qml/Wizard/Pages.qml+8−5
@@ -84,19 +84,22 @@ StyledItem {
8484 }
8585 }
8686
87− function quitWizard() {
88− pageStack.currentPage.enabled = false;
89−
87+ function savePassword() {
9088 if (password != "") {
91− var errorMsg = securityPrivacy.setSecurity("", password, passwordMethod)
89+ var errorMsg = securityPrivacy.setSecurity("", password, passwordMethod);
9290 if (errorMsg !== "") {
9391 // Ignore (but log) any errors, since we're past where the user set
9492 // the method. Worst case, we just leave the user with a swipe
9593 // security method and they fix it in the system settings.
96− console.log("Wizard: Error setting security method:", errorMsg)
94+ console.log("Wizard: Error setting security method:", errorMsg);
9795 }
9896 }
9997
98+ }
99+
100+ function quitWizard() {
101+ pageStack.currentPage.enabled = false;
102+ savePassword();
100103 quit();
101104 }
102105
qml/Wizard/Pages/79-system-update.qml+1
@@ -116,6 +116,7 @@ LocalComponents.Page {
116116 objectName: "installButton"
117117 anchors.fill: parent
118118 onClicked: {
119+ root.savePassword();
119120 System.skipUntilFinishedPage();
120121 SystemImage.applyUpdate();
121122 }
qml/Wizard/Pages/80-finished.qml+1−1
@@ -88,7 +88,7 @@ LocalComponents.Page {
8888 fontSize: "x-large"
8989 font.weight: Font.Light
9090 lineHeight: 1.2
91− text: (System.isUpdate) ? i18n.tr("Welcome Back") : i18n.tr("Welcome to Ubuntu")
91+ text: (System.isUpdate) ? i18n.tr("Welcome Back") : i18n.tr("Welcome to Ubuntu Touch")
9292 color: whiteColor
9393 }
9494
src/ApplicationArguments.h−13
@@ -26,27 +26,14 @@
2626class ApplicationArguments : public QObject
2727{
2828 Q_OBJECT
29− Q_PROPERTY(QString deviceName READ deviceName NOTIFY deviceNameChanged)
3029 Q_PROPERTY(QString mode READ mode CONSTANT)
3130public:
3231 ApplicationArguments(QObject *parent = nullptr);
3332
34− void setDeviceName(const QString &deviceName) {
35− if (deviceName != m_deviceName) {
36− m_deviceName = deviceName;
37− Q_EMIT deviceNameChanged(m_deviceName);
38− }
39− }
40− QString deviceName() const { return m_deviceName; }
41−
4233 void setMode(const QString &mode) { m_mode = mode; }
4334 QString mode() const { return m_mode; }
4435
45−Q_SIGNALS:
46− void deviceNameChanged(const QString&);
47−
4836private:
49− QString m_deviceName;
5037 QString m_mode;
5138};
5239
src/ShellApplication.cpp−12
@@ -47,15 +47,6 @@ ShellApplication::ShellApplication(int & argc, char ** argv, bool isMirServer)
4747
4848 UnityCommandLineParser parser(*this);
4949
50− if (!parser.deviceName().isEmpty()) {
51− m_deviceName = parser.deviceName();
52− } else {
53− char buffer[200];
54− property_get("ro.product.device", buffer /* value */, "desktop" /* default_value*/);
55− m_deviceName = QString(buffer);
56− }
57− m_qmlArgs.setDeviceName(m_deviceName);
58−
5950 m_qmlArgs.setMode(parser.mode());
6051
6152 // The testability driver is only loaded by QApplication but not by QGuiApplication.
@@ -110,7 +101,6 @@ ShellApplication::ShellApplication(int & argc, char ** argv, bool isMirServer)
110101 // (eg cloned desktop, several desktops, etc)
111102 if (isMirServer && screens().count() == 2) {
112103 m_shellView->setScreen(screens().at(1));
113− m_qmlArgs.setDeviceName(QStringLiteral("desktop"));
114104
115105 m_secondaryWindow = new SecondaryWindow(m_qmlEngine);
116106 m_secondaryWindow->setScreen(screens().at(0));
@@ -182,7 +172,6 @@ void ShellApplication::onScreenAdded(QScreen * /*screen*/)
182172 // (eg cloned desktop, several desktops, etc)
183173 if (screens().count() == 2) {
184174 m_shellView->setScreen(screens().at(1));
185− m_qmlArgs.setDeviceName(QStringLiteral("desktop"));
186175 // QWindow::destroy() is called when it changes between screens. We have to manually make it visible again
187176 // <dandrader> This bug is supposedly fixed in Qt 5.5.1, although I can still reproduce it there. :-/
188177 m_shellView->setVisible(true);
@@ -214,7 +203,6 @@ void ShellApplication::onScreenRemoved(QScreen *screen)
214203 delete m_secondaryWindow;
215204 m_secondaryWindow = nullptr;
216205 m_shellView->setScreen(allScreens.first());
217− m_qmlArgs.setDeviceName(m_deviceName);
218206 // Changing the QScreen where a QWindow is drawn makes it also lose focus (besides having
219207 // its backing QPlatformWindow recreated). So lets refocus it.
220208 m_shellView->requestActivate();
src/ShellApplication.h−1
@@ -46,7 +46,6 @@ private Q_SLOTS:
4646
4747private:
4848 void setupQmlEngine(bool isMirServer);
49− QString m_deviceName;
5049 ApplicationArguments m_qmlArgs;
5150 ShellView *m_shellView{nullptr};
5251 SecondaryWindow *m_secondaryWindow{nullptr};
src/UnityCommandLineParser.cpp−5
@@ -51,10 +51,6 @@ UnityCommandLineParser::UnityCommandLineParser(const QCoreApplication &app)
5151 QStringLiteral("DISCOURAGED: Please set QT_LOAD_TESTABILITY instead.\nLoad the testability driver"));
5252 parser.addOption(testabilityOption);
5353
54− QCommandLineOption devicenameOption(QStringList() << QStringLiteral("devicename"),
55− QStringLiteral("Specify the device name instead of letting Unity 8 find it out"), QStringLiteral("devicename"), QLatin1String(""));
56− parser.addOption(devicenameOption);
57−
5854 QCommandLineOption modeOption(QStringLiteral("mode"),
5955 QStringLiteral("Whether to run greeter and/or shell [full-greeter, full-shell, greeter, shell]"),
6056 QStringLiteral("mode"), QStringLiteral("full-greeter"));
@@ -83,7 +79,6 @@ UnityCommandLineParser::UnityCommandLineParser(const QCoreApplication &app)
8379 #endif
8480
8581 m_hasFullscreen = parser.isSet(fullscreenOption);
86− m_deviceName = parser.value(devicenameOption);
8782 resolveMode(parser, modeOption);
8883}
8984
src/UnityCommandLineParser.h−2
@@ -34,7 +34,6 @@ public:
3434 #endif
3535
3636 bool hasFullscreen() const { return m_hasFullscreen; }
37− QString deviceName() const { return m_deviceName; }
3837 QString mode() const { return m_mode; }
3938private:
4039
@@ -53,7 +52,6 @@ private:
5352 #endif
5453
5554 bool m_hasFullscreen;
56− QString m_deviceName;
5755 QString m_mode;
5856};
5957
tests/mocks/CMakeLists.txt+1−1
@@ -35,7 +35,7 @@ add_subdirectory(indicator-service)
3535add_subdirectory(liblightdm)
3636add_subdirectory(libusermetrics)
3737add_subdirectory(LightDMController)
38−add_subdirectory(Lights)
38+add_subdirectory(Hfd)
3939add_subdirectory(MeeGo)
4040add_subdirectory(Powerd)
4141add_subdirectory(QMenuModel)
tests/mocks/Hfd/CMakeLists.txtnew file+8
@@ -0,0 +1,8 @@
1+add_library(MockHfd-qml MODULE
2+ plugin.cpp
3+ Leds.cpp
4+ )
5+
6+qt5_use_modules(MockHfd-qml Qml Gui)
7+
8+add_unity8_mock(Hfd 0.1 Hfd TARGETS MockHfd-qml)
tests/mocks/Lights/Lights.cpp → tests/mocks/Hfd/Leds.cpprenamed+12−12
@@ -14,24 +14,24 @@
1414 * along with this program. If not, see <http://www.gnu.org/licenses/>.
1515 */
1616
17−#include "Lights.h"
17+#include "Leds.h"
1818
1919#include <QDebug>
2020
21−Lights::Lights(QObject* parent)
21+Leds::Leds(QObject* parent)
2222 : QObject(parent),
2323 m_color("blue"),
24− m_state(Lights::Off),
24+ m_state(Leds::Off),
2525 m_onMs(1000),
2626 m_offMs(3000)
2727{
2828}
2929
30−Lights::~Lights()
30+Leds::~Leds()
3131{
3232}
3333
34−void Lights::setState(Lights::State newState)
34+void Leds::setState(Leds::State newState)
3535{
3636 if (m_state != newState) {
3737 m_state = newState;
@@ -39,12 +39,12 @@ void Lights::setState(Lights::State newState)
3939 }
4040}
4141
42−Lights::State Lights::state() const
42+Leds::State Leds::state() const
4343{
4444 return m_state;
4545}
4646
47−void Lights::setColor(const QColor &color)
47+void Leds::setColor(const QColor &color)
4848{
4949 if (m_color != color) {
5050 m_color = color;
@@ -52,17 +52,17 @@ void Lights::setColor(const QColor &color)
5252 }
5353}
5454
55−QColor Lights::color() const
55+QColor Leds::color() const
5656{
5757 return m_color;
5858}
5959
60−int Lights::onMillisec() const
60+int Leds::onMillisec() const
6161{
6262 return m_onMs;
6363}
6464
65−void Lights::setOnMillisec(int onMs)
65+void Leds::setOnMillisec(int onMs)
6666{
6767 if (m_onMs != onMs) {
6868 m_onMs = onMs;
@@ -70,12 +70,12 @@ void Lights::setOnMillisec(int onMs)
7070 }
7171}
7272
73−int Lights::offMillisec() const
73+int Leds::offMillisec() const
7474{
7575 return m_offMs;
7676}
7777
78−void Lights::setOffMillisec(int offMs)
78+void Leds::setOffMillisec(int offMs)
7979{
8080 if (m_offMs != offMs) {
8181 m_offMs = offMs;
tests/mocks/Lights/Lights.h → tests/mocks/Hfd/Leds.hrenamed+4−7
@@ -14,13 +14,12 @@
1414 * along with this program. If not, see <http://www.gnu.org/licenses/>.
1515 */
1616
17−#ifndef UNITY_MOCK_LIGHTS_H
18−#define UNITY_MOCK_LIGHTS_H
17+#pragma once
1918
2019#include <QtCore/QObject>
2120#include <QtGui/QColor>
2221
23−class Lights: public QObject
22+class Leds: public QObject
2423{
2524 Q_OBJECT
2625 Q_PROPERTY(State state READ state WRITE setState NOTIFY stateChanged)
@@ -35,8 +34,8 @@ public:
3534 };
3635 Q_ENUM(State)
3736
38− explicit Lights(QObject *parent = 0);
39− ~Lights();
37+ explicit Leds(QObject *parent = 0);
38+ ~Leds();
4039
4140 void setState(State newState);
4241 State state() const;
@@ -62,5 +61,3 @@ private:
6261 int m_onMs;
6362 int m_offMs;
6463};
65−
66−#endif
tests/mocks/Lights/plugin.cpp → tests/mocks/Hfd/plugin.cpprenamed+5−5
@@ -15,19 +15,19 @@
1515 */
1616
1717#include "plugin.h"
18−#include "Lights.h"
18+#include "Leds.h"
1919
2020#include <QtQml/qqml.h>
2121
22−static QObject *lights_provider(QQmlEngine *engine, QJSEngine *scriptEngine)
22+static QObject *leds_provider(QQmlEngine *engine, QJSEngine *scriptEngine)
2323{
2424 Q_UNUSED(engine)
2525 Q_UNUSED(scriptEngine)
26− return new Lights();
26+ return new Leds();
2727}
2828
2929void PowerdPlugin::registerTypes(const char *uri)
3030{
31− Q_ASSERT(uri == QLatin1String("Lights"));
32− qmlRegisterSingletonType<Lights>(uri, 0, 1, "Lights", lights_provider);
31+ Q_ASSERT(uri == QLatin1String("Hfd"));
32+ qmlRegisterSingletonType<Leds>(uri, 0, 1, "Leds", leds_provider);
3333}
tests/mocks/Lights/plugin.h → tests/mocks/Hfd/plugin.hrenamed+1−4
@@ -14,8 +14,7 @@
1414 * along with this program. If not, see <http://www.gnu.org/licenses/>.
1515 */
1616
17−#ifndef MOCK_POWER_PLUGIN_H
18−#define MOCK_POWER_PLUGIN_H
17+#pragma once
1918
2019#include <QtQml/QQmlEngine>
2120#include <QtQml/QQmlExtensionPlugin>
@@ -28,5 +27,3 @@ class PowerdPlugin : public QQmlExtensionPlugin
2827public:
2928 void registerTypes(const char *uri) override;
3029};
31−
32−#endif
tests/mocks/Hfd/qmldirnew file+3
@@ -0,0 +1,3 @@
1+module Hfd
2+plugin MockHfd-qml
3+typeinfo hfd.qmltypes
tests/mocks/Lights/CMakeLists.txtdeleted−8
@@ -1,8 +0,0 @@
1−add_library(MockLights-qml MODULE
2− plugin.cpp
3− Lights.cpp
4− )
5−
6−target_link_libraries(MockLights-qml Qt5::Qml Qt5::Gui)
7−
8−add_unity8_mock(Lights 0.1 Lights TARGETS MockLights-qml)
tests/mocks/Lights/qmldirdeleted−3
@@ -1,3 +0,0 @@
1−module Lights
2−plugin MockLights-qml
3−typeinfo Lights.qmltypes
tests/mocks/Utils/CMakeLists.txt+3−1
@@ -9,6 +9,7 @@ include_directories(
99 ${Qt5Gui_PRIVATE_INCLUDE_DIRS}
1010 ${Qt5Quick_PRIVATE_INCLUDE_DIRS}
1111 ${GIO_INCLUDE_DIRS}
12+ ${DEVICEINFO_INCLUDE_DIRS}
1213)
1314
1415set(QMLPLUGIN_SRC
@@ -22,7 +23,7 @@ set(QMLPLUGIN_SRC
2223 ${CMAKE_SOURCE_DIR}/plugins/Utils/timezoneFormatter.cpp
2324 ${CMAKE_SOURCE_DIR}/plugins/Utils/applicationsfiltermodel.cpp
2425 ${CMAKE_SOURCE_DIR}/plugins/Utils/inputeventgenerator.cpp
25− ${CMAKE_SOURCE_DIR}/plugins/Utils/deviceconfigparser.cpp
26+ ${CMAKE_SOURCE_DIR}/plugins/Utils/deviceconfig.cpp
2627 ${CMAKE_SOURCE_DIR}/plugins/Utils/globalfunctions.cpp
2728 ${CMAKE_SOURCE_DIR}/plugins/Utils/appdrawerproxymodel.cpp
2829 ${CMAKE_SOURCE_DIR}/plugins/Utils/tabfocusfence.cpp
@@ -48,6 +49,7 @@ add_library(FakeUtils-qml SHARED
4849 )
4950
5051target_link_libraries(FakeUtils-qml
52+ ${DEVICEINFO_LDFLAGS}
5153 ${GIO_LDFLAGS}
5254 Qt5::Qml Qt5::Quick Qt5::DBus Qt5::Network Qt5::Gui
5355 )
tests/mocks/Utils/plugin.cpp+2−2
@@ -38,7 +38,7 @@
3838#include <timezoneFormatter.h>
3939#include <applicationsfiltermodel.h>
4040#include <inputeventgenerator.h>
41−#include <deviceconfigparser.h>
41+#include <deviceconfig.h>
4242#include <globalfunctions.h>
4343#include <appdrawerproxymodel.h>
4444#include <tabfocusfence.h>
@@ -83,7 +83,7 @@ void FakeUtilsPlugin::registerTypes(const char *uri)
8383 qmlRegisterType<ActiveFocusLogger>(uri, 0, 1, "ActiveFocusLogger");
8484 qmlRegisterType<ApplicationsFilterModel>(uri, 0, 1, "ApplicationsFilterModel");
8585 qmlRegisterType<InputEventGenerator>(uri, 0, 1, "InputEventGenerator");
86− qmlRegisterType<DeviceConfigParser>(uri, 0, 1, "DeviceConfigParser");
86+ qmlRegisterType<DeviceConfig>(uri, 0, 1, "DeviceConfig");
8787 qmlRegisterSingletonType<GlobalFunctions>(uri, 0, 1, "Functions", createGlobalFunctions);
8888 qmlRegisterType<URLDispatcher>(uri, 0, 1, "URLDispatcher");
8989 qmlRegisterType<AppDrawerProxyModel>(uri, 0, 1, "AppDrawerProxyModel");
tests/plugins/Utils/CMakeLists.txt−1
@@ -12,7 +12,6 @@ foreach(util_test
1212 QLimitProxyModel
1313 UnitySortFilterProxyModel
1414 WindowInputMonitor
15− DeviceConfigParser
1615 WindowStateStorage
1716)
1817 add_executable(${util_test}TestExec ${util_test}Test.cpp ModelTest.cpp)
tests/plugins/Utils/DeviceConfigParserTest.cppdeleted−76
@@ -1,76 +0,0 @@
1−/*
2− * Copyright (C) 2016 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−// local
18−#include "deviceconfigparser.h"
19−
20−// Qt
21−#include <QTest>
22−#include <QDebug>
23−#include <QSettings>
24−#include <QTemporaryDir>
25−
26−class DeviceConfigParserTest : public QObject
27−{
28− Q_OBJECT
29−
30−private Q_SLOTS:
31−
32− void initTestCase() {
33− }
34−
35− void testDefaults()
36− {
37− DeviceConfigParser p;
38− p.setName("nonexistent");
39−
40− QCOMPARE(p.supportedOrientations(), Qt::PortraitOrientation | Qt::InvertedPortraitOrientation | Qt::LandscapeOrientation | Qt::InvertedLandscapeOrientation);
41− QCOMPARE(p.primaryOrientation(), Qt::PrimaryOrientation);
42− QCOMPARE(p.portraitOrientation(), Qt::PortraitOrientation);
43− QCOMPARE(p.invertedPortraitOrientation(), Qt::InvertedPortraitOrientation);
44− QCOMPARE(p.landscapeOrientation(), Qt::LandscapeOrientation);
45− QCOMPARE(p.invertedLandscapeOrientation(), Qt::InvertedLandscapeOrientation);
46− QCOMPARE(p.supportsMultiColorLed(), true);
47− }
48−
49− void testCustomFile() {
50− QTemporaryDir dir;
51− QSettings s(dir.path() + "/devices.conf", QSettings::IniFormat);
52− s.beginGroup("fakedevice");
53−
54− s.setValue("SupportedOrientations", QStringList() << "Portrait" << "Landscape" << "InvertedLandscape");
55− s.setValue("PrimaryOrientation", "InvertedLandscape");
56− s.setValue("SupportsMultiColorLed", false);
57− s.sync();
58−
59− qputenv("XDG_CONFIG_HOME", dir.path().toUtf8());
60− DeviceConfigParser p;
61− p.setName("fakedevice");
62−
63− QCOMPARE(p.supportedOrientations(), Qt::PortraitOrientation | Qt::LandscapeOrientation | Qt::InvertedLandscapeOrientation);
64− QCOMPARE(p.primaryOrientation(), Qt::InvertedLandscapeOrientation);
65− QCOMPARE(p.portraitOrientation(), Qt::PortraitOrientation);
66− QCOMPARE(p.invertedPortraitOrientation(), Qt::InvertedPortraitOrientation);
67− QCOMPARE(p.landscapeOrientation(), Qt::LandscapeOrientation);
68− QCOMPARE(p.invertedLandscapeOrientation(), Qt::InvertedLandscapeOrientation);
69− QCOMPARE(p.supportsMultiColorLed(), false);
70− }
71−
72−};
73−
74−QTEST_GUILESS_MAIN(DeviceConfigParserTest)
75−
76−#include "DeviceConfigParserTest.moc"
tests/qmltests/CMakeLists.txt+1−1
@@ -23,7 +23,7 @@ add_unity8_qmltest(Components Rating)
2323add_unity8_qmltest(Components SharingPicker)
2424add_unity8_qmltest(Components Showable)
2525add_unity8_qmltest(Components VirtualTouchPad)
26−add_unity8_qmltest(Components WallpaperResolver)
26+add_unity8_qmltest(Components ImageResolver)
2727add_unity8_qmltest(Components ZoomableImage)
2828add_unity8_qmltest(Greeter Clock)
2929add_unity8_qmltest(Greeter Greeter)
tests/qmltests/Components/tst_WallpaperResolver.qml → tests/qmltests/Components/tst_ImageResolver.qmlrenamed+6−6
@@ -26,15 +26,15 @@ Image {
2626 width: units.gu(70)
2727 height: units.gu(70)
2828
29− source: wallpaperResolver.background
29+ source: imageResolver.background
3030
31− WallpaperResolver {
32− id: wallpaperResolver
31+ ImageResolver {
32+ id: imageResolver
3333 }
3434
3535 UnityTestCase {
3636 id: testCase
37− name: "WallpaperResolver"
37+ name: "ImageResolver"
3838 when: windowShown
3939
4040 function test_background_data() {
@@ -68,8 +68,8 @@ Image {
6868 }
6969
7070 function test_background(data) {
71− wallpaperResolver.candidates = data.list;
72− tryCompare(wallpaperResolver, "background", data.output);
71+ imageResolver.candidates = data.list;
72+ tryCompare(imageResolver, "background", data.output);
7373 }
7474 }
7575}
tests/qmltests/Greeter/tst_NarrowView.qml+1−1
@@ -445,7 +445,7 @@ Item {
445445 verify(dataCircle);
446446
447447 tap(dataCircle);
448− wait(1);
448+ wait(200);
449449 tap(dataCircle);
450450
451451 tryCompare(infographicDataChangedSpy, "count", 1);
tests/qmltests/Panel/Indicators/tst_IndicatorsLight.qml+28−28
@@ -20,7 +20,7 @@ import Unity.Test 0.1 as UT
2020import Unity.Indicators 0.1 as Indicators
2121import Ubuntu.Components 1.3
2222import Powerd 0.1
23−import Lights 0.1
23+import Hfd 0.1
2424import QMenuModel 0.1
2525import "../../../../qml/Panel/Indicators"
2626
@@ -75,7 +75,7 @@ Item {
7575 radius: width / 2
7676 anchors.centerIn: parent
7777
78− color: Lights.state === Lights.On ? Lights.color : "transparent"
78+ color: Leds.state === Leds.On ? Leds.color : "transparent"
7979
8080 border.color: "black"
8181 border.width: 1
@@ -162,79 +162,79 @@ Item {
162162 //
163163 // new messages
164164 //
165− { tag: "Powerd.On with No Message", powerd: Powerd.On, actionData: noNewMessage, expectedLightsState: Lights.Off },
166− { tag: "Powerd.Off with No Message", powerd: Powerd.Off, actionData: noNewMessage, expectedLightsState: Lights.Off },
167− { tag: "Powerd.On with New Message", powerd: Powerd.On, actionData: newMessage, expectedLightsState: Lights.Off },
168− { tag: "Powerd.Off with New Message", powerd: Powerd.Off, actionData: newMessage, expectedLightsState: Lights.On },
165+ { tag: "Powerd.On with No Message", powerd: Powerd.On, actionData: noNewMessage, expectedLightsState: Leds.Off },
166+ { tag: "Powerd.Off with No Message", powerd: Powerd.Off, actionData: noNewMessage, expectedLightsState: Leds.Off },
167+ { tag: "Powerd.On with New Message", powerd: Powerd.On, actionData: newMessage, expectedLightsState: Leds.Off },
168+ { tag: "Powerd.Off with New Message", powerd: Powerd.Off, actionData: newMessage, expectedLightsState: Leds.On },
169169
170170 //
171171 // show charging
172172 //
173173 { tag: "Powerd.Off while charging",
174− expectedLightsState: Lights.On,
174+ expectedLightsState: Leds.On,
175175 powerd: Powerd.Off, actionData: deviceStateDBusSignals.charging },
176176
177177 { tag: "Powerd.On while charging",
178− expectedLightsState: Lights.Off,
178+ expectedLightsState: Leds.Off,
179179 powerd: Powerd.On, actionData: deviceStateDBusSignals.charging },
180180
181181 { tag: "Powerd.On while charging",
182− expectedLightsState: Lights.Off,
182+ expectedLightsState: Leds.Off,
183183 powerd: Powerd.On, wizardStatus: batteryIconNames.charging },
184184
185185 //
186186 // show charging and full
187187 //
188188 { tag: "Powerd.Off while charging and battery full",
189− expectedLightsState: Lights.On, expectedLightsColor: green,
189+ expectedLightsState: Leds.On, expectedLightsColor: green,
190190 powerd: Powerd.Off, actionData: deviceStateDBusSignals.fullyCharged },
191191
192192 { tag: "Powerd.On while charging and battery full",
193− expectedLightsState: Lights.Off,
193+ expectedLightsState: Leds.Off,
194194 powerd: Powerd.On, actionData: deviceStateDBusSignals.fullyCharged },
195195
196196 { tag: "Powerd.Off while discharging and battery full",
197− expectedLightsState: Lights.Off,
197+ expectedLightsState: Leds.Off,
198198 powerd: Powerd.Off, actionData: deviceStateDBusSignals.discharging, wizardStatus: batteryIconNames.fullyCharged },
199199
200200 //
201201 // show empty
202202 //
203203 { tag: "Powerd.Off while discharging and battery empty",
204− expectedLightsState: Lights.On, expectedLightsColor: orangeRed,
204+ expectedLightsState: Leds.On, expectedLightsColor: orangeRed,
205205 powerd: Powerd.Off, wizardStatus: batteryIconNames.caution },
206206
207207 { tag: "Powerd.On while discharging and battery empty",
208− expectedLightsState: Lights.Off,
208+ expectedLightsState: Leds.Off,
209209 powerd: Powerd.On, wizardStatus: batteryIconNames.caution },
210210
211211 { tag: "Powerd.On while discharging and battery empty",
212− expectedLightsState: Lights.Off,
212+ expectedLightsState: Leds.Off,
213213 powerd: Powerd.On, wizardStatus: batteryIconNames.empty },
214214
215215 { tag: "Powerd.Off while charging and battery empty",
216− expectedLightsState: Lights.On, expectedLightsColor: white,
216+ expectedLightsState: Leds.On, expectedLightsColor: white,
217217 powerd: Powerd.Off, actionData: deviceStateDBusSignals.charging },
218218
219219 //
220220 // new message has highest priority
221221 //
222222 { tag: "Powerd.Off with New Message, discharging and battery empty",
223− expectedLightsState: Lights.On,
223+ expectedLightsState: Leds.On,
224224 expectedLightsColor: darkGreen,
225225 expectedLightsOnMillisec: 1000,
226226 expectedLightsOffMillisec: 3000,
227227 powerd: Powerd.Off, actionData: newMessage, wizardStatus: batteryIconNames.caution },
228228
229229 { tag: "Powerd.Off with New Message and charging",
230− expectedLightsState: Lights.On,
230+ expectedLightsState: Leds.On,
231231 expectedLightsColor: darkGreen,
232232 expectedLightsOnMillisec: 1000,
233233 expectedLightsOffMillisec: 3000,
234234 powerd: Powerd.Off, actionData: combinedDBusSignals.hasMessageAndCharging },
235235
236236 { tag: "Powerd.Off with New Message, charging and battery full",
237− expectedLightsState: Lights.On,
237+ expectedLightsState: Leds.On,
238238 expectedLightsColor: darkGreen,
239239 expectedLightsOnMillisec: 1000,
240240 expectedLightsOffMillisec: 3000,
@@ -244,11 +244,11 @@ Item {
244244 // use battery level
245245 //
246246 { tag: "Powerd.Off while charging and battery level at 80%",
247− expectedLightsState: Lights.On, expectedLightsColor: white,
247+ expectedLightsState: Leds.On, expectedLightsColor: white,
248248 powerd: Powerd.Off, actionData: batteryLevelDBusSignals["80"], wizardStatus: batteryIconNames.charging },
249249
250250 { tag: "Powerd.Off while charging and battery level at 100%",
251− expectedLightsState: Lights.On, expectedLightsColor: green,
251+ expectedLightsState: Leds.On, expectedLightsColor: green,
252252 expectedLightsOnMillisec: 1000,
253253 expectedLightsOffMillisec: 0,
254254 powerd: Powerd.Off, actionData: batteryLevelDBusSignals["100"], wizardStatus: batteryIconNames.charging },
@@ -257,13 +257,13 @@ Item {
257257 // Support for Multicolor LED
258258 //
259259 { tag: "Powerd.Off with New Message & no support for multicolor led",
260− expectedLightsState: Lights.On,
260+ expectedLightsState: Leds.On,
261261 powerd: Powerd.Off, actionData: newMessage, supportsMultiColorLed: false },
262262 { tag: "Powerd.Off while charging & support for multicolor led",
263− expectedLightsState: Lights.On,
263+ expectedLightsState: Leds.On,
264264 powerd: Powerd.Off, actionData: deviceStateDBusSignals.charging, supportsMultiColorLed: true },
265265 { tag: "Powerd.Off while charging & no support for multicolor led",
266− expectedLightsState: Lights.Off,
266+ expectedLightsState: Leds.Off,
267267 powerd: Powerd.Off, actionData: deviceStateDBusSignals.charging, supportsMultiColorLed: false },
268268 ]
269269 }
@@ -280,13 +280,13 @@ Item {
280280 if (data.hasOwnProperty("wizardStatus"))
281281 loader.item.batteryIconName = data.wizardStatus
282282
283− compare(Lights.state, data.expectedLightsState, "Lights state does not match expected value");
283+ compare(Leds.state, data.expectedLightsState, "Lights state does not match expected value");
284284 if (data.hasOwnProperty("expectedLightsColor"))
285− compare(Lights.color, data.expectedLightsColor, "Lights color does not match expected value")
285+ compare(Leds.color, data.expectedLightsColor, "Lights color does not match expected value")
286286 if (data.hasOwnProperty("expectedLightsOnMillisec"))
287− compare(Lights.onMillisec, data.expectedLightsOnMillisec, "Lights OnMillisec does not match expected value")
287+ compare(Leds.onMillisec, data.expectedLightsOnMillisec, "Lights OnMillisec does not match expected value")
288288 if (data.hasOwnProperty("expectedLightsOffMillisec"))
289− compare(Lights.offMillisec, data.expectedLightsOffMillisec, "Lights OffMillisec does not match expected value")
289+ compare(Leds.offMillisec, data.expectedLightsOffMillisec, "Lights OffMillisec does not match expected value")
290290 }
291291 }
292292}
tests/qmltests/tst_DeviceConfiguration.qml+23−2
@@ -34,8 +34,9 @@ Item {
3434 when: windowShown
3535
3636 function test_defaults() {
37− deviceConfiguration.name = "nonexisting"
38− compare(deviceConfiguration.primaryOrientation, -1)
37+ compare(deviceConfiguration.name, "generic");
38+ compare(deviceConfiguration.category, "desktop");
39+ compare(deviceConfiguration.primaryOrientation, Qt.LandscapeOrientation)
3940 compare(deviceConfiguration.landscapeOrientation, Qt.LandscapeOrientation)
4041 compare(deviceConfiguration.portraitOrientation, Qt.PortraitOrientation)
4142 compare(deviceConfiguration.invertedLandscapeOrientation, Qt.InvertedLandscapeOrientation)
@@ -45,5 +46,25 @@ Item {
4546 | Qt.LandscapeOrientation
4647 | Qt.InvertedLandscapeOrientation)
4748 }
49+
50+ function test_nameOverride() {
51+ deviceConfiguration.overrideName = "flo";
52+ compare(deviceConfiguration.name, "flo");
53+ compare(deviceConfiguration.category, "tablet");
54+ compare(deviceConfiguration.primaryOrientation, Qt.InvertedLandscapeOrientation)
55+ compare(deviceConfiguration.landscapeOrientation, Qt.InvertedLandscapeOrientation)
56+ compare(deviceConfiguration.portraitOrientation, Qt.PortraitOrientation)
57+ compare(deviceConfiguration.invertedLandscapeOrientation, Qt.LandscapeOrientation)
58+ compare(deviceConfiguration.invertedPortraitOrientation, Qt.InvertedPortraitOrientation)
59+ compare(deviceConfiguration.supportedOrientations, Qt.PortraitOrientation
60+ | Qt.InvertedPortraitOrientation
61+ | Qt.LandscapeOrientation
62+ | Qt.InvertedLandscapeOrientation)
63+
64+ // Also try reseting override
65+ deviceConfiguration.overrideName = false;
66+ compare(deviceConfiguration.name, "generic");
67+ compare(deviceConfiguration.category, "desktop");
68+ }
4869 }
4970}
tests/qmltests/tst_DisabledScreenNotice.qml+1−3
@@ -31,12 +31,10 @@ Item {
3131 id: touchScreenPad
3232 anchors.fill: parent
3333 anchors.rightMargin: units.gu(40)
34+ overrideDeviceName: "mako"
3435
3536 // Mock some things here
3637 property int internalGu: units.gu(1)
37− property var applicationArguments: QtObject {
38− property string deviceName: "mako"
39− }
4038
4139 screen: QtObject {
4240 property int orientation: {
tests/qmltests/tst_OrientedShell.qml+1
@@ -171,6 +171,7 @@ Rectangle {
171171 physicalOrientation: root.physicalOrientation0
172172 orientationLocked: orientationLockedCheckBox.checked
173173 orientationLock: mockOrientationLock
174+ overrideDeviceName: applicationArguments.deviceName
174175 Component.onDestruction: {
175176 orientedShellLoader.itemDestroyed = true;
176177 }