mirror of
				https://github.com/ciphervance/supercell-wx.git
				synced 2025-10-31 19:20:05 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			52 lines
		
	
	
	
		
			905 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			52 lines
		
	
	
	
		
			905 B
		
	
	
	
		
			C++
		
	
	
	
	
	
| #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,
 | |
|       DigestError
 | |
|    };
 | |
| 
 | |
|    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
 | 
