[libcalamares] Introduce quit-at-end

- In some cases, it makes sense to close Calamares automatically
  when it is done. Set *quit-at-end* to do so -- although this
  probably also means you should remove the *finished* page.
This commit is contained in:
Adriaan de Groot 2020-03-24 15:38:43 +01:00
parent 938277b74e
commit 1de2a4ff14
4 changed files with 17 additions and 0 deletions

View File

@ -188,3 +188,11 @@ disable-cancel: false
#
# YAML: boolean.
disable-cancel-during-exec: false
# If this is set to true, then once the end of the sequence has
# been reached, the quit (done) button is clicked automatically
# and Calamares will close. Default is false: the user will see
# that the end of installation has been reached, and that things are ok.
#
#
quit-at-end: false

View File

@ -232,6 +232,7 @@ Settings::Settings( const QString& settingsFilePath, bool debugMode )
m_isSetupMode = requireBool( config, "oem-setup", !m_doChroot );
m_disableCancel = requireBool( config, "disable-cancel", false );
m_disableCancelDuringExec = requireBool( config, "disable-cancel-during-exec", false );
m_quitAtEnd = requireBool( config, "quit-at-end", false );
}
catch ( YAML::Exception& e )
{

View File

@ -101,6 +101,9 @@ public:
/** @brief Temporary setting of disable-cancel: can't cancel during exec. */
bool disableCancelDuringExec() const { return m_disableCancelDuringExec; }
/** @brief Is quit-at-end set? (Quit automatically when done) */
bool quitAtEnd() const { return m_quitAtEnd; }
private:
static Settings* s_instance;
@ -117,6 +120,7 @@ private:
bool m_promptInstall;
bool m_disableCancel;
bool m_disableCancelDuringExec;
bool m_quitAtEnd;
};
} // namespace Calamares

View File

@ -426,6 +426,10 @@ ViewManager::updateButtonLabels()
m_quit->setVisible( true ); // At end, always visible and enabled.
setButtonIcon( m_quit, "dialog-ok-apply" );
updateCancelEnabled( true );
if ( settings->quitAtEnd() )
{
m_quit->click();
}
}
else
{