Merge lp:~mandel/ubuntu-download-manager/documentation into lp:ubuntu-download-manager

Proposed by Manuel de la Peña
Status: Merged
Merged at revision: 262
Proposed branch: lp:~mandel/ubuntu-download-manager/documentation
Merge into: lp:ubuntu-download-manager
Diff against target: 1760 lines (+1125/-84)
15 files modified
ubuntu-download-manager-client-tests/ubuntu-download-manager-client-tests.pro (+1/-1)
ubuntu-download-manager-client/ubuntu/download_manager/download.h (+188/-0)
ubuntu-download-manager-client/ubuntu/download_manager/error.h (+294/-38)
ubuntu-download-manager-client/ubuntu/download_manager/manager.h (+184/-4)
ubuntu-download-manager-common/ubuntu/download_manager/auth_error_struct.h (+60/-2)
ubuntu-download-manager-common/ubuntu/download_manager/download_struct.cpp (+0/-3)
ubuntu-download-manager-common/ubuntu/download_manager/download_struct.h (+113/-2)
ubuntu-download-manager-common/ubuntu/download_manager/group_download_struct.cpp (+0/-9)
ubuntu-download-manager-common/ubuntu/download_manager/group_download_struct.h (+68/-4)
ubuntu-download-manager-common/ubuntu/download_manager/http_error_struct.cpp (+2/-2)
ubuntu-download-manager-common/ubuntu/download_manager/http_error_struct.h (+53/-3)
ubuntu-download-manager-common/ubuntu/download_manager/network_error_struct.cpp (+2/-2)
ubuntu-download-manager-common/ubuntu/download_manager/network_error_struct.h (+56/-3)
ubuntu-download-manager-common/ubuntu/download_manager/process_error_struct.cpp (+5/-5)
ubuntu-download-manager-common/ubuntu/download_manager/process_error_struct.h (+99/-6)
To merge this branch: bzr merge lp:~mandel/ubuntu-download-manager/documentation
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Approve
Diego Sarmentero (community) Approve
Review via email: mp+209664@code.launchpad.net

Commit message

Improved the documentation of the project. The registerMetaType function was removed because it is not needed and not used in any part of the code. const have been added in those methods that simply are used as getters. The descturtors that can be trusted to the compiler have been removed to reduce clutter in the code.

Description of the change

Improve the documentation of the project. This is a first step, more to will be added.

To post a comment you must log in.
251. By Manuel de la Peña

Merged with trunk.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
252. By Manuel de la Peña

Merged with trunk.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
253. By Manuel de la Peña

Increase timeout.

Revision history for this message
Diego Sarmentero (diegosarmentero) wrote :

