diff --git a/kwin/CMakeLists.txt b/kwin/CMakeLists.txt index c3df9a4..4f5969d 100644 --- a/kwin/CMakeLists.txt +++ b/kwin/CMakeLists.txt @@ -26,8 +26,6 @@ include(cmake/qtversion.cmake) # required frameworks by Core find_package(KF${QT_MAJOR_VERSION} ${KF_MIN_VERSION} REQUIRED COMPONENTS - Config - ConfigWidgets CoreAddons GlobalAccel I18n diff --git a/kwin/src/CMakeLists.txt b/kwin/src/CMakeLists.txt index 896a2dc..71a6c70 100644 --- a/kwin/src/CMakeLists.txt +++ b/kwin/src/CMakeLists.txt @@ -2,14 +2,11 @@ # # SPDX-License-Identifier: BSD-3-Clause -add_subdirectory(kcm) - kcoreaddons_add_plugin(breezy_desktop_effect INSTALL_NAMESPACE "kwin/effects/plugins/") target_sources(breezy_desktop_effect PRIVATE cubeeffect.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 @@ -17,8 +14,6 @@ target_link_libraries(breezy_desktop_effect Qt6::Gui Qt6::Quick - KF6::ConfigCore - KF6::ConfigGui KF6::CoreAddons KF6::GlobalAccel KF6::I18n diff --git a/kwin/src/cubeconfig.kcfg b/kwin/src/cubeconfig.kcfg index c1bffbe..e69de29 100644 --- a/kwin/src/cubeconfig.kcfg +++ b/kwin/src/cubeconfig.kcfg @@ -1,34 +0,0 @@ - - - - - - 100 - - - 150 - - - - - false - - - false - - - - Color - - - - - - - 33,36,39 - - - diff --git a/kwin/src/cubeconfig.kcfgc b/kwin/src/cubeconfig.kcfgc index 4c28cf9..e69de29 100644 --- a/kwin/src/cubeconfig.kcfgc +++ b/kwin/src/cubeconfig.kcfgc @@ -1,4 +0,0 @@ -File=cubeconfig.kcfg -ClassName=CubeConfig -Singleton=true -Mutators=true diff --git a/kwin/src/cubeeffect.cpp b/kwin/src/cubeeffect.cpp index 5a70d16..1d0d33a 100644 --- a/kwin/src/cubeeffect.cpp +++ b/kwin/src/cubeeffect.cpp @@ -5,7 +5,6 @@ */ #include "cubeeffect.h" -#include "cubeconfig.h" #include "effect/effect.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")))); - - reconfigure(ReconfigureAll); - m_xrRotationTimer = new QTimer(this); m_xrRotationTimer->setInterval(16); // ~60Hz connect(m_xrRotationTimer, &QTimer::timeout, this, &CubeEffect::updateXrRotation); 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 activateBorders = CubeConfig::borderActivate(); - for (const int &border : activateBorders) { - m_borderActivate.append(ElectricBorder(border)); - effects->reserveElectricBorder(ElectricBorder(border), this); - } - - const QList touchActivateBorders = CubeConfig::touchBorderActivate(); - for (const int &border : touchActivateBorders) { - m_touchBorderActivate.append(ElectricBorder(border)); - effects->registerTouchBorder(ElectricBorder(border), m_toggleAction); - } -} - QVariantMap CubeEffect::initialProperties(Output *screen) { return QVariantMap{ @@ -186,106 +137,37 @@ void CubeEffect::realDeactivate() int CubeEffect::animationDuration() const { - return m_animationDuration; -} - -void CubeEffect::setAnimationDuration(int duration) -{ - if (m_animationDuration != duration) { - m_animationDuration = duration; - Q_EMIT animationDurationChanged(); - } + return 200; } qreal CubeEffect::cubeFaceDisplacement() const { - return m_cubeFaceDisplacement; -} - -void CubeEffect::setCubeFaceDisplacement(qreal displacement) -{ - if (m_cubeFaceDisplacement != displacement) { - m_cubeFaceDisplacement = displacement; - Q_EMIT cubeFaceDisplacementChanged(); - } + return 100; } qreal CubeEffect::distanceFactor() const { - return m_distanceFactor; -} - -void CubeEffect::setDistanceFactor(qreal factor) -{ - if (m_distanceFactor != factor) { - m_distanceFactor = factor; - Q_EMIT distanceFactorChanged(); - } + return 1.5; } bool CubeEffect::mouseInvertedX() const { - return m_mouseInvertedX; -} - -void CubeEffect::setMouseInvertedX(bool inverted) -{ - if (m_mouseInvertedX != inverted) { - m_mouseInvertedX = inverted; - Q_EMIT mouseInvertedXChanged(); - } + return false; } bool CubeEffect::mouseInvertedY() const { - return m_mouseInvertedY; -} - -void CubeEffect::setMouseInvertedY(bool inverted) -{ - if (m_mouseInvertedY != inverted) { - m_mouseInvertedY = inverted; - Q_EMIT mouseInvertedYChanged(); - } + return false; } CubeEffect::BackgroundMode CubeEffect::backgroundMode() const { - return m_backgroundMode; -} - -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(); - } + return BackgroundMode::Color; } QColor CubeEffect::backgroundColor() const { - return m_backgroundColor; -} - -void CubeEffect::setBackgroundColor(const QColor &color) -{ - if (m_backgroundColor != color) { - m_backgroundColor = color; - Q_EMIT backgroundColorChanged(); - } + return QColor(Qt::black); } QQuaternion CubeEffect::xrRotation() const { diff --git a/kwin/src/cubeeffect.h b/kwin/src/cubeeffect.h index f37c8aa..5829318 100644 --- a/kwin/src/cubeeffect.h +++ b/kwin/src/cubeeffect.h @@ -23,7 +23,6 @@ class CubeEffect : public QuickSceneEffect Q_PROPERTY(qreal distanceFactor READ distanceFactor NOTIFY distanceFactorChanged) Q_PROPERTY(bool mouseInvertedX READ mouseInvertedX NOTIFY mouseInvertedXChanged) 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(QColor backgroundColor READ backgroundColor NOTIFY backgroundColorChanged) Q_PROPERTY(QQuaternion xrRotation READ xrRotation NOTIFY xrRotationChanged) @@ -37,34 +36,17 @@ public: CubeEffect(); - void reconfigure(ReconfigureFlags flags) override; int requestedEffectChainPosition() const override; void grabbedKeyboardEvent(QKeyEvent *e) override; bool borderActivated(ElectricBorder border) override; int animationDuration() const; - void setAnimationDuration(int duration); - qreal cubeFaceDisplacement() const; - void setCubeFaceDisplacement(qreal displacement); - qreal distanceFactor() const; - void setDistanceFactor(qreal factor); - bool mouseInvertedX() const; - void setMouseInvertedX(bool inverted); - bool mouseInvertedY() const; - void setMouseInvertedY(bool inverted); - - QUrl skybox() const; - void setSkybox(const QUrl &url); - BackgroundMode backgroundMode() const; - void setBackgroundMode(BackgroundMode mode); - QColor backgroundColor() const; - void setBackgroundColor(const QColor &color); QQuaternion xrRotation() const; @@ -96,14 +78,6 @@ private: QList m_toggleShortcut; QList m_borderActivate; QList 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; QTimer *m_xrRotationTimer = nullptr; }; diff --git a/kwin/src/kcm/CMakeLists.txt b/kwin/src/kcm/CMakeLists.txt deleted file mode 100644 index 9a6df2a..0000000 --- a/kwin/src/kcm/CMakeLists.txt +++ /dev/null @@ -1,20 +0,0 @@ -# SPDX-FileCopyrightText: 2022 Vlad Zahorodnii -# -# 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 -) diff --git a/kwin/src/kcm/cubeeffectkcm.cpp b/kwin/src/kcm/cubeeffectkcm.cpp deleted file mode 100644 index 3bbef93..0000000 --- a/kwin/src/kcm/cubeeffectkcm.cpp +++ /dev/null @@ -1,135 +0,0 @@ -/* - SPDX-FileCopyrightText: 2022 Vlad Zahorodnii - - SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL -*/ - -#include "cubeeffectkcm.h" -#include "cubeconfig.h" - -#include - -#include -#include -#include -#include - -#include -#include - -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" diff --git a/kwin/src/kcm/cubeeffectkcm.h b/kwin/src/kcm/cubeeffectkcm.h deleted file mode 100644 index de1a60a..0000000 --- a/kwin/src/kcm/cubeeffectkcm.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - SPDX-FileCopyrightText: 2022 Vlad Zahorodnii - - SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL -*/ - -#pragma once - -#include - -#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; -}; diff --git a/kwin/src/kcm/cubeeffectkcm.ui b/kwin/src/kcm/cubeeffectkcm.ui deleted file mode 100644 index 44c23aa..0000000 --- a/kwin/src/kcm/cubeeffectkcm.ui +++ /dev/null @@ -1,307 +0,0 @@ - - - - CubeEffectConfig - - - - 0 - 0 - 455 - 361 - - - - - 400 - 250 - - - - - - - Cube face displacement: - - - - - - - - - 300 - - - Qt::Horizontal - - - - - - - - 0 - 0 - - - - Less - - - - - - - - 0 - 0 - - - - More - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - - Distance: - - - - - - - - - 100 - - - 300 - - - Qt::Horizontal - - - - - - - - 0 - 0 - - - - Closer - - - - - - - - 0 - 0 - - - - Farther - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - - Mouse: - - - - - - - Invert X - - - - - - - Invert Y - - - - - - - Background: - - - - - - - - - - - - 0 - 0 - - - - Plain color: - - - - - - - false - - - false - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - Skybox: - - - - - - - false - - - Type path or URL... - - - - - - - false - - - Select... - - - - - - - - - - - - 0 - 0 - - - - - - - - - KColorButton - QPushButton -
kcolorbutton.h
-
- - KShortcutsEditor - QWidget -
kshortcutseditor.h
- 1 -
-
- - - - button_SkyBox - toggled(bool) - button_SelectSkyBox - setEnabled(bool) - - - 242 - 229 - - - 446 - 235 - - - - - button_SkyBox - toggled(bool) - kcfg_SkyBox - setEnabled(bool) - - - 242 - 229 - - - 356 - 234 - - - - - button_Color - toggled(bool) - kcfg_BackgroundColor - setEnabled(bool) - - - 196 - 175 - - - 292 - 181 - - - - -
diff --git a/kwin/src/metadata.json b/kwin/src/metadata.json index 7e0f29d..17b467c 100644 --- a/kwin/src/metadata.json +++ b/kwin/src/metadata.json @@ -12,6 +12,5 @@ "License": "GPL", "Name": "Breezy Desktop XR" }, - "X-KDE-ConfigModule": "breezy_desktop_config", "X-KWin-Border-Activate": true } diff --git a/kwin/src/qml/main.qml b/kwin/src/qml/main.qml index 5d7cfbe..c9aa0b7 100644 --- a/kwin/src/qml/main.qml +++ b/kwin/src/qml/main.qml @@ -37,35 +37,6 @@ 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