[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
This commit is contained in:
demmm 2021-07-06 19:37:28 +02:00
parent 6ccdf79f77
commit 373b94b968
2 changed files with 31 additions and 1 deletions

View File

@ -1,6 +1,7 @@
/* === This file is part of Calamares - <https://calamares.io> ===
*
* SPDX-FileCopyrightText: 2021 Adriaan de Groot <groot@kde.org>
* SPDX-FileCopyrightText: 2021 Anke Boersma <demm@kaosx.us>
* 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: <strong>%1</strong>" ).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 )
{

View File

@ -1,6 +1,7 @@
/* === This file is part of Calamares - <https://calamares.io> ===
*
* SPDX-FileCopyrightText: 2021 Adriaan de Groot <groot@kde.org>
* SPDX-FileCopyrightText: 2021 Anke Boersma <demm@kaosx.us>
* 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;
};