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})
endforeach(EXTERNAL_SOURCE_SUBDIR)
find_package(Qt5Core REQUIRED)
find_package(Qt5Gui REQUIRED)
find_package(Qt5Multimedia REQUIRED)
@ -81,7 +80,14 @@ find_package(Qt5Svg REQUIRED)
find_package(Qt5WebKit REQUIRED)
find_package(Qt5WebKitWidgets 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)
set(MACOSX_BUNDLE_BUNDLE_NAME Interface)

View file

@ -6,48 +6,40 @@
// Copyright (c) 2013, 2014 High Fidelity, Inc. All rights reserved.
//
#include <QApplication>
#include <QDesktopWidget>
#include <QTextBlock>
#include <QtGui>
#include <QtUiTools>
#include <QPushButton>
#include <QLabel>
#include <QFrame>
#include "Application.h"
#include "SharedUtil.h"
#include "ui_updateDialog.h"
#include "UpdateDialog.h"
UpdateDialog::UpdateDialog(QWidget *parent, const QString& releaseNotes, const QString& latestVersion, const QUrl& downloadURL) :
QWidget(parent, Qt::Widget),
QDialog(parent),
_latestVersion(latestVersion),
_downloadUrl(downloadURL) {
QUiLoader updateDialogLoader;
QWidget* updateDialog;
QFile updateDialogUi("resources/ui/updateDialog.ui");
updateDialogUi.open(QFile::ReadOnly);
updateDialog = updateDialogLoader.load(&updateDialogUi, this);
_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);
updateDialog->setAttribute(Qt::WA_DeleteOnClose);
QPushButton* downloadButton = updateDialog->findChild<QPushButton*>("downloadButton");
QPushButton* skipButton = updateDialog->findChild<QPushButton*>("skipButton");
QPushButton* closeButton = updateDialog->findChild<QPushButton*>("closeButton");
QLabel* updateContent = updateDialog->findChild<QLabel*>("updateContent");
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()));
updateDialog->show();
QMetaObject::invokeMethod(this, "show", Qt::QueuedConnection);
}
void UpdateDialog::handleDownload() {

View file

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