Merge pull request from deprov447/Back/Next_buttons_at_installation

Navigation buttons hideability during installation
main
Adriaan de Groot committed by GitHub
commit b709ba7a5b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -2,7 +2,7 @@
# SPDX-License-Identifier: CC0-1.0 # SPDX-License-Identifier: CC0-1.0
# #
# Configuration file for Calamares # Configuration file for Calamares
# #
# This is the top-level configuration file for Calamares. # This is the top-level configuration file for Calamares.
# It specifies what modules will be used, as well as some # It specifies what modules will be used, as well as some
# overall characteristics -- is this a setup program, or # overall characteristics -- is this a setup program, or
@ -217,6 +217,14 @@ disable-cancel: false
# YAML: boolean. # YAML: boolean.
disable-cancel-during-exec: false 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 # If this is set to true, then once the end of the sequence has
# been reached, the quit (done) button is clicked automatically # been reached, the quit (done) button is clicked automatically
# and Calamares will close. Default is false: the user will see # and Calamares will close. Default is false: the user will see

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

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

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

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

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

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

Loading…
Cancel
Save