porymap/include/ui/updatepromoter.h

51 lines
1 KiB
C
Raw Normal View History

2024-01-21 07:00:28 +00:00
#ifndef UPDATEPROMOTER_H
#define UPDATEPROMOTER_H
2024-01-24 16:56:04 +00:00
#include "network.h"
2024-01-21 07:00:28 +00:00
#include <QDialog>
#include <QPushButton>
#include <QVersionNumber>
2024-01-21 07:00:28 +00:00
namespace Ui {
class UpdatePromoter;
}
class UpdatePromoter : public QDialog
{
Q_OBJECT
public:
2024-01-24 16:56:04 +00:00
explicit UpdatePromoter(QWidget *parent, NetworkAccessManager *manager);
2024-01-21 07:00:28 +00:00
~UpdatePromoter() {};
void checkForUpdates();
void updatePreferences();
private:
Ui::UpdatePromoter *ui;
2024-01-24 16:56:04 +00:00
NetworkAccessManager *const manager;
2024-01-21 07:00:28 +00:00
QPushButton * button_Downloads;
2024-01-24 16:56:04 +00:00
QPushButton * button_Retry;
2024-01-21 07:00:28 +00:00
QString changelog;
2024-01-24 16:56:04 +00:00
QUrl downloadUrl;
QVersionNumber newVersion;
2024-01-24 16:56:04 +00:00
bool foundReleases;
QSet<QUrl> visitedUrls; // Prevent infinite redirection
2024-01-21 07:00:28 +00:00
void resetDialog();
2024-01-24 16:56:04 +00:00
void get(const QUrl &url);
void processWebpage(const QJsonDocument &data, const QUrl &nextUrl);
void error(const QString &err, const QDateTime time = QDateTime());
2024-01-21 07:00:28 +00:00
private slots:
void dialogButtonClicked(QAbstractButton *button);
signals:
void changedPreferences();
};
#endif // UPDATEPROMOTER_H