[libcalamares] Give ViewManager a real quit() slot
- instead of creating a lambda, give ViewManager a real slot - hook up the new navigation buttons to the next, back, quit slots
This commit is contained in:
parent
9f66b63c00
commit
c638343c18
@ -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();
|
||||
|
@ -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()
|
||||
{
|
||||
|
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user