mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-25 17:14:59 +02:00
Get version XML and store latest version as application property
This commit is contained in:
parent
251416ab0a
commit
d44126ac33
3 changed files with 52 additions and 1 deletions
|
@ -60,6 +60,7 @@ find_package(Qt5OpenGL REQUIRED)
|
|||
find_package(Qt5Svg REQUIRED)
|
||||
find_package(Qt5WebKit REQUIRED)
|
||||
find_package(Qt5WebKitWidgets REQUIRED)
|
||||
find_package(Qt5Xml REQUIRED)
|
||||
|
||||
if (APPLE)
|
||||
set(MACOSX_BUNDLE_BUNDLE_NAME Interface)
|
||||
|
@ -136,7 +137,7 @@ if (LIBOVR_FOUND AND NOT DISABLE_LIBOVR)
|
|||
target_link_libraries(${TARGET_NAME} ${LIBOVR_LIBRARIES})
|
||||
endif (LIBOVR_FOUND AND NOT DISABLE_LIBOVR)
|
||||
|
||||
qt5_use_modules(${TARGET_NAME} Core Gui Multimedia Network OpenGL Script Svg WebKit WebKitWidgets)
|
||||
qt5_use_modules(${TARGET_NAME} Core Gui Multimedia Network OpenGL Script Svg WebKit WebKitWidgets Xml)
|
||||
|
||||
# include headers for interface and InterfaceConfig.
|
||||
include_directories(
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include <QMenuBar>
|
||||
#include <QMouseEvent>
|
||||
#include <QNetworkAccessManager>
|
||||
#include <QNetworkReply>
|
||||
#include <QNetworkDiskCache>
|
||||
#include <QOpenGLFramebufferObject>
|
||||
#include <QWheelEvent>
|
||||
|
@ -37,6 +38,8 @@
|
|||
#include <QtDebug>
|
||||
#include <QFileDialog>
|
||||
#include <QDesktopServices>
|
||||
#include <QXmlStreamReader>
|
||||
#include <QXmlStreamAttributes>
|
||||
|
||||
#include <AudioInjector.h>
|
||||
#include <NodeTypes.h>
|
||||
|
@ -192,6 +195,8 @@ Application::Application(int& argc, char** argv, timeval &startup_time) :
|
|||
setOrganizationName(applicationInfo.value("organizationName").toString());
|
||||
setOrganizationDomain(applicationInfo.value("organizationDomain").toString());
|
||||
|
||||
checkVersion();
|
||||
|
||||
qDebug("[VERSION] Build sequence: %s\n", applicationVersion().toStdString().c_str());
|
||||
|
||||
_settings = new QSettings(this);
|
||||
|
@ -4536,3 +4541,39 @@ void Application::toggleLogDialog() {
|
|||
_logDialog->close();
|
||||
}
|
||||
}
|
||||
|
||||
void Application::loadLatestVersionDetails() {
|
||||
QUrl url("https://a-tower.below92.com/version.xml");
|
||||
QNetworkAccessManager *downloadXML = new QNetworkAccessManager(this);
|
||||
QNetworkRequest request(url);
|
||||
connect(downloadXML, SIGNAL(finished(QNetworkReply*)), this, SLOT(parseVersionXml(QNetworkReply*)));
|
||||
downloadXML->get(request);
|
||||
|
||||
}
|
||||
|
||||
void Application::parseVersionXml(QNetworkReply *reply) {
|
||||
QXmlStreamReader xml(reply);
|
||||
while (!xml.atEnd() && !xml.hasError()) {
|
||||
QXmlStreamReader::TokenType token = xml.readNext();
|
||||
|
||||
if (token == QXmlStreamReader::StartElement) {
|
||||
if (xml.name() == "Version") {
|
||||
xml.readNext();
|
||||
_latestVersion = xml.text().toString();
|
||||
qDebug("################ Version found %s\n", _latestVersion.toStdString().c_str());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void Application::checkVersion() {
|
||||
loadLatestVersionDetails();
|
||||
|
||||
// This is a very rudimentary check, if this version is not equal to latest then you need to get it
|
||||
// unless you're coming from the future.
|
||||
|
||||
//if (applicationVersion() != 0 && applicationVersion() != this->_latestVersion) {
|
||||
|
||||
//}
|
||||
}
|
||||
|
|
|
@ -212,6 +212,11 @@ public:
|
|||
/// set a voxel which is to be rendered with a highlight
|
||||
void setHighlightVoxel(const VoxelDetail& highlightVoxel) { _highlightVoxel = highlightVoxel; }
|
||||
void setIsHighlightVoxel(bool isHighlightVoxel) { _isHighlightVoxel = isHighlightVoxel; }
|
||||
|
||||
// Get XML with version information and parse it
|
||||
// Display dialog when version is not the latest and allow for new version download from link
|
||||
void loadLatestVersionDetails();
|
||||
void checkVersion();
|
||||
|
||||
public slots:
|
||||
void sendAvatarFaceVideoMessage(int frameCount, const QByteArray& data);
|
||||
|
@ -255,6 +260,8 @@ private slots:
|
|||
void restoreMirrorView();
|
||||
void shrinkMirrorView();
|
||||
void resetSensors();
|
||||
|
||||
void parseVersionXml(QNetworkReply *reply);
|
||||
|
||||
private:
|
||||
void resetCamerasOnResizeGL(Camera& camera, int width, int height);
|
||||
|
@ -512,6 +519,8 @@ private:
|
|||
QPointer<LogDialog> _logDialog;
|
||||
|
||||
FileLogger* _logger;
|
||||
|
||||
QString _latestVersion;
|
||||
};
|
||||
|
||||
#endif /* defined(__interface__Application__) */
|
||||
|
|
Loading…
Reference in a new issue