[libcalamaresui] Adjust quit-messages to setup-mode

main
Adriaan de Groot 6 years ago
parent 8ee2375ee6
commit 3a0bd254c0

@ -74,7 +74,10 @@ ViewManager::ViewManager( QObject* parent )
m_back->setText( tr( "&Back" ) ); m_back->setText( tr( "&Back" ) );
m_next->setText( tr( "&Next" ) ); m_next->setText( tr( "&Next" ) );
m_quit->setText( tr( "&Cancel" ) ); m_quit->setText( tr( "&Cancel" ) );
m_quit->setToolTip( tr( "Cancel installation without changing the system." ) ); QString tooltip = Calamares::Settings::instance()->isSetupMode()
? tr( "Cancel setup without changing the system." )
: tr( "Cancel installation without changing the system." );
m_quit->setToolTip( tooltip );
) )
QBoxLayout* bottomLayout = new QHBoxLayout; QBoxLayout* bottomLayout = new QHBoxLayout;
@ -159,10 +162,13 @@ ViewManager::onInstallationFailed( const QString& message, const QString& detail
cDebug() << "- message:" << message; cDebug() << "- message:" << message;
cDebug() << "- details:" << details; cDebug() << "- details:" << details;
QString heading = Calamares::Settings::instance()->isSetupMode()
? tr( "Setup Failed" )
: tr( "Installation Failed" );
QMessageBox* msgBox = new QMessageBox(); QMessageBox* msgBox = new QMessageBox();
msgBox->setIcon( QMessageBox::Critical ); msgBox->setIcon( QMessageBox::Critical );
msgBox->setWindowTitle( tr( "Error" ) ); msgBox->setWindowTitle( tr( "Error" ) );
msgBox->setText( "<strong>" + tr( "Installation Failed" ) + "</strong>" ); msgBox->setText( "<strong>" + heading + "</strong>" );
msgBox->setStandardButtons( QMessageBox::Close ); msgBox->setStandardButtons( QMessageBox::Close );
msgBox->button( QMessageBox::Close )->setText( tr( "&Close" ) ); msgBox->button( QMessageBox::Close )->setText( tr( "&Close" ) );
@ -180,6 +186,8 @@ ViewManager::onInstallationFailed( const QString& message, const QString& detail
void void
ViewManager::onInitFailed( const QStringList& modules) ViewManager::onInitFailed( const QStringList& modules)
{ {
// Because this means the installer / setup program is broken by the distributor,
// don't bother being precise about installer / setup wording.
QString title( tr( "Calamares Initialization Failed" ) ); QString title( tr( "Calamares Initialization Failed" ) );
QString description( tr( "%1 can not be installed. Calamares was unable to load all of the configured modules. This is a problem with the way Calamares is being used by the distribution." ) ); QString description( tr( "%1 can not be installed. Calamares was unable to load all of the configured modules. This is a problem with the way Calamares is being used by the distribution." ) );
QString detailString; QString detailString;
@ -236,15 +244,25 @@ ViewManager::next()
// 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 ( Calamares::Settings::instance()->showPromptBeforeExecution() && stepNextWillExecute( m_steps, m_currentStep ) )
{ {
QString title = Calamares::Settings::instance()->isSetupMode()
? tr( "Continue with setup?" )
: tr( "Continue with installation?" );
QString question = Calamares::Settings::instance()->isSetupMode()
? 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 "
"to undo these changes.</strong>" )
: tr( "The %1 installer is about to make changes to your "
"disk in order to install %2.<br/><strong>You will not be able "
"to undo these changes.</strong>" );
QString confirm = Calamares::Settings::instance()->isSetupMode()
? tr( "&Set up now" )
: tr( "&Install now" );
int reply = int reply =
QMessageBox::question( m_widget, QMessageBox::question( m_widget,
tr( "Continue with setup?" ), title,
tr( "The %1 installer is about to make changes to your " question.arg( *Calamares::Branding::ShortProductName, *Calamares::Branding::ShortVersionedName ),
"disk in order to install %2.<br/><strong>You will not be able " confirm,
"to undo these changes.</strong>" )
.arg( *Calamares::Branding::ShortProductName )
.arg( *Calamares::Branding::ShortVersionedName ),
tr( "&Install now" ),
tr( "Go &back" ), tr( "Go &back" ),
QString(), QString(),
0, 0,
@ -277,15 +295,25 @@ ViewManager::next()
void void
ViewManager::updateButtonLabels() ViewManager::updateButtonLabels()
{ {
QString next = Calamares::Settings::instance()->isSetupMode()
? tr( "&Set up" )
: tr( "&Install" );
QString complete = Calamares::Settings::instance()->isSetupMode()
? tr( "Setup is complete. Close the setup program." )
: tr( "The installation is complete. Close the installer." );
QString quit = Calamares::Settings::instance()->isSetupMode()
? tr( "Cancel setup without changing the system." )
: tr( "Cancel installation without changing the system." );
if ( stepNextWillExecute( m_steps, m_currentStep ) ) if ( stepNextWillExecute( m_steps, m_currentStep ) )
m_next->setText( tr( "&Install" ) ); m_next->setText( next );
else else
m_next->setText( tr( "&Next" ) ); m_next->setText( tr( "&Next" ) );
if ( m_currentStep == m_steps.count() -1 && m_steps.last()->isAtEnd() ) if ( m_currentStep == m_steps.count() -1 && m_steps.last()->isAtEnd() )
{ {
m_quit->setText( tr( "&Done" ) ); m_quit->setText( tr( "&Done" ) );
m_quit->setToolTip( tr( "The installation is complete. Close the installer." ) ); m_quit->setToolTip( complete );
if (Calamares::Settings::instance()->disableCancel()) if (Calamares::Settings::instance()->disableCancel())
m_quit->setVisible( true ); m_quit->setVisible( true );
} }
@ -294,7 +322,7 @@ ViewManager::updateButtonLabels()
if (Calamares::Settings::instance()->disableCancel()) if (Calamares::Settings::instance()->disableCancel())
m_quit->setVisible( false ); m_quit->setVisible( false );
m_quit->setText( tr( "&Cancel" ) ); m_quit->setText( tr( "&Cancel" ) );
m_quit->setToolTip( tr( "Cancel installation without changing the system." ) ); m_quit->setToolTip( quit );
} }
} }
@ -329,10 +357,17 @@ bool ViewManager::confirmCancelInstallation()
if ( !( m_currentStep == m_steps.count() -1 && if ( !( m_currentStep == m_steps.count() -1 &&
m_steps.last()->isAtEnd() ) ) m_steps.last()->isAtEnd() ) )
{ {
QString title = Calamares::Settings::instance()->isSetupMode()
? tr( "Cancel setup?" )
: tr( "Cancel installation?" );
QString question = Calamares::Settings::instance()->isSetupMode()
? tr( "Do you really want to cancel the current setup process?\n"
"The setup program will quit and all changes will be lost." )
: tr( "Do you really want to cancel the current install process?\n"
"The installer will quit and all changes will be lost." );
QMessageBox mb( QMessageBox::Question, QMessageBox mb( QMessageBox::Question,
tr( "Cancel installation?" ), title,
tr( "Do you really want to cancel the current install process?\n" question,
"The installer will quit and all changes will be lost." ),
QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes | QMessageBox::No,
m_widget ); m_widget );
mb.setDefaultButton( QMessageBox::No ); mb.setDefaultButton( QMessageBox::No );

Loading…
Cancel
Save