Merge lp:~mandel/ubuntu-download-manager/add-mng-class into lp:ubuntu-download-manager
- add-mng-class
- Merge into trunk
Status: | Merged |
---|---|
Merged at revision: | 276 |
Proposed branch: | lp:~mandel/ubuntu-download-manager/add-mng-class |
Merge into: | lp:ubuntu-download-manager |
Prerequisite: | lp:~mandel/ubuntu-download-manager/add-factory |
Diff against target: |
364 lines (+178/-47) 5 files modified
ubuntu-upload-manager-priv/ubuntu/uploads/daemon.cpp (+4/-4) ubuntu-upload-manager-priv/ubuntu/uploads/daemon.h (+4/-4) ubuntu-upload-manager-priv/ubuntu/uploads/file_upload.cpp (+10/-2) ubuntu-upload-manager-priv/ubuntu/uploads/manager.cpp (+131/-35) ubuntu-upload-manager-priv/ubuntu/uploads/manager.h (+29/-2) |
To merge this branch: | bzr merge lp:~mandel/ubuntu-download-manager/add-mng-class |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
PS Jenkins bot | continuous-integration | Approve | |
Ubuntu One hackers | Pending | ||
Review via email:
|
Commit message
Add uploads manager implementation.
Description of the change
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
- 318. By Manuel de la Peña
-
Merged add-factory into add-mng-class.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:317
http://
Executed test runs:
SUCCESS: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:318
http://
Executed test runs:
SUCCESS: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
- 319. By Manuel de la Peña
-
Merged add-factory into add-mng-class.
- 320. By Manuel de la Peña
-
Merged add-factory into add-mng-class.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:319
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:320
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
- 321. By Manuel de la Peña
-
Merged add-factory into add-mng-class.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:321
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
- 322. By Manuel de la Peña
-
Merged add-factory into add-mng-class.
- 323. By Manuel de la Peña
-
Merged add-factory into add-mng-class.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:322
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:323
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
- 324. By Manuel de la Peña
-
Merged add-factory into add-mng-class.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:324
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
- 325. By Manuel de la Peña
-
Merged add-factory into add-mng-class.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:325
http://
Executed test runs:
SUCCESS: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
- 326. By Manuel de la Peña
-
Merged add-factory into add-mng-class.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:326
http://
Executed test runs:
SUCCESS: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
- 327. By Manuel de la Peña
-
Merged add-factory into add-mng-class.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:327
http://
Executed test runs:
SUCCESS: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
- 328. By Manuel de la Peña
-
Merged add-factory into add-mng-class.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:328
http://
Executed test runs:
SUCCESS: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
- 329. By Manuel de la Peña
-
Merged add-factory into add-mng-class.
- 330. By Manuel de la Peña
-
Merged add-factory into add-mng-class.
- 331. By Manuel de la Peña
-
Merged add-factory into add-mng-class.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:331
http://
Executed test runs:
SUCCESS: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
- 332. By Manuel de la Peña
-
Merged add-factory into add-mng-class.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:332
http://
Executed test runs:
SUCCESS: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
- 333. By Manuel de la Peña
-
Merged add-factory into add-mng-class.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:333
http://
Executed test runs:
SUCCESS: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
- 334. By Manuel de la Peña
-
Merged add-factory into add-mng-class.
- 335. By Manuel de la Peña
-
Merged add-factory into add-mng-class.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:334
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:334
http://
Executed test runs:
FAILURE: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 336. By Manuel de la Peña
-
Merged add-factory into add-mng-class.
- 337. By Manuel de la Peña
-
Merged add-factory into add-mng-class.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:337
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 338. By Manuel de la Peña
-
Merged add-factory into add-mng-class.
- 339. By Manuel de la Peña
-
Merged add-factory into add-mng-class.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:339
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Preview Diff
1 | === modified file 'ubuntu-upload-manager-priv/ubuntu/uploads/daemon.cpp' | |||
2 | --- ubuntu-upload-manager-priv/ubuntu/uploads/daemon.cpp 2014-04-15 15:31:31 +0000 | |||
3 | +++ ubuntu-upload-manager-priv/ubuntu/uploads/daemon.cpp 2014-04-15 15:31:32 +0000 | |||
4 | @@ -36,10 +36,10 @@ | |||
5 | 36 | } | 36 | } |
6 | 37 | 37 | ||
7 | 38 | UploadDaemon::UploadDaemon(ManagerFactory* managerFactory, | 38 | UploadDaemon::UploadDaemon(ManagerFactory* managerFactory, |
12 | 39 | System::Application* app, | 39 | System::Application* app, |
13 | 40 | System::DBusConnection* conn, | 40 | System::DBusConnection* conn, |
14 | 41 | System::Timer* timer, | 41 | System::Timer* timer, |
15 | 42 | QObject *parent) | 42 | QObject *parent) |
16 | 43 | : BaseDaemon(managerFactory, | 43 | : BaseDaemon(managerFactory, |
17 | 44 | new UploadAdaptorFactory(), | 44 | new UploadAdaptorFactory(), |
18 | 45 | app, conn, timer, parent) { | 45 | app, conn, timer, parent) { |
19 | 46 | 46 | ||
20 | === modified file 'ubuntu-upload-manager-priv/ubuntu/uploads/daemon.h' | |||
21 | --- ubuntu-upload-manager-priv/ubuntu/uploads/daemon.h 2014-04-15 15:31:31 +0000 | |||
22 | +++ ubuntu-upload-manager-priv/ubuntu/uploads/daemon.h 2014-04-15 15:31:32 +0000 | |||
23 | @@ -35,10 +35,10 @@ | |||
24 | 35 | public: | 35 | public: |
25 | 36 | UploadDaemon(QObject *parent = 0); | 36 | UploadDaemon(QObject *parent = 0); |
26 | 37 | UploadDaemon(ManagerFactory* managerFactory, | 37 | UploadDaemon(ManagerFactory* managerFactory, |
31 | 38 | System::Application* app, | 38 | System::Application* app, |
32 | 39 | System::DBusConnection* conn, | 39 | System::DBusConnection* conn, |
33 | 40 | System::Timer* timer, | 40 | System::Timer* timer, |
34 | 41 | QObject *parent = 0); | 41 | QObject *parent = 0); |
35 | 42 | 42 | ||
36 | 43 | public slots: | 43 | public slots: |
37 | 44 | virtual void start(); | 44 | virtual void start(); |
38 | 45 | 45 | ||
39 | === modified file 'ubuntu-upload-manager-priv/ubuntu/uploads/file_upload.cpp' | |||
40 | --- ubuntu-upload-manager-priv/ubuntu/uploads/file_upload.cpp 2014-04-15 15:31:31 +0000 | |||
41 | +++ ubuntu-upload-manager-priv/ubuntu/uploads/file_upload.cpp 2014-04-15 15:31:32 +0000 | |||
42 | @@ -56,10 +56,18 @@ | |||
43 | 56 | // we must make sure that the path is absolute | 56 | // we must make sure that the path is absolute |
44 | 57 | QFileInfo info(filePath); | 57 | QFileInfo info(filePath); |
45 | 58 | if (!info.isAbsolute()) { | 58 | if (!info.isAbsolute()) { |
46 | 59 | UP_LOG(INFO) << "Path is not absolute: " << filePath; | ||
47 | 59 | setIsValid(false); | 60 | setIsValid(false); |
48 | 60 | setLastError(QString("Path is not absolute: '%1'").arg(filePath)); | 61 | setLastError(QString("Path is not absolute: '%1'").arg(filePath)); |
49 | 61 | } | 62 | } |
51 | 62 | _currentData = FileManager::instance()->copyToTempFile(filePath); | 63 | |
52 | 64 | if (!info.exists()) { | ||
53 | 65 | UP_LOG(INFO) << "Path does not exist: " << filePath; | ||
54 | 66 | setIsValid(false); | ||
55 | 67 | setLastError(QString("Path does not exist: '%1'").arg(filePath)); | ||
56 | 68 | } else { | ||
57 | 69 | _currentData = FileManager::instance()->createFile(filePath); | ||
58 | 70 | } | ||
59 | 63 | _requestFactory = RequestFactory::instance(); | 71 | _requestFactory = RequestFactory::instance(); |
60 | 64 | } | 72 | } |
61 | 65 | 73 | ||
62 | @@ -181,7 +189,7 @@ | |||
63 | 181 | request.setHeader(QNetworkRequest::ContentTypeHeader, | 189 | request.setHeader(QNetworkRequest::ContentTypeHeader, |
64 | 182 | CONTENT_TYPE_HEADER); | 190 | CONTENT_TYPE_HEADER); |
65 | 183 | request.setHeader(QNetworkRequest::ContentLengthHeader, | 191 | request.setHeader(QNetworkRequest::ContentLengthHeader, |
67 | 184 | QString::number(_currentData->size())); | 192 | _currentData->size()); |
68 | 185 | 193 | ||
69 | 186 | return request; | 194 | return request; |
70 | 187 | } | 195 | } |
71 | 188 | 196 | ||
72 | === modified file 'ubuntu-upload-manager-priv/ubuntu/uploads/manager.cpp' | |||
73 | --- ubuntu-upload-manager-priv/ubuntu/uploads/manager.cpp 2014-04-15 15:31:31 +0000 | |||
74 | +++ ubuntu-upload-manager-priv/ubuntu/uploads/manager.cpp 2014-04-15 15:31:32 +0000 | |||
75 | @@ -16,6 +16,12 @@ | |||
76 | 16 | * Boston, MA 02110-1301, USA. | 16 | * Boston, MA 02110-1301, USA. |
77 | 17 | */ | 17 | */ |
78 | 18 | 18 | ||
79 | 19 | #include <functional> | ||
80 | 20 | #include <QRegExp> | ||
81 | 21 | #include <ubuntu/transfers/system/apparmor.h> | ||
82 | 22 | #include <ubuntu/transfers/system/logger.h> | ||
83 | 23 | #include <ubuntu/transfers/system/request_factory.h> | ||
84 | 24 | #include <ubuntu/upload_manager/metatypes.h> | ||
85 | 19 | #include "manager.h" | 25 | #include "manager.h" |
86 | 20 | 26 | ||
87 | 21 | namespace Ubuntu { | 27 | namespace Ubuntu { |
88 | @@ -33,40 +39,89 @@ | |||
89 | 33 | DBusConnection* connection, | 39 | DBusConnection* connection, |
90 | 34 | bool stoppable, | 40 | bool stoppable, |
91 | 35 | QObject *parent) | 41 | QObject *parent) |
94 | 36 | : BaseManager(app, stoppable, parent) { | 42 | : BaseManager(app, stoppable, parent), |
95 | 37 | Q_UNUSED(connection); | 43 | _throttle(0) { |
96 | 44 | _conn = connection; | ||
97 | 45 | RequestFactory::setStoppable(_stoppable); | ||
98 | 46 | _factory = new Factory(this); | ||
99 | 47 | _queue = new Queue(this); | ||
100 | 48 | init(); | ||
101 | 38 | } | 49 | } |
102 | 39 | 50 | ||
103 | 40 | /* | ||
104 | 41 | UploadManager::UploadManager(Application* app, | 51 | UploadManager::UploadManager(Application* app, |
105 | 42 | DBusConnection* connection, | 52 | DBusConnection* connection, |
107 | 43 | Factory* downloadFactory, | 53 | Factory* uploadFactory, |
108 | 44 | Queue* queue, | 54 | Queue* queue, |
109 | 45 | bool stoppable, | 55 | bool stoppable, |
113 | 46 | QObject *parent) { | 56 | QObject *parent) |
114 | 47 | } | 57 | : BaseManager(app, stoppable, parent), |
115 | 48 | */ | 58 | _throttle(0), |
116 | 59 | _factory(uploadFactory), | ||
117 | 60 | _queue(queue) { | ||
118 | 61 | _conn = connection; | ||
119 | 62 | init(); | ||
120 | 63 | } | ||
121 | 64 | |||
122 | 65 | void | ||
123 | 66 | UploadManager::init() { | ||
124 | 67 | // register the required types | ||
125 | 68 | qDBusRegisterMetaType<StringMap>(); | ||
126 | 69 | qDBusRegisterMetaType<UploadStruct>(); | ||
127 | 70 | qDBusRegisterMetaType<AuthErrorStruct>(); | ||
128 | 71 | qDBusRegisterMetaType<HttpErrorStruct>(); | ||
129 | 72 | qDBusRegisterMetaType<NetworkErrorStruct>(); | ||
130 | 73 | qDBusRegisterMetaType<ProcessErrorStruct>(); | ||
131 | 74 | |||
132 | 75 | connect(_queue, &Queue::transferRemoved, | ||
133 | 76 | this, &UploadManager::onUploadsChanged); | ||
134 | 77 | connect(_queue, &Queue::transferAdded, | ||
135 | 78 | this, &UploadManager::onUploadsChanged); | ||
136 | 79 | } | ||
137 | 49 | 80 | ||
138 | 50 | UploadManager::~UploadManager() { | 81 | UploadManager::~UploadManager() { |
139 | 82 | delete _queue; | ||
140 | 83 | delete _factory; | ||
141 | 51 | } | 84 | } |
142 | 52 | 85 | ||
143 | 53 | QList<QSslCertificate> | 86 | QList<QSslCertificate> |
144 | 54 | UploadManager::acceptedCertificates() { | 87 | UploadManager::acceptedCertificates() { |
148 | 55 | // TODO: Most be implemented | 88 | return _factory->acceptedCertificates(); |
146 | 56 | QList<QSslCertificate> certs; | ||
147 | 57 | return certs; | ||
149 | 58 | } | 89 | } |
150 | 59 | 90 | ||
151 | 60 | void | 91 | void |
152 | 61 | UploadManager::setAcceptedCertificates(const QList<QSslCertificate>& certs) { | 92 | UploadManager::setAcceptedCertificates(const QList<QSslCertificate>& certs) { |
155 | 62 | // TODO: Most be implemented | 93 | LOG(INFO) << __PRETTY_FUNCTION__; |
156 | 63 | Q_UNUSED(certs); | 94 | _factory->setAcceptedCertificates(certs); |
157 | 64 | } | 95 | } |
158 | 65 | 96 | ||
159 | 66 | void | 97 | void |
160 | 67 | UploadManager::allowMobileUpload(bool allowed) { | 98 | UploadManager::allowMobileUpload(bool allowed) { |
163 | 68 | // TODO: Most be implemented | 99 | _allowMobileData = allowed; |
164 | 69 | Q_UNUSED(allowed); | 100 | QHash<QString, Transfer*> uploads = _queue->transfers(); |
165 | 101 | foreach(const QString& path, uploads.keys()) { | ||
166 | 102 | uploads[path]->allowGSMData(allowed); | ||
167 | 103 | } | ||
168 | 104 | } | ||
169 | 105 | |||
170 | 106 | QDBusObjectPath | ||
171 | 107 | UploadManager::createUpload(UploadCreationFunc createUploadFunc) { | ||
172 | 108 | QString owner = ""; | ||
173 | 109 | |||
174 | 110 | auto wasCalledFromDBus = calledFromDBus(); | ||
175 | 111 | if (wasCalledFromDBus) { | ||
176 | 112 | owner = connection().interface()->serviceOwner( | ||
177 | 113 | message().service()); | ||
178 | 114 | LOG(INFO) << "Owner is: " << owner; | ||
179 | 115 | } | ||
180 | 116 | |||
181 | 117 | auto upload = createUploadFunc(owner); | ||
182 | 118 | |||
183 | 119 | if (wasCalledFromDBus && !upload->isValid()) { | ||
184 | 120 | sendErrorReply(QDBusError::InvalidArgs, upload->lastError()); | ||
185 | 121 | // the result will be ignored thanks to the sendErrorReply | ||
186 | 122 | return QDBusObjectPath(); | ||
187 | 123 | } | ||
188 | 124 | return registerUpload(upload); | ||
189 | 70 | } | 125 | } |
190 | 71 | 126 | ||
191 | 72 | QDBusObjectPath | 127 | QDBusObjectPath |
192 | @@ -76,27 +131,45 @@ | |||
193 | 76 | int port, | 131 | int port, |
194 | 77 | const QString& username, | 132 | const QString& username, |
195 | 78 | const QString& password) { | 133 | const QString& password) { |
211 | 79 | // TODO: Most be implemented | 134 | LOG(INFO) << "Create MMS upload == {url:" << url << " filePath: " |
212 | 80 | Q_UNUSED(url); | 135 | << file << " hostname:" << hostname << " port:" |
213 | 81 | Q_UNUSED(file); | 136 | << port << " username:" << username << " pwd: " << password << "}"; |
214 | 82 | Q_UNUSED(hostname); | 137 | UploadCreationFunc createUploadFunc = |
215 | 83 | Q_UNUSED(port); | 138 | [this, url, file, hostname, port, username, password](QString owner) { |
216 | 84 | Q_UNUSED(username); | 139 | auto upload = _factory->createMmsUpload(owner, url, file, hostname, |
217 | 85 | Q_UNUSED(password); | 140 | port, username, password); |
218 | 86 | return QDBusObjectPath(); | 141 | return upload; |
219 | 87 | } | 142 | }; |
220 | 88 | 143 | return createUpload(createUploadFunc); | |
221 | 89 | QDBusObjectPath | 144 | } |
222 | 90 | UploadManager::createUpload(UploadStruct upload) { | 145 | |
223 | 91 | // TODO: Most be implemented | 146 | QDBusObjectPath |
224 | 92 | Q_UNUSED(upload); | 147 | UploadManager::createUpload(const QString& url, |
225 | 93 | return QDBusObjectPath(); | 148 | const QString& filePath, |
226 | 149 | const QVariantMap& metadata, | ||
227 | 150 | StringMap headers) { | ||
228 | 151 | |||
229 | 152 | LOG(INFO) << "Create upload == {url:" << url << " filePath: " | ||
230 | 153 | << filePath << " metadata: " << metadata << " headers: " | ||
231 | 154 | << headers << "}"; | ||
232 | 155 | UploadCreationFunc createUploadFunc = | ||
233 | 156 | [this, url, filePath, metadata, headers](QString owner) { | ||
234 | 157 | return _factory->createUpload(owner, url, filePath, | ||
235 | 158 | metadata, headers); | ||
236 | 159 | }; | ||
237 | 160 | return createUpload(createUploadFunc); | ||
238 | 161 | } | ||
239 | 162 | |||
240 | 163 | QDBusObjectPath | ||
241 | 164 | UploadManager::createUpload(UploadStruct uploadStruct) { | ||
242 | 165 | return createUpload(uploadStruct.getUrl(), | ||
243 | 166 | uploadStruct.getFilePath(), uploadStruct.getMetadata(), | ||
244 | 167 | uploadStruct.getHeaders()); | ||
245 | 94 | } | 168 | } |
246 | 95 | 169 | ||
247 | 96 | qulonglong | 170 | qulonglong |
248 | 97 | UploadManager::defaultThrottle() { | 171 | UploadManager::defaultThrottle() { |
251 | 98 | // TODO: Most be implemented | 172 | return _throttle; |
250 | 99 | return 0; | ||
252 | 100 | } | 173 | } |
253 | 101 | 174 | ||
254 | 102 | QList<QDBusObjectPath> | 175 | QList<QDBusObjectPath> |
255 | @@ -118,14 +191,37 @@ | |||
256 | 118 | 191 | ||
257 | 119 | bool | 192 | bool |
258 | 120 | UploadManager::isMobileUploadAllowed() { | 193 | UploadManager::isMobileUploadAllowed() { |
261 | 121 | // TODO: Most be implemented | 194 | return _allowMobileData; |
260 | 122 | return false; | ||
262 | 123 | } | 195 | } |
263 | 124 | 196 | ||
264 | 125 | void | 197 | void |
265 | 126 | UploadManager::setDefaultThrottle(qulonglong speed) { | 198 | UploadManager::setDefaultThrottle(qulonglong speed) { |
268 | 127 | // TODO: Most be implemented | 199 | _throttle = speed; |
269 | 128 | Q_UNUSED(speed); | 200 | QHash<QString, Transfer*> uploads = _queue->transfers(); |
270 | 201 | foreach(const QString& path, uploads.keys()) { | ||
271 | 202 | uploads[path]->setThrottle(speed); | ||
272 | 203 | } | ||
273 | 204 | } | ||
274 | 205 | |||
275 | 206 | void | ||
276 | 207 | UploadManager::onUploadsChanged(QString path) { | ||
277 | 208 | LOG(INFO) << __PRETTY_FUNCTION__ << path; | ||
278 | 209 | emit sizeChanged(_queue->size()); | ||
279 | 210 | } | ||
280 | 211 | |||
281 | 212 | QDBusObjectPath | ||
282 | 213 | UploadManager::registerUpload(FileUpload* upload) { | ||
283 | 214 | LOG(INFO) << "Registering upload to path " << upload->path(); | ||
284 | 215 | upload->setThrottle(_throttle); | ||
285 | 216 | upload->allowMobileUpload(_allowMobileData); | ||
286 | 217 | _queue->add(upload); | ||
287 | 218 | _conn->registerObject(upload->path(), upload); | ||
288 | 219 | QDBusObjectPath objectPath = QDBusObjectPath(upload->path()); | ||
289 | 220 | |||
290 | 221 | // emit that the upload was created. Useful in case other | ||
291 | 222 | // processes are interested in them | ||
292 | 223 | emit uploadCreated(objectPath); | ||
293 | 224 | return objectPath; | ||
294 | 129 | } | 225 | } |
295 | 130 | 226 | ||
296 | 131 | } // Daemon | 227 | } // Daemon |
297 | 132 | 228 | ||
298 | === modified file 'ubuntu-upload-manager-priv/ubuntu/uploads/manager.h' | |||
299 | --- ubuntu-upload-manager-priv/ubuntu/uploads/manager.h 2014-04-15 15:31:31 +0000 | |||
300 | +++ ubuntu-upload-manager-priv/ubuntu/uploads/manager.h 2014-04-15 15:31:32 +0000 | |||
301 | @@ -28,6 +28,7 @@ | |||
302 | 28 | #include <ubuntu/transfers/system/dbus_connection.h> | 28 | #include <ubuntu/transfers/system/dbus_connection.h> |
303 | 29 | #include <ubuntu/transfers/queue.h> | 29 | #include <ubuntu/transfers/queue.h> |
304 | 30 | #include <ubuntu/transfers/base_manager.h> | 30 | #include <ubuntu/transfers/base_manager.h> |
305 | 31 | #include "factory.h" | ||
306 | 31 | 32 | ||
307 | 32 | namespace Ubuntu { | 33 | namespace Ubuntu { |
308 | 33 | 34 | ||
309 | @@ -45,13 +46,13 @@ | |||
310 | 45 | DBusConnection* connection, | 46 | DBusConnection* connection, |
311 | 46 | bool stoppable = false, | 47 | bool stoppable = false, |
312 | 47 | QObject *parent = 0); | 48 | QObject *parent = 0); |
314 | 48 | /* UploadManager(Application* app, | 49 | UploadManager(Application* app, |
315 | 49 | DBusConnection* connection, | 50 | DBusConnection* connection, |
316 | 50 | Factory* downloadFactory, | 51 | Factory* downloadFactory, |
317 | 51 | Queue* queue, | 52 | Queue* queue, |
318 | 52 | bool stoppable = false, | 53 | bool stoppable = false, |
319 | 53 | QObject *parent = 0); | 54 | QObject *parent = 0); |
321 | 54 | */ | 55 | |
322 | 55 | virtual ~UploadManager(); | 56 | virtual ~UploadManager(); |
323 | 56 | 57 | ||
324 | 57 | virtual QList<QSslCertificate> acceptedCertificates(); | 58 | virtual QList<QSslCertificate> acceptedCertificates(); |
325 | @@ -66,6 +67,10 @@ | |||
326 | 66 | int port, | 67 | int port, |
327 | 67 | const QString& username, | 68 | const QString& username, |
328 | 68 | const QString& password); | 69 | const QString& password); |
329 | 70 | QDBusObjectPath createUpload(const QString& url, | ||
330 | 71 | const QString& filePath, | ||
331 | 72 | const QVariantMap& metadata, | ||
332 | 73 | StringMap headers); | ||
333 | 69 | QDBusObjectPath createUpload(UploadStruct upload); | 74 | QDBusObjectPath createUpload(UploadStruct upload); |
334 | 70 | qulonglong defaultThrottle(); | 75 | qulonglong defaultThrottle(); |
335 | 71 | QList<QDBusObjectPath> getAllUploads(); | 76 | QList<QDBusObjectPath> getAllUploads(); |
336 | @@ -75,6 +80,28 @@ | |||
337 | 75 | bool isMobileUploadAllowed(); | 80 | bool isMobileUploadAllowed(); |
338 | 76 | void setDefaultThrottle(qulonglong speed); | 81 | void setDefaultThrottle(qulonglong speed); |
339 | 77 | 82 | ||
340 | 83 | signals: | ||
341 | 84 | void uploadCreated(const QDBusObjectPath& path); | ||
342 | 85 | void sizeChanged(int size); | ||
343 | 86 | |||
344 | 87 | private: | ||
345 | 88 | typedef std::function<FileUpload*(QString)> UploadCreationFunc; | ||
346 | 89 | |||
347 | 90 | QDBusObjectPath createUpload(UploadCreationFunc createUploadFunc); | ||
348 | 91 | void onUploadsChanged(QString); | ||
349 | 92 | QDBusObjectPath registerUpload(FileUpload* upload); | ||
350 | 93 | |||
351 | 94 | void init(); | ||
352 | 95 | |||
353 | 96 | |||
354 | 97 | private: | ||
355 | 98 | Application* _app = nullptr; | ||
356 | 99 | qulonglong _throttle; | ||
357 | 100 | Factory* _factory = nullptr; | ||
358 | 101 | Queue* _queue = nullptr; | ||
359 | 102 | DBusConnection* _conn = nullptr; | ||
360 | 103 | bool _stoppable = false; | ||
361 | 104 | bool _allowMobileData = true; | ||
362 | 78 | }; | 105 | }; |
363 | 79 | 106 | ||
364 | 80 | } // Daemon | 107 | } // Daemon |
FAILED: Continuous integration, rev:317 jenkins. qa.ubuntu. com/job/ ubuntu- download- manager- ci/390/ jenkins. qa.ubuntu. com/job/ ubuntu- download- manager- trusty- amd64-ci/ 279/console jenkins. qa.ubuntu. com/job/ ubuntu- download- manager- trusty- armhf-ci/ 279/console
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild: s-jenkins. ubuntu- ci:8080/ job/ubuntu- download- manager- ci/390/ rebuild
http://