+1

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'ubuntu-download-manager-client-tests/ubuntu-download-manager-client-tests.pro'
2--- ubuntu-download-manager-client-tests/ubuntu-download-manager-client-tests.pro 2014-02-05 13:04:13 +0000
3+++ ubuntu-download-manager-client-tests/ubuntu-download-manager-client-tests.pro 2014-03-19 19:29:24 +0000
4@@ -57,5 +57,5 @@
5
6
7 check.depends = $${TARGET}
8-check.commands = LD_LIBRARY_PATH=$$OUT_PWD/../ubuntu-download-manager-common:$$OUT_PWD/../ubuntu-download-manager-client:$$OUT_PWD/../ubuntu-download-manager-test-lib:$$OUT_PWD/../ubuntu-download-manager-priv dbus-test-runner -m 120 --task=./$${TARGET} -c
9+check.commands = LD_LIBRARY_PATH=$$OUT_PWD/../ubuntu-download-manager-common:$$OUT_PWD/../ubuntu-download-manager-client:$$OUT_PWD/../ubuntu-download-manager-test-lib:$$OUT_PWD/../ubuntu-download-manager-priv dbus-test-runner -m 240 --task=./$${TARGET} -c
10 QMAKE_EXTRA_TARGETS += check
11
12=== modified file 'ubuntu-download-manager-client/ubuntu/download_manager/download.h'
13--- ubuntu-download-manager-client/ubuntu/download_manager/download.h 2014-02-12 12:01:11 +0000
14+++ ubuntu-download-manager-client/ubuntu/download_manager/download.h 2014-03-19 19:29:24 +0000
15@@ -29,6 +29,24 @@
16 namespace DownloadManager {
17
18 class Error;
19+
20+/*!
21+ \class Download
22+ \brief The Download class allows to control a download that
23+ was created in the download manager.
24+ \since 0.3
25+
26+ The Download class represents a download request that was
27+ created to be performed by the download manager.
28+
29+ Due to the asynchronous nature of the API a download request
30+ is not performed on the Download object creation but after
31+ the client has requested it via the \l Download::start method.
32+
33+ \note The ownership of the Download is relayed to the caller and
34+ therefore the client must call delete or deleteLater whenever it
35+ considers to be appropriate.
36+*/
37 class DOWNLOAD_MANAGER_EXPORT Download : public QObject {
38 Q_OBJECT
39
40@@ -36,33 +54,203 @@
41 explicit Download(QObject* parent = 0)
42 : QObject(parent) {}
43
44+ /*!
45+ \fn void Download::start()
46+
47+ Notifies the download manager that the download that is
48+ represented by this download object is ready to be downloaded.
49+
50+ The normal use case is that the client of the API connects to
51+ all the download signals that he is interested in and the calls the
52+ start methods. This pattern ensures that if a download is performed
53+ that all signals are connected else the client could see cases in
54+ where no signals are received because the download finished before
55+ he connected to the signals.
56+ */
57 virtual void start() = 0;
58+
59+ /*!
60+ \fn void Download::pause()
61+
62+ Notifies the download manager that the download represented by this
63+ download object must be paused.
64+ */
65 virtual void pause() = 0;
66+
67+ /*!
68+ \fn void Download::resume()
69+
70+ Notifies the download manager that the download represented by this
71+ download object must be resumed. There is no guarantee that nor errors
72+ will be raised if a not paused download is resumed.
73+ */
74 virtual void resume() = 0;
75+
76+ /*!
77+ \fn void Download::cancel()
78+
79+ Notifies the download manager that the download represented by this
80+ download object must be canceled and all it resources must be cleaned.
81+ */
82 virtual void cancel() = 0;
83
84+ /*!
85+ \fn void Download::allowMobileDownload(bool allowed)
86+
87+ Notifies the download manager that the download represented by this
88+ download object is allowed or not to use the phones mobile data whenever
89+ the devices is connected to it. If the download is not allows to use
90+ mobile data it will be automatically paused until a valid network
91+ connection is present.
92+ */
93 virtual void allowMobileDownload(bool allowed) = 0;
94+
95+ /*!
96+ \fn bool isMobileDownloadAllowed()
97+
98+ Returns if the download represented by this download object is allowed to
99+ use the phones mobile data connection.
100+ */
101 virtual bool isMobileDownloadAllowed() = 0;
102
103+ /*!
104+ \fn void setThrottle(qulonglong speed)
105+
106+ Notifies the download manager that the download represented by this
107+ download object has its download bandwidth limited to the value
108+ provided by \a speed represented in bytes.
109+ */
110 virtual void setThrottle(qulonglong speed) = 0;
111+
112+ /*!
113+ \fn qulonglong throttle()
114+
115+ Returns the bandwidth limit that was set for the download represented
116+ by this object. If the result is 0 is that no limit was set.
117+ */
118 virtual qulonglong throttle() = 0;
119
120+ /*!
121+ \fn QString id() const
122+
123+ Returns the unique identifier that represents the download within
124+ the download manager.
125+ */
126 virtual QString id() const = 0;
127+
128+ /*!
129+ \fn QVariantMap metadata()
130+
131+ Returns the metadata used upon creation of the download represented
132+ by the object.
133+ */
134 virtual QVariantMap metadata() = 0;
135+
136+ /*!
137+ \fn qulonglong progress()
138+
139+ Returns the size of all the data downloaded so far in bytes.
140+ */
141 virtual qulonglong progress() = 0;
142+
143+ /*!
144+ \fn qulonglong totalSize()
145+
146+ Returns the totals size estimated for the download. The result can
147+ be 0 when the download manager was not able to deduce the download
148+ size due to a wrong configuration of the server.
149+ */
150 virtual qulonglong totalSize() = 0;
151
152+ /*!
153+ \fn bool isError() const
154+
155+ Returns if the download represented by the object has had an error.
156+ */
157 virtual bool isError() const = 0;
158+
159+ /*!
160+ \fn Error* error() const
161+
162+ Returns the last error encountered by the download object.
163+ */
164 virtual Error* error() const = 0;
165
166 signals:
167+
168+ /*!
169+ \fn void Download::canceled(bool success)
170+
171+ This signal is emitted whenever a download cancellation was requested
172+ and notifies if the cancellation was successful or not via \a success.
173+ */
174 void canceled(bool success);
175+
176+ /*!
177+ \fn void Download::error(Error* error)
178+
179+ This signal is emitted whenever and error occurred during a download.
180+ To get more information about the cause of the error the client can check
181+ the type of the error via \l Error::type() and cast \a error to the
182+ appropriate subclass.
183+ */
184 void error(Error* error);
185+
186+ /*!
187+ \fn void Download::finished(const QString& path)
188+
189+ This signal is emitted whenever a download has successfully completed.
190+ \a path is the absolute local file path where the downloaded file can
191+ be found.
192+ */
193 void finished(const QString& path);
194+
195+ /*!
196+ \fn void Download::paused(bool success)
197+
198+ This signal is emitted whenever a download paused was requested and
199+ notifies if the pause was successful or not via \a success.
200+ */
201 void paused(bool success);
202+
203+ /*!
204+ \fn void Download::processing(const QString& path)
205+
206+ This signal is emitted whenever a post processing action is being
207+ performed on the download file indicated by \a path.
208+ */
209 void processing(const QString &path);
210+
211+ /*!
212+ \fn void Download::progress(qulonglong received, qulonglong total)
213+
214+ This signal is emitted to indicate the progress of the download where
215+ \a received is the number of bytes received and \a total is the total
216+ size of the download.
217+
218+ \note If the download manager is not able to estimate the size of
219+ a download, which is something that can happen when the server does
220+ not correctly send the size back, \a received and \a total will have
221+ the same value. The fact that the values are the same \tt DOES NOT
222+ mean that a download was completed for that the signals
223+ \l Download::finished(const QString& path) should be used.
224+ */
225 void progress(qulonglong received, qulonglong total);
226+
227+ /*!
228+ \fn void Download::resumed(bool success)
229+
230+ This signal is emitted whenever a download resume was requested and
231+ notifies if the resume was successful via \a success.
232+ */
233 void resumed(bool success);
234+
235+ /*!
236+ \fn void Download::started(bool success)
237+
238+ This signal is emitted whenever a download start was requested and
239+ notifies if the start action was successful via \a success.
240+ */
241 void started(bool success);
242
243 };
244
245=== modified file 'ubuntu-download-manager-client/ubuntu/download_manager/error.h'
246--- ubuntu-download-manager-client/ubuntu/download_manager/error.h 2014-02-19 18:25:53 +0000
247+++ ubuntu-download-manager-client/ubuntu/download_manager/error.h 2014-03-19 19:29:24 +0000
248@@ -34,34 +34,79 @@
249 class NetworkErrorStruct;
250 class ProcessErrorStruct;
251 class ErrorPrivate;
252+
253+/*!
254+ \class Error
255+ \brief The Error class is the base class that represents an
256+ error in the download manager API.
257+ \since 0.3
258+
259+ The Error class represents an error in the download manager and
260+ can be of a number of types. The API is designed so that the client
261+ only needs to listen to a single error signal and that can later
262+ downcast the error class to get more detailed information.
263+*/
264 class DOWNLOAD_MANAGER_EXPORT Error : public QObject {
265 Q_OBJECT
266 Q_DECLARE_PRIVATE(Error)
267
268 public:
269+
270+ /*!
271+ Enumerator that represents the error type.
272+ */
273 enum Type {
274- Auth,
275- DBus,
276- Http,
277- Network,
278- Process
279+ Auth, /*! The error was due to a proxy or server authentication issue.*/
280+ DBus, /*! The error was due to some problem when communicating with the dbus API.*/
281+ Http, /*! The error was due to a http error, for example a 404.*/
282+ Network, /*! The error was due to network problems such as a missing network interface.*/
283+ Process /*! The error was due to a problem when executing the post download command.*/
284 };
285
286+ /*!
287+ Disposes of this error and frees any resources associated with it.
288+ */
289 virtual ~Error();
290+
291+ /*!
292+ \fn void Error::Type()
293+
294+ Returns the type of the error that was encountered.
295+ */
296 Type type();
297+
298+ /*!
299+ \fn QString errorString()
300+
301+ Returns a string representation of the error.
302+ */
303 virtual QString errorString();
304
305 protected:
306+ /*!
307+ Creates a new error of the given type and with the given parent.
308+ \internal
309+ */
310 Error(Type type, QObject* parent = 0);
311
312 private:
313- // use pimpl pattern so that users do not have to be recompiled
314+ /*!
315+ Use pimpl pattern so that users do not have to be recompiled
316+ \internal
317+ */
318 ErrorPrivate* d_ptr;
319
320 };
321
322
323 class DBusErrorPrivate;
324+
325+/*!
326+ \class DbusError
327+ \brief The DbusError represents an error that occurred during the
328+ interaction with the DBus API.
329+ \since 0.3
330+*/
331 class DOWNLOAD_MANAGER_EXPORT DBusError : public Error {
332 Q_OBJECT
333 Q_DECLARE_PRIVATE(DBusError)
334@@ -72,20 +117,62 @@
335 friend class DownloadPendingCallWatcher;
336 friend class GroupManagerPendingCallWatcher;
337
338+ /*!
339+ Disposes of this error and frees any resources associated with it.
340+ */
341 virtual ~DBusError();
342+
343+ /*!
344+ \fn QString message()
345+
346+ Returns a DBus error message that is readable by a human.
347+ */
348 QString message();
349+
350+ /*!
351+ \fn QString name();
352+
353+ Returns the name of the DBus error.
354+ */
355 QString name();
356+
357+ /*!
358+ \fn QString errorString() override
359+
360+ Returns a string representation of the error.
361+ */
362 QString errorString() override;
363
364 protected:
365+
366+ /*!
367+ Creates a new error from the provided QDbusError with a
368+ given parent.
369+ \internal
370+ */
371 DBusError(QDBusError err, QObject* parent = 0);
372
373 private:
374- // use pimpl pattern so that users do not have to be recompiled
375+ /*!
376+ Use pimpl pattern so that users do not have to be recompiled
377+ \internal
378+ */
379 DBusErrorPrivate* d_ptr;
380 };
381
382 class AuthErrorPrivate;
383+
384+/*!
385+ \class AuthError
386+ \brief The AuthError represents an authentication error that occurred
387+ during the request of the download.
388+ \since 0.3
389+
390+ The AuthError can occur due to two different reasons, either the
391+ download required a server side authentication or the download was
392+ performed via a proxy that requires authentication and was not
393+ provided.
394+*/
395 class DOWNLOAD_MANAGER_EXPORT AuthError : public Error {
396 Q_OBJECT
397 Q_DECLARE_PRIVATE(AuthError)
398@@ -93,25 +180,68 @@
399 friend class DownloadImpl;
400
401 public:
402+
403+ /*!
404+ Enumerator that represents the type of authentication error.
405+ */
406 enum Type {
407- Server,
408- Proxy
409+ Server, /*! The server needed authentication and it was not provided.*/
410+ Proxy /*! The proxy needed authentication and it was not provided. */
411 };
412
413+ /*!
414+ Disposes of this error and frees any resources associated with it.
415+ */
416 virtual ~AuthError();
417+
418+ /*!
419+ /fn Type type()
420+
421+ Returns the type of authentication error.
422+ */
423 Type type();
424+
425+ /*!
426+ /fn QString phrase()
427+
428+ Returns a human readable explanation for the authentication
429+ error.
430+ */
431 QString phrase();
432+
433+ /*!
434+ /fn QString errorString() override
435+
436+ Returns a string representation of the error.
437+ */
438 QString errorString() override;
439
440 protected:
441+ /*!
442+ Creates a new error from the provided authentication error struct.
443+ \internal
444+ */
445 AuthError(AuthErrorStruct err, QObject* parent);
446
447 private:
448- // use pimpl pattern so that users do not have to be recompiled
449+ /*!
450+ Use pimpl pattern so that users do not have to be recompiled
451+ \internal
452+ */
453 AuthErrorPrivate* d_ptr;
454 };
455
456 class HttpErrorPrivate;
457+
458+/*!
459+ \class HttpError
460+ \brief The HttpError represents an error that occurred during the
461+ download request.
462+ \since 0.3
463+
464+ The HttpError represents an error that occurred during the download
465+ request and that is related to one of the known http 1.1 error codes.
466+*/
467 class DOWNLOAD_MANAGER_EXPORT HttpError : public Error {
468 Q_OBJECT
469 Q_DECLARE_PRIVATE(HttpError)
470@@ -119,20 +249,57 @@
471 friend class DownloadImpl;
472
473 public:
474+
475+ /*!
476+ Disposes of this error and frees any resources associated with it.
477+ */
478 virtual ~HttpError();
479+
480+ /*!
481+ /fn int code()
482+
483+ Returns the http error code, for example 404.
484+ */
485 int code();
486+
487+ /*!
488+ /fn QString phrase()
489+
490+ Returns a human readable reason for the http error.
491+ */
492 QString phrase();
493+
494+ /*!
495+ /fn QString errorString() override
496+
497+ Returns a string representation of the error.
498+ */
499 QString errorString() override;
500
501 protected:
502+
503+ /*!
504+ Creates a new error from the provided http error struct.
505+ \internal
506+ */
507 HttpError(HttpErrorStruct err, QObject* parent);
508
509 private:
510- // use pimpl pattern so that users do not have to be recompiled
511+ /*!
512+ Use pimpl pattern so that users do not have to be recompiled
513+ \internal
514+ */
515 HttpErrorPrivate* d_ptr;
516 };
517
518 class NetworkErrorPrivate;
519+
520+/*!
521+ \class NetworkError
522+ \brief The NetworkError represents an error that occurred during the
523+ download request.
524+ \since 0.3
525+*/
526 class DOWNLOAD_MANAGER_EXPORT NetworkError : public Error {
527 Q_OBJECT
528 Q_DECLARE_PRIVATE(NetworkError)
529@@ -140,48 +307,89 @@
530 friend class DownloadImpl;
531
532 public:
533+
534+ /*!
535+ Enumerator that indicates all possible error conditions found during
536+ the processing of the request.
537+ */
538 enum ErrorCode {
539- ConnectionRefusedError,
540- RemoteHostClosedError,
541- HostNotFoundError,
542- TimeoutError,
543- OperationCanceledError,
544- SslHandshakeFailedError,
545- TemporaryNetworkFailureError,
546- NetworkSessionFailedError,
547- BackgroundRequestNotAllowedError,
548- ProxyConnectionRefusedError,
549- ProxyConnectionClosedError,
550- ProxyNotFoundError,
551- ProxyTimeoutError,
552- ProxyAuthenticationRequiredError,
553- ContentAccessDenied,
554- ContentOperationNotPermittedError,
555- ContentNotFoundError,
556- AuthenticationRequiredError,
557- ContentReSendError,
558- ProtocolUnknownError,
559- ProtocolInvalidOperationError,
560- UnknownNetworkError,
561- UnknownProxyError,
562- UnknownContentError,
563- ProtocolFailure
564+ ConnectionRefusedError, /*! The remote server refused the connection (the server is not accepting requests). */
565+ RemoteHostClosedError, /*! The remote server closed the connection prematurely, before the entire reply was received and processed. */
566+ HostNotFoundError, /*! The remote host name was not found (invalid hostname). */
567+ TimeoutError, /*! The connection to the remote server timed out. */
568+ OperationCanceledError, /*! The operation was canceled. */
569+ SslHandshakeFailedError, /*! The SSL/TLS handshake failed and the encrypted channel could not be established. */
570+ TemporaryNetworkFailureError, /*! The connection was broken due to disconnection from the networkd. */
571+ NetworkSessionFailedError, /*! The connection was broken due to disconnection from the network or failure to start the network. */
572+ BackgroundRequestNotAllowedError, /*! The background request is not currently allowed due to platform policy. */
573+ ProxyConnectionRefusedError, /*! The connection to the proxy server was refused (the proxy server is not accepting requests. )*/
574+ ProxyConnectionClosedError, /*! The proxy server closed the connection prematurely, before the entire reply was received and processed. */
575+ ProxyNotFoundError, /*! The proxy host name was not found (invalid proxy hostname). */
576+ ProxyTimeoutError, /*! The connection to the proxy timed out or the proxy did not reply in time to the request sent. */
577+ ProxyAuthenticationRequiredError, /*! The proxy requires authentication in order to honour the request but did not accept any credentials offered.*/
578+ ContentAccessDenied, /*! The access to the remote content was denied. */
579+ ContentOperationNotPermittedError, /*! The operation requested on the remote content is not permitted. */
580+ ContentNotFoundError, /*! The remote content was not found at the server. */
581+ AuthenticationRequiredError, /*! The remote server requires authentication to serve the content but the credentials provided were not accepted. */
582+ ContentReSendError, /*! The request needed to be sent again, but this failed. */
583+ ProtocolUnknownError, /*! The Network Access API cannot honor the request because the protocol is not known. */
584+ ProtocolInvalidOperationError, /*! The requested operation is invalid for this protocol. */
585+ UnknownNetworkError, /*! An unknown network-related error was detected. */
586+ UnknownProxyError, /*! An unknown proxy-related error was detected. */
587+ UnknownContentError, /*! An breakdown in protocol was detected. */
588+ ProtocolFailure /*! A breakdown in protocol was detected. */
589 };
590
591+ /*!
592+ Disposes of this error and frees any resources associated with it.
593+ */
594 virtual ~NetworkError();
595+
596+ /*!
597+ /fn ErrorCode code()
598+
599+ Returns the code that represents the occurred error.
600+ */
601 ErrorCode code();
602+
603+ /*!
604+ /fn QString phrase()
605+
606+ Returns a human readable explanation of the occurred error.
607+ */
608 QString phrase();
609+
610+ /*!
611+ /fn QString errorString() override
612+
613+ Returns a string representation of the error.
614+ */
615 QString errorString() override;
616
617 protected:
618+
619+ /*!
620+ Creates a new error from the provided http error struct.
621+ \internal
622+ */
623 NetworkError(NetworkErrorStruct err, QObject* parent);
624
625 private:
626- // use pimpl pattern so that users do not have to be recompiled
627+ /*!
628+ Use pimpl pattern so that users do not have to be recompiled
629+ \internal
630+ */
631 NetworkErrorPrivate* d_ptr;
632 };
633
634 class ProcessErrorPrivate;
635+
636+/*!
637+ \class ProcessError
638+ \brief The ProcessError represents an error that occurred during the
639+ post processing of a downloaded file.
640+ \since 0.3
641+*/
642 class DOWNLOAD_MANAGER_EXPORT ProcessError : public Error {
643 Q_OBJECT
644 Q_DECLARE_PRIVATE(ProcessError)
645@@ -189,19 +397,67 @@
646 friend class DownloadImpl;
647
648 public:
649+
650+ /*!
651+ Disposes of this error and frees any resources associated with it.
652+ */
653 virtual ~ProcessError();
654+
655+ /*!
656+ /fn QProcess::ProcessError code()
657+
658+ Returns the code of the process error.
659+ */
660 QProcess::ProcessError code();
661+
662+ /*!
663+ /fn QString phrase()
664+
665+ Returns a human readable explanation of the occurred process error.
666+ */
667 QString phrase();
668+
669+ /*!
670+ /fn int exitCode()
671+
672+ Returns the exit code of the executed process.
673+ */
674 int exitCode();
675+
676+ /*!
677+ /fn QString standardOut()
678+
679+ Returns the standard output of the executed process.
680+ */
681 QString standardOut();
682+
683+ /*!
684+ /fn QString standardError()
685+
686+ Returns the standard error of the executed process.
687+ */
688 QString standardError();
689+
690+ /*!
691+ /fn QString errorString() override
692+
693+ Returns a string representation of the error.
694+ */
695 QString errorString() override;
696
697 protected:
698+
699+ /*!
700+ Creates a new error from the provided process error struct.
701+ \internal
702+ */
703 ProcessError(ProcessErrorStruct err, QObject* parent);
704
705 private:
706- // use pimpl pattern so that users do not have to be recompiled
707+ /*!
708+ Use pimpl pattern so that users do not have to be recompiled
709+ \internal
710+ */
711 ProcessErrorPrivate* d_ptr;
712 };
713
714
715=== modified file 'ubuntu-download-manager-client/ubuntu/download_manager/manager.h'
716--- ubuntu-download-manager-client/ubuntu/download_manager/manager.h 2014-02-12 12:01:11 +0000
717+++ ubuntu-download-manager-client/ubuntu/download_manager/manager.h 2014-03-19 19:29:24 +0000
718@@ -36,9 +36,36 @@
719 class Error;
720 class GroupDownload;
721
722+/*!
723+ Callback to be executed that takes a download object created by
724+ the manager.
725+*/
726 typedef std::function<void(Download*)> DownloadCb;
727+
728+/*!
729+ Callback to be executed that takes a group download object created by
730+ the manager.
731+*/
732 typedef std::function<void(GroupDownload*)> GroupCb;
733
734+/*!
735+ \class Manager
736+ \brief The Manager class is the entry point of the download manager
737+ API and allows the client to create download requests in the
738+ download manager.
739+ \since 0.3
740+
741+ The Manager is the entry point of the API and allows to create new
742+ downloads that will be performed by the download manager. The
743+ class allows to have two different types of managers:
744+
745+ - Session manager: Connects to the session dbus service.
746+ - System manager: Connects to the system dbus service.
747+
748+ The general rule of thumb is that a normal client application must
749+ connect to the session which contains all the downloads created for
750+ the user in the current session.
751+*/
752 class DOWNLOAD_MANAGER_EXPORT Manager : public QObject {
753 Q_OBJECT
754
755@@ -46,36 +73,189 @@
756 explicit Manager(QObject* parent = 0)
757 : QObject(parent) {}
758
759+ /*!
760+ \fn void createDownload(DownloadStruct downStruct)
761+
762+ Creates a new download using the data found in the structure.
763+ The \l void downloadCreated(Download* down) can be used to get
764+ a pointer to the new created download.
765+
766+ \note The download object ownership from
767+ \l void downloadCreated(Download* down) is of the caller and
768+ the download manager will not delete it.
769+ */
770 virtual void createDownload(DownloadStruct downStruct) = 0;
771+
772+ /*!
773+ \fn void createDownload(DownloadStruct downStruct, DownloadCb cb, DownloadCb errCb)
774+
775+ Creates a new download using the data found in the structure.
776+ \a cb will be executed when a successful download creation occurs while
777+ \a errCb will be executed when there was an error during the creation
778+ of the download object.
779+
780+ \note Even when the callbacks are executed the
781+ \l void downloadCreated(Download* down) is emitted.
782+
783+ \note The download object ownership from
784+ \l void downloadCreated(Download* down) is of the caller and
785+ the download manager will not delete it.
786+ */
787 virtual void createDownload(DownloadStruct downStruct,
788 DownloadCb cb,
789 DownloadCb errCb) = 0;
790+
791+ /*!
792+ \fn void createDownload(StructList downs, const QString& algorithm, bool allowed3G, const QVariantMap& metadata, StringMap headers)
793+
794+ Creates a group download with the data found in the structure.
795+ The \l void groupCreated(GroupDownload* down) signal can be used to
796+ get a pointer to the new created group download.
797+
798+ \note The download object ownership from
799+ \l void downloadCreated(Download* down) is of the caller and
800+ the download manager will not delete it.
801+ */
802 virtual void createDownload(StructList downs,
803- const QString &algorithm,
804+ const QString& algorithm,
805 bool allowed3G,
806- const QVariantMap &metadata,
807+ const QVariantMap& metadata,
808 StringMap headers) = 0;
809+
810+ /*!
811+ \fn void createDownload(StructList downs, const QString& algorithm, bool allowed3G, const QVariantMap& metadata, StringMap headers, GroupCb cb, GroupCb errCb)
812+
813+ Creates a group download with the data found in the structure.
814+ \a cb will be executed when a successful group download creation
815+ occurs while \a errCb will be executed when there was an error
816+ during the creation of the group download object.
817+
818+ \note Even when the callbacks are executed the
819+ \l void downloadCreated(Download* down) is emitted.
820+
821+ \note The download object ownership from
822+ \l void downloadCreated(Download* down) is of the caller and
823+ the download manager will not delete it.
824+ */
825 virtual void createDownload(StructList downs,
826- const QString &algorithm,
827+ const QString& algorithm,
828 bool allowed3G,
829- const QVariantMap &metadata,
830+ const QVariantMap& metadata,
831 StringMap headers,
832 GroupCb cb,
833 GroupCb errCb) = 0;
834
835+ /*!
836+ \fn bool isError() const
837+
838+ Returns if the manager received an error during the execution
839+ of a command.
840+ */
841 virtual bool isError() const = 0;
842+
843+ /*!
844+ \fn Error* lastError() const
845+
846+ Returns the last error that occurred when interacting with the
847+ download manager.
848+ */
849 virtual Error* lastError() const = 0;
850+
851+ /*!
852+ \fn void Download::allowMobileDownload(bool allowed)
853+
854+ Allows to set a general setting that will ensure that all downloads
855+ managed by the download manager are allowed to use the phones
856+ mobile data or not.
857+
858+ \note Confined applications are not allowed to set this setting
859+ and therefore an error would happen.
860+ */
861 virtual void allowMobileDataDownload(bool allowed) = 0;
862+
863+ /*!
864+ \fn bool isMobileDownloadAllowed()
865+
866+ Returns if, as a general setting, the downloads created by the
867+ download manager are allowed to use the phones mobile data.
868+ */
869 virtual bool isMobileDataDownload() = 0;
870+
871+ /*!
872+ \fn qulonglong defaultThrottle()
873+
874+ Returns the default bandwidth limit that was set for the downloads
875+ that are present in the download manager.
876+ */
877 virtual qulonglong defaultThrottle() = 0;
878+
879+ /*!
880+ \fn void setDefaultThrottle(qulonglong speed)
881+
882+ Allows to set the default bandwidth limit to all the downloads in
883+ the download manager.
884+
885+ \note Confined applications are not allowed to set this setting
886+ and therefore an error would happen.
887+ */
888 virtual void setDefaultThrottle(qulonglong speed) = 0;
889+
890+ /*!
891+ \fn void exit()
892+
893+ Allows to stop the download manager. This method should not be used
894+ in production because it was added to simplify integration testing
895+ with the download manager.
896+
897+ \note Confined applications are not allowed to set this setting
898+ and therefore an error would happen.
899+ */
900 virtual void exit() = 0;
901
902+ /*!
903+ \fn static Manager* createSessionManager(const QString& path="", QObject* parent=0)
904+
905+ Creates a new manager that will be connected to the session manager.
906+ \a path allows to provide the path where the download manager service
907+ can be found. In the general use case \a path does not need to be
908+ provided and the default value should be used.
909+
910+ \note \a path is exposed to allow integration tests with the download
911+ manager by starting a download manager in a path and later
912+ providing the path to the client library.
913+ */
914 static Manager* createSessionManager(const QString& path = "", QObject* parent=0);
915+
916+ /*!
917+ \fn static Manager* createSystemManager(const QString& path = "", QObject* parent=0)
918+
919+ Creates a new manager that will be connected to the system manager.
920+ \a path allows to provide the path where the download manager service
921+ can be found. In the general use case \a path does not need to be
922+ provided and the default value should be used.
923+
924+ \note \a path is exposed to allow integration tests with the download
925+ manager by starting a download manager in a path and later
926+ providing the path to the client library.
927+ */
928 static Manager* createSystemManager(const QString& path = "", QObject* parent=0);
929
930 signals:
931+
932+ /*!
933+ \fn void downloadCreated(Download* down)
934+
935+ This signal is emitted whenever a download is created by the
936+ download manager.
937+ */
938 void downloadCreated(Download* down);
939+
940+ /*!
941+ \fn void groupCreated(GroupDownload* down)
942+
943+ This signal is emitted whenever a group download is created by the
944+ download manager.
945+ */
946 void groupCreated(GroupDownload* down);
947
948 };
949
950=== modified file 'ubuntu-download-manager-common/ubuntu/download_manager/auth_error_struct.h'
951--- ubuntu-download-manager-common/ubuntu/download_manager/auth_error_struct.h 2014-02-11 15:35:52 +0000
952+++ ubuntu-download-manager-common/ubuntu/download_manager/auth_error_struct.h 2014-03-19 19:29:24 +0000
953@@ -27,36 +27,94 @@
954
955 namespace DownloadManager {
956
957+/*!
958+ \class AuthErrorStruct
959+ \brief The AuthErrorStruct represents the dbus structure that is used
960+ to communicate authentication errors that happened in the download
961+ manager to the different clients.
962+ \since 0.3
963+*/
964 class AuthErrorStruct {
965 Q_PROPERTY(AuthErrorStruct::Type type READ getType)
966 Q_PROPERTY(QString phrase READ getPhrase)
967 public:
968+
969+ /*!
970+ Enumerator that represents the error type.
971+ */
972 enum Type {
973- Server,
974- Proxy
975+ Server, /*! The server needed authentication and it was not provided.*/
976+ Proxy /*! The proxy needed authentication and it was not provided. */
977 };
978
979+ /*!
980+ Creates a new structure with the default values.
981+ */
982 AuthErrorStruct();
983+
984+ /*!
985+ Creates a new structure with the given error types and message.
986+ */
987 AuthErrorStruct(AuthErrorStruct::Type type, QString phrase);
988+
989+ /*!
990+ Creates a new structure with the given error types and message.
991+ */
992 AuthErrorStruct(int type, QString phrase);
993+
994+ /*!
995+ Copy constructor.
996+ */
997 AuthErrorStruct(const AuthErrorStruct& other);
998+
999+ /*!
1000+ Assign operator.
1001+ */
1002 AuthErrorStruct& operator=(const AuthErrorStruct& other);
1003
1004+ /*!
1005+ \internal
1006+ */
1007 friend QDBusArgument &operator<<(QDBusArgument &argument,
1008 const AuthErrorStruct& error);
1009+
1010+ /*!
1011+ \internal
1012+ */
1013 friend const QDBusArgument &operator>>(const QDBusArgument &argument,
1014 AuthErrorStruct& error);
1015
1016 // properties getters
1017+
1018+ /*!
1019+ \fn AuthErrorStruct::Type getType()
1020+
1021+ Returns the type of the error.
1022+ */
1023 AuthErrorStruct::Type getType();
1024+
1025+ /*!
1026+ \fn QString getPhrase()
1027+
1028+ Returns the message of the error.
1029+ */
1030 QString getPhrase();
1031
1032 private:
1033+
1034+ /*!
1035+ \internal
1036+ */
1037 AuthErrorStruct::Type _type;
1038+
1039+ /*!
1040+ \internal
1041+ */
1042 QString _phrase;
1043 };
1044
1045 } // DownloadManager
1046
1047 } // Ubuntu
1048+
1049 #endif // AUTH_ERROR_STRUCT_H
1050
1051=== modified file 'ubuntu-download-manager-common/ubuntu/download_manager/download_struct.cpp'
1052--- ubuntu-download-manager-common/ubuntu/download_manager/download_struct.cpp 2014-02-07 11:16:15 +0000
1053+++ ubuntu-download-manager-common/ubuntu/download_manager/download_struct.cpp 2014-03-19 19:29:24 +0000
1054@@ -79,9 +79,6 @@
1055 return *this;
1056 }
1057
1058-DownloadStruct::~DownloadStruct() {
1059-}
1060-
1061 QDBusArgument &operator<<(QDBusArgument &argument,
1062 const DownloadStruct& download) {
1063 argument.beginStructure();
1064
1065=== modified file 'ubuntu-download-manager-common/ubuntu/download_manager/download_struct.h'
1066--- ubuntu-download-manager-common/ubuntu/download_manager/download_struct.h 2014-02-07 11:20:13 +0000
1067+++ ubuntu-download-manager-common/ubuntu/download_manager/download_struct.h 2014-03-19 19:29:24 +0000
1068@@ -30,6 +30,19 @@
1069 namespace DownloadManager {
1070
1071 typedef QMap<QString, QString> StringList;
1072+
1073+/*!
1074+ \class DownloadStruct
1075+ \brief The DownloadStruct represents the dbus structure that is used
1076+ to communicate the download manager the details of a new
1077+ download to be created.
1078+ \since 0.3
1079+
1080+ The DownloadStruct is the configuration structure that is sent to the
1081+ download manager specifying the different attribute of a download. This
1082+ attributes include from the url to be downloaded to the hash checksum
1083+ and the algorithm used for the checksum.
1084+*/
1085 class DOWNLOAD_MANAGER_EXPORT DownloadStruct {
1086 Q_PROPERTY(QString url READ getUrl)
1087 Q_PROPERTY(QString hash READ getHash)
1088@@ -38,37 +51,135 @@
1089 Q_PROPERTY(StringList headers READ getHeaders)
1090
1091 public:
1092+ /*
1093+ */
1094 DownloadStruct();
1095+
1096+ /*
1097+ Creates a new download structure that will tell the download manager
1098+ to download the file found in the provided \q url with no metadata,
1099+ empty headers and without a checksum check.
1100+ */
1101 DownloadStruct(const QString& url);
1102+
1103+ /*
1104+ Creates a new download structure that will tell the download manager
1105+ to download the file found in the provided \a url with the given
1106+ \a metadata and \a headers but without a checksum check.
1107+ */
1108 DownloadStruct(const QString& url,
1109 const QVariantMap& metadata,
1110 const QMap<QString, QString>& headers);
1111+
1112+ /*
1113+ Creates a new download structure that will tell the download manager
1114+ to download the file found in the provided \a url with the given
1115+ \a metadata and \a headers. Once the file is download the checksum
1116+ check will be done against the provided \a hash using the specified
1117+ \a algorithm. The \a algorithm can be of one of the following string
1118+ values:
1119+
1120+ - "md5"
1121+ - "sha1"
1122+ - "sha224"
1123+ - "sha256"
1124+ - "sha384"
1125+ - "sha512"
1126+
1127+ \note If the hash provided is empty the download manager will assume
1128+ that there is no need to perform the checksum.
1129+ \note If the algorithm is an empty string or a not recognized value
1130+ md5 will be used.
1131+ */
1132 DownloadStruct(const QString& url,
1133 const QString& hash,
1134 const QString& algorithm,
1135 const QVariantMap& metadata,
1136 const QMap<QString, QString>& headers);
1137+
1138+ /*
1139+ Copy constructor.
1140+ */
1141 DownloadStruct(const DownloadStruct& other);
1142+
1143+ /*
1144+ Assign operator.
1145+ */
1146 DownloadStruct& operator=(const DownloadStruct& other);
1147- ~DownloadStruct();
1148
1149+ /*
1150+ \internal
1151+ */
1152 friend QDBusArgument &operator<<(QDBusArgument &argument,
1153 const DownloadStruct& download);
1154+
1155+ /*
1156+ \internal
1157+ */
1158 friend const QDBusArgument &operator>>(const QDBusArgument &argument,
1159 DownloadStruct& download);
1160
1161- // properties getters
1162+ /*
1163+ \fn QString getUrl()
1164+
1165+ Returns the url that points to the file that will be downloaded.
1166+ */
1167 QString getUrl();
1168+
1169+ /*
1170+ \fn QString getHash()
1171+
1172+ Returns the hash against which the checksum will be performed.
1173+ */
1174 QString getHash();
1175+
1176+ /*
1177+ \fn QString getAlgorithm()
1178+
1179+ Returns the algorithm that will be used to perform the checksum.
1180+ */
1181 QString getAlgorithm();
1182+
1183+ /*
1184+ \fn QVariantMap getMetadata()
1185+
1186+ Returns the metadata carried by the download.
1187+ */
1188 QVariantMap getMetadata();
1189+
1190+ /*
1191+ \fn QMap<QString, QString> getHeaders()
1192+
1193+ Returns the extra headers that will be used in the GET request of
1194+ the download.
1195+ */
1196 QMap<QString, QString> getHeaders();
1197
1198 private:
1199+
1200+ /*
1201+ \internal
1202+ */
1203 QString _url;
1204+
1205+ /*
1206+ \internal
1207+ */
1208 QString _hash;
1209+
1210+ /*
1211+ \internal
1212+ */
1213 QString _algorithm;
1214+
1215+ /*
1216+ \internal
1217+ */
1218 QVariantMap _metadata;
1219+
1220+ /*
1221+ \internal
1222+ */
1223 QMap<QString, QString> _headers;
1224 };
1225
1226
1227=== modified file 'ubuntu-download-manager-common/ubuntu/download_manager/group_download_struct.cpp'
1228--- ubuntu-download-manager-common/ubuntu/download_manager/group_download_struct.cpp 2014-02-13 17:26:17 +0000
1229+++ ubuntu-download-manager-common/ubuntu/download_manager/group_download_struct.cpp 2014-03-19 19:29:24 +0000
1230@@ -53,10 +53,6 @@
1231 return *this;
1232 }
1233
1234-GroupDownloadStruct::~GroupDownloadStruct() {
1235-}
1236-
1237-
1238 QDBusArgument &operator<<(QDBusArgument& argument,
1239 const GroupDownloadStruct& group) {
1240 argument.beginStructure();
1241@@ -79,11 +75,6 @@
1242 return argument;
1243 }
1244
1245-void GroupDownloadStruct::registerMetaType() {
1246- qRegisterMetaType<GroupDownloadStruct>("GroupDownloadStruct");
1247- qDBusRegisterMetaType<GroupDownloadStruct>();
1248-}
1249-
1250 QString
1251 GroupDownloadStruct::getUrl() const {
1252 return _url;
1253
1254=== modified file 'ubuntu-download-manager-common/ubuntu/download_manager/group_download_struct.h'
1255--- ubuntu-download-manager-common/ubuntu/download_manager/group_download_struct.h 2014-02-13 17:26:17 +0000
1256+++ ubuntu-download-manager-common/ubuntu/download_manager/group_download_struct.h 2014-03-19 19:29:24 +0000
1257@@ -28,35 +28,99 @@
1258
1259 namespace DownloadManager {
1260
1261+/*!
1262+ \class GroupDownloadStruct
1263+ \brief The GroupDownloadStruct represents a single download in a
1264+ group download that will be created in the download manager.
1265+ \since 0.3
1266+
1267+
1268+ Group downloads can be viewed as atomic operations that perform the
1269+ dowload of more than one file. This structure represents a single file
1270+ ins such a type of download and therefore exposes a subset of the
1271+ properties of a download.
1272+*/
1273 class DOWNLOAD_MANAGER_EXPORT GroupDownloadStruct {
1274 Q_PROPERTY(QString url READ getUrl)
1275 Q_PROPERTY(QString hash READ getHash)
1276 Q_PROPERTY(QString localFile READ getLocalFile)
1277
1278 public:
1279+ /*!
1280+ Creates a new group download structure with the default values.
1281+ */
1282 GroupDownloadStruct();
1283+
1284+ /*!
1285+ Creates a new group download structure that will download a file
1286+ from \a url and will store it in the given \a localFile. The client
1287+ can provided the \a hash against which the checksum will be
1288+ performed.
1289+
1290+ \note if \a hash is empty the download manager will not check the
1291+ hash of the downloaded file.
1292+ */
1293 GroupDownloadStruct(const QString& url, const QString& localFile,
1294 const QString& hash);
1295+
1296+ /*!
1297+ Copy constructor.
1298+ */
1299 GroupDownloadStruct(const GroupDownloadStruct& other);
1300+
1301+ /*!
1302+ Assign operator.
1303+ */
1304 GroupDownloadStruct& operator=(const GroupDownloadStruct& other);
1305- ~GroupDownloadStruct();
1306
1307+ /*!
1308+ \internal
1309+ */
1310 friend QDBusArgument &operator<<(QDBusArgument &argument,
1311 const GroupDownloadStruct& group);
1312+
1313+ /*!
1314+ \internal
1315+ */
1316 friend const QDBusArgument &operator>>(const QDBusArgument &argument,
1317 GroupDownloadStruct& group);
1318
1319- // register Secret with the Qt type system
1320- static void registerMetaType();
1321+ /*!
1322+ \fn getUrl() const
1323
1324- // property getters
1325+ Returns the url from which the download will be performed.
1326+ */
1327 QString getUrl() const;
1328+
1329+ /*!
1330+ \fn QString getHash() const
1331+
1332+ Returns the hash value against which the checksum will be performed.
1333+ */
1334 QString getHash() const;
1335+
1336+ /*!
1337+ \fn QString getLocalFile() const
1338+
1339+ Returns the local file where the download will be stored.
1340+ */
1341 QString getLocalFile() const;
1342
1343 private:
1344+
1345+ /*!
1346+ \internal
1347+ */
1348 QString _url;
1349+
1350+ /*!
1351+ \internal
1352+ */
1353 QString _localFile;
1354+
1355+ /*!
1356+ \internal
1357+ */
1358 QString _hash;
1359 };
1360
1361
1362=== modified file 'ubuntu-download-manager-common/ubuntu/download_manager/http_error_struct.cpp'
1363--- ubuntu-download-manager-common/ubuntu/download_manager/http_error_struct.cpp 2014-02-07 11:16:15 +0000
1364+++ ubuntu-download-manager-common/ubuntu/download_manager/http_error_struct.cpp 2014-03-19 19:29:24 +0000
1365@@ -66,12 +66,12 @@
1366 }
1367
1368 int
1369-HttpErrorStruct::getCode() {
1370+HttpErrorStruct::getCode() const {
1371 return _code;
1372 }
1373
1374 QString
1375-HttpErrorStruct::getPhrase() {
1376+HttpErrorStruct::getPhrase() const {
1377 return _phrase;
1378 }
1379
1380
1381=== modified file 'ubuntu-download-manager-common/ubuntu/download_manager/http_error_struct.h'
1382--- ubuntu-download-manager-common/ubuntu/download_manager/http_error_struct.h 2014-02-07 11:20:13 +0000
1383+++ ubuntu-download-manager-common/ubuntu/download_manager/http_error_struct.h 2014-03-19 19:29:24 +0000
1384@@ -28,31 +28,81 @@
1385
1386 namespace DownloadManager {
1387
1388+/*!
1389+ \class HttpErrorStruct
1390+ \brief The HttpErrorStruct represents the dbus structure that is used
1391+ to communicate http errors that happened in the download
1392+ manager to the different clients.
1393+ \since 0.3
1394+*/
1395 class DOWNLOAD_MANAGER_EXPORT HttpErrorStruct {
1396 Q_PROPERTY(int code READ getCode)
1397 Q_PROPERTY(QString phrase READ getPhrase)
1398+
1399 public:
1400+
1401+ /*!
1402+ Creates a new structure with the default values.
1403+ */
1404 HttpErrorStruct();
1405+
1406+ /*!
1407+ Creates a new structure with the given error types and message.
1408+ */
1409 HttpErrorStruct(int code, QString phrase);
1410+
1411+ /*!
1412+ Copy constructor.
1413+ */
1414 HttpErrorStruct(const HttpErrorStruct& other);
1415+
1416+ /*!
1417+ Assign operator.
1418+ */
1419 HttpErrorStruct& operator=(const HttpErrorStruct& other);
1420
1421
1422+ /*!
1423+ \internal
1424+ */
1425 friend QDBusArgument &operator<<(QDBusArgument &argument,
1426 const HttpErrorStruct& error);
1427+
1428+ /*!
1429+ \internal
1430+ */
1431 friend const QDBusArgument &operator>>(const QDBusArgument &argument,
1432 HttpErrorStruct& error);
1433
1434- // properties getters
1435- int getCode();
1436- QString getPhrase();
1437+ /*!
1438+ \fn int getCode() const
1439+
1440+ Returns the http error code.
1441+ */
1442+ int getCode() const;
1443+
1444+ /*!
1445+ \fn QString getPhrase() const
1446+
1447+ Returns a human readable message about the http error.
1448+ */
1449+ QString getPhrase() const;
1450
1451 private:
1452+
1453+ /*!
1454+ \internal
1455+ */
1456 int _code;
1457+
1458+ /*!
1459+ \internal
1460+ */
1461 QString _phrase;
1462 };
1463
1464 } // DownloadManager
1465
1466 } // Ubuntu
1467+
1468 #endif // HTTP_ERROR_STRUCT_H
1469
1470=== modified file 'ubuntu-download-manager-common/ubuntu/download_manager/network_error_struct.cpp'
1471--- ubuntu-download-manager-common/ubuntu/download_manager/network_error_struct.cpp 2014-02-07 11:16:15 +0000
1472+++ ubuntu-download-manager-common/ubuntu/download_manager/network_error_struct.cpp 2014-03-19 19:29:24 +0000
1473@@ -152,12 +152,12 @@
1474 }
1475
1476 int
1477-NetworkErrorStruct::getCode() {
1478+NetworkErrorStruct::getCode() const {
1479 return _code;
1480 }
1481
1482 QString
1483-NetworkErrorStruct::getPhrase() {
1484+NetworkErrorStruct::getPhrase() const {
1485 return _phrase;
1486 }
1487
1488
1489=== modified file 'ubuntu-download-manager-common/ubuntu/download_manager/network_error_struct.h'
1490--- ubuntu-download-manager-common/ubuntu/download_manager/network_error_struct.h 2014-02-07 11:20:13 +0000
1491+++ ubuntu-download-manager-common/ubuntu/download_manager/network_error_struct.h 2014-03-19 19:29:24 +0000
1492@@ -28,28 +28,81 @@
1493
1494 namespace DownloadManager {
1495
1496+/*!
1497+ \class NetworkErrorStruct
1498+ \brief The NetworkErrorStruct represents the dbus structure that is used
1499+ to communicate network errors that happened in the download
1500+ manager to the different clients.
1501+ \since 0.3
1502+*/
1503 class DOWNLOAD_MANAGER_EXPORT NetworkErrorStruct {
1504 Q_PROPERTY(int code READ getCode)
1505 Q_PROPERTY(QString phrase READ getPhrase)
1506
1507 public:
1508+
1509+ /*!
1510+ Creates a new structure with the default values.
1511+ */
1512 NetworkErrorStruct();
1513+
1514+ /*!
1515+ Creates an network error of the given type.
1516+ */
1517 NetworkErrorStruct(int error);
1518+
1519+ /*!
1520+ Creates a network error with the given type and a human readable
1521+ message.
1522+ */
1523 NetworkErrorStruct(int code, QString phrase);
1524+
1525+ /*!
1526+ Copy constructor.
1527+ */
1528 NetworkErrorStruct(const NetworkErrorStruct& other);
1529+
1530+ /*!
1531+ Assign operator.
1532+ */
1533 NetworkErrorStruct& operator=(const NetworkErrorStruct& other);
1534
1535+ /*!
1536+ \internal
1537+ */
1538 friend QDBusArgument &operator<<(QDBusArgument &argument,
1539 const NetworkErrorStruct& error);
1540+
1541+ /*!
1542+ \internal
1543+ */
1544 friend const QDBusArgument &operator>>(const QDBusArgument &argument,
1545 NetworkErrorStruct& error);
1546
1547- // property getters
1548- int getCode();
1549- QString getPhrase();
1550+ /*!
1551+ \fn int getCode() const
1552+
1553+ Returns the type of network error.
1554+ */
1555+ int getCode() const;
1556+
1557+ /*!
1558+ \fn QString getPhrase const()
1559+
1560+ Returns a human readable message about the network error.
1561+ */
1562+ QString getPhrase() const;
1563
1564 private:
1565+
1566+ /*!
1567+ \internal
1568+ */
1569 int _code;
1570+
1571+ /*!
1572+ \internal
1573+ */
1574 QString _phrase;
1575 };
1576
1577
1578=== modified file 'ubuntu-download-manager-common/ubuntu/download_manager/process_error_struct.cpp'
1579--- ubuntu-download-manager-common/ubuntu/download_manager/process_error_struct.cpp 2014-02-07 11:16:15 +0000
1580+++ ubuntu-download-manager-common/ubuntu/download_manager/process_error_struct.cpp 2014-03-19 19:29:24 +0000
1581@@ -128,27 +128,27 @@
1582 }
1583
1584 int
1585-ProcessErrorStruct::getCode() {
1586+ProcessErrorStruct::getCode() const {
1587 return _code;
1588 }
1589
1590 int
1591-ProcessErrorStruct::getExitCode() {
1592+ProcessErrorStruct::getExitCode() const {
1593 return _exitCode;
1594 }
1595
1596 QString
1597-ProcessErrorStruct::getPhrase() {
1598+ProcessErrorStruct::getPhrase() const {
1599 return _phrase;
1600 }
1601
1602 QString
1603-ProcessErrorStruct::getStandardOutput() {
1604+ProcessErrorStruct::getStandardOutput() const {
1605 return _stdout;
1606 }
1607
1608 QString
1609-ProcessErrorStruct::getStandardError() {
1610+ProcessErrorStruct::getStandardError() const {
1611 return _stderr;
1612 }
1613
1614
1615=== modified file 'ubuntu-download-manager-common/ubuntu/download_manager/process_error_struct.h'
1616--- ubuntu-download-manager-common/ubuntu/download_manager/process_error_struct.h 2014-02-07 11:20:13 +0000
1617+++ ubuntu-download-manager-common/ubuntu/download_manager/process_error_struct.h 2014-03-19 19:29:24 +0000
1618@@ -28,6 +28,13 @@
1619
1620 namespace DownloadManager {
1621
1622+/*!
1623+ \class ProcessErrorStruct
1624+ \brief The ProcessErrorStruct represents the dbus structure that is used
1625+ to communicate process errors that happened in the download
1626+ manager to the different clients.
1627+ \since 0.3
1628+*/
1629 class DOWNLOAD_MANAGER_EXPORT ProcessErrorStruct {
1630 Q_PROPERTY(int code READ getCode)
1631 Q_PROPERTY(int exitCode READ getExitCode)
1632@@ -36,37 +43,123 @@
1633 Q_PROPERTY(QString READ getStandardError)
1634
1635 public:
1636+
1637+ /*!
1638+ Creates a new structure with the default values.
1639+ */
1640 ProcessErrorStruct();
1641+
1642+ /*!
1643+ Create a new structure with the given error \a code and
1644+ a given human readable message.
1645+ */
1646 ProcessErrorStruct(int code, QString phrase);
1647+
1648+ /*!
1649+ Creates a new structure with the given error \a code and with
1650+ the exit details of the process. The process details are its
1651+ \a exitCode as well as the standard out via \a standardOut and
1652+ standard error via \a standarError
1653+ */
1654 ProcessErrorStruct(int code,
1655 int exitCode,
1656 QString standardOutput,
1657 QString standardError);
1658+
1659+ /*!
1660+ Creates a new structure with the given error \a code , a human
1661+ readable message and with the exit details of the process.
1662+ The process details are its \a exitCode as well as the standard
1663+ out via \a standardOut and standard error via \a standarError
1664+ */
1665 ProcessErrorStruct(int code,
1666 QString phrase,
1667 int exitCode,
1668 QString standardOutput,
1669 QString standardError);
1670+
1671+ /*!
1672+ Copy constructor.
1673+ */
1674 ProcessErrorStruct(const ProcessErrorStruct& other);
1675+
1676+ /*!
1677+ Assign operator.
1678+ */
1679 ProcessErrorStruct& operator=(const ProcessErrorStruct& other);
1680
1681+ /*!
1682+ \internal
1683+ */
1684 friend QDBusArgument &operator<<(QDBusArgument &argument,
1685 const ProcessErrorStruct& error);
1686+
1687+ /*!
1688+ \internal
1689+ */
1690 friend const QDBusArgument &operator>>(const QDBusArgument &argument,
1691 ProcessErrorStruct& error);
1692
1693- // property getters
1694- int getCode();
1695- int getExitCode();
1696- QString getPhrase();
1697- QString getStandardOutput();
1698- QString getStandardError();
1699+ /*!
1700+ \fn int getCode() const
1701+
1702+ Returns the error code of the process.
1703+ */
1704+ int getCode() const;
1705+
1706+ /*!
1707+ \fn int getExitCode() const
1708+
1709+ Returns the exit code of the process.
1710+ */
1711+ int getExitCode() const;
1712+
1713+ /*!
1714+ \fn QString getPhrase() const
1715+
1716+ Returns a human readable message of the occurred error.
1717+ */
1718+ QString getPhrase() const;
1719+
1720+ /*!
1721+ \fn QString getStandardOutput() const
1722+
1723+ Returns the standard output of the process.
1724+ */
1725+ QString getStandardOutput() const;
1726+
1727+ /*!
1728+ \fn QString getStandardError() const
1729+
1730+ Returns the standard error of the process.
1731+ */
1732+ QString getStandardError() const;
1733
1734 private:
1735+
1736+ /*!
1737+ \internal
1738+ */
1739 int _code;
1740+
1741+ /*!
1742+ \internal
1743+ */
1744 int _exitCode;
1745+
1746+ /*!
1747+ \internal
1748+ */
1749 QString _phrase;
1750+
1751+ /*!
1752+ \internal
1753+ */
1754 QString _stdout;
1755+
1756+ /*!
1757+ \internal
1758+ */
1759 QString _stderr;
1760 };
1761

Subscribers

People subscribed via source and target branches