Engauge Digitizer  2
LoadImageFromUrl.h
Go to the documentation of this file.
1 /******************************************************************************************************
2  * (C) 2014 markummitchell@github.com. This file is part of Engauge Digitizer, which is released *
3  * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file *
4  * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. *
5  ******************************************************************************************************/
6 
7 #ifndef LOAD_IMAGE_FROM_URL_H
8 #define LOAD_IMAGE_FROM_URL_H
9 
10 #include <QImage>
11 #ifdef NETWORKING
12 #include <QtNetwork/QNetworkAccessManager>
13 #endif
14 #include <QObject>
15 #include <QString>
16 #include <QUrl>
17 
18 class MainWindow;
19 class QUrl;
20 
22 class LoadImageFromUrl : public QObject
23 {
24  Q_OBJECT;
25 
26 public:
28  LoadImageFromUrl(MainWindow &mainWindow);
30 
32  void startLoadImage (const QUrl &url);
33 
34 private slots:
35  void slotFinished ();
36  void slotReadData ();
37 
38 signals:
40  void signalImportImage (QString, QImage);
41 
42 private:
44 
45  void deallocate ();
46 
47  MainWindow &m_mainWindow;
48  QUrl m_url;
49 #ifdef NETWORKING
50  QNetworkAccessManager m_http;
51  QNetworkReply *m_reply;
52 #endif
53  QByteArray *m_buffer;
54 };
55 
56 #endif // LOAD_IMAGE_FROM_URL_H
void signalImportImage(QString, QImage)
Send the imported image to MainWindow. This completes the asynchronous loading of the image.
Load QImage from url. This is trivial for a file, but requires an asynchronous download step for http...
void startLoadImage(const QUrl &url)
Start the asynchronous loading of an image from the specified url.
Main window consisting of menu, graphics scene, status bar and optional toolbars as a Single Document...
Definition: MainWindow.h:91