mirror of
https://github.com/lubosz/overte.git
synced 2025-08-07 19:01:09 +02:00
Checkpoint
This commit is contained in:
parent
eb52ded4ad
commit
ede32cfadc
5 changed files with 58 additions and 22 deletions
|
@ -1,6 +1,12 @@
|
||||||
QPushButton {
|
QPushButton {
|
||||||
background-color: #333333;
|
background-color: #333333;
|
||||||
border-width: 0;
|
border-width: 0;
|
||||||
border-top-left-radius: 9px;
|
border-radius: 9px;
|
||||||
border-bottom-left-radius: 9px;
|
border-radius: 9px;
|
||||||
}
|
font-family: Arial;
|
||||||
|
font-size: 18px;
|
||||||
|
font-weight: 100;
|
||||||
|
color: #b7b7b7;
|
||||||
|
width: 120px;
|
||||||
|
height: 40px;
|
||||||
|
}
|
|
@ -4588,20 +4588,44 @@ void Application::parseVersionXml(QNetworkReply *reply) {
|
||||||
|
|
||||||
if (xml.name() == "Version") {
|
if (xml.name() == "Version") {
|
||||||
xml.readNext();
|
xml.readNext();
|
||||||
QString latestVersion = xml.text().toString();
|
_latestVersion = new QString(xml.text().toString());
|
||||||
_latestVersion = &latestVersion;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
if (!shouldSkipVersion() && applicationVersion() != _latestVersion) {
|
||||||
if (applicationVersion() != _latestVersion) {
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_downloadLink = new QUrl("http://www.google.com");
|
_downloadLink = new QUrl("http://www.google.com");
|
||||||
|
|
||||||
UpdateDialog *_updateDialog = new UpdateDialog(_glWidget, _releaseNotes, _downloadLink, _latestVersion, applicationVersion());
|
UpdateDialog *_updateDialog = new UpdateDialog(_glWidget, _releaseNotes, _downloadLink);
|
||||||
_updateDialog->exec();
|
_updateDialog->exec();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QFile *Application::loadSkipFile() {
|
||||||
|
QString fileName = QStandardPaths::writableLocation(QStandardPaths::DataLocation);
|
||||||
|
fileName.append(QString("/hifi.skipversion"));
|
||||||
|
QFile *file = new QFile(fileName);
|
||||||
|
file->open(QIODevice::ReadWrite);
|
||||||
|
return file;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Application::shouldSkipVersion() {
|
||||||
|
QFile *skipFile = loadSkipFile();
|
||||||
|
QByteArray skipFileContents = skipFile->readAll();
|
||||||
|
QString *skipVersion = new QString(skipFileContents);
|
||||||
|
skipFile->close();
|
||||||
|
if (*skipVersion == *_latestVersion ) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Application::skipVersion() {
|
||||||
|
QFile *skipFile = loadSkipFile();
|
||||||
|
skipFile->seek(0);
|
||||||
|
skipFile->write(_latestVersion->toStdString().c_str());
|
||||||
|
skipFile->close();
|
||||||
|
}
|
||||||
|
|
|
@ -216,8 +216,14 @@ public:
|
||||||
|
|
||||||
// Get XML with version information and parse it
|
// Get XML with version information and parse it
|
||||||
// Display dialog when version is not the latest and allow for new version download from link
|
// Display dialog when version is not the latest and allow for new version download from link
|
||||||
|
QFile *loadSkipFile();
|
||||||
void checkVersion();
|
void checkVersion();
|
||||||
void displayUpdateDialog();
|
void displayUpdateDialog();
|
||||||
|
bool shouldSkipVersion();
|
||||||
|
void skipVersion();
|
||||||
|
|
||||||
|
QString *_latestVersion;
|
||||||
|
QString *_operatingSystem;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void sendAvatarFaceVideoMessage(int frameCount, const QByteArray& data);
|
void sendAvatarFaceVideoMessage(int frameCount, const QByteArray& data);
|
||||||
|
@ -520,9 +526,6 @@ private:
|
||||||
QPointer<LogDialog> _logDialog;
|
QPointer<LogDialog> _logDialog;
|
||||||
|
|
||||||
FileLogger* _logger;
|
FileLogger* _logger;
|
||||||
|
|
||||||
QString *_latestVersion;
|
|
||||||
QString _operatingSystem;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* defined(__interface__Application__) */
|
#endif /* defined(__interface__Application__) */
|
||||||
|
|
|
@ -6,30 +6,32 @@
|
||||||
// Copyright (c) 2013, 2014 High Fidelity, Inc. All rights reserved.
|
// Copyright (c) 2013, 2014 High Fidelity, Inc. All rights reserved.
|
||||||
//
|
//
|
||||||
|
|
||||||
|
#include <QApplication>
|
||||||
#include <QDesktopWidget>
|
#include <QDesktopWidget>
|
||||||
#include <QTextBlock>
|
#include <QTextBlock>
|
||||||
#include <QtGui>
|
#include <QtGui>
|
||||||
|
|
||||||
|
#include "Application.h"
|
||||||
#include "SharedUtil.h"
|
#include "SharedUtil.h"
|
||||||
#include "UpdateDialog.h"
|
#include "UpdateDialog.h"
|
||||||
|
|
||||||
const int buttonWidth = 120;
|
const int buttonWidth = 125;
|
||||||
const int buttonHeight = 40;
|
const int buttonHeight = 40;
|
||||||
const int buttonMargin = 15;
|
const int buttonMargin = 100;
|
||||||
const int leftStartingPosition = 345;
|
const int leftStartingPosition = 275;
|
||||||
const int dialogWidth = 750;
|
const int dialogWidth = 750;
|
||||||
const int dialogHeigth = 300;
|
const int dialogHeigth = 300;
|
||||||
|
|
||||||
const QString dialogTitle = "Update Required";
|
const QString dialogTitle = "Update Required";
|
||||||
|
|
||||||
UpdateDialog::UpdateDialog(QWidget *parent, QString releaseNotes, QUrl *downloadURL, QString *latestVersion, QString currentVersion) : QDialog(parent, Qt::Dialog) {
|
UpdateDialog::UpdateDialog(QWidget *parent, QString releaseNotes, QUrl *downloadURL) : QDialog(parent, Qt::Dialog) {
|
||||||
|
|
||||||
|
Application* application = Application::getInstance();
|
||||||
_downloadURL = downloadURL;
|
_downloadURL = downloadURL;
|
||||||
_latestVersion = latestVersion;
|
|
||||||
|
|
||||||
const QString updateRequired = QString("You are currently running build %1, the latest build released is %2.\n \
|
const QString updateRequired = QString("You are currently running build %1, the latest build released is %2.\n \
|
||||||
Please download and install the most recent release to access the latest \
|
Please download and install the most recent release to access the latest \
|
||||||
features and bug fixes.").arg(currentVersion, *latestVersion);
|
features and bug fixes.").arg(application->applicationVersion(), *application->_latestVersion);
|
||||||
|
|
||||||
int leftPosition = leftStartingPosition;
|
int leftPosition = leftStartingPosition;
|
||||||
setWindowTitle(dialogTitle);
|
setWindowTitle(dialogTitle);
|
||||||
|
@ -70,13 +72,15 @@ UpdateDialog::UpdateDialog(QWidget *parent, QString releaseNotes, QUrl *download
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpdateDialog::handleDownload() {
|
void UpdateDialog::handleDownload() {
|
||||||
|
Application* application = Application::getInstance();
|
||||||
QDesktopServices::openUrl((*_downloadURL));
|
QDesktopServices::openUrl((*_downloadURL));
|
||||||
close();
|
application->quit();
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpdateDialog::handleSkip() {
|
void UpdateDialog::handleSkip() {
|
||||||
QString fileName = QStandardPaths::writableLocation(QStandardPaths::DataLocation);
|
Application* application = Application::getInstance();
|
||||||
fileName.append(QString("/hifi.skipversion"));
|
application->skipVersion();
|
||||||
|
close();
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpdateDialog::handleClose() {
|
void UpdateDialog::handleClose() {
|
||||||
|
|
|
@ -20,7 +20,7 @@ class UpdateDialog : public QDialog {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
UpdateDialog(QWidget*, QString releaseNotes, QUrl *downloadURL, QString *latestVersion, QString currentVersion);
|
UpdateDialog(QWidget*, QString releaseNotes, QUrl *downloadURL);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QLabel *_updateRequired;
|
QLabel *_updateRequired;
|
||||||
|
@ -30,7 +30,6 @@ private:
|
||||||
QPushButton *_closeButton;
|
QPushButton *_closeButton;
|
||||||
QFrame *_titleBackground;
|
QFrame *_titleBackground;
|
||||||
QUrl *_downloadURL;
|
QUrl *_downloadURL;
|
||||||
QString *_latestVersion;
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void handleDownload();
|
void handleDownload();
|
||||||
|
|
Loading…
Reference in a new issue