23 #define __DOWNLOAD_CONTROLLER_PRIVATE_H__ |
23 #define __DOWNLOAD_CONTROLLER_PRIVATE_H__ |
24 |
24 |
25 #include <QObject> |
25 #include <QObject> |
26 #include "BWFGlobal.h" |
26 #include "BWFGlobal.h" |
27 |
27 |
28 class QNetworkProxy; |
28 #ifdef USE_DOWNLOAD_MANAGER |
29 class QString; |
29 #include "download.h" |
30 class QUrl; |
30 #include "downloadmanager.h" |
31 |
31 |
|
32 |
|
33 // This seems to be necessary to use unqualified download manager |
|
34 // class names in the slots declarations below. We need to use |
|
35 // unqualified names because the signals they get connected to |
|
36 // use unqualified names and moc doesn't realize that DownloadXXX |
|
37 // and WRT::DownloadXXX are equivalent for some values of XXX. |
|
38 using namespace WRT; |
|
39 #else |
32 class Download; |
40 class Download; |
33 class DownloadEvent; |
41 class DownloadEvent; |
34 class DownloadManager; |
42 class DownloadManager; |
|
43 class DownloadManagerEvent; |
|
44 class Error; |
|
45 class QNetworkReply; |
|
46 #endif |
|
47 class QFileInfo; |
|
48 class QNetworkProxy; |
|
49 class QNetworkRequest; |
|
50 class QString; |
|
51 class QUrl; |
35 |
52 |
36 class DownloadController; |
53 class DownloadController; |
37 |
54 |
38 class BWF_EXPORT DownloadControllerPrivate : public QObject |
55 class BWF_EXPORT DownloadControllerPrivate : public QObject |
39 { |
56 { |
|
57 Q_OBJECT |
|
58 |
40 public: |
59 public: |
41 DownloadControllerPrivate( |
60 DownloadControllerPrivate( |
42 DownloadController * controller, |
61 DownloadController * controller, |
43 const QString & client, |
62 const QString & client, |
44 const QNetworkProxy & proxy); |
63 const QNetworkProxy & proxy); |
48 void startDownload(const QUrl & url, const QFileInfo & info); |
67 void startDownload(const QUrl & url, const QFileInfo & info); |
49 void startDownload(QNetworkReply * reply); |
68 void startDownload(QNetworkReply * reply); |
50 void startDownload(const QNetworkRequest & request); |
69 void startDownload(const QNetworkRequest & request); |
51 |
70 |
52 private: |
71 private: |
53 void startDownload(Download * download, const QUrl & url); |
72 #ifdef USE_DOWNLOAD_MANAGER |
|
73 void startDownload( |
|
74 WRT::Download * download, |
|
75 const QUrl & url); |
|
76 #else |
|
77 void startDownload( |
|
78 Download * download, |
|
79 const QUrl & url); |
|
80 #endif |
54 |
81 |
55 bool handleDownloadManagerEvent(DownloadEvent * event); |
82 public slots: |
56 bool handleDownloadEvent(DownloadEvent * event); |
83 void handleDownloadManagerEvent(DownloadManagerEvent * event); |
57 |
84 void handleDownloadEvent(DownloadEvent * event); |
58 protected: |
85 #ifdef USE_DOWNLOAD_MANAGER |
59 bool event(QEvent * event); |
86 void handleDownloadError(Error error); |
|
87 #endif |
60 |
88 |
61 private: |
89 private: |
62 DownloadController * m_downloadController; |
90 DownloadController * m_downloadController; |
|
91 #ifdef USE_DOWNLOAD_MANAGER |
|
92 WRT::DownloadManager * m_downloadManager; // owned |
|
93 #else |
63 DownloadManager * m_downloadManager; // owned |
94 DownloadManager * m_downloadManager; // owned |
|
95 #endif |
64 }; |
96 }; |
65 |
97 |
66 #endif // __DOWNLOAD_CONTROLLER_PRIVATE_H__ |
98 #endif // __DOWNLOAD_CONTROLLER_PRIVATE_H__ |