Ubuntu Download Manager  0.3.0
A session-wide downloading service
 All Classes Namespaces Files Functions Typedefs Enumerations Enumerator
manager_pendingcall_watcher.h
Go to the documentation of this file.
1 /*
2  * Copyright 2013 Canonical Ltd.
3  *
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
6  * License as published by the Free Software Foundation.
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 GNU
11  * General Public License for more details.
12  *
13  * You should have received a copy of the GNU Lesser General Public
14  * License along with this library; if not, write to the
15  * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
16  * Boston, MA 02110-1301, USA.
17  */
18 
19 #ifndef UBUNTU_DOWNLOADMANAGER_CLIENT_MANAGER_PENDINGCALL_WATCHER_H
20 #define UBUNTU_DOWNLOADMANAGER_CLIENT_MANAGER_PENDINGCALL_WATCHER_H
21 
22 #include <functional>
23 #include "pending_call_watcher.h"
24 
25 namespace Ubuntu {
26 
27 namespace DownloadManager {
28 
29 class Download;
30 class DownloadsList;
31 class Error;
32 class GroupDownload;
33 
34 typedef std::function<void(Download*)> DownloadCb;
35 typedef std::function<void(DownloadsList*)> DownloadsListCb;
36 typedef std::function<void(const QString&, const QString&, DownloadsList*)> MetadataDownloadsListCb;
37 typedef std::function<void(GroupDownload*)> GroupCb;
38 
39 
40 class DownloadManagerPCW : public PendingCallWatcher {
41  Q_OBJECT
42 
43  public:
44  DownloadManagerPCW(const QDBusConnection& conn,
45  const QString& servicePath,
46  const QDBusPendingCall& call,
47  DownloadCb cb,
48  DownloadCb errCb,
49  QObject* parent = 0);
50 
51  private slots:
52  void onFinished(QDBusPendingCallWatcher* watcher);
53 
54  private:
55  DownloadCb _cb;
56  DownloadCb _errCb;
57 };
58 
59 
60 class DownloadsListManagerPCW : public PendingCallWatcher {
61  Q_OBJECT
62 
63  public:
64  DownloadsListManagerPCW(const QDBusConnection& conn,
65  const QString& servicePath,
66  const QDBusPendingCall& call,
67  DownloadsListCb cb,
68  DownloadsListCb errCb,
69  QObject* parent = 0);
70  private slots:
71  void onFinished(QDBusPendingCallWatcher* watcher);
72 
73  private:
74  DownloadsListCb _cb;
75  DownloadsListCb _errCb;
76 };
77 
78 class MetadataDownloadsListManagerPCW : public PendingCallWatcher {
79  Q_OBJECT
80 
81  public:
82  MetadataDownloadsListManagerPCW(const QDBusConnection& conn,
83  const QString& servicePath,
84  const QDBusPendingCall& call,
85  const QString& key,
86  const QString& value,
89  QObject* parent = 0);
90  private slots:
91  void onFinished(QDBusPendingCallWatcher* watcher);
92 
93  private:
94  const QString& _key;
95  const QString& _value;
98 };
99 
100 class GroupManagerPCW : public PendingCallWatcher {
101  Q_OBJECT
102 
103  public:
104  GroupManagerPCW(const QDBusConnection& conn,
105  const QString& servicePath,
106  const QDBusPendingCall& call,
107  GroupCb cb,
108  GroupCb errCb,
109  QObject* parent = 0);
110 
111  private slots:
112  void onFinished(QDBusPendingCallWatcher* watcher);
113 
114  private:
115  GroupCb _cb;
116  GroupCb _errCb;
117 };
118 
119 } // DownloadManager
120 
121 } // Ubuntu
122 
123 #endif // UBUNTU_DOWNLOADMANAGER_CLIENT_MANAGER_PENDINGCALL_WATCHER_H
std::function< void(Download *)> DownloadCb
Definition: manager.h:37
std::function< void(const QString &, const QString &, DownloadsList *)> MetadataDownloadsListCb
Definition: manager.h:55
std::function< void(GroupDownload *)> GroupCb
Definition: manager.h:61
std::function< void(DownloadsList *)> DownloadsListCb
Definition: manager.h:49