on xenial help sign in
Set progress bar indeterminate when processing signal received. (LP: #1249349)
698e8fcDaniel d'Andrada
debian/control+3−1
@@ -11,9 +11,9 @@ Build-Depends: cmake,
11# to g++ so we don't try to run arm g++
11# to g++ so we don't try to run arm g++
12# on an x86 CPU for example, when cross-compiling.
12# on an x86 CPU for example, when cross-compiling.
13 g++:native,
13 g++:native,
14− libandroid-properties-dev,
15 graphviz,
14 graphviz,
16 gsettings-ubuntu-schemas (>= 0.0.2+14.10.20140815),
15 gsettings-ubuntu-schemas (>= 0.0.2+14.10.20140815),
16+ libandroid-properties-dev,
17 libconnectivity-qt1-dev (>= 0.7.1),
17 libconnectivity-qt1-dev (>= 0.7.1),
18 libevdev-dev,
18 libevdev-dev,
19 libgeonames-dev (>= 0.2),
19 libgeonames-dev (>= 0.2),
@@ -32,9 +32,11 @@ Build-Depends: cmake,
32 libqt5svg5-dev,
32 libqt5svg5-dev,
33 libqt5xmlpatterns5-dev,
33 libqt5xmlpatterns5-dev,
34 libsystemsettings-dev,
34 libsystemsettings-dev,
35+ libubuntu-download-manager-common-dev,
35 libubuntugestures5-dev (>= 1.3.2030),
36 libubuntugestures5-dev (>= 1.3.2030),
36 libubuntugestures5-private-dev (>= 1.3.2030),
37 libubuntugestures5-private-dev (>= 1.3.2030),
37 libudev-dev,
38 libudev-dev,
39+ libudm-common-dev,
38 libunity-api-dev (>= 7.118),
40 libunity-api-dev (>= 7.118),
39 libusermetricsoutput1-dev,
41 libusermetricsoutput1-dev,
40# Need those X11 libs touch emulation from mouse events in manual QML tests on a X11 desktop
42# Need those X11 libs touch emulation from mouse events in manual QML tests on a X11 desktop
plugins/Ubuntu/DownloadDaemonListener/CMakeLists.txt+3−1
@@ -12,5 +12,7 @@ set(DOWNLOADDAEMONLISTENER_SOURCES
12add_library(DownloadDaemonListener MODULE ${DOWNLOADDAEMONLISTENER_SOURCES})
12add_library(DownloadDaemonListener MODULE ${DOWNLOADDAEMONLISTENER_SOURCES})
13
13
14qt5_use_modules(DownloadDaemonListener Qml Quick DBus Core)
14qt5_use_modules(DownloadDaemonListener Qml Quick DBus Core)
15−
15+pkg_check_modules(DDLADAPTER REQUIRED udm-common)
16+add_definitions(${DDLADAPTER_CFLAGS} ${DDLADAPTER_CFLAGS_OTHER})
17+target_link_libraries(DownloadDaemonListener ${DDLADAPTER_LIBRARIES})
16add_unity8_plugin(Ubuntu.DownloadDaemonListener 0.1 Ubuntu/DownloadDaemonListener TARGETS DownloadDaemonListener)
18add_unity8_plugin(Ubuntu.DownloadDaemonListener 0.1 Ubuntu/DownloadDaemonListener TARGETS DownloadDaemonListener)
plugins/Ubuntu/DownloadDaemonListener/DownloadTracker.cpp+2−1
@@ -1,5 +1,5 @@
1/*
1/*
2− * Copyright (C) 2013 - Canonical Ltd.
2+ * Copyright (C) 2013-2016 Canonical Ltd.
3 *
3 *
4 * This program is free software: you can redistribute it and/or modify it
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU Lesser General Public License, as
5 * under the terms of the GNU Lesser General Public License, as
@@ -78,6 +78,7 @@ void DownloadTracker::startService()
78 connect(m_adaptor, static_cast<void (DownloadTrackerAdaptor::*)(qulonglong, qulonglong)>(&DownloadTrackerAdaptor::progress), this, &DownloadTracker::progress);
78 connect(m_adaptor, static_cast<void (DownloadTrackerAdaptor::*)(qulonglong, qulonglong)>(&DownloadTrackerAdaptor::progress), this, &DownloadTracker::progress);
79 connect(m_adaptor, &DownloadTrackerAdaptor::resumed, this, &DownloadTracker::resumed);
79 connect(m_adaptor, &DownloadTrackerAdaptor::resumed, this, &DownloadTracker::resumed);
80 connect(m_adaptor, &DownloadTrackerAdaptor::started, this, &DownloadTracker::started);
80 connect(m_adaptor, &DownloadTrackerAdaptor::started, this, &DownloadTracker::started);
81+ connect(m_adaptor, &DownloadTrackerAdaptor::processing, this, &DownloadTracker::processing);
81 }
82 }
82 // FIXME find a better way of determining if the service is ready
83 // FIXME find a better way of determining if the service is ready
83 Q_EMIT serviceReadyChanged(m_adaptor && m_adaptor->isValid());
84 Q_EMIT serviceReadyChanged(m_adaptor && m_adaptor->isValid());
plugins/Ubuntu/DownloadDaemonListener/DownloadTracker.h+2−1
@@ -1,5 +1,5 @@
1/*
1/*
2− * Copyright (C) 2013 - Canonical Ltd.
2+ * Copyright (C) 2013-2016 Canonical Ltd.
3 *
3 *
4 * This program is free software: you can redistribute it and/or modify it
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU Lesser General Public License, as
5 * under the terms of the GNU Lesser General Public License, as
@@ -54,6 +54,7 @@ Q_SIGNALS:
54 void error(const QString &error);
54 void error(const QString &error);
55 void finished(const QString &path);
55 void finished(const QString &path);
56 void paused(bool success);
56 void paused(bool success);
57+ void processing(const QString &path);
57 void progress(qulonglong received, qulonglong total);
58 void progress(qulonglong received, qulonglong total);
58 void resumed(bool success);
59 void resumed(bool success);
59 void started(bool success);
60 void started(bool success);
plugins/Ubuntu/DownloadDaemonListener/interface/downloadtrackeradaptor.cpp+2−2
@@ -1,8 +1,8 @@
1/*
1/*
2 * This file was generated by qdbusxml2cpp version 0.8
2 * This file was generated by qdbusxml2cpp version 0.8
3− * Command line was: qdbusxml2cpp -v -c DownloadTrackerAdaptor -p downloadtrackeradaptor.h:downloadtrackeradaptor.cpp -i metatypes.h com.canonical.applications.download.xml
3+ * Command line was: qdbusxml2cpp -v -c DownloadTrackerAdaptor -p downloadtrackeradaptor.h:downloadtrackeradaptor.cpp -i metatypes.h ../../../../../../ubuntu-download-manager/trunk/docs/dbus/com.canonical.applications.download.xml
4 *
4 *
5− * qdbusxml2cpp is Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
5+ * qdbusxml2cpp is Copyright (C) 2015 The Qt Company Ltd.
6 *
6 *
7 * This is an auto-generated file.
7 * This is an auto-generated file.
8 * This file may have been hand-edited. Look for HAND-EDIT comments
8 * This file may have been hand-edited. Look for HAND-EDIT comments
plugins/Ubuntu/DownloadDaemonListener/interface/downloadtrackeradaptor.h+71−4
@@ -1,15 +1,15 @@
1/*
1/*
2 * This file was generated by qdbusxml2cpp version 0.8
2 * This file was generated by qdbusxml2cpp version 0.8
3− * Command line was: qdbusxml2cpp -v -c DownloadTrackerAdaptor -p downloadtrackeradaptor.h:downloadtrackeradaptor.cpp -i metatypes.h com.canonical.applications.download.xml
3+ * Command line was: qdbusxml2cpp -v -c DownloadTrackerAdaptor -p downloadtrackeradaptor.h:downloadtrackeradaptor.cpp -i metatypes.h ../../../../../../ubuntu-download-manager/trunk/docs/dbus/com.canonical.applications.download.xml
4 *
4 *
5− * qdbusxml2cpp is Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
5+ * qdbusxml2cpp is Copyright (C) 2015 The Qt Company Ltd.
6 *
6 *
7 * This is an auto-generated file.
7 * This is an auto-generated file.
8 * Do not edit! All changes made to it will be lost.
8 * Do not edit! All changes made to it will be lost.
9 */
9 */
10
10
11−#ifndef DOWNLOADTRACKERADAPTOR_H_1374434371
11+#ifndef DOWNLOADTRACKERADAPTOR_H
12−#define DOWNLOADTRACKERADAPTOR_H_1374434371
12+#define DOWNLOADTRACKERADAPTOR_H
13
13
14#include <QtCore/QObject>
14#include <QtCore/QObject>
15#include <QtCore/QByteArray>
15#include <QtCore/QByteArray>
@@ -36,6 +36,22 @@ public:
36
36
37 ~DownloadTrackerAdaptor();
37 ~DownloadTrackerAdaptor();
38
38
39+ Q_PROPERTY(QString ClickPackage READ clickPackage)
40+ inline QString clickPackage() const
41+ { return qvariant_cast< QString >(property("ClickPackage")); }
42+
43+ Q_PROPERTY(QString DestinationApp READ destinationApp)
44+ inline QString destinationApp() const
45+ { return qvariant_cast< QString >(property("DestinationApp")); }
46+
47+ Q_PROPERTY(bool ShowInIndicator READ showInIndicator)
48+ inline bool showInIndicator() const
49+ { return qvariant_cast< bool >(property("ShowInIndicator")); }
50+
51+ Q_PROPERTY(QString Title READ title)
52+ inline QString title() const
53+ { return qvariant_cast< QString >(property("Title")); }
54+
39public Q_SLOTS: // METHODS
55public Q_SLOTS: // METHODS
40 inline QDBusPendingReply<> allowGSMDownload(bool allowed)
56 inline QDBusPendingReply<> allowGSMDownload(bool allowed)
41 {
57 {
@@ -50,6 +66,24 @@ public Q_SLOTS: // METHODS
50 return asyncCallWithArgumentList(QStringLiteral("cancel"), argumentList);
66 return asyncCallWithArgumentList(QStringLiteral("cancel"), argumentList);
51 }
67 }
52
68
69+ inline QDBusPendingReply<> collected()
70+ {
71+ QList<QVariant> argumentList;
72+ return asyncCallWithArgumentList(QStringLiteral("collected"), argumentList);
73+ }
74+
75+ inline QDBusPendingReply<QString> filePath()
76+ {
77+ QList<QVariant> argumentList;
78+ return asyncCallWithArgumentList(QStringLiteral("filePath"), argumentList);
79+ }
80+
81+ inline QDBusPendingReply<StringMap> headers()
82+ {
83+ QList<QVariant> argumentList;
84+ return asyncCallWithArgumentList(QStringLiteral("headers"), argumentList);
85+ }
86+
53 inline QDBusPendingReply<bool> isGSMDownloadAllowed()
87 inline QDBusPendingReply<bool> isGSMDownloadAllowed()
54 {
88 {
55 QList<QVariant> argumentList;
89 QList<QVariant> argumentList;
@@ -80,6 +114,27 @@ public Q_SLOTS: // METHODS
80 return asyncCallWithArgumentList(QStringLiteral("resume"), argumentList);
114 return asyncCallWithArgumentList(QStringLiteral("resume"), argumentList);
81 }
115 }
82
116
117+ inline QDBusPendingReply<> setDestinationDir(const QString &path)
118+ {
119+ QList<QVariant> argumentList;
120+ argumentList << QVariant::fromValue(path);
121+ return asyncCallWithArgumentList(QStringLiteral("setDestinationDir"), argumentList);
122+ }
123+
124+ inline QDBusPendingReply<> setHeaders(StringMap headers)
125+ {
126+ QList<QVariant> argumentList;
127+ argumentList << QVariant::fromValue(headers);
128+ return asyncCallWithArgumentList(QStringLiteral("setHeaders"), argumentList);
129+ }
130+
131+ inline QDBusPendingReply<> setMetadata(const QVariantMap &data)
132+ {
133+ QList<QVariant> argumentList;
134+ argumentList << QVariant::fromValue(data);
135+ return asyncCallWithArgumentList(QStringLiteral("setMetadata"), argumentList);
136+ }
137+
83 inline QDBusPendingReply<> setThrottle(qulonglong speed)
138 inline QDBusPendingReply<> setThrottle(qulonglong speed)
84 {
139 {
85 QList<QVariant> argumentList;
140 QList<QVariant> argumentList;
@@ -93,6 +148,12 @@ public Q_SLOTS: // METHODS
93 return asyncCallWithArgumentList(QStringLiteral("start"), argumentList);
148 return asyncCallWithArgumentList(QStringLiteral("start"), argumentList);
94 }
149 }
95
150
151+ inline QDBusPendingReply<int> state()
152+ {
153+ QList<QVariant> argumentList;
154+ return asyncCallWithArgumentList(QStringLiteral("state"), argumentList);
155+ }
156+
96 inline QDBusPendingReply<qulonglong> throttle()
157 inline QDBusPendingReply<qulonglong> throttle()
97 {
158 {
98 QList<QVariant> argumentList;
159 QList<QVariant> argumentList;
@@ -106,10 +167,16 @@ public Q_SLOTS: // METHODS
106 }
167 }
107
168
108Q_SIGNALS: // SIGNALS
169Q_SIGNALS: // SIGNALS
170+ void authError(AuthErrorStruct error);
109 void canceled(bool success);
171 void canceled(bool success);
110 void error(const QString &error);
172 void error(const QString &error);
111 void finished(const QString &path);
173 void finished(const QString &path);
174+ void hashError(HashErrorStruct error);
175+ void httpError(HttpErrorStruct error);
176+ void networkError(NetworkErrorStruct error);
112 void paused(bool success);
177 void paused(bool success);
178+ void processError(ProcessErrorStruct error);
179+ void processing(const QString &path);
113 void progress(qulonglong received, qulonglong total);
180 void progress(qulonglong received, qulonglong total);
114 void resumed(bool success);
181 void resumed(bool success);
115 void started(bool success);
182 void started(bool success);
plugins/Ubuntu/DownloadDaemonListener/interface/metatypes.h+3−6
@@ -1,5 +1,5 @@
1/*
1/*
2− * Copyright 2013 2013 Canonical Ltd.
2+ * Copyright 2013-2016 Canonical Ltd.
3 *
3 *
4 * This library is free software; you can redistribute it and/or
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of version 3 of the GNU Lesser General Public
5 * modify it under the terms of version 3 of the GNU Lesser General Public
@@ -19,10 +19,7 @@
19#ifndef DOWNLOADER_LIB_APP_METATYPES_H
19#ifndef DOWNLOADER_LIB_APP_METATYPES_H
20#define DOWNLOADER_LIB_APP_METATYPES_H
20#define DOWNLOADER_LIB_APP_METATYPES_H
21
21
22−#include <QMap>
22+// Just include the system file so we're always up to date.
23−
23+#include <ubuntu/download_manager/metatypes.h>
24−typedef QMap<QString, QString> StringMap;
25−
26−Q_DECLARE_METATYPE(StringMap)
27
24
28#endif // METATYPES_H
25#endif // METATYPES_H
qml/Dash/Previews/PreviewProgress.qml+5−1
@@ -1,5 +1,5 @@
1/*
1/*
2− * Copyright (C) 2014 Canonical, Ltd.
2+ * Copyright (C) 2014-2016 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 General Public License as published by
5 * it under the terms of the GNU General Public License as published by
@@ -59,6 +59,10 @@ PreviewWidget {
59 }
59 }
60 }
60 }
61
61
62+ onProcessing: {
63+ progressBar.indeterminate = true;
64+ }
65+
62 onFinished: {
66 onFinished: {
63 root.triggered(widgetId, "finished", widgetData)
67 root.triggered(widgetId, "finished", widgetData)
64 }
68 }
tests/mocks/Ubuntu/DownloadDaemonListener/MockDownloadTracker.cpp+3−1
@@ -1,5 +1,5 @@
1/*
1/*
2− * Copyright (C) 2013 - Canonical Ltd.
2+ * Copyright (C) 2013-2016 Canonical Ltd.
3 *
3 *
4 * This program is free software: you can redistribute it and/or modify it
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU Lesser General Public License, as
5 * under the terms of the GNU Lesser General Public License, as
@@ -67,6 +67,8 @@ void MockDownloadTracker::startService()
67 Q_EMIT finished("downloadComplete");
67 Q_EMIT finished("downloadComplete");
68 }else if(m_dbusPath == "error") {
68 }else if(m_dbusPath == "error") {
69 Q_EMIT error("DOWNLOAD ERROR");
69 Q_EMIT error("DOWNLOAD ERROR");
70+ }else if(m_dbusPath == "processing") {
71+ Q_EMIT processing(m_dbusPath);
70 }
72 }
71 }
73 }
72}
74}
tests/mocks/Ubuntu/DownloadDaemonListener/MockDownloadTracker.h+2−1
@@ -1,5 +1,5 @@
1/*
1/*
2− * Copyright (C) 2013 - Canonical Ltd.
2+ * Copyright (C) 2013-2016 Canonical Ltd.
3 *
3 *
4 * This program is free software: you can redistribute it and/or modify it
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU Lesser General Public License, as
5 * under the terms of the GNU Lesser General Public License, as
@@ -51,6 +51,7 @@ Q_SIGNALS:
51 void error(const QString &error);
51 void error(const QString &error);
52 void finished(const QString &path);
52 void finished(const QString &path);
53 void paused(bool success);
53 void paused(bool success);
54+ void processing(const QString &path);
54 void progress(qulonglong received, qulonglong total);
55 void progress(qulonglong received, qulonglong total);
55 void resumed(bool success);
56 void resumed(bool success);
56 void started(bool success);
57 void started(bool success);
tests/qmltests/Dash/Previews/tst_PreviewProgress.qml+14−1
@@ -1,5 +1,5 @@
1/*
1/*
2− * Copyright 2014 Canonical Ltd.
2+ * Copyright 2014-2016 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 General Public License as published by
5 * it under the terms of the GNU General Public License as published by
@@ -40,6 +40,11 @@ Rectangle {
40 "source": { "dbus-name" : "somename", "dbus-object": "error" }
40 "source": { "dbus-name" : "somename", "dbus-object": "error" }
41 }
41 }
42
42
43+ property var progressjsonProcessing: {
44+ "type": "progress",
45+ "source": { "dbus-name" : "somename", "dbus-object": "processing" }
46+ }
47+
43 SignalSpy {
48 SignalSpy {
44 id: spy
49 id: spy
45 signalName: "triggered"
50 signalName: "triggered"
@@ -82,6 +87,14 @@ Rectangle {
82 compare(args[0], "previewProgress");
87 compare(args[0], "previewProgress");
83 compare(args[1], "failed");
88 compare(args[1], "failed");
84 compare(args[2], progressjsonError);
89 compare(args[2], progressjsonError);
90+
91+ spy.clear();
92+
93+ var progressBar = findChild(previewProgress, "progressBar");
94+ compare(progressBar.indeterminate, false);
95+ previewProgress.widgetData = progressjsonProcessing;
96+ progressBar = findChild(previewProgress, "progressBar");
97+ tryCompare(progressBar, "indeterminate", true);
85 }
98 }
86 }
99 }
87}
100}