Merge branch 'polish-dont-cancel'
This commit is contained in:
commit
455d106163
4
CHANGES
4
CHANGES
@ -22,7 +22,9 @@ This release contains contributions from (alphabetically by first name):
|
|||||||
|
|
||||||
* Under-the-hood code cleanups in lots of parts of the core. Calamares now
|
* Under-the-hood code cleanups in lots of parts of the core. Calamares now
|
||||||
builds without warnings when Clang 8 is used.
|
builds without warnings when Clang 8 is used.
|
||||||
|
* A new *disable-cancel-during-exec* setting provides more fine-grained
|
||||||
|
control than *disable-cancel* (which hides the button entirely).
|
||||||
|
|
||||||
## Modules ##
|
## Modules ##
|
||||||
|
|
||||||
* All of the Python-based modules now have translations enabled.
|
* All of the Python-based modules now have translations enabled.
|
||||||
|
@ -154,7 +154,9 @@ dont-chroot: false
|
|||||||
# Calamares will complain if this is not explicitly set.
|
# Calamares will complain if this is not explicitly set.
|
||||||
# oem-setup: true
|
# oem-setup: true
|
||||||
|
|
||||||
# If this is set to true, the "Cancel" button will be disabled.
|
# If this is set to true, the "Cancel" button will be disabled entirely.
|
||||||
|
# The button is also hidden from view.
|
||||||
|
#
|
||||||
# This can be useful if when e.g. Calamares is used as a post-install
|
# This can be useful if when e.g. Calamares is used as a post-install
|
||||||
# configuration tool and you require the user to go through all the
|
# configuration tool and you require the user to go through all the
|
||||||
# configuration steps.
|
# configuration steps.
|
||||||
@ -167,4 +169,8 @@ disable-cancel: false
|
|||||||
# If this is set to true, the "Cancel" button will be disabled once
|
# If this is set to true, the "Cancel" button will be disabled once
|
||||||
# you start the 'Installation', meaning there won't be a way to cancel
|
# you start the 'Installation', meaning there won't be a way to cancel
|
||||||
# the Installation until it has finished or installation has failed.
|
# the Installation until it has finished or installation has failed.
|
||||||
dont-cancel: false
|
#
|
||||||
|
# Default is false, but Calamares will complain if this is not explicitly set.
|
||||||
|
#
|
||||||
|
# YAML: boolean.
|
||||||
|
disable-cancel-during-exec: false
|
||||||
|
@ -207,7 +207,7 @@ Settings::Settings( const QString& settingsFilePath,
|
|||||||
m_doChroot = !requireBool( config, "dont-chroot", false );
|
m_doChroot = !requireBool( config, "dont-chroot", false );
|
||||||
m_isSetupMode = requireBool( config, "oem-setup", !m_doChroot );
|
m_isSetupMode = requireBool( config, "oem-setup", !m_doChroot );
|
||||||
m_disableCancel = requireBool( config, "disable-cancel", false );
|
m_disableCancel = requireBool( config, "disable-cancel", false );
|
||||||
m_dontCancel = requireBool( config, "dont-cancel", false );
|
m_dontCancel = requireBool( config, "disable-cancel-during-exec", false );
|
||||||
}
|
}
|
||||||
catch ( YAML::Exception& e )
|
catch ( YAML::Exception& e )
|
||||||
{
|
{
|
||||||
|
@ -69,8 +69,9 @@ public:
|
|||||||
*/
|
*/
|
||||||
bool isSetupMode() const { return m_isSetupMode; }
|
bool isSetupMode() const { return m_isSetupMode; }
|
||||||
|
|
||||||
|
/** @brief Global setting of disable-cancel: can't cancel ever. */
|
||||||
bool disableCancel() const;
|
bool disableCancel() const;
|
||||||
|
/** @brief Temporary setting of disable-cancel: can't cancel during exec. */
|
||||||
bool dontCancel() const;
|
bool dontCancel() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -103,7 +103,6 @@ ViewManager::ViewManager( QObject* parent )
|
|||||||
|
|
||||||
if (Calamares::Settings::instance()->disableCancel())
|
if (Calamares::Settings::instance()->disableCancel())
|
||||||
m_quit->setVisible( false );
|
m_quit->setVisible( false );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -241,22 +240,24 @@ ViewManager::next()
|
|||||||
bool executing = false;
|
bool executing = false;
|
||||||
if ( step->isAtEnd() )
|
if ( step->isAtEnd() )
|
||||||
{
|
{
|
||||||
|
const auto const* settings = Calamares::Settings::instance();
|
||||||
|
|
||||||
// Special case when the user clicks next on the very last page in a view phase
|
// Special case when the user clicks next on the very last page in a view phase
|
||||||
// and right before switching to an execution phase.
|
// and right before switching to an execution phase.
|
||||||
// Depending on Calamares::Settings, we show an "are you sure" prompt or not.
|
// Depending on Calamares::Settings, we show an "are you sure" prompt or not.
|
||||||
if ( Calamares::Settings::instance()->showPromptBeforeExecution() && stepNextWillExecute( m_steps, m_currentStep ) )
|
if ( settings->showPromptBeforeExecution() && stepNextWillExecute( m_steps, m_currentStep ) )
|
||||||
{
|
{
|
||||||
QString title = Calamares::Settings::instance()->isSetupMode()
|
QString title = settings->isSetupMode()
|
||||||
? tr( "Continue with setup?" )
|
? tr( "Continue with setup?" )
|
||||||
: tr( "Continue with installation?" );
|
: tr( "Continue with installation?" );
|
||||||
QString question = Calamares::Settings::instance()->isSetupMode()
|
QString question = settings->isSetupMode()
|
||||||
? tr( "The %1 setup program is about to make changes to your "
|
? tr( "The %1 setup program is about to make changes to your "
|
||||||
"disk in order to set up %2.<br/><strong>You will not be able "
|
"disk in order to set up %2.<br/><strong>You will not be able "
|
||||||
"to undo these changes.</strong>" )
|
"to undo these changes.</strong>" )
|
||||||
: tr( "The %1 installer is about to make changes to your "
|
: tr( "The %1 installer is about to make changes to your "
|
||||||
"disk in order to install %2.<br/><strong>You will not be able "
|
"disk in order to install %2.<br/><strong>You will not be able "
|
||||||
"to undo these changes.</strong>" );
|
"to undo these changes.</strong>" );
|
||||||
QString confirm = Calamares::Settings::instance()->isSetupMode()
|
QString confirm = settings->isSetupMode()
|
||||||
? tr( "&Set up now" )
|
? tr( "&Set up now" )
|
||||||
: tr( "&Install now" );
|
: tr( "&Install now" );
|
||||||
|
|
||||||
@ -283,9 +284,12 @@ ViewManager::next()
|
|||||||
{
|
{
|
||||||
m_back->setEnabled( false );
|
m_back->setEnabled( false );
|
||||||
m_next->setEnabled( false );
|
m_next->setEnabled( false );
|
||||||
if (Calamares::Settings::instance()->dontCancel())
|
// Enabled if there's nothing blocking it during exec
|
||||||
m_quit->setEnabled( false );
|
m_quit->setEnabled( !( settings->dontCancel() || settings->disableCancel() ) );
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
// Enabled unless it's also hidden
|
||||||
|
m_quit->setEnabled( !settings->disableCancel() );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
step->next();
|
step->next();
|
||||||
@ -318,13 +322,16 @@ ViewManager::updateButtonLabels()
|
|||||||
{
|
{
|
||||||
m_quit->setText( tr( "&Done" ) );
|
m_quit->setText( tr( "&Done" ) );
|
||||||
m_quit->setToolTip( complete );
|
m_quit->setToolTip( complete );
|
||||||
if (Calamares::Settings::instance()->disableCancel())
|
m_quit->setVisible( true ); // At end, always visible and enabled.
|
||||||
m_quit->setVisible( true );
|
m_quit->setEnabled( true );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (Calamares::Settings::instance()->disableCancel())
|
if ( Calamares::Settings::instance()->disableCancel() )
|
||||||
|
{
|
||||||
m_quit->setVisible( false );
|
m_quit->setVisible( false );
|
||||||
|
m_quit->setEnabled( false ); // Can't be triggered through DBUS
|
||||||
|
}
|
||||||
m_quit->setText( tr( "&Cancel" ) );
|
m_quit->setText( tr( "&Cancel" ) );
|
||||||
m_quit->setToolTip( quit );
|
m_quit->setToolTip( quit );
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user