From 57ccefa1e5bca5c67f61030d0cab2871542d70da Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Mon, 1 Apr 2019 05:35:02 -0400 Subject: [PATCH 01/11] [libcalamares] Distinguish "install" and "setup" modes. - This initial bit of code re-uses the *dont-chroot* setting; it may need to be made independent. - This branch will use `isSetupMode()` to adjust user-visible strings to match the intended use. SEE #1100 --- src/libcalamares/Settings.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/libcalamares/Settings.h b/src/libcalamares/Settings.h index 4d7568c7d..c72e30421 100644 --- a/src/libcalamares/Settings.h +++ b/src/libcalamares/Settings.h @@ -57,6 +57,15 @@ public: bool debugMode() const; bool doChroot() const; + /** @brief Distinguish between "install" and "setup" modes. + * + * This influences user-visible strings, for instance using the + * word "setup" instead of "install" where relevant. + * + * NOTE: it's a synonym for !doChroot() for now, but may become + * an independent setting. + */ + bool isSetupMode() const { return !doChroot(); } bool disableCancel() const; From 8ee2375ee69b372da816e0c442616c16431398fd Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Mon, 1 Apr 2019 05:54:35 -0400 Subject: [PATCH 02/11] [welcome] Adjust welcome message to setup-mode --- src/modules/welcome/WelcomePage.cpp | 21 ++++++++++--- .../welcome/checker/ResultsListWidget.cpp | 31 +++++++++++++------ 2 files changed, 38 insertions(+), 14 deletions(-) diff --git a/src/modules/welcome/WelcomePage.cpp b/src/modules/welcome/WelcomePage.cpp index 9260f27a3..7d86567d7 100644 --- a/src/modules/welcome/WelcomePage.cpp +++ b/src/modules/welcome/WelcomePage.cpp @@ -28,6 +28,7 @@ #include "utils/Retranslator.h" #include "modulesystem/ModuleManager.h" +#include "Settings.h" #include "ViewManager.h" #include @@ -62,8 +63,18 @@ WelcomePage::WelcomePage( QWidget* parent ) << *Calamares::Branding::VersionedName; CALAMARES_RETRANSLATE( - ui->mainText->setText( (Calamares::Branding::instance()->welcomeStyleCalamares() ? tr( "

Welcome to the Calamares installer for %1.

" ) : tr( "

Welcome to the %1 installer.

" )) - .arg( *Calamares::Branding::VersionedName ) ); + QString message; + + if ( Calamares::Settings::instance()->isSetupMode() ) + message = Calamares::Branding::instance()->welcomeStyleCalamares() + ? tr( "

Welcome to the Calamares setup program for %1.

" ) + : tr( "

Welcome to %1 setup.

" ); + else + message = Calamares::Branding::instance()->welcomeStyleCalamares() + ? tr( "

Welcome to the Calamares installer for %1.

" ) + : tr( "

Welcome to the %1 installer.

" ); + + ui->mainText->setText( message.arg( *Calamares::Branding::VersionedName ) ); ui->retranslateUi( this ); ) @@ -74,9 +85,11 @@ WelcomePage::WelcomePage( QWidget* parent ) connect( ui->aboutButton, &QPushButton::clicked, this, [ this ] { + QString title = Calamares::Settings::instance()->isSetupMode() + ? tr( "About %1 setup" ) + : tr( "About %1 installer" ); QMessageBox mb( QMessageBox::Information, - tr( "About %1 installer" ) - .arg( CALAMARES_APPLICATION_NAME ), + title.arg( CALAMARES_APPLICATION_NAME ), tr( "

%1


