Revert "Remove kconfig stuff"

This reverts commit faf35e0cd4.
This commit is contained in:
wheaney 2025-07-18 11:30:57 -07:00
parent 126f69936c
commit 714264a08b
12 changed files with 227 additions and 2 deletions

View File

@ -26,6 +26,8 @@ include(cmake/qtversion.cmake)
# required frameworks by Core
find_package(KF${QT_MAJOR_VERSION} ${KF_MIN_VERSION} REQUIRED COMPONENTS
Config
ConfigWidgets
CoreAddons
GlobalAccel
I18n

View File

@ -1,8 +1,11 @@
add_subdirectory(kcm)
kcoreaddons_add_plugin(breezy_desktop_effect INSTALL_NAMESPACE "kwin/effects/plugins/")
target_sources(breezy_desktop_effect PRIVATE
breezydesktopeffect.cpp
main.cpp
)
kconfig_add_kcfg_files(breezy_desktop_effect cubeconfig.kcfgc)
target_include_directories(breezy_desktop_effect PRIVATE /usr/include/kwin)
target_link_libraries(breezy_desktop_effect
@ -10,6 +13,8 @@ target_link_libraries(breezy_desktop_effect
Qt6::Gui
Qt6::Quick
KF6::ConfigCore
KF6::ConfigGui
KF6::CoreAddons
KF6::GlobalAccel
KF6::I18n

View File

@ -1,4 +1,5 @@
#include "breezydesktopeffect.h"
#include "cubeconfig.h"
#include "effect/effect.h"
#include "effect/effecthandler.h"
#include "opengl/glutils.h"
@ -51,6 +52,7 @@ BreezyDesktopEffect::BreezyDesktopEffect()
connect(effects, &EffectsHandler::cursorShapeChanged, this, &BreezyDesktopEffect::updateCursorImage);
updateCursorImage();
reconfigure(ReconfigureAll);
setSource(QUrl::fromLocalFile(QStandardPaths::locate(QStandardPaths::GenericDataLocation, QStringLiteral("kwin/effects/breezy_desktop/qml/main.qml"))));
@ -66,6 +68,11 @@ BreezyDesktopEffect::BreezyDesktopEffect()
m_cursorUpdateTimer->start();
}
void BreezyDesktopEffect::reconfigure(ReconfigureFlags)
{
CubeConfig::self()->read();
}
QVariantMap BreezyDesktopEffect::initialProperties(Output *screen)
{
return QVariantMap{

View File

@ -34,6 +34,8 @@ namespace KWin
BreezyDesktopEffect();
void reconfigure(ReconfigureFlags) override;
int requestedEffectChainPosition() const override;
int animationDuration() const;

9
kwin/src/cubeconfig.kcfg Normal file
View File

@ -0,0 +1,9 @@
<?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-breezy_desktop">
</group>
</kcfg>

View File

@ -0,0 +1,4 @@
File=cubeconfig.kcfg
ClassName=CubeConfig
Singleton=true
Mutators=true

View File

@ -0,0 +1,20 @@
# 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
)

View File

@ -0,0 +1,74 @@
/*
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());
}
CubeEffectConfig::~CubeEffectConfig()
{
}
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()
{
}
void CubeEffectConfig::updateUiFromConfig()
{
}
void CubeEffectConfig::updateUiFromDefaultConfig()
{
}
void CubeEffectConfig::updateUnmanagedState()
{
}
#include "cubeeffectkcm.moc"

View File

@ -0,0 +1,33 @@
/*
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();
::Ui::CubeEffectConfig ui;
};

View File

@ -0,0 +1,39 @@
<?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>
</layout>
</widget>
<customwidgets>
</customwidgets>
<resources/>
<connections>
</connections>
</ui>

View File

@ -8,7 +8,7 @@
}
],
"Category": "Tools",
"Description": "Breezy Desktop XR Effect",
"Description": "Breezy Desktop XR Effect 2",
"EnabledByDefault": true,
"License": "GPL",
"Name": "Breezy Desktop XR",
@ -16,5 +16,6 @@
"KWin/Effect"
]
},
"X-Plasma-API-Minimum-Version": "6.0"
"X-Plasma-API-Minimum-Version": "6.0",
"X-KDE-ConfigModule": "breezy_desktop_config"
}

View File

@ -24,6 +24,35 @@ Item {
id: view
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 {
id: camera
fieldOfView: 22.55