Commit 101b5f74 authored by David Edmundson's avatar David Edmundson
Browse files

Add KCM for adjusting QtQuick Rendering in Plasma

Summary:
Does what you imagine it would.
It's akin to KWin's compositor settings, designed to be hidden away and
not used by 99%.

Test Plan:
Set some values
Looked at config.
Unset set values

Reviewers: #plasma, mart

Reviewed By: #plasma, mart

Subscribers: abetts, mart, graesslin, alexeymin, sebas, broulik, plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D7934
parent b8762ede
......@@ -48,6 +48,7 @@ add_subdirectory(translations)
add_subdirectory(spellchecking)
add_subdirectory(phonon)
add_subdirectory(runners)
add_subdirectory(qtquicksettings)
add_subdirectory(workspaceoptions)
if (KF5Baloo_FOUND)
......
add_definitions(-DTRANSLATION_DOMAIN=\"kcmqtquicksettings\")
set(kcm_qtquicksettings_PART_SRCS kcmqtquicksettings.cpp)
kconfig_add_kcfg_files(kcm_qtquicksettings_PART_SRCS renderersettings.kcfgc)
ki18n_wrap_ui(kcm_qtquicksettings_PART_SRCS kcmqtquicksettingswidget.ui)
add_library(kcm_qtquicksettings ${kcm_qtquicksettings_PART_SRCS})
target_link_libraries(kcm_qtquicksettings
Qt5::Widgets
KF5::WidgetsAddons
KF5::KCMUtils
KF5::I18n
)
########### install files ###############
install(TARGETS kcm_qtquicksettings DESTINATION ${PLUGIN_INSTALL_DIR})
install(FILES qtquicksettings.desktop DESTINATION ${SERVICES_INSTALL_DIR})
#! /usr/bin/env bash
$EXTRACTRC *.ui >> rc.cpp
$XGETTEXT *.cpp -o $podir/kcmqtquicksettings.pot
rm -f rc.cpp
/* This file is part of the KDE's Plasma desktop
* Copyright 2017 David Edmundson <davidedmundson@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#include "kcmqtquicksettings.h"
#include <KPluginFactory>
#include <KAboutData>
#include <QDebug>
#include "ui_kcmqtquicksettingswidget.h"
#include "renderersettings.h"
K_PLUGIN_FACTORY(KCMQtQuickSettingsFactory, registerPlugin<KCMQtQuickSettingsModule>();)
KCMQtQuickSettingsModule::KCMQtQuickSettingsModule(QWidget *parent, const QVariantList &args)
: KCModule(parent, args),
m_ui(new Ui::KCMQtQuickSettingsWidget),
m_settings(new PlasmaQtQuickSettings::RendererSettings(KSharedConfig::openConfig(QStringLiteral("kdeglobals"))))
{
KAboutData *about = new KAboutData(QStringLiteral("Plasma QtQuick Settings"),
i18n("Plasma QtQuick Settings"),
QString(),
i18n("Configure Plasma QtQuick Settings"),
KAboutLicense::GPL);
about->addAuthor(i18n("David Edmundson"), i18n("Maintainer"), QStringLiteral("davidedmundson@kde.org"));
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("opengl"));
m_ui->backendCombo->addItem(i18n("Software"), QVariant("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));
}
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"
/* This file is part of the KDE's Plasma desktop
* Copyright 2017 David Edmundson <davidedmundson@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#pragma once
#include <KCModule>
#include <KSharedConfig>
#include <KConfigGroup>
namespace Ui
{
class KCMQtQuickSettingsWidget;
}
namespace PlasmaQtQuickSettings
{
class RendererSettings;
}
/**
* @short A KCM to configure Plasma QtQuick settings
*/
class KCMQtQuickSettingsModule : public KCModule
{
Q_OBJECT
public:
KCMQtQuickSettingsModule(QWidget *parent, const QVariantList &);
virtual ~KCMQtQuickSettingsModule();
void load() Q_DECL_OVERRIDE;
void save() Q_DECL_OVERRIDE;
void defaults() Q_DECL_OVERRIDE;
private:
QScopedPointer<Ui::KCMQtQuickSettingsWidget> m_ui;
QScopedPointer<PlasmaQtQuickSettings::RendererSettings> m_settings;
};
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>KCMQtQuickSettingsWidget</class>
<widget class="QWidget" name="KCMQtQuickSettingsWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>687</width>
<height>333</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="KMessageWidget" name="kmessagewidget">
<property name="text">
<string>These settings adjust the QtQuick settings used by Plasma. Only adjust if you know what you are doing.</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="messageType">
<enum>KMessageWidget::Information</enum>
</property>
</widget>
</item>
<item>
<layout class="QFormLayout" name="formLayout">
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Rendering Backend:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="backendCombo"/>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>GL Core Profile:</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Render Loop:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="renderLoopCombo"/>
</item>
<item row="2" column="1">
<widget class="QCheckBox" name="glCoreProfileCheckbox">
<property name="text">
<string>Force</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>143</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>KMessageWidget</class>
<extends>QFrame</extends>
<header>kmessagewidget.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>
[Desktop Entry]
Exec=kcmshell5 qtquicksettings
Icon=preferences-desktop-locale
Type=Service
X-KDE-ServiceTypes=KCModule
X-DocPath=kcontrol/qtquicksettings/index.html
X-KDE-Library=kcm_qtquicksettings
X-KDE-ParentApp=kcontrol
X-KDE-System-Settings-Parent-Category=hidden
X-KDE-Weight=60
Name=Plasma Renderer
Categories=Qt;KDE;X-KDE-settings-qtquicksettings;
<?xml version="1.0" encoding="UTF-8" ?>
<kcfg xmlns="http://www.kde.org/standards/kcfg/1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0
http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" >
<kcfgfile arg="true" />
<group name="QtQuickRendererSettings">
<entry name="RenderLoop" type="String">
<default></default>
</entry>
<entry name="SceneGraphBackend" type="String">
<default></default>
</entry>
<entry name="ForceGlCoreProfile" type="Bool">
<default>false</default>
</entry>
</group>
</kcfg>
File=renderer.kcfg
NameSpace=PlasmaQtQuickSettings
ClassName=RendererSettings
UseEnumTypes=true
Mutators=true
Supports Markdown
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