configurator/Configurator.h

33 lines
941 B
C
Raw Normal View History

#pragma once
#include <QApplication>
#include <QNetworkAccessManager>
#include <QNetworkReply>
#include <QSettings>
#include <dialogs/FederatedLogin.h>
#include <lib/Service.h>
class Configurator:public QApplication {
Q_OBJECT
public:
Configurator(int &argc, char **&argv);
2024-09-03 13:40:08 +00:00
QNetworkAccessManager &nam() { return _nam; }
QString baseUrl() const { return "https://dashboard." + _loginDialog->domain(); }
2024-09-03 16:59:36 +00:00
QString user() const { return _loginDialog->user(); }
QString password() const { return _loginDialog->password(); }
2024-09-03 13:40:08 +00:00
QByteArray download(QUrl const &url);
void waitForDownload(QNetworkReply *r) const;
Services const &services() const { return _services; }
QSettings &settings() { return _settings; }
protected Q_SLOTS:
void loginRequested();
private:
QNetworkAccessManager _nam;
QSettings _settings;
FederatedLogin * _loginDialog;
Services _services;
};
2024-09-03 13:40:08 +00:00
#define app static_cast<Configurator*>(Configurator::instance())