checkpoint

This commit is contained in:
Leonardo Murillo 2014-01-09 16:14:51 -06:00
parent efb173e1d4
commit 9dd37344b8
3 changed files with 37 additions and 26 deletions

View file

@ -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();
}

View file

@ -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");
}

View file

@ -12,6 +12,7 @@
#include <QDialog>
#include <QPushButton>
#include <QLabel>
#include <QFrame>
#include <iostream>
@ -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();
};