From 373b94b96880d70774cbdaf50fca75df762c6df5 Mon Sep 17 00:00:00 2001 From: demmm Date: Tue, 6 Jul 2021 19:37:28 +0200 Subject: [PATCH] [packagechooser] Config files adjusted for new QML modules function added to store selections from packagechooserq line 103 in Config.cpp needs adjusting to restore working regular widget based packagechooser prettyStatus added, made visible in packagechooserq only, ViewStep not altered in packagechooser for this yet --- src/modules/packagechooser/Config.cpp | 17 ++++++++++++++++- src/modules/packagechooser/Config.h | 15 +++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/src/modules/packagechooser/Config.cpp b/src/modules/packagechooser/Config.cpp index 106ae4538..f66f16824 100644 --- a/src/modules/packagechooser/Config.cpp +++ b/src/modules/packagechooser/Config.cpp @@ -1,6 +1,7 @@ /* === This file is part of Calamares - === * * SPDX-FileCopyrightText: 2021 Adriaan de Groot + * SPDX-FileCopyrightText: 2021 Anke Boersma * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is Free Software: see the License-Identifier above. @@ -99,7 +100,8 @@ Config::updateGlobalStorage( const QStringList& selected ) const { if ( m_method == PackageChooserMethod::Legacy ) { - QString value = selected.join( ',' ); + //QString value = selected.join( ',' ); + QString value = ( m_pkgc ); Calamares::JobQueue::instance()->globalStorage()->insert( m_id, value ); cDebug() << m_id<< "selected" << value; } @@ -116,6 +118,18 @@ Config::updateGlobalStorage( const QStringList& selected ) const } } +void +Config::setPkgc( const QString& pkgc ) +{ + m_pkgc = pkgc; + emit pkgcChanged( m_pkgc ); +} + +QString +Config::prettyStatus() const +{ + return tr( "Install option: %1" ).arg( m_pkgc ); +} static void fillModel( PackageListModel* model, const QVariantList& items ) @@ -183,6 +197,7 @@ Config::setConfigurationMap( const QVariantMap& configurationMap ) PackageChooserMode::Required ); m_method = PackageChooserMethodNames().find( CalamaresUtils::getString( configurationMap, "method" ), PackageChooserMethod::Legacy ); + m_pkgc = CalamaresUtils::getString( configurationMap, "pkgc" ); if ( m_method == PackageChooserMethod::Legacy ) { diff --git a/src/modules/packagechooser/Config.h b/src/modules/packagechooser/Config.h index 5959e3ea4..b343a8cb2 100644 --- a/src/modules/packagechooser/Config.h +++ b/src/modules/packagechooser/Config.h @@ -1,6 +1,7 @@ /* === This file is part of Calamares - === * * SPDX-FileCopyrightText: 2021 Adriaan de Groot + * SPDX-FileCopyrightText: 2021 Anke Boersma * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is Free Software: see the License-Identifier above. @@ -39,6 +40,9 @@ class Config : public Calamares::ModuleSystem::Config { Q_OBJECT + Q_PROPERTY( QString pkgc READ pkgc WRITE setPkgc NOTIFY pkgcChanged ) + Q_PROPERTY( QString prettyStatus READ prettyStatus NOTIFY prettyStatusChanged FINAL ) + public: Config( QObject* parent = nullptr ); ~Config() override; @@ -74,6 +78,15 @@ 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 prettyStatus() const; + +signals: + void pkgcChanged( QString pkgc ); + void prettyStatusChanged(); + private: PackageListModel* m_model = nullptr; QModelIndex m_defaultModelIndex; @@ -86,6 +99,8 @@ 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; };