" "%2
" diff --git a/src/modules/welcome/checker/ResultsListWidget.cpp b/src/modules/welcome/checker/ResultsListWidget.cpp index 5908e4bf5..9c3e3f0cd 100644 --- a/src/modules/welcome/checker/ResultsListWidget.cpp +++ b/src/modules/welcome/checker/ResultsListWidget.cpp @@ -22,6 +22,7 @@ #include "ResultWidget.h" #include "Branding.h" +#include "Settings.h" #include "utils/CalamaresUtilsGui.h" #include "utils/Retranslator.h" #include "widgets/FixedAspectRatioLabel.h" @@ -91,11 +92,16 @@ ResultsListWidget::init( const Calamares::RequirementsList& checkEntries ) if ( !requirementsSatisfied ) { CALAMARES_RETRANSLATE( - textLabel->setText( tr( "This computer does not satisfy the minimum " - "requirements for installing %1.
" - "Installation cannot continue. " - "Details..." ) - .arg( *Calamares::Branding::ShortVersionedName ) ); + QString message = Calamares::Settings::instance()->isSetupMode() + ? tr( "This computer does not satisfy the minimum " + "requirements for setting up %1.
" + "Setup cannot continue. " + "Details..." ) + : tr( "This computer does not satisfy the minimum " + "requirements for installing %1.
" + "Installation cannot continue. " + "Details..." ); + textLabel->setText( message.arg( *Calamares::Branding::ShortVersionedName ) ); ) textLabel->setOpenExternalLinks( false ); connect( textLabel, &QLabel::linkActivated, @@ -108,11 +114,16 @@ ResultsListWidget::init( const Calamares::RequirementsList& checkEntries ) else { CALAMARES_RETRANSLATE( - textLabel->setText( tr( "This computer does not satisfy some of the " - "recommended requirements for installing %1.
" - "Installation can continue, but some features " - "might be disabled." ) - .arg( *Calamares::Branding::ShortVersionedName ) ); + QString message = Calamares::Settings::instance()->isSetupMode() + ? tr( "This computer does not satisfy some of the " + "recommended requirements for setting up %1.
" + "Setup can continue, but some features " + "might be disabled." ) + : tr( "This computer does not satisfy some of the " + "recommended requirements for installing %1.
" + "Installation can continue, but some features " + "might be disabled." ); + textLabel->setText( message.arg( *Calamares::Branding::ShortVersionedName ) ); ) } } From 3a0bd254c044f6053d31ea84ed872791ce436ba7 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Mon, 1 Apr 2019 06:16:13 -0400 Subject: [PATCH 03/11] [libcalamaresui] Adjust quit-messages to setup-mode --- src/libcalamaresui/ViewManager.cpp | 65 +++++++++++++++++++++++------- 1 file changed, 50 insertions(+), 15 deletions(-) diff --git a/src/libcalamaresui/ViewManager.cpp b/src/libcalamaresui/ViewManager.cpp index e222707ac..f9a7c9e06 100644 --- a/src/libcalamaresui/ViewManager.cpp +++ b/src/libcalamaresui/ViewManager.cpp @@ -74,7 +74,10 @@ ViewManager::ViewManager( QObject* parent ) m_back->setText( tr( "&Back" ) ); m_next->setText( tr( "&Next" ) ); 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; @@ -159,10 +162,13 @@ ViewManager::onInstallationFailed( const QString& message, const QString& detail cDebug() << "- message:" << message; cDebug() << "- details:" << details; + QString heading = Calamares::Settings::instance()->isSetupMode() + ? tr( "Setup Failed" ) + : tr( "Installation Failed" ); QMessageBox* msgBox = new QMessageBox(); msgBox->setIcon( QMessageBox::Critical ); msgBox->setWindowTitle( tr( "Error" ) ); - msgBox->setText( "" + tr( "Installation Failed" ) + "" ); + msgBox->setText( "" + heading + "" ); msgBox->setStandardButtons( QMessageBox::Close ); msgBox->button( QMessageBox::Close )->setText( tr( "&Close" ) ); @@ -180,6 +186,8 @@ ViewManager::onInstallationFailed( const QString& message, const QString& detail void 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 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; @@ -236,15 +244,25 @@ ViewManager::next() // Depending on Calamares::Settings, we show an "are you sure" prompt or not. 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.
You will not be able " + "to undo these changes." ) + : tr( "The %1 installer is about to make changes to your " + "disk in order to install %2.
You will not be able " + "to undo these changes." ); + QString confirm = Calamares::Settings::instance()->isSetupMode() + ? tr( "&Set up now" ) + : tr( "&Install now" ); + int reply = QMessageBox::question( m_widget, - tr( "Continue with setup?" ), - tr( "The %1 installer is about to make changes to your " - "disk in order to install %2.
You will not be able " - "to undo these changes." ) - .arg( *Calamares::Branding::ShortProductName ) - .arg( *Calamares::Branding::ShortVersionedName ), - tr( "&Install now" ), + title, + question.arg( *Calamares::Branding::ShortProductName, *Calamares::Branding::ShortVersionedName ), + confirm, tr( "Go &back" ), QString(), 0, @@ -277,15 +295,25 @@ ViewManager::next() void 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 ) ) - m_next->setText( tr( "&Install" ) ); + m_next->setText( next ); else m_next->setText( tr( "&Next" ) ); if ( m_currentStep == m_steps.count() -1 && m_steps.last()->isAtEnd() ) { 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()) m_quit->setVisible( true ); } @@ -294,7 +322,7 @@ ViewManager::updateButtonLabels() if (Calamares::Settings::instance()->disableCancel()) m_quit->setVisible( false ); 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 && 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, - tr( "Cancel installation?" ), - tr( "Do you really want to cancel the current install process?\n" - "The installer will quit and all changes will be lost." ), + title, + question, QMessageBox::Yes | QMessageBox::No, m_widget ); mb.setDefaultButton( QMessageBox::No ); From 3248aba8995d0cb0aa455b1214f9645bd9814850 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Mon, 1 Apr 2019 06:26:42 -0400 Subject: [PATCH 04/11] [libcalamares] Make oem-setup independent of dont-chroot - At least for testing purposes it makes sense to decouple dont-chroot from the OEM-setup wording, so introduce a separate setting for it. --- src/libcalamares/Settings.cpp | 5 +++-- src/libcalamares/Settings.h | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/libcalamares/Settings.cpp b/src/libcalamares/Settings.cpp index 9bedbbe41..9004cd8a2 100644 --- a/src/libcalamares/Settings.cpp +++ b/src/libcalamares/Settings.cpp @@ -35,7 +35,7 @@ hasValue( const YAML::Node& v ) return v.IsDefined() && !v.IsNull(); } -/** Helper function to grab a QString out of the config, and to warn if not present. */ +/** @brief Helper function to grab a QString out of the config, and to warn if not present. */ static QString requireString( const YAML::Node& config, const char* key ) { @@ -49,7 +49,7 @@ requireString( const YAML::Node& config, const char* key ) } } -/** Helper function to grab a bool out of the config, and to warn if not present. */ +/** @brief Helper function to grab a bool out of the config, and to warn if not present. */ static bool requireBool( const YAML::Node& config, const char* key, bool d ) { @@ -207,6 +207,7 @@ Settings::Settings( const QString& settingsFilePath, m_brandingComponentName = requireString( config, "branding" ); m_promptInstall = requireBool( config, "prompt-install", false ); m_doChroot = !requireBool( config, "dont-chroot", false ); + m_isSetupMode = requireBool( config, "oem-setup", !m_doChroot ); m_disableCancel = requireBool( config, "disable-cancel", false ); } catch ( YAML::Exception& e ) diff --git a/src/libcalamares/Settings.h b/src/libcalamares/Settings.h index c72e30421..0c0f0aa91 100644 --- a/src/libcalamares/Settings.h +++ b/src/libcalamares/Settings.h @@ -65,7 +65,7 @@ public: * NOTE: it's a synonym for !doChroot() for now, but may become * an independent setting. */ - bool isSetupMode() const { return !doChroot(); } + bool isSetupMode() const { return m_isSetupMode; } bool disableCancel() const; @@ -81,6 +81,7 @@ private: bool m_debug; bool m_doChroot; + bool m_isSetupMode; bool m_promptInstall; bool m_disableCancel; }; From c813ee94956fadc2c17dbaf28ce4539ac74d3170 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Mon, 1 Apr 2019 06:27:23 -0400 Subject: [PATCH 05/11] Settings: add an oem-setup entry - Add independent oem-setup entry to the example configuration. - Document that things may have a default value (so you don't **have** to set them in the file) but that Calamares will complain. --- settings.conf | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/settings.conf b/settings.conf index 2be482d44..8135ef3db 100644 --- a/settings.conf +++ b/settings.conf @@ -128,7 +128,8 @@ branding: default # If this is set to true, Calamares will show an "Are you sure?" prompt right # before each execution phase, i.e. at points of no return. If this is set to -# false, no prompt is shown. Default is false. +# false, no prompt is shown. Default is false, but Calamares will complain if +# this is not explicitly set. # # YAML: boolean. prompt-install: false @@ -142,16 +143,23 @@ prompt-install: false # setting. (e.g. partitioning seems like a bad idea, since that is expected to # have been done already) # -# Default is false (for a normal installer). +# Default is false (for a normal installer), but Calamares will complain if +# this is not explicitly set. # # YAML: boolean. dont-chroot: false +# If this is set to true, Calamares refers to itself as a "setup program" +# rather than an "installer". Defaults to the value of dont-chroot, but +# Calamares will complain if this is not explicitly set. +# oem-setup: true + # If this is set to true, the "Cancel" button will be disabled. -# This can be useful if when e.g. calamares is used as a post-install configuration -# tool and you require the user to go through all the configuration steps. +# This can be useful if when e.g. Calamares is used as a post-install +# configuration tool and you require the user to go through all the +# configuration steps. # -# Default is false. +# Default is false, but Calamares will complain if this is not explicitly set. # # YAML: boolean. disable-cancel: false From cbf7f4fb17c67bd400191eed05c35a31794c0d5a Mon Sep 17 00:00:00 2001 From: Arnaud Ferraris Date: Mon, 8 Apr 2019 13:41:21 +0200 Subject: [PATCH 06/11] [calamares] Adjust window title for setup mode Signed-off-by: Arnaud Ferraris --- src/calamares/CalamaresWindow.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/calamares/CalamaresWindow.cpp b/src/calamares/CalamaresWindow.cpp index 7e619a7be..e11990600 100644 --- a/src/calamares/CalamaresWindow.cpp +++ b/src/calamares/CalamaresWindow.cpp @@ -2,6 +2,7 @@ * * Copyright 2014-2015, Teo Mrnjavac * Copyright 2017-2018, Adriaan de Groot + * Copyright 2019, Collabora Ltd * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -53,8 +54,10 @@ CalamaresWindow::CalamaresWindow( QWidget* parent ) , m_viewManager( nullptr ) { CALAMARES_RETRANSLATE( - setWindowTitle( tr( "%1 Installer" ) - .arg( *Calamares::Branding::ProductName ) ); + setWindowTitle( Calamares::Settings::instance()->isSetupMode() + ? tr( "%1 Setup Program" ).arg( *Calamares::Branding::ProductName ) + : tr( "%1 Installer" ).arg( *Calamares::Branding::ProductName ) + ); ) const Calamares::Branding* const branding = Calamares::Branding::instance(); From 866afcfe47da23b455cc24c1017b85b843b37828 Mon Sep 17 00:00:00 2001 From: Arnaud Ferraris Date: Mon, 8 Apr 2019 13:42:15 +0200 Subject: [PATCH 07/11] [welcome] Adjust checker-messages for setup mode Signed-off-by: Arnaud Ferraris --- src/modules/welcome/checker/GeneralRequirements.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/modules/welcome/checker/GeneralRequirements.cpp b/src/modules/welcome/checker/GeneralRequirements.cpp index 07d99d707..dd43baafd 100644 --- a/src/modules/welcome/checker/GeneralRequirements.cpp +++ b/src/modules/welcome/checker/GeneralRequirements.cpp @@ -3,6 +3,7 @@ * Copyright 2014-2017, Teo Mrnjavac * Copyright 2017-2018, Adriaan de Groot * Copyright 2017, Gabriel Craciunescu + * Copyright 2019, Collabora Ltd * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -30,7 +31,7 @@ #include "utils/Retranslator.h" #include "utils/CalamaresUtilsSystem.h" #include "utils/Units.h" - +#include "Settings.h" #include "JobQueue.h" #include "GlobalStorage.h" @@ -141,7 +142,9 @@ Calamares::RequirementsList GeneralRequirements::checkRequirements() checkEntries.append( { entry, [this]{ return QString(); }, //we hide it - [this]{ return tr( "The installer is not running with administrator rights." ); }, + [this]{ return Calamares::Settings::instance()->isSetupMode() + ? tr( "The setup program is not running with administrator rights." ) + : tr( "The installer is not running with administrator rights." ); }, isRoot, m_entriesToRequire.contains( entry ) } ); @@ -149,7 +152,9 @@ Calamares::RequirementsList GeneralRequirements::checkRequirements() checkEntries.append( { entry, [this]{ return QString(); }, // we hide it - [this]{ return tr( "The screen is too small to display the installer." ); }, + [this]{ return Calamares::Settings::instance()->isSetupMode() + ? tr( "The screen is too small to display the setup program." ) + : tr( "The screen is too small to display the installer." ); }, enoughScreen, false } ); From 9b77e5b17d88a11ddb9b9d17ada5fb31b1420481 Mon Sep 17 00:00:00 2001 From: Arnaud Ferraris Date: Mon, 8 Apr 2019 13:43:38 +0200 Subject: [PATCH 08/11] [summary] Adjust summary text to setup mode Signed-off-by: Arnaud Ferraris --- src/modules/summary/SummaryPage.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/modules/summary/SummaryPage.cpp b/src/modules/summary/SummaryPage.cpp index de68b1211..bddfe9dcc 100644 --- a/src/modules/summary/SummaryPage.cpp +++ b/src/modules/summary/SummaryPage.cpp @@ -2,6 +2,7 @@ * * Copyright 2014-2015, Teo Mrnjavac * Copyright 2017, Adriaan de Groot + * Copyright 2019, Collabora Ltd * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -25,6 +26,7 @@ #include "utils/Retranslator.h" #include "utils/CalamaresUtilsGui.h" #include "utils/Logger.h" +#include "Settings.h" #include "ViewManager.h" #include @@ -46,8 +48,12 @@ SummaryPage::SummaryPage( const SummaryViewStep* thisViewStep, QWidget* parent ) QLabel* headerLabel = new QLabel( this ); CALAMARES_RETRANSLATE( - headerLabel->setText( tr( "This is an overview of what will happen once you start " - "the install procedure." ) ); + if ( Calamares::Settings::instance()->isSetupMode() ) + headerLabel->setText( tr( "This is an overview of what will happen once you start " + "the setup procedure." ) ); + else + headerLabel->setText( tr( "This is an overview of what will happen once you start " + "the install procedure." ) ); ) layout->addWidget( headerLabel ); layout->addWidget( m_scrollArea ); From e3cebd9da90da882cc5ab3da921795ca187336d7 Mon Sep 17 00:00:00 2001 From: Arnaud Ferraris Date: Mon, 8 Apr 2019 13:44:41 +0200 Subject: [PATCH 09/11] [plasmalnf] Adjust explanation message to setup mode Signed-off-by: Arnaud Ferraris --- src/modules/plasmalnf/PlasmaLnfPage.cpp | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/modules/plasmalnf/PlasmaLnfPage.cpp b/src/modules/plasmalnf/PlasmaLnfPage.cpp index df55cb3a4..7e2ef8aa6 100644 --- a/src/modules/plasmalnf/PlasmaLnfPage.cpp +++ b/src/modules/plasmalnf/PlasmaLnfPage.cpp @@ -1,6 +1,7 @@ /* === This file is part of Calamares - === * * Copyright 2017-2018, Adriaan de Groot + * Copyright 2019, Collabora Ltd * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -22,6 +23,7 @@ #include "utils/Logger.h" #include "utils/Retranslator.h" +#include "Settings.h" #include @@ -64,11 +66,18 @@ PlasmaLnfPage::PlasmaLnfPage( QWidget* parent ) CALAMARES_RETRANSLATE( { ui->retranslateUi( this ); - ui->generalExplanation->setText( tr( - "Please choose a look-and-feel for the KDE Plasma Desktop. " - "You can also skip this step and configure the look-and-feel " - "once the system is installed. Clicking on a look-and-feel " - "selection will give you a live preview of that look-and-feel.") ); + if ( Calamares::Settings::instance()->isSetupMode() ) + ui->generalExplanation->setText( tr( + "Please choose a look-and-feel for the KDE Plasma Desktop. " + "You can also skip this step and configure the look-and-feel " + "once the system is set up. Clicking on a look-and-feel " + "selection will give you a live preview of that look-and-feel.") ); + else + ui->generalExplanation->setText( tr( + "Please choose a look-and-feel for the KDE Plasma Desktop. " + "You can also skip this step and configure the look-and-feel " + "once the system is installed. Clicking on a look-and-feel " + "selection will give you a live preview of that look-and-feel.") ); updateThemeNames(); fillUi(); } From dddebc98b5a5a77467890cfc9811fa45d86260ab Mon Sep 17 00:00:00 2001 From: Arnaud Ferraris Date: Mon, 8 Apr 2019 17:55:03 +0200 Subject: [PATCH 10/11] [finished] Adjust messages to setup mode Signed-off-by: Arnaud Ferraris --- src/modules/finished/FinishedPage.cpp | 53 ++++++++++++++++++----- src/modules/finished/FinishedPage.ui | 2 +- src/modules/finished/FinishedViewStep.cpp | 10 ++++- 3 files changed, 50 insertions(+), 15 deletions(-) diff --git a/src/modules/finished/FinishedPage.cpp b/src/modules/finished/FinishedPage.cpp index ef3b0745e..856742ae6 100644 --- a/src/modules/finished/FinishedPage.cpp +++ b/src/modules/finished/FinishedPage.cpp @@ -2,6 +2,7 @@ * * Copyright 2014-2015, Teo Mrnjavac * Copyright 2017-2018, Adriaan de Groot + * Copyright 2019, Collabora Ltd * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -33,7 +34,7 @@ #include #include "Branding.h" - +#include "Settings.h" FinishedPage::FinishedPage( QWidget* parent ) : QWidget( parent ) @@ -48,12 +49,33 @@ FinishedPage::FinishedPage( QWidget* parent ) CALAMARES_RETRANSLATE( ui->retranslateUi( this ); - ui->mainText->setText( tr( "

