forked from evtrouble/ham
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnetdataaccess.h
More file actions
34 lines (26 loc) · 759 Bytes
/
Copy pathnetdataaccess.h
File metadata and controls
34 lines (26 loc) · 759 Bytes
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
#ifndef NETDATAACCESS_H
#define NETDATAACCESS_H
#include <QNetworkAccessManager>
#include <QNetworkRequest>
#include <QNetworkReply>
#include <QWidget>
class NetDataAccess : public QWidget
{
Q_OBJECT
private:
NetDataAccess(QWidget* parent = nullptr);
constexpr static char server[] = "http://localhost:3000/tasks";
public:
bool loadData();
bool addItem(QJsonObject&& data, int& id);
bool updateItem(QJsonObject&& data);
bool deleteItem(QJsonObject&& data);
static std::unique_ptr<NetDataAccess>& instance();
private:
static std::unique_ptr<NetDataAccess> dataAccess;
std::unique_ptr<QNetworkAccessManager> access;
QNetworkReply* reply;
signals:
void finish(QNetworkReply*);
};
#endif // NETDATAACCESS_H