mirror of
				https://github.com/ciphervance/supercell-wx.git
				synced 2025-10-31 00:30:05 +00:00 
			
		
		
		
	Download manager implementation
This commit is contained in:
		
							parent
							
								
									94726631cb
								
							
						
					
					
						commit
						4ac2626b65
					
				
					 5 changed files with 351 additions and 2 deletions
				
			
		
							
								
								
									
										57
									
								
								scwx-qt/source/scwx/qt/request/download_request.cpp
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										57
									
								
								scwx-qt/source/scwx/qt/request/download_request.cpp
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,57 @@ | |||
| #include <scwx/qt/request/download_request.hpp> | ||||
| 
 | ||||
| namespace scwx | ||||
| { | ||||
| namespace qt | ||||
| { | ||||
| namespace request | ||||
| { | ||||
| 
 | ||||
| static const std::string logPrefix_ = "scwx::qt::request::download_request"; | ||||
| 
 | ||||
| class DownloadRequest::Impl | ||||
| { | ||||
| public: | ||||
|    explicit Impl(const std::string&           url, | ||||
|                  const std::filesystem::path& destinationPath) : | ||||
|        url_ {url}, destinationPath_ {destinationPath} | ||||
|    { | ||||
|    } | ||||
|    ~Impl() = default; | ||||
| 
 | ||||
|    const std::string           url_; | ||||
|    const std::filesystem::path destinationPath_; | ||||
| 
 | ||||
|    bool canceled_ = false; | ||||
| }; | ||||
| 
 | ||||
| DownloadRequest::DownloadRequest(const std::string&           url, | ||||
|                                  const std::filesystem::path& destinationPath) : | ||||
|     p(std::make_unique<Impl>(url, destinationPath)) | ||||
| { | ||||
| } | ||||
| DownloadRequest::~DownloadRequest() = default; | ||||
| 
 | ||||
| const std::string& DownloadRequest::url() const | ||||
| { | ||||
|    return p->url_; | ||||
| } | ||||
| 
 | ||||
| const std::filesystem::path& DownloadRequest::destination_path() const | ||||
| { | ||||
|    return p->destinationPath_; | ||||
| } | ||||
| 
 | ||||
| void DownloadRequest::Cancel() | ||||
| { | ||||
|    p->canceled_ = true; | ||||
| } | ||||
| 
 | ||||
| bool DownloadRequest::IsCanceled() const | ||||
| { | ||||
|    return p->canceled_; | ||||
| } | ||||
| 
 | ||||
| } // namespace request
 | ||||
| } // namespace qt
 | ||||
| } // namespace scwx
 | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Dan Paulat
						Dan Paulat