| 1 | /***************************************************************************** |
| 2 | ** Copyright (C) 2005 by Iulian M |
| 3 | ** [email protected] |
| 4 | ** |
| 5 | ** modifications by Piotr KrzemiĆski |
| 6 | ** Copyright (C) 2008-2017 |
| 7 | ** |
| 8 | ** This program is free software; you can redistribute it and/or modify |
| 9 | ** it under the terms of the GNU General Public License as published by |
| 10 | ** the Free Software Foundation; either version 2 of the License, or |
| 11 | ** (at your option) any later version. |
| 12 | ** |
| 13 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
| 14 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
| 15 | ** |
| 16 | *****************************************************************************/ |
| 17 | |
| 18 | #ifndef SYNCHTTP_H |
| 19 | #define SYNCHTTP_H |
| 20 | |
| 21 | #include <QEventLoop> |
| 22 | #include <QNetworkAccessManager> |
| 23 | #include <QNetworkReply> |
| 24 | #include <QNetworkRequest> |
| 25 | #include <QObject> |
| 26 | |
| 27 | class SyncHTTP : public QObject { |
| 28 | Q_OBJECT |
| 29 | public: |
| 30 | SyncHTTP(); |
| 31 | |
| 32 | QNetworkReply* syncGet(const QNetworkRequest& req); |
| 33 | QNetworkReply* syncPost(const QNetworkRequest& req, const QByteArray& data); |
| 34 | |
| 35 | private: |
| 36 | QEventLoop loop; |
| 37 | QNetworkAccessManager manager; |
| 38 | }; |
| 39 | |
| 40 | #endif |