Draft: Big overhaul of the settings

This commit is contained in:
Carl Schwan
2021-06-04 23:46:31 +02:00
parent d9eaa95b9d
commit 23bd73c499
11 changed files with 467 additions and 69 deletions

39
src/colorschemer.cpp Normal file
View File

@@ -0,0 +1,39 @@
#include <KColorSchemeManager>
#include <QAbstractItemModel>
#include "colorschemer.h"
ColorSchemer::ColorSchemer(QObject* parent)
: QObject(parent)
, c(new KColorSchemeManager(this))
{
}
ColorSchemer::~ColorSchemer()
{
}
QAbstractItemModel *ColorSchemer::model() const
{
return c->model();
}
void ColorSchemer::apply(int idx)
{
c->activateScheme(c->model()->index(idx, 0));
}
void ColorSchemer::apply(const QString &name)
{
c->activateScheme(c->indexForScheme(name));
}
int ColorSchemer::indexForScheme(const QString &name) const
{
return c->indexForScheme(name).row();
}
QString ColorSchemer::nameForIndex(int index) const
{
return c->model()->data(c->model()->index(index, 0), Qt::DisplayRole).toString();
}