comparison include/core/http.h @ 258:862d0d8619f6

*: HUUUGE changes animia has been renamed to animone, so instead of thinking of a health condition, you think of a beautiful flower :) I've also edited some of the code for animone, but I have no idea if it even works or not because I don't have a mac or windows machine lying around. whoops! ... anyway, all of the changes divergent from Anisthesia are now licensed under BSD. it's possible that I could even rewrite most of the code to where I don't even have to keep the MIT license, but that's thinking too far into the future I've been slacking off on implementing the anime seasons page, mostly out of laziness. I think I'd have to create another db file specifically for the seasons anyway, this code is being pushed *primarily* because the hard drive it's on is failing! yay :)
author Paper <paper@paper.us.eu.org>
date Mon, 01 Apr 2024 02:43:44 -0400
parents 4d461ef7d424
children 3ec7804abf17
comparison
equal deleted inserted replaced
257:699a20c57dc8 258:862d0d8619f6
13 13
14 class GetThread : public QThread { 14 class GetThread : public QThread {
15 Q_OBJECT 15 Q_OBJECT
16 16
17 public: 17 public:
18 GetThread(const std::string& u, const std::vector<std::string>& h = {}, QObject* parent = nullptr) : QThread(parent) { 18 GetThread(const std::string& u, const std::vector<std::string>& h = {}, QObject* parent = nullptr)
19 : QThread(parent) {
19 url = u; 20 url = u;
20 headers = h; 21 headers = h;
21 } 22 }
22 23
23 signals: 24 signals:
24 void ReceivedData(const QByteArray& ba); 25 void ReceivedData(const QByteArray& ba);
25 26
26 protected: 27 protected:
27 void run() override { 28 void run() override { emit ReceivedData(Get(url, headers)); }
28 emit ReceivedData(Get(url, headers));
29 }
30 29
31 std::string url; 30 std::string url;
32 std::vector<std::string> headers; 31 std::vector<std::string> headers;
33 }; 32 };
34 33
35 class PostThread : public QThread { 34 class PostThread : public QThread {
36 Q_OBJECT 35 Q_OBJECT
37 36
38 public: 37 public:
39 PostThread(const std::string& u, const std::string& d, const std::vector<std::string>& h = {}, QObject* parent = nullptr) : QThread(parent) { 38 PostThread(const std::string& u, const std::string& d, const std::vector<std::string>& h = {},
39 QObject* parent = nullptr)
40 : QThread(parent) {
40 url = u; 41 url = u;
41 data = d; 42 data = d;
42 headers = h; 43 headers = h;
43 } 44 }
44 45
45 signals: 46 signals:
46 void ReceivedData(const QByteArray& ba); 47 void ReceivedData(const QByteArray& ba);
47 48
48 protected: 49 protected:
49 void run() override { 50 void run() override { emit ReceivedData(Post(url, data, headers)); }
50 emit ReceivedData(Post(url, data, headers));
51 }
52 51
53 std::string url; 52 std::string url;
54 std::string data; 53 std::string data;
55 std::vector<std::string> headers; 54 std::vector<std::string> headers;
56 }; 55 };