Merge pull request #1590 from deprov447/Back/Next_buttons_at_installation

Navigation buttons hideability during installation
This commit is contained in:
Adriaan de Groot 2021-01-18 16:24:10 +01:00 committed by GitHub
commit b709ba7a5b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 42 additions and 9 deletions

View File

@ -2,7 +2,7 @@
# SPDX-License-Identifier: CC0-1.0
#
# Configuration file for Calamares
#
#
# This is the top-level configuration file for Calamares.
# It specifies what modules will be used, as well as some
# overall characteristics -- is this a setup program, or
@ -217,6 +217,14 @@ disable-cancel: false
# YAML: boolean.
disable-cancel-during-exec: false
# If this is set to true, the "Next" and "Back" button will be hidden once
# you start the 'Installation'.
#
# Default is false, but Calamares will complain if this is not explicitly set.
#
# YAML: boolean.
hide-back-and-next-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

View File

@ -4,6 +4,7 @@
* SPDX-FileCopyrightText: 2017-2018 Adriaan de Groot <groot@kde.org>
* SPDX-FileCopyrightText: 2018 Raul Rodrigo Segura (raurodse)
* SPDX-FileCopyrightText: 2019 Collabora Ltd <arnaud.ferraris@collabora.com>
* SPDX-FileCopyrightText: 2020 Anubhav Choudhary <ac.10edu@gmail.com>
* SPDX-License-Identifier: GPL-3.0-or-later
*
* Calamares is Free Software: see the License-Identifier above.
@ -161,6 +162,7 @@ CalamaresWindow::getWidgetNavigation( QWidget* parent )
connect( m_viewManager, &Calamares::ViewManager::backIconChanged, this, [=]( QString n ) {
setButtonIcon( back, n );
} );
connect( m_viewManager, &Calamares::ViewManager::backAndNextVisibleChanged, back, &QPushButton::setVisible );
bottomLayout->addWidget( back );
}
{
@ -173,6 +175,7 @@ CalamaresWindow::getWidgetNavigation( QWidget* parent )
connect( m_viewManager, &Calamares::ViewManager::nextIconChanged, this, [=]( QString n ) {
setButtonIcon( next, n );
} );
connect( m_viewManager, &Calamares::ViewManager::backAndNextVisibleChanged, next, &QPushButton::setVisible );
bottomLayout->addWidget( next );
}
bottomLayout->addSpacing( 12 );

View File

@ -35,7 +35,7 @@ Rectangle {
icon.name: ViewManager.backIcon;
enabled: ViewManager.backEnabled;
visible: true;
visible: ViewManager.backAndNextVisible;
onClicked: { ViewManager.back(); }
}
Button
@ -44,7 +44,7 @@ Rectangle {
icon.name: ViewManager.nextIcon;
enabled: ViewManager.nextEnabled;
visible: true;
visible: ViewManager.backAndNextVisible;
onClicked: { ViewManager.next(); }
}
Button

View File

@ -308,6 +308,7 @@ Settings::setConfiguration( const QByteArray& ba, const QString& explainName )
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_hideBackAndNextDuringExec = requireBool( config, "hide-back-and-next-during-exec", false );
m_quitAtEnd = requireBool( config, "quit-at-end", false );
reconcileInstancesAndSequence();

View File

@ -157,6 +157,8 @@ public:
/** @brief Temporary setting of disable-cancel: can't cancel during exec. */
bool disableCancelDuringExec() const { return m_disableCancelDuringExec; }
bool hideBackAndNextDuringExec() const { return m_hideBackAndNextDuringExec; }
/** @brief Is quit-at-end set? (Quit automatically when done) */
bool quitAtEnd() const { return m_quitAtEnd; }
@ -170,13 +172,15 @@ private:
QString m_brandingComponentName;
// bools are initialized here according to default setting
bool m_debug;
bool m_doChroot;
bool m_isSetupMode;
bool m_promptInstall;
bool m_disableCancel;
bool m_disableCancelDuringExec;
bool m_quitAtEnd;
bool m_doChroot = true;
bool m_isSetupMode = false;
bool m_promptInstall = false;
bool m_disableCancel = false;
bool m_disableCancelDuringExec = false;
bool m_hideBackAndNextDuringExec=false;
bool m_quitAtEnd = false;
};
} // namespace Calamares

View File

@ -369,6 +369,7 @@ ViewManager::next()
UPDATE_BUTTON_PROPERTY( backEnabled, false )
}
updateCancelEnabled( !settings->disableCancel() && !( executing && settings->disableCancelDuringExec() ) );
updateBackAndNextVisibility( !( executing && settings->hideBackAndNextDuringExec() ) );
}
else
{
@ -528,6 +529,12 @@ ViewManager::updateCancelEnabled( bool enabled )
emit cancelEnabled( enabled );
}
void
ViewManager::updateBackAndNextVisibility( bool visible)
{
UPDATE_BUTTON_PROPERTY( backAndNextVisible, visible )
}
QVariant
ViewManager::data( const QModelIndex& index, int role ) const
{

View File

@ -45,6 +45,8 @@ class UIDLLEXPORT ViewManager : public QAbstractListModel
Q_PROPERTY( bool quitVisible READ quitVisible NOTIFY quitVisibleChanged FINAL )
Q_PROPERTY( bool backAndNextVisible READ backAndNextVisible NOTIFY backAndNextVisibleChanged FINAL )
///@brief Sides on which the ViewManager has side-panels
Q_PROPERTY( Qt::Orientations panelSides READ panelSides WRITE setPanelSides MEMBER m_panelSides )
@ -144,6 +146,10 @@ public Q_SLOTS:
return m_backIcon; ///< Name of the icon to show
}
bool backAndNextVisible() const
{
return m_backAndNextVisible; ///< Is the quit-button to be enabled
}
/**
* @brief Probably quit
*
@ -203,6 +209,7 @@ signals:
void backEnabledChanged( bool ) const;
void backLabelChanged( QString ) const;
void backIconChanged( QString ) const;
void backAndNextVisibleChanged( bool ) const;
void quitEnabledChanged( bool ) const;
void quitLabelChanged( QString ) const;
@ -217,6 +224,7 @@ private:
void insertViewStep( int before, ViewStep* step );
void updateButtonLabels();
void updateCancelEnabled( bool enabled );
void updateBackAndNextVisibility( bool visible );
inline bool currentStepValid() const { return ( 0 <= m_currentStep ) && ( m_currentStep < m_steps.length() ); }
@ -236,6 +244,8 @@ private:
QString m_backLabel;
QString m_backIcon;
bool m_backAndNextVisible = true;
bool m_quitEnabled = false;
QString m_quitLabel;
QString m_quitIcon;