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})
endforeach(EXTERNAL_SOURCE_SUBDIR)
find_package(Qt5Core REQUIRED)
find_package(Qt5Gui REQUIRED)
find_package(Qt5Multimedia REQUIRED)
@ -83,6 +82,14 @@ 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)
# 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);
skipFile.open(QIODevice::ReadWrite);
QString skipVersion(skipFile.readAll());
return (skipVersion == latestVersion || applicationVersion() == "dev");
// return (skipVersion == latestVersion || applicationVersion() == "dev");
return false;
}
void Application::skipVersion(QString latestVersion) {

View file

@ -19,35 +19,34 @@
#include "SharedUtil.h"
#include "UpdateDialog.h"
#include "ui_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: