Merge pull request #1628 from birarda/dialog-fix

updates to UpdateDialog ui loading
This commit is contained in:
ZappoMan 2014-01-22 15:31:28 -08:00
commit 29ce6db285
4 changed files with 24 additions and 26 deletions

View file

@ -71,7 +71,6 @@ foreach(EXTERNAL_SOURCE_SUBDIR ${EXTERNAL_SOURCE_SUBDIRS})
set(INTERFACE_SRCS ${INTERFACE_SRCS} ${SUBDIR_SRCS}) set(INTERFACE_SRCS ${INTERFACE_SRCS} ${SUBDIR_SRCS})
endforeach(EXTERNAL_SOURCE_SUBDIR) endforeach(EXTERNAL_SOURCE_SUBDIR)
find_package(Qt5Core REQUIRED) find_package(Qt5Core REQUIRED)
find_package(Qt5Gui REQUIRED) find_package(Qt5Gui REQUIRED)
find_package(Qt5Multimedia REQUIRED) find_package(Qt5Multimedia REQUIRED)
@ -81,7 +80,14 @@ find_package(Qt5Svg REQUIRED)
find_package(Qt5WebKit REQUIRED) find_package(Qt5WebKit REQUIRED)
find_package(Qt5WebKitWidgets REQUIRED) find_package(Qt5WebKitWidgets REQUIRED)
find_package(Qt5Xml REQUIRED) find_package(Qt5Xml REQUIRED)
find_package(Qt5UiTools REQUIRED)
# grab the ui files in resources/ui
file (GLOB_RECURSE QT_UI_FILES ui/*.ui)
# have qt5 wrap them and generate the appropriate header files
qt5_wrap_ui(QT_UI_HEADERS ${QT_UI_FILES})
# add them to the interface source files
set(INTERFACE_SRCS ${INTERFACE_SRCS} ${QT_UI_HEADERS})
if (APPLE) if (APPLE)
set(MACOSX_BUNDLE_BUNDLE_NAME Interface) set(MACOSX_BUNDLE_BUNDLE_NAME Interface)

View file

@ -6,48 +6,40 @@
// Copyright (c) 2013, 2014 High Fidelity, Inc. All rights reserved. // Copyright (c) 2013, 2014 High Fidelity, Inc. All rights reserved.
// //
#include <QApplication>
#include <QDesktopWidget>
#include <QTextBlock>
#include <QtGui> #include <QtGui>
#include <QtUiTools>
#include <QPushButton>
#include <QLabel>
#include <QFrame>
#include "Application.h" #include "Application.h"
#include "SharedUtil.h" #include "ui_updateDialog.h"
#include "UpdateDialog.h" #include "UpdateDialog.h"
UpdateDialog::UpdateDialog(QWidget *parent, const QString& releaseNotes, const QString& latestVersion, const QUrl& downloadURL) :
QWidget(parent, Qt::Widget),
_latestVersion(latestVersion),
_downloadUrl(downloadURL) {
QUiLoader updateDialogLoader; UpdateDialog::UpdateDialog(QWidget *parent, const QString& releaseNotes, const QString& latestVersion, const QUrl& downloadURL) :
QWidget* updateDialog; QDialog(parent),
QFile updateDialogUi("resources/ui/updateDialog.ui"); _latestVersion(latestVersion),
updateDialogUi.open(QFile::ReadOnly); _downloadUrl(downloadURL)
updateDialog = updateDialogLoader.load(&updateDialogUi, this); {
Ui::Dialog dialogUI;
dialogUI.setupUi(this);
QString updateRequired = QString("You are currently running build %1, the latest build released is %2. \ 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.") Please download and install the most recent release to access the latest features and bug fixes.")
.arg(Application::getInstance()->applicationVersion(), latestVersion); .arg(Application::getInstance()->applicationVersion(), latestVersion);
setAttribute(Qt::WA_DeleteOnClose);
updateDialog->setAttribute(Qt::WA_DeleteOnClose); QPushButton* downloadButton = findChild<QPushButton*>("downloadButton");
QPushButton* skipButton = findChild<QPushButton*>("skipButton");
QPushButton* downloadButton = updateDialog->findChild<QPushButton*>("downloadButton"); QPushButton* closeButton = findChild<QPushButton*>("closeButton");
QPushButton* skipButton = updateDialog->findChild<QPushButton*>("skipButton"); QLabel* updateContent = findChild<QLabel*>("updateContent");
QPushButton* closeButton = updateDialog->findChild<QPushButton*>("closeButton");
QLabel* updateContent = updateDialog->findChild<QLabel*>("updateContent");
updateContent->setText(updateRequired); updateContent->setText(updateRequired);
connect(downloadButton, SIGNAL(released()), this, SLOT(handleDownload())); connect(downloadButton, SIGNAL(released()), this, SLOT(handleDownload()));
connect(skipButton, SIGNAL(released()), this, SLOT(handleSkip())); connect(skipButton, SIGNAL(released()), this, SLOT(handleSkip()));
connect(closeButton, SIGNAL(released()), this, SLOT(close())); connect(closeButton, SIGNAL(released()), this, SLOT(close()));
updateDialog->show();
QMetaObject::invokeMethod(this, "show", Qt::QueuedConnection);
} }
void UpdateDialog::handleDownload() { void UpdateDialog::handleDownload() {

View file

@ -11,7 +11,7 @@
#include <QWidget> #include <QWidget>
class UpdateDialog : public QWidget { class UpdateDialog : public QDialog {
Q_OBJECT Q_OBJECT
public: public: