mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-26 16:35:08 +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(Qt5Svg REQUIRED)
|
||||||
find_package(Qt5WebKit REQUIRED)
|
find_package(Qt5WebKit REQUIRED)
|
||||||
find_package(Qt5WebKitWidgets REQUIRED)
|
find_package(Qt5WebKitWidgets REQUIRED)
|
||||||
|
find_package(Qt5Xml REQUIRED)
|
||||||
|
|
||||||
if (APPLE)
|
if (APPLE)
|
||||||
set(MACOSX_BUNDLE_BUNDLE_NAME Interface)
|
set(MACOSX_BUNDLE_BUNDLE_NAME Interface)
|
||||||
|
@ -136,7 +137,7 @@ if (LIBOVR_FOUND AND NOT DISABLE_LIBOVR)
|
||||||
target_link_libraries(${TARGET_NAME} ${LIBOVR_LIBRARIES})
|
target_link_libraries(${TARGET_NAME} ${LIBOVR_LIBRARIES})
|
||||||
endif (LIBOVR_FOUND AND NOT DISABLE_LIBOVR)
|
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 headers for interface and InterfaceConfig.
|
||||||
include_directories(
|
include_directories(
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
#include <QMenuBar>
|
#include <QMenuBar>
|
||||||
#include <QMouseEvent>
|
#include <QMouseEvent>
|
||||||
#include <QNetworkAccessManager>
|
#include <QNetworkAccessManager>
|
||||||
|
#include <QNetworkReply>
|
||||||
#include <QNetworkDiskCache>
|
#include <QNetworkDiskCache>
|
||||||
#include <QOpenGLFramebufferObject>
|
#include <QOpenGLFramebufferObject>
|
||||||
#include <QWheelEvent>
|
#include <QWheelEvent>
|
||||||
|
@ -37,6 +38,8 @@
|
||||||
#include <QtDebug>
|
#include <QtDebug>
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
#include <QDesktopServices>
|
#include <QDesktopServices>
|
||||||
|
#include <QXmlStreamReader>
|
||||||
|
#include <QXmlStreamAttributes>
|
||||||
|
|
||||||
#include <AudioInjector.h>
|
#include <AudioInjector.h>
|
||||||
#include <NodeTypes.h>
|
#include <NodeTypes.h>
|
||||||
|
@ -192,6 +195,8 @@ Application::Application(int& argc, char** argv, timeval &startup_time) :
|
||||||
setOrganizationName(applicationInfo.value("organizationName").toString());
|
setOrganizationName(applicationInfo.value("organizationName").toString());
|
||||||
setOrganizationDomain(applicationInfo.value("organizationDomain").toString());
|
setOrganizationDomain(applicationInfo.value("organizationDomain").toString());
|
||||||
|
|
||||||
|
checkVersion();
|
||||||
|
|
||||||
qDebug("[VERSION] Build sequence: %s\n", applicationVersion().toStdString().c_str());
|
qDebug("[VERSION] Build sequence: %s\n", applicationVersion().toStdString().c_str());
|
||||||
|
|
||||||
_settings = new QSettings(this);
|
_settings = new QSettings(this);
|
||||||
|
@ -4536,3 +4541,39 @@ void Application::toggleLogDialog() {
|
||||||
_logDialog->close();
|
_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) {
|
||||||
|
|
||||||
|
//}
|
||||||
|
}
|
||||||
|
|
|
@ -213,6 +213,11 @@ public:
|
||||||
void setHighlightVoxel(const VoxelDetail& highlightVoxel) { _highlightVoxel = highlightVoxel; }
|
void setHighlightVoxel(const VoxelDetail& highlightVoxel) { _highlightVoxel = highlightVoxel; }
|
||||||
void setIsHighlightVoxel(bool isHighlightVoxel) { _isHighlightVoxel = isHighlightVoxel; }
|
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:
|
public slots:
|
||||||
void sendAvatarFaceVideoMessage(int frameCount, const QByteArray& data);
|
void sendAvatarFaceVideoMessage(int frameCount, const QByteArray& data);
|
||||||
void exportVoxels();
|
void exportVoxels();
|
||||||
|
@ -256,6 +261,8 @@ private slots:
|
||||||
void shrinkMirrorView();
|
void shrinkMirrorView();
|
||||||
void resetSensors();
|
void resetSensors();
|
||||||
|
|
||||||
|
void parseVersionXml(QNetworkReply *reply);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void resetCamerasOnResizeGL(Camera& camera, int width, int height);
|
void resetCamerasOnResizeGL(Camera& camera, int width, int height);
|
||||||
void updateProjectionMatrix();
|
void updateProjectionMatrix();
|
||||||
|
@ -512,6 +519,8 @@ private:
|
||||||
QPointer<LogDialog> _logDialog;
|
QPointer<LogDialog> _logDialog;
|
||||||
|
|
||||||
FileLogger* _logger;
|
FileLogger* _logger;
|
||||||
|
|
||||||
|
QString _latestVersion;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* defined(__interface__Application__) */
|
#endif /* defined(__interface__Application__) */
|
||||||
|
|
Loading…
Reference in a new issue