From 9dd37344b8a7a65067013e8065cc58db37f1cca2 Mon Sep 17 00:00:00 2001 From: Leonardo Murillo Date: Thu, 9 Jan 2014 16:14:51 -0600 Subject: [PATCH] checkpoint --- interface/src/Application.cpp | 23 ++++----------------- interface/src/ui/UpdateDialog.cpp | 33 +++++++++++++++++++++++++++---- interface/src/ui/UpdateDialog.h | 7 ++++--- 3 files changed, 37 insertions(+), 26 deletions(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 4a762e4fc3..0727c8658f 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -4568,7 +4568,7 @@ void Application::checkVersion() { void Application::parseVersionXml(QNetworkReply *reply) { QString _releaseDate; QString _releaseNotes; - QString _downloadLink; + QUrl *_downloadLink; QXmlStreamReader xml(reply); while (!xml.atEnd() && !xml.hasError()) { @@ -4598,24 +4598,9 @@ void Application::parseVersionXml(QNetworkReply *reply) { } - displayUpdateDialog(); -} - -void Application::displayUpdateDialog() { - int _windowWidth = 500; - int _windowHeigth = 300; - QString _windowTitle = "Newer build available"; - - QPushButton *download = new QPushButton("Download"); - QPushButton *ignore = new QPushButton("Ignore this version"); - QPushButton *close = new QPushButton("Close"); - - QWidget *updateDialog = new QWidget; - updateDialog->setFixedWidth(_windowWidth); - updateDialog->setFixedHeight(_windowHeigth); - updateDialog->setWindowTitle(_windowTitle); - - updateDialog->show(); + _downloadLink = new QUrl("http://www.google.com"); + UpdateDialog *_updateDialog = new UpdateDialog(_glWidget, _releaseNotes, _downloadLink, _latestVersion, applicationVersion()); + _updateDialog->show(); } diff --git a/interface/src/ui/UpdateDialog.cpp b/interface/src/ui/UpdateDialog.cpp index c76cad7701..d9543f318b 100644 --- a/interface/src/ui/UpdateDialog.cpp +++ b/interface/src/ui/UpdateDialog.cpp @@ -15,14 +15,23 @@ const int buttonWidth = 120; const int buttonHeight = 40; +const int dialogWidth = 500; +const int dialogHeigth = 300; const QString dialogTitle = "Update Required"; -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("1", "2"); -UpdateDialog::UpdateDialog(QWidget *parent, QString releaseNotes, QString downloadURL) : QDialog(parent, Qt::Dialog) { +UpdateDialog::UpdateDialog(QWidget *parent, QString releaseNotes, QUrl *downloadURL, QString latestVersion, QString currentVersion) : QDialog(parent, Qt::Dialog) { + + 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); + setWindowTitle(dialogTitle); + setModal(true); + QFile styleSheet("resources/styles/update_dialog.qss"); + if (styleSheet.open(QIODevice::ReadOnly)) { + setStyleSheet(styleSheet.readAll()); + } _releaseNotes = new QLabel(this); _releaseNotes->setText(releaseNotes); @@ -36,5 +45,21 @@ UpdateDialog::UpdateDialog(QWidget *parent, QString releaseNotes, QString downlo _closeButton = new QPushButton("Close", this); _closeButton->setObjectName("closeButton"); + _titleBackground = new QFrame(); + connect(_downloadButton, SIGNAL(released()), this, SLOT(handleDownload())); + connect(_skipButton, SIGNAL(released()), this, SLOT(handleDownload())); + connect(_closeButton, SIGNAL(released()), this, SLOT(handleClose())); +} + +void UpdateDialog::handleDownload() { + qDebug("download clicked"); +} + +void UpdateDialog::handleSkip() { + qDebug("skip clicked"); +} + +void UpdateDialog::handleClose() { + qDebug("close clicked"); } \ No newline at end of file diff --git a/interface/src/ui/UpdateDialog.h b/interface/src/ui/UpdateDialog.h index 9a1bfff1c4..bd374afb5b 100644 --- a/interface/src/ui/UpdateDialog.h +++ b/interface/src/ui/UpdateDialog.h @@ -12,6 +12,7 @@ #include #include #include +#include #include @@ -19,8 +20,7 @@ class UpdateDialog : public QDialog { Q_OBJECT public: - UpdateDialog(QWidget*, QString releaseNotes, QString downloadURL); - ~UpdateDialog(); + UpdateDialog(QWidget*, QString releaseNotes, QUrl *downloadURL, QString latestVersion, QString currentVersion); private: QLabel *_updateRequired; @@ -28,10 +28,11 @@ private: QPushButton *_downloadButton; QPushButton *_skipButton; QPushButton *_closeButton; + QFrame *_titleBackground; private slots: void handleDownload(); - void handleIgnore(); + void handleSkip(); void handleClose(); };