mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-07-10 20:27:23 +02:00
52 lines
No EOL
1.9 KiB
C++
52 lines
No EOL
1.9 KiB
C++
//
|
|
// UpdateDialog.cpp
|
|
// interface
|
|
//
|
|
// Created by Leonardo Murillo <leo@highfidelity.io> on 1/8/14.
|
|
// Copyright (c) 2013, 2014 High Fidelity, Inc. All rights reserved.
|
|
//
|
|
|
|
#include "Application.h" // HACK ATTACK WARNING: for windows build to work, we need this ahead of QtGui
|
|
#include <QtGui>
|
|
#include "ui_updateDialog.h"
|
|
|
|
#include "UpdateDialog.h"
|
|
|
|
|
|
UpdateDialog::UpdateDialog(QWidget *parent, const QString& releaseNotes, const QString& latestVersion, const QUrl& downloadURL) :
|
|
QDialog(parent),
|
|
_latestVersion(latestVersion),
|
|
_downloadUrl(downloadURL)
|
|
{
|
|
Ui::Dialog dialogUI;
|
|
dialogUI.setupUi(this);
|
|
|
|
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.")
|
|
.arg(Application::getInstance()->applicationVersion(), latestVersion);
|
|
|
|
setAttribute(Qt::WA_DeleteOnClose);
|
|
|
|
QPushButton* downloadButton = findChild<QPushButton*>("downloadButton");
|
|
QPushButton* skipButton = findChild<QPushButton*>("skipButton");
|
|
QPushButton* closeButton = findChild<QPushButton*>("closeButton");
|
|
QLabel* updateContent = findChild<QLabel*>("updateContent");
|
|
|
|
updateContent->setText(updateRequired);
|
|
|
|
connect(downloadButton, SIGNAL(released()), this, SLOT(handleDownload()));
|
|
connect(skipButton, SIGNAL(released()), this, SLOT(handleSkip()));
|
|
connect(closeButton, SIGNAL(released()), this, SLOT(close()));
|
|
|
|
QMetaObject::invokeMethod(this, "show", Qt::QueuedConnection);
|
|
}
|
|
|
|
void UpdateDialog::handleDownload() {
|
|
QDesktopServices::openUrl(_downloadUrl);
|
|
Application::getInstance()->quit();
|
|
}
|
|
|
|
void UpdateDialog::handleSkip() {
|
|
Application::getInstance()->skipVersion(_latestVersion);
|
|
this->close();
|
|
} |