From 6e8779cbce44e282f3f9d8de09bd75a3b37495ae Mon Sep 17 00:00:00 2001 From: dalto Date: Sat, 4 Dec 2021 08:53:15 -0600 Subject: [PATCH 01/45] [mount] Ensure path is available when creating nested btrfs subvolumes --- src/modules/mount/main.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/modules/mount/main.py b/src/modules/mount/main.py index f186b0d26..a3318d1a0 100644 --- a/src/modules/mount/main.py +++ b/src/modules/mount/main.py @@ -193,6 +193,7 @@ def mount_partition(root_mount_point, partition, partitions): for s in btrfs_subvolumes: if not s["subvolume"]: continue + os.makedirs(root_mount_point + os.path.dirname(s["subvolume"]), exist_ok=True) subprocess.check_call(["btrfs", "subvolume", "create", root_mount_point + s["subvolume"]]) if s["mountPoint"] == "/": From 6bf0da7230260ddcf3f6afd6ec5820da87bb466c Mon Sep 17 00:00:00 2001 From: Artem Grinev Date: Sun, 5 Dec 2021 04:50:13 +0400 Subject: [PATCH 02/45] [libcalamaresui] Initial rework of error dialog --- src/libcalamaresui/CMakeLists.txt | 3 + src/libcalamaresui/ViewManager.cpp | 47 ++----- .../utils/ErrorDialog/ErrorDialog.cpp | 89 +++++++++++++ .../utils/ErrorDialog/ErrorDialog.h | 57 +++++++++ .../utils/ErrorDialog/ErrorDialog.ui | 120 ++++++++++++++++++ 5 files changed, 282 insertions(+), 34 deletions(-) create mode 100644 src/libcalamaresui/utils/ErrorDialog/ErrorDialog.cpp create mode 100644 src/libcalamaresui/utils/ErrorDialog/ErrorDialog.h create mode 100644 src/libcalamaresui/utils/ErrorDialog/ErrorDialog.ui diff --git a/src/libcalamaresui/CMakeLists.txt b/src/libcalamaresui/CMakeLists.txt index a704b7484..e745681f3 100644 --- a/src/libcalamaresui/CMakeLists.txt +++ b/src/libcalamaresui/CMakeLists.txt @@ -20,6 +20,7 @@ set( calamaresui_SOURCES utils/CalamaresUtilsGui.cpp utils/ImageRegistry.cpp utils/Paste.cpp + utils/ErrorDialog/ErrorDialog.cpp viewpages/BlankViewStep.cpp viewpages/ExecutionViewStep.cpp @@ -75,6 +76,8 @@ calamares_add_library( calamaresui Qt5::Svg RESOURCES libcalamaresui.qrc EXPORT Calamares + UI + utils/ErrorDialog/ErrorDialog.ui VERSION ${CALAMARES_VERSION_SHORT} ) target_link_libraries( calamaresui PRIVATE yamlcpp::yamlcpp ) diff --git a/src/libcalamaresui/ViewManager.cpp b/src/libcalamaresui/ViewManager.cpp index 57570ad64..ee521a02c 100644 --- a/src/libcalamaresui/ViewManager.cpp +++ b/src/libcalamaresui/ViewManager.cpp @@ -25,6 +25,7 @@ #include "viewpages/ExecutionViewStep.h" #include "viewpages/ViewStep.h" #include "widgets/TranslationFix.h" +#include "utils/ErrorDialog/ErrorDialog.h" #include #include @@ -32,6 +33,7 @@ #include #include #include +#include #define UPDATE_BUTTON_PROPERTY( name, value ) \ do \ @@ -159,44 +161,21 @@ ViewManager::onInstallationFailed( const QString& message, const QString& detail cDebug() << Logger::SubEntry << "- details:" << Logger::NoQuote << details; QString heading - = Calamares::Settings::instance()->isSetupMode() ? tr( "Setup Failed" ) : tr( "Installation Failed" ); - QString pasteMsg = tr( "Would you like to paste the install log to the web?" ); - QString text = "

" + message + "

"; - if ( !details.isEmpty() ) - { - text += "

" - + CalamaresUtils::truncateMultiLine( details, CalamaresUtils::LinesStartEnd { 6, 2 } ) - .replace( '\n', QStringLiteral( "
" ) ) - + "

"; - } - if ( shouldOfferWebPaste ) - { - text += "

" + pasteMsg + "

"; - } + = Calamares::Settings::instance()->isSetupMode() ? tr( "Setup Failed" ) : tr( "Installation Failed" ); - QMessageBox* msgBox = new QMessageBox(); - msgBox->setIcon( QMessageBox::Critical ); - msgBox->setWindowTitle( tr( "Error" ) ); - msgBox->setText( "" + heading + "" ); - msgBox->setInformativeText( text ); - if ( shouldOfferWebPaste ) - { - msgBox->setStandardButtons( QMessageBox::Yes | QMessageBox::No ); - msgBox->setDefaultButton( QMessageBox::No ); - } - else - { - msgBox->setStandardButtons( QMessageBox::Close ); - msgBox->setDefaultButton( QMessageBox::Close ); - } - Calamares::fixButtonLabels( msgBox ); - msgBox->show(); + ErrorDialog* errorDialog = new ErrorDialog(); + errorDialog->setWindowTitle( tr( "Error" ) ); + errorDialog->setHeading( "" + heading + "" ); + errorDialog->setInformativeText( message ); + errorDialog->setShouldOfferWebPaste(shouldOfferWebPaste); + errorDialog->setDetails(details); + errorDialog->show(); cDebug() << "Calamares will quit when the dialog closes."; - connect( msgBox, &QMessageBox::buttonClicked, [msgBox]( QAbstractButton* button ) { - if ( msgBox->buttonRole( button ) == QMessageBox::ButtonRole::YesRole ) + connect( errorDialog, &QDialog::finished, [errorDialog]( int result ) { + if ( result == QDialog::Accepted && errorDialog->shouldOfferWebPaste() ) { - CalamaresUtils::Paste::doLogUploadUI( msgBox ); + CalamaresUtils::Paste::doLogUploadUI( errorDialog ); } QApplication::quit(); } ); diff --git a/src/libcalamaresui/utils/ErrorDialog/ErrorDialog.cpp b/src/libcalamaresui/utils/ErrorDialog/ErrorDialog.cpp new file mode 100644 index 000000000..080ff2115 --- /dev/null +++ b/src/libcalamaresui/utils/ErrorDialog/ErrorDialog.cpp @@ -0,0 +1,89 @@ +#include "ErrorDialog.h" +#include "ui_ErrorDialog.h" + +#include +#include + +namespace Calamares { + + +ErrorDialog::ErrorDialog(QWidget *parent) : + QDialog(parent), + ui(new Ui::ErrorDialog) +{ + ui->setupUi(this); + ui->iconLabel->setPixmap(QIcon::fromTheme("dialog-error").pixmap(64)); + ui->detailsWidget->hide(); + ui->offerWebPasteLabel->hide(); +} + +ErrorDialog::~ErrorDialog() +{ + delete ui; +} + + +QString ErrorDialog::heading() const +{ + return ui->headingLabel->text(); +} + +QString ErrorDialog::informativeText() const +{ + return ui->informativeTextLabel->text(); +} + +QString ErrorDialog::details() const +{ + return ui->detailsBrowser->toPlainText(); +} + +void ErrorDialog::setHeading(const QString &newHeading) +{ + if (ui->headingLabel->text() == newHeading) + return; + ui->headingLabel->setText(newHeading); + emit headingChanged(); +} + +void ErrorDialog::setInformativeText(const QString &newInformativeText) +{ + if (ui->informativeTextLabel->text() == newInformativeText) + return; + ui->informativeTextLabel->setText(newInformativeText); + emit informativeTextChanged(); +} + +void ErrorDialog::setDetails(const QString &newDetails) +{ + if (ui->detailsBrowser->toPlainText() == newDetails) + return; + ui->detailsBrowser->setPlainText(newDetails); + + ui->detailsWidget->setVisible(!ui->detailsBrowser->toPlainText().trimmed().isEmpty()); + + emit detailsChanged(); +} + +bool ErrorDialog::shouldOfferWebPaste() const +{ + return m_shouldOfferWebPaste; +} + +void ErrorDialog::setShouldOfferWebPaste(bool newShouldOfferWebPaste) +{ + if (m_shouldOfferWebPaste == newShouldOfferWebPaste) + return; + m_shouldOfferWebPaste = newShouldOfferWebPaste; + + ui->offerWebPasteLabel->setVisible(m_shouldOfferWebPaste); + + ui->buttonBox->setStandardButtons( m_shouldOfferWebPaste + ? (QDialogButtonBox::Yes | QDialogButtonBox::No) + : QDialogButtonBox::Close ); + + + emit shouldOfferWebPasteChanged(); +} + +} // namespace Calamares diff --git a/src/libcalamaresui/utils/ErrorDialog/ErrorDialog.h b/src/libcalamaresui/utils/ErrorDialog/ErrorDialog.h new file mode 100644 index 000000000..8962c3e99 --- /dev/null +++ b/src/libcalamaresui/utils/ErrorDialog/ErrorDialog.h @@ -0,0 +1,57 @@ +#ifndef ERRORDIALOG_H +#define ERRORDIALOG_H + +#include + + +namespace Ui { +class ErrorDialog; +} +class QDialogButtonBox; +namespace Calamares +{ +class ErrorDialog : public QDialog +{ + Q_OBJECT + + Q_PROPERTY(QString heading READ heading WRITE setHeading NOTIFY headingChanged) + Q_PROPERTY(QString informativeText READ informativeText WRITE setInformativeText NOTIFY informativeTextChanged) + Q_PROPERTY(QString details READ details WRITE setDetails NOTIFY detailsChanged) + Q_PROPERTY(bool shouldOfferWebPaste READ shouldOfferWebPaste WRITE setShouldOfferWebPaste NOTIFY shouldOfferWebPasteChanged) + +public: + explicit ErrorDialog(QWidget *parent = nullptr); + ~ErrorDialog(); + + QString heading() const; + + QString informativeText() const; + + QString details() const; + + void setHeading(const QString &newHeading); + + void setInformativeText(const QString &newInformativeText); + + void setDetails(const QString &newDetails); + + bool shouldOfferWebPaste() const; + void setShouldOfferWebPaste(bool newShouldOfferWebPaste); + +signals: + void headingChanged(); + + void informativeTextChanged(); + + void detailsChanged(); + + void shouldOfferWebPasteChanged(); + +private: + Ui::ErrorDialog *ui; + bool m_shouldOfferWebPaste; +}; + +}; // namespace Calamares + +#endif // ERRORDIALOG_H diff --git a/src/libcalamaresui/utils/ErrorDialog/ErrorDialog.ui b/src/libcalamaresui/utils/ErrorDialog/ErrorDialog.ui new file mode 100644 index 000000000..2632af617 --- /dev/null +++ b/src/libcalamaresui/utils/ErrorDialog/ErrorDialog.ui @@ -0,0 +1,120 @@ + + + ErrorDialog + + + + 0 + 0 + 425 + 262 + + + + Dialog + + + + + + + 0 + 0 + + + + + + + + + + + + + + Details: + + + + + + + + + + + + + + 0 + 0 + + + + + + + + + + + + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Close + + + + + + + Would you like to paste the install log to the web? + + + + + + + + + buttonBox + accepted() + ErrorDialog + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + ErrorDialog + reject() + + + 316 + 260 + + + 286 + 274 + + + + + From e8936392e373b6bc1ab93e5c3693152d388ff23c Mon Sep 17 00:00:00 2001 From: dalto Date: Sun, 5 Dec 2021 13:17:23 -0600 Subject: [PATCH 03/45] [luksopenswaphookcfg] Add support unlocking swap with root on a btrfs subvol --- src/modules/luksopenswaphookcfg/main.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/modules/luksopenswaphookcfg/main.py b/src/modules/luksopenswaphookcfg/main.py index ec09a631b..aaac8a31a 100644 --- a/src/modules/luksopenswaphookcfg/main.py +++ b/src/modules/luksopenswaphookcfg/main.py @@ -64,6 +64,11 @@ def write_openswap_conf(partitions, root_mount_point, openswap_conf_path): elif lines[i].startswith("keyfile_filename"): lines[i] = "keyfile_filename=crypto_keyfile.bin" + elif lines[i].startswith("#keyfile_device_mount_options"): + if libcalamares.globalstorage.contains("btrfsRootSubvolume"): + btrfs_root_subvolume = libcalamares.globalstorage.value("btrfsRootSubvolume") + lines[i] = "keyfile_device_mount_options=--options=subvol=" + btrfs_root_subvolume.lstrip("/") + with open(os.path.join(root_mount_point, openswap_conf_path), 'w') as openswap_file: openswap_file.write("\n".join(lines) + "\n") @@ -84,11 +89,11 @@ def run(): if not partitions: libcalamares.utils.warning("partitions is empty, {!s}".format(partitions)) return (_("Configuration Error"), - _("No partitions are defined for
{!s}
to use." ).format("luksopenswaphookcfg")) + _("No partitions are defined for
{!s}
to use.").format("luksopenswaphookcfg")) if not root_mount_point: libcalamares.utils.warning("rootMountPoint is empty, {!s}".format(root_mount_point)) return (_("Configuration Error"), - _("No root mount point is given for
{!s}
to use." ).format("luksopenswaphookcfg")) + _("No root mount point is given for
{!s}
to use.").format("luksopenswaphookcfg")) openswap_conf_path = openswap_conf_path.lstrip('/') From 32c5e18db0e75833e9ad599694edc0d040c9ae22 Mon Sep 17 00:00:00 2001 From: Artem Grinev Date: Mon, 6 Dec 2021 02:26:13 +0400 Subject: [PATCH 04/45] [libcalamaresui] Add QDialogButtonBox translation fix --- src/libcalamaresui/widgets/TranslationFix.cpp | 35 +++++++++++++------ src/libcalamaresui/widgets/TranslationFix.h | 3 ++ 2 files changed, 28 insertions(+), 10 deletions(-) diff --git a/src/libcalamaresui/widgets/TranslationFix.cpp b/src/libcalamaresui/widgets/TranslationFix.cpp index 1262fceb5..b73bd0e16 100644 --- a/src/libcalamaresui/widgets/TranslationFix.cpp +++ b/src/libcalamaresui/widgets/TranslationFix.cpp @@ -10,21 +10,16 @@ #include "TranslationFix.h" #include +#include #include #include +#include namespace Calamares { -void -fixButtonLabels( QMessageBox* box ) -{ - if ( !box ) - { - return; - } - - static std::pair< decltype( QMessageBox::Ok ), const char* > maps[] = { +//Using QMessageBox's StandardButton enum here but according to headers they should be kept in-sync between multiple classes. +static std::pair< decltype( QMessageBox::Ok ), const char* > maps[] = { { QMessageBox::Ok, QT_TRANSLATE_NOOP( "StandardButtons", "&OK" ) }, { QMessageBox::Yes, QT_TRANSLATE_NOOP( "StandardButtons", "&Yes" ) }, { QMessageBox::No, QT_TRANSLATE_NOOP( "StandardButtons", "&No" ) }, @@ -32,9 +27,17 @@ fixButtonLabels( QMessageBox* box ) { QMessageBox::Close, QT_TRANSLATE_NOOP( "StandardButtons", "&Close" ) }, }; +template +void fixButtonLabels ( TButtonBox* box ) +{ + if ( !box ) + { + return; + } + for ( auto [ sb, label ] : maps ) { - auto* button = box->button( sb ); + auto* button = box->button( static_cast(int(sb)) ); if ( button ) { button->setText( QCoreApplication::translate( "StandardButtons", label ) ); @@ -42,4 +45,16 @@ fixButtonLabels( QMessageBox* box ) } } +void +fixButtonLabels( QMessageBox* box ) +{ + fixButtonLabels(box); +} + +void +fixButtonLabels(QDialogButtonBox *box) +{ + fixButtonLabels(box); +} + } // namespace Calamares diff --git a/src/libcalamaresui/widgets/TranslationFix.h b/src/libcalamaresui/widgets/TranslationFix.h index 107dad67d..89ee9a51a 100644 --- a/src/libcalamaresui/widgets/TranslationFix.h +++ b/src/libcalamaresui/widgets/TranslationFix.h @@ -13,6 +13,7 @@ #include "DllMacro.h" class QMessageBox; +class QDialogButtonBox; namespace Calamares { @@ -26,6 +27,8 @@ namespace Calamares * guess the context. */ void UIDLLEXPORT fixButtonLabels( QMessageBox* ); + +void UIDLLEXPORT fixButtonLabels( QDialogButtonBox* ); } // namespace Calamares #endif From bfa7b9a7927b05ad2fcabc3ce460d640bc786d97 Mon Sep 17 00:00:00 2001 From: Artem Grinev Date: Mon, 6 Dec 2021 02:27:18 +0400 Subject: [PATCH 05/45] [libcalamaresui] Use translation fix for Error Dialog --- src/libcalamaresui/utils/ErrorDialog/ErrorDialog.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/libcalamaresui/utils/ErrorDialog/ErrorDialog.cpp b/src/libcalamaresui/utils/ErrorDialog/ErrorDialog.cpp index 080ff2115..29da42e4d 100644 --- a/src/libcalamaresui/utils/ErrorDialog/ErrorDialog.cpp +++ b/src/libcalamaresui/utils/ErrorDialog/ErrorDialog.cpp @@ -3,6 +3,7 @@ #include #include +#include "widgets/TranslationFix.h" namespace Calamares { @@ -81,7 +82,8 @@ void ErrorDialog::setShouldOfferWebPaste(bool newShouldOfferWebPaste) ui->buttonBox->setStandardButtons( m_shouldOfferWebPaste ? (QDialogButtonBox::Yes | QDialogButtonBox::No) : QDialogButtonBox::Close ); - + + fixButtonLabels(ui->buttonBox); emit shouldOfferWebPasteChanged(); } From 2dd77ee828f5df31460535abc85ef9c2489287d1 Mon Sep 17 00:00:00 2001 From: Artem Grinev Date: Mon, 6 Dec 2021 02:31:05 +0400 Subject: [PATCH 06/45] [libcalamaresui] Initialize Error Dialog field --- src/libcalamaresui/utils/ErrorDialog/ErrorDialog.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libcalamaresui/utils/ErrorDialog/ErrorDialog.h b/src/libcalamaresui/utils/ErrorDialog/ErrorDialog.h index 8962c3e99..4196f6a7f 100644 --- a/src/libcalamaresui/utils/ErrorDialog/ErrorDialog.h +++ b/src/libcalamaresui/utils/ErrorDialog/ErrorDialog.h @@ -49,7 +49,7 @@ signals: private: Ui::ErrorDialog *ui; - bool m_shouldOfferWebPaste; + bool m_shouldOfferWebPaste = false; }; }; // namespace Calamares From 2f2a418cc42fa6b9bf3e2c68ab5f569e06e21e32 Mon Sep 17 00:00:00 2001 From: Artem Grinev Date: Mon, 6 Dec 2021 02:37:11 +0400 Subject: [PATCH 07/45] [libcalamaresui] Run clang-format --- src/libcalamaresui/ViewManager.cpp | 27 +++--- .../utils/ErrorDialog/ErrorDialog.cpp | 86 ++++++++++--------- .../utils/ErrorDialog/ErrorDialog.h | 56 ++++++------ 3 files changed, 91 insertions(+), 78 deletions(-) diff --git a/src/libcalamaresui/ViewManager.cpp b/src/libcalamaresui/ViewManager.cpp index ee521a02c..87024ea6b 100644 --- a/src/libcalamaresui/ViewManager.cpp +++ b/src/libcalamaresui/ViewManager.cpp @@ -17,6 +17,7 @@ #include "JobQueue.h" #include "Settings.h" +#include "utils/ErrorDialog/ErrorDialog.h" #include "utils/Logger.h" #include "utils/Paste.h" #include "utils/Retranslator.h" @@ -25,15 +26,14 @@ #include "viewpages/ExecutionViewStep.h" #include "viewpages/ViewStep.h" #include "widgets/TranslationFix.h" -#include "utils/ErrorDialog/ErrorDialog.h" #include #include #include +#include #include #include #include -#include #define UPDATE_BUTTON_PROPERTY( name, value ) \ do \ @@ -161,24 +161,27 @@ ViewManager::onInstallationFailed( const QString& message, const QString& detail cDebug() << Logger::SubEntry << "- details:" << Logger::NoQuote << details; QString heading - = Calamares::Settings::instance()->isSetupMode() ? tr( "Setup Failed" ) : tr( "Installation Failed" ); + = Calamares::Settings::instance()->isSetupMode() ? tr( "Setup Failed" ) : tr( "Installation Failed" ); ErrorDialog* errorDialog = new ErrorDialog(); errorDialog->setWindowTitle( tr( "Error" ) ); errorDialog->setHeading( "" + heading + "" ); errorDialog->setInformativeText( message ); - errorDialog->setShouldOfferWebPaste(shouldOfferWebPaste); - errorDialog->setDetails(details); + errorDialog->setShouldOfferWebPaste( shouldOfferWebPaste ); + errorDialog->setDetails( details ); errorDialog->show(); cDebug() << "Calamares will quit when the dialog closes."; - connect( errorDialog, &QDialog::finished, [errorDialog]( int result ) { - if ( result == QDialog::Accepted && errorDialog->shouldOfferWebPaste() ) - { - CalamaresUtils::Paste::doLogUploadUI( errorDialog ); - } - QApplication::quit(); - } ); + connect( errorDialog, + &QDialog::finished, + [ errorDialog ]( int result ) + { + if ( result == QDialog::Accepted && errorDialog->shouldOfferWebPaste() ) + { + CalamaresUtils::Paste::doLogUploadUI( errorDialog ); + } + QApplication::quit(); + } ); } diff --git a/src/libcalamaresui/utils/ErrorDialog/ErrorDialog.cpp b/src/libcalamaresui/utils/ErrorDialog/ErrorDialog.cpp index 29da42e4d..ca88031f6 100644 --- a/src/libcalamaresui/utils/ErrorDialog/ErrorDialog.cpp +++ b/src/libcalamaresui/utils/ErrorDialog/ErrorDialog.cpp @@ -1,19 +1,20 @@ #include "ErrorDialog.h" #include "ui_ErrorDialog.h" -#include -#include #include "widgets/TranslationFix.h" +#include +#include -namespace Calamares { - - -ErrorDialog::ErrorDialog(QWidget *parent) : - QDialog(parent), - ui(new Ui::ErrorDialog) +namespace Calamares { - ui->setupUi(this); - ui->iconLabel->setPixmap(QIcon::fromTheme("dialog-error").pixmap(64)); + + +ErrorDialog::ErrorDialog( QWidget* parent ) + : QDialog( parent ) + , ui( new Ui::ErrorDialog ) +{ + ui->setupUi( this ); + ui->iconLabel->setPixmap( QIcon::fromTheme( "dialog-error" ).pixmap( 64 ) ); ui->detailsWidget->hide(); ui->offerWebPasteLabel->hide(); } @@ -24,68 +25,75 @@ ErrorDialog::~ErrorDialog() } -QString ErrorDialog::heading() const +QString +ErrorDialog::heading() const { return ui->headingLabel->text(); } -QString ErrorDialog::informativeText() const +QString +ErrorDialog::informativeText() const { return ui->informativeTextLabel->text(); } -QString ErrorDialog::details() const +QString +ErrorDialog::details() const { return ui->detailsBrowser->toPlainText(); } -void ErrorDialog::setHeading(const QString &newHeading) +void +ErrorDialog::setHeading( const QString& newHeading ) { - if (ui->headingLabel->text() == newHeading) + if ( ui->headingLabel->text() == newHeading ) return; - ui->headingLabel->setText(newHeading); + ui->headingLabel->setText( newHeading ); emit headingChanged(); } -void ErrorDialog::setInformativeText(const QString &newInformativeText) +void +ErrorDialog::setInformativeText( const QString& newInformativeText ) { - if (ui->informativeTextLabel->text() == newInformativeText) + if ( ui->informativeTextLabel->text() == newInformativeText ) return; - ui->informativeTextLabel->setText(newInformativeText); + ui->informativeTextLabel->setText( newInformativeText ); emit informativeTextChanged(); } -void ErrorDialog::setDetails(const QString &newDetails) +void +ErrorDialog::setDetails( const QString& newDetails ) { - if (ui->detailsBrowser->toPlainText() == newDetails) - return; - ui->detailsBrowser->setPlainText(newDetails); - - ui->detailsWidget->setVisible(!ui->detailsBrowser->toPlainText().trimmed().isEmpty()); - + if ( ui->detailsBrowser->toPlainText() == newDetails ) + return; + ui->detailsBrowser->setPlainText( newDetails ); + + ui->detailsWidget->setVisible( !ui->detailsBrowser->toPlainText().trimmed().isEmpty() ); + emit detailsChanged(); } -bool ErrorDialog::shouldOfferWebPaste() const +bool +ErrorDialog::shouldOfferWebPaste() const { return m_shouldOfferWebPaste; } -void ErrorDialog::setShouldOfferWebPaste(bool newShouldOfferWebPaste) +void +ErrorDialog::setShouldOfferWebPaste( bool newShouldOfferWebPaste ) { - if (m_shouldOfferWebPaste == newShouldOfferWebPaste) + if ( m_shouldOfferWebPaste == newShouldOfferWebPaste ) return; m_shouldOfferWebPaste = newShouldOfferWebPaste; - - ui->offerWebPasteLabel->setVisible(m_shouldOfferWebPaste); - - ui->buttonBox->setStandardButtons( m_shouldOfferWebPaste - ? (QDialogButtonBox::Yes | QDialogButtonBox::No) - : QDialogButtonBox::Close ); - - fixButtonLabels(ui->buttonBox); - + + ui->offerWebPasteLabel->setVisible( m_shouldOfferWebPaste ); + + ui->buttonBox->setStandardButtons( m_shouldOfferWebPaste ? ( QDialogButtonBox::Yes | QDialogButtonBox::No ) + : QDialogButtonBox::Close ); + + fixButtonLabels( ui->buttonBox ); + emit shouldOfferWebPasteChanged(); } -} // namespace Calamares +} // namespace Calamares diff --git a/src/libcalamaresui/utils/ErrorDialog/ErrorDialog.h b/src/libcalamaresui/utils/ErrorDialog/ErrorDialog.h index 4196f6a7f..0c700f8d3 100644 --- a/src/libcalamaresui/utils/ErrorDialog/ErrorDialog.h +++ b/src/libcalamaresui/utils/ErrorDialog/ErrorDialog.h @@ -4,7 +4,8 @@ #include -namespace Ui { +namespace Ui +{ class ErrorDialog; } class QDialogButtonBox; @@ -13,45 +14,46 @@ namespace Calamares class ErrorDialog : public QDialog { Q_OBJECT - - Q_PROPERTY(QString heading READ heading WRITE setHeading NOTIFY headingChanged) - Q_PROPERTY(QString informativeText READ informativeText WRITE setInformativeText NOTIFY informativeTextChanged) - Q_PROPERTY(QString details READ details WRITE setDetails NOTIFY detailsChanged) - Q_PROPERTY(bool shouldOfferWebPaste READ shouldOfferWebPaste WRITE setShouldOfferWebPaste NOTIFY shouldOfferWebPasteChanged) - + + Q_PROPERTY( QString heading READ heading WRITE setHeading NOTIFY headingChanged ) + Q_PROPERTY( QString informativeText READ informativeText WRITE setInformativeText NOTIFY informativeTextChanged ) + Q_PROPERTY( QString details READ details WRITE setDetails NOTIFY detailsChanged ) + Q_PROPERTY( bool shouldOfferWebPaste READ shouldOfferWebPaste WRITE setShouldOfferWebPaste NOTIFY + shouldOfferWebPasteChanged ) + public: - explicit ErrorDialog(QWidget *parent = nullptr); + explicit ErrorDialog( QWidget* parent = nullptr ); ~ErrorDialog(); - + QString heading() const; - + QString informativeText() const; - + QString details() const; - - void setHeading(const QString &newHeading); - - void setInformativeText(const QString &newInformativeText); - - void setDetails(const QString &newDetails); - + + void setHeading( const QString& newHeading ); + + void setInformativeText( const QString& newInformativeText ); + + void setDetails( const QString& newDetails ); + bool shouldOfferWebPaste() const; - void setShouldOfferWebPaste(bool newShouldOfferWebPaste); - + void setShouldOfferWebPaste( bool newShouldOfferWebPaste ); + signals: void headingChanged(); - + void informativeTextChanged(); - + void detailsChanged(); - + void shouldOfferWebPasteChanged(); - + private: - Ui::ErrorDialog *ui; + Ui::ErrorDialog* ui; bool m_shouldOfferWebPaste = false; }; -}; // namespace Calamares +}; // namespace Calamares -#endif // ERRORDIALOG_H +#endif // ERRORDIALOG_H From d9f7726f7db3db97955fed876d37a80af7006a96 Mon Sep 17 00:00:00 2001 From: Artem Grinev Date: Mon, 6 Dec 2021 02:41:17 +0400 Subject: [PATCH 08/45] [libcalamaresui] Add SPDX-header for Error Dialog files --- src/libcalamaresui/utils/ErrorDialog/ErrorDialog.cpp | 9 +++++++++ src/libcalamaresui/utils/ErrorDialog/ErrorDialog.h | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/src/libcalamaresui/utils/ErrorDialog/ErrorDialog.cpp b/src/libcalamaresui/utils/ErrorDialog/ErrorDialog.cpp index ca88031f6..4ffe20384 100644 --- a/src/libcalamaresui/utils/ErrorDialog/ErrorDialog.cpp +++ b/src/libcalamaresui/utils/ErrorDialog/ErrorDialog.cpp @@ -1,3 +1,12 @@ +/* === This file is part of Calamares - === + * + * SPDX-FileCopyrightText: 2021 Artem Grinev + * SPDX-License-Identifier: GPL-3.0-or-later + * + * Calamares is Free Software: see the License-Identifier above. + * + */ + #include "ErrorDialog.h" #include "ui_ErrorDialog.h" diff --git a/src/libcalamaresui/utils/ErrorDialog/ErrorDialog.h b/src/libcalamaresui/utils/ErrorDialog/ErrorDialog.h index 0c700f8d3..a0126c2ce 100644 --- a/src/libcalamaresui/utils/ErrorDialog/ErrorDialog.h +++ b/src/libcalamaresui/utils/ErrorDialog/ErrorDialog.h @@ -1,3 +1,12 @@ +/* === This file is part of Calamares - === + * + * SPDX-FileCopyrightText: 2021 Artem Grinev + * SPDX-License-Identifier: GPL-3.0-or-later + * + * Calamares is Free Software: see the License-Identifier above. + * + */ + #ifndef ERRORDIALOG_H #define ERRORDIALOG_H From aa332477fd1858603f528a5f036925624446249a Mon Sep 17 00:00:00 2001 From: Artem Grinev Date: Mon, 6 Dec 2021 03:11:16 +0400 Subject: [PATCH 09/45] [libcalamaresui] Run clang-format on TranslationFix.cpp --- src/libcalamaresui/widgets/TranslationFix.cpp | 31 ++++++++++--------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/src/libcalamaresui/widgets/TranslationFix.cpp b/src/libcalamaresui/widgets/TranslationFix.cpp index b73bd0e16..dbfd0bd83 100644 --- a/src/libcalamaresui/widgets/TranslationFix.cpp +++ b/src/libcalamaresui/widgets/TranslationFix.cpp @@ -10,34 +10,35 @@ #include "TranslationFix.h" #include -#include #include -#include #include +#include +#include namespace Calamares { //Using QMessageBox's StandardButton enum here but according to headers they should be kept in-sync between multiple classes. static std::pair< decltype( QMessageBox::Ok ), const char* > maps[] = { - { QMessageBox::Ok, QT_TRANSLATE_NOOP( "StandardButtons", "&OK" ) }, - { QMessageBox::Yes, QT_TRANSLATE_NOOP( "StandardButtons", "&Yes" ) }, - { QMessageBox::No, QT_TRANSLATE_NOOP( "StandardButtons", "&No" ) }, - { QMessageBox::Cancel, QT_TRANSLATE_NOOP( "StandardButtons", "&Cancel" ) }, - { QMessageBox::Close, QT_TRANSLATE_NOOP( "StandardButtons", "&Close" ) }, - }; + { QMessageBox::Ok, QT_TRANSLATE_NOOP( "StandardButtons", "&OK" ) }, + { QMessageBox::Yes, QT_TRANSLATE_NOOP( "StandardButtons", "&Yes" ) }, + { QMessageBox::No, QT_TRANSLATE_NOOP( "StandardButtons", "&No" ) }, + { QMessageBox::Cancel, QT_TRANSLATE_NOOP( "StandardButtons", "&Cancel" ) }, + { QMessageBox::Close, QT_TRANSLATE_NOOP( "StandardButtons", "&Close" ) }, +}; -template -void fixButtonLabels ( TButtonBox* box ) +template < typename TButtonBox > +void +fixButtonLabels( TButtonBox* box ) { if ( !box ) { return; } - + for ( auto [ sb, label ] : maps ) { - auto* button = box->button( static_cast(int(sb)) ); + auto* button = box->button( static_cast< typename TButtonBox::StandardButton >( int( sb ) ) ); if ( button ) { button->setText( QCoreApplication::translate( "StandardButtons", label ) ); @@ -48,13 +49,13 @@ void fixButtonLabels ( TButtonBox* box ) void fixButtonLabels( QMessageBox* box ) { - fixButtonLabels(box); + fixButtonLabels< QMessageBox >( box ); } void -fixButtonLabels(QDialogButtonBox *box) +fixButtonLabels( QDialogButtonBox* box ) { - fixButtonLabels(box); + fixButtonLabels< QDialogButtonBox >( box ); } } // namespace Calamares From b8c02587ae6accef5f85c06c49bc3e00d3cfccdf Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Mon, 6 Dec 2021 10:29:16 +0100 Subject: [PATCH 10/45] Changes: post-release housekeeping --- CHANGES-3.2 | 13 +++++++++++++ CMakeLists.txt | 4 ++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/CHANGES-3.2 b/CHANGES-3.2 index baaf261d4..81fd55343 100644 --- a/CHANGES-3.2 +++ b/CHANGES-3.2 @@ -7,6 +7,19 @@ contributors are listed. Note that Calamares does not have a historical changelog -- this log starts with version 3.2.0. The release notes on the website will have to do for older versions. +# 3.2.49 (unreleased) # + +This release contains contributions from (alphabetically by first name): + - Evan James + +## Core ## + - No core changes yet + +## Modules ## + - *partition* now supports "deep" btrfs subvolume names, e.g. a + separate subvolume for `/usr/local`. (Thanks Evan) + + # 3.2.48 (2021-12-03) # This release contains contributions from (alphabetically by first name): diff --git a/CMakeLists.txt b/CMakeLists.txt index c998d43d0..1a55eae1c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -41,11 +41,11 @@ # TODO:3.3: Require CMake 3.12 cmake_minimum_required( VERSION 3.3 FATAL_ERROR ) project( CALAMARES - VERSION 3.2.48 + VERSION 3.2.49 LANGUAGES C CXX ) -set( CALAMARES_VERSION_RC 0 ) # Set to 0 during release cycle, 1 during development +set( CALAMARES_VERSION_RC 1 ) # Set to 0 during release cycle, 1 during development if( CALAMARES_VERSION_RC EQUAL 1 AND CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR ) message( FATAL_ERROR "Do not build development versions in the source-directory." ) endif() From 6e08da6c8d4bcf7608e6b61dc170d06e0b3246f7 Mon Sep 17 00:00:00 2001 From: dalto Date: Sat, 4 Dec 2021 09:10:49 -0600 Subject: [PATCH 11/45] [bootloader] Fix error with systemd-boot when path exists in the ESP --- src/modules/bootloader/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/bootloader/main.py b/src/modules/bootloader/main.py index 25c7e0d9b..0182d1110 100644 --- a/src/modules/bootloader/main.py +++ b/src/modules/bootloader/main.py @@ -224,7 +224,7 @@ def create_systemd_boot_conf(install_path, efi_dir, uuid, entry, entry_name, ker # Copy kernel and initramfs to a subdirectory of /efi partition files_dir = os.path.join(install_path + efi_dir, entry_name) - os.mkdir(files_dir) + os.makedirs(files_dir, exist_ok=True) kernel_path = install_path + kernel kernel_name = os.path.basename(kernel_path) From baf8297cc4eeb6f5aba774a61dea10673bab2d15 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Fri, 3 Dec 2021 12:11:33 +0100 Subject: [PATCH 12/45] [libcalamares] Reading a file from target system --- .../utils/CalamaresUtilsSystem.cpp | 24 +++++++++++++++++++ src/libcalamares/utils/CalamaresUtilsSystem.h | 18 ++++++++++++++ 2 files changed, 42 insertions(+) diff --git a/src/libcalamares/utils/CalamaresUtilsSystem.cpp b/src/libcalamares/utils/CalamaresUtilsSystem.cpp index b290b62c5..301d20b33 100644 --- a/src/libcalamares/utils/CalamaresUtilsSystem.cpp +++ b/src/libcalamares/utils/CalamaresUtilsSystem.cpp @@ -147,6 +147,30 @@ System::createTargetFile( const QString& path, const QByteArray& contents, Write return CreationResult( QFileInfo( f ).canonicalFilePath() ); } +QStringList +System::readTargetFile( const QString& path ) const +{ + const QString completePath = targetPath( path ); + if ( completePath.isEmpty() ) + { + return QStringList(); + } + + QFile f( completePath ); + if ( !f.open( QIODevice::ReadOnly ) ) + { + return QStringList(); + } + + QTextStream in( &f ); + QStringList l; + while ( !f.atEnd() ) + { + l << in.readLine(); + } + return l; +} + void System::removeTargetFile( const QString& path ) const { diff --git a/src/libcalamares/utils/CalamaresUtilsSystem.h b/src/libcalamares/utils/CalamaresUtilsSystem.h index e11ecae05..1bb5629d1 100644 --- a/src/libcalamares/utils/CalamaresUtilsSystem.h +++ b/src/libcalamares/utils/CalamaresUtilsSystem.h @@ -287,6 +287,24 @@ public: */ DLLEXPORT void removeTargetFile( const QString& path ) const; + /** @brief Reads a file from the target system. + * + * @param path Path to the file; this is interpreted from the root of + * the target system (@see targetPath()). + * + * Does no error checking, and returns an empty list if the file does + * not exist. + * + * NOTE: This function is now basically the same as QFile::readAll(), + * splitting into lines, but Calamares may need to change + * permissions or raise privileges to actually read the file, + * which is why there is an API. + * + * NOTE: Since this buffers the whole file in memory, reading big files + * is not recommended. + */ + DLLEXPORT QStringList readTargetFile( const QString& path ) const; + /** @brief Ensure that the directory @p path exists * * @param path a full pathname to a desired directory. From 6ef7acc1080d577359f2f5e26436a93221fee546 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Fri, 3 Dec 2021 13:22:18 +0100 Subject: [PATCH 13/45] [libcalamares] Add minor tests for new readTargetFile --- src/libcalamares/utils/Tests.cpp | 81 ++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) diff --git a/src/libcalamares/utils/Tests.cpp b/src/libcalamares/utils/Tests.cpp index 12b72cb4c..8fd11cd87 100644 --- a/src/libcalamares/utils/Tests.cpp +++ b/src/libcalamares/utils/Tests.cpp @@ -76,6 +76,9 @@ private Q_SLOTS: void testCalculateWorkingDirectory(); void testRunnerOutput(); + /** @section Test file-functions */ + void testReadWriteFile(); + private: void recursiveCompareMap( const QVariantMap& a, const QVariantMap& b, int depth ); }; @@ -950,6 +953,84 @@ LibCalamaresTests::testRunnerOutput() } +CalamaresUtils::System* +file_setup( const QTemporaryDir& tempRoot ) +{ + CalamaresUtils::System* ss = CalamaresUtils::System::instance(); + if ( !ss ) + { + ss = new CalamaresUtils::System( true ); + } + + Calamares::GlobalStorage* gs + = Calamares::JobQueue::instance() ? Calamares::JobQueue::instance()->globalStorage() : nullptr; + if ( !gs ) + { + cDebug() << "Creating new JobQueue"; + (void)new Calamares::JobQueue(); + gs = Calamares::JobQueue::instance() ? Calamares::JobQueue::instance()->globalStorage() : nullptr; + } + if ( gs ) + { + // Working with a rootMountPoint set + gs->insert( "rootMountPoint", tempRoot.path() ); + } + return ss; +} + +void +LibCalamaresTests::testReadWriteFile() +{ + static const QByteArray otherContents( "derp\n" ); + + QTemporaryDir tempRoot( QDir::tempPath() + QStringLiteral( "/test-job-XXXXXX" ) ); + auto* ss = file_setup( tempRoot ); + + QVERIFY( ss ); + { + auto fullPath = ss->createTargetFile( "test0", QByteArray(), CalamaresUtils::System::WriteMode::Overwrite ); + QVERIFY( fullPath ); + QVERIFY( !fullPath.path().isEmpty() ); + + QFileInfo fi( fullPath.path() ); + QVERIFY( fi.exists() ); + QVERIFY( fi.isFile() ); + QCOMPARE( fi.size(), 0 ); + } + // It won't overwrite unless you ask for it + { + auto fullPath = ss->createTargetFile( "test0", otherContents ); + QVERIFY( !fullPath ); // Failed, because it won't overwrite + QCOMPARE( fullPath.code(), decltype(fullPath)::Code::AlreadyExists ); + QVERIFY( fullPath.path().isEmpty() ); // Because it wasn't written + + QFileInfo fi( tempRoot.filePath( "test0" ) ); // Compute the name some other way + QVERIFY( fi.exists() ); + QVERIFY( fi.isFile() ); + QCOMPARE( fi.size(), 0 ); + } + // But it will if you say so explicitly + { + auto fullPath = ss->createTargetFile( "test0", otherContents, CalamaresUtils::System::WriteMode::Overwrite ); + QVERIFY( fullPath ); + QVERIFY( !fullPath.path().isEmpty() ); + + QFileInfo fi( fullPath.path() ); + QVERIFY( fi.exists() ); + QVERIFY( fi.isFile() ); + QCOMPARE( fi.size(), 5 ); + } + + // Now it's been written, we can read it, too + { + auto contents = ss->readTargetFile( "test0" ); + QVERIFY( !contents.isEmpty() ); + QCOMPARE( contents.count(), 1 ); + QCOMPARE( contents[ 0 ], QStringLiteral( "derp" ) ); // No trailing \n + } +} + + QTEST_GUILESS_MAIN( LibCalamaresTests ) #include "utils/moc-warnings.h" From 890c17cd71b2126e0a20f42fa9025b0f6358f62b Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Mon, 6 Dec 2021 12:29:03 +0100 Subject: [PATCH 14/45] [libcalamares] Expand error-logging when creating files --- src/libcalamares/utils/CalamaresUtilsSystem.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/libcalamares/utils/CalamaresUtilsSystem.cpp b/src/libcalamares/utils/CalamaresUtilsSystem.cpp index 301d20b33..9a4ba990f 100644 --- a/src/libcalamares/utils/CalamaresUtilsSystem.cpp +++ b/src/libcalamares/utils/CalamaresUtilsSystem.cpp @@ -115,12 +115,14 @@ System::createTargetFile( const QString& path, const QByteArray& contents, Write QString completePath = targetPath( path ); if ( completePath.isEmpty() ) { + cWarning() << "No target path for" << path; return CreationResult( CreationResult::Code::Invalid ); } QFile f( completePath ); if ( ( mode == WriteMode::KeepExisting ) && f.exists() ) { + cWarning() << "Target file" << completePath << "already exists"; return CreationResult( CreationResult::Code::AlreadyExists ); } @@ -133,13 +135,16 @@ System::createTargetFile( const QString& path, const QByteArray& contents, Write if ( !f.open( m ) ) { + cWarning() << "Could not open target file" << completePath; return CreationResult( CreationResult::Code::Failed ); } - if ( f.write( contents ) != contents.size() ) + auto written = f.write( contents ); + if ( written != contents.size() ) { f.close(); f.remove(); + cWarning() << "Short write (" << written << "out of" << contents.size() << "bytes) to" << completePath; return CreationResult( CreationResult::Code::Failed ); } From d89553a7773b0a5b2f362fd903de191f246ddff2 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Mon, 6 Dec 2021 14:44:38 +0100 Subject: [PATCH 15/45] [partition] Avoid problems with MessageAndPath in containers (drop const) --- src/modules/partition/jobs/ClearMountsJob.cpp | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/modules/partition/jobs/ClearMountsJob.cpp b/src/modules/partition/jobs/ClearMountsJob.cpp index 831a1e868..2f5a8bd36 100644 --- a/src/modules/partition/jobs/ClearMountsJob.cpp +++ b/src/modules/partition/jobs/ClearMountsJob.cpp @@ -243,14 +243,8 @@ public: } private: -#if ( QT_VERSION < QT_VERSION_CHECK( 5, 15, 0 ) ) - // TODO: 3.3 remove because newer Qt does support constness const char* m_message = nullptr; QString m_path; -#else - const char* const m_message = nullptr; - QString const m_path; -#endif }; STATICTEST inline QDebug& From 149f3ff3fe18a239e6c71bc93c0f570f0358bc07 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Mon, 6 Dec 2021 14:52:33 +0100 Subject: [PATCH 16/45] [partition] Reduce warnings about shadowed variables --- .../partition/jobs/CreatePartitionJob.cpp | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/modules/partition/jobs/CreatePartitionJob.cpp b/src/modules/partition/jobs/CreatePartitionJob.cpp index 83ebc0509..3e51ed598 100644 --- a/src/modules/partition/jobs/CreatePartitionJob.cpp +++ b/src/modules/partition/jobs/CreatePartitionJob.cpp @@ -60,24 +60,24 @@ createZfs( Partition* partition, Device* device ) // Now we need to do some things that would normally be done by kpmcore // First we get the device node from the output and set it as the partition path - QRegularExpression re( QStringLiteral( "Created a new partition (\\d+)" ) ); - QRegularExpressionMatch rem = re.match( r.getOutput() ); - QString deviceNode; - if ( rem.hasMatch() ) { - if ( partition->devicePath().back().isDigit() ) + QRegularExpression re( QStringLiteral( "Created a new partition (\\d+)" ) ); + QRegularExpressionMatch rem = re.match( r.getOutput() ); + + if ( rem.hasMatch() ) { - deviceNode = partition->devicePath() + QLatin1Char( 'p' ) + rem.captured( 1 ); - } - else - { - deviceNode = partition->devicePath() + rem.captured( 1 ); + if ( partition->devicePath().back().isDigit() ) + { + deviceNode = partition->devicePath() + QLatin1Char( 'p' ) + rem.captured( 1 ); + } + else + { + deviceNode = partition->devicePath() + rem.captured( 1 ); + } } + partition->setPartitionPath( deviceNode ); } - - partition->setPartitionPath( deviceNode ); - // If it is a gpt device, set the partition UUID if ( device->partitionTable()->type() == PartitionTable::gpt && partition->uuid().isEmpty() ) { From eb2cf60466fb9dbab07742b2bda249a4e359b614 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 7 Dec 2021 10:57:06 +0100 Subject: [PATCH 17/45] CI: support FreeBSD when pulling translations --- ci/txpull.sh | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/ci/txpull.sh b/ci/txpull.sh index f68814560..1c5c11a45 100755 --- a/ci/txpull.sh +++ b/ci/txpull.sh @@ -116,6 +116,19 @@ git commit "$AUTHOR" --message="i18n: [desktop] $BOILERPLATE" | true # PO-Created line). This applies only to modules which use po-files. git diff --numstat src/modules | awk '($1==1 && $2==1){print $3}' | xargs git checkout -- +# sed either wants -i'' (GNU sed) or -i '' (BSD sed) to +# replace in a file, with no backup extension. Define +# a `reinplace` command to deal with the difference. +if test FreeBSD = `uname` ; then + reinplace() { + sed -i '' "$@" + } +else + reinplace() { + sed -i'' "$@" + } +fi + # Go through the Python modules; those with a lang/ subdir have their # own complete gettext-based setup. for MODULE_DIR in $(find src/modules -maxdepth 1 -mindepth 1 -type d) ; do @@ -125,7 +138,7 @@ for MODULE_DIR in $(find src/modules -maxdepth 1 -mindepth 1 -type d) ; do if [ -d ${MODULE_DIR}/lang ]; then # Convert PO files to MO files for POFILE in $(find ${MODULE_DIR} -name "*.po") ; do - sed -i'' '/^"Content-Type/s/CHARSET/UTF-8/' $POFILE + reinplace '/^"Content-Type/s/CHARSET/UTF-8/' $POFILE # msgfmt -o ${POFILE%.po}.mo $POFILE done git add --verbose ${MODULE_DIR}/lang/* @@ -135,7 +148,7 @@ for MODULE_DIR in $(find src/modules -maxdepth 1 -mindepth 1 -type d) ; do done for POFILE in $(find lang -name "python.po") ; do - sed -i'' '/^"Content-Type/s/CHARSET/UTF-8/' $POFILE + reinplace '/^"Content-Type/s/CHARSET/UTF-8/' $POFILE # msgfmt -o ${POFILE%.po}.mo $POFILE done git add --verbose lang/python* From 13196ed2e2f2913375f6e64ad65750dfd6ca2316 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 7 Dec 2021 11:04:19 +0100 Subject: [PATCH 18/45] CI: sort .desktop entries for i18n The ordering of entries jumps around sometimes when reading from Transifex (this might be Python unordered dictionaries, or based on translation statistics -- I can't tell). Force an order by sorting on language code and key-name so they all end up grouped by language code, sorted Name Icon GenericName Comment. Although this shuffles some more entries now, longer-term it will reduce churn in the .desktop file. --- ci/txpull.sh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/ci/txpull.sh b/ci/txpull.sh index 1c5c11a45..a6e4127af 100755 --- a/ci/txpull.sh +++ b/ci/txpull.sh @@ -108,6 +108,21 @@ awk ' skip=0; print $0; }}' < calamares.desktop > calamares.desktop.new mv calamares.desktop.new calamares.desktop +# Now group translated key-names (Name, Icon, Description, ..) by sorted +# language key rather than random-ish language-key order (which shuffles +# entries around). +# +# First, the non-translated lines +grep -v '\[.*\]=' calamares.desktop > calamares.desktop.new +# The translated lines: +# - replace (the first) [] by | so we have a consistent field separator +# - sort based on field 2, then 1 (language code, then reversed key-name) +# - replace the first | by [, the first (remaining) | by ] +# Effectively this puts the fields in this order: Name, Icon, Generic Name, +# Comment -- within each language key. This keeps churn down since the +# language codes and key-names are constant. +grep '\[.*\]=' calamares.desktop | sed -e 's/\[/|/' -e 's/\]/|/' | sort -t '|' -k 2,2 -k 1,1r | sed -e 's/|/\[/' | sed -e 's/|/\]/' >> calamares.desktop.new +mv calamares.desktop.new calamares.desktop git add --verbose calamares.desktop git commit "$AUTHOR" --message="i18n: [desktop] $BOILERPLATE" | true From 8e4c9b8bd60d60d9ec8bf949d666bcdf5d20d6c4 Mon Sep 17 00:00:00 2001 From: Calamares CI Date: Tue, 7 Dec 2021 10:58:18 +0100 Subject: [PATCH 19/45] i18n: [calamares] Automatic merge of Transifex translations --- lang/calamares_sv.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lang/calamares_sv.ts b/lang/calamares_sv.ts index 5fdcce0eb..64946e710 100644 --- a/lang/calamares_sv.ts +++ b/lang/calamares_sv.ts @@ -688,17 +688,17 @@ Alla ändringar kommer att gå förlorade. Successfully unmounted %1. - + Framgångsrikt avmonterade %1. Successfully disabled swap %1. - + Framgångsrikt inaktiverade swap %1. Successfully cleared swap %1. - + Framgångsrikt rensade swap %1. @@ -708,7 +708,7 @@ Alla ändringar kommer att gå förlorade. Successfully disabled volume group %1. - + Framgångsrikt inaktiverade volymgrupp %1. From c8ea3bccf72bea180b62e724a962d39ebc233eca Mon Sep 17 00:00:00 2001 From: Calamares CI Date: Tue, 7 Dec 2021 10:58:18 +0100 Subject: [PATCH 20/45] i18n: [desktop] Automatic merge of Transifex translations --- calamares.desktop | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/calamares.desktop b/calamares.desktop index bfe3955b1..48d0df26d 100644 --- a/calamares.desktop +++ b/calamares.desktop @@ -98,10 +98,6 @@ Name[hr]=Instaliraj sustav Icon[hr]=calamares GenericName[hr]=Instalacija sustava Comment[hr]=Calamares — Instalacija sustava -Name[ie]=Installar li sistema -Icon[ie]=calamares -GenericName[ie]=Installator del sistema -Comment[ie]=Calamares — Installator del sistema Name[hu]=Rendszer telepítése Icon[hu]=calamares GenericName[hu]=Rendszertelepítő @@ -114,10 +110,6 @@ Name[is]=Setja upp kerfið Icon[is]=calamares GenericName[is]=Kerfis uppsetning Comment[is]=Calamares — Kerfis uppsetning -Name[cs_CZ]=Nainstalovat systém -Icon[cs_CZ]=calamares -GenericName[cs_CZ]=Instalátor systému -Comment[cs_CZ]=Calamares – instalátor operačních systémů Name[ja]=システムをインストール Icon[ja]=calamares GenericName[ja]=システムインストーラー @@ -158,6 +150,14 @@ Name[pl]=Zainstaluj system Icon[pl]=calamares GenericName[pl]=Instalator systemu Comment[pl]=Calamares — Instalator systemu +Name[ie]=Installar li sistema +Icon[ie]=calamares +GenericName[ie]=Installator del sistema +Comment[ie]=Calamares — Installator del sistema +Name[cs_CZ]=Nainstalovat systém +Icon[cs_CZ]=calamares +GenericName[cs_CZ]=Instalátor systému +Comment[cs_CZ]=Calamares – instalátor operačních systémů Name[pt_BR]=Sistema de Instalação Icon[pt_BR]=calamares GenericName[pt_BR]=Instalador de Sistema @@ -174,11 +174,6 @@ Name[si]=පද්ධතිය ස්ථාපනය කරන්න Icon[si]=කැලමරේස් GenericName[si]=පද්ධති ස්ථාපකය Comment[si]=Calamares - පද්ධති ස්ථාපකය -Name[sk]=Inštalovať systém -Icon[sk]=calamares -GenericName[sk]=Inštalátor systému -Comment[sk]=Calamares — Inštalátor systému -Name[sl]=Namesti sistem Name[sq]=Instalo Sistemin Icon[sq]=calamares GenericName[sq]=Instalues Sistemi @@ -187,11 +182,16 @@ Name[fi_FI]=Asenna järjestelmä Icon[fi_FI]=calamares GenericName[fi_FI]=Järjestelmän asennusohjelma Comment[fi_FI]=Calamares — Järjestelmän asentaja -Name[sr@latin]=Instaliraj sistem Name[sr]=Инсталирај систем Icon[sr]=calamares GenericName[sr]=Инсталатер система Comment[sr]=Каламарес — инсталатер система +Name[sr@latin]=Instaliraj sistem +Name[sk]=Inštalovať systém +Icon[sk]=calamares +GenericName[sk]=Inštalátor systému +Comment[sk]=Calamares — Inštalátor systému +Name[sl]=Namesti sistem Name[sv]=Installera system Icon[sv]=calamares GenericName[sv]=Systeminstallerare From d2ac201b982d272da2ce9220277e74e9155a1f5b Mon Sep 17 00:00:00 2001 From: Calamares CI Date: Tue, 7 Dec 2021 11:05:37 +0100 Subject: [PATCH 21/45] i18n: [desktop] Automatic merge of Transifex translations --- calamares.desktop | 108 +++++++++++++++++++++++----------------------- 1 file changed, 54 insertions(+), 54 deletions(-) diff --git a/calamares.desktop b/calamares.desktop index 48d0df26d..4db300495 100644 --- a/calamares.desktop +++ b/calamares.desktop @@ -21,10 +21,18 @@ Name[as]=চিছটেম ইনস্তল কৰক Icon[as]=কেলামাৰেচ GenericName[as]=চিছটেম ইনস্তলাৰ Comment[as]=কেলামাৰেচ — চিছটেম​ ইনস্তলাৰ +Name[ast]=Instalar el sistema +Icon[ast]=calamares +GenericName[ast]=Instalador del sistema +Comment[ast]=Calamares — Instalador del sistema Name[az]=Sistemi Quraşdırmaq Icon[az]=calamares GenericName[az]=Sistem Quraşdırıcısı Comment[az]=Calamares Sistem Quraşdırıcısı +Name[az_AZ]=Sistemi quraşdırmaq +Icon[az_AZ]=calamares +GenericName[az_AZ]=Sistem quraşdırcısı +Comment[az_AZ]=Calamares — Sistem Quraşdırıcısı Name[be]=Усталяваць сістэму Icon[be]=calamares GenericName[be]=Усталёўшчык сістэмы @@ -41,6 +49,10 @@ Name[ca]=Instal·la el sistema Icon[ca]=calamares GenericName[ca]=Instal·lador de sistema Comment[ca]=Calamares — Instal·lador de sistema +Name[cs_CZ]=Nainstalovat systém +Icon[cs_CZ]=calamares +GenericName[cs_CZ]=Instalátor systému +Comment[cs_CZ]=Calamares – instalátor operačních systémů Name[da]=Installér system Icon[da]=calamares GenericName[da]=Systeminstallationsprogram @@ -57,10 +69,19 @@ Name[en_GB]=Install System Icon[en_GB]=calamares GenericName[en_GB]=System Installer Comment[en_GB]=Calamares — System Installer +Name[eo]=Instali Sistemo +Icon[eo]=calamares +GenericName[eo]=Sistema Instalilo +Comment[eo]=Calamares — Sistema Instalilo Name[es]=Instalar Sistema Icon[es]=calamares GenericName[es]=Instalador del Sistema Comment[es]=Calamares — Instalador del Sistema +Name[es_MX]=Instalar el Sistema +Icon[es_MX]=calamares +GenericName[es_MX]=Instalador del sistema +Comment[es_MX]=Calamares - Instalador del sistema +Name[es_PR]=Instalar el sistema Name[et]=Paigalda süsteem Icon[et]=calamares GenericName[et]=Süsteemipaigaldaja @@ -73,7 +94,10 @@ Name[fa]=نصب سامانه Icon[fa]=کالامارس GenericName[fa]=نصب‌کننده سامانه Comment[fa]=کالامارس — نصب‌کننده سامانه -Name[es_PR]=Instalar el sistema +Name[fi_FI]=Asenna järjestelmä +Icon[fi_FI]=calamares +GenericName[fi_FI]=Järjestelmän asennusohjelma +Comment[fi_FI]=Calamares — Järjestelmän asentaja Name[fr]=Installer le système Icon[fr]=calamares GenericName[fr]=Installateur système @@ -106,10 +130,18 @@ Name[id]=Instal Sistem Icon[id]=calamares GenericName[id]=Pemasang Comment[id]=Calamares — Pemasang Sistem +Name[ie]=Installar li sistema +Icon[ie]=calamares +GenericName[ie]=Installator del sistema +Comment[ie]=Calamares — Installator del sistema Name[is]=Setja upp kerfið Icon[is]=calamares GenericName[is]=Kerfis uppsetning Comment[is]=Calamares — Kerfis uppsetning +Name[it_IT]=Installa il sistema +Icon[it_IT]=calamares +GenericName[it_IT]=Programma d'installazione del sistema +Comment[it_IT]=Calamares — Programma d'installazione del sistema Name[ja]=システムをインストール Icon[ja]=calamares GenericName[ja]=システムインストーラー @@ -122,10 +154,6 @@ Name[lt]=Įdiegti Sistemą Icon[lt]=calamares GenericName[lt]=Sistemos diegimas į kompiuterį Comment[lt]=Calamares — Sistemos diegimo programa -Name[it_IT]=Installa il sistema -Icon[it_IT]=calamares -GenericName[it_IT]=Programma d'installazione del sistema -Comment[it_IT]=Calamares — Programma d'installazione del sistema Name[mk]=Инсталирај го системот Icon[mk]=calamares GenericName[mk]=Системен Инсталер @@ -138,30 +166,26 @@ Name[nb]=Installer System Icon[nb]=calamares GenericName[nb]=Systeminstallatør Comment[nb]=Calamares-systeminstallatør +Name[ne_NP]= सिस्टम इन्स्टल गर्नुहोस् +Icon[ne_NP]=Calamares +GenericName[ne_NP]=सिस्टम इन्स्टलर +Comment[ne_NP]=Calamares - सिस्टम इन्स्टलर Name[nl]=Installeer systeem Icon[nl]=calamares GenericName[nl]=Installatieprogramma Comment[nl]=Calamares — Installatieprogramma -Name[az_AZ]=Sistemi quraşdırmaq -Icon[az_AZ]=calamares -GenericName[az_AZ]=Sistem quraşdırcısı -Comment[az_AZ]=Calamares — Sistem Quraşdırıcısı Name[pl]=Zainstaluj system Icon[pl]=calamares GenericName[pl]=Instalator systemu Comment[pl]=Calamares — Instalator systemu -Name[ie]=Installar li sistema -Icon[ie]=calamares -GenericName[ie]=Installator del sistema -Comment[ie]=Calamares — Installator del sistema -Name[cs_CZ]=Nainstalovat systém -Icon[cs_CZ]=calamares -GenericName[cs_CZ]=Instalátor systému -Comment[cs_CZ]=Calamares – instalátor operačních systémů Name[pt_BR]=Sistema de Instalação Icon[pt_BR]=calamares GenericName[pt_BR]=Instalador de Sistema Comment[pt_BR]=Calamares — Instalador de Sistema +Name[pt_PT]=Instalar Sistema +Icon[pt_PT]=calamares +GenericName[pt_PT]=Instalador de Sistema +Comment[pt_PT]=Instalador de Sistema - Calamares Name[ro]=Instalează sistemul Icon[ro]=calamares GenericName[ro]=Instalator de sistem @@ -174,24 +198,20 @@ Name[si]=පද්ධතිය ස්ථාපනය කරන්න Icon[si]=කැලමරේස් GenericName[si]=පද්ධති ස්ථාපකය Comment[si]=Calamares - පද්ධති ස්ථාපකය -Name[sq]=Instalo Sistemin -Icon[sq]=calamares -GenericName[sq]=Instalues Sistemi -Comment[sq]=Calamares — Instalues Sistemi -Name[fi_FI]=Asenna järjestelmä -Icon[fi_FI]=calamares -GenericName[fi_FI]=Järjestelmän asennusohjelma -Comment[fi_FI]=Calamares — Järjestelmän asentaja -Name[sr]=Инсталирај систем -Icon[sr]=calamares -GenericName[sr]=Инсталатер система -Comment[sr]=Каламарес — инсталатер система -Name[sr@latin]=Instaliraj sistem Name[sk]=Inštalovať systém Icon[sk]=calamares GenericName[sk]=Inštalátor systému Comment[sk]=Calamares — Inštalátor systému Name[sl]=Namesti sistem +Name[sq]=Instalo Sistemin +Icon[sq]=calamares +GenericName[sq]=Instalues Sistemi +Comment[sq]=Calamares — Instalues Sistemi +Name[sr]=Инсталирај систем +Icon[sr]=calamares +GenericName[sr]=Инсталатер система +Comment[sr]=Каламарес — инсталатер система +Name[sr@latin]=Instaliraj sistem Name[sv]=Installera system Icon[sv]=calamares GenericName[sv]=Systeminstallerare @@ -201,6 +221,10 @@ Icon[tg]=calamares GenericName[tg]=Насбкунандаи низомӣ Comment[tg]=Calamares — Насбкунандаи низомӣ Name[th]=ติดตั้งระบบ +Name[tr_TR]=Sistemi Yükle +Icon[tr_TR]=calamares +GenericName[tr_TR]=Sistem Yükleyici +Comment[tr_TR]=Calamares — Sistem Yükleyici Name[uk]=Встановити Систему Icon[uk]=calamares GenericName[uk]=Встановлювач системи @@ -217,27 +241,3 @@ Name[zh_TW]=安裝系統 Icon[zh_TW]=calamares GenericName[zh_TW]=系統安裝程式 Comment[zh_TW]=Calamares ── 系統安裝程式 -Name[ast]=Instalar el sistema -Icon[ast]=calamares -GenericName[ast]=Instalador del sistema -Comment[ast]=Calamares — Instalador del sistema -Name[eo]=Instali Sistemo -Icon[eo]=calamares -GenericName[eo]=Sistema Instalilo -Comment[eo]=Calamares — Sistema Instalilo -Name[ne_NP]= सिस्टम इन्स्टल गर्नुहोस् -Icon[ne_NP]=Calamares -GenericName[ne_NP]=सिस्टम इन्स्टलर -Comment[ne_NP]=Calamares - सिस्टम इन्स्टलर -Name[es_MX]=Instalar el Sistema -Icon[es_MX]=calamares -GenericName[es_MX]=Instalador del sistema -Comment[es_MX]=Calamares - Instalador del sistema -Name[pt_PT]=Instalar Sistema -Icon[pt_PT]=calamares -GenericName[pt_PT]=Instalador de Sistema -Comment[pt_PT]=Instalador de Sistema - Calamares -Name[tr_TR]=Sistemi Yükle -Icon[tr_TR]=calamares -GenericName[tr_TR]=Sistem Yükleyici -Comment[tr_TR]=Calamares — Sistem Yükleyici From dc11dd2203fda01e1f78e2c29225a885c2bc7449 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 7 Dec 2021 12:24:41 +0100 Subject: [PATCH 22/45] [libcalamaresui] Move ErrorDialog to the widgets/ part --- src/libcalamaresui/CMakeLists.txt | 6 +++--- .../{utils/ErrorDialog => widgets}/ErrorDialog.cpp | 0 .../{utils/ErrorDialog => widgets}/ErrorDialog.h | 0 .../{utils/ErrorDialog => widgets}/ErrorDialog.ui | 0 4 files changed, 3 insertions(+), 3 deletions(-) rename src/libcalamaresui/{utils/ErrorDialog => widgets}/ErrorDialog.cpp (100%) rename src/libcalamaresui/{utils/ErrorDialog => widgets}/ErrorDialog.h (100%) rename src/libcalamaresui/{utils/ErrorDialog => widgets}/ErrorDialog.ui (100%) diff --git a/src/libcalamaresui/CMakeLists.txt b/src/libcalamaresui/CMakeLists.txt index e745681f3..ab0ad963a 100644 --- a/src/libcalamaresui/CMakeLists.txt +++ b/src/libcalamaresui/CMakeLists.txt @@ -20,7 +20,6 @@ set( calamaresui_SOURCES utils/CalamaresUtilsGui.cpp utils/ImageRegistry.cpp utils/Paste.cpp - utils/ErrorDialog/ErrorDialog.cpp viewpages/BlankViewStep.cpp viewpages/ExecutionViewStep.cpp @@ -28,6 +27,7 @@ set( calamaresui_SOURCES viewpages/ViewStep.cpp widgets/ClickableLabel.cpp + widgets/ErrorDialog.cpp widgets/FixedAspectRatioLabel.cpp widgets/PrettyRadioButton.cpp widgets/TranslationFix.cpp @@ -76,8 +76,8 @@ calamares_add_library( calamaresui Qt5::Svg RESOURCES libcalamaresui.qrc EXPORT Calamares - UI - utils/ErrorDialog/ErrorDialog.ui + UI + utils/ErrorDialog/ErrorDialog.ui VERSION ${CALAMARES_VERSION_SHORT} ) target_link_libraries( calamaresui PRIVATE yamlcpp::yamlcpp ) diff --git a/src/libcalamaresui/utils/ErrorDialog/ErrorDialog.cpp b/src/libcalamaresui/widgets/ErrorDialog.cpp similarity index 100% rename from src/libcalamaresui/utils/ErrorDialog/ErrorDialog.cpp rename to src/libcalamaresui/widgets/ErrorDialog.cpp diff --git a/src/libcalamaresui/utils/ErrorDialog/ErrorDialog.h b/src/libcalamaresui/widgets/ErrorDialog.h similarity index 100% rename from src/libcalamaresui/utils/ErrorDialog/ErrorDialog.h rename to src/libcalamaresui/widgets/ErrorDialog.h diff --git a/src/libcalamaresui/utils/ErrorDialog/ErrorDialog.ui b/src/libcalamaresui/widgets/ErrorDialog.ui similarity index 100% rename from src/libcalamaresui/utils/ErrorDialog/ErrorDialog.ui rename to src/libcalamaresui/widgets/ErrorDialog.ui From 49890acd041594dc5b736aea137a95873d76b595 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 7 Dec 2021 12:39:50 +0100 Subject: [PATCH 23/45] [libcalamaresui] Fix build after move --- src/libcalamaresui/ViewManager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libcalamaresui/ViewManager.cpp b/src/libcalamaresui/ViewManager.cpp index 87024ea6b..e61859a13 100644 --- a/src/libcalamaresui/ViewManager.cpp +++ b/src/libcalamaresui/ViewManager.cpp @@ -17,7 +17,6 @@ #include "JobQueue.h" #include "Settings.h" -#include "utils/ErrorDialog/ErrorDialog.h" #include "utils/Logger.h" #include "utils/Paste.h" #include "utils/Retranslator.h" @@ -25,6 +24,7 @@ #include "viewpages/BlankViewStep.h" #include "viewpages/ExecutionViewStep.h" #include "viewpages/ViewStep.h" +#include "widgets/ErrorDialog.h" #include "widgets/TranslationFix.h" #include From ca7f28848827ea60f64a2882719826e52b0933bc Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 7 Dec 2021 12:40:05 +0100 Subject: [PATCH 24/45] [libcalamaresui] APIDOX for ErrorDialog --- src/libcalamaresui/widgets/ErrorDialog.h | 43 ++++++++++++++++-------- 1 file changed, 29 insertions(+), 14 deletions(-) diff --git a/src/libcalamaresui/widgets/ErrorDialog.h b/src/libcalamaresui/widgets/ErrorDialog.h index a0126c2ce..c4949a89c 100644 --- a/src/libcalamaresui/widgets/ErrorDialog.h +++ b/src/libcalamaresui/widgets/ErrorDialog.h @@ -7,17 +7,16 @@ * */ -#ifndef ERRORDIALOG_H -#define ERRORDIALOG_H +#ifndef LIBCALAMARESUI_ERRORDIALOG_H +#define LIBCALAMARESUI_ERRORDIALOG_H #include - namespace Ui { class ErrorDialog; } -class QDialogButtonBox; + namespace Calamares { class ErrorDialog : public QDialog @@ -32,30 +31,46 @@ class ErrorDialog : public QDialog public: explicit ErrorDialog( QWidget* parent = nullptr ); - ~ErrorDialog(); + ~ErrorDialog() override; + /** @brief The heading (title) of the error dialog + * + * This is a short (one-line) title. It is human-readable, so should + * be translated at the time it is set. + */ QString heading() const; - - QString informativeText() const; - - QString details() const; - void setHeading( const QString& newHeading ); + /** @brief The description of the problem + * + * Longer, human-readable, description of the problem. This text + * is word-wrapped as necessary. + */ + QString informativeText() const; void setInformativeText( const QString& newInformativeText ); + /** @brief Details of the problem + * + * This is generally command-output; it might not be translated + * when set. It should be considered "background to the informative + * text", or maybe "the reasons". Write the informative text for + * the end-user. + */ + QString details() const; void setDetails( const QString& newDetails ); + /** @brief Enable web-paste button + * + * The web-paste button can be configured at a global level, + * but each individual error dialog can be set separately. + */ bool shouldOfferWebPaste() const; void setShouldOfferWebPaste( bool newShouldOfferWebPaste ); signals: void headingChanged(); - void informativeTextChanged(); - void detailsChanged(); - void shouldOfferWebPasteChanged(); private: @@ -65,4 +80,4 @@ private: }; // namespace Calamares -#endif // ERRORDIALOG_H +#endif // LIBCALAMARESUI_ERRORDIALOG_H From 2f9edb3e08019ed7db413daeffe79066822c8543 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 7 Dec 2021 12:44:19 +0100 Subject: [PATCH 25/45] [libcalamaresui] Code style --- src/libcalamaresui/widgets/ErrorDialog.cpp | 52 +++++++++++----------- 1 file changed, 25 insertions(+), 27 deletions(-) diff --git a/src/libcalamaresui/widgets/ErrorDialog.cpp b/src/libcalamaresui/widgets/ErrorDialog.cpp index 4ffe20384..8c682f964 100644 --- a/src/libcalamaresui/widgets/ErrorDialog.cpp +++ b/src/libcalamaresui/widgets/ErrorDialog.cpp @@ -17,7 +17,6 @@ namespace Calamares { - ErrorDialog::ErrorDialog( QWidget* parent ) : QDialog( parent ) , ui( new Ui::ErrorDialog ) @@ -33,7 +32,6 @@ ErrorDialog::~ErrorDialog() delete ui; } - QString ErrorDialog::heading() const { @@ -55,31 +53,32 @@ ErrorDialog::details() const void ErrorDialog::setHeading( const QString& newHeading ) { - if ( ui->headingLabel->text() == newHeading ) - return; - ui->headingLabel->setText( newHeading ); - emit headingChanged(); + if ( ui->headingLabel->text() != newHeading ) + { + ui->headingLabel->setText( newHeading ); + emit headingChanged(); + } } void ErrorDialog::setInformativeText( const QString& newInformativeText ) { - if ( ui->informativeTextLabel->text() == newInformativeText ) - return; - ui->informativeTextLabel->setText( newInformativeText ); - emit informativeTextChanged(); + if ( ui->informativeTextLabel->text() != newInformativeText ) + { + ui->informativeTextLabel->setText( newInformativeText ); + emit informativeTextChanged(); + } } void ErrorDialog::setDetails( const QString& newDetails ) { - if ( ui->detailsBrowser->toPlainText() == newDetails ) - return; - ui->detailsBrowser->setPlainText( newDetails ); - - ui->detailsWidget->setVisible( !ui->detailsBrowser->toPlainText().trimmed().isEmpty() ); - - emit detailsChanged(); + if ( ui->detailsBrowser->toPlainText() != newDetails ) + { + ui->detailsBrowser->setPlainText( newDetails ); + ui->detailsWidget->setVisible( !ui->detailsBrowser->toPlainText().trimmed().isEmpty() ); + emit detailsChanged(); + } } bool @@ -91,18 +90,17 @@ ErrorDialog::shouldOfferWebPaste() const void ErrorDialog::setShouldOfferWebPaste( bool newShouldOfferWebPaste ) { - if ( m_shouldOfferWebPaste == newShouldOfferWebPaste ) - return; - m_shouldOfferWebPaste = newShouldOfferWebPaste; + if ( m_shouldOfferWebPaste != newShouldOfferWebPaste ) + { + m_shouldOfferWebPaste = newShouldOfferWebPaste; - ui->offerWebPasteLabel->setVisible( m_shouldOfferWebPaste ); + ui->offerWebPasteLabel->setVisible( m_shouldOfferWebPaste ); + ui->buttonBox->setStandardButtons( m_shouldOfferWebPaste ? ( QDialogButtonBox::Yes | QDialogButtonBox::No ) + : QDialogButtonBox::Close ); + fixButtonLabels( ui->buttonBox ); - ui->buttonBox->setStandardButtons( m_shouldOfferWebPaste ? ( QDialogButtonBox::Yes | QDialogButtonBox::No ) - : QDialogButtonBox::Close ); - - fixButtonLabels( ui->buttonBox ); - - emit shouldOfferWebPasteChanged(); + emit shouldOfferWebPasteChanged(); + } } } // namespace Calamares From 3234de5753faaed5760a2354fbaa5e09614de3c3 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 7 Dec 2021 12:48:17 +0100 Subject: [PATCH 26/45] [libcalamaresui] Make web-paste decision more readable --- src/libcalamaresui/ViewManager.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/libcalamaresui/ViewManager.cpp b/src/libcalamaresui/ViewManager.cpp index e61859a13..5d4109ca2 100644 --- a/src/libcalamaresui/ViewManager.cpp +++ b/src/libcalamaresui/ViewManager.cpp @@ -152,9 +152,9 @@ ViewManager::insertViewStep( int before, ViewStep* step ) void ViewManager::onInstallationFailed( const QString& message, const QString& details ) { - bool shouldOfferWebPaste = std::get< 0 >( Calamares::Branding::instance()->uploadServer() ) - != Calamares::Branding::UploadServerType::None - and std::get< 2 >( Calamares::Branding::instance()->uploadServer() ) != 0; + const auto webPaste = Calamares::Branding::instance()->uploadServer(); + bool shouldOfferWebPaste + = std::get< 0 >( webPaste ) != Calamares::Branding::UploadServerType::None and std::get< 2 >( webPaste ) != 0; cError() << "Installation failed:" << message; cDebug() << Logger::SubEntry << "- message:" << message; From b07c9bb4af8f202a741286d2068e7e116a332c48 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 7 Dec 2021 12:53:43 +0100 Subject: [PATCH 27/45] [libcalamaresui] Use meaningful type for Upload info - use a struct with named fields instead of a tuple - offer an operator bool() for the logic of does-it-make-sense-to-upload --- src/libcalamaresui/Branding.cpp | 7 ++++--- src/libcalamaresui/Branding.h | 9 ++++++++- src/libcalamaresui/ViewManager.cpp | 4 +--- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/libcalamaresui/Branding.cpp b/src/libcalamaresui/Branding.cpp index 5894c723d..b723f5dc7 100644 --- a/src/libcalamaresui/Branding.cpp +++ b/src/libcalamaresui/Branding.cpp @@ -162,14 +162,15 @@ uploadServerFromMap( const QVariantMap& map ) if ( typestring.isEmpty() || urlstring.isEmpty() ) { - return Branding::UploadServerInfo( Branding::UploadServerType::None, QUrl(), 0 ); + return Branding::UploadServerInfo { Branding::UploadServerType::None, QUrl(), 0 }; } bool bogus = false; // we don't care about type-name lookup success here - return Branding::UploadServerInfo( + return Branding::UploadServerInfo { names.find( typestring, bogus ), QUrl( urlstring, QUrl::ParsingMode::StrictMode ), - sizeLimitKiB >= 0 ? CalamaresUtils::KiBtoBytes( static_cast< unsigned long long >( sizeLimitKiB ) ) : -1 ); + sizeLimitKiB >= 0 ? CalamaresUtils::KiBtoBytes( static_cast< unsigned long long >( sizeLimitKiB ) ) : -1 + }; } /** @brief Load the @p map with strings from @p config diff --git a/src/libcalamaresui/Branding.h b/src/libcalamaresui/Branding.h index ba49f87c3..899b14c78 100644 --- a/src/libcalamaresui/Branding.h +++ b/src/libcalamaresui/Branding.h @@ -227,7 +227,14 @@ public: * is irrelevant and usually empty), the URL for the upload and the size limit of upload * in bytes (for configuration value < 0, it serves -1, which stands for having no limit). */ - using UploadServerInfo = std::tuple< UploadServerType, QUrl, qint64 >; + struct UploadServerInfo + { + UploadServerType type; + QUrl url; + qint64 size; + + operator bool() const { return type != Calamares::Branding::UploadServerType::None && size != 0; } + }; UploadServerInfo uploadServer() const { return m_uploadServer; } /** diff --git a/src/libcalamaresui/ViewManager.cpp b/src/libcalamaresui/ViewManager.cpp index 5d4109ca2..0c0e324a1 100644 --- a/src/libcalamaresui/ViewManager.cpp +++ b/src/libcalamaresui/ViewManager.cpp @@ -152,9 +152,7 @@ ViewManager::insertViewStep( int before, ViewStep* step ) void ViewManager::onInstallationFailed( const QString& message, const QString& details ) { - const auto webPaste = Calamares::Branding::instance()->uploadServer(); - bool shouldOfferWebPaste - = std::get< 0 >( webPaste ) != Calamares::Branding::UploadServerType::None and std::get< 2 >( webPaste ) != 0; + bool shouldOfferWebPaste = bool( Calamares::Branding::instance()->uploadServer() ); cError() << "Installation failed:" << message; cDebug() << Logger::SubEntry << "- message:" << message; From 3030a710cce93646f558be27355a04b57c440443 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 7 Dec 2021 12:58:22 +0100 Subject: [PATCH 28/45] [libcalamaresui] Simplify --- src/libcalamaresui/ViewManager.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/libcalamaresui/ViewManager.cpp b/src/libcalamaresui/ViewManager.cpp index 0c0e324a1..44afafb15 100644 --- a/src/libcalamaresui/ViewManager.cpp +++ b/src/libcalamaresui/ViewManager.cpp @@ -152,8 +152,6 @@ ViewManager::insertViewStep( int before, ViewStep* step ) void ViewManager::onInstallationFailed( const QString& message, const QString& details ) { - bool shouldOfferWebPaste = bool( Calamares::Branding::instance()->uploadServer() ); - cError() << "Installation failed:" << message; cDebug() << Logger::SubEntry << "- message:" << message; cDebug() << Logger::SubEntry << "- details:" << Logger::NoQuote << details; @@ -165,7 +163,7 @@ ViewManager::onInstallationFailed( const QString& message, const QString& detail errorDialog->setWindowTitle( tr( "Error" ) ); errorDialog->setHeading( "" + heading + "" ); errorDialog->setInformativeText( message ); - errorDialog->setShouldOfferWebPaste( shouldOfferWebPaste ); + errorDialog->setShouldOfferWebPaste( Calamares::Branding::instance()->uploadServer() ); errorDialog->setDetails( details ); errorDialog->show(); From 8b804c4ae04bf2844a05c8ff679acfafae47c098 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 7 Dec 2021 14:15:43 +0100 Subject: [PATCH 29/45] [libcalamaresui] Improve icon+heading layout - Icon was too wide, heading and message placed off to the side --- src/libcalamaresui/widgets/ErrorDialog.ui | 87 +++++++++++++---------- 1 file changed, 50 insertions(+), 37 deletions(-) diff --git a/src/libcalamaresui/widgets/ErrorDialog.ui b/src/libcalamaresui/widgets/ErrorDialog.ui index 2632af617..cb480034e 100644 --- a/src/libcalamaresui/widgets/ErrorDialog.ui +++ b/src/libcalamaresui/widgets/ErrorDialog.ui @@ -11,25 +11,25 @@ - Dialog + Dialog - - - - - 0 - 0 - - - - - - - - + + + + + + 0 + 0 + + + + + + + @@ -43,27 +43,17 @@ - - - - - 0 - 0 - + + + + - + Would you like to paste the install log to the web? - - - - - - - - + Qt::Horizontal @@ -73,12 +63,35 @@ - - - - Would you like to paste the install log to the web? - - + + + + + + + 0 + 0 + + + + + + + + + + + + 0 + 0 + + + + + + + + From c2e63f4a6bad3dae76d72690e721950eb793177b Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 7 Dec 2021 14:20:31 +0100 Subject: [PATCH 30/45] [libcalamaresui] Don't bother tagging nonexistent 3rdparty sources --- src/libcalamaresui/CMakeLists.txt | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/libcalamaresui/CMakeLists.txt b/src/libcalamaresui/CMakeLists.txt index e745681f3..c5101cb61 100644 --- a/src/libcalamaresui/CMakeLists.txt +++ b/src/libcalamaresui/CMakeLists.txt @@ -40,8 +40,6 @@ set( calamaresui_SOURCES # Don't warn about third-party sources mark_thirdparty_code( - ${CMAKE_SOURCE_DIR}/3rdparty/qjsonitem.cpp - ${CMAKE_SOURCE_DIR}/3rdparty/qjsonmodel.cpp ${CMAKE_SOURCE_DIR}/3rdparty/waitingspinnerwidget.cpp ) @@ -76,8 +74,8 @@ calamares_add_library( calamaresui Qt5::Svg RESOURCES libcalamaresui.qrc EXPORT Calamares - UI - utils/ErrorDialog/ErrorDialog.ui + UI + utils/ErrorDialog/ErrorDialog.ui VERSION ${CALAMARES_VERSION_SHORT} ) target_link_libraries( calamaresui PRIVATE yamlcpp::yamlcpp ) From 0b6239a9961ba32560cbf6c931ef553b9cb0b15c Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 7 Dec 2021 14:28:43 +0100 Subject: [PATCH 31/45] [libcalamaresui] Warnings-- : we know TCP ports are 16 bit --- src/libcalamaresui/utils/Paste.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/libcalamaresui/utils/Paste.cpp b/src/libcalamaresui/utils/Paste.cpp index 519dc0133..d782d138e 100644 --- a/src/libcalamaresui/utils/Paste.cpp +++ b/src/libcalamaresui/utils/Paste.cpp @@ -69,7 +69,8 @@ STATICTEST QString ficheLogUpload( const QByteArray& pasteData, const QUrl& serverUrl, QObject* parent ) { QTcpSocket* socket = new QTcpSocket( parent ); - socket->connectToHost( serverUrl.host(), serverUrl.port() ); + // 16 bits of port-number + socket->connectToHost( serverUrl.host(), quint16( serverUrl.port() ) ); if ( !socket->waitForConnected() ) { From 32da51b44cae6fe560f860172da574aeda6ad661 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 7 Dec 2021 14:48:14 +0100 Subject: [PATCH 32/45] [libcalamares] Avoid warnings in Boost::Python macros --- src/libcalamares/PythonJob.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/libcalamares/PythonJob.cpp b/src/libcalamares/PythonJob.cpp index 291adbc54..b1373f5f3 100644 --- a/src/libcalamares/PythonJob.cpp +++ b/src/libcalamares/PythonJob.cpp @@ -23,6 +23,11 @@ static const char* s_preScript = nullptr; namespace bp = boost::python; +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdisabled-macro-expansion" +#endif + BOOST_PYTHON_FUNCTION_OVERLOADS( mount_overloads, CalamaresPython::mount, 2, 4 ); BOOST_PYTHON_FUNCTION_OVERLOADS( target_env_call_str_overloads, CalamaresPython::target_env_call, 1, 3 ); BOOST_PYTHON_FUNCTION_OVERLOADS( target_env_call_list_overloads, CalamaresPython::target_env_call, 1, 3 ); @@ -42,6 +47,10 @@ BOOST_PYTHON_FUNCTION_OVERLOADS( target_env_process_output_overloads, 4 ); BOOST_PYTHON_FUNCTION_OVERLOADS( host_env_process_output_overloads, CalamaresPython::host_env_process_output, 1, 4 ); +#ifdef __clang__ +#pragma clang diagnostic pop +#endif + BOOST_PYTHON_MODULE( libcalamares ) { bp::object package = bp::scope(); From eda85c176afe2781bc9ef0d5566d3d1fd7cc26f3 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 7 Dec 2021 15:01:29 +0100 Subject: [PATCH 33/45] [tracking] Avoid unused-deprecated-methods warnings - these are internal classes, with no real Qt machinery; remove the Q_OBJECT macros. - replace the tr() calls with calls with an explicit context, so that translations do not change. --- src/modules/tracking/TrackingJobs.cpp | 54 +++++++++++++++------------ 1 file changed, 30 insertions(+), 24 deletions(-) diff --git a/src/modules/tracking/TrackingJobs.cpp b/src/modules/tracking/TrackingJobs.cpp index 5e3cd12b5..7430bd57b 100644 --- a/src/modules/tracking/TrackingJobs.cpp +++ b/src/modules/tracking/TrackingJobs.cpp @@ -19,6 +19,8 @@ #include +#include + #include @@ -37,7 +39,6 @@ namespace */ class TrackingInstallJob : public Calamares::Job { - Q_OBJECT public: TrackingInstallJob( const QString& url ); ~TrackingInstallJob() override; @@ -58,7 +59,6 @@ private: */ class TrackingMachineUpdateManagerJob : public Calamares::Job { - Q_OBJECT public: ~TrackingMachineUpdateManagerJob() override; @@ -75,7 +75,6 @@ public: */ class TrackingKUserFeedbackJob : public Calamares::Job { - Q_OBJECT public: TrackingKUserFeedbackJob( const QString& username, const QStringList& areas ); ~TrackingKUserFeedbackJob() override; @@ -99,13 +98,13 @@ TrackingInstallJob::~TrackingInstallJob() {} QString TrackingInstallJob::prettyName() const { - return tr( "Installation feedback" ); + return QCoreApplication::translate( "TrackingInstallJob", "Installation feedback" ); } QString TrackingInstallJob::prettyStatusMessage() const { - return tr( "Sending installation feedback." ); + return QCoreApplication::translate( "TrackingInstallJob", "Sending installation feedback." ); } Calamares::JobResult @@ -122,8 +121,9 @@ TrackingInstallJob::exec() if ( result.status == RequestStatus::Timeout ) { cWarning() << "install-tracking request timed out."; - return Calamares::JobResult::error( tr( "Internal error in install-tracking." ), - tr( "HTTP request timed out." ) ); + return Calamares::JobResult::error( + QCoreApplication::translate( "TrackingInstallJob", "Internal error in install-tracking." ), + QCoreApplication::translate( "TrackingInstallJob", "HTTP request timed out." ) ); } return Calamares::JobResult::ok(); } @@ -133,13 +133,13 @@ TrackingMachineUpdateManagerJob::~TrackingMachineUpdateManagerJob() {} QString TrackingMachineUpdateManagerJob::prettyName() const { - return tr( "Machine feedback" ); + return QCoreApplication::translate( "TrackingMachineUpdateManagerJob", "Machine feedback" ); } QString TrackingMachineUpdateManagerJob::prettyStatusMessage() const { - return tr( "Configuring machine feedback." ); + return QCoreApplication::translate( "TrackingMachineUpdateManagerJob", "Configuring machine feedback." ); } Calamares::JobResult @@ -162,14 +162,20 @@ TrackingMachineUpdateManagerJob::exec() else if ( r > 0 ) { return Calamares::JobResult::error( - tr( "Error in machine feedback configuration." ), - tr( "Could not configure machine feedback correctly, script error %1." ).arg( r ) ); + QCoreApplication::translate( "TrackingMachineUpdateManagerJob", + "Error in machine feedback configuration." ), + QCoreApplication::translate( "TrackingMachineUpdateManagerJob", + "Could not configure machine feedback correctly, script error %1." ) + .arg( r ) ); } else { return Calamares::JobResult::error( - tr( "Error in machine feedback configuration." ), - tr( "Could not configure machine feedback correctly, Calamares error %1." ).arg( r ) ); + QCoreApplication::translate( "TrackingMachineUpdateManagerJob", + "Error in machine feedback configuration." ), + QCoreApplication::translate( "TrackingMachineUpdateManagerJob", + "Could not configure machine feedback correctly, Calamares error %1." ) + .arg( r ) ); } } @@ -184,13 +190,13 @@ TrackingKUserFeedbackJob::~TrackingKUserFeedbackJob() {} QString TrackingKUserFeedbackJob::prettyName() const { - return tr( "KDE user feedback" ); + return QCoreApplication::translate( "TrackingKUserFeedbackJob", "KDE user feedback" ); } QString TrackingKUserFeedbackJob::prettyStatusMessage() const { - return tr( "Configuring KDE user feedback." ); + return QCoreApplication::translate( "TrackingKUserFeedbackJob", "Configuring KDE user feedback." ); } Calamares::JobResult @@ -212,21 +218,25 @@ FeedbackLevel=16 if ( r > 0 ) { return Calamares::JobResult::error( - tr( "Error in KDE user feedback configuration." ), - tr( "Could not configure KDE user feedback correctly, script error %1." ).arg( r ) ); + QCoreApplication::translate( "TrackingKUserFeedbackJob", "Error in KDE user feedback configuration." ), + QCoreApplication::translate( "TrackingKUserFeedbackJob", + "Could not configure KDE user feedback correctly, script error %1." ) + .arg( r ) ); } else if ( r < 0 ) { return Calamares::JobResult::error( - tr( "Error in KDE user feedback configuration." ), - tr( "Could not configure KDE user feedback correctly, Calamares error %1." ).arg( r ) ); + QCoreApplication::translate( "TrackingKUserFeedbackJob", "Error in KDE user feedback configuration." ), + QCoreApplication::translate( "TrackingKUserFeedbackJob", + "Could not configure KDE user feedback correctly, Calamares error %1." ) + .arg( r ) ); } } return Calamares::JobResult::ok(); } -} // namespace +} // namespace void addJob( Calamares::JobList& list, InstallTrackingConfig* config ) @@ -290,7 +300,3 @@ addJob( Calamares::JobList& list, UserTrackingConfig* config ) } } } - -#include "utils/moc-warnings.h" - -#include "TrackingJobs.moc" From 5b0511035164e17c2da787f1183370b4892a8bac Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 7 Dec 2021 15:29:02 +0100 Subject: [PATCH 34/45] [partition] Add convenience function formatByteSize We want to use the KPMCore function consistently, but Calamares uses a qint64 most of the time. Centralize the cast to double in one place in the code. --- src/modules/partition/core/SizeUtils.h | 27 ++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 src/modules/partition/core/SizeUtils.h diff --git a/src/modules/partition/core/SizeUtils.h b/src/modules/partition/core/SizeUtils.h new file mode 100644 index 000000000..d474656c9 --- /dev/null +++ b/src/modules/partition/core/SizeUtils.h @@ -0,0 +1,27 @@ +/* === This file is part of Calamares - === + * + * SPDX-FileCopyrightText: 2021 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later + * + * Calamares is Free Software: see the License-Identifier above. + * + */ + +#ifndef PARTITION_CORE_SIZEUTILS_H +#define PARTITION_CORE_SIZEUTILS_H + +#include + +/** @brief Helper function for printing sizes consistently. + * + * Most of Calamares uses a qint64 for partition sizes, so use that + * parameter type. However, the human-visible formatting doesn't need + * to bother with one-byte accuracy (and anyway, a double has at least 50 bits + * at which point we're printing giga (or gibi) bytes). + */ +static inline QString formatByteSize( qint64 sizeValue ) +{ + return Capacity::formatByteSize( static_cast< double >( sizeValue ) ); +} + +#endif // PARTITION_CORE_SIZEUTILS_H From bb3f4442f5f5e203a3c0ce673cd362aadb02882c Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 7 Dec 2021 15:30:21 +0100 Subject: [PATCH 35/45] [partition] Warnings-reduction - use consistent size-formatting - needs an out-of-line virtual function --- src/modules/partition/gui/ListPhysicalVolumeWidgetItem.cpp | 7 ++++--- src/modules/partition/gui/ListPhysicalVolumeWidgetItem.h | 1 + 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/modules/partition/gui/ListPhysicalVolumeWidgetItem.cpp b/src/modules/partition/gui/ListPhysicalVolumeWidgetItem.cpp index 1e8a9e573..8eeafcbf4 100644 --- a/src/modules/partition/gui/ListPhysicalVolumeWidgetItem.cpp +++ b/src/modules/partition/gui/ListPhysicalVolumeWidgetItem.cpp @@ -9,11 +9,10 @@ #include "ListPhysicalVolumeWidgetItem.h" -#include +#include "core/SizeUtils.h" ListPhysicalVolumeWidgetItem::ListPhysicalVolumeWidgetItem( const Partition* partition, bool checked ) - : QListWidgetItem( - QString( "%1 | %2" ).arg( partition->deviceNode(), Capacity::formatByteSize( partition->capacity() ) ) ) + : QListWidgetItem( QString( "%1 | %2" ).arg( partition->deviceNode(), formatByteSize( partition->capacity() ) ) ) , m_partition( partition ) { setToolTip( partition->deviceNode() ); @@ -26,3 +25,5 @@ ListPhysicalVolumeWidgetItem::partition() const { return m_partition; } + +ListPhysicalVolumeWidgetItem::~ListPhysicalVolumeWidgetItem() {} diff --git a/src/modules/partition/gui/ListPhysicalVolumeWidgetItem.h b/src/modules/partition/gui/ListPhysicalVolumeWidgetItem.h index 6e0b1c85a..5d7fdcb76 100644 --- a/src/modules/partition/gui/ListPhysicalVolumeWidgetItem.h +++ b/src/modules/partition/gui/ListPhysicalVolumeWidgetItem.h @@ -18,6 +18,7 @@ class ListPhysicalVolumeWidgetItem : public QListWidgetItem { public: ListPhysicalVolumeWidgetItem( const Partition* partition, bool checked ); + ~ListPhysicalVolumeWidgetItem() override; const Partition* partition() const; From 09a03fbbc0356f1fdd24de28715f4b8dc183d236 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 7 Dec 2021 15:31:49 +0100 Subject: [PATCH 36/45] [partition] Warnings--: we don't care about one-byte-in-10^12 --- src/modules/partition/gui/ReplaceWidget.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/modules/partition/gui/ReplaceWidget.cpp b/src/modules/partition/gui/ReplaceWidget.cpp index 94f527646..2e5675a11 100644 --- a/src/modules/partition/gui/ReplaceWidget.cpp +++ b/src/modules/partition/gui/ReplaceWidget.cpp @@ -212,7 +212,8 @@ ReplaceWidget::onPartitionSelected() } } - if ( partition->capacity() < requiredSpaceB ) + // The loss of precision is ok; we're not going to fall over from a single byte + if ( static_cast< double >( partition->capacity() ) < requiredSpaceB ) { updateStatus( CalamaresUtils::Fail, tr( "%4

" From 6e715205d785f63a997d48aaa59d9be6de44705b Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 7 Dec 2021 15:36:11 +0100 Subject: [PATCH 37/45] [partition] Warnings-- by calling formatting consistently --- src/modules/partition/core/DeviceModel.cpp | 8 +++----- src/modules/partition/core/PartitionModel.cpp | 10 ++++------ src/modules/partition/gui/PartitionLabelsView.cpp | 5 ++--- src/modules/partition/gui/VolumeGroupBaseDialog.cpp | 7 +++---- 4 files changed, 12 insertions(+), 18 deletions(-) diff --git a/src/modules/partition/core/DeviceModel.cpp b/src/modules/partition/core/DeviceModel.cpp index 33aae20c0..25bdbff6c 100644 --- a/src/modules/partition/core/DeviceModel.cpp +++ b/src/modules/partition/core/DeviceModel.cpp @@ -8,9 +8,10 @@ * Calamares is Free Software: see the License-Identifier above. * */ -#include "core/DeviceModel.h" +#include "DeviceModel.h" #include "core/PartitionModel.h" +#include "core/SizeUtils.h" #include "utils/CalamaresUtilsGui.h" #include "utils/Logger.h" @@ -18,9 +19,6 @@ // KPMcore #include -// KF5 -#include - #include #include @@ -83,7 +81,7 @@ DeviceModel::data( const QModelIndex& index, int role ) const //: device[name] - size[number] (device-node[name]) return tr( "%1 - %2 (%3)" ) .arg( device->name() ) - .arg( KFormat().formatByteSize( device->capacity() ) ) + .arg( formatByteSize( device->capacity() ) ) .arg( device->deviceNode() ); } else diff --git a/src/modules/partition/core/PartitionModel.cpp b/src/modules/partition/core/PartitionModel.cpp index e310eee5e..19dbcd076 100644 --- a/src/modules/partition/core/PartitionModel.cpp +++ b/src/modules/partition/core/PartitionModel.cpp @@ -8,11 +8,12 @@ * */ -#include "core/PartitionModel.h" +#include "PartitionModel.h" #include "core/ColorUtils.h" #include "core/KPMHelpers.h" #include "core/PartitionInfo.h" +#include "core/SizeUtils.h" #include "partition/FileSystem.h" #include "partition/PartitionQuery.h" @@ -24,9 +25,6 @@ #include #include -// KF5 -#include - // Qt #include @@ -178,7 +176,7 @@ PartitionModel::data( const QModelIndex& index, int role ) const if ( col == SizeColumn ) { qint64 size = ( partition->lastSector() - partition->firstSector() + 1 ) * m_device->logicalSize(); - return KFormat().formatByteSize( size ); + return formatByteSize( size ); } cDebug() << "Unknown column" << col; return QVariant(); @@ -210,7 +208,7 @@ PartitionModel::data( const QModelIndex& index, int role ) const QString prettyFileSystem = CalamaresUtils::Partition::prettyNameForFileSystemType( partition->fileSystem().type() ); qint64 size = ( partition->lastSector() - partition->firstSector() + 1 ) * m_device->logicalSize(); - QString prettySize = KFormat().formatByteSize( size ); + QString prettySize = formatByteSize( size ); return QVariant( name + " " + prettyFileSystem + " " + prettySize ); } case SizeRole: diff --git a/src/modules/partition/gui/PartitionLabelsView.cpp b/src/modules/partition/gui/PartitionLabelsView.cpp index 5803d59a2..e73d7f4af 100644 --- a/src/modules/partition/gui/PartitionLabelsView.cpp +++ b/src/modules/partition/gui/PartitionLabelsView.cpp @@ -12,6 +12,7 @@ #include "core/ColorUtils.h" #include "core/PartitionModel.h" +#include "core/SizeUtils.h" #include "utils/CalamaresUtilsGui.h" #include "utils/Logger.h" @@ -20,8 +21,6 @@ #include #include -#include - // Qt #include #include @@ -39,7 +38,7 @@ static QStringList buildUnknownDisklabelTexts( Device* dev ) { QStringList texts = { QObject::tr( "Unpartitioned space or unknown partition table" ), - KFormat().formatByteSize( dev->totalLogical() * dev->logicalSize() ) }; + formatByteSize( dev->totalLogical() * dev->logicalSize() ) }; return texts; } diff --git a/src/modules/partition/gui/VolumeGroupBaseDialog.cpp b/src/modules/partition/gui/VolumeGroupBaseDialog.cpp index 6277c30e5..48b44f68d 100644 --- a/src/modules/partition/gui/VolumeGroupBaseDialog.cpp +++ b/src/modules/partition/gui/VolumeGroupBaseDialog.cpp @@ -10,10 +10,9 @@ #include "VolumeGroupBaseDialog.h" #include "ui_VolumeGroupBaseDialog.h" +#include "core/SizeUtils.h" #include "gui/ListPhysicalVolumeWidgetItem.h" -#include - #include #include #include @@ -100,7 +99,7 @@ VolumeGroupBaseDialog::setUsedSizeValue( qint64 usedSize ) { m_usedSizeValue = usedSize; - ui->usedSize->setText( Capacity::formatByteSize( m_usedSizeValue ) ); + ui->usedSize->setText( formatByteSize( m_usedSizeValue ) ); } void @@ -121,7 +120,7 @@ VolumeGroupBaseDialog::updateTotalSize() % ( ui->peSize->value() * Capacity::unitFactor( Capacity::Unit::Byte, Capacity::Unit::MiB ) ); } - ui->totalSize->setText( Capacity::formatByteSize( m_totalSizeValue ) ); + ui->totalSize->setText( formatByteSize( m_totalSizeValue ) ); updateTotalSectors(); } From 4611545f93a2aafe8aea927a547c0df59c1f804c Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 7 Dec 2021 15:42:14 +0100 Subject: [PATCH 38/45] [libcalamares] Warnings-- on switch() - some switch statements handle a bunch of items explicitly, then default the rest. Clang complains about that. Turn off the warning for these specific switches, since there's dozens of values that simply do not need to be handled. --- src/libcalamares/PythonHelper.cpp | 8 ++++++++ src/libcalamares/partition/FileSystem.cpp | 16 ++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/src/libcalamares/PythonHelper.cpp b/src/libcalamares/PythonHelper.cpp index d6e61b3aa..ca004ab5f 100644 --- a/src/libcalamares/PythonHelper.cpp +++ b/src/libcalamares/PythonHelper.cpp @@ -26,6 +26,11 @@ namespace CalamaresPython boost::python::object variantToPyObject( const QVariant& variant ) { +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wswitch-enum" +#endif + // 49 enumeration values not handled switch ( variant.type() ) { case QVariant::Map: @@ -62,6 +67,9 @@ variantToPyObject( const QVariant& variant ) default: return bp::object(); } +#ifdef __clang__ +#pragma clang diagnostic pop +#endif } diff --git a/src/libcalamares/partition/FileSystem.cpp b/src/libcalamares/partition/FileSystem.cpp index ad4df31ed..0dcd6fd32 100644 --- a/src/libcalamares/partition/FileSystem.cpp +++ b/src/libcalamares/partition/FileSystem.cpp @@ -22,6 +22,11 @@ namespace Partition QString prettyNameForFileSystemType( FileSystem::Type t ) { +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wswitch-enum" +#endif + // 13 enumeration values not handled switch ( t ) { case FileSystem::Unknown: @@ -60,11 +65,19 @@ prettyNameForFileSystemType( FileSystem::Type t ) default: return FileSystem::nameForType( t ); } +#ifdef __clang__ +#pragma clang diagnostic pop +#endif } QString untranslatedFS( FileSystem::Type t ) { +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wswitch-enum" +#endif + // 34 enumeration values not handled switch ( t ) { case FileSystem::Type::ReiserFS: @@ -72,6 +85,9 @@ untranslatedFS( FileSystem::Type t ) default: return FileSystem::nameForType( t, { QStringLiteral( "C" ) } ); } +#ifdef __clang__ +#pragma clang diagnostic pop +#endif } } // namespace Partition From 09f47b576285001ca2fabb7e034d66b5a5404b91 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 7 Dec 2021 15:51:45 +0100 Subject: [PATCH 39/45] [partition] Build tests with consistent flags (in particular, KPMCore4-API flags) --- src/modules/partition/tests/CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/modules/partition/tests/CMakeLists.txt b/src/modules/partition/tests/CMakeLists.txt index 2839270fb..da017d96f 100644 --- a/src/modules/partition/tests/CMakeLists.txt +++ b/src/modules/partition/tests/CMakeLists.txt @@ -61,6 +61,7 @@ calamares_add_test( SOURCES ${PartitionModule_SOURCE_DIR}/jobs/AutoMountManagementJob.cpp AutoMountTests.cpp + DEFINITIONS ${_partition_defs} ) calamares_add_test( @@ -70,4 +71,5 @@ calamares_add_test( ${PartitionModule_SOURCE_DIR}/core/DeviceList.cpp LIBRARIES kpmcore + DEFINITIONS ${_partition_defs} ) From 1197d8c750ad20bedf7d3a9ed3c55c77ec7bf13a Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 7 Dec 2021 18:19:32 +0100 Subject: [PATCH 40/45] [interactiveterminal] Warnings-- with KF5 5.86-or-later --- .../InteractiveTerminalPage.cpp | 28 +++++++++++++------ 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/src/modules/interactiveterminal/InteractiveTerminalPage.cpp b/src/modules/interactiveterminal/InteractiveTerminalPage.cpp index afd39936b..ea30c21ef 100644 --- a/src/modules/interactiveterminal/InteractiveTerminalPage.cpp +++ b/src/modules/interactiveterminal/InteractiveTerminalPage.cpp @@ -18,6 +18,7 @@ #include #include #include +#include #include #include @@ -41,8 +42,10 @@ InteractiveTerminalPage::InteractiveTerminalPage( QWidget* parent ) void InteractiveTerminalPage::errorKonsoleNotInstalled() { - QMessageBox mb(QMessageBox::Critical, - tr( "Konsole not installed" ), tr( "Please install KDE Konsole and try again!" ), QMessageBox::Ok ); + QMessageBox mb( QMessageBox::Critical, + tr( "Konsole not installed" ), + tr( "Please install KDE Konsole and try again!" ), + QMessageBox::Ok ); Calamares::fixButtonLabels( &mb ); mb.exec(); } @@ -54,20 +57,30 @@ InteractiveTerminalPage::onActivate() { return; } - // For whatever reason, instead of simply linking against a library we - // need to do a runtime query to KService just to get a sodding terminal - // widget. + +#if KCOREADDONS_VERSION_MAJOR != 5 +#error Incompatible with not-KF5 +#endif +#if KCOREADDONS_VERSION_MINOR >= 86 + // 5.86 deprecated a bunch of KService and PluginFactory and related methods + auto md = KPluginMetaData::findPluginById( QString(), "konsolepart" ); + if ( !md.isValid() ) + { + errorKonsoleNotInstalled(); + return; + } + auto* p = KPluginFactory::instantiatePlugin< KParts::ReadOnlyPart >( md, this ).plugin; +#else KService::Ptr service = KService::serviceByDesktopName( "konsolepart" ); if ( !service ) { - // And all of this hoping the Konsole application is installed. If not, - // tough cookies. errorKonsoleNotInstalled(); return; } // Create one instance of konsolepart. KParts::ReadOnlyPart* p = service->createInstance< KParts::ReadOnlyPart >( this, this, {} ); +#endif if ( !p ) { // One more opportunity for the loading operation to fail. @@ -91,7 +104,6 @@ InteractiveTerminalPage::onActivate() m_termHostWidget = p->widget(); m_layout->addWidget( m_termHostWidget ); - cDebug() << "Part widget ought to be" << m_termHostWidget->metaObject()->className(); t->showShellInDir( QDir::home().path() ); t->sendInput( QString( "%1\n" ).arg( m_command ) ); From 13700b18c8ecf5f7ee44e266ef5b45e0eb750243 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Wed, 8 Dec 2021 00:06:17 +0100 Subject: [PATCH 41/45] [partition] Warnings-- - remove superfluous `break` - massage types around partition sizes --- src/modules/partition/PartitionViewStep.cpp | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/modules/partition/PartitionViewStep.cpp b/src/modules/partition/PartitionViewStep.cpp index a6b5e1dd8..18f10d629 100644 --- a/src/modules/partition/PartitionViewStep.cpp +++ b/src/modules/partition/PartitionViewStep.cpp @@ -146,15 +146,12 @@ modeDescription( Config::InstallChoice choice ) case Config::InstallChoice::Alongside: return QCoreApplication::translate( context, "Install %1 alongside another operating system." ) .arg( branding->shortVersionedName() ); - break; case Config::InstallChoice::Erase: return QCoreApplication::translate( context, "Erase disk and install %1." ) .arg( branding->shortVersionedName() ); - break; case Config::InstallChoice::Replace: return QCoreApplication::translate( context, "Replace a partition with %1." ) .arg( branding->shortVersionedName() ); - break; case Config::InstallChoice::NoChoice: case Config::InstallChoice::Manual: return QCoreApplication::translate( context, "Manual partitioning." ); @@ -187,21 +184,18 @@ diskDescription( int listLength, const PartitionCoreModule::SummaryInfo& info, C .arg( branding->shortVersionedName() ) .arg( info.deviceNode ) .arg( info.deviceName ); - break; case Config::Erase: return QCoreApplication::translate( context, "Erase disk %2 (%3) and install %1." ) .arg( branding->shortVersionedName() ) .arg( info.deviceNode ) .arg( info.deviceName ); - break; case Config::Replace: return QCoreApplication::translate( context, "Replace a partition on disk %2 (%3) with %1." ) .arg( branding->shortVersionedName() ) .arg( info.deviceNode ) .arg( info.deviceName ); - break; case Config::NoChoice: case Config::Manual: return QCoreApplication::translate( @@ -558,7 +552,7 @@ PartitionViewStep::onLeave() if ( !okSize ) { cDebug() << o << "ESP too small"; - const auto atLeastBytes = PartUtils::efiFilesystemMinimumSize(); + const qint64 atLeastBytes = static_cast< qint64 >( PartUtils::efiFilesystemMinimumSize() ); const auto atLeastMiB = CalamaresUtils::BytesToMiB( atLeastBytes ); description.append( ' ' ); description.append( tr( "The filesystem must be at least %1 MiB in size." ).arg( atLeastMiB ) ); From e8ca298712461c694269300422964905ed944af1 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Wed, 8 Dec 2021 00:15:01 +0100 Subject: [PATCH 42/45] [partition] Reduce warnings --- src/modules/partition/core/PartUtils.cpp | 8 ++++++-- src/modules/partition/core/PartitionActions.cpp | 6 +++--- src/modules/partition/core/PartitionLayout.cpp | 3 +++ 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/modules/partition/core/PartUtils.cpp b/src/modules/partition/core/PartUtils.cpp index 507330a80..cb7c8a01d 100644 --- a/src/modules/partition/core/PartUtils.cpp +++ b/src/modules/partition/core/PartUtils.cpp @@ -451,6 +451,8 @@ isEfiFilesystemSuitableType( const Partition* candidate ) { auto type = candidate->fileSystem().type(); + QT_WARNING_PUSH + QT_WARNING_DISABLE_CLANG( "-Wswitch-enum" ) switch ( type ) { case FileSystem::Type::Fat32: @@ -465,6 +467,7 @@ isEfiFilesystemSuitableType( const Partition* candidate ) cWarning() << "EFI boot partition must be FAT32"; return false; } + QT_WARNING_POP } bool @@ -526,14 +529,15 @@ efiFilesystemMinimumSize() { using CalamaresUtils::Units::operator""_MiB; - auto uefisys_part_sizeB = 300_MiB; + size_t uefisys_part_sizeB = 300_MiB; // The default can be overridden; the key used here comes // from the partition module Config.cpp auto* gs = Calamares::JobQueue::instance()->globalStorage(); if ( gs->contains( "efiSystemPartitionSize_i" ) ) { - uefisys_part_sizeB = gs->value( "efiSystemPartitionSize_i" ).toLongLong(); + qint64 v = gs->value( "efiSystemPartitionSize_i" ).toLongLong(); + uefisys_part_sizeB = v > 0 ? static_cast< size_t >( v ) : 0; } // There is a lower limit of what can be configured if ( uefisys_part_sizeB < 32_MiB ) diff --git a/src/modules/partition/core/PartitionActions.cpp b/src/modules/partition/core/PartitionActions.cpp index 8514bbe2c..8226499b4 100644 --- a/src/modules/partition/core/PartitionActions.cpp +++ b/src/modules/partition/core/PartitionActions.cpp @@ -71,15 +71,15 @@ swapSuggestion( const qint64 availableSpaceB, Config::SwapChoice swap ) // Allow for a fudge factor - suggestedSwapSizeB *= overestimationFactor; + suggestedSwapSizeB = qRound( suggestedSwapSizeB * overestimationFactor ); // don't use more than 10% of available space if ( !ensureSuspendToDisk ) { - suggestedSwapSizeB = qMin( suggestedSwapSizeB, qint64( 0.10 * availableSpaceB ) ); + suggestedSwapSizeB = qMin( suggestedSwapSizeB, availableSpaceB / 10 /* 10% is 0.1 */ ); } - cDebug() << "Suggested swap size:" << suggestedSwapSizeB / 1024. / 1024. / 1024. << "GiB"; + cDebug() << "Suggested swap size:" << CalamaresUtils::BytesToGiB( suggestedSwapSizeB ) << "GiB"; return suggestedSwapSizeB; } diff --git a/src/modules/partition/core/PartitionLayout.cpp b/src/modules/partition/core/PartitionLayout.cpp index f60952643..3813207ef 100644 --- a/src/modules/partition/core/PartitionLayout.cpp +++ b/src/modules/partition/core/PartitionLayout.cpp @@ -141,6 +141,8 @@ void PartitionLayout::setDefaultFsType( FileSystem::Type defaultFsType ) { using FileSystem = FileSystem::Type; + QT_WARNING_PUSH + QT_WARNING_DISABLE_CLANG( "-Wswitch-enum" ) switch ( defaultFsType ) { case FileSystem::Unknown: @@ -196,6 +198,7 @@ PartitionLayout::setDefaultFsType( FileSystem::Type defaultFsType ) << "Using ext4 instead."; defaultFsType = FileSystem::Ext4; } + QT_WARNING_POP m_defaultFsType = defaultFsType; } From f0eb7ffbda5f6844c864ee0d5269a54445bbab6e Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Wed, 8 Dec 2021 00:59:20 +0100 Subject: [PATCH 43/45] [partition Untangle, Warnings-- The translations apply to labels and a tooltip, which depends on the partition-table type. Move the strings together and make the whole range of the switch explicitly. --- .../partition/gui/DeviceInfoWidget.cpp | 83 ++++++++++--------- 1 file changed, 46 insertions(+), 37 deletions(-) diff --git a/src/modules/partition/gui/DeviceInfoWidget.cpp b/src/modules/partition/gui/DeviceInfoWidget.cpp index bbc8ce74c..05a8c4b63 100644 --- a/src/modules/partition/gui/DeviceInfoWidget.cpp +++ b/src/modules/partition/gui/DeviceInfoWidget.cpp @@ -68,7 +68,8 @@ DeviceInfoWidget::setPartitionTableType( PartitionTable::TableType type ) void DeviceInfoWidget::retranslateUi() { - QString typeString = PartitionTable::tableTypeToName( m_tableType ).toUpper(); + QString typeString; + QString toolTipString; // fix up if the name shouldn't be uppercase: switch ( m_tableType ) @@ -76,38 +77,32 @@ DeviceInfoWidget::retranslateUi() case PartitionTable::msdos: case PartitionTable::msdos_sectorbased: typeString = "MBR"; + toolTipString += tr( "

This partition table type is only advisable on older " + "systems which start from a BIOS boot " + "environment. GPT is recommended in most other cases.

" + "Warning: the MBR partition table " + "is an obsolete MS-DOS era standard.
" + "Only 4 primary partitions may be created, and of " + "those 4, one can be an extended partition, which " + "may in turn contain many logical partitions." ); + break; + case PartitionTable::gpt: + // TypeString is ok + toolTipString += tr( "

This is the recommended partition table type for modern " + "systems which start from an EFI boot " + "environment." ); break; case PartitionTable::loop: typeString = "loop"; - break; - case PartitionTable::mac: - typeString = "Mac"; - break; - case PartitionTable::amiga: - typeString = "Amiga"; - break; - case PartitionTable::sun: - typeString = "Sun"; - break; - case PartitionTable::unknownTableType: - typeString = " ? "; - } - - - QString toolTipString = tr( "This device has a %1 partition " - "table." ) - .arg( typeString ); - - switch ( m_tableType ) - { - case PartitionTable::loop: toolTipString = tr( "This is a loop " "device.

" "It is a pseudo-device with no partition table " "that makes a file accessible as a block device. " "This kind of setup usually only contains a single filesystem." ); break; + case PartitionTable::none: case PartitionTable::unknownTableType: + typeString = " ? "; toolTipString = tr( "This installer cannot detect a partition table on the " "selected storage device.

" "The device either has no partition " @@ -117,21 +112,35 @@ DeviceInfoWidget::retranslateUi() "either automatically, or through the manual partitioning " "page." ); break; - case PartitionTable::gpt: - toolTipString += tr( "

This is the recommended partition table type for modern " - "systems which start from an EFI boot " - "environment." ); + // The next ones need to have the name adjusted, but the default tooltip is OK + case PartitionTable::mac: + typeString = "Mac"; break; - case PartitionTable::msdos: - case PartitionTable::msdos_sectorbased: - toolTipString += tr( "

This partition table type is only advisable on older " - "systems which start from a BIOS boot " - "environment. GPT is recommended in most other cases.

" - "Warning: the MBR partition table " - "is an obsolete MS-DOS era standard.
" - "Only 4 primary partitions may be created, and of " - "those 4, one can be an extended partition, which " - "may in turn contain many logical partitions." ); + case PartitionTable::amiga: + typeString = "Amiga"; + break; + case PartitionTable::sun: + typeString = "Sun"; + break; + // Peculiar tables, do nothing and use default type and tooltip strings + case PartitionTable::aix: + case PartitionTable::bsd: + case PartitionTable::dasd: + case PartitionTable::dvh: + case PartitionTable::pc98: + case PartitionTable::vmd: + break; + } + + if ( typeString.isEmpty() ) + { + typeString = PartitionTable::tableTypeToName( m_tableType ).toUpper(); + } + if ( toolTipString.isEmpty() ) + { + toolTipString = tr( "This device has a %1 partition " + "table." ) + .arg( typeString ); } m_ptLabel->setText( typeString ); From 043bdc36d683e6619acc336879d7c102c2a0485b Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Wed, 8 Dec 2021 01:02:27 +0100 Subject: [PATCH 44/45] Changes: document contributors --- CHANGES-3.2 | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGES-3.2 b/CHANGES-3.2 index 81fd55343..b658191fb 100644 --- a/CHANGES-3.2 +++ b/CHANGES-3.2 @@ -10,10 +10,13 @@ website will have to do for older versions. # 3.2.49 (unreleased) # This release contains contributions from (alphabetically by first name): + - Artem Grinev - Evan James ## Core ## - - No core changes yet + - Errors (e.g. when an installation fails for whatever reason) are displayed + in a dialog with a scrollable details panel, rather than growing up + to the size of the screen. (Thanks Artem) ## Modules ## - *partition* now supports "deep" btrfs subvolume names, e.g. a From bb948c47dc447c0a01c9d2ecbadeb3aa060bdb77 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Wed, 8 Dec 2021 13:06:53 +0100 Subject: [PATCH 45/45] [fstab] Cut the example btrfs flags to 'defaults' Testing shows that the flags can influence -- maybe cause -- data corruption when noatime is set. FIXES #1846 --- src/modules/fstab/fstab.conf | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/modules/fstab/fstab.conf b/src/modules/fstab/fstab.conf index c05f1929a..560aa0073 100644 --- a/src/modules/fstab/fstab.conf +++ b/src/modules/fstab/fstab.conf @@ -18,10 +18,16 @@ # # btrfs_swap options are used when a swapfile is chosen with a btrfs root # the options are applied to the subvolume which holds the swap partition +# +# The settings shown here apply only the btrfs defaults; these +# are generally the right ones. Commented-out lines show other +# options wich **might** be applicable for specific situations. mountOptions: default: defaults,noatime - btrfs: defaults,noatime,autodefrag,compress=zstd - btrfs_swap: defaults,noatime + # btrfs: defaults,noatime,autodefrag,compress=zstd + btrfs: defaults + # btrfs_swap: defaults,noatime + btrfs_swap: defaults # Mount options to use for the EFI System Partition. If not defined, the # *mountOptions* for *vfat* are used, or if that is not set either,