| 
									
										
										
										
											2017-04-27 20:24:53 +02:00
										 |  |  | // SPDX-License-Identifier: GPL-2.0
 | 
					
						
							| 
									
										
										
										
											2015-11-06 10:39:59 -08:00
										 |  |  | #ifndef IMAGEDOWNLOADER_H
 | 
					
						
							|  |  |  | #define IMAGEDOWNLOADER_H
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include <QImage>
 | 
					
						
							|  |  |  | #include <QFuture>
 | 
					
						
							|  |  |  | #include <QNetworkReply>
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | typedef QPair<QString, QByteArray> SHashedFilename; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-09 16:29:49 +01:00
										 |  |  | extern QUrl cloudImageURL(const char *hash); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-11-06 10:39:59 -08:00
										 |  |  | class ImageDownloader : public QObject { | 
					
						
							|  |  |  | 	Q_OBJECT; | 
					
						
							|  |  |  | public: | 
					
						
							|  |  |  | 	ImageDownloader(struct picture *picture); | 
					
						
							| 
									
										
										
										
											2016-03-15 21:31:59 +01:00
										 |  |  | 	~ImageDownloader(); | 
					
						
							| 
									
										
										
										
											2016-01-09 16:29:49 +01:00
										 |  |  | 	void load(bool fromHash); | 
					
						
							| 
									
										
										
										
											2015-11-06 10:39:59 -08:00
										 |  |  | 
 | 
					
						
							|  |  |  | private: | 
					
						
							|  |  |  | 	struct picture *picture; | 
					
						
							|  |  |  | 	QNetworkAccessManager manager; | 
					
						
							| 
									
										
										
										
											2016-03-15 22:45:17 +01:00
										 |  |  | 	bool loadFromHash; | 
					
						
							| 
									
										
										
										
											2015-11-06 10:39:59 -08:00
										 |  |  | 
 | 
					
						
							|  |  |  | private slots: | 
					
						
							|  |  |  | 	void saveImage(QNetworkReply *reply); | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class SHashedImage : public QImage { | 
					
						
							|  |  |  | public: | 
					
						
							|  |  |  | 	SHashedImage(struct picture *picture); | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #endif // IMAGEDOWNLOADER_H
 |