Merge lp:~ken-vandine/content-hub/quiet_logging into lp:content-hub
- quiet_logging
- Merge into trunk
Status: | Merged |
---|---|
Approved by: | Ken VanDine |
Approved revision: | 139 |
Merged at revision: | 77 |
Proposed branch: | lp:~ken-vandine/content-hub/quiet_logging |
Merge into: | lp:content-hub |
Prerequisite: | lp:~michael-sheldon/content-hub/peer_picker_ui |
Diff against target: |
2281 lines (+378/-245) 32 files modified
CMakeLists.txt (+2/-0) debian/changelog (+10/-0) import/Ubuntu/Content/CMakeLists.txt (+1/-0) import/Ubuntu/Content/contenthandler.cpp (+2/-3) import/Ubuntu/Content/contenthub.cpp (+18/-12) import/Ubuntu/Content/contenthubplugin.cpp (+4/-3) import/Ubuntu/Content/contenticonprovider.cpp (+4/-5) import/Ubuntu/Content/contentitem.cpp (+8/-9) import/Ubuntu/Content/contentpeer.cpp (+16/-16) import/Ubuntu/Content/contentpeermodel.cpp (+9/-10) import/Ubuntu/Content/contentscope.cpp (+3/-4) import/Ubuntu/Content/contentstore.cpp (+8/-9) import/Ubuntu/Content/contenttransfer.cpp (+21/-22) import/Ubuntu/Content/contenttype.cpp (+3/-4) import/Ubuntu/Content/qmlimportexporthandler.cpp (+5/-6) src/com/ubuntu/content/CMakeLists.txt (+1/-0) src/com/ubuntu/content/debug.cpp (+26/-0) src/com/ubuntu/content/debug.h (+53/-0) src/com/ubuntu/content/detail/app_manager.cpp (+3/-3) src/com/ubuntu/content/detail/handler.cpp (+9/-9) src/com/ubuntu/content/detail/service.cpp (+63/-55) src/com/ubuntu/content/detail/transfer.cpp (+21/-22) src/com/ubuntu/content/hub.cpp (+17/-6) src/com/ubuntu/content/peer.cpp (+4/-4) src/com/ubuntu/content/service/CMakeLists.txt (+1/-0) src/com/ubuntu/content/service/helper.cpp (+12/-1) src/com/ubuntu/content/service/hook.cpp (+7/-7) src/com/ubuntu/content/service/main.cpp (+15/-4) src/com/ubuntu/content/service/registry.cpp (+21/-20) src/com/ubuntu/content/service/registry.h (+0/-1) src/com/ubuntu/content/transfer.cpp (+1/-1) src/com/ubuntu/content/utils.cpp (+10/-9) |
To merge this branch: | bzr merge lp:~ken-vandine/content-hub/quiet_logging |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Michael Sheldon (community) | Approve | ||
PS Jenkins bot | continuous-integration | Approve | |
Review via email: mp+211556@code.launchpad.net |
Commit message
Make debugging output optional based on CONTENT_
Description of the change
Make debugging output optional based on CONTENT_
PS Jenkins bot (ps-jenkins) wrote : | # |
Ken VanDine (ken-vandine) wrote : | # |
Are there any related MPs required for this MP to build/function as expected?
* No (besides the prerequisite branch included)
Is your branch in sync with latest trunk
* Yes
Did you perform an exploratory manual test run of your code change and any related functionality on device or emulator?
* Yes
Did you successfully run all tests found in your component's Test Plan (https:/
* Yes
If you changed the UI, was the change specified/approved by design?
* No UI changes
If you changed the packaging (debian), did you subscribe a core-dev to this MP?
* No packaging changes
- 139. By Ken VanDine
-
merged trunk
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:139
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Michael Sheldon (michael-sheldon) wrote : | # |
Did you perform an exploratory manual test run of the code change and any related functionality on device or emulator?
* Yes, based on https:/
Did CI run pass? If not, please explain why.
* Yes
Have you checked that submitter has accurately filled out the submitter checklist and has taken no shortcut?
* Yes
- 140. By Ken VanDine
-
merged peer_picker_ui
- 141. By Ken VanDine
-
merged fix_pending_check
Preview Diff
1 | === modified file 'CMakeLists.txt' |
2 | --- CMakeLists.txt 2014-03-21 00:29:33 +0000 |
3 | +++ CMakeLists.txt 2014-03-21 00:29:34 +0000 |
4 | @@ -67,6 +67,8 @@ |
5 | pkg_check_modules(NIH_DBUS REQUIRED libnih-dbus) |
6 | pkg_check_modules(DBUS REQUIRED dbus-1) |
7 | |
8 | +add_definitions( -DDEBUG_ENABLED ) |
9 | + |
10 | set(CONTENT_HUB_VERSION_MAJOR 0) |
11 | set(CONTENT_HUB_VERSION_MINOR 0) |
12 | set(CONTENT_HUB_VERSION_PATCH 1) |
13 | |
14 | === modified file 'debian/changelog' |
15 | --- debian/changelog 2014-03-07 06:59:44 +0000 |
16 | +++ debian/changelog 2014-03-21 00:29:34 +0000 |
17 | @@ -16,6 +16,16 @@ |
18 | |
19 | -- Ubuntu daily release <ps-jenkins@lists.canonical.com> Thu, 06 Mar 2014 16:50:24 +0000 |
20 | |
21 | +content-hub (0.0+14.04.20140304-0preview1) trusty; urgency=medium |
22 | + |
23 | + * Support for more handler types, including sharing |
24 | + * Marshal peer details like name and icon from the service, so confined apps |
25 | + can show them. |
26 | + * Improved QML bindings |
27 | + * New ContentPeerPicker QML component |
28 | + |
29 | + -- Ken VanDine <ken.vandine@canonical.com> Mon, 27 Jan 2014 14:09:38 -0500 |
30 | + |
31 | content-hub (0.0+14.04.20131209.1-0ubuntu1) trusty; urgency=low |
32 | |
33 | [ Ken VanDine ] |
34 | |
35 | === modified file 'import/Ubuntu/Content/CMakeLists.txt' |
36 | --- import/Ubuntu/Content/CMakeLists.txt 2014-03-21 00:29:33 +0000 |
37 | +++ import/Ubuntu/Content/CMakeLists.txt 2014-03-21 00:29:34 +0000 |
38 | @@ -63,6 +63,7 @@ |
39 | contenttransfer.cpp |
40 | contenttype.cpp |
41 | qmlimportexporthandler.cpp |
42 | + ../../../src/com/ubuntu/content/debug.cpp |
43 | ) |
44 | |
45 | add_library(${PLUGIN} MODULE ${PLUGIN_SRC} ${PLUGIN_HDRS}) |
46 | |
47 | === modified file 'import/Ubuntu/Content/contenthandler.cpp' |
48 | --- import/Ubuntu/Content/contenthandler.cpp 2014-03-21 00:29:33 +0000 |
49 | +++ import/Ubuntu/Content/contenthandler.cpp 2014-03-21 00:29:34 +0000 |
50 | @@ -14,10 +14,9 @@ |
51 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
52 | */ |
53 | |
54 | +#include "../../../src/com/ubuntu/content/debug.h" |
55 | #include "contenthandler.h" |
56 | |
57 | -#include <QDebug> |
58 | - |
59 | /*! |
60 | \qmltype ContentHandler |
61 | \instantiates ContentHandler |
62 | @@ -41,5 +40,5 @@ |
63 | ContentHandler::ContentHandler(QObject *parent) |
64 | : QObject(parent) |
65 | { |
66 | - qDebug() << Q_FUNC_INFO; |
67 | + TRACE() << Q_FUNC_INFO; |
68 | } |
69 | |
70 | === modified file 'import/Ubuntu/Content/contenthub.cpp' |
71 | --- import/Ubuntu/Content/contenthub.cpp 2014-03-21 00:29:33 +0000 |
72 | +++ import/Ubuntu/Content/contenthub.cpp 2014-03-21 00:29:34 +0000 |
73 | @@ -14,6 +14,7 @@ |
74 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
75 | */ |
76 | |
77 | +#include "../../../src/com/ubuntu/content/debug.h" |
78 | #include "contenthub.h" |
79 | #include "contentpeer.h" |
80 | #include "contentstore.h" |
81 | @@ -26,7 +27,6 @@ |
82 | #include <com/ubuntu/content/type.h> |
83 | |
84 | #include <QStringList> |
85 | -#include <QDebug> |
86 | |
87 | /*! |
88 | * \qmltype ContentHub |
89 | @@ -117,7 +117,7 @@ |
90 | : QObject(parent), |
91 | m_hub(0) |
92 | { |
93 | - qDebug() << Q_FUNC_INFO; |
94 | + TRACE() << Q_FUNC_INFO; |
95 | m_hub = cuc::Hub::Client::instance(); |
96 | m_handler = new QmlImportExportHandler(this); |
97 | m_hub->register_import_export_handler(m_handler); |
98 | @@ -132,7 +132,7 @@ |
99 | |
100 | ContentHub *ContentHub::instance() |
101 | { |
102 | - qDebug() << Q_FUNC_INFO; |
103 | + TRACE() << Q_FUNC_INFO; |
104 | static ContentHub *contentHub = new ContentHub(nullptr); |
105 | return contentHub; |
106 | } |
107 | @@ -145,7 +145,7 @@ |
108 | */ |
109 | ContentTransfer* ContentHub::importContent(cuc::Peer peer) |
110 | { |
111 | - qDebug() << Q_FUNC_INFO; |
112 | + TRACE() << Q_FUNC_INFO; |
113 | |
114 | cuc::Transfer *hubTransfer = m_hub->create_import_from_peer(peer); |
115 | ContentTransfer *qmlTransfer = new ContentTransfer(this); |
116 | @@ -162,7 +162,7 @@ |
117 | */ |
118 | ContentTransfer* ContentHub::exportContent(cuc::Peer peer) |
119 | { |
120 | - qDebug() << Q_FUNC_INFO; |
121 | + TRACE() << Q_FUNC_INFO; |
122 | |
123 | cuc::Transfer *hubTransfer = m_hub->create_export_to_peer(peer); |
124 | ContentTransfer *qmlTransfer = new ContentTransfer(this); |
125 | @@ -179,7 +179,7 @@ |
126 | */ |
127 | ContentTransfer* ContentHub::shareContent(cuc::Peer peer) |
128 | { |
129 | - qDebug() << Q_FUNC_INFO; |
130 | + TRACE() << Q_FUNC_INFO; |
131 | |
132 | cuc::Transfer *hubTransfer = m_hub->create_share_to_peer(peer); |
133 | ContentTransfer *qmlTransfer = new ContentTransfer(this); |
134 | @@ -194,7 +194,7 @@ |
135 | */ |
136 | void ContentHub::restoreImports() |
137 | { |
138 | - qDebug() << Q_FUNC_INFO; |
139 | + TRACE() << Q_FUNC_INFO; |
140 | } |
141 | |
142 | /*! |
143 | @@ -203,7 +203,7 @@ |
144 | */ |
145 | QQmlListProperty<ContentTransfer> ContentHub::finishedImports() |
146 | { |
147 | - qDebug() << Q_FUNC_INFO; |
148 | + TRACE() << Q_FUNC_INFO; |
149 | return QQmlListProperty<ContentTransfer>(this, m_finishedImports); |
150 | } |
151 | |
152 | @@ -213,7 +213,7 @@ |
153 | */ |
154 | void ContentHub::handleImport(com::ubuntu::content::Transfer *transfer) |
155 | { |
156 | - qDebug() << Q_FUNC_INFO; |
157 | + TRACE() << Q_FUNC_INFO; |
158 | ContentTransfer *qmlTransfer = nullptr; |
159 | if (m_activeImports.contains(transfer)) { |
160 | qmlTransfer = m_activeImports.take(transfer); |
161 | @@ -229,6 +229,12 @@ |
162 | Q_EMIT importRequested(qmlTransfer); |
163 | } |
164 | |
165 | + |
166 | + |
167 | + // FIXME: maybe we need to emit something else here |
168 | +// if (qmlTransfer->state() == ContentTransfer::Charged) |
169 | +// Q_EMIT importRequested(qmlTransfer); |
170 | + |
171 | m_finishedImports.append(qmlTransfer); |
172 | Q_EMIT finishedImportsChanged(); |
173 | } |
174 | @@ -239,7 +245,7 @@ |
175 | */ |
176 | void ContentHub::handleExport(com::ubuntu::content::Transfer *transfer) |
177 | { |
178 | - qDebug() << Q_FUNC_INFO; |
179 | + TRACE() << Q_FUNC_INFO; |
180 | ContentTransfer *qmlTransfer = nullptr; |
181 | if (m_activeImports.contains(transfer)) |
182 | qmlTransfer = m_activeImports.take(transfer); |
183 | @@ -264,7 +270,7 @@ |
184 | */ |
185 | void ContentHub::handleShare(com::ubuntu::content::Transfer *transfer) |
186 | { |
187 | - qDebug() << Q_FUNC_INFO; |
188 | + TRACE() << Q_FUNC_INFO; |
189 | ContentTransfer *qmlTransfer = nullptr; |
190 | if (m_activeImports.contains(transfer)) |
191 | { |
192 | @@ -287,7 +293,7 @@ |
193 | |
194 | void ContentHub::updateState() |
195 | { |
196 | - qDebug() << Q_FUNC_INFO; |
197 | + TRACE() << Q_FUNC_INFO; |
198 | } |
199 | |
200 | /*! |
201 | |
202 | === modified file 'import/Ubuntu/Content/contenthubplugin.cpp' |
203 | --- import/Ubuntu/Content/contenthubplugin.cpp 2014-03-21 00:29:33 +0000 |
204 | +++ import/Ubuntu/Content/contenthubplugin.cpp 2014-03-21 00:29:34 +0000 |
205 | @@ -15,6 +15,7 @@ |
206 | */ |
207 | |
208 | #include "contenthubplugin.h" |
209 | +#include "../../../src/com/ubuntu/content/debug.h" |
210 | |
211 | #include "contenthandler.h" |
212 | #include "contenthub.h" |
213 | @@ -40,7 +41,7 @@ |
214 | { |
215 | Q_UNUSED(engine) |
216 | Q_UNUSED(scriptEngine) |
217 | - qDebug() << Q_FUNC_INFO; |
218 | + TRACE() << Q_FUNC_INFO; |
219 | return ContentHub::instance(); |
220 | } |
221 | |
222 | @@ -50,7 +51,7 @@ |
223 | void ContentHubPlugin::initializeEngine(QQmlEngine * engine, const char * uri) |
224 | { |
225 | Q_UNUSED(uri) |
226 | - qDebug() << Q_FUNC_INFO; |
227 | + TRACE() << Q_FUNC_INFO; |
228 | QIcon::setThemeName("ubuntu-mobile"); |
229 | QIcon::setThemeSearchPaths(QStringList() << ("/usr/share/icons/")); |
230 | ContentIconProvider *iconProvider = ContentIconProvider::instance(); |
231 | @@ -62,7 +63,7 @@ |
232 | */ |
233 | void ContentHubPlugin::registerTypes(const char *uri) |
234 | { |
235 | - qDebug() << Q_FUNC_INFO; |
236 | + TRACE() << Q_FUNC_INFO; |
237 | Q_ASSERT(uri == QLatin1String("Ubuntu.Content")); |
238 | |
239 | const int versionMajor = 0; |
240 | |
241 | === modified file 'import/Ubuntu/Content/contenticonprovider.cpp' |
242 | --- import/Ubuntu/Content/contenticonprovider.cpp 2014-03-21 00:29:33 +0000 |
243 | +++ import/Ubuntu/Content/contenticonprovider.cpp 2014-03-21 00:29:34 +0000 |
244 | @@ -14,14 +14,13 @@ |
245 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
246 | */ |
247 | |
248 | +#include "../../../src/com/ubuntu/content/debug.h" |
249 | #include "contenticonprovider.h" |
250 | |
251 | -#include <QDebug> |
252 | - |
253 | ContentIconProvider::ContentIconProvider() |
254 | : QQuickImageProvider(QQuickImageProvider::Image) |
255 | { |
256 | - qDebug() << Q_FUNC_INFO; |
257 | + TRACE() << Q_FUNC_INFO; |
258 | |
259 | appIdImageMap = new QMap<QString, QImage>(); |
260 | } |
261 | @@ -39,7 +38,7 @@ |
262 | */ |
263 | void ContentIconProvider::addImage(QString appId, QImage image) |
264 | { |
265 | - qDebug() << Q_FUNC_INFO; |
266 | + TRACE() << Q_FUNC_INFO; |
267 | appIdImageMap->insert(appId, image); |
268 | } |
269 | |
270 | @@ -51,7 +50,7 @@ |
271 | QImage ContentIconProvider::requestImage(const QString &id, QSize *size, const QSize &requestedSize) |
272 | { |
273 | Q_UNUSED(requestedSize) |
274 | - qDebug() << Q_FUNC_INFO; |
275 | + TRACE() << Q_FUNC_INFO; |
276 | |
277 | QImage image = appIdImageMap->value(id); |
278 | if(size) { |
279 | |
280 | === modified file 'import/Ubuntu/Content/contentitem.cpp' |
281 | --- import/Ubuntu/Content/contentitem.cpp 2013-11-07 20:12:56 +0000 |
282 | +++ import/Ubuntu/Content/contentitem.cpp 2014-03-21 00:29:34 +0000 |
283 | @@ -15,8 +15,7 @@ |
284 | */ |
285 | |
286 | #include "contentitem.h" |
287 | - |
288 | -#include <QDebug> |
289 | +#include "../../../src/com/ubuntu/content/debug.h" |
290 | |
291 | /*! |
292 | * \qmltype ContentItem |
293 | @@ -34,7 +33,7 @@ |
294 | ContentItem::ContentItem(QObject *parent) |
295 | : QObject(parent) |
296 | { |
297 | - qDebug() << Q_FUNC_INFO; |
298 | + TRACE() << Q_FUNC_INFO; |
299 | } |
300 | |
301 | /*! |
302 | @@ -43,13 +42,13 @@ |
303 | */ |
304 | const QString &ContentItem::name() const |
305 | { |
306 | - qDebug() << Q_FUNC_INFO; |
307 | + TRACE() << Q_FUNC_INFO; |
308 | return m_name; |
309 | } |
310 | |
311 | void ContentItem::setName(const QString &name) |
312 | { |
313 | - qDebug() << Q_FUNC_INFO; |
314 | + TRACE() << Q_FUNC_INFO; |
315 | if (name == m_name) |
316 | return; |
317 | |
318 | @@ -64,13 +63,13 @@ |
319 | */ |
320 | const QUrl &ContentItem::url() const |
321 | { |
322 | - qDebug() << Q_FUNC_INFO; |
323 | + TRACE() << Q_FUNC_INFO; |
324 | return m_item.url(); |
325 | } |
326 | |
327 | void ContentItem::setUrl(const QUrl &url) |
328 | { |
329 | - qDebug() << Q_FUNC_INFO; |
330 | + TRACE() << Q_FUNC_INFO; |
331 | if (url == this->url()) |
332 | return; |
333 | |
334 | @@ -84,7 +83,7 @@ |
335 | */ |
336 | const com::ubuntu::content::Item &ContentItem::item() const |
337 | { |
338 | - qDebug() << Q_FUNC_INFO; |
339 | + TRACE() << Q_FUNC_INFO; |
340 | return m_item; |
341 | } |
342 | |
343 | @@ -94,7 +93,7 @@ |
344 | */ |
345 | void ContentItem::setItem(const com::ubuntu::content::Item &item) |
346 | { |
347 | - qDebug() << Q_FUNC_INFO; |
348 | + TRACE() << Q_FUNC_INFO; |
349 | if (item == m_item) |
350 | return; |
351 | |
352 | |
353 | === modified file 'import/Ubuntu/Content/contentpeer.cpp' |
354 | --- import/Ubuntu/Content/contentpeer.cpp 2014-03-21 00:29:33 +0000 |
355 | +++ import/Ubuntu/Content/contentpeer.cpp 2014-03-21 00:29:34 +0000 |
356 | @@ -14,6 +14,7 @@ |
357 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
358 | */ |
359 | |
360 | +#include "../../../src/com/ubuntu/content/debug.h" |
361 | #include "contenthandler.h" |
362 | #include "contenthub.h" |
363 | #include "contenticonprovider.h" |
364 | @@ -21,7 +22,6 @@ |
365 | #include "contenttype.h" |
366 | |
367 | #include <com/ubuntu/content/peer.h> |
368 | -#include <QDebug> |
369 | #include <QIcon> |
370 | |
371 | /*! |
372 | @@ -46,7 +46,7 @@ |
373 | m_selectionType(ContentTransfer::Single), |
374 | m_explicit_peer(false) |
375 | { |
376 | - qDebug() << Q_FUNC_INFO; |
377 | + TRACE() << Q_FUNC_INFO; |
378 | |
379 | m_hub = cuc::Hub::Client::instance(); |
380 | } |
381 | @@ -58,7 +58,7 @@ |
382 | */ |
383 | QString ContentPeer::name() |
384 | { |
385 | - qDebug() << Q_FUNC_INFO; |
386 | + TRACE() << Q_FUNC_INFO; |
387 | return m_peer.name(); |
388 | } |
389 | |
390 | @@ -68,7 +68,7 @@ |
391 | */ |
392 | const QString &ContentPeer::appId() const |
393 | { |
394 | - qDebug() << Q_FUNC_INFO; |
395 | + TRACE() << Q_FUNC_INFO; |
396 | return m_peer.id(); |
397 | } |
398 | |
399 | @@ -79,13 +79,13 @@ |
400 | */ |
401 | void ContentPeer::setAppId(const QString& appId) |
402 | { |
403 | - qDebug() << Q_FUNC_INFO << appId; |
404 | + TRACE() << Q_FUNC_INFO << appId; |
405 | this->setPeer(cuc::Peer{appId}); |
406 | } |
407 | |
408 | QImage &ContentPeer::icon() |
409 | { |
410 | - qDebug() << Q_FUNC_INFO; |
411 | + TRACE() << Q_FUNC_INFO; |
412 | return m_icon; |
413 | } |
414 | |
415 | @@ -104,7 +104,7 @@ |
416 | */ |
417 | void ContentPeer::setPeer(const cuc::Peer &peer, bool explicitPeer) |
418 | { |
419 | - qDebug() << Q_FUNC_INFO; |
420 | + TRACE() << Q_FUNC_INFO; |
421 | m_peer = peer; |
422 | m_explicit_peer = explicitPeer; |
423 | if (peer.iconData().isEmpty()) |
424 | @@ -126,7 +126,7 @@ |
425 | */ |
426 | ContentHandler::Handler ContentPeer::handler() |
427 | { |
428 | - qDebug() << Q_FUNC_INFO; |
429 | + TRACE() << Q_FUNC_INFO; |
430 | return m_handler; |
431 | } |
432 | |
433 | @@ -136,7 +136,7 @@ |
434 | */ |
435 | void ContentPeer::setHandler(ContentHandler::Handler handler) |
436 | { |
437 | - qDebug() << Q_FUNC_INFO; |
438 | + TRACE() << Q_FUNC_INFO; |
439 | m_handler = handler; |
440 | |
441 | Q_EMIT handlerChanged(); |
442 | @@ -148,7 +148,7 @@ |
443 | */ |
444 | ContentType::Type ContentPeer::contentType() |
445 | { |
446 | - qDebug() << Q_FUNC_INFO; |
447 | + TRACE() << Q_FUNC_INFO; |
448 | return m_contentType; |
449 | } |
450 | |
451 | @@ -158,7 +158,7 @@ |
452 | */ |
453 | void ContentPeer::setContentType(ContentType::Type contentType) |
454 | { |
455 | - qDebug() << Q_FUNC_INFO; |
456 | + TRACE() << Q_FUNC_INFO; |
457 | m_contentType = contentType; |
458 | |
459 | if(!m_explicit_peer) { |
460 | @@ -175,7 +175,7 @@ |
461 | */ |
462 | ContentTransfer::SelectionType ContentPeer::selectionType() |
463 | { |
464 | - qDebug() << Q_FUNC_INFO; |
465 | + TRACE() << Q_FUNC_INFO; |
466 | return m_selectionType; |
467 | } |
468 | |
469 | @@ -185,7 +185,7 @@ |
470 | */ |
471 | void ContentPeer::setSelectionType(ContentTransfer::SelectionType selectionType) |
472 | { |
473 | - qDebug() << Q_FUNC_INFO; |
474 | + TRACE() << Q_FUNC_INFO; |
475 | m_selectionType = selectionType; |
476 | |
477 | Q_EMIT selectionTypeChanged(); |
478 | @@ -197,7 +197,7 @@ |
479 | */ |
480 | bool ContentPeer::isDefaultPeer() |
481 | { |
482 | - qDebug() << Q_FUNC_INFO; |
483 | + TRACE() << Q_FUNC_INFO; |
484 | return m_peer.isDefaultPeer(); |
485 | } |
486 | |
487 | @@ -208,7 +208,7 @@ |
488 | */ |
489 | ContentTransfer *ContentPeer::request() |
490 | { |
491 | - qDebug() << Q_FUNC_INFO; |
492 | + TRACE() << Q_FUNC_INFO; |
493 | return request(nullptr); |
494 | } |
495 | |
496 | @@ -220,7 +220,7 @@ |
497 | */ |
498 | ContentTransfer *ContentPeer::request(ContentStore *store) |
499 | { |
500 | - qDebug() << Q_FUNC_INFO; |
501 | + TRACE() << Q_FUNC_INFO; |
502 | |
503 | ContentHub *contentHub = ContentHub::instance(); |
504 | ContentTransfer *qmlTransfer = NULL; |
505 | |
506 | === modified file 'import/Ubuntu/Content/contentpeermodel.cpp' |
507 | --- import/Ubuntu/Content/contentpeermodel.cpp 2014-03-21 00:29:33 +0000 |
508 | +++ import/Ubuntu/Content/contentpeermodel.cpp 2014-03-21 00:29:34 +0000 |
509 | @@ -14,11 +14,10 @@ |
510 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
511 | */ |
512 | |
513 | +#include "../../../src/com/ubuntu/content/debug.h" |
514 | #include "contentpeermodel.h" |
515 | #include <stdio.h> |
516 | |
517 | -#include <QDebug> |
518 | - |
519 | namespace cuc = com::ubuntu::content; |
520 | |
521 | /*! |
522 | @@ -39,7 +38,7 @@ |
523 | m_handler(ContentHandler::Source), |
524 | m_complete(false) |
525 | { |
526 | - qDebug() << Q_FUNC_INFO; |
527 | + TRACE() << Q_FUNC_INFO; |
528 | m_hub = cuc::Hub::Client::instance(); |
529 | } |
530 | |
531 | @@ -69,7 +68,7 @@ |
532 | */ |
533 | ContentType::Type ContentPeerModel::contentType() |
534 | { |
535 | - qDebug() << Q_FUNC_INFO; |
536 | + TRACE() << Q_FUNC_INFO; |
537 | return m_contentType; |
538 | } |
539 | |
540 | @@ -79,7 +78,7 @@ |
541 | */ |
542 | void ContentPeerModel::setContentType(ContentType::Type contentType) |
543 | { |
544 | - qDebug() << Q_FUNC_INFO; |
545 | + TRACE() << Q_FUNC_INFO; |
546 | m_contentType = contentType; |
547 | if (m_complete) { |
548 | findPeers(); |
549 | @@ -92,7 +91,7 @@ |
550 | * \internal |
551 | */ |
552 | void ContentPeerModel::findPeers() { |
553 | - qDebug() << Q_FUNC_INFO; |
554 | + TRACE() << Q_FUNC_INFO; |
555 | m_peers.clear(); |
556 | QCoreApplication::processEvents(); |
557 | if(m_contentType == ContentType::All) { |
558 | @@ -113,7 +112,7 @@ |
559 | */ |
560 | void ContentPeerModel::appendPeersForContentType(ContentType::Type contentType) |
561 | { |
562 | - qDebug() << Q_FUNC_INFO; |
563 | + TRACE() << Q_FUNC_INFO; |
564 | const cuc::Type &hubType = ContentType::contentType2HubType(contentType); |
565 | QVector<cuc::Peer> hubPeers; |
566 | if (m_handler == ContentHandler::Destination) { |
567 | @@ -151,7 +150,7 @@ |
568 | */ |
569 | ContentHandler::Handler ContentPeerModel::handler() |
570 | { |
571 | - qDebug() << Q_FUNC_INFO; |
572 | + TRACE() << Q_FUNC_INFO; |
573 | return m_handler; |
574 | } |
575 | |
576 | @@ -161,7 +160,7 @@ |
577 | */ |
578 | void ContentPeerModel::setHandler(ContentHandler::Handler handler) |
579 | { |
580 | - qDebug() << Q_FUNC_INFO; |
581 | + TRACE() << Q_FUNC_INFO; |
582 | m_handler = handler; |
583 | if (m_complete) { |
584 | findPeers(); |
585 | @@ -176,7 +175,7 @@ |
586 | */ |
587 | QQmlListProperty<ContentPeer> ContentPeerModel::peers() |
588 | { |
589 | - qDebug() << Q_FUNC_INFO; |
590 | + TRACE() << Q_FUNC_INFO; |
591 | return QQmlListProperty<ContentPeer>(this, m_peers); |
592 | } |
593 | |
594 | |
595 | === modified file 'import/Ubuntu/Content/contentscope.cpp' |
596 | --- import/Ubuntu/Content/contentscope.cpp 2014-03-21 00:29:33 +0000 |
597 | +++ import/Ubuntu/Content/contentscope.cpp 2014-03-21 00:29:34 +0000 |
598 | @@ -14,10 +14,9 @@ |
599 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
600 | */ |
601 | |
602 | +#include "../../../src/com/ubuntu/content/debug.h" |
603 | #include "contentscope.h" |
604 | |
605 | -#include <QDebug> |
606 | - |
607 | /*! |
608 | \qmltype ContentScope |
609 | \instantiates ContentScope |
610 | @@ -41,7 +40,7 @@ |
611 | ContentScope::ContentScope(QObject *parent) |
612 | : QObject(parent) |
613 | { |
614 | - qDebug() << Q_FUNC_INFO; |
615 | + TRACE() << Q_FUNC_INFO; |
616 | } |
617 | |
618 | /*! |
619 | @@ -52,7 +51,7 @@ |
620 | com::ubuntu::content::Scope ContentScope::contentScope2HubScope(int scope) |
621 | { |
622 | Scope cscope = static_cast<Scope>(scope); |
623 | - qDebug() << Q_FUNC_INFO << cscope; |
624 | + TRACE() << Q_FUNC_INFO << cscope; |
625 | return contentScope2HubScope(cscope); |
626 | } |
627 | |
628 | |
629 | === modified file 'import/Ubuntu/Content/contentstore.cpp' |
630 | --- import/Ubuntu/Content/contentstore.cpp 2014-03-21 00:29:33 +0000 |
631 | +++ import/Ubuntu/Content/contentstore.cpp 2014-03-21 00:29:34 +0000 |
632 | @@ -14,12 +14,11 @@ |
633 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
634 | */ |
635 | |
636 | +#include "../../../src/com/ubuntu/content/debug.h" |
637 | #include "contentpeer.h" |
638 | #include "contentstore.h" |
639 | #include "contenttype.h" |
640 | |
641 | -#include <QDebug> |
642 | - |
643 | /*! |
644 | * \qmltype ContentStore |
645 | * \instantiates ContentStore |
646 | @@ -37,7 +36,7 @@ |
647 | m_store(0), |
648 | m_scope(ContentScope::System) |
649 | { |
650 | - qDebug() << Q_FUNC_INFO; |
651 | + TRACE() << Q_FUNC_INFO; |
652 | m_hub = cuc::Hub::Client::instance(); |
653 | } |
654 | |
655 | @@ -50,7 +49,7 @@ |
656 | { |
657 | static const QString __empty; |
658 | |
659 | - qDebug() << Q_FUNC_INFO; |
660 | + TRACE() << Q_FUNC_INFO; |
661 | |
662 | if ( ! m_store) { |
663 | qWarning() << "Accessing ContentStore uri with NULL internal store"; |
664 | @@ -65,7 +64,7 @@ |
665 | */ |
666 | const com::ubuntu::content::Store *ContentStore::store() const |
667 | { |
668 | - qDebug() << Q_FUNC_INFO; |
669 | + TRACE() << Q_FUNC_INFO; |
670 | return m_store; |
671 | } |
672 | |
673 | @@ -75,7 +74,7 @@ |
674 | */ |
675 | void ContentStore::setStore(const com::ubuntu::content::Store *store) |
676 | { |
677 | - qDebug() << Q_FUNC_INFO; |
678 | + TRACE() << Q_FUNC_INFO; |
679 | m_store = store; |
680 | Q_EMIT uriChanged(); |
681 | } |
682 | @@ -87,7 +86,7 @@ |
683 | */ |
684 | ContentScope::Scope ContentStore::scope() |
685 | { |
686 | - qDebug() << Q_FUNC_INFO; |
687 | + TRACE() << Q_FUNC_INFO; |
688 | return m_scope; |
689 | } |
690 | |
691 | @@ -97,7 +96,7 @@ |
692 | */ |
693 | void ContentStore::setScope(ContentScope::Scope scope) |
694 | { |
695 | - qDebug() << Q_FUNC_INFO; |
696 | + TRACE() << Q_FUNC_INFO; |
697 | m_scope = scope; |
698 | |
699 | Q_EMIT scopeChanged(); |
700 | @@ -109,7 +108,7 @@ |
701 | */ |
702 | void ContentStore::updateStore(ContentType::Type contentType) |
703 | { |
704 | - qDebug() << Q_FUNC_INFO; |
705 | + TRACE() << Q_FUNC_INFO; |
706 | |
707 | com::ubuntu::content::Scope hubScope = ContentScope::contentScope2HubScope(m_scope); |
708 | const com::ubuntu::content::Type &hubType = ContentType::contentType2HubType(contentType); |
709 | |
710 | === modified file 'import/Ubuntu/Content/contenttransfer.cpp' |
711 | --- import/Ubuntu/Content/contenttransfer.cpp 2014-03-21 00:29:33 +0000 |
712 | +++ import/Ubuntu/Content/contenttransfer.cpp 2014-03-21 00:29:34 +0000 |
713 | @@ -16,11 +16,10 @@ |
714 | |
715 | #include "contenttransfer.h" |
716 | #include "contentitem.h" |
717 | +#include "../../../src/com/ubuntu/content/debug.h" |
718 | |
719 | #include <com/ubuntu/content/item.h> |
720 | |
721 | -#include <QDebug> |
722 | - |
723 | /*! |
724 | * \qmltype ContentTransfer |
725 | * \instantiates ContentTransfer |
726 | @@ -39,7 +38,7 @@ |
727 | m_selectionType(Single), |
728 | m_store(0) |
729 | { |
730 | - qDebug() << Q_FUNC_INFO; |
731 | + TRACE() << Q_FUNC_INFO; |
732 | } |
733 | |
734 | /*! |
735 | @@ -76,18 +75,18 @@ |
736 | */ |
737 | ContentTransfer::State ContentTransfer::state() const |
738 | { |
739 | - qDebug() << Q_FUNC_INFO; |
740 | + TRACE() << Q_FUNC_INFO; |
741 | return m_state; |
742 | } |
743 | |
744 | void ContentTransfer::setState(ContentTransfer::State state) |
745 | { |
746 | - qDebug() << Q_FUNC_INFO << state; |
747 | + TRACE() << Q_FUNC_INFO << state; |
748 | if (!m_transfer) |
749 | return; |
750 | |
751 | if (state == Charged && m_state == InProgress) { |
752 | - qDebug() << Q_FUNC_INFO << "Charged"; |
753 | + TRACE() << Q_FUNC_INFO << "Charged"; |
754 | QVector<cuc::Item> hubItems; |
755 | hubItems.reserve(m_items.size()); |
756 | Q_FOREACH (const ContentItem *citem, m_items) { |
757 | @@ -96,7 +95,7 @@ |
758 | m_transfer->charge(hubItems); |
759 | return; |
760 | } else if (state == Aborted) { |
761 | - qDebug() << Q_FUNC_INFO << "Aborted"; |
762 | + TRACE() << Q_FUNC_INFO << "Aborted"; |
763 | m_transfer->abort(); |
764 | } else |
765 | updateState(); |
766 | @@ -153,7 +152,7 @@ |
767 | |
768 | void ContentTransfer::setSelectionType(ContentTransfer::SelectionType type) |
769 | { |
770 | - qDebug() << Q_FUNC_INFO << type; |
771 | + TRACE() << Q_FUNC_INFO << type; |
772 | if (!m_transfer) |
773 | return; |
774 | |
775 | @@ -169,7 +168,7 @@ |
776 | */ |
777 | QQmlListProperty<ContentItem> ContentTransfer::items() |
778 | { |
779 | - qDebug() << Q_FUNC_INFO; |
780 | + TRACE() << Q_FUNC_INFO; |
781 | if (m_state == Charged) { |
782 | collectItems(); |
783 | } |
784 | @@ -183,7 +182,7 @@ |
785 | */ |
786 | bool ContentTransfer::start() |
787 | { |
788 | - qDebug() << Q_FUNC_INFO << m_transfer->id() << ":" << m_state; |
789 | + TRACE() << Q_FUNC_INFO << m_transfer->id() << ":" << m_state; |
790 | if (m_state == Created) { |
791 | return m_transfer->start(); |
792 | } else { |
793 | @@ -199,7 +198,7 @@ |
794 | */ |
795 | bool ContentTransfer::finalize() |
796 | { |
797 | - qDebug() << Q_FUNC_INFO; |
798 | + TRACE() << Q_FUNC_INFO; |
799 | return m_transfer->finalize(); |
800 | } |
801 | |
802 | @@ -209,13 +208,13 @@ |
803 | */ |
804 | const QString ContentTransfer::store() const |
805 | { |
806 | - qDebug() << Q_FUNC_INFO; |
807 | + TRACE() << Q_FUNC_INFO; |
808 | return m_transfer->store().uri(); |
809 | } |
810 | |
811 | void ContentTransfer::setStore(ContentStore* contentStore) |
812 | { |
813 | - qDebug() << Q_FUNC_INFO; |
814 | + TRACE() << Q_FUNC_INFO; |
815 | |
816 | if (!m_transfer) |
817 | { |
818 | @@ -234,7 +233,7 @@ |
819 | */ |
820 | com::ubuntu::content::Transfer *ContentTransfer::transfer() const |
821 | { |
822 | - qDebug() << Q_FUNC_INFO; |
823 | + TRACE() << Q_FUNC_INFO; |
824 | return m_transfer; |
825 | } |
826 | |
827 | @@ -256,7 +255,7 @@ |
828 | |
829 | m_transfer = transfer; |
830 | m_direction = static_cast<ContentTransfer::Direction>(transfer->direction()); |
831 | - qDebug() << Q_FUNC_INFO << "Direction:" << m_direction; |
832 | + TRACE() << Q_FUNC_INFO << "Direction:" << m_direction; |
833 | |
834 | connect(m_transfer, SIGNAL(selectionTypeChanged()), this, SLOT(updateSelectionType())); |
835 | connect(m_transfer, SIGNAL(storeChanged()), this, SLOT(updateStore())); |
836 | @@ -273,7 +272,7 @@ |
837 | */ |
838 | void ContentTransfer::collectItems() |
839 | { |
840 | - qDebug() << Q_FUNC_INFO; |
841 | + TRACE() << Q_FUNC_INFO; |
842 | if (m_state != Charged) |
843 | return; |
844 | |
845 | @@ -295,11 +294,11 @@ |
846 | */ |
847 | void ContentTransfer::updateState() |
848 | { |
849 | - qDebug() << Q_FUNC_INFO << m_transfer->state(); |
850 | + TRACE() << Q_FUNC_INFO << m_transfer->state(); |
851 | |
852 | if (!m_transfer) |
853 | { |
854 | - qWarning() << Q_FUNC_INFO << "Invalid transfer"; |
855 | + TRACE() << Q_FUNC_INFO << "Invalid transfer"; |
856 | return; |
857 | } |
858 | |
859 | @@ -313,10 +312,10 @@ |
860 | */ |
861 | void ContentTransfer::updateSelectionType() |
862 | { |
863 | - qDebug() << Q_FUNC_INFO; |
864 | + TRACE() << Q_FUNC_INFO; |
865 | if (!m_transfer) |
866 | { |
867 | - qWarning() << Q_FUNC_INFO << "Invalid transfer"; |
868 | + TRACE() << Q_FUNC_INFO << "Invalid transfer"; |
869 | return; |
870 | } |
871 | |
872 | @@ -331,10 +330,10 @@ |
873 | */ |
874 | void ContentTransfer::updateStore() |
875 | { |
876 | - qDebug() << Q_FUNC_INFO; |
877 | + TRACE() << Q_FUNC_INFO; |
878 | if (!m_transfer) |
879 | { |
880 | - qWarning() << Q_FUNC_INFO << "Invalid transfer"; |
881 | + TRACE() << Q_FUNC_INFO << "Invalid transfer"; |
882 | return; |
883 | } |
884 | |
885 | |
886 | === modified file 'import/Ubuntu/Content/contenttype.cpp' |
887 | --- import/Ubuntu/Content/contenttype.cpp 2014-03-21 00:29:33 +0000 |
888 | +++ import/Ubuntu/Content/contenttype.cpp 2014-03-21 00:29:34 +0000 |
889 | @@ -15,8 +15,7 @@ |
890 | */ |
891 | |
892 | #include "contenttype.h" |
893 | - |
894 | -#include <QDebug> |
895 | +#include "../../../src/com/ubuntu/content/debug.h" |
896 | |
897 | /*! |
898 | \qmltype ContentType |
899 | @@ -57,7 +56,7 @@ |
900 | ContentType::ContentType(QObject *parent) |
901 | : QObject(parent) |
902 | { |
903 | - qDebug() << Q_FUNC_INFO; |
904 | + TRACE() << Q_FUNC_INFO; |
905 | } |
906 | |
907 | |
908 | @@ -69,7 +68,7 @@ |
909 | const com::ubuntu::content::Type &ContentType::contentType2HubType(int type) |
910 | { |
911 | Type ctype = static_cast<Type>(type); |
912 | - qDebug() << Q_FUNC_INFO << ctype; |
913 | + TRACE() << Q_FUNC_INFO << ctype; |
914 | return contentType2HubType(ctype); |
915 | } |
916 | |
917 | |
918 | === modified file 'import/Ubuntu/Content/qmlimportexporthandler.cpp' |
919 | --- import/Ubuntu/Content/qmlimportexporthandler.cpp 2014-03-21 00:29:33 +0000 |
920 | +++ import/Ubuntu/Content/qmlimportexporthandler.cpp 2014-03-21 00:29:34 +0000 |
921 | @@ -15,11 +15,10 @@ |
922 | */ |
923 | |
924 | #include "qmlimportexporthandler.h" |
925 | +#include "../../../src/com/ubuntu/content/debug.h" |
926 | |
927 | #include <com/ubuntu/content/transfer.h> |
928 | |
929 | -#include <QDebug> |
930 | - |
931 | namespace cuc = com::ubuntu::content; |
932 | |
933 | /*! |
934 | @@ -29,7 +28,7 @@ |
935 | QmlImportExportHandler::QmlImportExportHandler(QObject *parent) |
936 | : cuc::ImportExportHandler(parent) |
937 | { |
938 | - qDebug() << Q_FUNC_INFO; |
939 | + TRACE() << Q_FUNC_INFO; |
940 | } |
941 | |
942 | /*! |
943 | @@ -37,7 +36,7 @@ |
944 | */ |
945 | void QmlImportExportHandler::handle_import(com::ubuntu::content::Transfer *transfer) |
946 | { |
947 | - qDebug() << Q_FUNC_INFO; |
948 | + TRACE() << Q_FUNC_INFO; |
949 | Q_EMIT importRequested(transfer); |
950 | } |
951 | |
952 | @@ -46,7 +45,7 @@ |
953 | */ |
954 | void QmlImportExportHandler::handle_export(com::ubuntu::content::Transfer *transfer) |
955 | { |
956 | - qDebug() << Q_FUNC_INFO; |
957 | + TRACE() << Q_FUNC_INFO; |
958 | Q_EMIT exportRequested(transfer); |
959 | } |
960 | |
961 | @@ -55,6 +54,6 @@ |
962 | */ |
963 | void QmlImportExportHandler::handle_share(com::ubuntu::content::Transfer *transfer) |
964 | { |
965 | - qDebug() << Q_FUNC_INFO; |
966 | + TRACE() << Q_FUNC_INFO; |
967 | Q_EMIT shareRequested(transfer); |
968 | } |
969 | |
970 | === modified file 'src/com/ubuntu/content/CMakeLists.txt' |
971 | --- src/com/ubuntu/content/CMakeLists.txt 2014-03-21 00:29:33 +0000 |
972 | +++ src/com/ubuntu/content/CMakeLists.txt 2014-03-21 00:29:34 +0000 |
973 | @@ -68,6 +68,7 @@ |
974 | transfer.cpp |
975 | type.cpp |
976 | utils.cpp |
977 | + debug.cpp |
978 | |
979 | detail/app_manager.cpp |
980 | detail/service.cpp |
981 | |
982 | === added file 'src/com/ubuntu/content/debug.cpp' |
983 | --- src/com/ubuntu/content/debug.cpp 1970-01-01 00:00:00 +0000 |
984 | +++ src/com/ubuntu/content/debug.cpp 2014-03-21 00:29:34 +0000 |
985 | @@ -0,0 +1,26 @@ |
986 | +/* |
987 | + * Copyright © 2014 Canonical Ltd. |
988 | + * |
989 | + * This program is free software: you can redistribute it and/or modify |
990 | + * it under the terms of the GNU Lesser General Public License version 3 as |
991 | + * published by the Free Software Foundation. |
992 | + * |
993 | + * This program is distributed in the hope that it will be useful, |
994 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
995 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
996 | + * GNU Lesser General Public License for more details. |
997 | + * |
998 | + * You should have received a copy of the GNU Lesser General Public License |
999 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1000 | + */ |
1001 | + |
1002 | + |
1003 | +#include "debug.h" |
1004 | + |
1005 | +int appLoggingLevel = 1; // criticals |
1006 | + |
1007 | +void setLoggingLevel(int level) |
1008 | +{ |
1009 | + appLoggingLevel = level; |
1010 | +} |
1011 | + |
1012 | |
1013 | === added file 'src/com/ubuntu/content/debug.h' |
1014 | --- src/com/ubuntu/content/debug.h 1970-01-01 00:00:00 +0000 |
1015 | +++ src/com/ubuntu/content/debug.h 2014-03-21 00:29:34 +0000 |
1016 | @@ -0,0 +1,53 @@ |
1017 | +/* |
1018 | + * Copyright © 2014 Canonical Ltd. |
1019 | + * |
1020 | + * This program is free software: you can redistribute it and/or modify |
1021 | + * it under the terms of the GNU Lesser General Public License version 3 as |
1022 | + * published by the Free Software Foundation. |
1023 | + * |
1024 | + * This program is distributed in the hope that it will be useful, |
1025 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1026 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1027 | + * GNU Lesser General Public License for more details. |
1028 | + * |
1029 | + * You should have received a copy of the GNU Lesser General Public License |
1030 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1031 | + */ |
1032 | + |
1033 | +#ifndef DEBUG_H |
1034 | +#define DEBUG_H |
1035 | + |
1036 | +#include <QDebug> |
1037 | + |
1038 | +/* 0 - fatal, 1 - critical(default), 2 - info/debug */ |
1039 | +extern int appLoggingLevel; |
1040 | + |
1041 | +static inline bool debugEnabled() |
1042 | +{ |
1043 | + return appLoggingLevel >= 2; |
1044 | +} |
1045 | + |
1046 | +static inline bool criticalsEnabled() |
1047 | +{ |
1048 | + return appLoggingLevel >= 1; |
1049 | +} |
1050 | + |
1051 | +static inline int loggingLevel() |
1052 | +{ |
1053 | + return appLoggingLevel; |
1054 | +} |
1055 | + |
1056 | +void setLoggingLevel(int level); |
1057 | + |
1058 | +#ifdef DEBUG_ENABLED |
1059 | + #define TRACE() \ |
1060 | + if (debugEnabled()) qDebug() << __FILE__ << __LINE__ << __func__ |
1061 | + #define BLAME() \ |
1062 | + if (criticalsEnabled()) qCritical() << __FILE__ << __LINE__ << __func__ |
1063 | +#else |
1064 | + #define TRACE() while (0) qDebug() |
1065 | + #define BLAME() while (0) qDebug() |
1066 | +#endif |
1067 | + |
1068 | +#endif // DEBUG_H |
1069 | + |
1070 | |
1071 | === modified file 'src/com/ubuntu/content/detail/app_manager.cpp' |
1072 | --- src/com/ubuntu/content/detail/app_manager.cpp 2014-03-21 00:29:33 +0000 |
1073 | +++ src/com/ubuntu/content/detail/app_manager.cpp 2014-03-21 00:29:34 +0000 |
1074 | @@ -15,9 +15,9 @@ |
1075 | */ |
1076 | |
1077 | #include "app_manager.h" |
1078 | +#include "debug.h" |
1079 | |
1080 | #include <upstart-app-launch.h> |
1081 | -#include <QDebug> |
1082 | |
1083 | namespace cucd = com::ubuntu::content::detail; |
1084 | |
1085 | @@ -27,7 +27,7 @@ |
1086 | |
1087 | bool cucd::AppManager::invoke_application(const std::string &app_id) |
1088 | { |
1089 | - qDebug() << Q_FUNC_INFO << "APP_ID:" << app_id.c_str(); |
1090 | + TRACE() << Q_FUNC_INFO << "APP_ID:" << app_id.c_str(); |
1091 | gchar ** uris = NULL; |
1092 | gboolean ok = upstart_app_launch_start_application(app_id.c_str(), (const gchar * const *)uris); |
1093 | return static_cast<bool>(ok); |
1094 | @@ -38,7 +38,7 @@ |
1095 | */ |
1096 | bool cucd::AppManager::stop_application(const std::string &app_id) |
1097 | { |
1098 | - qDebug() << Q_FUNC_INFO << "APP_ID:" << app_id.c_str(); |
1099 | + TRACE() << Q_FUNC_INFO << "APP_ID:" << app_id.c_str(); |
1100 | |
1101 | gboolean ok = upstart_app_launch_stop_application(app_id.c_str()); |
1102 | return static_cast<bool>(ok); |
1103 | |
1104 | === modified file 'src/com/ubuntu/content/detail/handler.cpp' |
1105 | --- src/com/ubuntu/content/detail/handler.cpp 2014-03-21 00:29:33 +0000 |
1106 | +++ src/com/ubuntu/content/detail/handler.cpp 2014-03-21 00:29:34 +0000 |
1107 | @@ -19,9 +19,9 @@ |
1108 | #include "transfer_p.h" |
1109 | #include "handler.h" |
1110 | #include "utils.cpp" |
1111 | +#include "debug.h" |
1112 | |
1113 | #include <QObject> |
1114 | -#include <QDebug> |
1115 | |
1116 | namespace cucd = com::ubuntu::content::detail; |
1117 | namespace cuc = com::ubuntu::content; |
1118 | @@ -35,7 +35,7 @@ |
1119 | connection(connection), |
1120 | peer_id(peer_id) |
1121 | { |
1122 | - qDebug() << Q_FUNC_INFO; |
1123 | + TRACE() << Q_FUNC_INFO; |
1124 | } |
1125 | |
1126 | QDBusConnection connection; |
1127 | @@ -45,7 +45,7 @@ |
1128 | cucd::Handler::Handler(QDBusConnection connection, const QString& peer_id, cuc::ImportExportHandler* handler) |
1129 | : d(new Private{connection, peer_id, this}) |
1130 | { |
1131 | - qDebug() << Q_FUNC_INFO; |
1132 | + TRACE() << Q_FUNC_INFO; |
1133 | m_handler = handler; |
1134 | } |
1135 | |
1136 | @@ -55,20 +55,20 @@ |
1137 | |
1138 | void cucd::Handler::HandleImport(const QDBusObjectPath& transfer) |
1139 | { |
1140 | - qDebug() << Q_FUNC_INFO << transfer.path(); |
1141 | + TRACE() << Q_FUNC_INFO << transfer.path(); |
1142 | cuc::Transfer* t = cuc::Transfer::Private::make_transfer(transfer, this); |
1143 | |
1144 | - qDebug() << Q_FUNC_INFO << "State:" << t->state(); |
1145 | + TRACE() << Q_FUNC_INFO << "State:" << t->state(); |
1146 | if (t->state() == cuc::Transfer::charged) |
1147 | m_handler->handle_import(t); |
1148 | } |
1149 | |
1150 | void cucd::Handler::HandleExport(const QDBusObjectPath& transfer) |
1151 | { |
1152 | - qDebug() << Q_FUNC_INFO << transfer.path(); |
1153 | + TRACE() << Q_FUNC_INFO << transfer.path(); |
1154 | cuc::Transfer* t = cuc::Transfer::Private::make_transfer(transfer, this); |
1155 | |
1156 | - qDebug() << Q_FUNC_INFO << "State:" << t->state(); |
1157 | + TRACE() << Q_FUNC_INFO << "State:" << t->state(); |
1158 | if (t->state() == cuc::Transfer::initiated) |
1159 | { |
1160 | t->d->handled(); |
1161 | @@ -78,10 +78,10 @@ |
1162 | |
1163 | void cucd::Handler::HandleShare(const QDBusObjectPath& transfer) |
1164 | { |
1165 | - qDebug() << Q_FUNC_INFO; |
1166 | + TRACE() << Q_FUNC_INFO; |
1167 | cuc::Transfer* t = cuc::Transfer::Private::make_transfer(transfer, this); |
1168 | |
1169 | - qDebug() << Q_FUNC_INFO << "State:" << t->state(); |
1170 | + TRACE() << Q_FUNC_INFO << "State:" << t->state(); |
1171 | if (t->state() == cuc::Transfer::charged) |
1172 | { |
1173 | m_handler->handle_share(t); |
1174 | |
1175 | === modified file 'src/com/ubuntu/content/detail/service.cpp' |
1176 | --- src/com/ubuntu/content/detail/service.cpp 2014-03-21 00:29:33 +0000 |
1177 | +++ src/com/ubuntu/content/detail/service.cpp 2014-03-21 00:29:34 +0000 |
1178 | @@ -16,8 +16,8 @@ |
1179 | * Authored by: Thomas Voß <thomas.voss@canonical.com> |
1180 | */ |
1181 | |
1182 | +#include "debug.h" |
1183 | #include "service.h" |
1184 | - |
1185 | #include "peer_registry.h" |
1186 | #include "transfer.h" |
1187 | #include "transferadaptor.h" |
1188 | @@ -94,10 +94,10 @@ |
1189 | |
1190 | cucd::Service::~Service() |
1191 | { |
1192 | - qDebug() << Q_FUNC_INFO; |
1193 | + TRACE() << Q_FUNC_INFO; |
1194 | Q_FOREACH (cucd::Transfer *t, d->active_transfers) |
1195 | { |
1196 | - qDebug() << Q_FUNC_INFO << "Destroying transfer:" << t->Id(); |
1197 | + TRACE() << Q_FUNC_INFO << "Destroying transfer:" << t->Id(); |
1198 | delete t; |
1199 | } |
1200 | } |
1201 | @@ -158,11 +158,11 @@ |
1202 | |
1203 | QDBusObjectPath cucd::Service::CreateImportFromPeer(const QString& peer_id, const QString& app_id) |
1204 | { |
1205 | - qDebug() << Q_FUNC_INFO; |
1206 | + TRACE() << Q_FUNC_INFO; |
1207 | QString dest_id = app_id; |
1208 | if (dest_id.isEmpty()) |
1209 | { |
1210 | - qDebug() << Q_FUNC_INFO << "APP_ID isnt' set, attempting to get it from AppArmor"; |
1211 | + TRACE() << Q_FUNC_INFO << "APP_ID isnt' set, attempting to get it from AppArmor"; |
1212 | dest_id = aa_profile(this->message().service()); |
1213 | } |
1214 | return CreateTransfer(dest_id, peer_id, cuc::Transfer::Import); |
1215 | @@ -170,7 +170,7 @@ |
1216 | |
1217 | bool cucd::Service::should_cancel (int st) |
1218 | { |
1219 | - qDebug() << Q_FUNC_INFO << "State:" << st; |
1220 | + TRACE() << Q_FUNC_INFO << "State:" << st; |
1221 | |
1222 | return (st != cuc::Transfer::finalized |
1223 | && st != cuc::Transfer::collected |
1224 | @@ -179,11 +179,11 @@ |
1225 | |
1226 | QDBusObjectPath cucd::Service::CreateExportToPeer(const QString& peer_id, const QString& app_id) |
1227 | { |
1228 | - qDebug() << Q_FUNC_INFO; |
1229 | + TRACE() << Q_FUNC_INFO; |
1230 | QString src_id = app_id; |
1231 | if (src_id.isEmpty()) |
1232 | { |
1233 | - qDebug() << Q_FUNC_INFO << "APP_ID isnt' set, attempting to get it from AppArmor"; |
1234 | + TRACE() << Q_FUNC_INFO << "APP_ID isnt' set, attempting to get it from AppArmor"; |
1235 | src_id = aa_profile(this->message().service()); |
1236 | } |
1237 | return CreateTransfer(peer_id, src_id, cuc::Transfer::Export); |
1238 | @@ -191,11 +191,11 @@ |
1239 | |
1240 | QDBusObjectPath cucd::Service::CreateShareToPeer(const QString& peer_id, const QString& app_id) |
1241 | { |
1242 | - qDebug() << Q_FUNC_INFO; |
1243 | + TRACE() << Q_FUNC_INFO; |
1244 | QString src_id = app_id; |
1245 | if (src_id.isEmpty()) |
1246 | { |
1247 | - qDebug() << Q_FUNC_INFO << "APP_ID isnt' set, attempting to get it from AppArmor"; |
1248 | + TRACE() << Q_FUNC_INFO << "APP_ID isnt' set, attempting to get it from AppArmor"; |
1249 | src_id = aa_profile(this->message().service()); |
1250 | } |
1251 | return CreateTransfer(peer_id, src_id, cuc::Transfer::Share); |
1252 | @@ -203,7 +203,7 @@ |
1253 | |
1254 | QDBusObjectPath cucd::Service::CreateTransfer(const QString& dest_id, const QString& src_id, int dir) |
1255 | { |
1256 | - qDebug() << Q_FUNC_INFO << "DEST:" << dest_id << "SRC:" << src_id << "DIRECTION:" << dir; |
1257 | + TRACE() << Q_FUNC_INFO << "DEST:" << dest_id << "SRC:" << src_id << "DIRECTION:" << dir; |
1258 | |
1259 | static size_t import_counter{0}; import_counter++; |
1260 | |
1261 | @@ -213,10 +213,10 @@ |
1262 | { |
1263 | if (t->destination() == dest_id || t->source() == src_id) |
1264 | { |
1265 | - qDebug() << Q_FUNC_INFO << "Found transfer for peer_id:" << src_id; |
1266 | + TRACE() << Q_FUNC_INFO << "Found transfer for peer_id:" << src_id; |
1267 | if (should_cancel(t->State())) |
1268 | { |
1269 | - qDebug() << Q_FUNC_INFO << "Aborting active transfer:" << t->Id(); |
1270 | + TRACE() << Q_FUNC_INFO << "Aborting active transfer:" << t->Id(); |
1271 | t->Abort(); |
1272 | } |
1273 | } |
1274 | @@ -229,10 +229,10 @@ |
1275 | auto destination = transfer->import_path(); |
1276 | auto source = transfer->export_path(); |
1277 | if (not d->connection.registerObject(source, transfer)) |
1278 | - qDebug() << "Problem registering object for path: " << source; |
1279 | + TRACE() << "Problem registering object for path: " << source; |
1280 | d->connection.registerObject(destination, transfer); |
1281 | |
1282 | - qDebug() << "Created transfer " << source << " -> " << destination; |
1283 | + TRACE() << "Created transfer " << source << " -> " << destination; |
1284 | |
1285 | // Content flow is different for import |
1286 | if (dir == cuc::Transfer::Import) |
1287 | @@ -247,13 +247,13 @@ |
1288 | |
1289 | void cucd::Service::handle_imports(int state) |
1290 | { |
1291 | - qDebug() << Q_FUNC_INFO << state; |
1292 | + TRACE() << Q_FUNC_INFO << state; |
1293 | cucd::Transfer *transfer = static_cast<cucd::Transfer*>(sender()); |
1294 | - qDebug() << Q_FUNC_INFO << "State: " << transfer->State() << "Id:" << transfer->Id(); |
1295 | + TRACE() << Q_FUNC_INFO << "State: " << transfer->State() << "Id:" << transfer->Id(); |
1296 | |
1297 | if (state == cuc::Transfer::initiated) |
1298 | { |
1299 | - qDebug() << Q_FUNC_INFO << "initiated"; |
1300 | + TRACE() << Q_FUNC_INFO << "initiated"; |
1301 | if (d->app_manager->is_application_started(transfer->source().toStdString())) |
1302 | transfer->SetSourceStartedByContentHub(false); |
1303 | else |
1304 | @@ -261,14 +261,14 @@ |
1305 | |
1306 | Q_FOREACH (RegHandler *r, d->handlers) |
1307 | { |
1308 | - qDebug() << Q_FUNC_INFO << "ID:" << r->id << "Handler: " << r->service << "Transfer: " << transfer->source(); |
1309 | + TRACE() << Q_FUNC_INFO << "ID:" << r->id << "Handler: " << r->service << "Transfer: " << transfer->source(); |
1310 | if (r->id == transfer->source()) |
1311 | { |
1312 | - qDebug() << Q_FUNC_INFO << "Found handler for initiated transfer" << r->id; |
1313 | + TRACE() << Q_FUNC_INFO << "Found handler for initiated transfer" << r->id; |
1314 | if (r->handler->isValid()) |
1315 | r->handler->HandleExport(QDBusObjectPath{transfer->export_path()}); |
1316 | else |
1317 | - qDebug() << Q_FUNC_INFO << "Handler invalid"; |
1318 | + TRACE() << Q_FUNC_INFO << "Handler invalid"; |
1319 | } |
1320 | } |
1321 | |
1322 | @@ -277,7 +277,7 @@ |
1323 | |
1324 | if (state == cuc::Transfer::charged) |
1325 | { |
1326 | - qDebug() << Q_FUNC_INFO << "Charged"; |
1327 | + TRACE() << Q_FUNC_INFO << "Charged"; |
1328 | if (transfer->WasSourceStartedByContentHub()) |
1329 | d->app_manager->stop_application(transfer->source().toStdString()); |
1330 | |
1331 | @@ -285,10 +285,10 @@ |
1332 | |
1333 | Q_FOREACH (RegHandler *r, d->handlers) |
1334 | { |
1335 | - qDebug() << Q_FUNC_INFO << "ID:" << r->id << "Handler: " << r->service << "Transfer: " << transfer->destination(); |
1336 | + TRACE() << Q_FUNC_INFO << "ID:" << r->id << "Handler: " << r->service << "Transfer: " << transfer->destination(); |
1337 | if (r->id == transfer->destination()) |
1338 | { |
1339 | - qDebug() << Q_FUNC_INFO << "Found handler for charged transfer" << r->id; |
1340 | + TRACE() << Q_FUNC_INFO << "Found handler for charged transfer" << r->id; |
1341 | if (r->handler->isValid()) |
1342 | r->handler->HandleImport(QDBusObjectPath{transfer->import_path()}); |
1343 | } |
1344 | @@ -304,39 +304,43 @@ |
1345 | { |
1346 | if (t->Id() != transfer->Id()) |
1347 | { |
1348 | - if ((t->source() == transfer->source()) || (t->destination() == transfer->destination())) |
1349 | + if ((t->source() == transfer->source()) && (t->State() == cuc::Transfer::in_progress)) |
1350 | { |
1351 | - qDebug() << Q_FUNC_INFO << "Peer has pending transfers:" << t->Id(); |
1352 | + TRACE() << Q_FUNC_INFO << "Source has pending transfers:" << t->Id(); |
1353 | shouldStop = false; |
1354 | } |
1355 | + if (t->destination() == transfer->destination()) |
1356 | + { |
1357 | + qDebug() << Q_FUNC_INFO << "Destination has pending transfers:" << t->Id(); |
1358 | + if (should_cancel(t->State())) |
1359 | + shouldStop = false; |
1360 | + } |
1361 | } |
1362 | } |
1363 | if (shouldStop) |
1364 | - { |
1365 | - d->app_manager->stop_application(transfer->source().toStdString()); |
1366 | - d->app_manager->invoke_application(transfer->destination().toStdString()); |
1367 | - } |
1368 | + d->app_manager->stop_application(transfer->source().toStdString()); |
1369 | } |
1370 | + d->app_manager->invoke_application(transfer->destination().toStdString()); |
1371 | } |
1372 | } |
1373 | |
1374 | void cucd::Service::handle_exports(int state) |
1375 | { |
1376 | - qDebug() << Q_FUNC_INFO; |
1377 | + TRACE() << Q_FUNC_INFO; |
1378 | cucd::Transfer *transfer = static_cast<cucd::Transfer*>(sender()); |
1379 | |
1380 | - qDebug() << Q_FUNC_INFO << "STATE:" << transfer->State(); |
1381 | + TRACE() << Q_FUNC_INFO << "STATE:" << transfer->State(); |
1382 | |
1383 | |
1384 | if (state == cuc::Transfer::initiated) |
1385 | { |
1386 | - qDebug() << Q_FUNC_INFO << "Initiated"; |
1387 | + TRACE() << Q_FUNC_INFO << "Initiated"; |
1388 | transfer->Handled(); |
1389 | } |
1390 | |
1391 | if (state == cuc::Transfer::charged) |
1392 | { |
1393 | - qDebug() << Q_FUNC_INFO << "Charged"; |
1394 | + TRACE() << Q_FUNC_INFO << "Charged"; |
1395 | if (d->app_manager->is_application_started(transfer->destination().toStdString())) |
1396 | transfer->SetSourceStartedByContentHub(false); |
1397 | else |
1398 | @@ -346,10 +350,10 @@ |
1399 | |
1400 | Q_FOREACH (RegHandler *r, d->handlers) |
1401 | { |
1402 | - qDebug() << "Handler: " << r->service << "Transfer: " << transfer->destination(); |
1403 | + TRACE() << "Handler: " << r->service << "Transfer: " << transfer->destination(); |
1404 | if (r->id == transfer->destination()) |
1405 | { |
1406 | - qDebug() << "Found handler for charged transfer" << r->id; |
1407 | + TRACE() << "Found handler for charged transfer" << r->id; |
1408 | if (transfer->Direction() == cuc::Transfer::Share && r->handler->isValid()) |
1409 | r->handler->HandleShare(QDBusObjectPath{transfer->import_path()}); |
1410 | else if (r->handler->isValid()) |
1411 | @@ -360,7 +364,7 @@ |
1412 | |
1413 | if (state == cuc::Transfer::finalized) |
1414 | { |
1415 | - qDebug() << Q_FUNC_INFO << "Finalized"; |
1416 | + TRACE() << Q_FUNC_INFO << "Finalized"; |
1417 | if (transfer->WasSourceStartedByContentHub()) |
1418 | d->app_manager->stop_application(transfer->destination().toStdString()); |
1419 | |
1420 | @@ -369,7 +373,7 @@ |
1421 | |
1422 | if (state == cuc::Transfer::aborted) |
1423 | { |
1424 | - qDebug() << Q_FUNC_INFO << "Aborted"; |
1425 | + TRACE() << Q_FUNC_INFO << "Aborted"; |
1426 | if (transfer->WasSourceStartedByContentHub()) |
1427 | { |
1428 | bool shouldStop = true; |
1429 | @@ -377,35 +381,39 @@ |
1430 | { |
1431 | if (t->Id() != transfer->Id()) |
1432 | { |
1433 | - if ((t->source() == transfer->source()) || (t->destination() == transfer->destination())) |
1434 | + if ((t->source() == transfer->source()) && (t->State() == cuc::Transfer::in_progress)) |
1435 | { |
1436 | - qDebug() << Q_FUNC_INFO << "Peer has pending transfers:" << t->Id(); |
1437 | + TRACE() << Q_FUNC_INFO << "Source has pending transfers:" << t->Id(); |
1438 | shouldStop = false; |
1439 | } |
1440 | + if (t->destination() == transfer->destination()) |
1441 | + { |
1442 | + qDebug() << Q_FUNC_INFO << "Destination has pending transfers:" << t->Id(); |
1443 | + if (should_cancel(t->State())) |
1444 | + shouldStop = false; |
1445 | + } |
1446 | } |
1447 | } |
1448 | if (shouldStop) |
1449 | - { |
1450 | d->app_manager->stop_application(transfer->destination().toStdString()); |
1451 | - d->app_manager->invoke_application(transfer->source().toStdString()); |
1452 | - } |
1453 | } |
1454 | + d->app_manager->invoke_application(transfer->source().toStdString()); |
1455 | } |
1456 | } |
1457 | |
1458 | void cucd::Service::handler_unregistered(const QString& s) |
1459 | { |
1460 | - qDebug() << Q_FUNC_INFO << s; |
1461 | + TRACE() << Q_FUNC_INFO << s; |
1462 | |
1463 | if (d->handlers.isEmpty()) |
1464 | return; |
1465 | |
1466 | Q_FOREACH (RegHandler *r, d->handlers) |
1467 | { |
1468 | - qDebug() << "Handler: " << r->id; |
1469 | + TRACE() << "Handler: " << r->id; |
1470 | if (r->service == s) |
1471 | { |
1472 | - qDebug() << "Found match for " << r->id; |
1473 | + TRACE() << "Found match for " << r->id; |
1474 | d->handlers.remove(r); |
1475 | m_watcher->removeWatchedService(s); |
1476 | delete r; |
1477 | @@ -415,15 +423,15 @@ |
1478 | |
1479 | void cucd::Service::RegisterImportExportHandler(const QString& peer_id, const QDBusObjectPath& handler) |
1480 | { |
1481 | - qDebug() << Q_FUNC_INFO << peer_id; |
1482 | + TRACE() << Q_FUNC_INFO << peer_id; |
1483 | bool exists = false; |
1484 | RegHandler* r; |
1485 | Q_FOREACH (RegHandler *rh, d->handlers) |
1486 | { |
1487 | - qDebug() << "Handler: " << rh->id; |
1488 | + TRACE() << "Handler: " << rh->id; |
1489 | if (rh->id == peer_id) |
1490 | { |
1491 | - qDebug() << "Found existing handler for " << rh->id; |
1492 | + TRACE() << "Found existing handler for " << rh->id; |
1493 | exists = true; |
1494 | r = rh; |
1495 | } |
1496 | @@ -442,14 +450,14 @@ |
1497 | m_watcher->addWatchedService(r->service); |
1498 | } |
1499 | |
1500 | - qDebug() << Q_FUNC_INFO << r->id; |
1501 | + TRACE() << Q_FUNC_INFO << r->id; |
1502 | |
1503 | Q_FOREACH (cucd::Transfer *t, d->active_transfers) |
1504 | { |
1505 | - qDebug() << Q_FUNC_INFO << "SOURCE: " << t->source() << "DEST:" << t->destination() << "STATE:" << t->State(); |
1506 | + TRACE() << Q_FUNC_INFO << "SOURCE: " << t->source() << "DEST:" << t->destination() << "STATE:" << t->State(); |
1507 | if ((t->source() == peer_id) && (t->State() == cuc::Transfer::initiated)) |
1508 | { |
1509 | - qDebug() << Q_FUNC_INFO << "Found source:" << peer_id << "Direction:" << t->Direction(); |
1510 | + TRACE() << Q_FUNC_INFO << "Found source:" << peer_id << "Direction:" << t->Direction(); |
1511 | if (t->Direction() == cuc::Transfer::Import) |
1512 | { |
1513 | if (r->handler->isValid()) |
1514 | @@ -458,15 +466,15 @@ |
1515 | } |
1516 | else if ((t->destination() == peer_id) && (t->State() == cuc::Transfer::charged)) |
1517 | { |
1518 | - qDebug() << Q_FUNC_INFO << "Found destination:" << peer_id << "Direction:" << t->Direction(); |
1519 | + TRACE() << Q_FUNC_INFO << "Found destination:" << peer_id << "Direction:" << t->Direction(); |
1520 | if (t->Direction() == cuc::Transfer::Export) |
1521 | { |
1522 | - qDebug() << Q_FUNC_INFO << "Found import, calling HandleImport"; |
1523 | + TRACE() << Q_FUNC_INFO << "Found import, calling HandleImport"; |
1524 | if (r->handler->isValid()) |
1525 | r->handler->HandleImport(QDBusObjectPath{t->import_path()}); |
1526 | } else if (t->Direction() == cuc::Transfer::Share) |
1527 | { |
1528 | - qDebug() << Q_FUNC_INFO << "Found share, calling HandleShare"; |
1529 | + TRACE() << Q_FUNC_INFO << "Found share, calling HandleShare"; |
1530 | if (r->handler->isValid()) |
1531 | r->handler->HandleShare(QDBusObjectPath{t->import_path()}); |
1532 | } |
1533 | |
1534 | === modified file 'src/com/ubuntu/content/detail/transfer.cpp' |
1535 | --- src/com/ubuntu/content/detail/transfer.cpp 2014-03-21 00:29:33 +0000 |
1536 | +++ src/com/ubuntu/content/detail/transfer.cpp 2014-03-21 00:29:34 +0000 |
1537 | @@ -16,6 +16,7 @@ |
1538 | * Authored by: Thomas Voß <thomas.voss@canonical.com> |
1539 | */ |
1540 | |
1541 | +#include "debug.h" |
1542 | #include "transfer.h" |
1543 | #include "utils.cpp" |
1544 | |
1545 | @@ -23,8 +24,6 @@ |
1546 | #include <com/ubuntu/content/store.h> |
1547 | #include <com/ubuntu/content/transfer.h> |
1548 | |
1549 | -#include <QDebug> |
1550 | - |
1551 | namespace cuc = com::ubuntu::content; |
1552 | namespace cucd = com::ubuntu::content::detail; |
1553 | |
1554 | @@ -62,51 +61,51 @@ |
1555 | QObject* parent) : |
1556 | QObject(parent), d(new Private(id, source, destination, direction)) |
1557 | { |
1558 | - qDebug() << __PRETTY_FUNCTION__; |
1559 | + TRACE() << __PRETTY_FUNCTION__; |
1560 | } |
1561 | |
1562 | cucd::Transfer::~Transfer() |
1563 | { |
1564 | - qDebug() << __PRETTY_FUNCTION__; |
1565 | + TRACE() << __PRETTY_FUNCTION__; |
1566 | purge_store_cache(d->store); |
1567 | } |
1568 | |
1569 | /* unique id of the transfer */ |
1570 | int cucd::Transfer::Id() |
1571 | { |
1572 | - qDebug() << __PRETTY_FUNCTION__; |
1573 | + TRACE() << __PRETTY_FUNCTION__; |
1574 | return d->id; |
1575 | } |
1576 | |
1577 | /* returns the peer_id of the requested export handler */ |
1578 | QString cucd::Transfer::source() |
1579 | { |
1580 | - qDebug() << __PRETTY_FUNCTION__; |
1581 | + TRACE() << __PRETTY_FUNCTION__; |
1582 | return d->source; |
1583 | } |
1584 | |
1585 | /* returns the peer_id of the application requesting the import */ |
1586 | QString cucd::Transfer::destination() |
1587 | { |
1588 | - qDebug() << __PRETTY_FUNCTION__; |
1589 | + TRACE() << __PRETTY_FUNCTION__; |
1590 | return d->destination; |
1591 | } |
1592 | |
1593 | int cucd::Transfer::Direction() |
1594 | { |
1595 | - qDebug() << __PRETTY_FUNCTION__; |
1596 | + TRACE() << __PRETTY_FUNCTION__; |
1597 | return d->direction; |
1598 | } |
1599 | |
1600 | int cucd::Transfer::State() |
1601 | { |
1602 | - qDebug() << __PRETTY_FUNCTION__; |
1603 | + TRACE() << __PRETTY_FUNCTION__; |
1604 | return d->state; |
1605 | } |
1606 | |
1607 | void cucd::Transfer::Abort() |
1608 | { |
1609 | - qDebug() << __PRETTY_FUNCTION__; |
1610 | + TRACE() << __PRETTY_FUNCTION__; |
1611 | |
1612 | if (d->state == cuc::Transfer::aborted) |
1613 | return; |
1614 | @@ -119,7 +118,7 @@ |
1615 | |
1616 | void cucd::Transfer::Start() |
1617 | { |
1618 | - qDebug() << __PRETTY_FUNCTION__; |
1619 | + TRACE() << __PRETTY_FUNCTION__; |
1620 | |
1621 | if (d->state == cuc::Transfer::initiated) |
1622 | return; |
1623 | @@ -130,7 +129,7 @@ |
1624 | |
1625 | void cucd::Transfer::Handled() |
1626 | { |
1627 | - qDebug() << __PRETTY_FUNCTION__; |
1628 | + TRACE() << __PRETTY_FUNCTION__; |
1629 | |
1630 | if (d->state == cuc::Transfer::in_progress) |
1631 | return; |
1632 | @@ -141,7 +140,7 @@ |
1633 | |
1634 | void cucd::Transfer::Charge(const QStringList& items) |
1635 | { |
1636 | - qDebug() << __PRETTY_FUNCTION__; |
1637 | + TRACE() << __PRETTY_FUNCTION__; |
1638 | |
1639 | if (d->state == cuc::Transfer::charged) |
1640 | return; |
1641 | @@ -151,7 +150,7 @@ |
1642 | ret.append(copy_to_store(i, d->store)); |
1643 | |
1644 | Q_FOREACH(QString f, ret) |
1645 | - qDebug() << Q_FUNC_INFO << "Item:" << f; |
1646 | + TRACE() << Q_FUNC_INFO << "Item:" << f; |
1647 | |
1648 | if (ret.count() <= 0) |
1649 | { |
1650 | @@ -168,7 +167,7 @@ |
1651 | |
1652 | QStringList cucd::Transfer::Collect() |
1653 | { |
1654 | - qDebug() << __PRETTY_FUNCTION__; |
1655 | + TRACE() << __PRETTY_FUNCTION__; |
1656 | |
1657 | if (d->state != cuc::Transfer::collected) |
1658 | { |
1659 | @@ -181,7 +180,7 @@ |
1660 | |
1661 | void cucd::Transfer::Finalize() |
1662 | { |
1663 | - qDebug() << __PRETTY_FUNCTION__; |
1664 | + TRACE() << __PRETTY_FUNCTION__; |
1665 | |
1666 | if (d->state == cuc::Transfer::finalized) |
1667 | return; |
1668 | @@ -194,13 +193,13 @@ |
1669 | |
1670 | QString cucd::Transfer::Store() |
1671 | { |
1672 | - qDebug() << __PRETTY_FUNCTION__; |
1673 | + TRACE() << __PRETTY_FUNCTION__; |
1674 | return d->store; |
1675 | } |
1676 | |
1677 | void cucd::Transfer::SetStore(QString uri) |
1678 | { |
1679 | - qDebug() << Q_FUNC_INFO; |
1680 | + TRACE() << Q_FUNC_INFO; |
1681 | |
1682 | if (d->store == uri) |
1683 | return; |
1684 | @@ -211,13 +210,13 @@ |
1685 | |
1686 | int cucd::Transfer::SelectionType() |
1687 | { |
1688 | - qDebug() << __PRETTY_FUNCTION__; |
1689 | + TRACE() << __PRETTY_FUNCTION__; |
1690 | return d->selection_type; |
1691 | } |
1692 | |
1693 | void cucd::Transfer::SetSelectionType(int type) |
1694 | { |
1695 | - qDebug() << Q_FUNC_INFO; |
1696 | + TRACE() << Q_FUNC_INFO; |
1697 | if (d->state != cuc::Transfer::created) |
1698 | return; |
1699 | if (d->selection_type == type) |
1700 | @@ -230,7 +229,7 @@ |
1701 | /* returns the object path for the export */ |
1702 | QString cucd::Transfer::export_path() |
1703 | { |
1704 | - qDebug() << Q_FUNC_INFO << "source:" << d->source; |
1705 | + TRACE() << Q_FUNC_INFO << "source:" << d->source; |
1706 | static const QString exporter_path_pattern{"/transfers/%1/export/%2"}; |
1707 | QString source = exporter_path_pattern |
1708 | .arg(sanitize_id(d->source)) |
1709 | @@ -241,7 +240,7 @@ |
1710 | /* returns the object path for the import */ |
1711 | QString cucd::Transfer::import_path() |
1712 | { |
1713 | - qDebug() << Q_FUNC_INFO << "destination:" << d->destination; |
1714 | + TRACE() << Q_FUNC_INFO << "destination:" << d->destination; |
1715 | static const QString importer_path_pattern{"/transfers/%1/import/%2"}; |
1716 | QString destination = importer_path_pattern |
1717 | .arg(sanitize_id(d->destination)) |
1718 | |
1719 | === modified file 'src/com/ubuntu/content/hub.cpp' |
1720 | --- src/com/ubuntu/content/hub.cpp 2014-03-21 00:29:33 +0000 |
1721 | +++ src/com/ubuntu/content/hub.cpp 2014-03-21 00:29:34 +0000 |
1722 | @@ -17,6 +17,7 @@ |
1723 | */ |
1724 | |
1725 | #include "common.h" |
1726 | +#include "debug.h" |
1727 | #include "ContentServiceInterface.h" |
1728 | #include "ContentHandlerInterface.h" |
1729 | #include "handleradaptor.h" |
1730 | @@ -31,6 +32,7 @@ |
1731 | #include <com/ubuntu/content/type.h> |
1732 | |
1733 | #include <QStandardPaths> |
1734 | +#include <QProcessEnvironment> |
1735 | #include <map> |
1736 | |
1737 | namespace cuc = com::ubuntu::content; |
1738 | @@ -51,6 +53,15 @@ |
1739 | |
1740 | cuc::Hub::Hub(QObject* parent) : QObject(parent), d{new cuc::Hub::Private{this}} |
1741 | { |
1742 | + /* read environment variables */ |
1743 | + QProcessEnvironment environment = QProcessEnvironment::systemEnvironment(); |
1744 | + if (environment.contains(QLatin1String("CONTENT_HUB_LOGGING_LEVEL"))) { |
1745 | + bool isOk; |
1746 | + int value = environment.value( |
1747 | + QLatin1String("CONTENT_HUB_LOGGING_LEVEL")).toInt(&isOk); |
1748 | + if (isOk) |
1749 | + setLoggingLevel(value); |
1750 | + } |
1751 | } |
1752 | |
1753 | cuc::Hub::~Hub() |
1754 | @@ -65,7 +76,7 @@ |
1755 | |
1756 | void cuc::Hub::register_import_export_handler(cuc::ImportExportHandler* handler) |
1757 | { |
1758 | - qDebug() << Q_FUNC_INFO; |
1759 | + TRACE() << Q_FUNC_INFO; |
1760 | QString id = app_id(); |
1761 | |
1762 | if (id.isEmpty()) |
1763 | @@ -116,7 +127,7 @@ |
1764 | |
1765 | cuc::Peer cuc::Hub::default_source_for_type(cuc::Type t) |
1766 | { |
1767 | - qDebug() << Q_FUNC_INFO; |
1768 | + TRACE() << Q_FUNC_INFO; |
1769 | auto reply = d->service->DefaultSourceForType(t.id()); |
1770 | reply.waitForFinished(); |
1771 | |
1772 | @@ -215,9 +226,9 @@ |
1773 | cuc::Transfer *transfer = cuc::Transfer::Private::make_transfer(reply.value(), this); |
1774 | |
1775 | QString peerName = peer.id().split("_")[0]; |
1776 | - qDebug() << Q_FUNC_INFO << "peerName: " << peerName; |
1777 | + TRACE() << Q_FUNC_INFO << "peerName: " << peerName; |
1778 | const cuc::Store *store = new cuc::Store{QStandardPaths::writableLocation(QStandardPaths::GenericCacheLocation) + "/" + peerName + "/HubIncoming/" + QString::number(transfer->id()), this}; |
1779 | - qDebug() << Q_FUNC_INFO << "STORE:" << store->uri(); |
1780 | + TRACE() << Q_FUNC_INFO << "STORE:" << store->uri(); |
1781 | transfer->setStore(store); |
1782 | transfer->start(); |
1783 | return transfer; |
1784 | @@ -236,9 +247,9 @@ |
1785 | |
1786 | cuc::Transfer *transfer = cuc::Transfer::Private::make_transfer(reply.value(), this); |
1787 | QString peerName = peer.id().split("_")[0]; |
1788 | - qDebug() << Q_FUNC_INFO << "peerName: " << peerName; |
1789 | + TRACE() << Q_FUNC_INFO << "peerName: " << peerName; |
1790 | const cuc::Store *store = new cuc::Store{QStandardPaths::writableLocation(QStandardPaths::GenericCacheLocation) + "/" + peerName + "/HubIncoming/" + QString::number(transfer->id()), this}; |
1791 | - qDebug() << Q_FUNC_INFO << "STORE:" << store->uri(); |
1792 | + TRACE() << Q_FUNC_INFO << "STORE:" << store->uri(); |
1793 | transfer->setStore(store); |
1794 | transfer->start(); |
1795 | return transfer; |
1796 | |
1797 | === modified file 'src/com/ubuntu/content/peer.cpp' |
1798 | --- src/com/ubuntu/content/peer.cpp 2014-03-21 00:29:33 +0000 |
1799 | +++ src/com/ubuntu/content/peer.cpp 2014-03-21 00:29:34 +0000 |
1800 | @@ -16,10 +16,10 @@ |
1801 | * Authored by: Thomas Voß <thomas.voss@canonical.com> |
1802 | */ |
1803 | |
1804 | - |
1805 | #include <gio/gdesktopappinfo.h> |
1806 | #include <com/ubuntu/content/peer.h> |
1807 | #include <QMetaType> |
1808 | +#include "debug.h" |
1809 | |
1810 | namespace cuc = com::ubuntu::content; |
1811 | |
1812 | @@ -27,7 +27,7 @@ |
1813 | { |
1814 | Private (QString id, bool isDefaultPeer) : id(id), isDefaultPeer(isDefaultPeer) |
1815 | { |
1816 | - qDebug() << Q_FUNC_INFO << id; |
1817 | + TRACE() << Q_FUNC_INFO << id; |
1818 | if (name.isEmpty()) |
1819 | { |
1820 | QString desktop_id(id + ".desktop"); |
1821 | @@ -69,7 +69,7 @@ |
1822 | |
1823 | cuc::Peer::Peer(const QString& id, bool isDefaultPeer, QObject* parent) : QObject(parent), d(new cuc::Peer::Private{id, isDefaultPeer}) |
1824 | { |
1825 | - qDebug() << Q_FUNC_INFO; |
1826 | + TRACE() << Q_FUNC_INFO; |
1827 | } |
1828 | |
1829 | cuc::Peer::Peer(const cuc::Peer& rhs) : QObject(rhs.parent()), d(rhs.d) |
1830 | @@ -147,7 +147,7 @@ |
1831 | |
1832 | const QDBusArgument &operator>>(const QDBusArgument &argument, cuc::Peer &peer) |
1833 | { |
1834 | - qDebug() << Q_FUNC_INFO; |
1835 | + TRACE() << Q_FUNC_INFO; |
1836 | QString id; |
1837 | QString name; |
1838 | QByteArray ic; |
1839 | |
1840 | === modified file 'src/com/ubuntu/content/service/CMakeLists.txt' |
1841 | --- src/com/ubuntu/content/service/CMakeLists.txt 2014-03-21 00:29:33 +0000 |
1842 | +++ src/com/ubuntu/content/service/CMakeLists.txt 2014-03-21 00:29:34 +0000 |
1843 | @@ -32,6 +32,7 @@ |
1844 | |
1845 | main.cpp |
1846 | registry.cpp |
1847 | + ../debug.cpp |
1848 | ${CONTENT_SERVICE_SKELETON} |
1849 | ) |
1850 | |
1851 | |
1852 | === modified file 'src/com/ubuntu/content/service/helper.cpp' |
1853 | --- src/com/ubuntu/content/service/helper.cpp 2014-03-21 00:29:33 +0000 |
1854 | +++ src/com/ubuntu/content/service/helper.cpp 2014-03-21 00:29:34 +0000 |
1855 | @@ -19,6 +19,7 @@ |
1856 | #include <QCoreApplication> |
1857 | |
1858 | #include "hook.h" |
1859 | +#include "debug.h" |
1860 | |
1861 | namespace cuc = com::ubuntu::content; |
1862 | |
1863 | @@ -26,7 +27,7 @@ |
1864 | { |
1865 | QCoreApplication app(argc, argv); |
1866 | |
1867 | - qDebug() << Q_FUNC_INFO; |
1868 | + TRACE() << Q_FUNC_INFO; |
1869 | |
1870 | if (app.arguments().count() > 1) |
1871 | { |
1872 | @@ -34,6 +35,16 @@ |
1873 | return 1; |
1874 | } |
1875 | |
1876 | + /* read environment variables */ |
1877 | + QProcessEnvironment environment = QProcessEnvironment::systemEnvironment(); |
1878 | + if (environment.contains(QLatin1String("CONTENT_HUB_LOGGING_LEVEL"))) { |
1879 | + bool isOk; |
1880 | + int value = environment.value( |
1881 | + QLatin1String("CONTENT_HUB_LOGGING_LEVEL")).toInt(&isOk); |
1882 | + if (isOk) |
1883 | + setLoggingLevel(value); |
1884 | + } |
1885 | + |
1886 | new cuc::detail::Hook(); |
1887 | |
1888 | app.exec(); |
1889 | |
1890 | === modified file 'src/com/ubuntu/content/service/hook.cpp' |
1891 | --- src/com/ubuntu/content/service/hook.cpp 2014-03-21 00:29:33 +0000 |
1892 | +++ src/com/ubuntu/content/service/hook.cpp 2014-03-21 00:29:34 +0000 |
1893 | @@ -22,10 +22,10 @@ |
1894 | #include <QFile> |
1895 | #include <QDir> |
1896 | #include <QStandardPaths> |
1897 | -#include <QDebug> |
1898 | #include <QTimer> |
1899 | #include <com/ubuntu/content/peer.h> |
1900 | |
1901 | +#include "debug.h" |
1902 | #include "hook.h" |
1903 | |
1904 | namespace cucd = com::ubuntu::content::detail; |
1905 | @@ -45,7 +45,7 @@ |
1906 | |
1907 | void cucd::Hook::run() |
1908 | { |
1909 | - qDebug() << Q_FUNC_INFO; |
1910 | + TRACE() << Q_FUNC_INFO; |
1911 | /* Looks for files in ${HOME}/.local/share/content-hub/${id} installed |
1912 | * by click packages. These files are JSON, for example: |
1913 | * |
1914 | @@ -76,7 +76,7 @@ |
1915 | |
1916 | Q_FOREACH(QString p, all_peers) |
1917 | { |
1918 | - qDebug() << Q_FUNC_INFO << "Looking for" << p; |
1919 | + TRACE() << Q_FUNC_INFO << "Looking for" << p; |
1920 | QStringList pp = contentDir.entryList(QStringList("*"+ p)); |
1921 | if (pp.isEmpty()) |
1922 | registry->remove_peer(com::ubuntu::content::Peer{p}); |
1923 | @@ -90,7 +90,7 @@ |
1924 | |
1925 | bool cucd::Hook::add_peer(QFileInfo result) |
1926 | { |
1927 | - qDebug() << Q_FUNC_INFO << "Hook:" << result.filePath(); |
1928 | + TRACE() << Q_FUNC_INFO << "Hook:" << result.filePath(); |
1929 | |
1930 | QStringList knownTypes; |
1931 | knownTypes << "pictures" << "music" << "contacts" << "documents"; |
1932 | @@ -117,7 +117,7 @@ |
1933 | if (knownTypes.contains(k)) |
1934 | { |
1935 | if (registry->install_source_for_type(cuc::Type{k}, peer)) |
1936 | - qDebug() << "Installed source:" << peer.id() << "for type:" << k; |
1937 | + TRACE() << "Installed source:" << peer.id() << "for type:" << k; |
1938 | } |
1939 | else |
1940 | qWarning() << "Failed to install" << peer.id() << "unknown type:" << k; |
1941 | @@ -129,7 +129,7 @@ |
1942 | if (knownTypes.contains(k)) |
1943 | { |
1944 | if (registry->install_destination_for_type(cuc::Type{k}, peer)) |
1945 | - qDebug() << "Installed destination:" << peer.id() << "for type:" << k; |
1946 | + TRACE() << "Installed destination:" << peer.id() << "for type:" << k; |
1947 | } |
1948 | else |
1949 | qWarning() << "Failed to install" << peer.id() << "unknown type:" << k; |
1950 | @@ -141,7 +141,7 @@ |
1951 | if (knownTypes.contains(k)) |
1952 | { |
1953 | if (registry->install_share_for_type(cuc::Type{k}, peer)) |
1954 | - qDebug() << "Installed share:" << peer.id() << "for type:" << k; |
1955 | + TRACE() << "Installed share:" << peer.id() << "for type:" << k; |
1956 | } |
1957 | else |
1958 | qWarning() << "Failed to install" << peer.id() << "unknown type:" << k; |
1959 | |
1960 | === modified file 'src/com/ubuntu/content/service/main.cpp' |
1961 | --- src/com/ubuntu/content/service/main.cpp 2014-03-21 00:29:33 +0000 |
1962 | +++ src/com/ubuntu/content/service/main.cpp 2014-03-21 00:29:34 +0000 |
1963 | @@ -17,10 +17,11 @@ |
1964 | */ |
1965 | |
1966 | #include <QCoreApplication> |
1967 | -#include <QDebug> |
1968 | +#include <QProcessEnvironment> |
1969 | #include <csignal> |
1970 | |
1971 | #include "detail/app_manager.h" |
1972 | +#include "debug.h" |
1973 | #include "common.h" |
1974 | #include "registry.h" |
1975 | #include "detail/service.h" |
1976 | @@ -44,13 +45,13 @@ |
1977 | }); |
1978 | |
1979 | foreach (QString r, result) { |
1980 | - qDebug() << "PEER: " << r; |
1981 | + TRACE() << "PEER: " << r; |
1982 | } |
1983 | } |
1984 | |
1985 | void shutdown(int sig) |
1986 | { |
1987 | - qDebug() << Q_FUNC_INFO << sig; |
1988 | + TRACE() << Q_FUNC_INFO << sig; |
1989 | QCoreApplication::instance()->quit(); |
1990 | } |
1991 | } |
1992 | @@ -60,6 +61,16 @@ |
1993 | int ret = 0; |
1994 | QCoreApplication *app = new QCoreApplication(argc, argv); |
1995 | |
1996 | + /* read environment variables */ |
1997 | + QProcessEnvironment environment = QProcessEnvironment::systemEnvironment(); |
1998 | + if (environment.contains(QLatin1String("CONTENT_HUB_LOGGING_LEVEL"))) { |
1999 | + bool isOk; |
2000 | + int value = environment.value( |
2001 | + QLatin1String("CONTENT_HUB_LOGGING_LEVEL")).toInt(&isOk); |
2002 | + if (isOk) |
2003 | + setLoggingLevel(value); |
2004 | + } |
2005 | + |
2006 | auto connection = QDBusConnection::sessionBus(); |
2007 | |
2008 | auto registry = QSharedPointer<cucd::PeerRegistry>(new Registry()); |
2009 | @@ -96,7 +107,7 @@ |
2010 | ret = app->exec(); |
2011 | } |
2012 | |
2013 | - qDebug() << "Server exiting, cleaning up"; |
2014 | + TRACE() << "Server exiting, cleaning up"; |
2015 | delete server; |
2016 | return ret; |
2017 | } |
2018 | |
2019 | === modified file 'src/com/ubuntu/content/service/registry.cpp' |
2020 | --- src/com/ubuntu/content/service/registry.cpp 2014-03-21 00:29:33 +0000 |
2021 | +++ src/com/ubuntu/content/service/registry.cpp 2014-03-21 00:29:34 +0000 |
2022 | @@ -16,6 +16,7 @@ |
2023 | * Authored by: Ken VanDine <ken.vandine@canonical.com> |
2024 | */ |
2025 | |
2026 | +#include "debug.h" |
2027 | #include "registry.h" |
2028 | #include "utils.cpp" |
2029 | #include <upstart-app-launch.h> |
2030 | @@ -54,7 +55,7 @@ |
2031 | |
2032 | cuc::Peer Registry::default_source_for_type(cuc::Type type) |
2033 | { |
2034 | - qDebug() << Q_FUNC_INFO << type.id(); |
2035 | + TRACE() << Q_FUNC_INFO << type.id(); |
2036 | if (m_defaultSources->keys().contains(type.id())) |
2037 | { |
2038 | QStringList as(m_defaultSources->get(type.id()).toStringList()); |
2039 | @@ -72,32 +73,32 @@ |
2040 | |
2041 | void Registry::enumerate_known_peers(const std::function<void(const cuc::Peer&)>&for_each) |
2042 | { |
2043 | - qDebug() << Q_FUNC_INFO; |
2044 | + TRACE() << Q_FUNC_INFO; |
2045 | |
2046 | Q_FOREACH (QString type_id, m_sources->keys()) |
2047 | { |
2048 | - qDebug() << Q_FUNC_INFO << type_id; |
2049 | + TRACE() << Q_FUNC_INFO << type_id; |
2050 | Q_FOREACH (QString k, m_sources->get(type_id).toStringList()) |
2051 | { |
2052 | - qDebug() << Q_FUNC_INFO << k; |
2053 | + TRACE() << Q_FUNC_INFO << k; |
2054 | for_each(cuc::Peer{k}); |
2055 | } |
2056 | } |
2057 | Q_FOREACH (QString type_id, m_dests->keys()) |
2058 | { |
2059 | - qDebug() << Q_FUNC_INFO << type_id; |
2060 | + TRACE() << Q_FUNC_INFO << type_id; |
2061 | Q_FOREACH (QString k, m_dests->get(type_id).toStringList()) |
2062 | { |
2063 | - qDebug() << Q_FUNC_INFO << k; |
2064 | + TRACE() << Q_FUNC_INFO << k; |
2065 | for_each(cuc::Peer{k}); |
2066 | } |
2067 | } |
2068 | Q_FOREACH (QString type_id, m_shares->keys()) |
2069 | { |
2070 | - qDebug() << Q_FUNC_INFO << type_id; |
2071 | + TRACE() << Q_FUNC_INFO << type_id; |
2072 | Q_FOREACH (QString k, m_shares->get(type_id).toStringList()) |
2073 | { |
2074 | - qDebug() << Q_FUNC_INFO << k; |
2075 | + TRACE() << Q_FUNC_INFO << k; |
2076 | for_each(cuc::Peer{k}); |
2077 | } |
2078 | } |
2079 | @@ -105,14 +106,14 @@ |
2080 | |
2081 | void Registry::enumerate_known_sources_for_type(cuc::Type type, const std::function<void(const cuc::Peer&)>&for_each) |
2082 | { |
2083 | - qDebug() << Q_FUNC_INFO << type.id(); |
2084 | + TRACE() << Q_FUNC_INFO << type.id(); |
2085 | |
2086 | if (type == cuc::Type::unknown()) |
2087 | return; |
2088 | |
2089 | Q_FOREACH (QString k, m_sources->get(type.id()).toStringList()) |
2090 | { |
2091 | - qDebug() << Q_FUNC_INFO << k; |
2092 | + TRACE() << Q_FUNC_INFO << k; |
2093 | bool defaultPeer = false; |
2094 | QStringList as(m_defaultSources->get(type.id()).toStringList()); |
2095 | if (!as.isEmpty()) |
2096 | @@ -128,31 +129,31 @@ |
2097 | |
2098 | void Registry::enumerate_known_destinations_for_type(cuc::Type type, const std::function<void(const cuc::Peer&)>&for_each) |
2099 | { |
2100 | - qDebug() << Q_FUNC_INFO << type.id(); |
2101 | + TRACE() << Q_FUNC_INFO << type.id(); |
2102 | Q_FOREACH (QString k, m_dests->get(type.id()).toStringList()) |
2103 | { |
2104 | - qDebug() << Q_FUNC_INFO << k; |
2105 | + TRACE() << Q_FUNC_INFO << k; |
2106 | for_each(cuc::Peer{k}); |
2107 | } |
2108 | } |
2109 | |
2110 | void Registry::enumerate_known_shares_for_type(cuc::Type type, const std::function<void(const cuc::Peer&)>&for_each) |
2111 | { |
2112 | - qDebug() << Q_FUNC_INFO << type.id(); |
2113 | + TRACE() << Q_FUNC_INFO << type.id(); |
2114 | |
2115 | Q_FOREACH (QString k, m_shares->get(type.id()).toStringList()) |
2116 | { |
2117 | - qDebug() << Q_FUNC_INFO << k; |
2118 | + TRACE() << Q_FUNC_INFO << k; |
2119 | for_each(cuc::Peer{k}); |
2120 | } |
2121 | } |
2122 | |
2123 | bool Registry::install_default_source_for_type(cuc::Type type, cuc::Peer peer) |
2124 | { |
2125 | - qDebug() << Q_FUNC_INFO << "type:" << type.id() << "peer:" << peer.id(); |
2126 | + TRACE() << Q_FUNC_INFO << "type:" << type.id() << "peer:" << peer.id(); |
2127 | if (m_defaultSources->keys().contains(type.id())) |
2128 | { |
2129 | - qDebug() << Q_FUNC_INFO << "Default peer for" << type.id() << "already installed."; |
2130 | + TRACE() << Q_FUNC_INFO << "Default peer for" << type.id() << "already installed."; |
2131 | return false; |
2132 | } |
2133 | |
2134 | @@ -162,7 +163,7 @@ |
2135 | |
2136 | bool Registry::install_source_for_type(cuc::Type type, cuc::Peer peer) |
2137 | { |
2138 | - qDebug() << Q_FUNC_INFO << "type:" << type.id() << "peer:" << peer.id(); |
2139 | + TRACE() << Q_FUNC_INFO << "type:" << type.id() << "peer:" << peer.id(); |
2140 | QStringList l = m_sources->get(type.id()).toStringList(); |
2141 | if (not l.contains(peer.id())) |
2142 | { |
2143 | @@ -174,7 +175,7 @@ |
2144 | |
2145 | bool Registry::install_destination_for_type(cuc::Type type, cuc::Peer peer) |
2146 | { |
2147 | - qDebug() << Q_FUNC_INFO << "type:" << type.id() << "peer:" << peer.id(); |
2148 | + TRACE() << Q_FUNC_INFO << "type:" << type.id() << "peer:" << peer.id(); |
2149 | QStringList l = m_dests->get(type.id()).toStringList(); |
2150 | if (not l.contains(peer.id())) |
2151 | { |
2152 | @@ -186,7 +187,7 @@ |
2153 | |
2154 | bool Registry::install_share_for_type(cuc::Type type, cuc::Peer peer) |
2155 | { |
2156 | - qDebug() << Q_FUNC_INFO << "type:" << type.id() << "peer:" << peer.id(); |
2157 | + TRACE() << Q_FUNC_INFO << "type:" << type.id() << "peer:" << peer.id(); |
2158 | QStringList l = m_shares->get(type.id()).toStringList(); |
2159 | if (not l.contains(peer.id())) |
2160 | { |
2161 | @@ -198,7 +199,7 @@ |
2162 | |
2163 | bool Registry::remove_peer(cuc::Peer peer) |
2164 | { |
2165 | - qDebug() << Q_FUNC_INFO << "peer:" << peer.id(); |
2166 | + TRACE() << Q_FUNC_INFO << "peer:" << peer.id(); |
2167 | bool ret = false; |
2168 | Q_FOREACH (QString type_id, m_sources->keys()) |
2169 | { |
2170 | |
2171 | === modified file 'src/com/ubuntu/content/service/registry.h' |
2172 | --- src/com/ubuntu/content/service/registry.h 2014-03-21 00:29:33 +0000 |
2173 | +++ src/com/ubuntu/content/service/registry.h 2014-03-21 00:29:34 +0000 |
2174 | @@ -20,7 +20,6 @@ |
2175 | #define REGISTRY_H |
2176 | |
2177 | #include <QGSettings/QGSettings> |
2178 | -#include <QDebug> |
2179 | #include <com/ubuntu/content/peer.h> |
2180 | #include <com/ubuntu/content/type.h> |
2181 | #include "detail/peer_registry.h" |
2182 | |
2183 | === modified file 'src/com/ubuntu/content/transfer.cpp' |
2184 | --- src/com/ubuntu/content/transfer.cpp 2014-03-21 00:29:33 +0000 |
2185 | +++ src/com/ubuntu/content/transfer.cpp 2014-03-21 00:29:34 +0000 |
2186 | @@ -43,7 +43,7 @@ |
2187 | |
2188 | cuc::Transfer::~Transfer() |
2189 | { |
2190 | - qDebug() << Q_FUNC_INFO; |
2191 | + TRACE() << Q_FUNC_INFO; |
2192 | purge_store_cache(d->store().uri()); |
2193 | } |
2194 | |
2195 | |
2196 | === modified file 'src/com/ubuntu/content/utils.cpp' |
2197 | --- src/com/ubuntu/content/utils.cpp 2014-03-21 00:29:33 +0000 |
2198 | +++ src/com/ubuntu/content/utils.cpp 2014-03-21 00:29:34 +0000 |
2199 | @@ -27,6 +27,7 @@ |
2200 | #include <nih-dbus/dbus_util.h> |
2201 | |
2202 | #include "common.h" |
2203 | +#include "debug.h" |
2204 | #include "com/ubuntu/content/type.h" |
2205 | |
2206 | namespace cuc = com::ubuntu::content; |
2207 | @@ -46,7 +47,7 @@ |
2208 | /* sanitize the dbus names */ |
2209 | QString sanitize_id(const QString& appId) |
2210 | { |
2211 | - qDebug() << Q_FUNC_INFO; |
2212 | + TRACE() << Q_FUNC_INFO; |
2213 | return QString(nih_dbus_path(NULL, |
2214 | "", |
2215 | appId.toLocal8Bit().data(), |
2216 | @@ -80,7 +81,7 @@ |
2217 | |
2218 | QString aa_profile(QString uniqueConnectionId) |
2219 | { |
2220 | - qDebug() << Q_FUNC_INFO << uniqueConnectionId; |
2221 | + TRACE() << Q_FUNC_INFO << uniqueConnectionId; |
2222 | QDBusMessage msg = |
2223 | QDBusMessage::createMethodCall("org.freedesktop.DBus", |
2224 | "/org/freedesktop/DBus", |
2225 | @@ -94,7 +95,7 @@ |
2226 | QDBusConnection::sessionBus().call(msg, QDBus::Block); |
2227 | if (reply.type() == QDBusMessage::ReplyMessage) { |
2228 | aaProfile = reply.arguments().value(0, QString()).toString(); |
2229 | - qDebug() << "AppArmor Profile:" << aaProfile; |
2230 | + TRACE() << "AppArmor Profile:" << aaProfile; |
2231 | } else { |
2232 | qWarning() << "Error getting app ID:" << reply.errorName() << |
2233 | reply.errorMessage(); |
2234 | @@ -109,7 +110,7 @@ |
2235 | |
2236 | QString copy_to_store(const QString& src, const QString& store) |
2237 | { |
2238 | - qDebug() << Q_FUNC_INFO; |
2239 | + TRACE() << Q_FUNC_INFO; |
2240 | QUrl srcUrl(src); |
2241 | if (not srcUrl.isLocalFile()) |
2242 | return srcUrl.url(); |
2243 | @@ -120,7 +121,7 @@ |
2244 | if (not st.exists()) |
2245 | st.mkpath(st.absolutePath()); |
2246 | QString destFilePath = store + QDir::separator() + fi.fileName(); |
2247 | - qDebug() << Q_FUNC_INFO << destFilePath; |
2248 | + TRACE() << Q_FUNC_INFO << destFilePath; |
2249 | bool result = QFile::copy(fi.filePath(), destFilePath); |
2250 | if (not result) |
2251 | { |
2252 | @@ -132,7 +133,7 @@ |
2253 | |
2254 | bool is_persistent(QString store) |
2255 | { |
2256 | - qDebug() << Q_FUNC_INFO << store; |
2257 | + TRACE() << Q_FUNC_INFO << store; |
2258 | QRegExp rx("*.cache/*/HubIncoming/*"); |
2259 | rx.setPatternSyntax(QRegExp::Wildcard); |
2260 | rx.setCaseSensitivity(Qt::CaseSensitive); |
2261 | @@ -141,18 +142,18 @@ |
2262 | |
2263 | bool purge_store_cache(QString store) |
2264 | { |
2265 | - qDebug() << Q_FUNC_INFO << "Store:" << store; |
2266 | + TRACE() << Q_FUNC_INFO << "Store:" << store; |
2267 | |
2268 | if (is_persistent(store)) |
2269 | { |
2270 | - qDebug() << Q_FUNC_INFO << store << "is persistent"; |
2271 | + TRACE() << Q_FUNC_INFO << store << "is persistent"; |
2272 | return false; |
2273 | } |
2274 | |
2275 | QDir st(store); |
2276 | if (st.exists()) |
2277 | { |
2278 | - qDebug() << Q_FUNC_INFO << store << "isn't persistent, purging"; |
2279 | + TRACE() << Q_FUNC_INFO << store << "isn't persistent, purging"; |
2280 | return st.removeRecursively(); |
2281 | } |
2282 |
PASSED: Continuous integration, rev:138 jenkins. qa.ubuntu. com/job/ content- hub-ci/ 121/ jenkins. qa.ubuntu. com/job/ content- hub-trusty- amd64-ci/ 24 jenkins. qa.ubuntu. com/job/ content- hub-trusty- armhf-ci/ 24 jenkins. qa.ubuntu. com/job/ content- hub-trusty- armhf-ci/ 24/artifact/ work/output/ *zip*/output. zip jenkins. qa.ubuntu. com/job/ content- hub-trusty- i386-ci/ 24
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild: s-jenkins. ubuntu- ci:8080/ job/content- hub-ci/ 121/rebuild
http://