44 |
46 |
45 // ============================================================================= |
47 // ============================================================================= |
46 // ----------------------------------------------------------------------------- |
48 // ----------------------------------------------------------------------------- |
47 class PartDownloadPrompt : public QDialog { |
49 class PartDownloadPrompt : public QDialog { |
48 Q_OBJECT |
50 Q_OBJECT |
|
51 PROPERTY (LDFile*, primaryFile, setPrimaryFile) |
49 |
52 |
50 public: |
53 public: |
51 enum Source { |
54 enum Source { |
52 /* OfficialLibrary, |
55 PartsTracker, |
53 */ PartsTracker, |
|
54 CustomURL, |
56 CustomURL, |
55 }; |
57 }; |
56 |
58 |
57 explicit PartDownloadPrompt (QWidget* parent = null); |
59 explicit PartDownloadPrompt (QWidget* parent = null); |
58 virtual ~PartDownloadPrompt(); |
60 virtual ~PartDownloadPrompt(); |
59 str getURL() const; |
61 str getURL() const; |
60 str getDest(str fname) const; |
|
61 Source getSource() const; |
62 Source getSource() const; |
62 void downloadFile (str dest, str url, bool primary); |
63 void downloadFile (str dest, str url, bool primary); |
63 void modifyDest (str& dest) const; |
64 void modifyDest (str& dest) const; |
64 |
65 |
65 public slots: |
66 public slots: |
91 enum State { |
92 enum State { |
92 Requesting, |
93 Requesting, |
93 Downloading, |
94 Downloading, |
94 Finished, |
95 Finished, |
95 Failed, |
96 Failed, |
96 Aborted, |
|
97 }; |
97 }; |
98 |
98 |
99 explicit PartDownloadRequest (str url, str dest, bool primary, PartDownloadPrompt* parent); |
99 explicit PartDownloadRequest (str url, str dest, bool primary, PartDownloadPrompt* parent); |
100 PartDownloadRequest (const PartDownloadRequest&) = delete; |
100 PartDownloadRequest (const PartDownloadRequest&) = delete; |
101 virtual ~PartDownloadRequest(); |
101 virtual ~PartDownloadRequest(); |
102 void updateToTable(); |
102 void updateToTable(); |
103 bool isFinished() const; |
103 bool isFinished() const; |
|
104 const State& state() const; |
104 |
105 |
105 void operator= (const PartDownloadRequest&) = delete; |
106 void operator= (const PartDownloadRequest&) = delete; |
106 |
107 |
107 public slots: |
108 public slots: |
108 void downloadFinished(); |
109 void downloadFinished(); |