on xenial help sign in
Set progress bar indeterminate when processing signal received.
commit1612875f9e8fcd289ca043c34b9e4b7469b0885a authorRodney Dawes <rodney.dawes@canonical.com> dateFri 2 Sep 2016, 10:59 (10 years ago) parent8595fe6
11 files changed+110−20
debian/control+3−1 plugins/Ubuntu/DownloadDaemonListener/CMakeLists.txt+3−1 plugins/Ubuntu/DownloadDaemonListener/DownloadTracker.cpp+2−1 plugins/Ubuntu/DownloadDaemonListener/DownloadTracker.h+2−1 plugins/Ubuntu/DownloadDaemonListener/interface/downloadtrackeradaptor.cpp+2−2 plugins/Ubuntu/DownloadDaemonListener/interface/downloadtrackeradaptor.h+71−4 plugins/Ubuntu/DownloadDaemonListener/interface/metatypes.h+3−6 qml/Dash/Previews/PreviewProgress.qml+5−1 tests/mocks/Ubuntu/DownloadDaemonListener/MockDownloadTracker.cpp+3−1 tests/mocks/Ubuntu/DownloadDaemonListener/MockDownloadTracker.h+2−1 tests/qmltests/Dash/Previews/tst_PreviewProgress.qml+14−1
debian/control+3−1
@@ -11,9 +11,9 @@ Build-Depends: cmake,
1111# to g++ so we don't try to run arm g++
1212# on an x86 CPU for example, when cross-compiling.
1313 g++:native,
14− libandroid-properties-dev,
1514 graphviz,
1615 gsettings-ubuntu-schemas (>= 0.0.2+14.10.20140815),
16+ libandroid-properties-dev,
1717 libconnectivity-qt1-dev (>= 0.7.1),
1818 libevdev-dev,
1919 libgeonames-dev (>= 0.2),
@@ -32,9 +32,11 @@ Build-Depends: cmake,
3232 libqt5svg5-dev,
3333 libqt5xmlpatterns5-dev,
3434 libsystemsettings-dev,
35+ libubuntu-download-manager-common-dev,
3536 libubuntugestures5-dev (>= 1.3.2030),
3637 libubuntugestures5-private-dev (>= 1.3.2030),
3738 libudev-dev,
39+ libudm-common-dev,
3840 libunity-api-dev (>= 7.117),
3941 libusermetricsoutput1-dev,
4042# 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
1212add_library(DownloadDaemonListener MODULE ${DOWNLOADDAEMONLISTENER_SOURCES})
1313
1414qt5_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})
1618add_unity8_plugin(Ubuntu.DownloadDaemonListener 0.1 Ubuntu/DownloadDaemonListener TARGETS DownloadDaemonListener)
plugins/Ubuntu/DownloadDaemonListener/DownloadTracker.cpp+2−1
@@ -1,5 +1,5 @@
11/*
2− * Copyright (C) 2013 - Canonical Ltd.
2+ * Copyright (C) 2013-2016 Canonical Ltd.
33 *
44 * This program is free software: you can redistribute it and/or modify it
55 * under the terms of the GNU Lesser General Public License, as
@@ -78,6 +78,7 @@ void DownloadTracker::startService()
7878 connect(m_adaptor, static_cast<void (DownloadTrackerAdaptor::*)(qulonglong, qulonglong)>(&DownloadTrackerAdaptor::progress), this, &DownloadTracker::progress);
7979 connect(m_adaptor, &DownloadTrackerAdaptor::resumed, this, &DownloadTracker::resumed);
8080 connect(m_adaptor, &DownloadTrackerAdaptor::started, this, &DownloadTracker::started);
81+ connect(m_adaptor, &DownloadTrackerAdaptor::processing, this, &DownloadTracker::processing);
8182 }
8283 // FIXME find a better way of determining if the service is ready
8384 Q_EMIT serviceReadyChanged(m_adaptor && m_adaptor->isValid());
plugins/Ubuntu/DownloadDaemonListener/DownloadTracker.h+2−1
@@ -1,5 +1,5 @@
11/*
2− * Copyright (C) 2013 - Canonical Ltd.
2+ * Copyright (C) 2013-2016 Canonical Ltd.
33 *
44 * This program is free software: you can redistribute it and/or modify it
55 * under the terms of the GNU Lesser General Public License, as
@@ -54,6 +54,7 @@ Q_SIGNALS:
5454 void error(const QString &error);
5555 void finished(const QString &path);
5656 void paused(bool success);
57+ void processing(const QString &path);
5758 void progress(qulonglong received, qulonglong total);
5859 void resumed(bool success);
5960 void started(bool success);
plugins/Ubuntu/DownloadDaemonListener/interface/downloadtrackeradaptor.cpp+2−2
@@ -1,8 +1,8 @@
11/*
22 * 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
44 *
5− * qdbusxml2cpp is Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
5+ * qdbusxml2cpp is Copyright (C) 2015 The Qt Company Ltd.
66 *
77 * This is an auto-generated file.
88 * This file may have been hand-edited. Look for HAND-EDIT comments
plugins/Ubuntu/DownloadDaemonListener/interface/downloadtrackeradaptor.h+71−4
@@ -1,15 +1,15 @@
11/*
22 * 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
44 *
5− * qdbusxml2cpp is Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
5+ * qdbusxml2cpp is Copyright (C) 2015 The Qt Company Ltd.
66 *
77 * This is an auto-generated file.
88 * Do not edit! All changes made to it will be lost.
99 */
1010
11−#ifndef DOWNLOADTRACKERADAPTOR_H_1374434371
12−#define DOWNLOADTRACKERADAPTOR_H_1374434371
11+#ifndef DOWNLOADTRACKERADAPTOR_H
12+#define DOWNLOADTRACKERADAPTOR_H
1313
1414#include <QtCore/QObject>
1515#include <QtCore/QByteArray>
@@ -36,6 +36,22 @@ public:
3636
3737 ~DownloadTrackerAdaptor();
3838
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+
3955public Q_SLOTS: // METHODS
4056 inline QDBusPendingReply<> allowGSMDownload(bool allowed)
4157 {
@@ -50,6 +66,24 @@ public Q_SLOTS: // METHODS
5066 return asyncCallWithArgumentList(QStringLiteral("cancel"), argumentList);
5167 }
5268
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+
5387 inline QDBusPendingReply<bool> isGSMDownloadAllowed()
5488 {
5589 QList<QVariant> argumentList;
@@ -80,6 +114,27 @@ public Q_SLOTS: // METHODS
80114 return asyncCallWithArgumentList(QStringLiteral("resume"), argumentList);
81115 }
82116
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+
83138 inline QDBusPendingReply<> setThrottle(qulonglong speed)
84139 {
85140 QList<QVariant> argumentList;
@@ -93,6 +148,12 @@ public Q_SLOTS: // METHODS
93148 return asyncCallWithArgumentList(QStringLiteral("start"), argumentList);
94149 }
95150
151+ inline QDBusPendingReply<int> state()
152+ {
153+ QList<QVariant> argumentList;
154+ return asyncCallWithArgumentList(QStringLiteral("state"), argumentList);
155+ }
156+
96157 inline QDBusPendingReply<qulonglong> throttle()
97158 {
98159 QList<QVariant> argumentList;
@@ -106,10 +167,16 @@ public Q_SLOTS: // METHODS
106167 }
107168
108169Q_SIGNALS: // SIGNALS
170+ void authError(AuthErrorStruct error);
109171 void canceled(bool success);
110172 void error(const QString &error);
111173 void finished(const QString &path);
174+ void hashError(HashErrorStruct error);
175+ void httpError(HttpErrorStruct error);
176+ void networkError(NetworkErrorStruct error);
112177 void paused(bool success);
178+ void processError(ProcessErrorStruct error);
179+ void processing(const QString &path);
113180 void progress(qulonglong received, qulonglong total);
114181 void resumed(bool success);
115182 void started(bool success);
plugins/Ubuntu/DownloadDaemonListener/interface/metatypes.h+3−6
@@ -1,5 +1,5 @@
11/*
2− * Copyright 2013 2013 Canonical Ltd.
2+ * Copyright 2013-2016 Canonical Ltd.
33 *
44 * This library is free software; you can redistribute it and/or
55 * modify it under the terms of version 3 of the GNU Lesser General Public
@@ -19,10 +19,7 @@
1919#ifndef DOWNLOADER_LIB_APP_METATYPES_H
2020#define DOWNLOADER_LIB_APP_METATYPES_H
2121
22−#include <QMap>
23−
24−typedef QMap<QString, QString> StringMap;
25−
26−Q_DECLARE_METATYPE(StringMap)
22+// Just include the system file so we're always up to date.
23+#include <ubuntu/download_manager/metatypes.h>
2724
2825#endif // METATYPES_H
qml/Dash/Previews/PreviewProgress.qml+5−1
@@ -1,5 +1,5 @@
11/*
2− * Copyright (C) 2014 Canonical, Ltd.
2+ * Copyright (C) 2014-2016 Canonical, Ltd.
33 *
44 * This program is free software; you can redistribute it and/or modify
55 * it under the terms of the GNU General Public License as published by
@@ -59,6 +59,10 @@ PreviewWidget {
5959 }
6060 }
6161
62+ onProcessing: {
63+ progressBar.indeterminate = true;
64+ }
65+
6266 onFinished: {
6367 root.triggered(widgetId, "finished", widgetData)
6468 }
tests/mocks/Ubuntu/DownloadDaemonListener/MockDownloadTracker.cpp+3−1
@@ -1,5 +1,5 @@
11/*
2− * Copyright (C) 2013 - Canonical Ltd.
2+ * Copyright (C) 2013-2016 Canonical Ltd.
33 *
44 * This program is free software: you can redistribute it and/or modify it
55 * under the terms of the GNU Lesser General Public License, as
@@ -67,6 +67,8 @@ void MockDownloadTracker::startService()
6767 Q_EMIT finished("downloadComplete");
6868 }else if(m_dbusPath == "error") {
6969 Q_EMIT error("DOWNLOAD ERROR");
70+ }else if(m_dbusPath == "processing") {
71+ Q_EMIT processing(m_dbusPath);
7072 }
7173 }
7274}
tests/mocks/Ubuntu/DownloadDaemonListener/MockDownloadTracker.h+2−1
@@ -1,5 +1,5 @@
11/*
2− * Copyright (C) 2013 - Canonical Ltd.
2+ * Copyright (C) 2013-2016 Canonical Ltd.
33 *
44 * This program is free software: you can redistribute it and/or modify it
55 * under the terms of the GNU Lesser General Public License, as
@@ -51,6 +51,7 @@ Q_SIGNALS:
5151 void error(const QString &error);
5252 void finished(const QString &path);
5353 void paused(bool success);
54+ void processing(const QString &path);
5455 void progress(qulonglong received, qulonglong total);
5556 void resumed(bool success);
5657 void started(bool success);
tests/qmltests/Dash/Previews/tst_PreviewProgress.qml+14−1
@@ -1,5 +1,5 @@
11/*
2− * Copyright 2014 Canonical Ltd.
2+ * Copyright 2014-2016 Canonical Ltd.
33 *
44 * This program is free software; you can redistribute it and/or modify
55 * it under the terms of the GNU General Public License as published by
@@ -40,6 +40,11 @@ Rectangle {
4040 "source": { "dbus-name" : "somename", "dbus-object": "error" }
4141 }
4242
43+ property var progressjsonProcessing: {
44+ "type": "progress",
45+ "source": { "dbus-name" : "somename", "dbus-object": "processing" }
46+ }
47+
4348 SignalSpy {
4449 id: spy
4550 signalName: "triggered"
@@ -82,6 +87,14 @@ Rectangle {
8287 compare(args[0], "previewProgress");
8388 compare(args[1], "failed");
8489 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);
8598 }
8699 }
87100}