All done.


" - "%1 has been installed on your computer.
" - "You may now restart into your new system, or continue " - "using the %2 Live environment." ) - .arg( *Calamares::Branding::VersionedName ) - .arg( *Calamares::Branding::ProductName ) ); + if ( Calamares::Settings::instance()->isSetupMode() ) + { + ui->mainText->setText( tr( "

All done.


" + "%1 has been set up on your computer.
" + "You may now start using your new system." ) + .arg( *Calamares::Branding::VersionedName ) + .arg( *Calamares::Branding::ProductName ) ); + ui->restartCheckBox->setToolTip( tr ( "" + "

When this box is checked, your system will " + "restart immediately when you click on " + "Done " + "or close the setup program.

" ) ); + } + else + { + ui->mainText->setText( tr( "

All done.


" + "%1 has been installed on your computer.
" + "You may now restart into your new system, or continue " + "using the %2 Live environment." ) + .arg( *Calamares::Branding::VersionedName ) + .arg( *Calamares::Branding::ProductName ) ); + ui->restartCheckBox->setToolTip( tr ( "" + "

When this box is checked, your system will " + "restart immediately when you click on " + "Done " + "or close the installer.

" ) ); + } ) } @@ -106,10 +128,17 @@ void FinishedPage::onInstallationFailed( const QString& message, const QString& details ) { Q_UNUSED( details ); - ui->mainText->setText( tr( "

