[plasmalnf] Add description to theme widget
This commit is contained in:
parent
8b3f71af40
commit
244919d6fe
@ -19,7 +19,6 @@
|
||||
#include "PlasmaLnfPage.h"
|
||||
|
||||
#include "ui_page_plasmalnf.h"
|
||||
#include "ThemeWidget.h"
|
||||
|
||||
#include "utils/Logger.h"
|
||||
#include "utils/Retranslator.h"
|
||||
@ -27,6 +26,13 @@
|
||||
#include <KPackage/Package>
|
||||
#include <KPackage/PackageLoader>
|
||||
|
||||
ThemeInfo::ThemeInfo( const KPluginMetaData& data )
|
||||
: id( data.pluginId() )
|
||||
, name( data.name() )
|
||||
, description( data.description() )
|
||||
{
|
||||
}
|
||||
|
||||
static ThemeInfoList plasma_themes()
|
||||
{
|
||||
ThemeInfoList packages;
|
||||
@ -37,7 +43,7 @@ static ThemeInfoList plasma_themes()
|
||||
{
|
||||
if ( data.isValid() && !data.isHidden() && !data.name().isEmpty() )
|
||||
{
|
||||
packages << ThemeInfo{ data.pluginId(), data.name() };
|
||||
packages << ThemeInfo{ data };
|
||||
}
|
||||
}
|
||||
|
||||
@ -89,6 +95,7 @@ void PlasmaLnfPage::updateThemeNames()
|
||||
if ( t != nullptr )
|
||||
{
|
||||
enabled_theme.name = t->name;
|
||||
enabled_theme.description = t->description;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -142,14 +142,17 @@ PlasmaLnfViewStep::setConfigurationMap( const QVariantMap& configurationMap )
|
||||
{
|
||||
ThemeInfoList allThemes;
|
||||
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();
|
||||
allThemes.append( ThemeInfo( iv.value( "theme" ).toString(), QString(), iv.value( "image" ).toString() ) );
|
||||
allThemes.append( ThemeInfo( iv.value( "theme" ).toString(), iv.value( "image" ).toString() ) );
|
||||
}
|
||||
else if ( i.type() == QVariant::String )
|
||||
allThemes.append( ThemeInfo( i.toString(), QString() ) );
|
||||
allThemes.append( ThemeInfo( i.toString() ) );
|
||||
|
||||
if ( allThemes.length() == 1 )
|
||||
cDebug() << "WARNING: only one theme enabled in plasmalnf";
|
||||
|
@ -22,6 +22,8 @@
|
||||
#include <QList>
|
||||
#include <QString>
|
||||
|
||||
class KPluginMetaData;
|
||||
|
||||
/** @brief describes a single plasma LnF theme.
|
||||
*
|
||||
* A theme description has an id, which is really the name of the desktop
|
||||
@ -33,17 +35,25 @@ struct ThemeInfo
|
||||
{
|
||||
QString id;
|
||||
QString name;
|
||||
QString description;
|
||||
QString imagePath;
|
||||
|
||||
ThemeInfo()
|
||||
{}
|
||||
|
||||
ThemeInfo( const QString& _id, const QString& _name, const QString& image = QString() )
|
||||
explicit ThemeInfo( const QString& _id )
|
||||
: id( _id )
|
||||
{
|
||||
}
|
||||
|
||||
explicit ThemeInfo( const QString& _id, const QString& image )
|
||||
: id( _id )
|
||||
, name( _name )
|
||||
, imagePath( image )
|
||||
{}
|
||||
|
||||
// Defined in PlasmaLnfPage.cpp
|
||||
explicit ThemeInfo( const KPluginMetaData& );
|
||||
|
||||
bool isValid() const { return !id.isEmpty(); }
|
||||
} ;
|
||||
|
||||
|
@ -34,6 +34,7 @@ ThemeWidget::ThemeWidget(const ThemeInfo& info, QWidget* parent)
|
||||
|
||||
layout->addWidget( m_check );
|
||||
layout->addWidget( new QLabel( "Image", this ) );
|
||||
layout->addWidget( new QLabel( info.description, this ) );
|
||||
|
||||
connect( m_check, &QRadioButton::clicked, this, &ThemeWidget::clicked );
|
||||
}
|
||||
|
@ -23,7 +23,8 @@
|
||||
|
||||
class QAbstractButton;
|
||||
class QRadioButton;
|
||||
class ThemeInfo;
|
||||
|
||||
struct ThemeInfo;
|
||||
|
||||
class ThemeWidget : public QWidget
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user