Merge pull request #590 from GriffinRichards/update-promoter

Add update promoter
This commit is contained in:
GriffinR
2024-02-12 13:27:49 -05:00
committed by GitHub
18 changed files with 782 additions and 50 deletions

View File

@@ -14,7 +14,6 @@ class AboutPorymap : public QMainWindow
public:
explicit AboutPorymap(QWidget *parent = nullptr);
~AboutPorymap();
QList<int> getVersionNumbers();
private:
Ui::AboutPorymap *ui;
};

View File

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