Engauge Digitizer  2
LoadImageFromUrl.h
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 #include <QtNetwork/QNetworkAccessManager>
12 #include <QObject>
13 #include <QString>
14 #include <QUrl>
15 
16 class MainWindow;
17 class QUrl;
18 
20 class LoadImageFromUrl : public QObject
21 {
22  Q_OBJECT;
23 
24 public:
26  LoadImageFromUrl(MainWindow &mainWindow);
28 
30  void startLoadImage (const QUrl &url);
31 
32 private slots:
33  void slotFinished ();
34  void slotReadData ();
35 
36 signals:
38  void signalImportImage (QString, QImage);
39 
40 private:
42 
43  void deallocate ();
44 
45  MainWindow &m_mainWindow;
46  QUrl m_url;
47  QNetworkAccessManager m_http;
48  QNetworkReply *m_reply;
49  QByteArray *m_buffer;
50 };
51 
52 #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:89