33 |
33 |
34 // ============================================================================= |
34 // ============================================================================= |
35 // |
35 // |
36 class PartDownloader : public QDialog |
36 class PartDownloader : public QDialog |
37 { |
37 { |
38 public: |
38 public: |
39 enum Source |
39 enum Source |
40 { |
40 { |
41 PartsTracker, |
41 PartsTracker, |
42 CustomURL, |
42 CustomURL, |
43 }; |
43 }; |
44 |
44 |
45 enum Button |
45 enum Button |
46 { |
46 { |
47 Download, |
47 Download, |
48 Abort, |
48 Abort, |
49 Close |
49 Close |
50 }; |
50 }; |
51 |
51 |
52 enum TableColumn |
52 enum TableColumn |
53 { |
53 { |
54 PartLabelColumn, |
54 PartLabelColumn, |
55 ProgressColumn, |
55 ProgressColumn, |
56 }; |
56 }; |
57 |
57 |
58 using RequestList = QList<PartDownloadRequest*>; |
58 using RequestList = QList<PartDownloadRequest*>; |
59 |
59 |
60 Q_OBJECT |
60 Q_OBJECT |
61 PROPERTY (public, LDDocumentPtr, primaryFile, setPrimaryFile, STOCK_WRITE) |
61 PROPERTY (public, LDDocumentPtr, primaryFile, setPrimaryFile, STOCK_WRITE) |
62 PROPERTY (public, bool, isAborted, setAborted, STOCK_WRITE) |
62 PROPERTY (public, bool, isAborted, setAborted, STOCK_WRITE) |
63 PROPERTY (private, Ui_DownloadFrom*, interface, setInterface, STOCK_WRITE) |
63 PROPERTY (private, Ui_DownloadFrom*, interface, setInterface, STOCK_WRITE) |
64 PROPERTY (private, QStringList, filesToDownload, setFilesToDownload, STOCK_WRITE) |
64 PROPERTY (private, QStringList, filesToDownload, setFilesToDownload, STOCK_WRITE) |
65 PROPERTY (private, RequestList, requests, setRequests, STOCK_WRITE) |
65 PROPERTY (private, RequestList, requests, setRequests, STOCK_WRITE) |
66 PROPERTY (private, QPushButton*, downloadButton, setDownloadButton, STOCK_WRITE) |
66 PROPERTY (private, QPushButton*, downloadButton, setDownloadButton, STOCK_WRITE) |
67 |
67 |
68 public: |
68 public: |
69 explicit PartDownloader (QWidget* parent = null); |
69 explicit PartDownloader (QWidget* parent = null); |
70 virtual ~PartDownloader(); |
70 virtual ~PartDownloader(); |
71 |
71 |
72 void downloadFile (QString dest, QString url, bool primary); |
72 void downloadFile (QString dest, QString url, bool primary); |
73 QPushButton* getButton (Button i); |
73 QPushButton* getButton (Button i); |
74 QString getURL() const; |
74 QString getURL() const; |
75 Source getSource() const; |
75 Source getSource() const; |
76 void modifyDestination (QString& dest) const; |
76 void modifyDestination (QString& dest) const; |
77 |
77 |
78 static QString getDownloadPath(); |
78 static QString getDownloadPath(); |
79 static void staticBegin(); |
79 static void staticBegin(); |
80 |
80 |
81 public slots: |
81 public slots: |
82 void buttonClicked (QAbstractButton* btn); |
82 void buttonClicked (QAbstractButton* btn); |
83 void checkIfFinished(); |
83 void checkIfFinished(); |
84 void sourceChanged (int i); |
84 void sourceChanged (int i); |
85 }; |
85 }; |
86 |
86 |
87 // ============================================================================= |
87 // ============================================================================= |
88 // |
88 // |
89 class PartDownloadRequest : public QObject |
89 class PartDownloadRequest : public QObject |