Commit 61cd3d4b authored by Kevin Ottens's avatar Kevin Ottens
Browse files

Adjust QtQuickSettings KCM to use KConfigXT in full

Summary:
This removes quite a lot of uneeded code and fixes the automatic default
handling from KConfigXT point of view (this was the wrong integration
scheme with combo boxes).

It also gives me a nice testing ground for a widget based KCM usable
with kcmshell. :-)

Reviewers: #plasma, mart, davidedmundson

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D25068
parent c21a8bd8
......@@ -42,44 +42,11 @@ KCMQtQuickSettingsModule::KCMQtQuickSettingsModule(QWidget *parent, const QVaria
setAboutData(about);
m_ui->setupUi(this);
m_ui->backendCombo->addItem(i18n("Automatic"), QVariant(QStringLiteral()));//so data matches empty config
m_ui->backendCombo->addItem(i18n("Open GL"), QVariant(QStringLiteral("opengl")));
m_ui->backendCombo->addItem(i18n("Software"), QVariant(QStringLiteral("software")));
m_ui->renderLoopCombo->addItem(i18n("Automatic"), QVariant(QStringLiteral()));
m_ui->renderLoopCombo->addItem(i18n("Basic"), QVariant(QStringLiteral("basic")));
m_ui->renderLoopCombo->addItem(i18n("Threaded"), QVariant(QStringLiteral("threaded")));
connect(m_ui->backendCombo, static_cast<void (QComboBox::*)(int)>(&QComboBox::activated), this, static_cast<void (KCMQtQuickSettingsModule::*)()>(&KCMQtQuickSettingsModule::changed));
connect(m_ui->renderLoopCombo, static_cast<void (QComboBox::*)(int)>(&QComboBox::activated), this, static_cast<void (KCMQtQuickSettingsModule::*)()>(&KCMQtQuickSettingsModule::changed));
connect(m_ui->glCoreProfileCheckbox, &QCheckBox::stateChanged, this, static_cast<void (KCMQtQuickSettingsModule::*)()>(&KCMQtQuickSettingsModule::changed));
addConfig(m_settings.get(), this);
}
KCMQtQuickSettingsModule::~KCMQtQuickSettingsModule()
{
}
void KCMQtQuickSettingsModule::load()
{
m_ui->backendCombo->setCurrentIndex(m_ui->backendCombo->findData(m_settings->sceneGraphBackend()));
m_ui->renderLoopCombo->setCurrentIndex(m_ui->renderLoopCombo->findData(m_settings->renderLoop()));
m_ui->glCoreProfileCheckbox->setChecked(m_settings->forceGlCoreProfile());
}
void KCMQtQuickSettingsModule::save()
{
m_settings->setSceneGraphBackend(m_ui->backendCombo->currentData().toString());
m_settings->setRenderLoop(m_ui->renderLoopCombo->currentData().toString());
m_settings->setForceGlCoreProfile(m_ui->glCoreProfileCheckbox->isChecked());
m_settings->save();
}
void KCMQtQuickSettingsModule::defaults()
{
m_ui->backendCombo->setCurrentIndex(0);
m_ui->renderLoopCombo->setCurrentIndex(0);
m_ui->glCoreProfileCheckbox->setChecked(false);
}
#include "kcmqtquicksettings.moc"
......@@ -44,10 +44,6 @@ public:
explicit KCMQtQuickSettingsModule(QWidget *parent, const QVariantList &);
~KCMQtQuickSettingsModule() override;
void load() override;
void save() override;
void defaults() override;
private:
QScopedPointer<Ui::KCMQtQuickSettingsWidget> m_ui;
QScopedPointer<PlasmaQtQuickSettings::RendererSettings> m_settings;
......
......@@ -40,7 +40,23 @@
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="backendCombo"/>
<widget class="QComboBox" name="kcfg_SceneGraphBackend">
<item>
<property name="text">
<string>Automatic</string>
</property>
</item>
<item>
<property name="text">
<string>Open GL</string>
</property>
</item>
<item>
<property name="text">
<string>Software</string>
</property>
</item>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_2">
......@@ -57,10 +73,26 @@
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="renderLoopCombo"/>
<widget class="QComboBox" name="kcfg_RenderLoop">
<item>
<property name="text">
<string>Automatic</string>
</property>
</item>
<item>
<property name="text">
<string>Basic</string>
</property>
</item>
<item>
<property name="text">
<string>Threaded</string>
</property>
</item>
</widget>
</item>
<item row="2" column="1">
<widget class="QCheckBox" name="glCoreProfileCheckbox">
<widget class="QCheckBox" name="kcfg_ForceGlCoreProfile">
<property name="text">
<string>Force</string>
</property>
......
......@@ -5,11 +5,21 @@
http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" >
<kcfgfile arg="true" />
<group name="QtQuickRendererSettings">
<entry name="RenderLoop" type="String">
<default></default>
<entry name="RenderLoop" type="Enum">
<choices name="RenderLoopType">
<choice name="automaticloop" />
<choice name="basic" />
<choice name="threaded" />
</choices>
<default>automaticloop</default>
</entry>
<entry name="SceneGraphBackend" type="String">
<default></default>
<entry name="SceneGraphBackend" type="Enum">
<choices name="SceneGraphBackendType">
<choice name="automaticbackend" />
<choice name="opengl" />
<choice name="software" />
</choices>
<default>automaticbackend</default>
</entry>
<entry name="ForceGlCoreProfile" type="Bool">
<default>false</default>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment