UpdateDialog now starts GET request to GitHub API
This commit is contained in:
@@ -1,15 +1,34 @@
|
|||||||
#include "updatedialog.h"
|
#include "updatedialog.h"
|
||||||
#include "ui_updatedialog.h"
|
#include "ui_updatedialog.h"
|
||||||
|
|
||||||
|
#include <QNetworkAccessManager>
|
||||||
|
#include <QNetworkRequest>
|
||||||
|
#include <QNetworkReply>
|
||||||
|
#include <QDebug>
|
||||||
|
|
||||||
UpdateDialog::UpdateDialog(ZeiterfassungSettings &settings, QNetworkAccessManager *manager, QWidget *parent) :
|
UpdateDialog::UpdateDialog(ZeiterfassungSettings &settings, QNetworkAccessManager *manager, QWidget *parent) :
|
||||||
QDialog(parent),
|
QDialog(parent),
|
||||||
ui(new Ui::UpdateDialog),
|
ui(new Ui::UpdateDialog),
|
||||||
m_settings(settings)
|
m_settings(settings)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
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()
|
UpdateDialog::~UpdateDialog()
|
||||||
{
|
{
|
||||||
delete ui;
|
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>
|
#include <QDialog>
|
||||||
|
|
||||||
class QNetworkAccessManager;
|
class QNetworkAccessManager;
|
||||||
|
class QNetworkReply;
|
||||||
|
|
||||||
class ZeiterfassungSettings;
|
class ZeiterfassungSettings;
|
||||||
namespace Ui { class UpdateDialog; }
|
namespace Ui { class UpdateDialog; }
|
||||||
@@ -16,9 +17,13 @@ public:
|
|||||||
explicit UpdateDialog(ZeiterfassungSettings &settings, QNetworkAccessManager *manager, QWidget *parent = 0);
|
explicit UpdateDialog(ZeiterfassungSettings &settings, QNetworkAccessManager *manager, QWidget *parent = 0);
|
||||||
~UpdateDialog();
|
~UpdateDialog();
|
||||||
|
|
||||||
|
private Q_SLOTS:
|
||||||
|
void finished();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::UpdateDialog *ui;
|
Ui::UpdateDialog *ui;
|
||||||
ZeiterfassungSettings &m_settings;
|
ZeiterfassungSettings &m_settings;
|
||||||
|
QNetworkReply *m_reply;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // UPDATEDIALOG_H
|
#endif // UPDATEDIALOG_H
|
||||||
|
Reference in New Issue
Block a user