[plasmalnf] New setting to show all installed LnF themes
- This enables working in three modes: - No themes listed; all are shown without screenshots, - Themes listed, showAll false; only those are shown, - Themes listed, showAll true; the installed-but-not-listed themes are shown after the listed ones, and have limited info.
This commit is contained in:
parent
c2efae765d
commit
b0828faadb
@ -57,6 +57,7 @@ static ThemeInfoList plasma_themes()
|
||||
PlasmaLnfPage::PlasmaLnfPage( QWidget* parent )
|
||||
: QWidget( parent )
|
||||
, ui( new Ui::PlasmaLnfPage )
|
||||
, m_showAll( false )
|
||||
, m_buttonGroup( nullptr )
|
||||
{
|
||||
ui->setupUi( this );
|
||||
@ -85,6 +86,14 @@ PlasmaLnfPage::setEnabledThemes(const ThemeInfoList& themes)
|
||||
{
|
||||
m_enabledThemes = themes;
|
||||
|
||||
if ( m_showAll )
|
||||
{
|
||||
auto plasmaThemes = plasma_themes();
|
||||
for ( auto& installed_theme : plasmaThemes )
|
||||
if ( !m_enabledThemes.findById( installed_theme.id ) )
|
||||
m_enabledThemes.append( installed_theme );
|
||||
}
|
||||
|
||||
updateThemeNames();
|
||||
winnowThemes();
|
||||
fillUi();
|
||||
@ -104,6 +113,12 @@ PlasmaLnfPage::setPreselect( const QString& id )
|
||||
fillUi();
|
||||
}
|
||||
|
||||
void
|
||||
PlasmaLnfPage::setShowAll(bool b)
|
||||
{
|
||||
m_showAll = b;
|
||||
}
|
||||
|
||||
|
||||
void PlasmaLnfPage::updateThemeNames()
|
||||
{
|
||||
|
@ -52,6 +52,8 @@ public:
|
||||
void setEnabledThemesAll();
|
||||
/** @brief set which theme is to be preselected. */
|
||||
void setPreselect( const QString& id );
|
||||
/** @brief set whether to show all themes, not just the listed ones. */
|
||||
void setShowAll( bool b );
|
||||
|
||||
signals:
|
||||
void plasmaThemeSelected( const QString& id );
|
||||
@ -67,6 +69,7 @@ private:
|
||||
Ui::PlasmaLnfPage* ui;
|
||||
QString m_lnfPath;
|
||||
QString m_preselect;
|
||||
bool m_showAll; // If true, don't winnow according to enabledThemes
|
||||
ThemeInfoList m_enabledThemes;
|
||||
|
||||
QButtonGroup *m_buttonGroup;
|
||||
|
@ -162,6 +162,11 @@ PlasmaLnfViewStep::setConfigurationMap( const QVariantMap& configurationMap )
|
||||
if ( !preselect.isEmpty() )
|
||||
m_widget->setPreselect( preselect );
|
||||
|
||||
bool showAll( false );
|
||||
if ( configurationMap.contains( "showAll" ) && configurationMap.value( "showAll" ).type() == QVariant::Bool )
|
||||
showAll = configurationMap.value( "showAll" ).toBool();
|
||||
m_widget->setShowAll( showAll );
|
||||
|
||||
if ( configurationMap.contains( "themes" ) &&
|
||||
configurationMap.value( "themes" ).type() == QVariant::List )
|
||||
{
|
||||
|
@ -13,8 +13,9 @@ lnftool: "/usr/bin/lookandfeeltool"
|
||||
|
||||
# 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.
|
||||
# If the key is present, only installed themes that are *also* included
|
||||
# in the list are shown (could be none!).
|
||||
# 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,
|
||||
# to change that.
|
||||
#
|
||||
# Themes may be listed by id, (e.g. fluffy-bunny, below) or as a theme
|
||||
# and an image (e.g. breeze) which will be used to show a screenshot.
|
||||
@ -28,6 +29,13 @@ themes:
|
||||
image: "breeze-dark.png"
|
||||
- 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
|
||||
# immediately, but its radio-button is switched on to indicate
|
||||
# that that is the theme (that is most likely) currently in use.
|
||||
|
Loading…
Reference in New Issue
Block a user