[libcalamares] Make isAtVeryEnd() internal

This commit is contained in:
Adriaan de Groot 2020-03-24 14:23:37 +01:00
parent 1eec1a9fe7
commit 1ec7251275
2 changed files with 10 additions and 9 deletions

View File

@ -29,8 +29,8 @@
#include "utils/Paste.h" #include "utils/Paste.h"
#include "utils/Retranslator.h" #include "utils/Retranslator.h"
#include "viewpages/BlankViewStep.h" #include "viewpages/BlankViewStep.h"
#include "viewpages/ViewStep.h"
#include "viewpages/ExecutionViewStep.h" #include "viewpages/ExecutionViewStep.h"
#include "viewpages/ViewStep.h"
#include <QApplication> #include <QApplication>
#include <QBoxLayout> #include <QBoxLayout>
@ -309,6 +309,13 @@ stepIsExecute( const ViewStepList& steps, int index )
&& ( qobject_cast< ExecutionViewStep* >( steps.at( index ) ) != nullptr ); && ( qobject_cast< ExecutionViewStep* >( steps.at( index ) ) != nullptr );
} }
static inline bool
isAtVeryEnd( const ViewStepList& steps, int index )
{
return ( index >= steps.count() ) || ( index == steps.count() - 1 && steps.last()->isAtEnd() );
}
void void
ViewManager::next() ViewManager::next()
{ {
@ -412,7 +419,7 @@ ViewManager::updateButtonLabels()
m_back->setText( tr( "&Back" ) ); m_back->setText( tr( "&Back" ) );
// Cancel button changes label at the end // Cancel button changes label at the end
if ( isAtVeryEnd() ) if ( isAtVeryEnd( m_steps, m_currentStep ) )
{ {
m_quit->setText( tr( "&Done" ) ); m_quit->setText( tr( "&Done" ) );
m_quit->setToolTip( quitOnCompleteTooltip ); m_quit->setToolTip( quitOnCompleteTooltip );
@ -473,7 +480,7 @@ ViewManager::confirmCancelInstallation()
const auto* const settings = Calamares::Settings::instance(); const auto* const settings = Calamares::Settings::instance();
// When we're at the very end, then it's always OK to exit. // When we're at the very end, then it's always OK to exit.
if ( isAtVeryEnd() ) if ( isAtVeryEnd( m_steps, m_currentStep ) )
{ {
return true; return true;
} }

View File

@ -132,12 +132,6 @@ private:
void updateButtonLabels(); void updateButtonLabels();
void updateCancelEnabled( bool enabled ); void updateCancelEnabled( bool enabled );
bool isAtVeryEnd() const
{
return ( m_currentStep >= m_steps.count() )
|| ( m_currentStep == m_steps.count() - 1 && m_steps.last()->isAtEnd() );
}
static ViewManager* s_instance; static ViewManager* s_instance;
ViewStepList m_steps; ViewStepList m_steps;