src/partDownloader.h

changeset 814
c8ef30fd0e54
parent 794
c254ddc6618b
child 839
5f822ad61875
equal deleted inserted replaced
813:987f35e96467 814:c8ef30fd0e54
84 void sourceChanged (int i); 84 void sourceChanged (int i);
85 }; 85 };
86 86
87 // ============================================================================= 87 // =============================================================================
88 // 88 //
89 enum PartDownloadRequestState
90 {
91 DLRQ_Requesting,
92 DLRQ_Downloading,
93 DLRQ_Finished,
94 DLRQ_Failed,
95 };
96
89 class PartDownloadRequest : public QObject 97 class PartDownloadRequest : public QObject
90 { 98 {
91 public: 99 public:
92 enum EState 100 Q_OBJECT
93 { 101 PROPERTY (public, int, tableRow, setTableRow, STOCK_WRITE)
94 ERequesting, 102 PROPERTY (private, PartDownloadRequestState, state, setState, STOCK_WRITE)
95 EDownloading, 103 PROPERTY (private, PartDownloader*, prompt, setPrompt, STOCK_WRITE)
96 EFinished, 104 PROPERTY (private, QString, url, setURL, STOCK_WRITE)
97 EFailed, 105 PROPERTY (private, QString, destinaton, setDestination, STOCK_WRITE)
98 }; 106 PROPERTY (private, QString, filePath, setFilePath, STOCK_WRITE)
107 PROPERTY (private, QNetworkAccessManager*, networkManager, setNetworkManager, STOCK_WRITE)
108 PROPERTY (private, QNetworkReply*, networkReply, setNetworkReply, STOCK_WRITE)
109 PROPERTY (private, bool, isFirstUpdate, setFirstUpdate, STOCK_WRITE)
110 PROPERTY (private, int64, numBytesRead, setNumBytesRead, STOCK_WRITE)
111 PROPERTY (private, int64, numBytesTotal, setNumBytesTotal, STOCK_WRITE)
112 PROPERTY (private, bool, isPrimary, setPrimary, STOCK_WRITE)
113 PROPERTY (private, QFile*, filePointer, setFilePointer, STOCK_WRITE)
99 114
100 Q_OBJECT 115 public:
101 PROPERTY (public, int, tableRow, setTableRow, STOCK_WRITE) 116 explicit PartDownloadRequest (QString url, QString dest, bool primary, PartDownloader* parent);
102 PROPERTY (private, EState, state, setState, STOCK_WRITE) 117 PartDownloadRequest (const PartDownloadRequest&) = delete;
103 PROPERTY (private, PartDownloader*, prompt, setPrompt, STOCK_WRITE) 118 virtual ~PartDownloadRequest();
104 PROPERTY (private, QString, url, setURL, STOCK_WRITE) 119 void updateToTable();
105 PROPERTY (private, QString, destinaton, setDestination, STOCK_WRITE) 120 bool isFinished() const;
106 PROPERTY (private, QString, filePath, setFilePath, STOCK_WRITE) 121 void operator= (const PartDownloadRequest&) = delete;
107 PROPERTY (private, QNetworkAccessManager*, networkManager, setNetworkManager, STOCK_WRITE)
108 PROPERTY (private, QNetworkReply*, networkReply, setNetworkReply, STOCK_WRITE)
109 PROPERTY (private, bool, isFirstUpdate, setFirstUpdate, STOCK_WRITE)
110 PROPERTY (private, int64, numBytesRead, setNumBytesRead, STOCK_WRITE)
111 PROPERTY (private, int64, numBytesTotal, setNumBytesTotal, STOCK_WRITE)
112 PROPERTY (private, bool, isPrimary, setPrimary, STOCK_WRITE)
113 PROPERTY (private, QFile*, filePointer, setFilePointer, STOCK_WRITE)
114 122
115 public: 123 public slots:
116 explicit PartDownloadRequest (QString url, QString dest, bool primary, PartDownloader* parent); 124 void downloadFinished();
117 PartDownloadRequest (const PartDownloadRequest&) = delete; 125 void readyRead();
118 virtual ~PartDownloadRequest(); 126 void downloadProgress (qint64 recv, qint64 total);
119 void updateToTable(); 127 void abort();
120 bool isFinished() const;
121 void operator= (const PartDownloadRequest&) = delete;
122
123 public slots:
124 void downloadFinished();
125 void readyRead();
126 void downloadProgress (qint64 recv, qint64 total);
127 void abort();
128 }; 128 };

mercurial