From 1a1009a2a9e866bc596ba7d701549fa58b1df1e7 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Fri, 3 Sep 2021 17:07:32 +0200 Subject: [PATCH 1/8] [summaryq] add SPDX-tags --- src/modules/summaryq/CMakeLists.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/modules/summaryq/CMakeLists.txt b/src/modules/summaryq/CMakeLists.txt index cdf520b24..8aac1bc2f 100644 --- a/src/modules/summaryq/CMakeLists.txt +++ b/src/modules/summaryq/CMakeLists.txt @@ -1,3 +1,8 @@ +# === This file is part of Calamares - === +# +# SPDX-FileCopyrightText: 2021 Anke Boersma +# SPDX-License-Identifier: BSD-2-Clause +# if( NOT WITH_QML ) calamares_skip_module( "summaryq (QML is not supported in this build)" ) return() From 47c504df5daed636664ec1828b4b6dd0051627a4 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Fri, 3 Sep 2021 17:07:49 +0200 Subject: [PATCH 2/8] [welcome] add SPDX-tags to test-data --- src/modules/welcome/tests/1a-checkinternet.conf | 2 ++ src/modules/welcome/tests/1b-checkinternet.conf | 3 +++ src/modules/welcome/tests/1c-checkinternet.conf | 3 +++ src/modules/welcome/tests/1d-checkinternet.conf | 3 +++ src/modules/welcome/tests/1e-checkinternet.conf | 3 +++ src/modules/welcome/tests/1f-checkinternet.conf | 6 +++++- src/modules/welcome/tests/1g-checkinternet.conf | 4 ++++ src/modules/welcome/tests/1h-checkinternet.conf | 5 ++++- 8 files changed, 27 insertions(+), 2 deletions(-) diff --git a/src/modules/welcome/tests/1a-checkinternet.conf b/src/modules/welcome/tests/1a-checkinternet.conf index d2140f201..d10a97d2a 100644 --- a/src/modules/welcome/tests/1a-checkinternet.conf +++ b/src/modules/welcome/tests/1a-checkinternet.conf @@ -1,3 +1,5 @@ +# SPDX-FileCopyrightText: no +# SPDX-License-Identifier: CC0-1.0 --- requirements: internetCheckUrl: http://example.com diff --git a/src/modules/welcome/tests/1b-checkinternet.conf b/src/modules/welcome/tests/1b-checkinternet.conf index a1e656985..7cb9b4206 100644 --- a/src/modules/welcome/tests/1b-checkinternet.conf +++ b/src/modules/welcome/tests/1b-checkinternet.conf @@ -1,3 +1,6 @@ +# SPDX-FileCopyrightText: no +# SPDX-License-Identifier: CC0-1.0 +# # Nothing at all --- bogus: 1 diff --git a/src/modules/welcome/tests/1c-checkinternet.conf b/src/modules/welcome/tests/1c-checkinternet.conf index 845e253c0..6dbfb8f37 100644 --- a/src/modules/welcome/tests/1c-checkinternet.conf +++ b/src/modules/welcome/tests/1c-checkinternet.conf @@ -1,3 +1,6 @@ +# SPDX-FileCopyrightText: no +# SPDX-License-Identifier: CC0-1.0 +# # Set to blank --- requirements: diff --git a/src/modules/welcome/tests/1d-checkinternet.conf b/src/modules/welcome/tests/1d-checkinternet.conf index 9a44d7c93..0f5896ce1 100644 --- a/src/modules/welcome/tests/1d-checkinternet.conf +++ b/src/modules/welcome/tests/1d-checkinternet.conf @@ -1,3 +1,6 @@ +# SPDX-FileCopyrightText: no +# SPDX-License-Identifier: CC0-1.0 +# # Set to something broken --- requirements: diff --git a/src/modules/welcome/tests/1e-checkinternet.conf b/src/modules/welcome/tests/1e-checkinternet.conf index 579414a79..98ff62695 100644 --- a/src/modules/welcome/tests/1e-checkinternet.conf +++ b/src/modules/welcome/tests/1e-checkinternet.conf @@ -1,3 +1,6 @@ +# SPDX-FileCopyrightText: no +# SPDX-License-Identifier: CC0-1.0 +# # Empty list --- requirements: diff --git a/src/modules/welcome/tests/1f-checkinternet.conf b/src/modules/welcome/tests/1f-checkinternet.conf index 660760381..158025c62 100644 --- a/src/modules/welcome/tests/1f-checkinternet.conf +++ b/src/modules/welcome/tests/1f-checkinternet.conf @@ -1,6 +1,10 @@ +# SPDX-FileCopyrightText: no +# SPDX-License-Identifier: CC0-1.0 +# +# Multiple, all valid --- requirements: - internetCheckUrl: + internetCheckUrl: - http://example.com - http://bogus.example.com - http://nonexistent.example.com diff --git a/src/modules/welcome/tests/1g-checkinternet.conf b/src/modules/welcome/tests/1g-checkinternet.conf index dd3ddae0c..1f4477f9f 100644 --- a/src/modules/welcome/tests/1g-checkinternet.conf +++ b/src/modules/welcome/tests/1g-checkinternet.conf @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: no +# SPDX-License-Identifier: CC0-1.0 +# +# Multiple, all valid, in short-list form --- requirements: internetCheckUrl: [ http://example.com, http://bogus.example.com, http://nonexistent.example.com ] diff --git a/src/modules/welcome/tests/1h-checkinternet.conf b/src/modules/welcome/tests/1h-checkinternet.conf index 928360c20..4984cf12b 100644 --- a/src/modules/welcome/tests/1h-checkinternet.conf +++ b/src/modules/welcome/tests/1h-checkinternet.conf @@ -1,7 +1,10 @@ +# SPDX-FileCopyrightText: no +# SPDX-License-Identifier: CC0-1.0 +# # "0" is a valid URL (?) but "" is not --- requirements: - internetCheckUrl: + internetCheckUrl: - http://example.com - 0 - "" From c367731c42f5fd1cdeb9206c0010ff7ad98bf3c4 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Fri, 3 Sep 2021 17:29:21 +0200 Subject: [PATCH 3/8] [packagechooser] Rename internals - pkgc -> packageChoice and similar for methods, variables - document that this is the convenience value for one-selection QML modules, not a full model - use std::optional to keep track of which one is being used. --- src/modules/packagechooser/Config.cpp | 23 +++++++++++++++-------- src/modules/packagechooser/Config.h | 26 ++++++++++++++++++++------ 2 files changed, 35 insertions(+), 14 deletions(-) diff --git a/src/modules/packagechooser/Config.cpp b/src/modules/packagechooser/Config.cpp index f66f16824..2c798ea03 100644 --- a/src/modules/packagechooser/Config.cpp +++ b/src/modules/packagechooser/Config.cpp @@ -100,10 +100,10 @@ Config::updateGlobalStorage( const QStringList& selected ) const { if ( m_method == PackageChooserMethod::Legacy ) { - //QString value = selected.join( ',' ); - QString value = ( m_pkgc ); + QString value = selected.join( ',' ); + // QString value = ( m_pkgc ); Calamares::JobQueue::instance()->globalStorage()->insert( m_id, value ); - cDebug() << m_id<< "selected" << value; + cDebug() << m_id << "selected" << value; } else if ( m_method == PackageChooserMethod::Packages ) { @@ -119,16 +119,23 @@ Config::updateGlobalStorage( const QStringList& selected ) const } void -Config::setPkgc( const QString& pkgc ) +Config::setPackageChoice( const QString& packageChoice ) { - m_pkgc = pkgc; - emit pkgcChanged( m_pkgc ); + if ( packageChoice.isEmpty() ) + { + m_packageChoice.reset(); + } + else + { + m_packageChoice = packageChoice; + } + emit packageChoiceChanged( m_packageChoice.value_or( QString() ) ); } QString Config::prettyStatus() const { - return tr( "Install option: %1" ).arg( m_pkgc ); + return tr( "Install option: %1" ).arg( m_packageChoice.value_or( tr( "None" ) ) ); } static void @@ -197,7 +204,7 @@ Config::setConfigurationMap( const QVariantMap& configurationMap ) PackageChooserMode::Required ); m_method = PackageChooserMethodNames().find( CalamaresUtils::getString( configurationMap, "method" ), PackageChooserMethod::Legacy ); - m_pkgc = CalamaresUtils::getString( configurationMap, "pkgc" ); + setPackageChoice( CalamaresUtils::getString( configurationMap, "pkgc" ) ); if ( m_method == PackageChooserMethod::Legacy ) { diff --git a/src/modules/packagechooser/Config.h b/src/modules/packagechooser/Config.h index b343a8cb2..75ff0d0c6 100644 --- a/src/modules/packagechooser/Config.h +++ b/src/modules/packagechooser/Config.h @@ -17,6 +17,7 @@ #include "modulesystem/InstanceKey.h" #include +#include enum class PackageChooserMode { @@ -40,7 +41,16 @@ class Config : public Calamares::ModuleSystem::Config { Q_OBJECT - Q_PROPERTY( QString pkgc READ pkgc WRITE setPkgc NOTIFY pkgcChanged ) + /** @brief This is the single-select package-choice + * + * For (QML) modules that support only a single selection and + * just want to do things in a straightforward pick-this-one + * way, the packageChoice property is a (the) way to go. + * + * Writing to this property means that any other form of package- + * choice or selection is ignored. + */ + Q_PROPERTY( QString packageChoice READ packageChoice WRITE setPackageChoice NOTIFY packageChoiceChanged ) Q_PROPERTY( QString prettyStatus READ prettyStatus NOTIFY prettyStatusChanged FINAL ) public: @@ -78,13 +88,13 @@ public: /// As updateGlobalStorage() with an empty selection list void fillGSSecondaryConfiguration() const { updateGlobalStorage( QStringList() ); } - QString pkgc() const { return m_pkgc; } - void setPkgc( const QString& pkgc ); + QString packageChoice() const { return m_packageChoice.value_or( QString() ); } + void setPackageChoice( const QString& packageChoice ); QString prettyStatus() const; signals: - void pkgcChanged( QString pkgc ); + void packageChoiceChanged( QString packageChoice ); void prettyStatusChanged(); private: @@ -99,8 +109,12 @@ private: QString m_id; /// Value to use for id if none is set in the config file Calamares::ModuleSystem::InstanceKey m_defaultId; - /// QML selection - QString m_pkgc; + /** @brief QML selection (for single-selection approaches) + * + * If there is no value, then there has been no selection. + * Reading the property will return an empty QString. + */ + std::optional< QString > m_packageChoice; }; From 8b703ba6a33c5bbf21909e348d28f54adbcaa53d Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Fri, 3 Sep 2021 21:12:11 +0200 Subject: [PATCH 4/8] [packagechooserq] More docs for the config file --- src/modules/packagechooserq/packagechooserq.conf | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/modules/packagechooserq/packagechooserq.conf b/src/modules/packagechooserq/packagechooserq.conf index fc45e4fa9..ecf9ed1a6 100644 --- a/src/modules/packagechooserq/packagechooserq.conf +++ b/src/modules/packagechooserq/packagechooserq.conf @@ -6,9 +6,7 @@ # Software selection mode, to set whether the software packages # can be chosen singly, or multiply. # -# Possible modes are "optional", "required" (for zero-or-one or exactly-one) -# or "optionalmultiple", "requiredmultiple" (for zero-or-more -# or one-or-more). +# The example QML module does not use a model, and ignores this value. mode: required # Software installation method: @@ -40,7 +38,11 @@ mode: required # modules, either *contextualprocess* or *packages* or some custom # module, in the `exec` section to do the actual work. method: legacy -# The *id* key is used only in "legacy" mode + +# The *id* key is used only in "legacy" mode and changes the GlobalStorage +# key used to store the package choices. It is not recommended to use +# this, since the module instance key does the same job. +# # id: "" # The *pkgc* is used for setting the default selection in the QML view From 8a49fde0163c6660784d2ea11da817e721a8f36b Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Fri, 3 Sep 2021 21:15:57 +0200 Subject: [PATCH 5/8] [packagechooserq] Apply renaming also to distro-visible code - The distro-visible key is renamed *pkgc* to *packageChoice* - Read *packageChoice* only if there are no items to use --- src/modules/packagechooser/Config.cpp | 27 ++++++++++--------- .../packagechooserq/packagechooserq.conf | 10 +++++-- .../packagechooserq/packagechooserq.qml | 8 +++--- 3 files changed, 27 insertions(+), 18 deletions(-) diff --git a/src/modules/packagechooser/Config.cpp b/src/modules/packagechooser/Config.cpp index 2c798ea03..11288bde6 100644 --- a/src/modules/packagechooser/Config.cpp +++ b/src/modules/packagechooser/Config.cpp @@ -204,7 +204,6 @@ Config::setConfigurationMap( const QVariantMap& configurationMap ) PackageChooserMode::Required ); m_method = PackageChooserMethodNames().find( CalamaresUtils::getString( configurationMap, "method" ), PackageChooserMethod::Legacy ); - setPackageChoice( CalamaresUtils::getString( configurationMap, "pkgc" ) ); if ( m_method == PackageChooserMethod::Legacy ) { @@ -233,21 +232,25 @@ Config::setConfigurationMap( const QVariantMap& configurationMap ) if ( configurationMap.contains( "items" ) ) { fillModel( m_model, configurationMap.value( "items" ).toList() ); - } - QString default_item_id = CalamaresUtils::getString( configurationMap, "default" ); - if ( !default_item_id.isEmpty() ) - { - for ( int item_n = 0; item_n < m_model->packageCount(); ++item_n ) + QString default_item_id = CalamaresUtils::getString( configurationMap, "default" ); + if ( !default_item_id.isEmpty() ) { - QModelIndex item_idx = m_model->index( item_n, 0 ); - QVariant item_id = m_model->data( item_idx, PackageListModel::IdRole ); - - if ( item_id.toString() == default_item_id ) + for ( int item_n = 0; item_n < m_model->packageCount(); ++item_n ) { - m_defaultModelIndex = item_idx; - break; + QModelIndex item_idx = m_model->index( item_n, 0 ); + QVariant item_id = m_model->data( item_idx, PackageListModel::IdRole ); + + if ( item_id.toString() == default_item_id ) + { + m_defaultModelIndex = item_idx; + break; + } } } } + else + { + setPackageChoice( CalamaresUtils::getString( configurationMap, "packageChoice" ) ); + } } diff --git a/src/modules/packagechooserq/packagechooserq.conf b/src/modules/packagechooserq/packagechooserq.conf index ecf9ed1a6..8fd3a08f6 100644 --- a/src/modules/packagechooserq/packagechooserq.conf +++ b/src/modules/packagechooserq/packagechooserq.conf @@ -45,6 +45,12 @@ method: legacy # # id: "" -# The *pkgc* is used for setting the default selection in the QML view -pkgc: libreoffice +# The *packageChoice* value is used for setting the default selection +# in the QML view; this should match one of the keys used in the QML +# module for package names. +# +# (e.g. the sample QML uses "no_office_suite", "minimal_install" and +# "libreoffice" as possible choices). +# +packageChoice: libreoffice diff --git a/src/modules/packagechooserq/packagechooserq.qml b/src/modules/packagechooserq/packagechooserq.qml index cf7454fe9..98f7b8038 100644 --- a/src/modules/packagechooserq/packagechooserq.qml +++ b/src/modules/packagechooserq/packagechooserq.qml @@ -84,8 +84,8 @@ Item { print("L not used") } else { - config.pkgc = "libreoffice" - print( config.pkgc ) + config.packageChoice = "libreoffice" + print( config.packageChoice ) } } } @@ -152,7 +152,7 @@ Item { } else { print("No Office Suite") - config.pkgc = "no_office_suite" + config.packageChoice = "no_office_suite" } } } @@ -220,7 +220,7 @@ Item { } else { print("minimal") - config.pkgc = "minimal_install" + config.packageChoice = "minimal_install" } } } From 33e7e8da58a24bea4ca2916c79e0454e7dfd272d Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Fri, 3 Sep 2021 22:41:13 +0200 Subject: [PATCH 6/8] [packagechooser] Massage API - use updateGlobalStorage() for both single-selection and model-based approaches, although the model-based one needs extra parameters. - complain about inconsistent settings and API calls (e.g. setting a model and single-selection at the same time) --- src/modules/packagechooser/Config.cpp | 39 ++++++++++++++++++- src/modules/packagechooser/Config.h | 9 ++++- .../PackageChooserQmlViewStep.cpp | 2 +- 3 files changed, 46 insertions(+), 4 deletions(-) diff --git a/src/modules/packagechooser/Config.cpp b/src/modules/packagechooser/Config.cpp index 11288bde6..0001d9fc6 100644 --- a/src/modules/packagechooser/Config.cpp +++ b/src/modules/packagechooser/Config.cpp @@ -98,10 +98,13 @@ Config::introductionPackage() const void Config::updateGlobalStorage( const QStringList& selected ) const { + if ( m_packageChoice.has_value() ) + { + cWarning() << "Inconsistent package choices -- both model and single-selection QML"; + } if ( m_method == PackageChooserMethod::Legacy ) { QString value = selected.join( ',' ); - // QString value = ( m_pkgc ); Calamares::JobQueue::instance()->globalStorage()->insert( m_id, value ); cDebug() << m_id << "selected" << value; } @@ -118,6 +121,36 @@ Config::updateGlobalStorage( const QStringList& selected ) const } } +void +Config::updateGlobalStorage() const +{ + if ( m_model->packageCount() > 0 ) + { + cWarning() << "Inconsistent package choices -- both model and single-selection QML"; + } + if ( m_method == PackageChooserMethod::Legacy ) + { + auto* gs = Calamares::JobQueue::instance()->globalStorage(); + if ( m_packageChoice.has_value() ) + { + gs->insert( m_id, m_packageChoice.value() ); + } + else + { + gs->remove( m_id ); + } + } + else if ( m_method == PackageChooserMethod::Packages ) + { + cWarning() << "Unsupported single-selection packagechooser method 'Packages'"; + } + else + { + cWarning() << "Unknown packagechooser method" << smash( m_method ); + } +} + + void Config::setPackageChoice( const QString& packageChoice ) { @@ -252,5 +285,9 @@ Config::setConfigurationMap( const QVariantMap& configurationMap ) else { setPackageChoice( CalamaresUtils::getString( configurationMap, "packageChoice" ) ); + if ( m_method != PackageChooserMethod::Legacy ) + { + cWarning() << "Single-selection QML module must use 'Legacy' method."; + } } } diff --git a/src/modules/packagechooser/Config.h b/src/modules/packagechooser/Config.h index 75ff0d0c6..85b8de83f 100644 --- a/src/modules/packagechooser/Config.h +++ b/src/modules/packagechooser/Config.h @@ -85,8 +85,13 @@ public: * (and only) the packages in @p selected as selected. */ void updateGlobalStorage( const QStringList& selected ) const; - /// As updateGlobalStorage() with an empty selection list - void fillGSSecondaryConfiguration() const { updateGlobalStorage( QStringList() ); } + /** @brief Write selection to global storage + * + * Updates the GS keys for this packagechooser, marking **only** + * the package choice as selected. This assumes that the single- + * selection QML code is in use. + */ + void updateGlobalStorage() const; QString packageChoice() const { return m_packageChoice.value_or( QString() ); } void setPackageChoice( const QString& packageChoice ); diff --git a/src/modules/packagechooserq/PackageChooserQmlViewStep.cpp b/src/modules/packagechooserq/PackageChooserQmlViewStep.cpp index 109260ca9..543c9771d 100644 --- a/src/modules/packagechooserq/PackageChooserQmlViewStep.cpp +++ b/src/modules/packagechooserq/PackageChooserQmlViewStep.cpp @@ -74,7 +74,7 @@ PackageChooserQmlViewStep::jobs() const void PackageChooserQmlViewStep::onLeave() { - m_config->fillGSSecondaryConfiguration(); + m_config->updateGlobalStorage(); } void From 6def41fab4270498ea8df5e98fc48b950572189b Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Fri, 3 Sep 2021 22:57:17 +0200 Subject: [PATCH 7/8] [packagechooserq] Remove debug-output in QML --- .../packagechooserq/packagechooserq.qml | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/src/modules/packagechooserq/packagechooserq.qml b/src/modules/packagechooserq/packagechooserq.qml index 98f7b8038..7d1613582 100644 --- a/src/modules/packagechooserq/packagechooserq.qml +++ b/src/modules/packagechooserq/packagechooserq.qml @@ -80,12 +80,8 @@ Item { } onCheckedChanged: { - if ( ! checked ) { - print("L not used") - } - else { + if ( checked ) { config.packageChoice = "libreoffice" - print( config.packageChoice ) } } } @@ -146,12 +142,7 @@ Item { } onCheckedChanged: { - if ( ! checked ) { - print("not used") - //console.log("removed") - } - else { - print("No Office Suite") + if ( checked ) { config.packageChoice = "no_office_suite" } } @@ -215,11 +206,7 @@ Item { } onCheckedChanged: { - if ( ! checked ) { - print("M not used") - } - else { - print("minimal") + if ( checked ) { config.packageChoice = "minimal_install" } } From e311d7a89346ad61ee10a2da48cb1a7a76559725 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Fri, 3 Sep 2021 23:59:11 +0200 Subject: [PATCH 8/8] [packagechooser] Remove 'id' configuration setting - Setting 'id' (which changes the Global Storage key that gets used) is a kludge when the existing module-instance name can be used instead -- and **was** already used, as a fallback when 'id' is not set. There's no point in having two places to set a particular name. - Rip out the docs for 'id' as well. - Add documentation on the difference between single-selection (the QML implementation) and model-selection (what the Widgets version does). --- src/modules/packagechooser/Config.cpp | 35 ++++++------------- src/modules/packagechooser/Config.h | 2 -- .../packagechooser/packagechooser.conf | 12 +++---- .../packagechooserq/packagechooserq.conf | 31 ++++++++-------- 4 files changed, 29 insertions(+), 51 deletions(-) diff --git a/src/modules/packagechooser/Config.cpp b/src/modules/packagechooser/Config.cpp index 0001d9fc6..5c0db5d91 100644 --- a/src/modules/packagechooser/Config.cpp +++ b/src/modules/packagechooser/Config.cpp @@ -95,6 +95,12 @@ Config::introductionPackage() const return *defaultIntroduction; } +static inline QString +make_gs_key( const Calamares::ModuleSystem::InstanceKey& key ) +{ + return QStringLiteral( "packagechooser_" ) + key.id(); +} + void Config::updateGlobalStorage( const QStringList& selected ) const { @@ -105,8 +111,8 @@ Config::updateGlobalStorage( const QStringList& selected ) const if ( m_method == PackageChooserMethod::Legacy ) { QString value = selected.join( ',' ); - Calamares::JobQueue::instance()->globalStorage()->insert( m_id, value ); - cDebug() << m_id << "selected" << value; + Calamares::JobQueue::instance()->globalStorage()->insert( make_gs_key( m_defaultId ), value ); + cDebug() << m_defaultId << "selected" << value; } else if ( m_method == PackageChooserMethod::Packages ) { @@ -133,11 +139,11 @@ Config::updateGlobalStorage() const auto* gs = Calamares::JobQueue::instance()->globalStorage(); if ( m_packageChoice.has_value() ) { - gs->insert( m_id, m_packageChoice.value() ); + gs->insert( make_gs_key( m_defaultId ), m_packageChoice.value() ); } else { - gs->remove( m_id ); + gs->remove( make_gs_key( m_defaultId ) ); } } else if ( m_method == PackageChooserMethod::Packages ) @@ -240,26 +246,7 @@ Config::setConfigurationMap( const QVariantMap& configurationMap ) if ( m_method == PackageChooserMethod::Legacy ) { - const QString configId = CalamaresUtils::getString( configurationMap, "id" ); - const QString base = QStringLiteral( "packagechooser_" ); - if ( configId.isEmpty() ) - { - if ( m_defaultId.id().isEmpty() ) - { - // We got nothing to work with - m_id = base; - } - else - { - m_id = base + m_defaultId.id(); - } - cDebug() << "Using default ID" << m_id << "from" << m_defaultId.toString(); - } - else - { - m_id = base + configId; - cDebug() << "Using configured ID" << m_id; - } + cDebug() << "Using module ID" << m_defaultId; } if ( configurationMap.contains( "items" ) ) diff --git a/src/modules/packagechooser/Config.h b/src/modules/packagechooser/Config.h index 85b8de83f..32f1e8b57 100644 --- a/src/modules/packagechooser/Config.h +++ b/src/modules/packagechooser/Config.h @@ -110,8 +110,6 @@ private: PackageChooserMode m_mode = PackageChooserMode::Optional; /// How this module stores to GS PackageChooserMethod m_method = PackageChooserMethod::Legacy; - /// Id (used to identify settings from this module in GS) - QString m_id; /// Value to use for id if none is set in the config file Calamares::ModuleSystem::InstanceKey m_defaultId; /** @brief QML selection (for single-selection approaches) diff --git a/src/modules/packagechooser/packagechooser.conf b/src/modules/packagechooser/packagechooser.conf index 2bde1369c..231826cd3 100644 --- a/src/modules/packagechooser/packagechooser.conf +++ b/src/modules/packagechooser/packagechooser.conf @@ -15,11 +15,10 @@ mode: required # # - "legacy" or "custom" or "contextualprocess" # When set to "legacy", writes a GlobalStorage value for the choice that -# has been made. The key is *packagechooser_*. Normally, the module's +# has been made. The key is *packagechooser_*. The module's # instance name is used; see the *instances* section of `settings.conf`. # If there is just one packagechooser module, and no special instance is set, -# resulting GS key is probably *packagechooser@packagechooser*. -# You can set *id* to change that, but it is not recommended. +# resulting GS key is probably *packagechooser_packagechooser*. # # The GS value is a comma-separated list of the IDs of the selected # packages, or an empty string if none is selected. @@ -33,15 +32,12 @@ mode: required # consumption by the *packages* module (which should appear later # in the `exec` section. These package settings will then be handed # off to whatever package manager is configured there. -# The *id* key is not used. # # There is no need to put this module in the `exec` section. There # are no jobs that this module provides. You should put **other** # modules, either *contextualprocess* or *packages* or some custom # module, in the `exec` section to do the actual work. method: legacy -# The *id* key is used only in "legacy" mode -# id: "" # Human-visible strings in this module. These are all optional. @@ -51,13 +47,13 @@ method: legacy # Each key can have a [locale] added to it, which is used as # the translated string for that locale. For the strings # associated with the "no-selection" item, see *items*, below -# with the explicit id "". +# with the explicit item-*id* "". # labels: step: "Packages" step[nl]: "Pakketten" -# (Optional) 'id' of pre-selected list-view item. +# (Optional) item-*id* of pre-selected list-view item. # Pre-selects one of the items below. # default: kde diff --git a/src/modules/packagechooserq/packagechooserq.conf b/src/modules/packagechooserq/packagechooserq.conf index 8fd3a08f6..803c6f670 100644 --- a/src/modules/packagechooserq/packagechooserq.conf +++ b/src/modules/packagechooserq/packagechooserq.conf @@ -1,23 +1,26 @@ # SPDX-FileCopyrightText: no # SPDX-License-Identifier: CC0-1.0 # -# Configuration for the low-density software chooser ---- -# Software selection mode, to set whether the software packages -# can be chosen singly, or multiply. +# Configuration for the low-density software chooser, QML implementation +# +# The example QML implementation uses single-selection, rather than +# a model for the available packages. That makes it simpler: the +# QML itself codes the available options, descriptions and images +# -- after all, this is **low density** selection, so a custom UI +# can make sense for the few choices that need to be made. +# # -# The example QML module does not use a model, and ignores this value. -mode: required +--- # Software installation method: # # - "legacy" or "custom" or "contextualprocess" # When set to "legacy", writes a GlobalStorage value for the choice that -# has been made. The key is *packagechooser_*. Normally, the module's +# has been made. The key is *packagechooser_*. The module's # instance name is used; see the *instances* section of `settings.conf`. -# If there is just one packagechooser module, and no special instance is set, -# resulting GS key is probably *packagechooser@packagechooser*. -# You can set *id* to change that, but it is not recommended. +# If there is just one packagechooserq module, and no special instance is set, +# resulting GS key is probably *packagechooser_packagechooserq*. +# (Do note that the prefix of the GS key remains "packagechooser_") # # The GS value is a comma-separated list of the IDs of the selected # packages, or an empty string if none is selected. @@ -31,19 +34,13 @@ mode: required # consumption by the *packages* module (which should appear later # in the `exec` section. These package settings will then be handed # off to whatever package manager is configured there. -# The *id* key is not used. # # There is no need to put this module in the `exec` section. There # are no jobs that this module provides. You should put **other** # modules, either *contextualprocess* or *packages* or some custom # module, in the `exec` section to do the actual work. -method: legacy - -# The *id* key is used only in "legacy" mode and changes the GlobalStorage -# key used to store the package choices. It is not recommended to use -# this, since the module instance key does the same job. # -# id: "" +method: legacy # The *packageChoice* value is used for setting the default selection # in the QML view; this should match one of the keys used in the QML