From 3d2d43412531c85a095a3ce2cd7c04ea747b6894 Mon Sep 17 00:00:00 2001 From: Eberhard Graether Date: Tue, 26 Apr 2016 18:28:57 +0200 Subject: [PATCH] ui: Added cancel button to enter license window --- script/setup.sh | 2 +- src/lib_gui/qt/window/QtLicense.cpp | 21 ++++++++++++++++++--- src/lib_gui/qt/window/QtLicense.h | 3 +++ src/lib_gui/qt/window/QtMainWindow.cpp | 4 ++-- 4 files changed, 24 insertions(+), 6 deletions(-) diff --git a/script/setup.sh b/script/setup.sh index 21bc8bbd..f10f7e35 100755 --- a/script/setup.sh +++ b/script/setup.sh @@ -82,7 +82,7 @@ if [ $PLATFORM == "Linux" ] || [ $PLATFORM == "MacOS" ]; then cd build/Debug && cmake -G Ninja -DCMAKE_BUILD_TYPE="Debug" ../.. echo -e $INFO "run cmake with Release configuration" - cd ../Release && cmake -G Ninja -DCMAKE_BUILD_TYPE="Release" ../.. + cd ../Release && cmake -G Xcode -DCMAKE_BUILD_TYPE="Release" ../.. fi echo -e $SUCCESS "setup complete" diff --git a/src/lib_gui/qt/window/QtLicense.cpp b/src/lib_gui/qt/window/QtLicense.cpp index 3e52120b..42aa9b19 100644 --- a/src/lib_gui/qt/window/QtLicense.cpp +++ b/src/lib_gui/qt/window/QtLicense.cpp @@ -13,6 +13,7 @@ QtLicense::QtLicense(QWidget *parent) : QtWindow(parent) + , m_forced(false) { raise(); } @@ -45,6 +46,15 @@ void QtLicense::load() { m_licenseText->setText(licenseString.c_str()); } + + m_forced = false; + updateCloseButton("Cancel"); +} + +void QtLicense::loadForced() +{ + m_forced = true; + updateCloseButton("Quit Coati"); } void QtLicense::setErrorMessage(const QString& errorMessage) @@ -122,14 +132,19 @@ void QtLicense::windowReady() updateNextButton("Activate"); setPreviousVisible(false); - updateCloseButton("Quit Coati"); - m_title->hide(); } void QtLicense::handleClose() { - QApplication::quit(); + if (m_forced) + { + QApplication::quit(); + } + else + { + emit canceled(); + } } void QtLicense::handleNext() diff --git a/src/lib_gui/qt/window/QtLicense.h b/src/lib_gui/qt/window/QtLicense.h index 049adc19..b451cb2e 100644 --- a/src/lib_gui/qt/window/QtLicense.h +++ b/src/lib_gui/qt/window/QtLicense.h @@ -18,6 +18,7 @@ public: void clear(); void load(); + void loadForced(); void setErrorMessage(const QString& errorMessage); @@ -32,6 +33,8 @@ protected: private: QTextEdit* m_licenseText; QLabel* m_errorLabel; + + bool m_forced; }; #endif // QT_LICENSE_H diff --git a/src/lib_gui/qt/window/QtMainWindow.cpp b/src/lib_gui/qt/window/QtMainWindow.cpp index af7807d2..1e5ef435 100644 --- a/src/lib_gui/qt/window/QtMainWindow.cpp +++ b/src/lib_gui/qt/window/QtMainWindow.cpp @@ -282,9 +282,10 @@ void QtMainWindow::forceEnterLicense(bool expired) enterLicenseWindow->clear(); } + enterLicenseWindow->loadForced(); + this->setEnabled(false); enterLicenseWindow->setEnabled(true); - enterLicenseWindow->setCloseVisible(true); } bool QtMainWindow::event(QEvent* event) @@ -348,7 +349,6 @@ void QtMainWindow::enterLicense() connect(enterLicenseWindow, SIGNAL(finished()), this, SLOT(activateWindow())); enterLicenseWindow->load(); - enterLicenseWindow->setCloseVisible(false); } void QtMainWindow::showStartScreen()