History

Checkpoint auto updater

Leonardo Murillo committed 11 years ago

Commit cefdbc31 parent faf91209 files · +158 −295Browse files

Showing the changes to interface/src/ui/UpdateDialog.cpp (1 of 9 files). Show all

Unified · Split

interface/src/ui/UpdateDialog.cpp+0−55
@@ -1,55 +0,0 @@
1//
2// UpdateDialog.cpp
3// interface/src/ui
4//
5// Copyright 2014 High Fidelity, Inc.
6//
7// Distributed under the Apache License, Version 2.0.
8// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
9//
10
11#include <QDesktopServices>
12
13#include "ui_updateDialog.h"
14
15#include "Application.h"
16#include "UpdateDialog.h"
17
18
19UpdateDialog::UpdateDialog(QWidget *parent, const QString& releaseNotes, const QString& latestVersion, const QUrl& downloadURL) :
20 QDialog(parent),
21 _latestVersion(latestVersion),
22 _downloadUrl(downloadURL)
23{
24 Ui::Dialog dialogUI;
25 dialogUI.setupUi(this);
26
27 QString updateRequired = QString("You are currently running build %1, the latest build released is %2."
28 "\n\nPlease download and install the most recent release to access the latest features and bug fixes.")
29 .arg(Application::getInstance()->applicationVersion(), latestVersion);
30
31 setAttribute(Qt::WA_DeleteOnClose);
32
33 QPushButton* downloadButton = findChild<QPushButton*>("downloadButton");
34 QPushButton* skipButton = findChild<QPushButton*>("skipButton");
35 QPushButton* closeButton = findChild<QPushButton*>("closeButton");
36 QLabel* updateContent = findChild<QLabel*>("updateContent");
37
38 updateContent->setText(updateRequired);
39
40 connect(downloadButton, SIGNAL(released()), this, SLOT(handleDownload()));
41 connect(skipButton, SIGNAL(released()), this, SLOT(handleSkip()));
42 connect(closeButton, SIGNAL(released()), this, SLOT(close()));
43
44 QMetaObject::invokeMethod(this, "show", Qt::QueuedConnection);
45}
46
47void UpdateDialog::handleDownload() {
48 QDesktopServices::openUrl(_downloadUrl);
49 Application::getInstance()->quit();
50}
51
52void UpdateDialog::handleSkip() {
53 Application::getInstance()->skipVersion(_latestVersion);
54 this->close();
55}