Lomiri
Loading...
Searching...
No Matches
DownloadTracker.h
1/*
2 * Copyright (C) 2013-2016 Canonical Ltd.
3 *
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
6 * published by the Free Software Foundation; either version 2.1 or 3.0
7 * of the License.
8 *
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranties of
11 * MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR
12 * PURPOSE. See the applicable version of the GNU Lesser General Public
13 * License for more details.
14 *
15 * You should have received a copy of both the GNU Lesser General Public
16 * License along with this program. If not, see <http://www.gnu.org/licenses/>
17 *
18 * Authored by: Diego Sarmentero <diego.sarmentero@canonical.com>
19 */
20
21
22#ifndef DOWNLOADTRACKER_H
23#define DOWNLOADTRACKER_H
24
25#include <interface/downloadtrackeradaptor.h>
26
27#include <QObject>
28#include <QDBusObjectPath>
29
30class DownloadTracker : public QObject
31{
32 Q_OBJECT
33 Q_DISABLE_COPY(DownloadTracker)
34 Q_PROPERTY(QString service READ service WRITE setService NOTIFY serviceChanged)
35 Q_PROPERTY(QString dbusPath READ dbusPath WRITE setDbusPath NOTIFY dbusPathChanged)
36 Q_PROPERTY(bool serviceReady READ isServiceReady NOTIFY serviceReadyChanged)
37
38public:
39 explicit DownloadTracker(QObject *parent = 0);
40
41 QString service() const;
42 QString dbusPath() const;
43 bool isServiceReady() const;
44
45 void setDbusPath(const QString& path);
46 void setService(const QString& service);
47
48Q_SIGNALS:
49 void serviceChanged(const QString &service);
50 void dbusPathChanged(const QString &dbusPath);
51 void serviceReadyChanged(const bool serviceReady);
52
53 void canceled(bool success);
54 void error(const QString &error);
55 void finished(const QString &path);
56 void paused(bool success);
57 void processing(const QString &path);
58 void progress(qulonglong received, qulonglong total);
59 void resumed(bool success);
60 void started(bool success);
61
62private:
63 QString m_dbusPath;
64 QString m_service;
65 DownloadTrackerAdaptor* m_adaptor;
66
67 void startService();
68};
69
70#endif // DOWNLOADTRACKER_H