[plasmalnf] Set screenshots on themes, filtering
- while here reorder the config so the effect of *showAll* is clearer
This commit is contained in:
parent
254933a488
commit
d4887426e2
@ -58,6 +58,37 @@ Config::setConfigurationMap( const QVariantMap& configurationMap )
|
|||||||
preselect = currentPlasmaTheme();
|
preselect = currentPlasmaTheme();
|
||||||
}
|
}
|
||||||
m_preselectThemeId = preselect;
|
m_preselectThemeId = preselect;
|
||||||
|
|
||||||
|
if ( configurationMap.contains( "themes" ) && configurationMap.value( "themes" ).type() == QVariant::List )
|
||||||
|
{
|
||||||
|
QMap< QString, QString > listedThemes;
|
||||||
|
auto themeList = configurationMap.value( "themes" ).toList();
|
||||||
|
// Create the ThemInfo objects for the listed themes; information
|
||||||
|
// about the themes from Plasma (e.g. human-readable name and description)
|
||||||
|
// are filled in by update_names() in PlasmaLnfPage.
|
||||||
|
for ( const auto& i : themeList )
|
||||||
|
if ( i.type() == QVariant::Map )
|
||||||
|
{
|
||||||
|
auto iv = i.toMap();
|
||||||
|
listedThemes.insert( iv.value( "theme" ).toString(), iv.value( "image" ).toString() );
|
||||||
|
}
|
||||||
|
else if ( i.type() == QVariant::String )
|
||||||
|
{
|
||||||
|
listedThemes.insert( i.toString(), QString() );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( listedThemes.count() == 1 )
|
||||||
|
{
|
||||||
|
cWarning() << "only one theme enabled in plasmalnf";
|
||||||
|
}
|
||||||
|
m_themeModel->setThemeImage( listedThemes );
|
||||||
|
|
||||||
|
bool showAll = CalamaresUtils::getBool( configurationMap, "showAll", false );
|
||||||
|
if ( !listedThemes.isEmpty() && !showAll )
|
||||||
|
{
|
||||||
|
m_themeModel->showOnlyThemes( listedThemes );
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Calamares::JobList
|
Calamares::JobList
|
||||||
|
@ -90,7 +90,7 @@ ThemesModel::showTheme( const QString& id, bool show )
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ThemesModel::showTheme( const QMap< QString, QString >& onlyThese )
|
ThemesModel::showOnlyThemes( const QMap< QString, QString >& onlyThese )
|
||||||
{
|
{
|
||||||
for ( auto& t : m_themes )
|
for ( auto& t : m_themes )
|
||||||
{
|
{
|
||||||
|
@ -119,7 +119,7 @@ public:
|
|||||||
void showTheme( const QString& id, bool show = true );
|
void showTheme( const QString& id, bool show = true );
|
||||||
|
|
||||||
/// @brief Shows the keys in the @p onlyThese map, and hides the rest
|
/// @brief Shows the keys in the @p onlyThese map, and hides the rest
|
||||||
void showTheme( const QMap< QString, QString >& onlyThese );
|
void showOnlyThemes( const QMap< QString, QString >& onlyThese );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ThemeInfoList m_themes;
|
ThemeInfoList m_themes;
|
||||||
|
@ -24,10 +24,18 @@ lnftool: "/usr/bin/lookandfeeltool"
|
|||||||
#
|
#
|
||||||
# liveuser: "live"
|
# liveuser: "live"
|
||||||
|
|
||||||
|
# If *showAll* is true, then all installed themes are shown in the
|
||||||
|
# UI for selection, even if they are not listed in *themes* (below).
|
||||||
|
# This allows selection of all themes even while not all of them are
|
||||||
|
# listed in *themes* -- which is useful to show screenshots for those
|
||||||
|
# you do have a screenshot for. If *themes* is empty or missing,
|
||||||
|
# the value of *showAll* is treated as `true`.
|
||||||
|
showAll: false
|
||||||
|
|
||||||
# You can limit the list of Plasma look-and-feel themes by listing ids
|
# You can limit the list of Plasma look-and-feel themes by listing ids
|
||||||
# here. If this key is not present, all of the installed themes are listed.
|
# here. If this key is not present, all of the installed themes are listed.
|
||||||
# If the key is present, only installed themes that are **also** included
|
# If the key is present, only installed themes that are **also** included
|
||||||
# in the list are shown (could be none!). See the *showAll* key, below,
|
# in the list are shown (could be none!). See the *showAll* key, above,
|
||||||
# to change that.
|
# to change that.
|
||||||
#
|
#
|
||||||
# Themes may be listed by id, (e.g. fluffy-bunny, below) or as a theme
|
# Themes may be listed by id, (e.g. fluffy-bunny, below) or as a theme
|
||||||
@ -58,13 +66,6 @@ themes:
|
|||||||
image: "breeze-dark.png"
|
image: "breeze-dark.png"
|
||||||
- org.kde.fluffy-bunny.desktop
|
- org.kde.fluffy-bunny.desktop
|
||||||
|
|
||||||
# If *showAll* is true, then all installed themes are shown in the
|
|
||||||
# UI for selection, even if they are not listed in *themes*. This
|
|
||||||
# allows selection of all themes even while not all of them are
|
|
||||||
# listed in *themes* -- which is useful to show screenshots for those
|
|
||||||
# you do have a screenshot for.
|
|
||||||
showAll: false
|
|
||||||
|
|
||||||
# You can pre-select one of the themes; it is not applied
|
# You can pre-select one of the themes; it is not applied
|
||||||
# immediately, but its radio-button is switched on to indicate
|
# immediately, but its radio-button is switched on to indicate
|
||||||
# that that is the theme (that is most likely) currently in use.
|
# that that is the theme (that is most likely) currently in use.
|
||||||
|
Loading…
Reference in New Issue
Block a user