Auto updater #4
@@ -1,15 +1,34 @@
|
||||
#include "updatedialog.h"
|
||||
#include "ui_updatedialog.h"
|
||||
|
||||
#include <QNetworkAccessManager>
|
||||
#include <QNetworkRequest>
|
||||
#include <QNetworkReply>
|
||||
#include <QDebug>
|
||||
|
||||
UpdateDialog::UpdateDialog(ZeiterfassungSettings &settings, QNetworkAccessManager *manager, QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::UpdateDialog),
|
||||
m_settings(settings)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
m_reply = manager->get(QNetworkRequest(QUrl(QStringLiteral("https://api.github.com/repos/0xFEEDC0DE64/QtZeiterfassung/releases"))));
|
||||
connect(m_reply, &QNetworkReply::finished, this, &UpdateDialog::finished);
|
||||
}
|
||||
|
||||
UpdateDialog::~UpdateDialog()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void UpdateDialog::finished()
|
||||
{
|
||||
if(m_reply->error() != QNetworkReply::NoError)
|
||||
{
|
||||
qWarning() << m_reply->error() << m_reply->errorString();
|
||||
return;
|
||||
}
|
||||
|
||||
qDebug() << m_reply->readAll();
|
||||
}
|
||||
|
@@ -4,6 +4,7 @@
|
||||
#include <QDialog>
|
||||
|
||||
class QNetworkAccessManager;
|
||||
class QNetworkReply;
|
||||
|
||||
class ZeiterfassungSettings;
|
||||
namespace Ui { class UpdateDialog; }
|
||||
@@ -16,9 +17,13 @@ public:
|
||||
explicit UpdateDialog(ZeiterfassungSettings &settings, QNetworkAccessManager *manager, QWidget *parent = 0);
|
||||
~UpdateDialog();
|
||||
|
||||
private Q_SLOTS:
|
||||
void finished();
|
||||
|
||||
private:
|
||||
Ui::UpdateDialog *ui;
|
||||
ZeiterfassungSettings &m_settings;
|
||||
QNetworkReply *m_reply;
|
||||
};
|
||||
|
||||
#endif // UPDATEDIALOG_H
|
||||
|
Reference in New Issue
Block a user