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>
|
2024-02-07 20:35:11 +00:00
|
|
|
#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;
|
2024-02-07 20:35:11 +00:00
|
|
|
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);
|
2024-02-05 16:54:35 +00:00
|
|
|
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
|