Installation Failed


" - "%1 has not been installed on your computer.
" - "The error message was: %2." ) - .arg( *Calamares::Branding::VersionedName ) - .arg( message ) ); + if ( Calamares::Settings::instance()->isSetupMode() ) + ui->mainText->setText( tr( "

Setup Failed


" + "%1 has not been set up on your computer.
" + "The error message was: %2." ) + .arg( *Calamares::Branding::VersionedName ) + .arg( message ) ); + else + ui->mainText->setText( tr( "

Installation Failed


" + "%1 has not been installed on your computer.
" + "The error message was: %2." ) + .arg( *Calamares::Branding::VersionedName ) + .arg( message ) ); setRestartNowEnabled( false ); } diff --git a/src/modules/finished/FinishedPage.ui b/src/modules/finished/FinishedPage.ui index 8da5aad67..adb99b5b3 100644 --- a/src/modules/finished/FinishedPage.ui +++ b/src/modules/finished/FinishedPage.ui @@ -92,7 +92,7 @@ - <html><head/><body><p>When this box is checked, your system will restart immediately when you click on <span style=" font-style:italic;">Done</span> or close the installer.</p></body></html> + <Restart checkbox tooltip> &Restart now diff --git a/src/modules/finished/FinishedViewStep.cpp b/src/modules/finished/FinishedViewStep.cpp index 8457aa4cd..721df9765 100644 --- a/src/modules/finished/FinishedViewStep.cpp +++ b/src/modules/finished/FinishedViewStep.cpp @@ -2,6 +2,7 @@ * * Copyright 2014-2015, Teo Mrnjavac * Copyright 2017, Adriaan de Groot + * Copyright 2019, Collabora Ltd * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -29,6 +30,7 @@ #include #include "Branding.h" +#include "Settings.h" FinishedViewStep::FinishedViewStep( QObject* parent ) : Calamares::ViewStep( parent ) @@ -109,8 +111,12 @@ FinishedViewStep::sendNotification() QString( "Calamares" ), QVariant( 0U ), QString( "calamares" ), - tr( "Installation Complete" ), - tr( "The installation of %1 is complete." ).arg( *Calamares::Branding::VersionedName ), + Calamares::Settings::instance()->isSetupMode() + ? tr( "Setup Complete" ) + : tr( "Installation Complete" ), + Calamares::Settings::instance()->isSetupMode() + ? tr( "The setup of %1 is complete." ).arg( *Calamares::Branding::VersionedName ) + : tr( "The installation of %1 is complete." ).arg( *Calamares::Branding::VersionedName ), QStringList(), QVariantMap(), QVariant( 0 ) From 6463e5f83ccf85c78c5faefc23978681c91e46bc Mon Sep 17 00:00:00 2001 From: Arnaud Ferraris Date: Mon, 8 Apr 2019 18:02:23 +0200 Subject: [PATCH 11/11] [users] Adjust messages to setup mode Signed-off-by: Arnaud Ferraris --- src/modules/users/UsersPage.cpp | 18 +++++++++++++++++- src/modules/users/page_usersetup.ui | 2 +- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/modules/users/UsersPage.cpp b/src/modules/users/UsersPage.cpp index 00e15b69d..834287bcd 100644 --- a/src/modules/users/UsersPage.cpp +++ b/src/modules/users/UsersPage.cpp @@ -2,6 +2,7 @@ * * Copyright 2014-2017, Teo Mrnjavac * Copyright 2017-2018, Adriaan de Groot + * Copyright 2019, Collabora Ltd * * Portions from the Manjaro Installation Framework * by Roland Singer @@ -31,6 +32,7 @@ #include "utils/Logger.h" #include "utils/CalamaresUtilsGui.h" #include "utils/Retranslator.h" +#include "Settings.h" #include #include @@ -106,7 +108,21 @@ UsersPage::UsersPage( QWidget* parent ) ui->hostname_extra_label_2->setMaximumWidth( 3 * boxWidth ); ui->password_extra_label_3->setMaximumWidth( 3 * boxWidth ); - CALAMARES_RETRANSLATE( ui->retranslateUi( this ); ) + CALAMARES_RETRANSLATE( + ui->retranslateUi( this ); + if ( Calamares::Settings::instance()->isSetupMode() ) + { + ui->username_extra_label_2->setText( tr( "If more than one person will " + "use this computer, you can create multiple " + "accounts after setup." ) ); + } + else + { + ui->username_extra_label_2->setText( tr( "If more than one person will " + "use this computer, you can create multiple " + "accounts after installation." ) ); + } + ) } diff --git a/src/modules/users/page_usersetup.ui b/src/modules/users/page_usersetup.ui index 650c568fa..ccd0e37fa 100644 --- a/src/modules/users/page_usersetup.ui +++ b/src/modules/users/page_usersetup.ui @@ -197,7 +197,7 @@ font-weight: normal - <small>If more than one person will use this computer, you can set up multiple accounts after installation.</small> + <Username extra label 2 text> true