on xenial help sign in
Merge trunk.
5d9abd8Michał Sawicz
.bazaar/plugins/makecheck_unity_phablet.py+16−8
@@ -1,5 +1,5 @@
1#!/usr/bin/python
1#!/usr/bin/python
2−# Copyright 2013 Canonical Ltd.
2+# Copyright 2013, 2014 Canonical Ltd.
3#
3#
4# This program is free software; you can redistribute it and/or modify
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
5# it under the terms of the GNU Lesser General Public License as published by
@@ -13,11 +13,15 @@
13# You should have received a copy of the GNU Lesser General Public License
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/>.
14# along with this program. If not, see <http://www.gnu.org/licenses/>.
15
15
16−import os, subprocess
16+import os
17+import subprocess
17−from bzrlib import branch, errors
18+from bzrlib import branch
18−from bzrlib.urlutils import dirname, local_path_from_url
19+from bzrlib.urlutils import local_path_from_url
19
20
21+
22+def execute_makecheck(
23+ local_branch, master_branch, old_revision_number, old_revision_id,
20−def execute_makecheck(local_branch, master_branch, old_revision_number, old_revision_id, future_revision_number, future_revision_id, tree_delta, future_tree):
24+ future_revision_number, future_revision_id, tree_delta, future_tree):
21 if not master_branch.basis_tree().has_filename("qml/Shell.qml"):
25 if not master_branch.basis_tree().has_filename("qml/Shell.qml"):
22 return
26 return
23
27
@@ -27,7 +31,9 @@ def execute_makecheck(local_branch, master_branch, old_revision_number, old_revi
27 os.environ['CTEST_OUTPUT_ON_FAILURE'] = "1"
31 os.environ['CTEST_OUTPUT_ON_FAILURE'] = "1"
28 if (subprocess.call("make -C builddir test", shell=True) != 0):
32 if (subprocess.call("make -C builddir test", shell=True) != 0):
29
33
34+ print("\n\n*** Warning ***\n\n"
30− print("\n\n*** Warning ***\n\nBasic tests failed. This commit will not pass continuous integration.")
35+ "Basic tests failed. This commit will not pass continuous "
36+ "integration.")
31
37
32 branch = local_branch or master_branch
38 branch = local_branch or master_branch
33 revision = branch.repository.get_revision(future_revision_id)
39 revision = branch.repository.get_revision(future_revision_id)
@@ -36,8 +42,10 @@ def execute_makecheck(local_branch, master_branch, old_revision_number, old_revi
36 msg_file.close()
42 msg_file.close()
37
43
38 print("\n\nSaved commit message to $SRC_DIR/message.txt.")
44 print("\n\nSaved commit message to $SRC_DIR/message.txt.")
39− print("You can uncommit this revision, fix the tests and reuse your message running:\n\nbzr commit -F message.txt\n\n")
45+ print("You can uncommit this revision, fix the tests and reuse your "
46+ "message running:\n\nbzr commit -F message.txt\n\n")
40 elif os.path.isfile("message.txt"):
47 elif os.path.isfile("message.txt"):
41 os.remove("message.txt")
48 os.remove("message.txt")
42
49
50+branch.Branch.hooks.install_named_hook(
43−branch.Branch.hooks.install_named_hook('pre_commit', execute_makecheck, 'make check pre-commit')
51+ 'pre_commit', execute_makecheck, 'make check pre-commit')
build.sh+1
@@ -42,6 +42,7 @@ install_dependencies() {
42 equivs \
42 equivs \
43 gsettings-desktop-schemas \
43 gsettings-desktop-schemas \
44 gsettings-ubuntu-schemas \
44 gsettings-ubuntu-schemas \
45+ pay-service \
45 qmenumodel-qml \
46 qmenumodel-qml \
46 qml-module-qtquick-xmllistmodel \
47 qml-module-qtquick-xmllistmodel \
47 qtdeclarative5-gsettings1.0 \
48 qtdeclarative5-gsettings1.0 \
cmake/modules/autopilot.cmake+2−2
@@ -2,7 +2,7 @@ add_custom_target(autopilot)
2
2
3function(declare_autopilot_test TEST_NAME TEST_SUITE WORKING_DIR)
3function(declare_autopilot_test TEST_NAME TEST_SUITE WORKING_DIR)
4 add_custom_target(autopilot-${TEST_NAME}
4 add_custom_target(autopilot-${TEST_NAME}
5− COMMAND LANG=C UBUNTU_ICON_THEME=ubuntu-mobile QML2_IMPORT_PATH=${SHELL_INSTALL_QML}/mocks python3 -m autopilot.run run ${TEST_SUITE}
5+ COMMAND LANG=C QML2_IMPORT_PATH=${SHELL_INSTALL_QML}/mocks python3 -m autopilot.run run ${TEST_SUITE}
6 WORKING_DIRECTORY ${WORKING_DIR}
6 WORKING_DIRECTORY ${WORKING_DIR}
7 DEPENDS fake_install
7 DEPENDS fake_install
8 )
8 )
@@ -14,7 +14,7 @@ function(declare_autopilot_test TEST_NAME TEST_SUITE WORKING_DIR)
14 add_dependencies(autopilot autopilot-${TEST_NAME})
14 add_dependencies(autopilot autopilot-${TEST_NAME})
15
15
16 add_custom_target(autopilot2-${TEST_NAME}
16 add_custom_target(autopilot2-${TEST_NAME}
17− COMMAND LANG=C UBUNTU_ICON_THEME=ubuntu-mobile QML2_IMPORT_PATH=${SHELL_INSTALL_QML}/mocks python2 -m autopilot.run run ${TEST_SUITE}
17+ COMMAND LANG=C QML2_IMPORT_PATH=${SHELL_INSTALL_QML}/mocks python2 -m autopilot.run run ${TEST_SUITE}
18 WORKING_DIRECTORY ${WORKING_DIR}
18 WORKING_DIRECTORY ${WORKING_DIR}
19 DEPENDS fake_install
19 DEPENDS fake_install
20 )
20 )
debian/changelog+94
@@ -1,3 +1,97 @@
1+unity8 (7.90+14.10.20140703.1-0ubuntu1) utopic; urgency=low
2+
3+ [ Michał Sawicz ]
4+ * Initial code for a payment button widget, to handle purchasing apps
5+ from the click scope.
6+
7+ [ Nick Dedekind ]
8+ * Moved [Message]MenuItemFacotory from Unity.Indicators plugin to qml
9+ folder.
10+
11+ [ Albert Astals ]
12+ * EasingCurve: Initialize members
13+ * Fix valgrind warning by not emitting reset on model destructor That
14+ won't be supported until Qt 5.4 More info at https://bugreports.qt-
15+ project.org/browse/QTBUG-39780 Warning was ==16693== Invalid read of
16+ size 8 ==16693== at 0x72B19A0: QQmlContext::isValid() const
17+ (qqmlcontext.cpp:231) ==16693== by 0x736C82B:
18+ QQmlDelegateModelPrivate::emitChanges() (qqmldelegatemodel.cpp:1412)
19+ ==16693== by 0x7372AE6: QQmlDelegateModel::_q_modelReset()
20+ (qqmldelegatemodel.cpp:1463) ==16693== by 0x7397224:
21+ QQmlDelegateModel::qt_static_metacall(QObject*, QMetaObject::Call,
22+ int, void**) (moc_qqmldelegatemodel_p.cpp:196) ==16693== by
23+ 0x739769E: QQmlDelegateModel::qt_metacall(QMetaObject::Call, int,
24+ void**) (moc_qqmldelegatemodel_p.cpp:292) ==16693== by 0x66379CC:
25+ QMetaObject::activate(QObject*, int, int, void**) (in
26+ /usr/lib/x86_64-linux-gnu/libQt5Core.so.5.3.0) ==16693== by
27+ 0x65AEEFD: QAbstractItemModel::endResetModel() (in /usr/lib/x86_64-
28+ linux-gnu/libQt5Core.so.5.3.0) ==16693== by 0x23461EFD:
29+ FakeIndicatorsModel::unload() (fakeindicatorsmodel.cpp:53) ==16693==
30+ by 0x23461E13: FakeIndicatorsModel::~FakeIndicatorsModel()
31+ (fakeindicatorsmodel.cpp:34) ==16693== by 0x2345C073:
32+ QQmlPrivate::QQmlElement<FakeIndicatorsModel>::~QQmlElement() (in
33+ /home/tsdgeos_work/phablet/unity8/investigate_test_shell_crash/build
34+ dir/tests/mocks/Unity/Indicators/libIndicatorsFakeQml.so) ==16693==
35+ by 0x2345C0A3:
36+ QQmlPrivate::QQmlElement<FakeIndicatorsModel>::~QQmlElement()
37+ (qqmlprivate.h:106) ==16693== by 0x663636B:
38+ QObjectPrivate::deleteChildren() (in /usr/lib/x86_64-linux-
39+ gnu/libQt5Core.so.5.3.0) ==16693== Address 0x1862d448 is 8 bytes
40+ inside a block of size 16 free'd ==16693== at 0x4C2C2BC: operator
41+ delete(void*) (vg_replace_malloc.c:503) ==16693== by 0x72B21B8:
42+ QQmlContextData::destroy() (qqmlcontext.cpp:647) ==16693== by
43+ 0x7293458: QQmlPrivate::qdeclarativeelement_destructor(QObject*)
44+ (qqmlengine.cpp:612) ==16693== by 0x6C0CADD:
45+ QQmlPrivate::QQmlElement<QQuickItem>::~QQmlElement()
46+ (qqmlprivate.h:105) ==16693== by 0x663636B:
47+ QObjectPrivate::deleteChildren() (in /usr/lib/x86_64-linux-
48+ gnu/libQt5Core.so.5.3.0) ==16693== by 0x663F0EB: QObject::~QObject()
49+ (in /usr/lib/x86_64-linux-gnu/libQt5Core.so.5.3.0) ==16693== by
50+ 0x6BF64B5: QQuickItem::~QQuickItem() (qquickitem.cpp:2064) ==16693==
51+ by 0x6C0CAE5: QQmlPrivate::QQmlElement<QQuickItem>::~QQmlElement()
52+ (qqmlprivate.h:106) ==16693== by 0x663636B:
53+ QObjectPrivate::deleteChildren() (in /usr/lib/x86_64-linux-
54+ gnu/libQt5Core.so.5.3.0) ==16693== by 0x663F0EB: QObject::~QObject()
55+ (in /usr/lib/x86_64-linux-gnu/libQt5Core.so.5.3.0) ==16693== by
56+ 0x6BF64B5: QQuickItem::~QQuickItem() (qquickitem.cpp:2064) ==16693==
57+ by 0x6C0CAE5: QQmlPrivate::QQmlElement<QQuickItem>::~QQmlElement()
58+ (qqmlprivate.h:106) (LP: #1332598)
59+
60+ [ Michael Zanetti ]
61+ * drop launcher item spacing (LP: #1332022)
62+ * change wording in launcher quicklist (LP: #1332035)
63+
64+ [ Alejandro J. Cura ]
65+ * Initial code for a payment button widget, to handle purchasing apps
66+ from the click scope.
67+
68+ [ Rodney Dawes ]
69+ * Initial code for a payment button widget, to handle purchasing apps
70+ from the click scope.
71+
72+ [ Renato Araujo Oliveira Filho ]
73+ * Create IndicatorsLight.qml component used to control indicator led.
74+ A blue led will pulse if the message indicator is blue and screen is
75+ off.
76+
77+ -- Ubuntu daily release <ps-jenkins@lists.canonical.com> Thu, 03 Jul 2014 14:47:46 +0000
78+
79+unity8 (7.90+14.10.20140701.2-0ubuntu2) utopic; urgency=medium
80+
81+ * debian/control:
82+ list qtdeclarative5-ubuntu-ui-toolkit-plugin-gles as an alternative
83+ choice, since provides are not versionned, should restore installability
84+ on amd64 and i386
85+
86+ -- Sebastien Bacher <seb128@ubuntu.com> Thu, 03 Jul 2014 13:26:38 +0200
87+
88+unity8 (7.90+14.10.20140701.2-0ubuntu1) utopic; urgency=medium
89+
90+ [ Michał Sawicz ]
91+ * Adapt to suru theme.
92+
93+ -- Ubuntu daily release <ps-jenkins@lists.canonical.com> Tue, 01 Jul 2014 15:10:35 +0000
94+
1unity8 (7.89+14.10.20140627-0ubuntu1) utopic; urgency=low
95unity8 (7.89+14.10.20140627-0ubuntu1) utopic; urgency=low
2
96
3 [ Michael Terry ]
97 [ Michael Terry ]
debian/control+9−5
@@ -13,7 +13,9 @@ Build-Depends: cmake,
13 libgles2-mesa-dev[armhf],
13 libgles2-mesa-dev[armhf],
14 libglib2.0-dev,
14 libglib2.0-dev,
15 libgsettings-qt-dev,
15 libgsettings-qt-dev,
16+ libhardware-dev,
16 libhud-client2-dev,
17 libhud-client2-dev,
18+ libpay1-dev,
17 libpulse-dev,
19 libpulse-dev,
18 libqmenumodel-dev (>= 0.2.7),
20 libqmenumodel-dev (>= 0.2.7),
19 libqt5xmlpatterns5-dev,
21 libqt5xmlpatterns5-dev,
@@ -37,8 +39,8 @@ Build-Depends: cmake,
37 qtdeclarative5-dev-tools,
39 qtdeclarative5-dev-tools,
38 qtdeclarative5-private-dev (>= 5.2.1),
40 qtdeclarative5-private-dev (>= 5.2.1),
39 qtdeclarative5-qtmultimedia-plugin,
41 qtdeclarative5-qtmultimedia-plugin,
40− qtdeclarative5-ubuntu-settings-components,
42+ qtdeclarative5-ubuntu-settings-components (>= 0.2),
41− qtdeclarative5-ubuntu-ui-toolkit-plugin,
43+ qtdeclarative5-ubuntu-ui-toolkit-plugin (>= 0.1.48) | qtdeclarative5-ubuntu-ui-toolkit-plugin-gles (>= 0.1.48),
42 ttf-ubuntu-font-family,
44 ttf-ubuntu-font-family,
43Standards-Version: 3.9.4
45Standards-Version: 3.9.4
44Homepage: http://launchpad.net/unity
46Homepage: http://launchpad.net/unity
@@ -51,7 +53,7 @@ Vcs-Browser: https://bazaar.launchpad.net/~unity-team/unity8/trunk
51Package: indicators-client
53Package: indicators-client
52Architecture: amd64 armhf i386
54Architecture: amd64 armhf i386
53Depends: qmenumodel-qml (>= 0.2.7),
55Depends: qmenumodel-qml (>= 0.2.7),
54− qtdeclarative5-ubuntu-ui-toolkit-plugin,
56+ qtdeclarative5-ubuntu-ui-toolkit-plugin (>= 0.1.48) | qtdeclarative5-ubuntu-ui-toolkit-plugin-gles (>= 0.1.48),
55 unity8 (= ${binary:Version}),
57 unity8 (= ${binary:Version}),
56 ${misc:Depends},
58 ${misc:Depends},
57 ${shlibs:Depends},
59 ${shlibs:Depends},
@@ -78,7 +80,7 @@ Depends: gsettings-desktop-schemas,
78 qmenumodel-qml (>= 0.2.7),
80 qmenumodel-qml (>= 0.2.7),
79 qml-module-qtquick-xmllistmodel,
81 qml-module-qtquick-xmllistmodel,
80 qtdeclarative5-gsettings1.0,
82 qtdeclarative5-gsettings1.0,
81− qtdeclarative5-ubuntu-settings-components,
83+ qtdeclarative5-ubuntu-settings-components (>= 0.2),
82 unity-launcher-impl-3,
84 unity-launcher-impl-3,
83 unity8-common (= ${source:Version}),
85 unity8-common (= ${source:Version}),
84 unity8-private (= ${binary:Version}),
86 unity8-private (= ${binary:Version}),
@@ -99,7 +101,7 @@ Description: Unity 8 shell
99Package: unity8-common
101Package: unity8-common
100Architecture: all
102Architecture: all
101Depends: qtdeclarative5-ubuntu-thumbnailer0.1 | ubuntu-thumbnailer-impl,
103Depends: qtdeclarative5-ubuntu-thumbnailer0.1 | ubuntu-thumbnailer-impl,
102− qtdeclarative5-ubuntu-ui-toolkit-plugin,
104+ qtdeclarative5-ubuntu-ui-toolkit-plugin (>= 0.1.48) | qtdeclarative5-ubuntu-ui-toolkit-plugin-gles (>= 0.1.48),
103 qtdeclarative5-unity-notifications-plugin | unity-notifications-impl,
105 qtdeclarative5-unity-notifications-plugin | unity-notifications-impl,
104 ubuntu-thumbnailer-impl-0,
106 ubuntu-thumbnailer-impl-0,
105 unity-application-impl-2,
107 unity-application-impl-2,
@@ -159,7 +161,9 @@ Architecture: any
159Multi-Arch: same
161Multi-Arch: same
160Pre-Depends: ${misc:Pre-Depends},
162Pre-Depends: ${misc:Pre-Depends},
161Depends: gsettings-ubuntu-schemas,
163Depends: gsettings-ubuntu-schemas,
164+ libhardware2,
162 libunity-core-6.0-9,
165 libunity-core-6.0-9,
166+ pay-service,
163 ${misc:Depends},
167 ${misc:Depends},
164 ${shlibs:Depends},
168 ${shlibs:Depends},
165Provides: unity-launcher-impl,
169Provides: unity-launcher-impl,
debian/unity8-private.install+1
@@ -2,6 +2,7 @@ usr/lib/*/unity8/qml/AccountsService
2usr/lib/*/unity8/qml/Dash
2usr/lib/*/unity8/qml/Dash
3usr/lib/*/unity8/qml/HudClient
3usr/lib/*/unity8/qml/HudClient
4usr/lib/*/unity8/qml/LightDM
4usr/lib/*/unity8/qml/LightDM
5+usr/lib/*/unity8/qml/Lights
5usr/lib/*/unity8/qml/Powerd
6usr/lib/*/unity8/qml/Powerd
6usr/lib/*/unity8/qml/SessionBroadcast
7usr/lib/*/unity8/qml/SessionBroadcast
7usr/lib/*/unity8/qml/Ubuntu
8usr/lib/*/unity8/qml/Ubuntu
include/paths.h.in−8
@@ -127,12 +127,4 @@ inline void appendImportPaths(QQmlEngine *engine, const QStringList &paths)
127 engine->setImportPathList(importPathList);
127 engine->setImportPathList(importPathList);
128}
128}
129
129
130−inline void resolveIconTheme() {
131− const char *ubuntuIconTheme = getenv("UBUNTU_ICON_THEME");
132− if (ubuntuIconTheme == NULL) {
133− ubuntuIconTheme = "ubuntu-mobile";
134− }
135− QIcon::setThemeName(ubuntuIconTheme);
136−}
137−
138#endif
130#endif
plugins/CMakeLists.txt+1
@@ -14,6 +14,7 @@ endmacro()
14add_subdirectory(AccountsService)
14add_subdirectory(AccountsService)
15add_subdirectory(HudClient)
15add_subdirectory(HudClient)
16add_subdirectory(LightDM)
16add_subdirectory(LightDM)
17+add_subdirectory(Lights)
17add_subdirectory(Dash)
18add_subdirectory(Dash)
18add_subdirectory(Powerd)
19add_subdirectory(Powerd)
19add_subdirectory(SessionBroadcast)
20add_subdirectory(SessionBroadcast)
plugins/Lights/CMakeLists.txtnew file+18
@@ -0,0 +1,18 @@
1+include(FindPkgConfig)
2+
3+pkg_check_modules(ANDROID_HEADERS REQUIRED android-headers)
4+pkg_check_modules(ANDROID_HARDWARE REQUIRED libhardware)
5+
6+include_directories(
7+ ${ANDROID_HEADERS_INCLUDE_DIRS}
8+)
9+
10+add_library(Lights-qml MODULE
11+ plugin.cpp
12+ Lights.cpp
13+ )
14+
15+qt5_use_modules(Lights-qml Qml Gui)
16+target_link_libraries(Lights-qml ${ANDROID_HARDWARE_LIBRARIES})
17+
18+add_unity8_plugin(Lights 0.1 Lights TARGETS Lights-qml)
plugins/Lights/Lights.cppnew file+182
@@ -0,0 +1,182 @@
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 <hardware/hardware.h>
24+#include <hardware/lights.h>
25+#include <string.h>
26+}
27+
28+Lights::Lights(QObject* parent)
29+ : QObject(parent),
30+ m_lightDevice(0),
31+ m_color("blue"),
32+ m_state(Lights::Off),
33+ m_onMs(1000),
34+ m_offMs(3000)
35+{
36+}
37+
38+Lights::~Lights()
39+{
40+ if (m_lightDevice) {
41+ hw_device_t* device = (hw_device_t*) m_lightDevice;
42+ device->close(device);
43+ }
44+}
45+
46+void Lights::setState(Lights::State newState)
47+{
48+ if (m_state != newState) {
49+ if (newState == Lights::On) {
50+ turnOn();
51+ } else {
52+ turnOff();
53+ }
54+ }
55+}
56+
57+Lights::State Lights::state() const
58+{
59+ return m_state;
60+}
61+
62+void Lights::setColor(const QColor &color)
63+{
64+ if (m_color != color) {
65+ m_color = color;
66+ Q_EMIT colorChanged(m_color);
67+ // FIXME: update the collor if the light is already on
68+ }
69+}
70+
71+QColor Lights::color() const
72+{
73+ return m_color;
74+}
75+
76+int Lights::onMillisec() const
77+{
78+ return m_onMs;
79+}
80+
81+void Lights::setOnMillisec(int onMs)
82+{
83+ if (m_onMs != onMs) {
84+ m_onMs = onMs;
85+ Q_EMIT onMillisecChanged(m_onMs);
86+ // FIXME: update the property if the light is already on
87+ }
88+}
89+
90+int Lights::offMillisec() const
91+{
92+ return m_offMs;
93+}
94+
95+void Lights::setOffMillisec(int offMs)
96+{
97+ if (m_offMs != offMs) {
98+ m_offMs = offMs;
99+ Q_EMIT offMillisecChanged(m_offMs);
100+ // FIXME: update the property if the light is already on
101+ }
102+}
103+
104+bool Lights::init()
105+{
106+ if (m_lightDevice) {
107+ return true;
108+ }
109+
110+ int err;
111+ hw_module_t* module;
112+
113+ err = hw_get_module(LIGHTS_HARDWARE_MODULE_ID, (hw_module_t const**)&module);
114+ if (err == 0) {
115+ hw_device_t* device;
116+ err = module->methods->open(module, LIGHT_ID_NOTIFICATIONS, &device);
117+ if (err == 0) {
118+ m_lightDevice = (light_device_t*)device;
119+ return true;
120+ } else {
121+ qWarning() << "Failed to access notification lights";
122+ }
123+ } else {
124+ qWarning() << "Failed to initialize lights hardware.";
125+ }
126+ return false;
127+}
128+
129+void Lights::turnOn()
130+{
131+ if (!init()) {
132+ qWarning() << "No lights device";
133+ return;
134+ }
135+
136+ if (m_state == Lights::On) {
137+ return;
138+ }
139+
140+ // pulse
141+ light_state_t state;
142+ memset(&state, 0, sizeof(light_state_t));
143+ state.color = m_color.rgba();
144+ state.flashMode = LIGHT_FLASH_TIMED;
145+ state.flashOnMS = m_onMs;
146+ state.flashOffMS = m_offMs;
147+ state.brightnessMode = BRIGHTNESS_MODE_USER;
148+
149+ if (m_lightDevice->set_light(m_lightDevice, &state) != 0) {
150+ qWarning() << "Failed to turn the light off";
151+ } else {
152+ m_state = Lights::On;
153+ Q_EMIT stateChanged(m_state);
154+ }
155+}
156+
157+void Lights::turnOff()
158+{
159+ if (!init()) {
160+ qWarning() << "No lights device";
161+ return;
162+ }
163+
164+ if (m_state == Lights::Off) {
165+ return;
166+ }
167+
168+ light_state_t state;
169+ memset(&state, 0, sizeof(light_state_t));
170+ state.color = 0x00000000;
171+ state.flashMode = LIGHT_FLASH_NONE;
172+ state.flashOnMS = 0;
173+ state.flashOffMS = 0;
174+ state.brightnessMode = 0;
175+
176+ if (m_lightDevice->set_light(m_lightDevice, &state) != 0) {
177+ qWarning() << "Failed to turn the light off";
178+ } else {
179+ m_state = Lights::Off;
180+ Q_EMIT stateChanged(m_state);
181+ }
182+}
plugins/Lights/Lights.hnew file+75
@@ -0,0 +1,75 @@
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_ENUMS(State)
31+ Q_PROPERTY(State state READ state WRITE setState NOTIFY stateChanged)
32+ Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged)
33+ Q_PROPERTY(int onMillisec READ onMillisec WRITE setOnMillisec NOTIFY onMillisecChanged)
34+ Q_PROPERTY(int offMillisec READ offMillisec WRITE setOffMillisec NOTIFY offMillisecChanged)
35+
36+public:
37+ enum State {
38+ Off,
39+ On,
40+ };
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/plugin.cppnew file+35
@@ -0,0 +1,35 @@
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.hnew file+34
@@ -0,0 +1,34 @@
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);
32+};
33+
34+#endif
plugins/Lights/qmldirnew file+3
@@ -0,0 +1,3 @@
1+module Lights
2+plugin Lights-qml
3+typeinfo Lights.qmltypes
plugins/Ubuntu/CMakeLists.txt+1
@@ -1,2 +1,3 @@
1add_subdirectory(Gestures)
1add_subdirectory(Gestures)
2add_subdirectory(DownloadDaemonListener)
2add_subdirectory(DownloadDaemonListener)
3+add_subdirectory(Payments)
plugins/Ubuntu/Payments/CMakeLists.txtnew file+20
@@ -0,0 +1,20 @@
1+include_directories(
2+ ${CMAKE_CURRENT_SOURCE_DIR}
3+ ${CMAKE_CURRENT_BINARY_DIR}
4+)
5+
6+set(PAYMENTS_SOURCES
7+ plugin.cpp
8+ Payments.cpp
9+)
10+
11+add_library(Payments MODULE ${PAYMENTS_SOURCES})
12+
13+qt5_use_modules(Payments Qml Quick DBus Core)
14+
15+add_unity8_plugin(Ubuntu.Payments 0.1 Ubuntu/Payments TARGETS Payments)
16+
17+pkg_check_modules(LIBPAY REQUIRED pay-1)
18+add_definitions(${LIBPAY_CFLAGS} ${LIBPAY_CFLAGS_OTHER})
19+
20+target_link_libraries(Payments ${LIBPAY_LDFLAGS})
plugins/Ubuntu/Payments/Payments.cppnew file+118
@@ -0,0 +1,118 @@
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+#include "Payments.h"
18+
19+#include <QLocale>
20+
21+#include <libpay/pay-package.h>
22+
23+
24+// The observer callback for the package we are watching.
25+static void observer(PayPackage* /* package */, const char* itemid, PayPackageItemStatus status, void* user_data) {
26+ // This function is called in libpay's thread, so be careful what you call
27+ // Emitting signals should be fine as long as they use Queued or Auto
28+ // connections (the default)
29+ // http://qt-project.org/doc/qt-5/threads-qobject.html#signals-and-slots-across-threads
30+
31+ Payments *self = static_cast<Payments*>(user_data);
32+
33+ // If the item ID is different, ignore it.
34+ if (itemid != self->storeItemId()) {
35+ return;
36+ }
37+
38+ // FIXME: No error reporting from libpay, but we need to show some
39+ // types of errors to the user. https://launchpad.net/bugs/1333403
40+ switch (status) {
41+ case PAY_PACKAGE_ITEM_STATUS_PURCHASED:
42+ Q_EMIT self->purchaseCompleted();
43+ break;
44+ default:
45+ break;
46+ }
47+}
48+
49+Payments::Payments(QObject *parent)
50+ : QObject(parent)
51+{
52+ m_package = pay_package_new("click-scope");
53+ pay_package_item_observer_install(m_package, observer, this);
54+}
55+
56+Payments::~Payments()
57+{
58+ pay_package_item_observer_uninstall(m_package, observer, this);
59+ pay_package_delete(m_package);
60+}
61+
62+QString Payments::currency() const
63+{
64+ return m_currency;
65+}
66+
67+double Payments::price() const
68+{
69+ return m_price;
70+}
71+
72+QString Payments::storeItemId() const
73+{
74+ return m_store_item_id;
75+}
76+
77+QString Payments::formattedPrice() const
78+{
79+ QLocale locale;
80+ return locale.toCurrencyString(m_price, m_currency);
81+}
82+
83+void Payments::setCurrency(const QString &currency)
84+{
85+ if(m_currency != currency) {
86+ m_currency = currency;
87+ Q_EMIT currencyChanged(currency);
88+ Q_EMIT formattedPriceChanged(formattedPrice());
89+ }
90+}
91+
92+void Payments::setPrice(const double price)
93+{
94+ if(m_price != price) {
95+ m_price = price;
96+ Q_EMIT priceChanged(price);
97+ Q_EMIT formattedPriceChanged(formattedPrice());
98+ }
99+}
100+
101+void Payments::setStoreItemId(const QString &store_item_id)
102+{
103+ if (m_store_item_id != store_item_id) {
104+ m_store_item_id = store_item_id;
105+ Q_EMIT storeItemIdChanged(m_store_item_id);
106+ }
107+
108+ if (m_store_item_id.isEmpty()) {
109+ return;
110+ }
111+
112+ pay_package_item_start_verification(m_package, m_store_item_id.toLocal8Bit().data());
113+}
114+
115+void Payments::start()
116+{
117+ pay_package_item_start_purchase(m_package, m_store_item_id.toLocal8Bit().data());
118+}
plugins/Ubuntu/Payments/Payments.hnew file+65
@@ -0,0 +1,65 @@
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+#ifndef PAYMENTS_H
18+#define PAYMENTS_H
19+
20+#include <QObject>
21+
22+#include <libpay/pay-package.h>
23+
24+
25+class Payments : public QObject
26+{
27+ Q_OBJECT
28+ Q_DISABLE_COPY(Payments)
29+ Q_PROPERTY(QString currency READ currency WRITE setCurrency NOTIFY currencyChanged)
30+ Q_PROPERTY(double price READ price WRITE setPrice NOTIFY priceChanged)
31+ Q_PROPERTY(QString storeItemId READ storeItemId WRITE setStoreItemId NOTIFY storeItemIdChanged)
32+ Q_PROPERTY(QString formattedPrice READ formattedPrice NOTIFY formattedPriceChanged)
33+
34+public:
35+ explicit Payments(QObject *parent = 0);
36+ virtual ~Payments();
37+
38+ QString currency() const;
39+ double price() const;
40+ QString storeItemId() const;
41+ QString formattedPrice() const;
42+
43+ void setCurrency(const QString& currency);
44+ void setPrice(const double price);
45+ void setStoreItemId(const QString& store_item_id);
46+ Q_INVOKABLE void start();
47+
48+Q_SIGNALS:
49+ void currencyChanged(const QString& currency);
50+ void priceChanged(const double price);
51+ void storeItemIdChanged(const QString &store_item_id);
52+ void formattedPriceChanged(const QString &formatted_price);
53+
54+ void purchaseError(const QString &error);
55+ void purchaseCompleted();
56+
57+private:
58+ QString m_currency;
59+ double m_price;
60+ QString m_store_item_id;
61+
62+ PayPackage *m_package;
63+};
64+
65+#endif // PAYMENTS_H
plugins/Ubuntu/Payments/Payments.qmltypesnew file+42
@@ -0,0 +1,42 @@
1+import QtQuick.tooling 1.1
2+
3+// This file describes the plugin-supplied types contained in the library.
4+// It is used for QML tooling purposes only.
5+//
6+// This file was auto-generated by:
7+// 'qmlplugindump -notrelocatable Ubuntu.Payments 0.1 plugins'
8+
9+Module {
10+ Component {
11+ name: "Payments"
12+ prototype: "QObject"
13+ exports: ["Ubuntu.Payments/Payments 0.1"]
14+ exportMetaObjectRevisions: [0]
15+ Property { name: "currency"; type: "string" }
16+ Property { name: "price"; type: "double" }
17+ Property { name: "storeItemId"; type: "string" }
18+ Property { name: "formattedPrice"; type: "string"; isReadonly: true }
19+ Signal {
20+ name: "currencyChanged"
21+ Parameter { name: "currency"; type: "string" }
22+ }
23+ Signal {
24+ name: "priceChanged"
25+ Parameter { name: "price"; type: "double" }
26+ }
27+ Signal {
28+ name: "storeItemIdChanged"
29+ Parameter { name: "store_item_id"; type: "string" }
30+ }
31+ Signal {
32+ name: "formattedPriceChanged"
33+ Parameter { name: "formatted_price"; type: "string" }
34+ }
35+ Signal {
36+ name: "purchaseError"
37+ Parameter { name: "error"; type: "string" }
38+ }
39+ Signal { name: "purchaseCompleted" }
40+ Method { name: "start" }
41+ }
42+}
plugins/Ubuntu/Payments/plugin.cppnew file+28
@@ -0,0 +1,28 @@
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+#include "plugin.h"
18+#include "Payments.h"
19+
20+#include <QtQml>
21+
22+
23+void BackendPlugin::registerTypes(const char *uri)
24+{
25+ Q_ASSERT(uri == QLatin1String("Ubuntu.Payments"));
26+
27+ qmlRegisterType<Payments>(uri, 0, 1, "Payments");
28+}
plugins/Ubuntu/Payments/plugin.hnew file+31
@@ -0,0 +1,31 @@
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+#ifndef PAYMENTS_PLUGIN_H
18+#define PAYMENTS_PLUGIN_H
19+
20+#include <QQmlExtensionPlugin>
21+
22+class BackendPlugin : public QQmlExtensionPlugin
23+{
24+ Q_OBJECT
25+ Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
26+
27+public:
28+ void registerTypes(const char *uri);
29+};
30+
31+#endif // PAYMENTS_PLUGIN_H
plugins/Ubuntu/Payments/qmldirnew file+3
@@ -0,0 +1,3 @@
1+module Ubuntu.Payments
2+plugin Payments
3+typeinfo Payments.qmltypes
plugins/Unity/Launcher/launcheritem.cpp+2−2
@@ -40,7 +40,7 @@ LauncherItem::LauncherItem(const QString &appId, const QString &name, const QStr
40 m_quickList->appendAction(nameAction);
40 m_quickList->appendAction(nameAction);
41 QuickListEntry pinningAction;
41 QuickListEntry pinningAction;
42 pinningAction.setActionId("pin_item");
42 pinningAction.setActionId("pin_item");
43− pinningAction.setText(gettext("Lock to Launcher"));
43+ pinningAction.setText(gettext("Pin shortcut"));
44 m_quickList->appendAction(pinningAction);
44 m_quickList->appendAction(pinningAction);
45}
45}
46
46
@@ -70,7 +70,7 @@ void LauncherItem::setPinned(bool pinned)
70 m_pinned = pinned;
70 m_pinned = pinned;
71 QuickListEntry entry;
71 QuickListEntry entry;
72 entry.setActionId("pin_item");
72 entry.setActionId("pin_item");
73− entry.setText(pinned ? gettext("Unlock from Launcher") : gettext("Lock to Launcher"));
73+ entry.setText(pinned ? gettext("Unpin shortcut") : gettext("Pin shortcut"));
74 m_quickList->updateAction(entry);
74 m_quickList->updateAction(entry);
75 Q_EMIT pinnedChanged(pinned);
75 Q_EMIT pinnedChanged(pinned);
76 }
76 }
plugins/Utils/easingcurve.cpp+3−1
@@ -20,7 +20,9 @@
20
20
21
21
22EasingCurve::EasingCurve(QObject *parent):
22EasingCurve::EasingCurve(QObject *parent):
23− QObject(parent)
23+ QObject(parent),
24+ m_progress(0),
25+ m_value(0)
24{
26{
25
27
26}
28}
po/ast.po+11−11
@@ -8,14 +8,14 @@ msgstr ""
8"Project-Id-Version: unity8\n"
8"Project-Id-Version: unity8\n"
9"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
9"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
10"POT-Creation-Date: 2014-06-13 09:55+0200\n"
10"POT-Creation-Date: 2014-06-13 09:55+0200\n"
11−"PO-Revision-Date: 2014-04-04 02:16+0000\n"
11+"PO-Revision-Date: 2014-07-04 15:29+0000\n"
12−"Last-Translator: Xuacu Saturio <xuacusk8@gmail.com>\n"
12+"Last-Translator: ivarela <ivarela@ubuntu.com>\n"
13"Language-Team: Asturian <ast@li.org>\n"
13"Language-Team: Asturian <ast@li.org>\n"
14"MIME-Version: 1.0\n"
14"MIME-Version: 1.0\n"
15"Content-Type: text/plain; charset=UTF-8\n"
15"Content-Type: text/plain; charset=UTF-8\n"
16"Content-Transfer-Encoding: 8bit\n"
16"Content-Transfer-Encoding: 8bit\n"
17−"X-Launchpad-Export-Date: 2014-06-17 06:51+0000\n"
17+"X-Launchpad-Export-Date: 2014-07-05 05:59+0000\n"
18−"X-Generator: Launchpad (build 17045)\n"
18+"X-Generator: Launchpad (build 17086)\n"
19
19
20#: plugins/Unity/Launcher/launcheritem.cpp:43
20#: plugins/Unity/Launcher/launcheritem.cpp:43
21#: plugins/Unity/Launcher/launcheritem.cpp:73
21#: plugins/Unity/Launcher/launcheritem.cpp:73
@@ -73,8 +73,8 @@ msgid ""
73"You have now mastered the edge gestures and can start using the "
73"You have now mastered the edge gestures and can start using the "
74"phone<br><br>Tap on the screen to start"
74"phone<br><br>Tap on the screen to start"
75msgstr ""
75msgstr ""
76−"Agora domina los xestos de los bordes y pue principiar a usar el "
76+"Agora yá domines los xestos de los berbesos y pues entamar a usar el "
77−"teléfonu<br><br>Toque la pantalla pa comenzar"
77+"teléfonu<br><br>Toca la pantalla pa comenzar"
78
78
79#: qml/Components/Lockscreen.qml:214
79#: qml/Components/Lockscreen.qml:214
80msgid "Emergency Call"
80msgid "Emergency Call"
@@ -82,7 +82,7 @@ msgstr "Llamada d'emerxencia"
82
82
83#: qml/Components/Lockscreen.qml:231
83#: qml/Components/Lockscreen.qml:231
84msgid "OK"
84msgid "OK"
85−msgstr ""
85+msgstr "Aceutar"
86
86
87#: qml/Components/PageHeader.qml:365
87#: qml/Components/PageHeader.qml:365
88msgid "Recent searches"
88msgid "Recent searches"
@@ -99,11 +99,11 @@ msgstr "Hola"
99
99
100#: qml/Components/PinLockscreen.qml:198
100#: qml/Components/PinLockscreen.qml:198
101msgid "CANCEL"
101msgid "CANCEL"
102−msgstr ""
102+msgstr "ENCABOXAR"
103
103
104#: qml/Components/PinLockscreen.qml:216
104#: qml/Components/PinLockscreen.qml:216
105msgid "DONE"
105msgid "DONE"
106−msgstr ""
106+msgstr "FECHO"
107
107
108#: qml/Components/SeeMore.qml:35
108#: qml/Components/SeeMore.qml:35
109msgid "See more"
109msgid "See more"
@@ -139,7 +139,7 @@ msgstr "Unviar"
139
139
140#: qml/Greeter/Greeter.qml:157
140#: qml/Greeter/Greeter.qml:157
141msgid "Swipe to unlock"
141msgid "Swipe to unlock"
142−msgstr ""
142+msgstr "Esliza pa desbloquiar"
143
143
144#: qml/Hud/HudParametrizedActionsPage.qml:132
144#: qml/Hud/HudParametrizedActionsPage.qml:132
145msgid "Confirm"
145msgid "Confirm"
@@ -167,7 +167,7 @@ msgstr "Amosar contraseña"
167
167
168#: qml/Notifications/NotificationMenuItemFactory.qml:103
168#: qml/Notifications/NotificationMenuItemFactory.qml:103
169msgid "Please enter SIM PIN"
169msgid "Please enter SIM PIN"
170−msgstr "Escriba'l PIN de la SIM"
170+msgstr "Escribi'l PIN de la SIM"
171
171
172#: qml/Panel/SearchIndicator.qml:27
172#: qml/Panel/SearchIndicator.qml:27
173msgid "Search"
173msgid "Search"
po/gl.po+10−8
@@ -8,14 +8,14 @@ msgstr ""
8"Project-Id-Version: unity\n"
8"Project-Id-Version: unity\n"
9"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
9"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
10"POT-Creation-Date: 2014-06-13 09:55+0200\n"
10"POT-Creation-Date: 2014-06-13 09:55+0200\n"
11−"PO-Revision-Date: 2014-06-07 13:26+0000\n"
11+"PO-Revision-Date: 2014-07-06 15:53+0000\n"
12"Last-Translator: Marcos Lans <Unknown>\n"
12"Last-Translator: Marcos Lans <Unknown>\n"
13"Language-Team: Galician <gl@li.org>\n"
13"Language-Team: Galician <gl@li.org>\n"
14"MIME-Version: 1.0\n"
14"MIME-Version: 1.0\n"
15"Content-Type: text/plain; charset=UTF-8\n"
15"Content-Type: text/plain; charset=UTF-8\n"
16"Content-Transfer-Encoding: 8bit\n"
16"Content-Transfer-Encoding: 8bit\n"
17−"X-Launchpad-Export-Date: 2014-06-17 06:51+0000\n"
17+"X-Launchpad-Export-Date: 2014-07-07 06:08+0000\n"
18−"X-Generator: Launchpad (build 17045)\n"
18+"X-Generator: Launchpad (build 17086)\n"
19
19
20#: plugins/Unity/Launcher/launcheritem.cpp:43
20#: plugins/Unity/Launcher/launcheritem.cpp:43
21#: plugins/Unity/Launcher/launcheritem.cpp:73
21#: plugins/Unity/Launcher/launcheritem.cpp:73
@@ -36,7 +36,7 @@ msgstr "Bordo dereito"
36
36
37#: qml/Components/EdgeDemo.qml:114
37#: qml/Components/EdgeDemo.qml:114
38msgid "Try swiping from the right edge to unlock the phone"
38msgid "Try swiping from the right edge to unlock the phone"
39−msgstr "Probe a esvarar desde o bordo dereito para desbloquear o teléfono"
39+msgstr "Esvare o dedo desde o bordo dereito para desbloquear o teléfono"
40
40
41#: qml/Components/EdgeDemo.qml:145
41#: qml/Components/EdgeDemo.qml:145
42msgid "Top edge"
42msgid "Top edge"
@@ -44,7 +44,7 @@ msgstr "Bordo superior"
44
44
45#: qml/Components/EdgeDemo.qml:146
45#: qml/Components/EdgeDemo.qml:146
46msgid "Try swiping from the top edge to access the indicators"
46msgid "Try swiping from the top edge to access the indicators"
47−msgstr "Esvare desde o bordo superior para acceder aos indicadores."
47+msgstr "Esvare o dedo desde o bordo superior para acceder aos indicadores."
48
48
49#: qml/Components/EdgeDemo.qml:171
49#: qml/Components/EdgeDemo.qml:171
50msgid "Close"
50msgid "Close"
@@ -52,7 +52,7 @@ msgstr "Pechar"
52
52
53#: qml/Components/EdgeDemo.qml:172
53#: qml/Components/EdgeDemo.qml:172
54msgid "Swipe up again to close the settings screen"
54msgid "Swipe up again to close the settings screen"
55−msgstr "Esvare cara a arriba para pechar os axustes"
55+msgstr "Esvare o dedo cara a arriba para pechar os axustes"
56
56
57#: qml/Components/EdgeDemo.qml:199
57#: qml/Components/EdgeDemo.qml:199
58msgid "Left edge"
58msgid "Left edge"
@@ -60,7 +60,9 @@ msgstr "Bordo esquerdo"
60
60
61#: qml/Components/EdgeDemo.qml:200
61#: qml/Components/EdgeDemo.qml:200
62msgid "Swipe from the left to reveal the launcher for quick access to apps"
62msgid "Swipe from the left to reveal the launcher for quick access to apps"
63+msgstr ""
63−msgstr "Esvare desde a esquerda para mostrar o iniciador de acceso rápido"
64+"Esvare o dedo desde a esquerda para mostrar o iniciador rápido aos "
65+"aplicativos"
64
66
65#: qml/Components/EdgeDemo.qml:227
67#: qml/Components/EdgeDemo.qml:227
66msgid "Well done"
68msgid "Well done"
@@ -137,7 +139,7 @@ msgstr "Enviar"
137
139
138#: qml/Greeter/Greeter.qml:157
140#: qml/Greeter/Greeter.qml:157
139msgid "Swipe to unlock"
141msgid "Swipe to unlock"
140−msgstr "Esvare para desbloquear"
142+msgstr "Esvare o dedo para desbloquear"
141
143
142#: qml/Hud/HudParametrizedActionsPage.qml:132
144#: qml/Hud/HudParametrizedActionsPage.qml:132
143msgid "Confirm"
145msgid "Confirm"
qml/Dash/Previews/PreviewPayments.qmlnew file+56
@@ -0,0 +1,56 @@
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+import QtQuick 2.1
18+import Ubuntu.Components 0.1
19+import Ubuntu.Payments 0.1
20+
21+/*! \brief Preview widget for a purchase button.
22+ *
23+ * When clicked, this button starts the payments service.
24+ * Then it waits until the purchase finishes or fails.
25+ * Those events trigger the corresponding actions.
26+ */
27+
28+PreviewWidget {
29+ id: root
30+
31+ implicitHeight: paymentButton.implicitHeight
32+ implicitWidth: paymentButton.implicitWidth
33+
34+ Button {
35+ id: paymentButton
36+ objectName: "paymentButton"
37+
38+ color: Theme.palette.selected.foreground
39+ text: paymentClient.formattedPrice
40+ onClicked: paymentClient.start()
41+ anchors.right: parent.right
42+ width: (root.width - units.gu(1)) / 2
43+
44+ Payments {
45+ id: paymentClient
46+
47+ property var source: widgetData["source"]
48+
49+ price: source["price"]
50+ currency: source["currency"]
51+ storeItemId: source["store_item_id"]
52+ onPurchaseCompleted: root.triggered(widgetId, "purchaseCompleted", source)
53+ onPurchaseError: root.triggered(widgetId, "purchaseError", source)
54+ }
55+ }
56+}
qml/Dash/Previews/PreviewWidgetFactory.qml+1
@@ -48,6 +48,7 @@ Loader {
48 case "header": return "PreviewHeader.qml";
48 case "header": return "PreviewHeader.qml";
49 case "image": return "PreviewZoomableImage.qml";
49 case "image": return "PreviewZoomableImage.qml";
50 case "progress": return "PreviewProgress.qml";
50 case "progress": return "PreviewProgress.qml";
51+ case "payments": return "PreviewPayments.qml";
51 case "rating-input": return "PreviewRatingInput.qml";
52 case "rating-input": return "PreviewRatingInput.qml";
52 case "reviews": return "PreviewRatingDisplay.qml";
53 case "reviews": return "PreviewRatingDisplay.qml";
53 case "text": return "PreviewTextSummary.qml";
54 case "text": return "PreviewTextSummary.qml";
qml/Launcher/LauncherDelegate.qml+1
@@ -63,6 +63,7 @@ Item {
63 id: iconImage
63 id: iconImage
64 sourceSize.width: iconShape.width
64 sourceSize.width: iconShape.width
65 sourceSize.height: iconShape.height
65 sourceSize.height: iconShape.height
66+ fillMode: Image.PreserveAspectCrop
66 source: root.iconName
67 source: root.iconName
67 }
68 }
68 }
69 }
qml/Launcher/LauncherPanel.qml−1
@@ -104,7 +104,6 @@ Item {
104 highlightRangeMode: ListView.ApplyRange
104 highlightRangeMode: ListView.ApplyRange
105 preferredHighlightBegin: (height - itemHeight) / 2
105 preferredHighlightBegin: (height - itemHeight) / 2
106 preferredHighlightEnd: (height + itemHeight) / 2
106 preferredHighlightEnd: (height + itemHeight) / 2
107− spacing: units.gu(0.5)
108
107
109 // The size of the area the ListView is extended to make sure items are not
108 // The size of the area the ListView is extended to make sure items are not
110 // destroyed when dragging them outside the list. This needs to be at least
109 // destroyed when dragging them outside the list. This needs to be at least
qml/Panel/Indicators/DefaultIndicatorWidget.qml+21−29
@@ -19,11 +19,12 @@
19
19
20import QtQuick 2.0
20import QtQuick 2.0
21import Ubuntu.Components 0.1
21import Ubuntu.Components 0.1
22+import Ubuntu.Settings.Components 0.1
22
23
23IndicatorBase {
24IndicatorBase {
24 id: indicatorWidget
25 id: indicatorWidget
25
26
26− property int iconSize: height
27+ property int iconSize: units.gu(2)
27 property alias leftLabel: itemLeftLabel.text
28 property alias leftLabel: itemLeftLabel.text
28 property alias rightLabel: itemRightLabel.text
29 property alias rightLabel: itemRightLabel.text
29 property var icons: undefined
30 property var icons: undefined
@@ -31,9 +32,16 @@ IndicatorBase {
31 width: itemRow.width
32 width: itemRow.width
32 enabled: false
33 enabled: false
33
34
35+ // FIXME: For now we will enable led indicator support only for messaging indicator
36+ // in the future we should export a led API insted of doing that,
37+ Loader {
38+ id: indicatorLed
39+ // only load source Component if the icons contains the new message icon
40+ source: (indicatorWidget.icons && (String(indicatorWidget.icons).indexOf("indicator-messages-new") != -1)) ? Qt.resolvedUrl("IndicatorsLight.qml") : ""
41+ }
42+
34 Row {
43 Row {
35 id: itemRow
44 id: itemRow
36− width: childrenRect.width
37 objectName: "itemRow"
45 objectName: "itemRow"
38 anchors {
46 anchors {
39 top: parent.top
47 top: parent.top
@@ -43,7 +51,7 @@ IndicatorBase {
43
51
44 Label {
52 Label {
45 id: itemLeftLabel
53 id: itemLeftLabel
46− width: guRoundUp(implicitWidth)
54+ width: contentWidth + units.gu(1)
47 objectName: "leftLabel"
55 objectName: "leftLabel"
48 color: Theme.palette.selected.backgroundText
56 color: Theme.palette.selected.backgroundText
49 opacity: 0.8
57 opacity: 0.8
@@ -51,10 +59,10 @@ IndicatorBase {
51 fontSize: "medium"
59 fontSize: "medium"
52 anchors.verticalCenter: parent.verticalCenter
60 anchors.verticalCenter: parent.verticalCenter
53 visible: text != ""
61 visible: text != ""
62+ horizontalAlignment: Text.AlignHCenter
54 }
63 }
55
64
56 Row {
65 Row {
57− width: childrenRect.width
58 anchors {
66 anchors {
59 top: parent.top
67 top: parent.top
60 bottom: parent.bottom
68 bottom: parent.bottom
@@ -64,22 +72,16 @@ IndicatorBase {
64 model: indicatorWidget.icons
72 model: indicatorWidget.icons
65
73
66 Item {
74 Item {
67− width: guRoundUp(itemImage.width)
75+ width: itemImage.width + units.gu(1)
68− height: indicatorWidget.iconSize
76+ anchors { top: parent.top; bottom: parent.bottom }
69
77
70− Image {
78+ StatusIcon {
71 id: itemImage
79 id: itemImage
72− objectName: "itemImage"
80+ height: indicatorWidget.iconSize
73− visible: source != ""
81+ anchors.centerIn: parent
74 source: modelData
82 source: modelData
75− height: parent.height
83+ sets: ["status", "actions"]
76− anchors.horizontalCenter: parent.horizontalCenter
84+ color: "#CCCCCC"
77− fillMode: Image.PreserveAspectFit
78−
79− sourceSize {
80− width: indicatorWidget.iconSize
81− height: indicatorWidget.iconSize
82− }
83 }
85 }
84 }
86 }
85 }
87 }
@@ -87,7 +89,7 @@ IndicatorBase {
87
89
88 Label {
90 Label {
89 id: itemRightLabel
91 id: itemRightLabel
90− width: guRoundUp(implicitWidth)
92+ width: contentWidth + units.gu(1)
91 objectName: "rightLabel"
93 objectName: "rightLabel"
92 color: Theme.palette.selected.backgroundText
94 color: Theme.palette.selected.backgroundText
93 opacity: 0.8
95 opacity: 0.8
@@ -95,20 +97,10 @@ IndicatorBase {
95 fontSize: "medium"
97 fontSize: "medium"
96 anchors.verticalCenter: parent.verticalCenter
98 anchors.verticalCenter: parent.verticalCenter
97 visible: text != ""
99 visible: text != ""
100+ horizontalAlignment: Text.AlignHCenter
98 }
101 }
99 }
102 }
100
103
101− // TODO: Use toolkit function https://bugs.launchpad.net/ubuntu-ui-toolkit/+bug/1242575
102− function guRoundUp(width) {
103− if (width == 0) {
104− return 0;
105− }
106− var gu1 = units.gu(1.0);
107− var mod = (width % gu1);
108−
109− return mod == 0 ? width : width + (gu1 - mod);
110− }
111−
112 onRootActionStateChanged: {
104 onRootActionStateChanged: {
113 if (rootActionState == undefined) {
105 if (rootActionState == undefined) {
114 leftLabel = "";
106 leftLabel = "";
qml/Panel/Indicators/IndicatorBase.qml+3−4
@@ -18,8 +18,7 @@
18 */
18 */
19
19
20import QtQuick 2.0
20import QtQuick 2.0
21−import QMenuModel 0.1 as QMenuModel
22−import Unity.Indicators 0.1 as Indicators
21+import Unity.Indicators 0.1
23
22
24Item {
23Item {
25 id: indicatorItem
24 id: indicatorItem
@@ -36,14 +35,14 @@ Item {
36
35
37 property alias menuModel: cachedModel.model
36 property alias menuModel: cachedModel.model
38
37
39− Indicators.CachedUnityMenuModel {
38+ CachedUnityMenuModel {
40 id: cachedModel
39 id: cachedModel
41 busName: indicatorItem.busName
40 busName: indicatorItem.busName
42 actionsObjectPath: indicatorItem.actionsObjectPath
41 actionsObjectPath: indicatorItem.actionsObjectPath
43 menuObjectPath: indicatorItem.deviceMenuObjectPath
42 menuObjectPath: indicatorItem.deviceMenuObjectPath
44 }
43 }
45
44
46− property var rootActionState: Indicators.RootActionState {
45+ property RootActionState rootActionState: RootActionState {
47 menu: menuModel
46 menu: menuModel
48 onUpdated: indicatorItem.rootActionStateChanged()
47 onUpdated: indicatorItem.rootActionStateChanged()
49 }
48 }
tests/mocks/Unity/Indicators/IndicatorBase.qml → qml/Panel/Indicators/IndicatorsLight.qmlrenamed+14−14
@@ -1,5 +1,5 @@
1/*
1/*
2− * Copyright 2013 Canonical Ltd.
2+ * Copyright 2014 Canonical Ltd.
3 *
3 *
4 * This program is free software; you can redistribute it and/or modify
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
5 * it under the terms of the GNU Lesser General Public License as published by
@@ -14,25 +14,25 @@
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
15 *
16 * Authors:
16 * Authors:
17− * Nick Dedekind <nick.dedekind@canonical.com>
17+ * Renato Araujo Oliveira Filho <renato@canonical.com>
18 */
18 */
19
19
20import QtQuick 2.0
20import QtQuick 2.0
21−import QMenuModel 0.1
21+import Powerd 0.1
22+import Lights 0.1
22
23
23−Item {
24+QtObject {
24− id: indicatorBase
25+ id: root
25
26
26− //const
27+ Component.onDestruction: Lights.state = Lights.Off
27− property string busName
28− property string actionsObjectPath
29− property string menuObjectPath
30− property string rootMenuType: "com.canonical.indicator.root"
31− property string deviceMenuObjectPath: menuObjectPath
32
28
33− property var menuModel: UnityMenuModel {}
29+ // QtObject does not have children
30+ property var _connections: Connections {
31+ id: powerConnection
34
32
35− property RootActionState rootActionState: RootActionState {
33+ target: Powerd
36− onUpdated: indicatorBase.rootActionStateChanged()
34+ onDisplayPowerStateChange: {
35+ Lights.state = (status === Powerd.Off) ? Lights.On : Lights.Off
36+ }
37 }
37 }
38}
38}
qml/Panel/Indicators/MenuItemFactory.qml+1−1
@@ -165,7 +165,7 @@ Item {
165
165
166 Component {
166 Component {
167 id: standardMenu;
167 id: standardMenu;
168− ListItems.Standard {
168+ Menus.StandardMenu {
169 objectName: "standardMenu"
169 objectName: "standardMenu"
170 property QtObject menuData: null
170 property QtObject menuData: null
171 property int menuIndex: -1
171 property int menuIndex: -1
qml/Panel/Panel.qml+1−1
@@ -21,7 +21,7 @@ import "../Components"
21Item {
21Item {
22 id: root
22 id: root
23 readonly property real panelHeight: units.gu(3) + units.dp(2)
23 readonly property real panelHeight: units.gu(3) + units.dp(2)
24− property real indicatorsMenuWidth: (shell.width > units.gu(60)) ? units.gu(40) : shell.width
24+ property real indicatorsMenuWidth: width
25 property alias indicators: indicatorsMenu
25 property alias indicators: indicatorsMenu
26 property bool fullscreenMode: false
26 property bool fullscreenMode: false
27 property bool searchVisible: true
27 property bool searchVisible: true
run.sh−6
@@ -57,12 +57,6 @@ if $KEYLOCK; then
57 export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$PWD/builddir/tests/mocks/libusermetrics:$PWD/builddir/tests/mocks/LightDM/single-passphrase
57 export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$PWD/builddir/tests/mocks/libusermetrics:$PWD/builddir/tests/mocks/LightDM/single-passphrase
58fi
58fi
59
59
60−# Force icon theme if running on the desktop, otherwise gnome theme (if running
61−# on Ubuntu Desktop) will be used and icons won't be found
62−if [ -n "$DESKTOP_SESSION" ]; then
63− export UBUNTU_ICON_THEME=ubuntu-mobile
64−fi
65−
66QML_PHONE_SHELL_ARGS=""
60QML_PHONE_SHELL_ARGS=""
67if $MOUSE_TOUCH; then
61if $MOUSE_TOUCH; then
68 QML_PHONE_SHELL_ARGS="$QML_PHONE_SHELL_ARGS -mousetouch"
62 QML_PHONE_SHELL_ARGS="$QML_PHONE_SHELL_ARGS -mousetouch"
src/CMakeLists.txt+1
@@ -19,6 +19,7 @@ add_executable(${SHELL_APP}
19 ApplicationArguments.h
19 ApplicationArguments.h
20 main.cpp
20 main.cpp
21 MouseTouchAdaptor.cpp
21 MouseTouchAdaptor.cpp
22+ CachingNetworkManagerFactory.cpp
22 ${QML_FILES} # This is to make qml and image files appear in the IDE's project tree
23 ${QML_FILES} # This is to make qml and image files appear in the IDE's project tree
23)
24)
24
25
src/CachingNetworkManagerFactory.cppnew file+62
@@ -0,0 +1,62 @@
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 "CachingNetworkManagerFactory.h"
19+
20+#include <QNetworkDiskCache>
21+#include <QNetworkAccessManager>
22+#include <QStandardPaths>
23+#include <QNetworkConfigurationManager>
24+
25+CachingNetworkAccessManager::CachingNetworkAccessManager(QObject *parent)
26+ : QNetworkAccessManager(parent)
27+{
28+ m_networkManager = new QNetworkConfigurationManager(this);
29+
30+ QObject::connect(m_networkManager, &QNetworkConfigurationManager::onlineStateChanged, this, &CachingNetworkAccessManager::onlineStateChanged);
31+ m_isOnline = m_networkManager->isOnline();
32+}
33+
34+void CachingNetworkAccessManager::onlineStateChanged(bool isOnline)
35+{
36+ m_isOnline = isOnline;
37+}
38+
39+QNetworkReply* CachingNetworkAccessManager::createRequest(Operation op, const QNetworkRequest &request, QIODevice *outgoingData)
40+{
41+ if (!m_isOnline) {
42+ QNetworkRequest req(request);
43+ req.setAttribute(QNetworkRequest::CacheLoadControlAttribute, QNetworkRequest::AlwaysCache);
44+ return QNetworkAccessManager::createRequest(op, req, outgoingData);
45+ }
46+
47+ return QNetworkAccessManager::createRequest(op, request, outgoingData);
48+}
49+
50+CachingNetworkManagerFactory::CachingNetworkManagerFactory()
51+{
52+}
53+
54+QNetworkAccessManager *CachingNetworkManagerFactory::create(QObject *parent) {
55+ QNetworkAccessManager *manager = new CachingNetworkAccessManager(parent);
56+
57+ QNetworkDiskCache* cache = new QNetworkDiskCache(manager);
58+ cache->setCacheDirectory(QString("%1/network").arg(QStandardPaths::writableLocation(QStandardPaths::CacheLocation)));
59+
60+ manager->setCache(cache);
61+ return manager;
62+}
src/CachingNetworkManagerFactory.hnew file+50
@@ -0,0 +1,50 @@
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+#ifndef CACHINGNETWORKMANAGERFACTORY_H
19+#define CACHINGNETWORKMANAGERFACTORY_H
20+
21+#include <QQmlNetworkAccessManagerFactory>
22+#include <QNetworkAccessManager>
23+
24+class QNetworkConfigurationManager;
25+
26+class CachingNetworkAccessManager : public QNetworkAccessManager
27+{
28+public:
29+ CachingNetworkAccessManager(QObject *parent = 0);
30+
31+protected:
32+ QNetworkReply* createRequest(Operation op, const QNetworkRequest &req, QIODevice *outgoingData = 0) override;
33+
34+private Q_SLOTS:
35+ void onlineStateChanged(bool isOnline);
36+
37+private:
38+ QNetworkConfigurationManager* m_networkManager;
39+ bool m_isOnline;
40+};
41+
42+class CachingNetworkManagerFactory : public QQmlNetworkAccessManagerFactory
43+{
44+public:
45+ CachingNetworkManagerFactory();
46+
47+ QNetworkAccessManager *create(QObject *parent) override;
48+};
49+
50+#endif // CACHINGNETWORKMANAGERFACTORY_H
src/Panel/Indicators/client/indicatorsclient.cpp−1
@@ -32,7 +32,6 @@ IndicatorsClient::IndicatorsClient(int &argc, char **argv)
32 m_view(0)
32 m_view(0)
33{
33{
34 m_application = new QApplication(argc, argv);
34 m_application = new QApplication(argc, argv);
35− resolveIconTheme();
36
35
37 QStringList args = m_application->arguments();
36 QStringList args = m_application->arguments();
38
37
src/main.cpp+5−4
@@ -34,15 +34,15 @@
34#include <paths.h>
34#include <paths.h>
35#include "MouseTouchAdaptor.h"
35#include "MouseTouchAdaptor.h"
36#include "ApplicationArguments.h"
36#include "ApplicationArguments.h"
37+#include "CachingNetworkManagerFactory.h"
37
38
38#include <unity-mir/qmirserver.h>
39#include <unity-mir/qmirserver.h>
39
40
40−
41int startShell(int argc, const char** argv, void* server)
41int startShell(int argc, const char** argv, void* server)
42{
42{
43 const bool isUbuntuMirServer = qgetenv("QT_QPA_PLATFORM") == "ubuntumirserver";
43 const bool isUbuntuMirServer = qgetenv("QT_QPA_PLATFORM") == "ubuntumirserver";
44
44
45− QGuiApplication::setApplicationName("Unity 8");
45+ QGuiApplication::setApplicationName("unity8");
46 QGuiApplication *application;
46 QGuiApplication *application;
47
47
48 QCommandLineParser parser;
48 QCommandLineParser parser;
@@ -96,8 +96,6 @@ Load the testability driver");
96 indicatorProfile = "phone";
96 indicatorProfile = "phone";
97 }
97 }
98
98
99− resolveIconTheme();
100−
101 ApplicationArguments qmlArgs;
99 ApplicationArguments qmlArgs;
102 if (parser.isSet(windowGeometryOption) &&
100 if (parser.isSet(windowGeometryOption) &&
103 parser.value(windowGeometryOption).split('x').size() == 2)
101 parser.value(windowGeometryOption).split('x').size() == 2)
@@ -159,6 +157,9 @@ Load the testability driver");
159 }
157 }
160 appendImportPaths(view->engine(), ::fallbackImportPaths());
158 appendImportPaths(view->engine(), ::fallbackImportPaths());
161
159
160+ CachingNetworkManagerFactory *managerFactory = new CachingNetworkManagerFactory();
161+ view->engine()->setNetworkAccessManagerFactory(managerFactory);
162+
162 view->setSource(source);
163 view->setSource(source);
163 view->setColor("transparent");
164 view->setColor("transparent");
164 QObject::connect(view->engine(), SIGNAL(quit()), application, SLOT(quit()));
165 QObject::connect(view->engine(), SIGNAL(quit()), application, SLOT(quit()));
tests/autopilot/unity8/process_helpers.py+4−3
@@ -75,7 +75,7 @@ def unlock_unity(unity_proxy_obj=None):
75 main_window_emulator.QQuickView)
75 main_window_emulator.QQuickView)
76
76
77 greeter = main_window.get_greeter()
77 greeter = main_window.get_greeter()
78− if greeter.created == False:
78+ if greeter.created is False:
79 raise RuntimeWarning("Greeter appears to be already unlocked.")
79 raise RuntimeWarning("Greeter appears to be already unlocked.")
80
80
81 # Because of potential input jerkiness under heavy load,
81 # Because of potential input jerkiness under heavy load,
@@ -98,7 +98,8 @@ def unlock_unity(unity_proxy_obj=None):
98
98
99def lock_unity(unity_proxy_obj=None):
99def lock_unity(unity_proxy_obj=None):
100 """Helper function that attempts to lock the unity greeter."""
100 """Helper function that attempts to lock the unity greeter."""
101− import evdev, time
101+ import evdev
102+ import time
102 uinput = evdev.UInput(name='unity8-autopilot-power-button',
103 uinput = evdev.UInput(name='unity8-autopilot-power-button',
103 devnode='/dev/autopilot-uinput')
104 devnode='/dev/autopilot-uinput')
104 # One press and release to turn screen off (locking unity)
105 # One press and release to turn screen off (locking unity)
@@ -172,7 +173,7 @@ def _get_unity_status():
172
173
173def _get_unity_pid():
174def _get_unity_pid():
174 status = _get_unity_status()
175 status = _get_unity_status()
175− if not "start/" in status:
176+ if "start/" not in status:
176 raise CannotAccessUnity("Unity is not in the running state.")
177 raise CannotAccessUnity("Unity is not in the running state.")
177 return int(status.split()[-1])
178 return int(status.split()[-1])
178
179
tests/autopilot/unity8/shell/tests/__init__.py+1−2
@@ -142,12 +142,11 @@ class UnityTestCase(AutopilotTestCase):
142 self._data_dirs_mock_enabled = True
142 self._data_dirs_mock_enabled = True
143 self._environment = {}
143 self._environment = {}
144
144
145− #### FIXME: This is a work around re: lp:1238417 ####
145+ # FIXME: This is a work around re: lp:1238417
146 if model() != "Desktop":
146 if model() != "Desktop":
147 from autopilot.input import _uinput
147 from autopilot.input import _uinput
148 _uinput._touch_device = _uinput.create_touch_device()
148 _uinput._touch_device = _uinput.create_touch_device()
149 self.addCleanup(_uinput._touch_device.close)
149 self.addCleanup(_uinput._touch_device.close)
150− ####
151
150
152 self.touch = Touch.create()
151 self.touch = Touch.create()
153 self._setup_display_details()
152 self._setup_display_details()
tests/autopilot/unity8/shell/tests/disabled_test_hud.py+44−13
@@ -20,12 +20,13 @@
20from __future__ import absolute_import
20from __future__ import absolute_import
21
21
22from unity8.process_helpers import unlock_unity
22from unity8.process_helpers import unlock_unity
23−from unity8.shell import with_lightdm_mock, DragMixin
23+from unity8.shell import DragMixin
24from unity8.shell.tests import UnityTestCase, _get_device_emulation_scenarios
24from unity8.shell.tests import UnityTestCase, _get_device_emulation_scenarios
25
25
26from testtools.matchers import Equals
26from testtools.matchers import Equals
27from autopilot.matchers import Eventually
27from autopilot.matchers import Eventually
28
28
29+
29class TestHud(UnityTestCase, DragMixin):
30class TestHud(UnityTestCase, DragMixin):
30
31
31 """Tests the Shell HUD."""
32 """Tests the Shell HUD."""
@@ -33,10 +34,14 @@ class TestHud(UnityTestCase, DragMixin):
33 scenarios = _get_device_emulation_scenarios()
34 scenarios = _get_device_emulation_scenarios()
34
35
35 def test_show_hud_button_appears(self):
36 def test_show_hud_button_appears(self):
36− """Swiping up while an app is active must show the 'show hud' button, following some behaviours.
37+ """Swiping up while an app is active must show the 'show hud' button.
38+
39+ It should follow some behaviours.
37 The button must disappear not opening the HUD when releasing the
40 The button must disappear not opening the HUD when releasing the
38− mouse again somewhere on the screen except on the button itself following a timeout.
41+ mouse again somewhere on the screen except on the button itself
42+ following a timeout.
39− The button must disappear when touching somewhere on the screen except the button itself.
43+ The button must disappear when touching somewhere on the screen
44+ except the button itself.
40
45
41 """
46 """
42 unity_proxy = self.launch_unity()
47 unity_proxy = self.launch_unity()
@@ -55,29 +60,47 @@ class TestHud(UnityTestCase, DragMixin):
55
60
56 self.touch.press(swipe_coords.start_x, swipe_coords.start_y)
61 self.touch.press(swipe_coords.start_x, swipe_coords.start_y)
57 self.addCleanup(self._maybe_release_finger)
62 self.addCleanup(self._maybe_release_finger)
63+ self._drag(
64+ swipe_coords.start_x,
65+ swipe_coords.start_y,
66+ swipe_coords.start_x,
58− self._drag(swipe_coords.start_x, swipe_coords.start_y, swipe_coords.start_x, swipe_coords.start_y - int(edge_drag_area.distanceThreshold) - 5)
67+ swipe_coords.start_y - int(edge_drag_area.distanceThreshold) - 5)
59 self.assertThat(hud_show_button.opacity, Eventually(Equals(0.5)))
68 self.assertThat(hud_show_button.opacity, Eventually(Equals(0.5)))
69+ self.assertThat(
70+ hud_show_button.bottomMargin,
60− self.assertThat(hud_show_button.bottomMargin, Eventually(Equals(initialBottomMargin)))
71+ Eventually(Equals(initialBottomMargin)))
72+ self._drag(
73+ swipe_coords.start_x,
61− self._drag(swipe_coords.start_x, swipe_coords.start_y - int(edge_drag_area.distanceThreshold) - 5, swipe_coords.end_x, swipe_coords.start_y - int(edge_drag_area.distanceThreshold) - int(edge_drag_area.commitDistance) - 5)
74+ swipe_coords.start_y - int(edge_drag_area.distanceThreshold) - 5,
75+ swipe_coords.end_x,
76+ swipe_coords.start_y - int(edge_drag_area.distanceThreshold) -
77+ int(edge_drag_area.commitDistance) - 5)
62 self.assertThat(hud_show_button.opacity, Eventually(Equals(1.0)))
78 self.assertThat(hud_show_button.opacity, Eventually(Equals(1.0)))
63 self.assertThat(hud_show_button.bottomMargin, Eventually(Equals(0.0)))
79 self.assertThat(hud_show_button.bottomMargin, Eventually(Equals(0.0)))
64− self.touch.release();
80+ self.touch.release()
65 self.assertThat(hud.shown, Equals(False))
81 self.assertThat(hud.shown, Equals(False))
66 self.assertThat(hud_show_button.opacity, Eventually(Equals(0.0)))
82 self.assertThat(hud_show_button.opacity, Eventually(Equals(0.0)))
67
83
68 self.touch.press(swipe_coords.start_x, swipe_coords.start_y)
84 self.touch.press(swipe_coords.start_x, swipe_coords.start_y)
85+ self._drag(
86+ swipe_coords.start_x,
87+ swipe_coords.start_y,
88+ swipe_coords.start_x,
69− self._drag(swipe_coords.start_x, swipe_coords.start_y, swipe_coords.start_x, swipe_coords.end_y - int(hud_show_button.height))
89+ swipe_coords.end_y - int(hud_show_button.height))
70 self.assertThat(hud.shown, Equals(False))
90 self.assertThat(hud.shown, Equals(False))
71 self.assertThat(hud_show_button.opacity, Eventually(Equals(1.0)))
91 self.assertThat(hud_show_button.opacity, Eventually(Equals(1.0)))
72 self.touch.release()
92 self.touch.release()
73 self.assertThat(hud_show_button.opacity, Eventually(Equals(1.0)))
93 self.assertThat(hud_show_button.opacity, Eventually(Equals(1.0)))
94+ self.touch.tap(
95+ swipe_coords.end_x,
74− self.touch.tap(swipe_coords.end_x, swipe_coords.end_y - int(hud_show_button.height))
96+ swipe_coords.end_y - int(hud_show_button.height))
75 self.assertThat(hud.shown, Equals(False))
97 self.assertThat(hud.shown, Equals(False))
76 self.assertThat(hud_show_button.opacity, Eventually(Equals(0.0)))
98 self.assertThat(hud_show_button.opacity, Eventually(Equals(0.0)))
77
99
78 def test_show_hud_appears(self):
100 def test_show_hud_appears(self):
79 """Releasing the touch on the 'show hud' button must display the hud.
101 """Releasing the touch on the 'show hud' button must display the hud.
80− Test that the hud button stays on screen and tapping it opens the hud.
102+ Test that the hud button stays on screen and tapping it opens the
103+ hud.
81
104
82 """
105 """
83 unity_proxy = self.launch_unity()
106 unity_proxy = self.launch_unity()
@@ -94,7 +117,11 @@ class TestHud(UnityTestCase, DragMixin):
94
117
95 self.touch.press(swipe_coords.start_x, swipe_coords.start_y)
118 self.touch.press(swipe_coords.start_x, swipe_coords.start_y)
96 self.addCleanup(self._maybe_release_finger)
119 self.addCleanup(self._maybe_release_finger)
97− self._drag(swipe_coords.start_x, swipe_coords.start_y, swipe_coords.start_x, swipe_coords.end_y)
120+ self._drag(
121+ swipe_coords.start_x,
122+ swipe_coords.start_y,
123+ swipe_coords.start_x,
124+ swipe_coords.end_y)
98 self.assertThat(hud.shown, Eventually(Equals(False)))
125 self.assertThat(hud.shown, Eventually(Equals(False)))
99 self.assertThat(hud_show_button.opacity, Eventually(Equals(1.0)))
126 self.assertThat(hud_show_button.opacity, Eventually(Equals(1.0)))
100 self.touch.release()
127 self.touch.release()
@@ -105,7 +132,11 @@ class TestHud(UnityTestCase, DragMixin):
105 self.assertThat(hud.shown, Eventually(Equals(False)))
132 self.assertThat(hud.shown, Eventually(Equals(False)))
106
133
107 self.touch.press(swipe_coords.start_x, swipe_coords.start_y)
134 self.touch.press(swipe_coords.start_x, swipe_coords.start_y)
135+ self._drag(
136+ swipe_coords.start_x,
137+ swipe_coords.start_y,
138+ swipe_coords.start_x,
108− self._drag(swipe_coords.start_x, swipe_coords.start_y, swipe_coords.start_x, swipe_coords.end_y - int(hud_show_button.height))
139+ swipe_coords.end_y - int(hud_show_button.height))
109 self.assertThat(hud.shown, Equals(False))
140 self.assertThat(hud.shown, Equals(False))
110 self.assertThat(hud_show_button.opacity, Eventually(Equals(1.0)))
141 self.assertThat(hud_show_button.opacity, Eventually(Equals(1.0)))
111 self.touch.release()
142 self.touch.release()
tests/autopilot/unity8/shell/tests/test_emulators.py−2
@@ -32,8 +32,6 @@ try:
32except ImportError:
32except ImportError:
33 import mock
33 import mock
34
34
35−from testtools.matchers import Contains, HasLength
36−
37from unity8 import process_helpers
35from unity8 import process_helpers
38from unity8.shell import emulators, fixture_setup, tests
36from unity8.shell import emulators, fixture_setup, tests
39from unity8.shell.emulators import dash as dash_emulators
37from unity8.shell.emulators import dash as dash_emulators
tests/autopilot/unity8/shell/tests/test_lock_screen.py+4−5
@@ -1,7 +1,7 @@
1# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
1# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
2#
2#
3# Unity Autopilot Test Suite
3# Unity Autopilot Test Suite
4−# Copyright (C) 2012-2013 Canonical
4+# Copyright (C) 2012, 2013, 2014 Canonical
5#
5#
6# This program is free software: you can redistribute it and/or modify
6# This program is free software: you can redistribute it and/or modify
7# it under the terms of the GNU General Public License as published by
7# it under the terms of the GNU General Public License as published by
@@ -25,9 +25,7 @@ from unity8.shell import with_lightdm_mock
25from unity8.shell.tests import UnityTestCase, _get_device_emulation_scenarios
25from unity8.shell.tests import UnityTestCase, _get_device_emulation_scenarios
26
26
27from autopilot.matchers import Eventually
27from autopilot.matchers import Eventually
28−from autopilot.platform import model
29import sys
28import sys
30−from testtools import skipUnless
31from testtools.matchers import Equals
29from testtools.matchers import Equals
32import logging
30import logging
33
31
@@ -133,7 +131,7 @@ class TestLockscreen(UnityTestCase):
133 if not isinstance(code, basestring):
131 if not isinstance(code, basestring):
134 raise TypeError(
132 raise TypeError(
135 "'code' parameter must be a string, not %r."
133 "'code' parameter must be a string, not %r."
136− % type(passphrase)
134+ % type(code)
137 )
135 )
138 for num in code:
136 for num in code:
139 if not num.isdigit():
137 if not num.isdigit():
@@ -190,7 +188,8 @@ class TestLockscreen(UnityTestCase):
190 current_text = prompt.text
188 current_text = prompt.text
191 self.keyboard.type(character)
189 self.keyboard.type(character)
192 try:
190 try:
191+ self.assertThat(
193− self.assertThat(prompt.text, Eventually(Equals(current_text + character)))
192+ prompt.text, Eventually(Equals(current_text + character)))
194 except AssertionError:
193 except AssertionError:
195 if retries > 0:
194 if retries > 0:
196 self._type_character(character, prompt, retries-1)
195 self._type_character(character, prompt, retries-1)
tests/autopilot/unity8/shell/tests/test_notifications.py+15−10
@@ -211,8 +211,8 @@ class InteractiveNotificationBase(NotificationsBase):
211 self.touch.tap_object(notification.select_single(objectName="button4"))
211 self.touch.tap_object(notification.select_single(objectName="button4"))
212 self.assert_notification_action_id_was_called("action_decline_4")
212 self.assert_notification_action_id_was_called("action_decline_4")
213
213
214− def test_modal_sd_without_greeter (self):
214+ def test_modal_sd_without_greeter(self):
215− """A snap-decision on a phone should block input to shell beneath it when there's no greeter."""
215+ """Snap-decision should block input to shell without greeter."""
216 unity_proxy = self.launch_unity()
216 unity_proxy = self.launch_unity()
217 unlock_unity(unity_proxy)
217 unlock_unity(unity_proxy)
218
218
@@ -238,7 +238,8 @@ class InteractiveNotificationBase(NotificationsBase):
238 hints
238 hints
239 )
239 )
240
240
241− # verify that we cannot reveal the launcher (no longer interact with the shell)
241+ # verify that we cannot reveal the launcher (no longer interact with
242+ # the shell)
242 time.sleep(1)
243 time.sleep(1)
243 self.main_window.show_dash_swiping()
244 self.main_window.show_dash_swiping()
244 launcher = self.main_window.get_launcher()
245 launcher = self.main_window.get_launcher()
@@ -249,13 +250,14 @@ class InteractiveNotificationBase(NotificationsBase):
249 get_notification = lambda: notify_list.wait_select_single(
250 get_notification = lambda: notify_list.wait_select_single(
250 'Notification', objectName='notification1')
251 'Notification', objectName='notification1')
251 notification = get_notification()
252 notification = get_notification()
253+ self._assert_notification(
252− self._assert_notification(notification, summary, body, True, False, 1.0)
254+ notification, summary, body, True, False, 1.0)
253 self.touch.tap_object(notification.select_single(objectName="button0"))
255 self.touch.tap_object(notification.select_single(objectName="button0"))
254 self.assert_notification_action_id_was_called("action_accept")
256 self.assert_notification_action_id_was_called("action_accept")
255
257
256− def test_modal_sd_with_greeter (self):
258+ def test_modal_sd_with_greeter(self):
257− """A snap-decision on a phone should not block input to the greeter beneath it."""
259+ """A snap-decision should not block input to the greeter beneath it."""
258− unity_proxy = self.launch_unity()
260+ self.launch_unity()
259
261
260 summary = "Incoming file"
262 summary = "Incoming file"
261 body = "Frank would like to send you the file: essay.pdf"
263 body = "Frank would like to send you the file: essay.pdf"
@@ -290,7 +292,8 @@ class InteractiveNotificationBase(NotificationsBase):
290 get_notification = lambda: notify_list.wait_select_single(
292 get_notification = lambda: notify_list.wait_select_single(
291 'Notification', objectName='notification1')
293 'Notification', objectName='notification1')
292 notification = get_notification()
294 notification = get_notification()
295+ self._assert_notification(
293− self._assert_notification(notification, summary, body, True, False, 1.0)
296+ notification, summary, body, True, False, 1.0)
294 self.touch.tap_object(notification.select_single(objectName="button0"))
297 self.touch.tap_object(notification.select_single(objectName="button0"))
295 self.assert_notification_action_id_was_called("action_accept")
298 self.assert_notification_action_id_was_called("action_accept")
296
299
@@ -663,7 +666,8 @@ class EphemeralNotificationsTests(NotificationsBase):
663 icon_path = self._get_icon_path('avatars/amanda.png')
666 icon_path = self._get_icon_path('avatars/amanda.png')
664 notification.update(summary, body, icon_path)
667 notification.update(summary, body, icon_path)
665 notification.show()
668 notification.show()
669+ self._assert_notification(
666− self._assert_notification(get_notification(), summary, body, True, False, 1.0)
670+ get_notification(), summary, body, True, False, 1.0)
667
671
668 def test_update_notification_layout_change(self):
672 def test_update_notification_layout_change(self):
669 """Notification must allow updating its contents and layout while
673 """Notification must allow updating its contents and layout while
@@ -710,7 +714,8 @@ class EphemeralNotificationsTests(NotificationsBase):
710 notification.show()
714 notification.show()
711
715
712 self.assertThat(get_notification, Eventually(NotEquals(None)))
716 self.assertThat(get_notification, Eventually(NotEquals(None)))
717+ self._assert_notification(
713− self._assert_notification(get_notification(), summary, body, False, False, 1.0)
718+ get_notification(), summary, body, False, False, 1.0)
714
719
715 def test_append_hint(self):
720 def test_append_hint(self):
716 """Notification has to accumulate body-text using append-hint."""
721 """Notification has to accumulate body-text using append-hint."""
tests/autopilot/unity8/shell/tests/test_system_integration.py+10−5
@@ -23,19 +23,24 @@ import subprocess
23import unittest
23import unittest
24
24
25from autopilot import platform
25from autopilot import platform
26−from unity8.shell.emulators import UnityEmulatorBase
27from unity8.shell.tests import UnityTestCase, _get_device_emulation_scenarios
26from unity8.shell.tests import UnityTestCase, _get_device_emulation_scenarios
28
27
29−from testtools.matchers._basic import Equals
30
28
31class SystemIntegrationTests(UnityTestCase):
29class SystemIntegrationTests(UnityTestCase):
32
30
33 scenarios = _get_device_emulation_scenarios()
31 scenarios = _get_device_emulation_scenarios()
34
32
33+ @unittest.skipIf(
34+ platform.model() == "Desktop",
35− @unittest.skipIf(platform.model() == "Desktop", "Test is broken on otto, see bug 1281634.")
35+ "Test is broken on otto, see bug 1281634.")
36 def test_networkmanager_integration(self):
36 def test_networkmanager_integration(self):
37 self.launch_unity()
37 self.launch_unity()
38
38
39 # invoke policykit to check permissions
39 # invoke policykit to check permissions
40+ pid = subprocess.check_output(
40− pid = subprocess.check_output(["pidof", "-s", "unity8"], universal_newlines=True)
41+ ["pidof", "-s", "unity8"], universal_newlines=True)
42+ subprocess.check_call(
43+ "pkcheck --action-id "
41− subprocess.check_call("pkcheck --action-id org.freedesktop.NetworkManager.enable-disable-network --process " + pid, shell=True)
44+ "org.freedesktop.NetworkManager.enable-disable-network "
45+ "--process " + pid,
46+ shell=True)
tests/autopilot/unity8/shell/tests/test_upstart.py+20−11
@@ -1,7 +1,7 @@
1# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
1# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
2#
2#
3# Unity Autopilot Test Suite
3# Unity Autopilot Test Suite
4−# Copyright (C) 2013 Canonical
4+# Copyright (C) 2013, 2014 Canonical
5#
5#
6# This program is free software: you can redistribute it and/or modify
6# This program is free software: you can redistribute it and/or modify
7# it under the terms of the GNU General Public License as published by
7# it under the terms of the GNU General Public License as published by
@@ -42,19 +42,24 @@ import sys
42if sys.version_info < (3,):
42if sys.version_info < (3,):
43 range = xrange
43 range = xrange
44
44
45+
45class UpstartIntegrationTests(UnityTestCase):
46class UpstartIntegrationTests(UnityTestCase):
46
47
47 scenarios = _get_device_emulation_scenarios()
48 scenarios = _get_device_emulation_scenarios()
48
49
49 def _get_status(self):
50 def _get_status(self):
51+ pid, status = os.waitpid(
50− pid, status = os.waitpid(self.process.pid, os.WUNTRACED | os.WCONTINUED | os.WNOHANG)
52+ self.process.pid, os.WUNTRACED | os.WCONTINUED | os.WNOHANG)
53+ logger.debug(
51− logger.debug("Got status: {0}; stopped: {1}; continued: {2}"\
54+ "Got status: {0}; stopped: {1}; continued: {2}".format(
52− .format(status, os.WIFSTOPPED(status), os.WIFCONTINUED(status)))
55+ status, os.WIFSTOPPED(status), os.WIFCONTINUED(status)))
53 return status
56 return status
54
57
55 def _launch_unity(self):
58 def _launch_unity(self):
56 self.patch_environment("QT_LOAD_TESTABILITY", "1")
59 self.patch_environment("QT_LOAD_TESTABILITY", "1")
60+ self.process = subprocess.Popen(
57− self.process = subprocess.Popen([get_binary_path()] + self.unity_geometry_args)
61+ [get_binary_path()] + self.unity_geometry_args)
62+
58 def ensure_stopped():
63 def ensure_stopped():
59 self.process.terminate()
64 self.process.terminate()
60 for i in range(10):
65 for i in range(10):
@@ -76,10 +81,10 @@ class UpstartIntegrationTests(UnityTestCase):
76 self.addCleanup(ensure_stopped)
81 self.addCleanup(ensure_stopped)
77
82
78 def _set_proxy(self):
83 def _set_proxy(self):
79− super(UpstartIntegrationTests, self)._set_proxy(get_proxy_object_for_existing_process(
84+ super(UpstartIntegrationTests, self)._set_proxy(
85+ get_proxy_object_for_existing_process(
80− pid=self.process.pid,
86+ pid=self.process.pid,
81− emulator_base=UnityEmulatorBase,
87+ emulator_base=UnityEmulatorBase,))
82− ))
83
88
84 def test_no_sigstop(self):
89 def test_no_sigstop(self):
85 self.patch_environment("UNITY_MIR_EMITS_SIGSTOP", "")
90 self.patch_environment("UNITY_MIR_EMITS_SIGSTOP", "")
@@ -93,10 +98,14 @@ class UpstartIntegrationTests(UnityTestCase):
93 def test_expect_sigstop(self):
98 def test_expect_sigstop(self):
94 self.patch_environment("UNITY_MIR_EMITS_SIGSTOP", "1")
99 self.patch_environment("UNITY_MIR_EMITS_SIGSTOP", "1")
95 self._launch_unity()
100 self._launch_unity()
101+ self.assertThat(
102+ lambda: os.WIFSTOPPED(self._get_status()),
96− self.assertThat(lambda: os.WIFSTOPPED(self._get_status()), Eventually(Equals(True)), "Unity8 should raise SIGSTOP when ready")
103+ Eventually(Equals(True)), "Unity8 should raise SIGSTOP when ready")
97
104
98 self.process.send_signal(signal.SIGCONT)
105 self.process.send_signal(signal.SIGCONT)
106+ self.assertThat(
107+ lambda: os.WIFCONTINUED(self._get_status()),
99− self.assertThat(lambda: os.WIFCONTINUED(self._get_status()), Eventually(Equals(True)), "Unity8 should have resumed")
108+ Eventually(Equals(True)), "Unity8 should have resumed")
100
109
101 logger.debug("Unity started, waiting for it to be ready.")
110 logger.debug("Unity started, waiting for it to be ready.")
102 self._set_proxy()
111 self._set_proxy()
tests/mocks/Ubuntu/CMakeLists.txt+1
@@ -1,2 +1,3 @@
1add_subdirectory(DownloadDaemonListener)
1add_subdirectory(DownloadDaemonListener)
2+add_subdirectory(Payments)
2add_subdirectory(Thumbnailer)
3add_subdirectory(Thumbnailer)
tests/mocks/Ubuntu/Payments/CMakeLists.txtnew file+10
@@ -0,0 +1,10 @@
1+set(FakeUbuntuPaymentsQml_SOURCES
2+ plugin.cpp
3+ MockPayments.cpp
4+ )
5+
6+add_library(FakeUbuntuPaymentsQml MODULE ${FakeUbuntuPaymentsQml_SOURCES})
7+
8+qt5_use_modules(FakeUbuntuPaymentsQml Qml Quick Core)
9+
10+add_unity8_mock(Ubuntu.Payments 0.1 Ubuntu/Payments TARGETS FakeUbuntuPaymentsQml)
tests/mocks/Ubuntu/Payments/MockPayments.cppnew file+89
@@ -0,0 +1,89 @@
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+#include "MockPayments.h"
18+
19+#include <QLocale>
20+
21+
22+MockPayments::MockPayments(QObject *parent)
23+ : QObject(parent)
24+{
25+}
26+
27+QString MockPayments::currency() const
28+{
29+ return m_currency;
30+}
31+
32+double MockPayments::price() const
33+{
34+ return m_price;
35+}
36+
37+QString MockPayments::storeItemId() const
38+{
39+ return m_store_item_id;
40+}
41+
42+QString MockPayments::formattedPrice() const
43+{
44+ QLocale locale;
45+ return locale.toCurrencyString(m_price, m_currency);
46+}
47+
48+void MockPayments::setCurrency(const QString &currency)
49+{
50+ if(m_currency != currency) {
51+ m_currency = currency;
52+ Q_EMIT currencyChanged(currency);
53+ Q_EMIT formattedPriceChanged(formattedPrice());
54+ }
55+}
56+
57+void MockPayments::setPrice(const double price)
58+{
59+ if(m_price != price) {
60+ m_price = price;
61+ Q_EMIT priceChanged(price);
62+ Q_EMIT formattedPriceChanged(formattedPrice());
63+ }
64+}
65+
66+void MockPayments::setStoreItemId(const QString &store_item_id)
67+{
68+ if (m_store_item_id != store_item_id) {
69+ m_store_item_id = store_item_id;
70+ Q_EMIT storeItemIdChanged(m_store_item_id);
71+ }
72+
73+ if (m_store_item_id.isEmpty()) {
74+ return;
75+ }
76+}
77+
78+void MockPayments::start()
79+{
80+ if (!m_store_item_id.isEmpty()) {
81+ if (m_store_item_id == "com.example.invalid") {
82+ Q_EMIT purchaseError("Purchase failed.");
83+ } else {
84+ Q_EMIT purchaseCompleted();
85+ }
86+ } else {
87+ Q_EMIT purchaseError("No item ID supplied.");
88+ }
89+}
tests/mocks/Ubuntu/Payments/MockPayments.hnew file+60
@@ -0,0 +1,60 @@
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+#ifndef MOCK_PAYMENTS_H
18+#define MOCK_PAYMENTS_H
19+
20+#include <QObject>
21+
22+
23+class MockPayments : public QObject
24+{
25+ Q_OBJECT
26+ Q_DISABLE_COPY(MockPayments)
27+ Q_PROPERTY(QString currency READ currency WRITE setCurrency NOTIFY currencyChanged)
28+ Q_PROPERTY(double price READ price WRITE setPrice NOTIFY priceChanged)
29+ Q_PROPERTY(QString storeItemId READ storeItemId WRITE setStoreItemId NOTIFY storeItemIdChanged)
30+ Q_PROPERTY(QString formattedPrice READ formattedPrice NOTIFY formattedPriceChanged)
31+
32+public:
33+ explicit MockPayments(QObject *parent = 0);
34+
35+ QString currency() const;
36+ double price() const;
37+ QString storeItemId() const;
38+ QString formattedPrice() const;
39+
40+ void setCurrency(const QString& currency);
41+ void setPrice(const double price);
42+ void setStoreItemId(const QString& store_item_id);
43+ Q_INVOKABLE void start();
44+
45+Q_SIGNALS:
46+ void currencyChanged(const QString& currency);
47+ void priceChanged(const double price);
48+ void storeItemIdChanged(const QString &store_item_id);
49+ void formattedPriceChanged(const QString &formatted_price);
50+
51+ void purchaseError(const QString &error);
52+ void purchaseCompleted();
53+
54+private:
55+ QString m_currency;
56+ double m_price;
57+ QString m_store_item_id;
58+};
59+
60+#endif // MOCK_PAYMENTS_H
tests/mocks/Ubuntu/Payments/Payments.qmltypesnew file+42
@@ -0,0 +1,42 @@
1+import QtQuick.tooling 1.1
2+
3+// This file describes the plugin-supplied types contained in the library.
4+// It is used for QML tooling purposes only.
5+//
6+// This file was auto-generated by:
7+// 'qmlplugindump -notrelocatable Ubuntu.Payments 0.1 tests/mocks'
8+
9+Module {
10+ Component {
11+ name: "MockPayments"
12+ prototype: "QObject"
13+ exports: ["Ubuntu.Payments/Payments 0.1"]
14+ exportMetaObjectRevisions: [0]
15+ Property { name: "currency"; type: "string" }
16+ Property { name: "price"; type: "double" }
17+ Property { name: "storeItemId"; type: "string" }
18+ Property { name: "formattedPrice"; type: "string"; isReadonly: true }
19+ Signal {
20+ name: "currencyChanged"
21+ Parameter { name: "currency"; type: "string" }
22+ }
23+ Signal {
24+ name: "priceChanged"
25+ Parameter { name: "price"; type: "double" }
26+ }
27+ Signal {
28+ name: "storeItemIdChanged"
29+ Parameter { name: "store_item_id"; type: "string" }
30+ }
31+ Signal {
32+ name: "formattedPriceChanged"
33+ Parameter { name: "formatted_price"; type: "string" }
34+ }
35+ Signal {
36+ name: "purchaseError"
37+ Parameter { name: "error"; type: "string" }
38+ }
39+ Signal { name: "purchaseCompleted" }
40+ Method { name: "start" }
41+ }
42+}
tests/mocks/Ubuntu/Payments/plugin.cppnew file+28
@@ -0,0 +1,28 @@
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+#include "plugin.h"
18+#include "MockPayments.h"
19+
20+#include <QtQml>
21+
22+
23+void BackendPlugin::registerTypes(const char *uri)
24+{
25+ Q_ASSERT(uri == QLatin1String("Ubuntu.Payments"));
26+
27+ qmlRegisterType<MockPayments>(uri, 0, 1, "Payments");
28+}
tests/mocks/Ubuntu/Payments/plugin.hnew file+31
@@ -0,0 +1,31 @@
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+#ifndef PAYMENTS_PLUGIN_H
18+#define PAYMENTS_PLUGIN_H
19+
20+#include <QQmlExtensionPlugin>
21+
22+class BackendPlugin : public QQmlExtensionPlugin
23+{
24+ Q_OBJECT
25+ Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
26+
27+public:
28+ void registerTypes(const char *uri);
29+};
30+
31+#endif // PAYMENTS_PLUGIN_H
tests/mocks/Ubuntu/Payments/qmldirnew file+3
@@ -0,0 +1,3 @@
1+module Ubuntu.Payments
2+plugin FakeUbuntuPaymentsQml
3+typeinfo Payments.qmltypes
tests/mocks/Unity/Indicators/fakeindicatorsmodel.cpp+1−1
@@ -31,7 +31,7 @@ FakeIndicatorsModel::FakeIndicatorsModel(QObject *parent)
31/*! \internal */
31/*! \internal */
32FakeIndicatorsModel::~FakeIndicatorsModel()
32FakeIndicatorsModel::~FakeIndicatorsModel()
33{
33{
34− unload();
34+ qDeleteAll(m_indicators);
35}
35}
36
36
37int FakeIndicatorsModel::count() const
37int FakeIndicatorsModel::count() const
tests/mocks/Unity/Indicators/qmldir−1
@@ -3,7 +3,6 @@ plugin IndicatorsFakeQml
3typeinfo Indicators.qmltypes
3typeinfo Indicators.qmltypes
4
4
5CachedUnityMenuModel 0.1 CachedUnityMenuModel.qml
5CachedUnityMenuModel 0.1 CachedUnityMenuModel.qml
6−IndicatorBase 0.1 IndicatorBase.qml
7IndicatorsModel 0.1 IndicatorsModel.qml
6IndicatorsModel 0.1 IndicatorsModel.qml
8FakeMenuPage 0.1 FakeMenuPage.qml
7FakeMenuPage 0.1 FakeMenuPage.qml
9RootActionState 0.1 RootActionState.qml
8RootActionState 0.1 RootActionState.qml
tests/qmltests/CMakeLists.txt+1
@@ -46,6 +46,7 @@ add_qml_test(Dash/Previews PreviewActions)
46add_qml_test(Dash/Previews PreviewAudioPlayback)
46add_qml_test(Dash/Previews PreviewAudioPlayback)
47add_qml_test(Dash/Previews PreviewHeader)
47add_qml_test(Dash/Previews PreviewHeader)
48add_qml_test(Dash/Previews PreviewImageGallery)
48add_qml_test(Dash/Previews PreviewImageGallery)
49+add_qml_test(Dash/Previews PreviewPayments)
49add_qml_test(Dash/Previews PreviewProgress)
50add_qml_test(Dash/Previews PreviewProgress)
50add_qml_test(Dash/Previews PreviewRatingDisplay)
51add_qml_test(Dash/Previews PreviewRatingDisplay)
51add_qml_test(Dash/Previews PreviewRatingInput)
52add_qml_test(Dash/Previews PreviewRatingInput)
tests/qmltests/Dash/Previews/tst_PreviewPayments.qmlnew file+100
@@ -0,0 +1,100 @@
1+/*
2+ * Copyright 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+import QtQuick 2.0
18+import QtTest 1.0
19+import "../../../../qml/Dash/Previews"
20+import Unity.Test 0.1 as UT
21+import Ubuntu.Components 0.1
22+
23+Rectangle {
24+ id: root
25+ width: units.gu(60)
26+ height: units.gu(80)
27+
28+ property var jsonPurchase: {
29+ "source": { "price" : 0.99, "currency": "USD", "store_item_id": "com.example.package" }
30+ }
31+
32+ property var jsonPurchaseError: {
33+ "source": { "price" : 0.99, "currency": "USD", "store_item_id": "com.example.invalid" }
34+ }
35+
36+ SignalSpy {
37+ id: spy
38+ target: previewPayments
39+ signalName: "triggered"
40+ }
41+
42+ PreviewPayments {
43+ id: previewPayments
44+ widgetId: "previewPayments"
45+ width: units.gu(30)
46+ }
47+
48+ UT.UnityTestCase {
49+ name: "PreviewPaymentsTest"
50+ when: windowShown
51+
52+ function cleanup()
53+ {
54+ spy.clear();
55+ }
56+
57+ function test_purchase_text_display() {
58+ previewPayments.widgetData = jsonPurchase;
59+
60+ var button = findChild(root, "paymentButton");
61+ verify(button != null, "Button not found.");
62+ compare(button.text, "0.99USD");
63+ }
64+
65+ function test_purchase_completed() {
66+ // Exercise the purchaseCompleted signal here.
67+ previewPayments.widgetData = jsonPurchase;
68+
69+ var button = findChild(root, "paymentButton");
70+ verify(button != null, "Button not found.");
71+
72+ mouseClick(button, button.width / 2, button.height / 2);
73+
74+ spy.wait();
75+
76+ var args = spy.signalArguments[0];
77+ compare(args[0], "previewPayments");
78+ compare(args[1], "purchaseCompleted");
79+ compare(args[2], jsonPurchase["source"]);
80+ }
81+
82+ function test_purchase_error() {
83+ // The mock Payments triggers an error when com.example.invalid is
84+ // passed to it as store_item_id. Exercise it here
85+ previewPayments.widgetData = jsonPurchaseError;
86+
87+ var button = findChild(root, "paymentButton");
88+ verify(button != null, "Button not found.");
89+
90+ mouseClick(button, button.width / 2, button.height / 2);
91+
92+ spy.wait();
93+
94+ var args = spy.signalArguments[0];
95+ compare(args[0], "previewPayments");
96+ compare(args[1], "purchaseError");
97+ compare(args[2], jsonPurchaseError["source"]);
98+ }
99+ }
100+}
tests/qmltests/Panel/Indicators/tst_DefaultIndicatorPage.qml+1
@@ -31,6 +31,7 @@ Item {
31 anchors.fill: parent
31 anchors.fill: parent
32 contentActive: true
32 contentActive: true
33
33
34+ menuModel: UnityMenuModel {}
34 busName: "test"
35 busName: "test"
35 actionsObjectPath: "test"
36 actionsObjectPath: "test"
36 menuObjectPath: "test"
37 menuObjectPath: "test"
tests/qmltests/Panel/Indicators/tst_DefaultIndicatorWidget.qml+3−40
@@ -33,6 +33,7 @@ Item {
33 top: parent.top
33 top: parent.top
34 }
34 }
35
35
36+ menuModel: UnityMenuModel {}
36 busName: "test"
37 busName: "test"
37 actionsObjectPath: "test"
38 actionsObjectPath: "test"
38 deviceMenuObjectPath: "test"
39 deviceMenuObjectPath: "test"
@@ -41,12 +42,6 @@ Item {
41
42
42 iconSize: units.gu(3.2)
43 iconSize: units.gu(3.2)
43 height: units.gu(3)
44 height: units.gu(3)
44−
45− rootActionState {
46− icons: [ "image://theme/audio-volume-high", "image://theme/audio-volume-low" ]
47− leftLabel: "left"
48− rightLabel: "right"
49− }
50 }
45 }
51
46
52 UT.UnityTestCase {
47 UT.UnityTestCase {
@@ -57,41 +52,9 @@ Item {
57 widget.rootActionState.icons = [];
52 widget.rootActionState.icons = [];
58 widget.rootActionState.leftLabel = "";
53 widget.rootActionState.leftLabel = "";
59 widget.rootActionState.rightLabel = "";
54 widget.rootActionState.rightLabel = "";
60− wait(50);
55+ waitForRendering(widget)
61− }
62−
63− function test_guRoundedWidth_data() {
64− return [
65− { tag: "empty", icons: [], leftLabel: "", rightLabel: "" },
66− { tag: "1-icon-no-label", icons: [ "image://theme/audio-volume-high" ], leftLabel: "", rightLabel: "" },
67− { tag: "2-icon-no-label", icons: [ "image://theme/audio-volume-high", "image://theme/audio-volume-low" ], leftLabel: "", rightLabel: "" },
68− { tag: "no-icon-l-label", icons: [], leftLabel: "left", rightLabel: "" },
69− { tag: "no-icon-lr-label", icons: [], leftLabel: "left", rightLabel: "right" },
70− { tag: "1-icon-l-label", icons: [ "image://theme/audio-volume-high" ], leftLabel: "left", rightLabel: "" },
71− { tag: "1-icon-lr-label", icons: [ "image://theme/audio-volume-high" ], leftLabel: "left", rightLabel: "right" },
72− { tag: "2-icon-l-label", icons: [ "image://theme/audio-volume-high", "image://theme/audio-volume-low" ], leftLabel: "left", rightLabel: "" },
73− { tag: "2-icon-lr-label", icons: [ "image://theme/audio-volume-high", "image://theme/audio-volume-low" ], leftLabel: "left", rightLabel: "right" }
74− ];
75− }
76−
77− function test_guRoundedWidth(data) {
78− widget.rootActionState.icons = data.icons
79− widget.rootActionState.leftLabel = data.leftLabel;
80− widget.rootActionState.rightLabel = data.rightLabel;
81− wait(50);
82−
83− compare(widget.width, guRoundUp(widget.width));
84− }
85− }
86−
87− // TODO: Use toolkit function https://bugs.launchpad.net/ubuntu-ui-toolkit/+bug/1242575
88− function guRoundUp(width) {
89− if (width == 0) {
90− return 0;
91 }
56 }
92− var gu1 = units.gu(1.0);
93− var mod = (width % gu1);
94
57
95− return mod == 0 ? width : width + (gu1 - mod);
58+ // FIXME: add tests
96 }
59 }
97}
60}
tests/whitespace/check_whitespace.py+22−12
@@ -1,7 +1,7 @@
1#! /usr/bin/env python3
1#! /usr/bin/env python3
2
2
3#
3#
4−# Copyright (C) 2013 Canonical Ltd
4+# Copyright (C) 2013, 2014 Canonical Ltd
5#
5#
6# This program is free software: you can redistribute it and/or modify
6# This program is free software: you can redistribute it and/or modify
7# it under the terms of the GNU General Public License version 3 as
7# it under the terms of the GNU General Public License version 3 as
@@ -19,8 +19,8 @@
19#
19#
20
20
21#
21#
22−# Little helper program to test that source files do not contain trailing whitespace
22+# Little helper program to test that source files do not contain trailing
23−# or tab indentation.
23+# whitespace or tab indentation.
24#
24#
25# Usage: check_whitespace.py directory [ignore_prefix]
25# Usage: check_whitespace.py directory [ignore_prefix]
26#
26#
@@ -31,18 +31,20 @@
31# See the file_pat definition below for a list of files that are checked.
31# See the file_pat definition below for a list of files that are checked.
32#
32#
33
33
34+from __future__ import print_function
35+
34import argparse
36import argparse
35import os
37import os
36import re
38import re
37import sys
39import sys
38
40
39−# Print msg on stderr, preceded by program name and followed by newline
40
41
42+# Print msg on stderr, preceded by program name and followed by newline
41def error(msg):
43def error(msg):
42 print(os.path.basename(sys.argv[0]) + ": " + msg, file=sys.stderr)
44 print(os.path.basename(sys.argv[0]) + ": " + msg, file=sys.stderr)
43
45
44−# Function to raise errors encountered by os.walk
45
46
47+# Function to raise errors encountered by os.walk
46def raise_error(e):
48def raise_error(e):
47 raise e
49 raise e
48
50
@@ -52,6 +54,7 @@ def raise_error(e):
52whitespace_pat = re.compile(r'.*[ \t]$')
54whitespace_pat = re.compile(r'.*[ \t]$')
53tab_indent_pat = re.compile(r'^ *\t')
55tab_indent_pat = re.compile(r'^ *\t')
54
56
57+
55def scan_for_bad_whitespace(file_path):
58def scan_for_bad_whitespace(file_path):
56 global tab_indent_pat, whitespace_pat
59 global tab_indent_pat, whitespace_pat
57 errors = []
60 errors = []
@@ -69,7 +72,9 @@ def scan_for_bad_whitespace(file_path):
69 plural = 's'
72 plural = 's'
70 else:
73 else:
71 plural = ''
74 plural = ''
75+ print(
76+ "%s: bad whitespace in line%s %s" % (
72− print("%s: bad whitespace in line%s %s" % (file_path, plural, ", ".join((str(i) for i in errors))))
77+ file_path, plural, ", ".join((str(i) for i in errors))))
73 elif errors:
78 elif errors:
74 print("%s: bad whitespace in multiple lines" % file_path)
79 print("%s: bad whitespace in multiple lines" % file_path)
75 if newlines_at_end:
80 if newlines_at_end:
@@ -78,15 +83,20 @@ def scan_for_bad_whitespace(file_path):
78
83
79# Parse args
84# Parse args
80
85
86+parser = argparse.ArgumentParser(
81−parser = argparse.ArgumentParser(description = 'Test that source files do not contain trailing whitespace.')
87+ description='Test that source files do not contain trailing whitespace.')
88+parser.add_argument(
89+ 'dir', nargs=1,
82−parser.add_argument('dir', nargs = 1, help = 'The directory to (recursively) search for source files')
90+ help='The directory to (recursively) search for source files')
91+parser.add_argument(
83−parser.add_argument('ignore_prefix', nargs = '?', default=None,
92+ 'ignore_prefix', nargs='?', default=None,
84− help = 'Ignore source files with a path that starts with the given prefix.')
93+ help='Ignore source files with a path that starts with the given prefix.')
85args = parser.parse_args()
94args = parser.parse_args()
86
95
87# Files we want to check for trailing whitespace.
96# Files we want to check for trailing whitespace.
88
97
98+file_pat = (
89−file_pat = r'(.*\.(c|cpp|h|hpp|hh|in|install|js|py|qml|sh)$)|(.*CMakeLists\.txt$)'
99+ r'(.*\.(c|cpp|h|hpp|hh|in|install|js|py|qml|sh)$)|(.*CMakeLists\.txt$)')
90pat = re.compile(file_pat)
100pat = re.compile(file_pat)
91
101
92# Find all the files with matching file extension in the specified
102# Find all the files with matching file extension in the specified
@@ -97,7 +107,7 @@ ignore = args.ignore_prefix and os.path.abspath(args.ignore_prefix) or None
97
107
98found_whitespace = False
108found_whitespace = False
99try:
109try:
100− for root, dirs, files in os.walk(directory, onerror = raise_error):
110+ for root, dirs, files in os.walk(directory, onerror=raise_error):
101 for file in files:
111 for file in files:
102 path = os.path.join(root, file)
112 path = os.path.join(root, file)
103 if not (ignore and path.startswith(ignore)) and pat.match(file):
113 if not (ignore and path.startswith(ignore)) and pat.match(file):
tools/scopetool.cpp−2
@@ -77,8 +77,6 @@ int main(int argc, char *argv[])
77 tracker.reset(new RegistryTracker(extraScopes, systemScopes, serverScopes));
77 tracker.reset(new RegistryTracker(extraScopes, systemScopes, serverScopes));
78 }
78 }
79
79
80− resolveIconTheme();
81−
82 bindtextdomain("unity8", translationDirectory().toUtf8().data());
80 bindtextdomain("unity8", translationDirectory().toUtf8().data());
83
81
84 QQuickView* view = new QQuickView();
82 QQuickView* view = new QQuickView();