Attempt to mimick kwin's built-in cube project structure, works except for config mirroring from UI
https://invent.kde.org/plasma/kdeplasma-addons/-/tree/master/kwin/effects/cube
This commit is contained in:
parent
742fa0e4ca
commit
f0d6543311
|
|
@ -0,0 +1,95 @@
|
||||||
|
---
|
||||||
|
# SPDX-FileCopyrightText: 2019 Christoph Cullmann <cullmann@kde.org>
|
||||||
|
# SPDX-FileCopyrightText: 2019 Gernot Gebhard <gebhard@absint.com>
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
|
# This file got automatically created by ECM, do not edit
|
||||||
|
# See https://clang.llvm.org/docs/ClangFormatStyleOptions.html for the config options
|
||||||
|
# and https://community.kde.org/Policies/Frameworks_Coding_Style#Clang-format_automatic_code_formatting
|
||||||
|
# for clang-format tips & tricks
|
||||||
|
---
|
||||||
|
Language: JavaScript
|
||||||
|
DisableFormat: true
|
||||||
|
---
|
||||||
|
Language: Json
|
||||||
|
DisableFormat: false
|
||||||
|
IndentWidth: 4
|
||||||
|
---
|
||||||
|
|
||||||
|
# Style for C++
|
||||||
|
Language: Cpp
|
||||||
|
|
||||||
|
# base is WebKit coding style: https://webkit.org/code-style-guidelines/
|
||||||
|
# below are only things set that diverge from this style!
|
||||||
|
BasedOnStyle: WebKit
|
||||||
|
|
||||||
|
# enforce C++11 (e.g. for std::vector<std::vector<lala>>
|
||||||
|
Standard: Cpp11
|
||||||
|
|
||||||
|
# 4 spaces indent
|
||||||
|
TabWidth: 4
|
||||||
|
|
||||||
|
# 2 * 80 wide lines
|
||||||
|
ColumnLimit: 160
|
||||||
|
|
||||||
|
# sort includes inside line separated groups
|
||||||
|
SortIncludes: true
|
||||||
|
|
||||||
|
# break before braces on function, namespace and class definitions.
|
||||||
|
BreakBeforeBraces: Linux
|
||||||
|
|
||||||
|
# CrlInstruction *a;
|
||||||
|
PointerAlignment: Right
|
||||||
|
|
||||||
|
# horizontally aligns arguments after an open bracket.
|
||||||
|
AlignAfterOpenBracket: Align
|
||||||
|
|
||||||
|
# don't move all parameters to new line
|
||||||
|
AllowAllParametersOfDeclarationOnNextLine: false
|
||||||
|
|
||||||
|
# no single line functions
|
||||||
|
AllowShortFunctionsOnASingleLine: None
|
||||||
|
|
||||||
|
# no single line enums
|
||||||
|
AllowShortEnumsOnASingleLine: false
|
||||||
|
|
||||||
|
# always break before you encounter multi line strings
|
||||||
|
AlwaysBreakBeforeMultilineStrings: true
|
||||||
|
|
||||||
|
# don't move arguments to own lines if they are not all on the same
|
||||||
|
BinPackArguments: false
|
||||||
|
|
||||||
|
# don't move parameters to own lines if they are not all on the same
|
||||||
|
BinPackParameters: false
|
||||||
|
|
||||||
|
# In case we have an if statement with multiple lines the operator should be at the beginning of the line
|
||||||
|
# but we do not want to break assignments
|
||||||
|
BreakBeforeBinaryOperators: NonAssignment
|
||||||
|
|
||||||
|
# format C++11 braced lists like function calls
|
||||||
|
Cpp11BracedListStyle: true
|
||||||
|
|
||||||
|
# do not put a space before C++11 braced lists
|
||||||
|
SpaceBeforeCpp11BracedList: false
|
||||||
|
|
||||||
|
# remove empty lines
|
||||||
|
KeepEmptyLinesAtTheStartOfBlocks: false
|
||||||
|
|
||||||
|
# no namespace indentation to keep indent level low
|
||||||
|
NamespaceIndentation: None
|
||||||
|
|
||||||
|
# we use template< without space.
|
||||||
|
SpaceAfterTemplateKeyword: false
|
||||||
|
|
||||||
|
# Always break after template declaration
|
||||||
|
AlwaysBreakTemplateDeclarations: true
|
||||||
|
|
||||||
|
# macros for which the opening brace stays attached.
|
||||||
|
ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH, forever, Q_FOREVER, QBENCHMARK, QBENCHMARK_ONCE , wl_resource_for_each, wl_resource_for_each_safe ]
|
||||||
|
|
||||||
|
# keep lambda formatting multi-line if not empty
|
||||||
|
AllowShortLambdasOnASingleLine: Empty
|
||||||
|
|
||||||
|
# We do not want clang-format to put all arguments on a new line
|
||||||
|
AllowAllArgumentsOnNextLine: false
|
||||||
|
|
@ -2,6 +2,11 @@ cmake_minimum_required(VERSION 3.20)
|
||||||
|
|
||||||
project(breezy_desktop_kwin_plugin VERSION 0.0.1 LANGUAGES CXX)
|
project(breezy_desktop_kwin_plugin VERSION 0.0.1 LANGUAGES CXX)
|
||||||
|
|
||||||
|
set(PROJECT_DEP_VERSION "6.3.90")
|
||||||
|
set(QT_MIN_VERSION "6.8.0")
|
||||||
|
set(KF6_MIN_VERSION "6.14.0")
|
||||||
|
set(KDE_COMPILERSETTINGS_LEVEL "5.82")
|
||||||
|
|
||||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||||
|
|
||||||
set(CMAKE_CXX_STANDARD 20)
|
set(CMAKE_CXX_STANDARD 20)
|
||||||
|
|
@ -10,19 +15,61 @@ set(CMAKE_CXX_EXTENSIONS OFF)
|
||||||
|
|
||||||
include(cmake/default-vars.cmake)
|
include(cmake/default-vars.cmake)
|
||||||
|
|
||||||
find_package(ECM "5.100" REQUIRED NO_MODULE)
|
find_package(ECM ${KF6_MIN_VERSION} REQUIRED NO_MODULE)
|
||||||
set(CMAKE_MODULE_PATH
|
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH})
|
||||||
${CMAKE_MODULE_PATH}
|
|
||||||
${ECM_MODULE_PATH}
|
|
||||||
${ECM_KDE_MODULE_DIR}
|
|
||||||
)
|
|
||||||
include(cmake/qtversion.cmake)
|
|
||||||
include(FeatureSummary)
|
|
||||||
include(KDEInstallDirs)
|
include(KDEInstallDirs)
|
||||||
include(KDECMakeSettings)
|
include(KDECMakeSettings)
|
||||||
include(KDECompilerSettings NO_POLICY_SCOPE)
|
include(KDECompilerSettings NO_POLICY_SCOPE)
|
||||||
|
include(ECMQtDeclareLoggingCategory)
|
||||||
|
include(ECMGenerateExportHeader)
|
||||||
|
include(ECMInstallIcons)
|
||||||
|
include(KDEPackageAppTemplates)
|
||||||
|
include(GenerateExportHeader)
|
||||||
|
include(CMakePackageConfigHelpers)
|
||||||
|
include(KDEClangFormat)
|
||||||
|
include(KDEGitCommitHooks)
|
||||||
|
include(ECMDeprecationSettings)
|
||||||
|
include(ECMQmlModule)
|
||||||
|
|
||||||
|
find_package(Qt6 ${QT_MIN_VERSION} CONFIG REQUIRED
|
||||||
|
Core
|
||||||
|
Gui
|
||||||
|
DBus
|
||||||
|
Network
|
||||||
|
Quick
|
||||||
|
Qml
|
||||||
|
Widgets
|
||||||
|
Test
|
||||||
|
Core5Compat
|
||||||
|
)
|
||||||
|
|
||||||
|
find_package(KF6 ${KF6_MIN_VERSION} REQUIRED COMPONENTS
|
||||||
|
Config
|
||||||
|
CoreAddons
|
||||||
|
DBusAddons
|
||||||
|
Declarative
|
||||||
|
GlobalAccel
|
||||||
|
Holidays
|
||||||
|
I18n
|
||||||
|
Auth
|
||||||
|
KIO
|
||||||
|
KCMUtils
|
||||||
|
Notifications
|
||||||
|
Runner
|
||||||
|
Service
|
||||||
|
Sonnet
|
||||||
|
UnitConversion
|
||||||
|
XmlGui
|
||||||
|
NewStuff
|
||||||
|
JobWidgets
|
||||||
|
Svg
|
||||||
|
)
|
||||||
|
|
||||||
|
find_package(Plasma5Support ${PROJECT_DEP_VERSION} REQUIRED)
|
||||||
|
find_package(Plasma ${PROJECT_DEP_VERSION} REQUIRED)
|
||||||
|
find_package(PlasmaQuick ${PROJECT_DEP_VERSION} REQUIRED)
|
||||||
|
|
||||||
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
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
add_subdirectory(kcm)
|
add_subdirectory(kcm)
|
||||||
|
kpackage_install_package(package breezy_desktop_effect effects kwin)
|
||||||
|
|
||||||
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
|
||||||
|
|
@ -22,6 +23,3 @@ target_link_libraries(breezy_desktop_effect
|
||||||
|
|
||||||
KWin::kwin
|
KWin::kwin
|
||||||
)
|
)
|
||||||
|
|
||||||
install(DIRECTORY qml DESTINATION ${KDE_INSTALL_DATADIR}/kwin/effects/breezy_desktop_effect)
|
|
||||||
install(FILES metadata.json DESTINATION ${KDE_INSTALL_DATADIR}/kwin/effects/breezy_desktop_effect)
|
|
||||||
|
|
|
||||||
|
|
@ -86,7 +86,7 @@ BreezyDesktopEffect::BreezyDesktopEffect()
|
||||||
updateCursorImage();
|
updateCursorImage();
|
||||||
reconfigure(ReconfigureAll);
|
reconfigure(ReconfigureAll);
|
||||||
|
|
||||||
setSource(QUrl::fromLocalFile(QStandardPaths::locate(QStandardPaths::GenericDataLocation, QStringLiteral("kwin/effects/breezy_desktop_effect/qml/main.qml"))));
|
setSource(QUrl::fromLocalFile(QStandardPaths::locate(QStandardPaths::GenericDataLocation, QStringLiteral("kwin/effects/breezy_desktop_effect/contents/ui/main.qml"))));
|
||||||
|
|
||||||
// Monitor the IMU file for changes, even if it doesn't exist at startup
|
// Monitor the IMU file for changes, even if it doesn't exist at startup
|
||||||
m_shmDirectoryWatcher = new QFileSystemWatcher(this);
|
m_shmDirectoryWatcher = new QFileSystemWatcher(this);
|
||||||
|
|
@ -123,6 +123,8 @@ BreezyDesktopEffect::BreezyDesktopEffect()
|
||||||
void BreezyDesktopEffect::reconfigure(ReconfigureFlags)
|
void BreezyDesktopEffect::reconfigure(ReconfigureFlags)
|
||||||
{
|
{
|
||||||
BreezyDesktopConfig::self()->read();
|
BreezyDesktopConfig::self()->read();
|
||||||
|
qCCritical(KWIN_XR) << "\t\t\tBreezy - reconfigure, focusedDisplayDistance:" << BreezyDesktopConfig::focusedDisplayDistance()
|
||||||
|
<< " allDisplaysDistance:" << BreezyDesktopConfig::allDisplaysDistance();
|
||||||
setFocusedDisplayDistance(BreezyDesktopConfig::focusedDisplayDistance());
|
setFocusedDisplayDistance(BreezyDesktopConfig::focusedDisplayDistance());
|
||||||
setAllDisplaysDistance(BreezyDesktopConfig::allDisplaysDistance());
|
setAllDisplaysDistance(BreezyDesktopConfig::allDisplaysDistance());
|
||||||
}
|
}
|
||||||
|
|
@ -211,6 +213,7 @@ qreal BreezyDesktopEffect::focusedDisplayDistance() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
void BreezyDesktopEffect::setFocusedDisplayDistance(qreal distance) {
|
void BreezyDesktopEffect::setFocusedDisplayDistance(qreal distance) {
|
||||||
|
qCCritical(KWIN_XR) << "\t\t\tBreezy - setFocusedDisplayDistance:" << distance;
|
||||||
if (distance != m_focusedDisplayDistance) {
|
if (distance != m_focusedDisplayDistance) {
|
||||||
m_focusedDisplayDistance = std::clamp(distance, 0.2, 2.5);
|
m_focusedDisplayDistance = std::clamp(distance, 0.2, 2.5);
|
||||||
Q_EMIT displayDistanceChanged();
|
Q_EMIT displayDistanceChanged();
|
||||||
|
|
@ -222,6 +225,7 @@ qreal BreezyDesktopEffect::allDisplaysDistance() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
void BreezyDesktopEffect::setAllDisplaysDistance(qreal distance) {
|
void BreezyDesktopEffect::setAllDisplaysDistance(qreal distance) {
|
||||||
|
qCCritical(KWIN_XR) << "\t\t\tBreezy - setAllDisplaysDistance:" << distance;
|
||||||
if (distance != m_allDisplaysDistance) {
|
if (distance != m_allDisplaysDistance) {
|
||||||
m_allDisplaysDistance = std::clamp(distance, 0.2, 2.5);
|
m_allDisplaysDistance = std::clamp(distance, 0.2, 2.5);
|
||||||
Q_EMIT displayDistanceChanged();
|
Q_EMIT displayDistanceChanged();
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,10 @@
|
||||||
# SPDX-FileCopyrightText: 2022 Vlad Zahorodnii <vlad.zahorodnii@kde.org>
|
|
||||||
#
|
|
||||||
# SPDX-License-Identifier: BSD-3-Clause
|
|
||||||
|
|
||||||
set(breezy_desktop_config_SOURCES breezydesktopeffectkcm.cpp)
|
set(breezy_desktop_config_SOURCES breezydesktopeffectkcm.cpp)
|
||||||
ki18n_wrap_ui(breezy_desktop_config_SOURCES breezydesktopeffectkcm.ui)
|
ki18n_wrap_ui(breezy_desktop_config_SOURCES breezydesktopeffectkcm.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})
|
kcoreaddons_add_plugin(breezy_desktop_config INSTALL_NAMESPACE "kwin/effects/configs" SOURCES ${breezy_desktop_config_SOURCES})
|
||||||
kconfig_add_kcfg_files(breezy_desktop_config ../breezydesktopconfig.kcfgc)
|
target_sources(breezy_desktop_config PRIVATE
|
||||||
|
resources.qrc
|
||||||
|
)
|
||||||
target_link_libraries(breezy_desktop_config
|
target_link_libraries(breezy_desktop_config
|
||||||
KF6::ConfigCore
|
KF6::ConfigCore
|
||||||
KF6::ConfigGui
|
KF6::ConfigGui
|
||||||
|
|
@ -18,3 +15,7 @@ target_link_libraries(breezy_desktop_config
|
||||||
KF6::KCMUtils
|
KF6::KCMUtils
|
||||||
KF6::XmlGui
|
KF6::XmlGui
|
||||||
)
|
)
|
||||||
|
|
||||||
|
target_compile_definitions(breezy_desktop_config PRIVATE
|
||||||
|
-DTRANSLATION_DOMAIN=\"breezy_desktop_effect\"
|
||||||
|
)
|
||||||
|
|
@ -5,9 +5,6 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "breezydesktopeffectkcm.h"
|
#include "breezydesktopeffectkcm.h"
|
||||||
#include "breezydesktopconfig.h"
|
|
||||||
|
|
||||||
#include <kwineffects_interface.h>
|
|
||||||
|
|
||||||
#include <KActionCollection>
|
#include <KActionCollection>
|
||||||
#include <KGlobalAccel>
|
#include <KGlobalAccel>
|
||||||
|
|
@ -15,15 +12,25 @@
|
||||||
#include <KPluginFactory>
|
#include <KPluginFactory>
|
||||||
|
|
||||||
#include <QAction>
|
#include <QAction>
|
||||||
|
#include <QDBusConnection>
|
||||||
|
#include <QDBusMessage>
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
|
#include <QLoggingCategory>
|
||||||
|
|
||||||
|
Q_LOGGING_CATEGORY(KWIN_XR, "kwin.xr")
|
||||||
|
|
||||||
K_PLUGIN_CLASS(BreezyDesktopEffectConfig)
|
K_PLUGIN_CLASS(BreezyDesktopEffectConfig)
|
||||||
|
|
||||||
BreezyDesktopEffectConfig::BreezyDesktopEffectConfig(QObject *parent, const KPluginMetaData &data, const QVariantList &args)
|
BreezyDesktopEffectConfig::BreezyDesktopEffectConfig(QObject *parent, const KPluginMetaData &data)
|
||||||
: KCModule(parent, data)
|
: KCModule(parent, data)
|
||||||
{
|
{
|
||||||
ui.setupUi(widget());
|
ui.setupUi(widget());
|
||||||
addConfig(BreezyDesktopConfig::self(), widget());
|
|
||||||
|
QFile xmlFile(QStringLiteral(":/main.xml"));
|
||||||
|
qCCritical(KWIN_XR) << "\t\t\tBreezy - xml file exists:" << xmlFile.exists();
|
||||||
|
KConfigGroup cg = KSharedConfig::openConfig(QStringLiteral("kwinrc"))->group("Effect-breezy_desktop_effect");
|
||||||
|
m_configLoader = new KConfigLoader(cg, &xmlFile, this);
|
||||||
|
addConfig(m_configLoader, widget());
|
||||||
}
|
}
|
||||||
|
|
||||||
BreezyDesktopEffectConfig::~BreezyDesktopEffectConfig()
|
BreezyDesktopEffectConfig::~BreezyDesktopEffectConfig()
|
||||||
|
|
@ -40,12 +47,17 @@ void BreezyDesktopEffectConfig::load()
|
||||||
void BreezyDesktopEffectConfig::save()
|
void BreezyDesktopEffectConfig::save()
|
||||||
{
|
{
|
||||||
updateConfigFromUi();
|
updateConfigFromUi();
|
||||||
BreezyDesktopConfig::self()->save();
|
m_configLoader->save();
|
||||||
|
|
||||||
KCModule::save();
|
KCModule::save();
|
||||||
updateUnmanagedState();
|
updateUnmanagedState();
|
||||||
|
|
||||||
OrgKdeKwinEffectsInterface interface(QStringLiteral("org.kde.KWin"), QStringLiteral("/Effects"), QDBusConnection::sessionBus());
|
QDBusMessage reconfigureMessage = QDBusMessage::createMethodCall(QStringLiteral("org.kde.KWin"),
|
||||||
interface.reconfigureEffect(QStringLiteral("breezy_desktop_effect"));
|
QStringLiteral("/Effects"),
|
||||||
|
QStringLiteral("org.kde.kwin.Effects"),
|
||||||
|
QStringLiteral("reconfigureEffect"));
|
||||||
|
reconfigureMessage.setArguments({QStringLiteral("breezy_desktop_effect")});
|
||||||
|
QDBusConnection::sessionBus().call(reconfigureMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BreezyDesktopEffectConfig::defaults()
|
void BreezyDesktopEffectConfig::defaults()
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <KCModule>
|
#include <KCModule>
|
||||||
|
#include <KConfigLoader>
|
||||||
|
|
||||||
#include "ui_breezydesktopeffectkcm.h"
|
#include "ui_breezydesktopeffectkcm.h"
|
||||||
|
|
||||||
|
|
@ -15,7 +16,7 @@ class BreezyDesktopEffectConfig : public KCModule
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
BreezyDesktopEffectConfig(QObject *parent, const KPluginMetaData &data, const QVariantList &args);
|
BreezyDesktopEffectConfig(QObject *parent, const KPluginMetaData &data);
|
||||||
~BreezyDesktopEffectConfig() override;
|
~BreezyDesktopEffectConfig() override;
|
||||||
|
|
||||||
public Q_SLOTS:
|
public Q_SLOTS:
|
||||||
|
|
@ -30,4 +31,5 @@ private:
|
||||||
void updateUnmanagedState();
|
void updateUnmanagedState();
|
||||||
|
|
||||||
::Ui::BreezyDesktopEffectConfig ui;
|
::Ui::BreezyDesktopEffectConfig ui;
|
||||||
|
KConfigLoader *m_configLoader = nullptr;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
<!DOCTYPE RCC><RCC version="1.0">
|
||||||
|
<qresource prefix="/">
|
||||||
|
<file alias="main.xml">../breezydesktopconfig.kcfg</file>
|
||||||
|
</qresource>
|
||||||
|
</RCC>
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
namespace KWin
|
namespace KWin
|
||||||
{
|
{
|
||||||
|
|
||||||
KWIN_EFFECT_FACTORY_SUPPORTED(BreezyDesktopEffect, "metadata.json", return BreezyDesktopEffect::supported();)
|
KWIN_EFFECT_FACTORY_SUPPORTED(BreezyDesktopEffect, "package/metadata.json", return BreezyDesktopEffect::supported();)
|
||||||
|
|
||||||
} // namespace KWin
|
} // namespace KWin
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,16 +7,13 @@
|
||||||
"Name": "Wayne Heaney"
|
"Name": "Wayne Heaney"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"Category": "Tools",
|
"Category": "Window Management",
|
||||||
"Description": "Breezy Desktop XR Effect",
|
"Description": "Breezy Desktop",
|
||||||
"EnabledByDefault": true,
|
"EnabledByDefault": true,
|
||||||
"Id": "breezy_desktop_effect",
|
"Id": "breezy_desktop_effect",
|
||||||
"License": "GPL",
|
"License": "GPL",
|
||||||
"Name": "Breezy Desktop XR",
|
"Name": "Breezy Desktop"
|
||||||
"ServiceTypes": [
|
|
||||||
"KWin/Effect"
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
"X-Plasma-API-Minimum-Version": "6.0",
|
"X-KDE-ConfigModule": "breezy_desktop_config",
|
||||||
"X-KDE-ConfigModule": "breezy_desktop_config"
|
"X-KDE-Ordering": 60
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue