mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 18:23:54 +02:00
Checkpoint
This commit is contained in:
parent
9dd37344b8
commit
664a1a7677
4 changed files with 30 additions and 11 deletions
|
@ -4588,7 +4588,7 @@ void Application::parseVersionXml(QNetworkReply *reply) {
|
|||
|
||||
if (xml.name() == "Version") {
|
||||
xml.readNext();
|
||||
_latestVersion = xml.text().toString();
|
||||
*_latestVersion = xml.text().toString();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4601,6 +4601,6 @@ void Application::parseVersionXml(QNetworkReply *reply) {
|
|||
_downloadLink = new QUrl("http://www.google.com");
|
||||
|
||||
UpdateDialog *_updateDialog = new UpdateDialog(_glWidget, _releaseNotes, _downloadLink, _latestVersion, applicationVersion());
|
||||
_updateDialog->show();
|
||||
_updateDialog->exec();
|
||||
|
||||
}
|
||||
|
|
|
@ -521,7 +521,7 @@ private:
|
|||
|
||||
FileLogger* _logger;
|
||||
|
||||
QString _latestVersion;
|
||||
QString *_latestVersion;
|
||||
QString _operatingSystem;
|
||||
};
|
||||
|
||||
|
|
|
@ -15,19 +15,27 @@
|
|||
|
||||
const int buttonWidth = 120;
|
||||
const int buttonHeight = 40;
|
||||
const int dialogWidth = 500;
|
||||
const int buttonMargin = 15;
|
||||
const int leftStartingPosition = 345;
|
||||
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, QString *latestVersion, QString currentVersion) : QDialog(parent, Qt::Dialog) {
|
||||
|
||||
_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(currentVersion, *latestVersion);
|
||||
|
||||
int leftPosition = leftStartingPosition;
|
||||
setWindowTitle(dialogTitle);
|
||||
//setWindowFlags(Qt::WindowTitleHint);
|
||||
setModal(true);
|
||||
resize(dialogWidth, dialogHeigth);
|
||||
QFile styleSheet("resources/styles/update_dialog.qss");
|
||||
if (styleSheet.open(QIODevice::ReadOnly)) {
|
||||
setStyleSheet(styleSheet.readAll());
|
||||
|
@ -40,26 +48,35 @@ UpdateDialog::UpdateDialog(QWidget *parent, QString releaseNotes, QUrl *download
|
|||
|
||||
_downloadButton = new QPushButton("Download", this);
|
||||
_downloadButton->setObjectName("downloadButton");
|
||||
_downloadButton->setGeometry(leftPosition, buttonMargin, buttonWidth, buttonHeight);
|
||||
leftPosition += buttonWidth;
|
||||
|
||||
_skipButton = new QPushButton("Skip Version", this);
|
||||
_skipButton->setObjectName("skipButton");
|
||||
_skipButton->setGeometry(leftPosition, buttonMargin, buttonWidth, buttonHeight);
|
||||
leftPosition += buttonWidth;
|
||||
|
||||
_closeButton = new QPushButton("Close", this);
|
||||
_closeButton->setObjectName("closeButton");
|
||||
_closeButton->setGeometry(leftPosition, buttonMargin, buttonWidth, buttonHeight);
|
||||
|
||||
_titleBackground = new QFrame();
|
||||
|
||||
connect(_downloadButton, SIGNAL(released()), this, SLOT(handleDownload()));
|
||||
connect(_skipButton, SIGNAL(released()), this, SLOT(handleDownload()));
|
||||
connect(_skipButton, SIGNAL(released()), this, SLOT(handleSkip()));
|
||||
connect(_closeButton, SIGNAL(released()), this, SLOT(handleClose()));
|
||||
}
|
||||
|
||||
void UpdateDialog::handleDownload() {
|
||||
qDebug("download clicked");
|
||||
QDesktopServices::openUrl((*_downloadURL));
|
||||
close();
|
||||
}
|
||||
|
||||
void UpdateDialog::handleSkip() {
|
||||
qDebug("skip clicked");
|
||||
QString fileName = QStandardPaths::writableLocation(QStandardPaths::DataLocation);
|
||||
fileName.append(QString("/hifi.skipversion"));
|
||||
}
|
||||
|
||||
void UpdateDialog::handleClose() {
|
||||
qDebug("close clicked");
|
||||
close();
|
||||
}
|
|
@ -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, QString *latestVersion, QString currentVersion);
|
||||
|
||||
private:
|
||||
QLabel *_updateRequired;
|
||||
|
@ -29,6 +29,8 @@ private:
|
|||
QPushButton *_skipButton;
|
||||
QPushButton *_closeButton;
|
||||
QFrame *_titleBackground;
|
||||
QUrl *_downloadURL;
|
||||
QString *_latestVersion;
|
||||
|
||||
private slots:
|
||||
void handleDownload();
|
||||
|
|
Loading…
Reference in a new issue