diff --git a/settings.conf b/settings.conf index 17e4d690c..bd5b06bda 100644 --- a/settings.conf +++ b/settings.conf @@ -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 diff --git a/src/calamares/CalamaresWindow.cpp b/src/calamares/CalamaresWindow.cpp index a141317e0..0d425d929 100644 --- a/src/calamares/CalamaresWindow.cpp +++ b/src/calamares/CalamaresWindow.cpp @@ -4,6 +4,7 @@ * SPDX-FileCopyrightText: 2017-2018 Adriaan de Groot * SPDX-FileCopyrightText: 2018 Raul Rodrigo Segura (raurodse) * SPDX-FileCopyrightText: 2019 Collabora Ltd + * SPDX-FileCopyrightText: 2020 Anubhav Choudhary * 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 ); diff --git a/src/calamares/calamares-navigation.qml b/src/calamares/calamares-navigation.qml index 131926175..937e35529 100644 --- a/src/calamares/calamares-navigation.qml +++ b/src/calamares/calamares-navigation.qml @@ -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 diff --git a/src/libcalamares/Settings.cpp b/src/libcalamares/Settings.cpp index dcb5c70b0..9453075b6 100644 --- a/src/libcalamares/Settings.cpp +++ b/src/libcalamares/Settings.cpp @@ -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(); diff --git a/src/libcalamares/Settings.h b/src/libcalamares/Settings.h index 0abf3b866..4d3d2db3a 100644 --- a/src/libcalamares/Settings.h +++ b/src/libcalamares/Settings.h @@ -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 diff --git a/src/libcalamaresui/ViewManager.cpp b/src/libcalamaresui/ViewManager.cpp index 8094e5223..f43152209 100644 --- a/src/libcalamaresui/ViewManager.cpp +++ b/src/libcalamaresui/ViewManager.cpp @@ -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 { diff --git a/src/libcalamaresui/ViewManager.h b/src/libcalamaresui/ViewManager.h index 165358b76..4fbcda39d 100644 --- a/src/libcalamaresui/ViewManager.h +++ b/src/libcalamaresui/ViewManager.h @@ -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;