mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 11:48:09 +02:00
Pull Request fixes
This commit is contained in:
parent
865045aae7
commit
cd9f2fd240
4 changed files with 36 additions and 43 deletions
|
@ -95,6 +95,7 @@ const float MIRROR_REARVIEW_DISTANCE = 0.65f;
|
||||||
const float MIRROR_REARVIEW_BODY_DISTANCE = 2.3f;
|
const float MIRROR_REARVIEW_BODY_DISTANCE = 2.3f;
|
||||||
|
|
||||||
const QString CHECK_VERSION_URL = "http://highfidelity.io/latestVersion.xml";
|
const QString CHECK_VERSION_URL = "http://highfidelity.io/latestVersion.xml";
|
||||||
|
const QString SKIP_FILENAME = QStandardPaths::writableLocation(QStandardPaths::DataLocation) + "/hifi.skipversion";
|
||||||
|
|
||||||
void messageHandler(QtMsgType type, const QMessageLogContext& context, const QString &message) {
|
void messageHandler(QtMsgType type, const QMessageLogContext& context, const QString &message) {
|
||||||
QString messageWithNewLine = message + "\n";
|
QString messageWithNewLine = message + "\n";
|
||||||
|
@ -202,8 +203,6 @@ 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);
|
||||||
|
@ -262,7 +261,8 @@ Application::Application(int& argc, char** argv, timeval &startup_time) :
|
||||||
|
|
||||||
// Set the sixense filtering
|
// Set the sixense filtering
|
||||||
_sixenseManager.setFilter(Menu::getInstance()->isOptionChecked(MenuOption::FilterSixense));
|
_sixenseManager.setFilter(Menu::getInstance()->isOptionChecked(MenuOption::FilterSixense));
|
||||||
|
|
||||||
|
checkVersion();
|
||||||
}
|
}
|
||||||
|
|
||||||
Application::~Application() {
|
Application::~Application() {
|
||||||
|
@ -4367,31 +4367,28 @@ void Application::updateLocalOctreeCache(bool firstTime) {
|
||||||
|
|
||||||
void Application::checkVersion() {
|
void Application::checkVersion() {
|
||||||
QUrl url(CHECK_VERSION_URL);
|
QUrl url(CHECK_VERSION_URL);
|
||||||
QNetworkAccessManager *downloadXML = new QNetworkAccessManager(this);
|
QNetworkRequest latestVersionRequest(url);
|
||||||
QNetworkRequest request(url);
|
latestVersionRequest.setAttribute(QNetworkRequest::CacheLoadControlAttribute, QNetworkRequest::PreferCache);
|
||||||
connect(downloadXML, SIGNAL(finished(QNetworkReply*)), this, SLOT(parseVersionXml(QNetworkReply*)));
|
_latestVersionReply = getNetworkAccessManager()->get(latestVersionRequest);
|
||||||
downloadXML->get(request);
|
|
||||||
|
connect(_latestVersionReply, SIGNAL(readyRead()), SLOT(parseVersionXml()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::parseVersionXml(QNetworkReply *reply) {
|
void Application::parseVersionXml() {
|
||||||
QString *operatingSystem;
|
|
||||||
|
|
||||||
#ifdef Q_OS_WIN32
|
#ifdef Q_OS_WIN32
|
||||||
operatingSystem = new QString("win");
|
QString operatingSystem("win");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef Q_OS_MAC
|
#ifdef Q_OS_MAC
|
||||||
operatingSystem = new QString("mac");
|
QString operatingSystem("mac");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
QString releaseDate;
|
QString releaseDate;
|
||||||
QString releaseNotes;
|
QString releaseNotes;
|
||||||
QString latestVersion;
|
QString latestVersion;
|
||||||
QUrl downloadURL;
|
|
||||||
|
|
||||||
QWidget *updateDialog;
|
QXmlStreamReader xml(_latestVersionReply);
|
||||||
|
|
||||||
QXmlStreamReader xml(reply);
|
|
||||||
while (!xml.atEnd() && !xml.hasError()) {
|
while (!xml.atEnd() && !xml.hasError()) {
|
||||||
QXmlStreamReader::TokenType token = xml.readNext();
|
QXmlStreamReader::TokenType token = xml.readNext();
|
||||||
|
|
||||||
|
@ -4410,36 +4407,28 @@ void Application::parseVersionXml(QNetworkReply *reply) {
|
||||||
}
|
}
|
||||||
if (xml.name() == operatingSystem) {
|
if (xml.name() == operatingSystem) {
|
||||||
xml.readNext();
|
xml.readNext();
|
||||||
downloadURL = QUrl(xml.text().toString());
|
_downloadUrl = QUrl(xml.text().toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!shouldSkipVersion(latestVersion) && applicationVersion() != latestVersion) {
|
if (!shouldSkipVersion(latestVersion) && applicationVersion() != latestVersion) {
|
||||||
updateDialog = new UpdateDialog(_glWidget, releaseNotes, latestVersion, downloadURL);
|
new UpdateDialog(_glWidget, releaseNotes, latestVersion, _downloadUrl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
delete _latestVersionReply;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Application::shouldSkipVersion(QString latestVersion) {
|
bool Application::shouldSkipVersion(QString latestVersion) {
|
||||||
QString fileName = QStandardPaths::writableLocation(QStandardPaths::DataLocation);
|
QFile skipFile(SKIP_FILENAME);
|
||||||
fileName.append(QString("/hifi.skipversion"));
|
|
||||||
QFile skipFile(fileName);
|
|
||||||
skipFile.open(QIODevice::ReadWrite);
|
skipFile.open(QIODevice::ReadWrite);
|
||||||
QByteArray skipFileContents = skipFile.readAll();
|
QString skipVersion(skipFile.readAll());
|
||||||
QString skipVersion(skipFileContents);
|
return (skipVersion == latestVersion /*|| applicationVersion() == "dev"*/);
|
||||||
skipFile.close();
|
|
||||||
if (skipVersion == latestVersion || applicationVersion() == "dev") {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::skipVersion(QString latestVersion) {
|
void Application::skipVersion(QString latestVersion) {
|
||||||
QString fileName = QStandardPaths::writableLocation(QStandardPaths::DataLocation);
|
QFile skipFile(SKIP_FILENAME);
|
||||||
fileName.append(QString("/hifi.skipversion"));
|
|
||||||
QFile skipFile(fileName);
|
|
||||||
skipFile.open(QIODevice::WriteOnly|QIODevice::Truncate);
|
skipFile.open(QIODevice::WriteOnly|QIODevice::Truncate);
|
||||||
skipFile.seek(0);
|
skipFile.seek(0);
|
||||||
skipFile.write(latestVersion.toStdString().c_str());
|
skipFile.write(latestVersion.toStdString().c_str());
|
||||||
skipFile.close();
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -203,6 +203,8 @@ public:
|
||||||
/// set a voxel which is to be rendered with a highlight
|
/// set a voxel which is to be rendered with a highlight
|
||||||
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; }
|
||||||
|
|
||||||
|
QUrl _downloadUrl;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void domainChanged(const QString& domainHostname);
|
void domainChanged(const QString& domainHostname);
|
||||||
|
@ -251,7 +253,7 @@ private slots:
|
||||||
void shrinkMirrorView();
|
void shrinkMirrorView();
|
||||||
void resetSensors();
|
void resetSensors();
|
||||||
|
|
||||||
void parseVersionXml(QNetworkReply *reply);
|
void parseVersionXml();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void resetCamerasOnResizeGL(Camera& camera, int width, int height);
|
void resetCamerasOnResizeGL(Camera& camera, int width, int height);
|
||||||
|
@ -503,6 +505,7 @@ private:
|
||||||
void displayUpdateDialog();
|
void displayUpdateDialog();
|
||||||
bool shouldSkipVersion(QString latestVersion);
|
bool shouldSkipVersion(QString latestVersion);
|
||||||
void skipVersion(QString latestVersion);
|
void skipVersion(QString latestVersion);
|
||||||
|
QNetworkReply* _latestVersionReply;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* defined(__interface__Application__) */
|
#endif /* defined(__interface__Application__) */
|
||||||
|
|
|
@ -19,17 +19,18 @@
|
||||||
#include "SharedUtil.h"
|
#include "SharedUtil.h"
|
||||||
#include "UpdateDialog.h"
|
#include "UpdateDialog.h"
|
||||||
|
|
||||||
UpdateDialog::UpdateDialog(QWidget *parent, QString releaseNotes, QString latestVersion, QUrl downloadURL) : QDialog(parent, Qt::Dialog) {
|
UpdateDialog::UpdateDialog(QWidget *parent, QString releaseNotes, QString latestVersion, QUrl downloadURL) :
|
||||||
|
QDialog(parent, Qt::Dialog) {
|
||||||
|
|
||||||
Application* application = Application::getInstance();
|
Application* application = Application::getInstance();
|
||||||
|
|
||||||
QUiLoader updateDialogLoader;
|
QUiLoader updateDialogLoader;
|
||||||
|
|
||||||
QFile updateDialogUi("resources/ui/updateDialog.ui");
|
QFile updateDialogUi("resources/ui/updateDialog.ui");
|
||||||
updateDialogUi.open(QFile::ReadOnly);
|
updateDialogUi.open(QFile::ReadOnly);
|
||||||
_dialogWidget = updateDialogLoader.load(&updateDialogUi, parent);
|
_dialogWidget = updateDialogLoader.load(&updateDialogUi, this);
|
||||||
updateDialogUi.close();
|
|
||||||
|
|
||||||
const QString updateRequired = QString("You are currently running build %1, the latest build released is %2. \
|
QString updateRequired = QString("You are currently running build %1, the latest build released is %2. \
|
||||||
Please download and install the most recent release to access the latest features and bug fixes.")
|
Please download and install the most recent release to access the latest features and bug fixes.")
|
||||||
.arg(application->applicationVersion(), latestVersion);
|
.arg(application->applicationVersion(), latestVersion);
|
||||||
|
|
||||||
|
@ -43,22 +44,22 @@ UpdateDialog::UpdateDialog(QWidget *parent, QString releaseNotes, QString latest
|
||||||
|
|
||||||
updateContent->setText(updateRequired);
|
updateContent->setText(updateRequired);
|
||||||
|
|
||||||
connect(downloadButton, SIGNAL(released()), this, SLOT(handleDownload(QUrl downloadURL)));
|
connect(downloadButton, SIGNAL(released()), this, SLOT(handleDownload()));
|
||||||
connect(skipButton, SIGNAL(released()), this, SLOT(handleSkip()));
|
connect(skipButton, SIGNAL(released()), this, SLOT(handleSkip()));
|
||||||
connect(closeButton, SIGNAL(released()), this, SLOT(handleClose()));
|
connect(closeButton, SIGNAL(released()), this, SLOT(handleClose()));
|
||||||
_dialogWidget->show();
|
_dialogWidget->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpdateDialog::handleDownload(QUrl downloadURL) {
|
void UpdateDialog::handleDownload() {
|
||||||
Application* application = Application::getInstance();
|
Application* application = Application::getInstance();
|
||||||
QDesktopServices::openUrl(downloadURL);
|
QDesktopServices::openUrl(application->_downloadUrl);
|
||||||
application->quit();
|
application->quit();
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpdateDialog::handleSkip() {
|
void UpdateDialog::handleSkip() {
|
||||||
this->_dialogWidget->close();
|
this->close();
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpdateDialog::handleClose() {
|
void UpdateDialog::handleClose() {
|
||||||
this->_dialogWidget->close();
|
this->close();
|
||||||
}
|
}
|
|
@ -18,13 +18,13 @@ class UpdateDialog : public QDialog {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
UpdateDialog(QWidget*, QString releaseNotes, QString latestVersion, QUrl downloadURL);
|
UpdateDialog(QWidget* parent, QString releaseNotes, QString latestVersion, QUrl downloadURL);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QWidget* _dialogWidget;
|
QWidget* _dialogWidget;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void handleDownload(QUrl downloadURL);
|
void handleDownload();
|
||||||
void handleSkip();
|
void handleSkip();
|
||||||
void handleClose();
|
void handleClose();
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue