mirror of
				https://github.com/ciphervance/supercell-wx.git
				synced 2025-10-31 06:10:04 +00:00 
			
		
		
		
	Download manager implementation
This commit is contained in:
		
							parent
							
								
									94726631cb
								
							
						
					
					
						commit
						4ac2626b65
					
				
					 5 changed files with 351 additions and 2 deletions
				
			
		
							
								
								
									
										51
									
								
								scwx-qt/source/scwx/qt/request/download_request.hpp
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										51
									
								
								scwx-qt/source/scwx/qt/request/download_request.hpp
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,51 @@ | |||
| #pragma once | ||||
| 
 | ||||
| #include <filesystem> | ||||
| #include <memory> | ||||
| 
 | ||||
| #include <QObject> | ||||
| 
 | ||||
| namespace scwx | ||||
| { | ||||
| namespace qt | ||||
| { | ||||
| namespace request | ||||
| { | ||||
| 
 | ||||
| class DownloadRequest : public QObject | ||||
| { | ||||
|    Q_OBJECT | ||||
| 
 | ||||
| public: | ||||
|    enum class CompleteReason | ||||
|    { | ||||
|       OK, | ||||
|       Canceled, | ||||
|       IOError, | ||||
|       RemoteError | ||||
|    }; | ||||
| 
 | ||||
|    explicit DownloadRequest(const std::string&           url, | ||||
|                             const std::filesystem::path& destinationPath); | ||||
|    ~DownloadRequest(); | ||||
| 
 | ||||
|    const std::string&           url() const; | ||||
|    const std::filesystem::path& destination_path() const; | ||||
| 
 | ||||
|    void Cancel(); | ||||
| 
 | ||||
|    bool IsCanceled() const; | ||||
| 
 | ||||
| private: | ||||
|    class Impl; | ||||
|    std::unique_ptr<Impl> p; | ||||
| 
 | ||||
| signals: | ||||
|    void ProgressUpdated(std::ptrdiff_t downloadedBytes, | ||||
|                         std::ptrdiff_t totalBytes); | ||||
|    void RequestComplete(CompleteReason reason); | ||||
| }; | ||||
| 
 | ||||
| } // namespace request
 | ||||
| } // namespace qt
 | ||||
| } // namespace scwx
 | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Dan Paulat
						Dan Paulat