blob: 2bf98fc0ae62c131967a53435e8f5dc46c68f3ba (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
#ifndef GOPHERCLIENT_HPP
#define GOPHERCLIENT_HPP
#include <QObject>
#include <QTcpSocket>
#include <QUrl>
class GopherClient : public QObject
{
Q_OBJECT
public:
explicit GopherClient(QObject *parent = nullptr);
~GopherClient() override;
bool startRequest(QUrl const & url);
bool isInProgress() const;
bool cancelRequest();
signals:
void requestComplete(QByteArray const & data, QString const & mime);
void requestFailed(QString const & message);
private slots:
void on_connected();
void on_readRead();
void on_finished();
private:
QTcpSocket socket;
QByteArray body;
QUrl requested_url;
bool was_cancelled;
QString mime;
};
#endif // GOPHERCLIENT_HPP
|