[plasmalnf] Allow filtering the selectable lnf themes
- empty list allows all of them - always suppress hidden, invalid themes, and those named
This commit is contained in:
parent
ad69eda337
commit
6bd8c67ca9
@ -34,11 +34,11 @@ static PlasmaLnfList plasma_themes()
|
||||
|
||||
for ( const KPluginMetaData& data : pkgs )
|
||||
{
|
||||
packages << PlasmaLnfDescriptor{ data.pluginId(), data.name() };
|
||||
cDebug() << "LNF Package" << data.pluginId();
|
||||
cDebug() << " .." << data.name();
|
||||
cDebug() << " .." << data.description();
|
||||
cDebug() << " .." << 'V' << data.isValid() << 'H' << data.isHidden() << 'D' << data.isEnabledByDefault();
|
||||
if ( data.isValid() && !data.isHidden() && !data.name().isEmpty() )
|
||||
{
|
||||
packages << PlasmaLnfDescriptor{ data.pluginId(), data.name() };
|
||||
cDebug() << "LNF Package" << data.pluginId();
|
||||
}
|
||||
}
|
||||
|
||||
return packages;
|
||||
@ -55,9 +55,7 @@ PlasmaLnfPage::PlasmaLnfPage( QWidget* parent )
|
||||
ui->retranslateUi( this );
|
||||
ui->generalExplanation->setText( tr( "Please choose a look-and-feel for the KDE Plasma Desktop, below." ) );
|
||||
m_availableLnf = plasma_themes();
|
||||
ui->lnfCombo->clear();
|
||||
for ( const auto& p : m_availableLnf )
|
||||
ui->lnfCombo->addItem( p.name );
|
||||
winnowThemes();
|
||||
}
|
||||
)
|
||||
|
||||
@ -83,3 +81,18 @@ PlasmaLnfPage::setLnfPath( const QString& path )
|
||||
{
|
||||
m_lnfPath = path;
|
||||
}
|
||||
|
||||
void
|
||||
PlasmaLnfPage::setEnabledThemes(const QStringList& themes)
|
||||
{
|
||||
m_enabledThemes = themes;
|
||||
winnowThemes();
|
||||
}
|
||||
|
||||
void PlasmaLnfPage::winnowThemes()
|
||||
{
|
||||
ui->lnfCombo->clear();
|
||||
for ( const auto& p : m_availableLnf )
|
||||
if ( m_enabledThemes.isEmpty() || m_enabledThemes.contains( p.id ) )
|
||||
ui->lnfCombo->addItem( p.name );
|
||||
}
|
||||
|
@ -21,6 +21,7 @@
|
||||
|
||||
#include <QList>
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
#include <QWidget>
|
||||
|
||||
namespace Ui
|
||||
@ -43,6 +44,7 @@ public:
|
||||
explicit PlasmaLnfPage( QWidget* parent = nullptr );
|
||||
|
||||
void setLnfPath( const QString& path );
|
||||
void setEnabledThemes( const QStringList& themes );
|
||||
|
||||
public slots:
|
||||
void activated( int index );
|
||||
@ -51,8 +53,11 @@ signals:
|
||||
void plasmaThemeSelected( const QString& id );
|
||||
|
||||
private:
|
||||
void winnowThemes();
|
||||
|
||||
Ui::PlasmaLnfPage* ui;
|
||||
QString m_lnfPath;
|
||||
QStringList m_enabledThemes;
|
||||
PlasmaLnfList m_availableLnf;
|
||||
};
|
||||
|
||||
|
@ -135,6 +135,15 @@ PlasmaLnfViewStep::setConfigurationMap( const QVariantMap& configurationMap )
|
||||
if ( configurationMap.contains( "liveuser" ) && configurationMap.value( "liveuser" ).type() == QVariant::String )
|
||||
liveUser = configurationMap.value( "liveuser" ).toString();
|
||||
m_liveUser = liveUser;
|
||||
|
||||
if ( configurationMap.contains( "themes" ) &&
|
||||
configurationMap.value( "themes" ).type() == QVariant::List )
|
||||
{
|
||||
QStringList enabledThemes( configurationMap.value( "themes" ).toStringList() );
|
||||
if ( enabledThemes.length() == 1 )
|
||||
cDebug() << "WARNING: only one theme enabled in plasmalnf";
|
||||
m_widget->setEnabledThemes( enabledThemes );
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1,10 +1,22 @@
|
||||
---
|
||||
# Full path to the Plasma look-and-feel tool (CLI program
|
||||
# for querying and applying Plasma themes).
|
||||
# for querying and applying Plasma themes). If this is not
|
||||
# set, no LNF setting will happen.
|
||||
lnftool: "/usr/bin/lookandfeeltool"
|
||||
|
||||
# For systems where the user Calamares runs as (usually root,
|
||||
# via either sudo or pkexec) has a clean environment, set this
|
||||
# to the originating username; the lnftool will be run through
|
||||
# "sudo -H -u <liveuser>" instead of directly.
|
||||
liveuser: "live"
|
||||
#
|
||||
# liveuser: "live"
|
||||
|
||||
# You can limit the list of Plasma look-and-feel themes by listing ids
|
||||
# here. If this key is not present, or the list is empty, all of the
|
||||
# installed themes are listed. If only one theme is listed, why are
|
||||
# you using this module at all?
|
||||
#
|
||||
themes:
|
||||
- org.kde.breeze.desktop
|
||||
# - org.kde.breezedark.desktop
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user