Auto updater #4

Merged
0xFEEDC0DE64 merged 7 commits from auto-update into master 2017-12-07 00:53:15 +01:00
9 changed files with 167 additions and 3 deletions
Showing only changes of commit 5a8d05c565 - Show all commits

View File

@@ -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();
}

View File

@@ -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