|
|
|
@ -17,46 +17,10 @@
|
|
|
|
|
#include "utils/Logger.h"
|
|
|
|
|
#include "utils/Retranslator.h"
|
|
|
|
|
|
|
|
|
|
#include <KExtraColumnsProxyModel>
|
|
|
|
|
|
|
|
|
|
#include <QHeaderView>
|
|
|
|
|
#include <QStyledItemDelegate>
|
|
|
|
|
#include <QTableView>
|
|
|
|
|
|
|
|
|
|
class ThemeColumns : public KExtraColumnsProxyModel
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
ThemeColumns( QObject* parent );
|
|
|
|
|
|
|
|
|
|
QVariant extraColumnData( const QModelIndex& parent, int row, int extraColumn, int role ) const override;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
ThemeColumns::ThemeColumns( QObject* parent )
|
|
|
|
|
: KExtraColumnsProxyModel( parent )
|
|
|
|
|
{
|
|
|
|
|
appendColumn();
|
|
|
|
|
appendColumn();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QVariant
|
|
|
|
|
ThemeColumns::extraColumnData( const QModelIndex&, int row, int extraColumn, int role ) const
|
|
|
|
|
{
|
|
|
|
|
if ( role != Qt::DisplayRole )
|
|
|
|
|
{
|
|
|
|
|
return QVariant();
|
|
|
|
|
}
|
|
|
|
|
switch ( extraColumn )
|
|
|
|
|
{
|
|
|
|
|
case 0:
|
|
|
|
|
return sourceModel()->data( sourceModel()->index( row, 0 ), ThemesModel::DescriptionRole );
|
|
|
|
|
case 1:
|
|
|
|
|
return sourceModel()->data( sourceModel()->index( row, 0 ), ThemesModel::ImageRole );
|
|
|
|
|
default:
|
|
|
|
|
return QVariant();
|
|
|
|
|
}
|
|
|
|
|
__builtin_unreachable();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
PlasmaLnfPage::PlasmaLnfPage( Config* config, QWidget* parent )
|
|
|
|
|
: QWidget( parent )
|
|
|
|
@ -77,12 +41,9 @@ PlasmaLnfPage::PlasmaLnfPage( Config* config, QWidget* parent )
|
|
|
|
|
"once the system is installed. Clicking on a look-and-feel "
|
|
|
|
|
"selection will give you a live preview of that look-and-feel." ) );
|
|
|
|
|
} )
|
|
|
|
|
connect( this, &PlasmaLnfPage::plasmaThemeSelected, config, &Config::setTheme );
|
|
|
|
|
|
|
|
|
|
QTableView* view = new QTableView( this );
|
|
|
|
|
ThemeColumns* columnsModel = new ThemeColumns( this );
|
|
|
|
|
columnsModel->setSourceModel( m_config->themeModel() );
|
|
|
|
|
view->setModel( columnsModel );
|
|
|
|
|
view->setModel( m_config->themeModel() );
|
|
|
|
|
view->verticalHeader()->hide();
|
|
|
|
|
view->horizontalHeader()->hide();
|
|
|
|
|
ui->verticalLayout->addWidget( view );
|
|
|
|
@ -98,7 +59,7 @@ PlasmaLnfPage::PlasmaLnfPage( Config* config, QWidget* parent )
|
|
|
|
|
auto id = model->data( model->index( row, 0 ), ThemesModel::KeyRole ).toString();
|
|
|
|
|
if ( !id.isEmpty() )
|
|
|
|
|
{
|
|
|
|
|
emit plasmaThemeSelected( id );
|
|
|
|
|
m_config->setTheme( id );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} );
|
|
|
|
|