This repository has been archived on 2022-08-16. You can view files and clone it, but cannot push or open issues or pull requests.
fanny-app/headers/serverconn.h

64 lines
1.3 KiB
C
Raw Normal View History

2018-06-21 08:47:09 +02:00
#ifndef SERVERCONN_H
#define SERVERCONN_H
#include <QObject>
2018-06-21 16:41:02 +02:00
#include <QDir>
2018-06-21 18:36:46 +02:00
#include <QUrl>
2018-06-21 08:47:09 +02:00
#include <QtNetwork>
#include <QAuthenticator>
2018-06-21 16:41:02 +02:00
#include <QDesktopServices>
2018-06-21 18:36:46 +02:00
#include <QXmlNamespaceSupport>
2018-06-21 16:41:02 +02:00
#include "headers/appsettings.h"
2018-06-21 08:47:09 +02:00
2018-06-21 18:36:46 +02:00
2018-06-21 08:47:09 +02:00
typedef struct strReturnData{
int status_code;
QString text;
}ReturnData_t;
class ServerConn : public QObject
{
Q_OBJECT
2018-06-21 16:41:02 +02:00
2018-06-21 08:47:09 +02:00
public:
2018-06-21 16:41:02 +02:00
QString username;
QString password;
2018-06-21 08:47:09 +02:00
QNetworkAccessManager *networkManager;
2018-06-21 16:41:02 +02:00
QNetworkAccessManager *refreshNetworkManager;
2018-06-22 09:36:20 +02:00
float progress;
2018-06-21 16:41:02 +02:00
public:
2018-06-21 08:47:09 +02:00
explicit ServerConn(QObject *parent = nullptr);
2018-06-21 16:41:02 +02:00
~ServerConn();
Q_INVOKABLE QString login(QString username, QString password, bool permanent);
Q_INVOKABLE int logout();
Q_INVOKABLE QString getDay(QString day);
Q_INVOKABLE int checkConn();
2018-06-22 09:36:20 +02:00
Q_INVOKABLE float getProgress();
2018-06-25 00:15:18 +02:00
Q_INVOKABLE int getFoodPlan();
2018-06-24 09:23:10 +02:00
Q_INVOKABLE QVariantMap getFoodPlanData(int index);
2018-06-21 08:47:09 +02:00
ReturnData_t senddata(QUrl serviceUrl, QUrlQuery postData);
signals:
public slots:
2018-06-30 20:59:42 +02:00
Q_INVOKABLE void updateProgress(qint64 read, qint64 total);
2018-06-22 09:36:20 +02:00
2018-06-24 09:23:10 +02:00
private:
struct Day
{
QString Cookteam;
QString Date;
QString Main;
QString Main_veg;
QString Salad;
QString Dessert;
};
QList<QList<QString>> m_weekplan;
2018-06-21 08:47:09 +02:00
};
#endif // SERVERCONN_H