diff --git a/src/calamares/CalamaresWindow.cpp b/src/calamares/CalamaresWindow.cpp index 9ec5a7405..22025dccb 100644 --- a/src/calamares/CalamaresWindow.cpp +++ b/src/calamares/CalamaresWindow.cpp @@ -158,10 +158,13 @@ CalamaresWindow::getWidgetNavigation() // Create buttons and sets an initial icon; the icons may change auto* back = new QPushButton( getButtonIcon( QStringLiteral( "go-previous" ) ), tr( "&Back" ), navigation ); back->setObjectName( "view-button-back" ); + connect( back, &QPushButton::clicked, m_viewManager, &Calamares::ViewManager::back ); auto* next = new QPushButton( getButtonIcon( QStringLiteral( "go-next" ) ), tr( "&Next" ), navigation ); next->setObjectName( "view-button-next" ); + connect( next, &QPushButton::clicked, m_viewManager, &Calamares::ViewManager::next ); auto* quit = new QPushButton( getButtonIcon( QStringLiteral( "dialog-cancel" ) ), tr( "&Cancel" ), navigation ); quit->setObjectName( "view-button-cancel" ); + connect( quit, &QPushButton::clicked, m_viewManager, &Calamares::ViewManager::quit ); QBoxLayout* bottomLayout = new QHBoxLayout; bottomLayout->addStretch(); diff --git a/src/libcalamaresui/ViewManager.cpp b/src/libcalamaresui/ViewManager.cpp index dda757fda..2b0c59e49 100644 --- a/src/libcalamaresui/ViewManager.cpp +++ b/src/libcalamaresui/ViewManager.cpp @@ -108,14 +108,9 @@ ViewManager::ViewManager( QObject* parent ) connect( m_next, &QPushButton::clicked, this, &ViewManager::next ); connect( m_back, &QPushButton::clicked, this, &ViewManager::back ); + connect( m_quit, &QPushButton::clicked, this, &ViewManager::quit ); m_back->setEnabled( false ); - connect( m_quit, &QPushButton::clicked, this, [this]() { - if ( this->confirmCancelInstallation() ) - { - qApp->quit(); - } - } ); connect( JobQueue::instance(), &JobQueue::failed, this, &ViewManager::onInstallationFailed ); connect( JobQueue::instance(), &JobQueue::finished, this, &ViewManager::next ); @@ -476,6 +471,16 @@ ViewManager::back() updateButtonLabels(); } + +void +ViewManager::quit() +{ + if ( confirmCancelInstallation() ) + { + qApp->quit(); + } +} + bool ViewManager::confirmCancelInstallation() { diff --git a/src/libcalamaresui/ViewManager.h b/src/libcalamaresui/ViewManager.h index f16419dcd..a3f1918e5 100644 --- a/src/libcalamaresui/ViewManager.h +++ b/src/libcalamaresui/ViewManager.h @@ -92,7 +92,7 @@ public: */ bool confirmCancelInstallation(); -public slots: +public Q_SLOTS: /** * @brief next moves forward to the next page of the current ViewStep (if any), * or to the first page of the next ViewStep if the current ViewStep doesn't @@ -107,6 +107,13 @@ public slots: */ void back(); + /** + * @brief Probably quit + * + * Asks for confirmation if necessary. Terminates the application. + */ + void quit(); + /** * @brief onInstallationFailed displays an error message when a fatal failure * happens in a ViewStep.