mirror of
https://github.com/lubosz/overte.git
synced 2025-04-23 20:34:07 +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 {
|
||||
background-color: #333333;
|
||||
border-width: 0;
|
||||
border-top-left-radius: 9px;
|
||||
border-bottom-left-radius: 9px;
|
||||
}
|
||||
border-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") {
|
||||
xml.readNext();
|
||||
QString latestVersion = xml.text().toString();
|
||||
_latestVersion = &latestVersion;
|
||||
_latestVersion = new QString(xml.text().toString());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (applicationVersion() != _latestVersion) {
|
||||
if (!shouldSkipVersion() && applicationVersion() != _latestVersion) {
|
||||
|
||||
}
|
||||
|
||||
_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();
|
||||
|
||||
}
|
||||
|
||||
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
|
||||
// Display dialog when version is not the latest and allow for new version download from link
|
||||
QFile *loadSkipFile();
|
||||
void checkVersion();
|
||||
void displayUpdateDialog();
|
||||
bool shouldSkipVersion();
|
||||
void skipVersion();
|
||||
|
||||
QString *_latestVersion;
|
||||
QString *_operatingSystem;
|
||||
|
||||
public slots:
|
||||
void sendAvatarFaceVideoMessage(int frameCount, const QByteArray& data);
|
||||
|
@ -520,9 +526,6 @@ private:
|
|||
QPointer<LogDialog> _logDialog;
|
||||
|
||||
FileLogger* _logger;
|
||||
|
||||
QString *_latestVersion;
|
||||
QString _operatingSystem;
|
||||
};
|
||||
|
||||
#endif /* defined(__interface__Application__) */
|
||||
|
|
|
@ -6,30 +6,32 @@
|
|||
// Copyright (c) 2013, 2014 High Fidelity, Inc. All rights reserved.
|
||||
//
|
||||
|
||||
#include <QApplication>
|
||||
#include <QDesktopWidget>
|
||||
#include <QTextBlock>
|
||||
#include <QtGui>
|
||||
|
||||
#include "Application.h"
|
||||
#include "SharedUtil.h"
|
||||
#include "UpdateDialog.h"
|
||||
|
||||
const int buttonWidth = 120;
|
||||
const int buttonWidth = 125;
|
||||
const int buttonHeight = 40;
|
||||
const int buttonMargin = 15;
|
||||
const int leftStartingPosition = 345;
|
||||
const int buttonMargin = 100;
|
||||
const int leftStartingPosition = 275;
|
||||
const int dialogWidth = 750;
|
||||
const int dialogHeigth = 300;
|
||||
|
||||
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;
|
||||
_latestVersion = latestVersion;
|
||||
|
||||
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 \
|
||||
features and bug fixes.").arg(currentVersion, *latestVersion);
|
||||
features and bug fixes.").arg(application->applicationVersion(), *application->_latestVersion);
|
||||
|
||||
int leftPosition = leftStartingPosition;
|
||||
setWindowTitle(dialogTitle);
|
||||
|
@ -70,13 +72,15 @@ UpdateDialog::UpdateDialog(QWidget *parent, QString releaseNotes, QUrl *download
|
|||
}
|
||||
|
||||
void UpdateDialog::handleDownload() {
|
||||
Application* application = Application::getInstance();
|
||||
QDesktopServices::openUrl((*_downloadURL));
|
||||
close();
|
||||
application->quit();
|
||||
}
|
||||
|
||||
void UpdateDialog::handleSkip() {
|
||||
QString fileName = QStandardPaths::writableLocation(QStandardPaths::DataLocation);
|
||||
fileName.append(QString("/hifi.skipversion"));
|
||||
Application* application = Application::getInstance();
|
||||
application->skipVersion();
|
||||
close();
|
||||
}
|
||||
|
||||
void UpdateDialog::handleClose() {
|
||||
|
|
|
@ -20,7 +20,7 @@ class UpdateDialog : public QDialog {
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
UpdateDialog(QWidget*, QString releaseNotes, QUrl *downloadURL, QString *latestVersion, QString currentVersion);
|
||||
UpdateDialog(QWidget*, QString releaseNotes, QUrl *downloadURL);
|
||||
|
||||
private:
|
||||
QLabel *_updateRequired;
|
||||
|
@ -30,7 +30,6 @@ private:
|
|||
QPushButton *_closeButton;
|
||||
QFrame *_titleBackground;
|
||||
QUrl *_downloadURL;
|
||||
QString *_latestVersion;
|
||||
|
||||
private slots:
|
||||
void handleDownload();
|
||||
|
|
Loading…
Reference in a new issue