check for updates

This commit is contained in:
itsmattkc
2019-03-10 16:37:03 +11:00
parent 8cf3bd46a1
commit 9fc1bc3e1d
6 changed files with 85 additions and 2 deletions
+6 -2
View File
@@ -160,7 +160,9 @@ SOURCES += \
rendering/clipqueue.cpp \
rendering/audio.cpp \
dialogs/clippropertiesdialog.cpp \
rendering/framebufferobject.cpp
rendering/framebufferobject.cpp \
ui/updatenotification.cpp \
ui/icons.cpp
HEADERS += \
mainwindow.h \
@@ -272,7 +274,9 @@ HEADERS += \
rendering/cacher.h \
rendering/audio.h \
dialogs/clippropertiesdialog.h \
rendering/framebufferobject.h
rendering/framebufferobject.h \
ui/updatenotification.h \
ui/icons.h
FORMS +=
+5
View File
@@ -41,6 +41,8 @@
#include "project/sequence.h"
#include "ui/updatenotification.h"
#include <QMessageBox>
#include <QFileDialog>
#include <QAction>
@@ -263,6 +265,9 @@ void OliveGlobal::finished_initialize() {
d->open();
#endif
}
// Check for updates
olive::update_notifier.check();
}
void OliveGlobal::save_autorecovery_file() {
+3
View File
@@ -0,0 +1,3 @@
#include "icons.h"
+14
View File
@@ -0,0 +1,14 @@
#ifndef ICONS_H
#define ICONS_H
#include <QIcon>
namespace olive {
namespace icon {
extern QIcon KeyframeLeft;
extern QIcon KeyframeSet;
extern QIcon KeyframeRight;
}
}
#endif // ICONS_H
+38
View File
@@ -0,0 +1,38 @@
#include "updatenotification.h"
#include <QNetworkAccessManager>
#include <QStatusBar>
#include "mainwindow.h"
UpdateNotification olive::update_notifier;
UpdateNotification::UpdateNotification()
{
}
void UpdateNotification::check()
{
#if defined(_WIN32) || defined(__APPLE__)
QNetworkAccessManager* manager = new QNetworkAccessManager();
connect(manager, SIGNAL(finished(QNetworkReply *)), this, SLOT(finished_slot(QNetworkReply *)));
connect(manager, SIGNAL(finished(QNetworkReply *)), manager, SLOT(deleteLater()));
QString update_url = QString("http://olivevideoeditor.org/update.php?version=0&hash=%1");
QNetworkRequest request(QUrl(update_url.arg(GITHASH)));
manager->get(request);
#endif
}
void UpdateNotification::finished_slot(QNetworkReply *reply)
{
QString response = QString::fromUtf8(reply->readAll());
if (response == "1") {
olive::MainWindow->statusBar()->showMessage(tr("An update is available from the Olive website. "
"Visit www.olivevideoeditor.org to download it."));
}
}
+19
View File
@@ -0,0 +1,19 @@
#ifndef UPDATENOTIFICATION_H
#define UPDATENOTIFICATION_H
#include <QNetworkReply>
class UpdateNotification : public QObject {
Q_OBJECT
public:
UpdateNotification();
void check();
private slots:
void finished_slot(QNetworkReply*);
};
namespace olive {
extern UpdateNotification update_notifier;
}
#endif // UPDATENOTIFICATION_H