repair the UpdateDialog so it is a QDialog with no child QWidget

This commit is contained in:
Stephen Birarda 2014-01-22 14:17:56 -08:00
parent 120001ecac
commit d2e02c15d8
5 changed files with 25 additions and 18 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)
@ -83,6 +82,14 @@ find_package(Qt5WebKitWidgets REQUIRED)
find_package(Qt5Xml REQUIRED) find_package(Qt5Xml REQUIRED)
find_package(Qt5UiTools 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)
# set how the icon shows up in the Info.plist file # set how the icon shows up in the Info.plist file

View file

@ -4415,7 +4415,8 @@ bool Application::shouldSkipVersion(QString latestVersion) {
QFile skipFile(SKIP_FILENAME); QFile skipFile(SKIP_FILENAME);
skipFile.open(QIODevice::ReadWrite); skipFile.open(QIODevice::ReadWrite);
QString skipVersion(skipFile.readAll()); QString skipVersion(skipFile.readAll());
return (skipVersion == latestVersion || applicationVersion() == "dev"); // return (skipVersion == latestVersion || applicationVersion() == "dev");
return false;
} }
void Application::skipVersion(QString latestVersion) { void Application::skipVersion(QString latestVersion) {

View file

@ -19,35 +19,34 @@
#include "SharedUtil.h" #include "SharedUtil.h"
#include "UpdateDialog.h" #include "UpdateDialog.h"
#include "ui_updateDialog.h"
UpdateDialog::UpdateDialog(QWidget *parent, const QString& releaseNotes, const QString& latestVersion, const QUrl& downloadURL) : UpdateDialog::UpdateDialog(QWidget *parent, const QString& releaseNotes, const QString& latestVersion, const QUrl& downloadURL) :
QWidget(parent, Qt::Widget), QDialog(parent),
_latestVersion(latestVersion), _latestVersion(latestVersion),
_downloadUrl(downloadURL) { _downloadUrl(downloadURL)
{
QUiLoader updateDialogLoader; Ui::Dialog dialogUI;
QWidget* updateDialog; dialogUI.setupUi(this);
QFile updateDialogUi("resources/ui/updateDialog.ui");
updateDialogUi.open(QFile::ReadOnly);
updateDialog = updateDialogLoader.load(&updateDialogUi, 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: