Remove kconfig stuff
This commit is contained in:
parent
72f81c1ad7
commit
faf35e0cd4
|
|
@ -26,8 +26,6 @@ include(cmake/qtversion.cmake)
|
||||||
|
|
||||||
# required frameworks by Core
|
# required frameworks by Core
|
||||||
find_package(KF${QT_MAJOR_VERSION} ${KF_MIN_VERSION} REQUIRED COMPONENTS
|
find_package(KF${QT_MAJOR_VERSION} ${KF_MIN_VERSION} REQUIRED COMPONENTS
|
||||||
Config
|
|
||||||
ConfigWidgets
|
|
||||||
CoreAddons
|
CoreAddons
|
||||||
GlobalAccel
|
GlobalAccel
|
||||||
I18n
|
I18n
|
||||||
|
|
|
||||||
|
|
@ -2,14 +2,11 @@
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: BSD-3-Clause
|
# SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
|
||||||
add_subdirectory(kcm)
|
|
||||||
|
|
||||||
kcoreaddons_add_plugin(breezy_desktop_effect INSTALL_NAMESPACE "kwin/effects/plugins/")
|
kcoreaddons_add_plugin(breezy_desktop_effect INSTALL_NAMESPACE "kwin/effects/plugins/")
|
||||||
target_sources(breezy_desktop_effect PRIVATE
|
target_sources(breezy_desktop_effect PRIVATE
|
||||||
cubeeffect.cpp
|
cubeeffect.cpp
|
||||||
main.cpp
|
main.cpp
|
||||||
)
|
)
|
||||||
kconfig_add_kcfg_files(breezy_desktop_effect cubeconfig.kcfgc)
|
|
||||||
|
|
||||||
target_include_directories(breezy_desktop_effect PRIVATE /usr/include/kwin)
|
target_include_directories(breezy_desktop_effect PRIVATE /usr/include/kwin)
|
||||||
target_link_libraries(breezy_desktop_effect
|
target_link_libraries(breezy_desktop_effect
|
||||||
|
|
@ -17,8 +14,6 @@ target_link_libraries(breezy_desktop_effect
|
||||||
Qt6::Gui
|
Qt6::Gui
|
||||||
Qt6::Quick
|
Qt6::Quick
|
||||||
|
|
||||||
KF6::ConfigCore
|
|
||||||
KF6::ConfigGui
|
|
||||||
KF6::CoreAddons
|
KF6::CoreAddons
|
||||||
KF6::GlobalAccel
|
KF6::GlobalAccel
|
||||||
KF6::I18n
|
KF6::I18n
|
||||||
|
|
|
||||||
|
|
@ -1,34 +0,0 @@
|
||||||
<?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 name="kwinrc"/>
|
|
||||||
<group name="Effect-cube">
|
|
||||||
<entry name="CubeFaceDisplacement" type="Double">
|
|
||||||
<default>100</default>
|
|
||||||
</entry>
|
|
||||||
<entry name="DistanceFactor" type="Double">
|
|
||||||
<default>150</default>
|
|
||||||
</entry>
|
|
||||||
<entry name="BorderActivate" type="IntList" />
|
|
||||||
<entry name="TouchBorderActivate" type="IntList" />
|
|
||||||
<entry name="MouseInvertedX" type="Bool">
|
|
||||||
<default>false</default>
|
|
||||||
</entry>
|
|
||||||
<entry name="MouseInvertedY" type="Bool">
|
|
||||||
<default>false</default>
|
|
||||||
</entry>
|
|
||||||
<entry name="SkyBox" type="Url" />
|
|
||||||
<entry name="Background" type="Enum">
|
|
||||||
<default>Color</default>
|
|
||||||
<choices>
|
|
||||||
<choice name="Color" />
|
|
||||||
<choice name="Skybox" />
|
|
||||||
</choices>
|
|
||||||
</entry>
|
|
||||||
<entry name="BackgroundColor" type="Color">
|
|
||||||
<default>33,36,39</default>
|
|
||||||
</entry>
|
|
||||||
</group>
|
|
||||||
</kcfg>
|
|
||||||
|
|
@ -1,4 +0,0 @@
|
||||||
File=cubeconfig.kcfg
|
|
||||||
ClassName=CubeConfig
|
|
||||||
Singleton=true
|
|
||||||
Mutators=true
|
|
||||||
|
|
@ -5,7 +5,6 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "cubeeffect.h"
|
#include "cubeeffect.h"
|
||||||
#include "cubeconfig.h"
|
|
||||||
#include "effect/effect.h"
|
#include "effect/effect.h"
|
||||||
#include "effect/effecthandler.h"
|
#include "effect/effecthandler.h"
|
||||||
|
|
||||||
|
|
@ -51,60 +50,12 @@ CubeEffect::CubeEffect()
|
||||||
|
|
||||||
setSource(QUrl::fromLocalFile(QStandardPaths::locate(QStandardPaths::GenericDataLocation, QStringLiteral("kwin/effects/cube/qml/main.qml"))));
|
setSource(QUrl::fromLocalFile(QStandardPaths::locate(QStandardPaths::GenericDataLocation, QStringLiteral("kwin/effects/cube/qml/main.qml"))));
|
||||||
|
|
||||||
|
|
||||||
reconfigure(ReconfigureAll);
|
|
||||||
|
|
||||||
m_xrRotationTimer = new QTimer(this);
|
m_xrRotationTimer = new QTimer(this);
|
||||||
m_xrRotationTimer->setInterval(16); // ~60Hz
|
m_xrRotationTimer->setInterval(16); // ~60Hz
|
||||||
connect(m_xrRotationTimer, &QTimer::timeout, this, &CubeEffect::updateXrRotation);
|
connect(m_xrRotationTimer, &QTimer::timeout, this, &CubeEffect::updateXrRotation);
|
||||||
m_xrRotationTimer->start();
|
m_xrRotationTimer->start();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CubeEffect::reconfigure(ReconfigureFlags)
|
|
||||||
{
|
|
||||||
CubeConfig::self()->read();
|
|
||||||
setAnimationDuration(animationTime(std::chrono::milliseconds(200)));
|
|
||||||
setCubeFaceDisplacement(CubeConfig::cubeFaceDisplacement());
|
|
||||||
setDistanceFactor(CubeConfig::distanceFactor() / 100.0);
|
|
||||||
setMouseInvertedX(CubeConfig::mouseInvertedX());
|
|
||||||
setMouseInvertedY(CubeConfig::mouseInvertedY());
|
|
||||||
setSkybox(CubeConfig::skyBox());
|
|
||||||
setBackgroundColor(CubeConfig::backgroundColor());
|
|
||||||
|
|
||||||
switch (CubeConfig::background()) {
|
|
||||||
case CubeConfig::EnumBackground::Skybox:
|
|
||||||
setBackgroundMode(BackgroundMode::Skybox);
|
|
||||||
break;
|
|
||||||
case CubeConfig::EnumBackground::Color:
|
|
||||||
default:
|
|
||||||
setBackgroundMode(BackgroundMode::Color);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (const ElectricBorder &border : std::as_const(m_borderActivate)) {
|
|
||||||
effects->unreserveElectricBorder(border, this);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (const ElectricBorder &border : std::as_const(m_touchBorderActivate)) {
|
|
||||||
effects->unregisterTouchBorder(border, m_toggleAction);
|
|
||||||
}
|
|
||||||
|
|
||||||
m_borderActivate.clear();
|
|
||||||
m_touchBorderActivate.clear();
|
|
||||||
|
|
||||||
const QList<int> activateBorders = CubeConfig::borderActivate();
|
|
||||||
for (const int &border : activateBorders) {
|
|
||||||
m_borderActivate.append(ElectricBorder(border));
|
|
||||||
effects->reserveElectricBorder(ElectricBorder(border), this);
|
|
||||||
}
|
|
||||||
|
|
||||||
const QList<int> touchActivateBorders = CubeConfig::touchBorderActivate();
|
|
||||||
for (const int &border : touchActivateBorders) {
|
|
||||||
m_touchBorderActivate.append(ElectricBorder(border));
|
|
||||||
effects->registerTouchBorder(ElectricBorder(border), m_toggleAction);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
QVariantMap CubeEffect::initialProperties(Output *screen)
|
QVariantMap CubeEffect::initialProperties(Output *screen)
|
||||||
{
|
{
|
||||||
return QVariantMap{
|
return QVariantMap{
|
||||||
|
|
@ -186,106 +137,37 @@ void CubeEffect::realDeactivate()
|
||||||
|
|
||||||
int CubeEffect::animationDuration() const
|
int CubeEffect::animationDuration() const
|
||||||
{
|
{
|
||||||
return m_animationDuration;
|
return 200;
|
||||||
}
|
|
||||||
|
|
||||||
void CubeEffect::setAnimationDuration(int duration)
|
|
||||||
{
|
|
||||||
if (m_animationDuration != duration) {
|
|
||||||
m_animationDuration = duration;
|
|
||||||
Q_EMIT animationDurationChanged();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
qreal CubeEffect::cubeFaceDisplacement() const
|
qreal CubeEffect::cubeFaceDisplacement() const
|
||||||
{
|
{
|
||||||
return m_cubeFaceDisplacement;
|
return 100;
|
||||||
}
|
|
||||||
|
|
||||||
void CubeEffect::setCubeFaceDisplacement(qreal displacement)
|
|
||||||
{
|
|
||||||
if (m_cubeFaceDisplacement != displacement) {
|
|
||||||
m_cubeFaceDisplacement = displacement;
|
|
||||||
Q_EMIT cubeFaceDisplacementChanged();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
qreal CubeEffect::distanceFactor() const
|
qreal CubeEffect::distanceFactor() const
|
||||||
{
|
{
|
||||||
return m_distanceFactor;
|
return 1.5;
|
||||||
}
|
|
||||||
|
|
||||||
void CubeEffect::setDistanceFactor(qreal factor)
|
|
||||||
{
|
|
||||||
if (m_distanceFactor != factor) {
|
|
||||||
m_distanceFactor = factor;
|
|
||||||
Q_EMIT distanceFactorChanged();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CubeEffect::mouseInvertedX() const
|
bool CubeEffect::mouseInvertedX() const
|
||||||
{
|
{
|
||||||
return m_mouseInvertedX;
|
return false;
|
||||||
}
|
|
||||||
|
|
||||||
void CubeEffect::setMouseInvertedX(bool inverted)
|
|
||||||
{
|
|
||||||
if (m_mouseInvertedX != inverted) {
|
|
||||||
m_mouseInvertedX = inverted;
|
|
||||||
Q_EMIT mouseInvertedXChanged();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CubeEffect::mouseInvertedY() const
|
bool CubeEffect::mouseInvertedY() const
|
||||||
{
|
{
|
||||||
return m_mouseInvertedY;
|
return false;
|
||||||
}
|
|
||||||
|
|
||||||
void CubeEffect::setMouseInvertedY(bool inverted)
|
|
||||||
{
|
|
||||||
if (m_mouseInvertedY != inverted) {
|
|
||||||
m_mouseInvertedY = inverted;
|
|
||||||
Q_EMIT mouseInvertedYChanged();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CubeEffect::BackgroundMode CubeEffect::backgroundMode() const
|
CubeEffect::BackgroundMode CubeEffect::backgroundMode() const
|
||||||
{
|
{
|
||||||
return m_backgroundMode;
|
return BackgroundMode::Color;
|
||||||
}
|
|
||||||
|
|
||||||
void CubeEffect::setBackgroundMode(BackgroundMode mode)
|
|
||||||
{
|
|
||||||
if (m_backgroundMode != mode) {
|
|
||||||
m_backgroundMode = mode;
|
|
||||||
Q_EMIT backgroundModeChanged();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
QUrl CubeEffect::skybox() const
|
|
||||||
{
|
|
||||||
return m_skybox;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CubeEffect::setSkybox(const QUrl &url)
|
|
||||||
{
|
|
||||||
if (m_skybox != url) {
|
|
||||||
m_skybox = url;
|
|
||||||
Q_EMIT skyboxChanged();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QColor CubeEffect::backgroundColor() const
|
QColor CubeEffect::backgroundColor() const
|
||||||
{
|
{
|
||||||
return m_backgroundColor;
|
return QColor(Qt::black);
|
||||||
}
|
|
||||||
|
|
||||||
void CubeEffect::setBackgroundColor(const QColor &color)
|
|
||||||
{
|
|
||||||
if (m_backgroundColor != color) {
|
|
||||||
m_backgroundColor = color;
|
|
||||||
Q_EMIT backgroundColorChanged();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QQuaternion CubeEffect::xrRotation() const {
|
QQuaternion CubeEffect::xrRotation() const {
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,6 @@ class CubeEffect : public QuickSceneEffect
|
||||||
Q_PROPERTY(qreal distanceFactor READ distanceFactor NOTIFY distanceFactorChanged)
|
Q_PROPERTY(qreal distanceFactor READ distanceFactor NOTIFY distanceFactorChanged)
|
||||||
Q_PROPERTY(bool mouseInvertedX READ mouseInvertedX NOTIFY mouseInvertedXChanged)
|
Q_PROPERTY(bool mouseInvertedX READ mouseInvertedX NOTIFY mouseInvertedXChanged)
|
||||||
Q_PROPERTY(bool mouseInvertedY READ mouseInvertedY NOTIFY mouseInvertedYChanged)
|
Q_PROPERTY(bool mouseInvertedY READ mouseInvertedY NOTIFY mouseInvertedYChanged)
|
||||||
Q_PROPERTY(QUrl skybox READ skybox NOTIFY skyboxChanged)
|
|
||||||
Q_PROPERTY(BackgroundMode backgroundMode READ backgroundMode NOTIFY backgroundModeChanged)
|
Q_PROPERTY(BackgroundMode backgroundMode READ backgroundMode NOTIFY backgroundModeChanged)
|
||||||
Q_PROPERTY(QColor backgroundColor READ backgroundColor NOTIFY backgroundColorChanged)
|
Q_PROPERTY(QColor backgroundColor READ backgroundColor NOTIFY backgroundColorChanged)
|
||||||
Q_PROPERTY(QQuaternion xrRotation READ xrRotation NOTIFY xrRotationChanged)
|
Q_PROPERTY(QQuaternion xrRotation READ xrRotation NOTIFY xrRotationChanged)
|
||||||
|
|
@ -37,34 +36,17 @@ public:
|
||||||
|
|
||||||
CubeEffect();
|
CubeEffect();
|
||||||
|
|
||||||
void reconfigure(ReconfigureFlags flags) override;
|
|
||||||
int requestedEffectChainPosition() const override;
|
int requestedEffectChainPosition() const override;
|
||||||
void grabbedKeyboardEvent(QKeyEvent *e) override;
|
void grabbedKeyboardEvent(QKeyEvent *e) override;
|
||||||
bool borderActivated(ElectricBorder border) override;
|
bool borderActivated(ElectricBorder border) override;
|
||||||
|
|
||||||
int animationDuration() const;
|
int animationDuration() const;
|
||||||
void setAnimationDuration(int duration);
|
|
||||||
|
|
||||||
qreal cubeFaceDisplacement() const;
|
qreal cubeFaceDisplacement() const;
|
||||||
void setCubeFaceDisplacement(qreal displacement);
|
|
||||||
|
|
||||||
qreal distanceFactor() const;
|
qreal distanceFactor() const;
|
||||||
void setDistanceFactor(qreal factor);
|
|
||||||
|
|
||||||
bool mouseInvertedX() const;
|
bool mouseInvertedX() const;
|
||||||
void setMouseInvertedX(bool inverted);
|
|
||||||
|
|
||||||
bool mouseInvertedY() const;
|
bool mouseInvertedY() const;
|
||||||
void setMouseInvertedY(bool inverted);
|
|
||||||
|
|
||||||
QUrl skybox() const;
|
|
||||||
void setSkybox(const QUrl &url);
|
|
||||||
|
|
||||||
BackgroundMode backgroundMode() const;
|
BackgroundMode backgroundMode() const;
|
||||||
void setBackgroundMode(BackgroundMode mode);
|
|
||||||
|
|
||||||
QColor backgroundColor() const;
|
QColor backgroundColor() const;
|
||||||
void setBackgroundColor(const QColor &color);
|
|
||||||
|
|
||||||
QQuaternion xrRotation() const;
|
QQuaternion xrRotation() const;
|
||||||
|
|
||||||
|
|
@ -96,14 +78,6 @@ private:
|
||||||
QList<QKeySequence> m_toggleShortcut;
|
QList<QKeySequence> m_toggleShortcut;
|
||||||
QList<ElectricBorder> m_borderActivate;
|
QList<ElectricBorder> m_borderActivate;
|
||||||
QList<ElectricBorder> m_touchBorderActivate;
|
QList<ElectricBorder> m_touchBorderActivate;
|
||||||
QUrl m_skybox;
|
|
||||||
qreal m_cubeFaceDisplacement = 100;
|
|
||||||
qreal m_distanceFactor = 1.5;
|
|
||||||
BackgroundMode m_backgroundMode = BackgroundMode::Color;
|
|
||||||
QColor m_backgroundColor;
|
|
||||||
int m_animationDuration = 200;
|
|
||||||
bool m_mouseInvertedX = true;
|
|
||||||
bool m_mouseInvertedY = true;
|
|
||||||
QQuaternion m_xrRotation;
|
QQuaternion m_xrRotation;
|
||||||
QTimer *m_xrRotationTimer = nullptr;
|
QTimer *m_xrRotationTimer = nullptr;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,20 +0,0 @@
|
||||||
# SPDX-FileCopyrightText: 2022 Vlad Zahorodnii <vlad.zahorodnii@kde.org>
|
|
||||||
#
|
|
||||||
# SPDX-License-Identifier: BSD-3-Clause
|
|
||||||
|
|
||||||
set(breezy_desktop_config_SOURCES cubeeffectkcm.cpp)
|
|
||||||
ki18n_wrap_ui(breezy_desktop_config_SOURCES cubeeffectkcm.ui)
|
|
||||||
qt_add_dbus_interface(breezy_desktop_config_SOURCES ${KWIN_EFFECTS_INTERFACE} kwineffects_interface)
|
|
||||||
|
|
||||||
kcoreaddons_add_plugin(breezy_desktop_config INSTALL_NAMESPACE "kwin/effects/configs" SOURCES ${breezy_desktop_config_SOURCES})
|
|
||||||
kconfig_add_kcfg_files(breezy_desktop_config ../cubeconfig.kcfgc)
|
|
||||||
target_link_libraries(breezy_desktop_config
|
|
||||||
KF6::ConfigCore
|
|
||||||
KF6::ConfigGui
|
|
||||||
KF6::ConfigWidgets
|
|
||||||
KF6::CoreAddons
|
|
||||||
KF6::GlobalAccel
|
|
||||||
KF6::I18n
|
|
||||||
KF6::KCMUtils
|
|
||||||
KF6::XmlGui
|
|
||||||
)
|
|
||||||
|
|
@ -1,135 +0,0 @@
|
||||||
/*
|
|
||||||
SPDX-FileCopyrightText: 2022 Vlad Zahorodnii <vlad.zahorodnii@kde.org>
|
|
||||||
|
|
||||||
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "cubeeffectkcm.h"
|
|
||||||
#include "cubeconfig.h"
|
|
||||||
|
|
||||||
#include <kwineffects_interface.h>
|
|
||||||
|
|
||||||
#include <KActionCollection>
|
|
||||||
#include <KGlobalAccel>
|
|
||||||
#include <KLocalizedString>
|
|
||||||
#include <KPluginFactory>
|
|
||||||
|
|
||||||
#include <QAction>
|
|
||||||
#include <QFileDialog>
|
|
||||||
|
|
||||||
K_PLUGIN_CLASS(CubeEffectConfig)
|
|
||||||
|
|
||||||
CubeEffectConfig::CubeEffectConfig(QObject *parent, const KPluginMetaData &data, const QVariantList &args)
|
|
||||||
: KCModule(parent, data)
|
|
||||||
{
|
|
||||||
ui.setupUi(widget());
|
|
||||||
addConfig(CubeConfig::self(), widget());
|
|
||||||
|
|
||||||
auto actionCollection = new KActionCollection(this, QStringLiteral("kwin"));
|
|
||||||
actionCollection->setComponentDisplayName(i18n("KWin"));
|
|
||||||
actionCollection->setConfigGroup(QStringLiteral("cube"));
|
|
||||||
actionCollection->setConfigGlobal(true);
|
|
||||||
|
|
||||||
const QKeySequence defaultToggleShortcut = Qt::META | Qt::Key_C;
|
|
||||||
QAction *toggleAction = actionCollection->addAction(QStringLiteral("Cube"));
|
|
||||||
toggleAction->setText(i18n("Toggle Cube"));
|
|
||||||
toggleAction->setProperty("isConfigurationAction", true);
|
|
||||||
KGlobalAccel::self()->setDefaultShortcut(toggleAction, {defaultToggleShortcut});
|
|
||||||
KGlobalAccel::self()->setShortcut(toggleAction, {defaultToggleShortcut});
|
|
||||||
|
|
||||||
ui.shortcutsEditor->addCollection(actionCollection);
|
|
||||||
connect(ui.shortcutsEditor, &KShortcutsEditor::keyChange, this, &CubeEffectConfig::markAsChanged);
|
|
||||||
|
|
||||||
connect(ui.button_SelectSkyBox, &QPushButton::clicked, this, [this]() {
|
|
||||||
auto dialog = new QFileDialog(widget());
|
|
||||||
dialog->setFileMode(QFileDialog::ExistingFile);
|
|
||||||
connect(dialog, &QFileDialog::fileSelected, ui.kcfg_SkyBox, &QLineEdit::setText);
|
|
||||||
dialog->open();
|
|
||||||
});
|
|
||||||
|
|
||||||
connect(ui.button_Color, &QPushButton::toggled, this, &CubeEffectConfig::updateUnmanagedState);
|
|
||||||
connect(ui.button_SkyBox, &QPushButton::toggled, this, &CubeEffectConfig::updateUnmanagedState);
|
|
||||||
}
|
|
||||||
|
|
||||||
CubeEffectConfig::~CubeEffectConfig()
|
|
||||||
{
|
|
||||||
// If save() is called, undo() has no effect.
|
|
||||||
ui.shortcutsEditor->undo();
|
|
||||||
}
|
|
||||||
|
|
||||||
void CubeEffectConfig::load()
|
|
||||||
{
|
|
||||||
KCModule::load();
|
|
||||||
updateUiFromConfig();
|
|
||||||
updateUnmanagedState();
|
|
||||||
}
|
|
||||||
|
|
||||||
void CubeEffectConfig::save()
|
|
||||||
{
|
|
||||||
updateConfigFromUi();
|
|
||||||
CubeConfig::self()->save();
|
|
||||||
KCModule::save();
|
|
||||||
updateUnmanagedState();
|
|
||||||
|
|
||||||
OrgKdeKwinEffectsInterface interface(QStringLiteral("org.kde.KWin"), QStringLiteral("/Effects"), QDBusConnection::sessionBus());
|
|
||||||
interface.reconfigureEffect(QStringLiteral("cube"));
|
|
||||||
}
|
|
||||||
|
|
||||||
void CubeEffectConfig::defaults()
|
|
||||||
{
|
|
||||||
KCModule::defaults();
|
|
||||||
updateUiFromDefaultConfig();
|
|
||||||
updateUnmanagedState();
|
|
||||||
}
|
|
||||||
|
|
||||||
void CubeEffectConfig::updateConfigFromUi()
|
|
||||||
{
|
|
||||||
CubeConfig::setBackground(uiBackground());
|
|
||||||
ui.shortcutsEditor->save();
|
|
||||||
}
|
|
||||||
|
|
||||||
void CubeEffectConfig::updateUiFromConfig()
|
|
||||||
{
|
|
||||||
setUiBackground(CubeConfig::background());
|
|
||||||
}
|
|
||||||
|
|
||||||
void CubeEffectConfig::updateUiFromDefaultConfig()
|
|
||||||
{
|
|
||||||
setUiBackground(defaultBackground());
|
|
||||||
ui.shortcutsEditor->allDefault();
|
|
||||||
}
|
|
||||||
|
|
||||||
int CubeEffectConfig::uiBackground() const
|
|
||||||
{
|
|
||||||
if (ui.button_SkyBox->isChecked()) {
|
|
||||||
return CubeConfig::EnumBackground::Skybox;
|
|
||||||
} else {
|
|
||||||
return CubeConfig::EnumBackground::Color;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int CubeEffectConfig::defaultBackground() const
|
|
||||||
{
|
|
||||||
return CubeConfig::EnumBackground::Color;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CubeEffectConfig::setUiBackground(int mode)
|
|
||||||
{
|
|
||||||
switch (mode) {
|
|
||||||
case CubeConfig::EnumBackground::Skybox:
|
|
||||||
ui.button_SkyBox->setChecked(true);
|
|
||||||
break;
|
|
||||||
case CubeConfig::EnumBackground::Color:
|
|
||||||
default:
|
|
||||||
ui.button_Color->setChecked(true);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void CubeEffectConfig::updateUnmanagedState()
|
|
||||||
{
|
|
||||||
unmanagedWidgetChangeState(CubeConfig::background() != uiBackground());
|
|
||||||
unmanagedWidgetDefaultState(CubeConfig::background() != defaultBackground());
|
|
||||||
}
|
|
||||||
|
|
||||||
#include "cubeeffectkcm.moc"
|
|
||||||
|
|
@ -1,37 +0,0 @@
|
||||||
/*
|
|
||||||
SPDX-FileCopyrightText: 2022 Vlad Zahorodnii <vlad.zahorodnii@kde.org>
|
|
||||||
|
|
||||||
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
|
|
||||||
*/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <KCModule>
|
|
||||||
|
|
||||||
#include "ui_cubeeffectkcm.h"
|
|
||||||
|
|
||||||
class CubeEffectConfig : public KCModule
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
CubeEffectConfig(QObject *parent, const KPluginMetaData &data, const QVariantList &args);
|
|
||||||
~CubeEffectConfig() override;
|
|
||||||
|
|
||||||
public Q_SLOTS:
|
|
||||||
void load() override;
|
|
||||||
void save() override;
|
|
||||||
void defaults() override;
|
|
||||||
|
|
||||||
private:
|
|
||||||
void updateUiFromConfig();
|
|
||||||
void updateUiFromDefaultConfig();
|
|
||||||
void updateConfigFromUi();
|
|
||||||
void updateUnmanagedState();
|
|
||||||
|
|
||||||
int uiBackground() const;
|
|
||||||
int defaultBackground() const;
|
|
||||||
void setUiBackground(int mode);
|
|
||||||
|
|
||||||
::Ui::CubeEffectConfig ui;
|
|
||||||
};
|
|
||||||
|
|
@ -1,307 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<!--
|
|
||||||
SPDX-FileCopyrightText: 2022 Vlad Zahorodnii <vlad.zahorodnii@kde.org>
|
|
||||||
|
|
||||||
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
|
|
||||||
-->
|
|
||||||
<ui version="4.0">
|
|
||||||
<class>CubeEffectConfig</class>
|
|
||||||
<widget class="QWidget" name="CubeEffectConfig">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>0</x>
|
|
||||||
<y>0</y>
|
|
||||||
<width>455</width>
|
|
||||||
<height>361</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>400</width>
|
|
||||||
<height>250</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<layout class="QFormLayout" name="formLayout">
|
|
||||||
<item row="0" column="0">
|
|
||||||
<widget class="QLabel" name="label_2">
|
|
||||||
<property name="text">
|
|
||||||
<string>Cube face displacement:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="1">
|
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
|
||||||
<item row="0" column="0" colspan="2">
|
|
||||||
<widget class="QSlider" name="kcfg_CubeFaceDisplacement">
|
|
||||||
<property name="maximum">
|
|
||||||
<number>300</number>
|
|
||||||
</property>
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="0">
|
|
||||||
<widget class="QLabel" name="label_less">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Less</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="1">
|
|
||||||
<widget class="QLabel" name="label_more">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>More</string>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="0">
|
|
||||||
<widget class="QLabel" name="label">
|
|
||||||
<property name="text">
|
|
||||||
<string>Distance:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="1">
|
|
||||||
<layout class="QGridLayout" name="gridLayout_2">
|
|
||||||
<item row="0" column="0" colspan="2">
|
|
||||||
<widget class="QSlider" name="kcfg_DistanceFactor">
|
|
||||||
<property name="minimum">
|
|
||||||
<number>100</number>
|
|
||||||
</property>
|
|
||||||
<property name="maximum">
|
|
||||||
<number>300</number>
|
|
||||||
</property>
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="0">
|
|
||||||
<widget class="QLabel" name="label_closer">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Closer</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="1">
|
|
||||||
<widget class="QLabel" name="label_farther">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Farther</string>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="0">
|
|
||||||
<widget class="QLabel" name="label_Mouse">
|
|
||||||
<property name="text">
|
|
||||||
<string>Mouse:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="1">
|
|
||||||
<widget class="QCheckBox" name="kcfg_MouseInvertedX">
|
|
||||||
<property name="text">
|
|
||||||
<string>Invert X</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="3" column="1">
|
|
||||||
<widget class="QCheckBox" name="kcfg_MouseInvertedY">
|
|
||||||
<property name="text">
|
|
||||||
<string>Invert Y</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="4" column="0">
|
|
||||||
<widget class="QLabel" name="label_4">
|
|
||||||
<property name="text">
|
|
||||||
<string>Background:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="4" column="1">
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
|
||||||
<item>
|
|
||||||
<widget class="QRadioButton" name="button_Color">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Plain color:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="KColorButton" name="kcfg_BackgroundColor">
|
|
||||||
<property name="enabled">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="flat">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<spacer name="horizontalSpacer">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>40</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
|
||||||
<item>
|
|
||||||
<widget class="QRadioButton" name="button_SkyBox">
|
|
||||||
<property name="text">
|
|
||||||
<string>Skybox:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QLineEdit" name="kcfg_SkyBox">
|
|
||||||
<property name="enabled">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="placeholderText">
|
|
||||||
<string>Type path or URL...</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="button_SelectSkyBox">
|
|
||||||
<property name="enabled">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Select...</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item row="5" column="0" colspan="2">
|
|
||||||
<widget class="KShortcutsEditor" name="shortcutsEditor">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
<customwidgets>
|
|
||||||
<customwidget>
|
|
||||||
<class>KColorButton</class>
|
|
||||||
<extends>QPushButton</extends>
|
|
||||||
<header>kcolorbutton.h</header>
|
|
||||||
</customwidget>
|
|
||||||
<customwidget>
|
|
||||||
<class>KShortcutsEditor</class>
|
|
||||||
<extends>QWidget</extends>
|
|
||||||
<header>kshortcutseditor.h</header>
|
|
||||||
<container>1</container>
|
|
||||||
</customwidget>
|
|
||||||
</customwidgets>
|
|
||||||
<resources/>
|
|
||||||
<connections>
|
|
||||||
<connection>
|
|
||||||
<sender>button_SkyBox</sender>
|
|
||||||
<signal>toggled(bool)</signal>
|
|
||||||
<receiver>button_SelectSkyBox</receiver>
|
|
||||||
<slot>setEnabled(bool)</slot>
|
|
||||||
<hints>
|
|
||||||
<hint type="sourcelabel">
|
|
||||||
<x>242</x>
|
|
||||||
<y>229</y>
|
|
||||||
</hint>
|
|
||||||
<hint type="destinationlabel">
|
|
||||||
<x>446</x>
|
|
||||||
<y>235</y>
|
|
||||||
</hint>
|
|
||||||
</hints>
|
|
||||||
</connection>
|
|
||||||
<connection>
|
|
||||||
<sender>button_SkyBox</sender>
|
|
||||||
<signal>toggled(bool)</signal>
|
|
||||||
<receiver>kcfg_SkyBox</receiver>
|
|
||||||
<slot>setEnabled(bool)</slot>
|
|
||||||
<hints>
|
|
||||||
<hint type="sourcelabel">
|
|
||||||
<x>242</x>
|
|
||||||
<y>229</y>
|
|
||||||
</hint>
|
|
||||||
<hint type="destinationlabel">
|
|
||||||
<x>356</x>
|
|
||||||
<y>234</y>
|
|
||||||
</hint>
|
|
||||||
</hints>
|
|
||||||
</connection>
|
|
||||||
<connection>
|
|
||||||
<sender>button_Color</sender>
|
|
||||||
<signal>toggled(bool)</signal>
|
|
||||||
<receiver>kcfg_BackgroundColor</receiver>
|
|
||||||
<slot>setEnabled(bool)</slot>
|
|
||||||
<hints>
|
|
||||||
<hint type="sourcelabel">
|
|
||||||
<x>196</x>
|
|
||||||
<y>175</y>
|
|
||||||
</hint>
|
|
||||||
<hint type="destinationlabel">
|
|
||||||
<x>292</x>
|
|
||||||
<y>181</y>
|
|
||||||
</hint>
|
|
||||||
</hints>
|
|
||||||
</connection>
|
|
||||||
</connections>
|
|
||||||
</ui>
|
|
||||||
|
|
@ -12,6 +12,5 @@
|
||||||
"License": "GPL",
|
"License": "GPL",
|
||||||
"Name": "Breezy Desktop XR"
|
"Name": "Breezy Desktop XR"
|
||||||
},
|
},
|
||||||
"X-KDE-ConfigModule": "breezy_desktop_config",
|
|
||||||
"X-KWin-Border-Activate": true
|
"X-KWin-Border-Activate": true
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -37,35 +37,6 @@ Item {
|
||||||
id: view
|
id: view
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|
||||||
Loader {
|
|
||||||
id: colorSceneEnvironment
|
|
||||||
active: effect.backgroundMode == CubeEffect.BackgroundMode.Color
|
|
||||||
sourceComponent: SceneEnvironment {
|
|
||||||
clearColor: effect.backgroundColor
|
|
||||||
backgroundMode: SceneEnvironment.Color
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Loader {
|
|
||||||
id: skyboxSceneEnvironment
|
|
||||||
active: effect.backgroundMode == CubeEffect.BackgroundMode.Skybox
|
|
||||||
sourceComponent: SceneEnvironment {
|
|
||||||
backgroundMode: SceneEnvironment.SkyBox
|
|
||||||
lightProbe: Texture {
|
|
||||||
source: effect.skybox
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
environment: {
|
|
||||||
switch (effect.backgroundMode) {
|
|
||||||
case CubeEffect.BackgroundMode.Skybox:
|
|
||||||
return skyboxSceneEnvironment.item;
|
|
||||||
case CubeEffect.BackgroundMode.Color:
|
|
||||||
return colorSceneEnvironment.item;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
PerspectiveCamera {
|
PerspectiveCamera {
|
||||||
id: camera
|
id: camera
|
||||||
fieldOfView: 22.55
|
fieldOfView: 22.55
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue