forked from SaschaWillems/OpenCLCapsViewer
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdatabase.h
More file actions
57 lines (51 loc) · 1.49 KB
/
database.h
File metadata and controls
57 lines (51 loc) · 1.49 KB
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/*
*
* OpenCL hardware capability viewer
*
* Copyright (C) 2021-2022 by Sascha Willems (www.saschawillems.de)
*
* This code is free software, you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 3 as published by the Free Software Foundation.
*
* Please review the following information to ensure the GNU Lesser
* General Public License version 3 requirements will be met:
* http://opensource.org/licenses/lgpl-3.0.html
*
* The code is distributed WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU LGPL 3.0 for more details.
*
*/
#include <QNetworkAccessManager>
#include <QNetworkRequest>
#include <QNetworkReply>
#include <QUrl>
#include <QEventLoop>
#include <QHttpMultiPart>
#include <QXmlStreamReader>
#include <QJsonObject>
#include <QJsonDocument>
#ifdef GUI_BUILD
#include <QMessageBox>
#endif
#pragma once
enum class ReportState { unknown, not_present, is_present, is_updatable };
class Database : public QObject
{
Q_OBJECT
private:
QNetworkProxy* proxy;
QNetworkAccessManager* manager;
void setCredentials(QUrl& url);
QString get(QString url);
public:
static QString username;
static QString password;
static QString databaseUrl;
bool getReportId(QJsonObject json, int& id);
bool getReportState(QJsonObject json, ReportState& state);
bool uploadReport(QJsonObject json, QString& message);
bool checkServerConnection(QString& message);
};
extern Database database;