KCM KWin ScreenEdge and TouchScreenEdge use KCModuleData

This commit is contained in:
Cyril Rossi 2020-10-09 16:45:15 +02:00
parent 03a27a0081
commit c61ba64a9c
6 changed files with 150 additions and 122 deletions

View file

@ -8,9 +8,20 @@ set(kcm_screenedges_SRCS
kwinscreenedge.cpp
kwinscreenedgeconfigform.cpp
)
qt5_add_dbus_interface(kcm_screenedges_SRCS ${KWin_SOURCE_DIR}/org.kde.kwin.Effects.xml kwin_effects_interface)
set(kcm_kwinscreenedges_PART_SRCS main.cpp ${kcm_screenedges_SRCS})
kcmutils_generate_module_data(
kcm_kwinscreenedges_PART_SRCS
MODULE_DATA_HEADER kwinscreenedgedata.h
MODULE_DATA_CLASS_NAME KWinScreenEdgeData
SETTINGS_HEADERS kwinscreenedgesettings.h
SETTINGS_CLASSES KWinScreenEdgeSettings
NAMESPACE KWin
)
ki18n_wrap_ui(kcm_kwinscreenedges_PART_SRCS main.ui)
kconfig_add_kcfg_files(kcm_kwinscreenedges_PART_SRCS kwinscreenedgesettings.kcfgc kwinscreenedgescriptsettings.kcfgc)
add_library(kcm_kwinscreenedges MODULE ${kcm_kwinscreenedges_PART_SRCS})
@ -20,6 +31,7 @@ set(kcm_screenedges_LIBS
KF5::Completion
KF5::ConfigCore
KF5::ConfigWidgets
KF5::KCMUtils
KF5::I18n
KF5::Package
KF5::Plasma
@ -29,7 +41,21 @@ set(kcm_screenedges_LIBS
)
target_link_libraries(kcm_kwinscreenedges ${X11_LIBRARIES} ${kcm_screenedges_LIBS})
set(kcm_kwintouchscreenedges_PART_SRCS touch.cpp kwintouchscreenedgeconfigform.cpp ${kcm_screenedges_SRCS})
set(kcm_kwintouchscreenedges_PART_SRCS
touch.cpp
kwintouchscreenedgeconfigform.cpp
${kcm_screenedges_SRCS}
)
kcmutils_generate_module_data(
kcm_kwintouchscreenedges_PART_SRCS
MODULE_DATA_HEADER kwintouchscreendata.h
MODULE_DATA_CLASS_NAME KWinTouchScreenData
SETTINGS_HEADERS kwintouchscreensettings.h
SETTINGS_CLASSES KWinTouchScreenSettings
NAMESPACE KWin
)
ki18n_wrap_ui(kcm_kwintouchscreenedges_PART_SRCS main.ui touch.ui)
kconfig_add_kcfg_files(kcm_kwintouchscreenedges_PART_SRCS kwintouchscreensettings.kcfgc kwintouchscreenscriptsettings.kcfgc)
add_library(kcm_kwintouchscreen MODULE ${kcm_kwintouchscreenedges_PART_SRCS})

View file

@ -47,7 +47,7 @@
<default>None</default>
</entry>
<entry key="TopLeft" type="String">
<default>PresentWindowsAll</default>
<default>None</default>
</entry>
</group>
<group name="Effect-PresentWindows">

View file

@ -23,10 +23,11 @@
#include <QVBoxLayout>
#include "kwinscreenedgeconfigform.h"
#include "kwinscreenedgedata.h"
#include "kwinscreenedgesettings.h"
#include "kwinscreenedgescriptsettings.h"
K_PLUGIN_FACTORY(KWinScreenEdgesConfigFactory, registerPlugin<KWin::KWinScreenEdgesConfig>();)
K_PLUGIN_FACTORY(KWinScreenEdgesConfigFactory, registerPlugin<KWin::KWinScreenEdgesConfig>(); registerPlugin<KWin::KWinScreenEdgeData>();)
namespace KWin
{
@ -35,12 +36,12 @@ KWinScreenEdgesConfig::KWinScreenEdgesConfig(QWidget *parent, const QVariantList
: KCModule(parent, args)
, m_form(new KWinScreenEdgesConfigForm(this))
, m_config(KSharedConfig::openConfig("kwinrc"))
, m_settings(new KWinScreenEdgeSettings(this))
, m_data(new KWinScreenEdgeData(this))
{
QVBoxLayout *layout = new QVBoxLayout(this);
layout->addWidget(m_form);
addConfig(m_settings, m_form);
addConfig(m_data->settings(), m_form);
monitorInit();
@ -56,30 +57,30 @@ KWinScreenEdgesConfig::~KWinScreenEdgesConfig()
void KWinScreenEdgesConfig::load()
{
KCModule::load();
m_settings->load();
m_data->settings()->load();
for (KWinScreenEdgeScriptSettings *setting : qAsConst(m_scriptSettings)) {
setting->load();
}
monitorLoadSettings();
monitorLoadDefaultSettings();
m_form->setElectricBorderCornerRatio(m_settings->electricBorderCornerRatio());
m_form->setDefaultElectricBorderCornerRatio(m_settings->defaultElectricBorderCornerRatioValue());
m_form->setElectricBorderCornerRatio(m_data->settings()->electricBorderCornerRatio());
m_form->setDefaultElectricBorderCornerRatio(m_data->settings()->defaultElectricBorderCornerRatioValue());
m_form->reload();
}
void KWinScreenEdgesConfig::save()
{
monitorSaveSettings();
m_settings->setElectricBorderCornerRatio(m_form->electricBorderCornerRatio());
m_settings->save();
m_data->settings()->setElectricBorderCornerRatio(m_form->electricBorderCornerRatio());
m_data->settings()->save();
for (KWinScreenEdgeScriptSettings *setting : qAsConst(m_scriptSettings)) {
setting->save();
}
// Reload saved settings to ScreenEdge UI
monitorLoadSettings();
m_form->setElectricBorderCornerRatio(m_settings->electricBorderCornerRatio());
m_form->setElectricBorderCornerRatio(m_data->settings()->electricBorderCornerRatio());
m_form->reload();
// Reload KWin.
@ -165,38 +166,38 @@ void KWinScreenEdgesConfig::monitorInit()
void KWinScreenEdgesConfig::monitorLoadSettings()
{
// Load ElectricBorderActions
m_form->monitorChangeEdge(ElectricTop, KWinScreenEdgesConfig::electricBorderActionFromString(m_settings->top()));
m_form->monitorChangeEdge(ElectricTopRight, KWinScreenEdgesConfig::electricBorderActionFromString(m_settings->topRight()));
m_form->monitorChangeEdge(ElectricRight, KWinScreenEdgesConfig::electricBorderActionFromString(m_settings->right()));
m_form->monitorChangeEdge(ElectricBottomRight, KWinScreenEdgesConfig::electricBorderActionFromString(m_settings->bottomRight()));
m_form->monitorChangeEdge(ElectricBottom, KWinScreenEdgesConfig::electricBorderActionFromString(m_settings->bottom()));
m_form->monitorChangeEdge(ElectricBottomLeft, KWinScreenEdgesConfig::electricBorderActionFromString(m_settings->bottomLeft()));
m_form->monitorChangeEdge(ElectricLeft, KWinScreenEdgesConfig::electricBorderActionFromString(m_settings->left()));
m_form->monitorChangeEdge(ElectricTopLeft, KWinScreenEdgesConfig::electricBorderActionFromString(m_settings->topLeft()));
m_form->monitorChangeEdge(ElectricTop, KWinScreenEdgesConfig::electricBorderActionFromString(m_data->settings()->top()));
m_form->monitorChangeEdge(ElectricTopRight, KWinScreenEdgesConfig::electricBorderActionFromString(m_data->settings()->topRight()));
m_form->monitorChangeEdge(ElectricRight, KWinScreenEdgesConfig::electricBorderActionFromString(m_data->settings()->right()));
m_form->monitorChangeEdge(ElectricBottomRight, KWinScreenEdgesConfig::electricBorderActionFromString(m_data->settings()->bottomRight()));
m_form->monitorChangeEdge(ElectricBottom, KWinScreenEdgesConfig::electricBorderActionFromString(m_data->settings()->bottom()));
m_form->monitorChangeEdge(ElectricBottomLeft, KWinScreenEdgesConfig::electricBorderActionFromString(m_data->settings()->bottomLeft()));
m_form->monitorChangeEdge(ElectricLeft, KWinScreenEdgesConfig::electricBorderActionFromString(m_data->settings()->left()));
m_form->monitorChangeEdge(ElectricTopLeft, KWinScreenEdgesConfig::electricBorderActionFromString(m_data->settings()->topLeft()));
// Load effect-specific actions:
// PresentWindows BorderActivateAll
m_form->monitorChangeEdge(m_settings->borderActivateAll(), PresentWindowsAll);
m_form->monitorChangeEdge(m_data->settings()->borderActivateAll(), PresentWindowsAll);
// PresentWindows BorderActivate
m_form->monitorChangeEdge(m_settings->borderActivatePresentWindows(), PresentWindowsCurrent);
m_form->monitorChangeEdge(m_data->settings()->borderActivatePresentWindows(), PresentWindowsCurrent);
// PresentWindows BorderActivateClass
m_form->monitorChangeEdge(m_settings->borderActivateClass(), PresentWindowsClass);
m_form->monitorChangeEdge(m_data->settings()->borderActivateClass(), PresentWindowsClass);
// Desktop Grid
m_form->monitorChangeEdge(m_settings->borderActivateDesktopGrid(), DesktopGrid);
m_form->monitorChangeEdge(m_data->settings()->borderActivateDesktopGrid(), DesktopGrid);
// Desktop Cube
m_form->monitorChangeEdge(m_settings->borderActivateCube(), Cube);
m_form->monitorChangeEdge(m_settings->borderActivateCylinder(), Cylinder);
m_form->monitorChangeEdge(m_settings->borderActivateSphere(), Sphere);
m_form->monitorChangeEdge(m_data->settings()->borderActivateCube(), Cube);
m_form->monitorChangeEdge(m_data->settings()->borderActivateCylinder(), Cylinder);
m_form->monitorChangeEdge(m_data->settings()->borderActivateSphere(), Sphere);
// TabBox
m_form->monitorChangeEdge(m_settings->borderActivateTabBox(), TabBox);
m_form->monitorChangeEdge(m_data->settings()->borderActivateTabBox(), TabBox);
// Alternative TabBox
m_form->monitorChangeEdge(m_settings->borderAlternativeActivate(), TabBoxAlternative);
m_form->monitorChangeEdge(m_data->settings()->borderAlternativeActivate(), TabBoxAlternative);
// Scripts
for (int i = 0; i < m_scripts.size(); i++) {
@ -208,70 +209,70 @@ void KWinScreenEdgesConfig::monitorLoadSettings()
void KWinScreenEdgesConfig::monitorLoadDefaultSettings()
{
// Load ElectricBorderActions
m_form->monitorChangeDefaultEdge(ElectricTop, KWinScreenEdgesConfig::electricBorderActionFromString(m_settings->defaultTopValue()));
m_form->monitorChangeDefaultEdge(ElectricTopRight, KWinScreenEdgesConfig::electricBorderActionFromString(m_settings->defaultTopRightValue()));
m_form->monitorChangeDefaultEdge(ElectricRight, KWinScreenEdgesConfig::electricBorderActionFromString(m_settings->defaultRightValue()));
m_form->monitorChangeDefaultEdge(ElectricBottomRight, KWinScreenEdgesConfig::electricBorderActionFromString(m_settings->defaultBottomRightValue()));
m_form->monitorChangeDefaultEdge(ElectricBottom, KWinScreenEdgesConfig::electricBorderActionFromString(m_settings->defaultBottomValue()));
m_form->monitorChangeDefaultEdge(ElectricBottomLeft, KWinScreenEdgesConfig::electricBorderActionFromString(m_settings->defaultBottomLeftValue()));
m_form->monitorChangeDefaultEdge(ElectricLeft, KWinScreenEdgesConfig::electricBorderActionFromString(m_settings->defaultLeftValue()));
m_form->monitorChangeDefaultEdge(ElectricTopLeft, KWinScreenEdgesConfig::electricBorderActionFromString(m_settings->defaultTopLeftValue()));
m_form->monitorChangeDefaultEdge(ElectricTop, KWinScreenEdgesConfig::electricBorderActionFromString(m_data->settings()->defaultTopValue()));
m_form->monitorChangeDefaultEdge(ElectricTopRight, KWinScreenEdgesConfig::electricBorderActionFromString(m_data->settings()->defaultTopRightValue()));
m_form->monitorChangeDefaultEdge(ElectricRight, KWinScreenEdgesConfig::electricBorderActionFromString(m_data->settings()->defaultRightValue()));
m_form->monitorChangeDefaultEdge(ElectricBottomRight, KWinScreenEdgesConfig::electricBorderActionFromString(m_data->settings()->defaultBottomRightValue()));
m_form->monitorChangeDefaultEdge(ElectricBottom, KWinScreenEdgesConfig::electricBorderActionFromString(m_data->settings()->defaultBottomValue()));
m_form->monitorChangeDefaultEdge(ElectricBottomLeft, KWinScreenEdgesConfig::electricBorderActionFromString(m_data->settings()->defaultBottomLeftValue()));
m_form->monitorChangeDefaultEdge(ElectricLeft, KWinScreenEdgesConfig::electricBorderActionFromString(m_data->settings()->defaultLeftValue()));
m_form->monitorChangeDefaultEdge(ElectricTopLeft, KWinScreenEdgesConfig::electricBorderActionFromString(m_data->settings()->defaultTopLeftValue()));
// Load effect-specific actions:
// PresentWindows BorderActivateAll
m_form->monitorChangeDefaultEdge(m_settings->defaultBorderActivateAllValue(), PresentWindowsAll);
m_form->monitorChangeDefaultEdge(m_data->settings()->defaultBorderActivateAllValue(), PresentWindowsAll);
// PresentWindows BorderActivate
m_form->monitorChangeDefaultEdge(m_settings->defaultBorderActivatePresentWindowsValue(), PresentWindowsCurrent);
m_form->monitorChangeDefaultEdge(m_data->settings()->defaultBorderActivatePresentWindowsValue(), PresentWindowsCurrent);
// PresentWindows BorderActivateClass
m_form->monitorChangeDefaultEdge(m_settings->defaultBorderActivateClassValue(), PresentWindowsClass);
m_form->monitorChangeDefaultEdge(m_data->settings()->defaultBorderActivateClassValue(), PresentWindowsClass);
// Desktop Grid
m_form->monitorChangeDefaultEdge(m_settings->defaultBorderActivateDesktopGridValue(), DesktopGrid);
m_form->monitorChangeDefaultEdge(m_data->settings()->defaultBorderActivateDesktopGridValue(), DesktopGrid);
// Desktop Cube
m_form->monitorChangeDefaultEdge(m_settings->defaultBorderActivateCubeValue(), Cube);
m_form->monitorChangeDefaultEdge(m_settings->defaultBorderActivateCylinderValue(), Cylinder);
m_form->monitorChangeDefaultEdge(m_settings->defaultBorderActivateSphereValue(), Sphere);
m_form->monitorChangeDefaultEdge(m_data->settings()->defaultBorderActivateCubeValue(), Cube);
m_form->monitorChangeDefaultEdge(m_data->settings()->defaultBorderActivateCylinderValue(), Cylinder);
m_form->monitorChangeDefaultEdge(m_data->settings()->defaultBorderActivateSphereValue(), Sphere);
// TabBox
m_form->monitorChangeDefaultEdge(m_settings->defaultBorderActivateTabBoxValue(), TabBox);
m_form->monitorChangeDefaultEdge(m_data->settings()->defaultBorderActivateTabBoxValue(), TabBox);
// Alternative TabBox
m_form->monitorChangeDefaultEdge(m_settings->defaultBorderAlternativeActivateValue(), TabBoxAlternative);
m_form->monitorChangeDefaultEdge(m_data->settings()->defaultBorderAlternativeActivateValue(), TabBoxAlternative);
}
void KWinScreenEdgesConfig::monitorSaveSettings()
{
// Save ElectricBorderActions
m_settings->setTop(KWinScreenEdgesConfig::electricBorderActionToString(m_form->selectedEdgeItem(ElectricTop)));
m_settings->setTopRight(KWinScreenEdgesConfig::electricBorderActionToString(m_form->selectedEdgeItem(ElectricTopRight)));
m_settings->setRight(KWinScreenEdgesConfig::electricBorderActionToString(m_form->selectedEdgeItem(ElectricRight)));
m_settings->setBottomRight(KWinScreenEdgesConfig::electricBorderActionToString(m_form->selectedEdgeItem(ElectricBottomRight)));
m_settings->setBottom(KWinScreenEdgesConfig::electricBorderActionToString(m_form->selectedEdgeItem(ElectricBottom)));
m_settings->setBottomLeft(KWinScreenEdgesConfig::electricBorderActionToString(m_form->selectedEdgeItem(ElectricBottomLeft)));
m_settings->setLeft(KWinScreenEdgesConfig::electricBorderActionToString(m_form->selectedEdgeItem(ElectricLeft)));
m_settings->setTopLeft(KWinScreenEdgesConfig::electricBorderActionToString(m_form->selectedEdgeItem(ElectricTopLeft)));
m_data->settings()->setTop(KWinScreenEdgesConfig::electricBorderActionToString(m_form->selectedEdgeItem(ElectricTop)));
m_data->settings()->setTopRight(KWinScreenEdgesConfig::electricBorderActionToString(m_form->selectedEdgeItem(ElectricTopRight)));
m_data->settings()->setRight(KWinScreenEdgesConfig::electricBorderActionToString(m_form->selectedEdgeItem(ElectricRight)));
m_data->settings()->setBottomRight(KWinScreenEdgesConfig::electricBorderActionToString(m_form->selectedEdgeItem(ElectricBottomRight)));
m_data->settings()->setBottom(KWinScreenEdgesConfig::electricBorderActionToString(m_form->selectedEdgeItem(ElectricBottom)));
m_data->settings()->setBottomLeft(KWinScreenEdgesConfig::electricBorderActionToString(m_form->selectedEdgeItem(ElectricBottomLeft)));
m_data->settings()->setLeft(KWinScreenEdgesConfig::electricBorderActionToString(m_form->selectedEdgeItem(ElectricLeft)));
m_data->settings()->setTopLeft(KWinScreenEdgesConfig::electricBorderActionToString(m_form->selectedEdgeItem(ElectricTopLeft)));
// Save effect-specific actions:
// Present Windows
m_settings->setBorderActivateAll(m_form->monitorCheckEffectHasEdge(PresentWindowsAll));
m_settings->setBorderActivatePresentWindows(m_form->monitorCheckEffectHasEdge(PresentWindowsCurrent));
m_settings->setBorderActivateClass(m_form->monitorCheckEffectHasEdge(PresentWindowsClass));
m_data->settings()->setBorderActivateAll(m_form->monitorCheckEffectHasEdge(PresentWindowsAll));
m_data->settings()->setBorderActivatePresentWindows(m_form->monitorCheckEffectHasEdge(PresentWindowsCurrent));
m_data->settings()->setBorderActivateClass(m_form->monitorCheckEffectHasEdge(PresentWindowsClass));
// Desktop Grid
m_settings->setBorderActivateDesktopGrid(m_form->monitorCheckEffectHasEdge(DesktopGrid));
m_data->settings()->setBorderActivateDesktopGrid(m_form->monitorCheckEffectHasEdge(DesktopGrid));
// Desktop Cube
m_settings->setBorderActivateCube(m_form->monitorCheckEffectHasEdge(Cube));
m_settings->setBorderActivateCylinder(m_form->monitorCheckEffectHasEdge(Cylinder));
m_settings->setBorderActivateSphere(m_form->monitorCheckEffectHasEdge(Sphere));
m_data->settings()->setBorderActivateCube(m_form->monitorCheckEffectHasEdge(Cube));
m_data->settings()->setBorderActivateCylinder(m_form->monitorCheckEffectHasEdge(Cylinder));
m_data->settings()->setBorderActivateSphere(m_form->monitorCheckEffectHasEdge(Sphere));
// TabBox
m_settings->setBorderActivateTabBox(m_form->monitorCheckEffectHasEdge(TabBox));
m_settings->setBorderAlternativeActivate(m_form->monitorCheckEffectHasEdge(TabBoxAlternative));
m_data->settings()->setBorderActivateTabBox(m_form->monitorCheckEffectHasEdge(TabBox));
m_data->settings()->setBorderAlternativeActivate(m_form->monitorCheckEffectHasEdge(TabBoxAlternative));
// Scripts
for (int i = 0; i < m_scripts.size(); i++) {
@ -307,17 +308,17 @@ void KWinScreenEdgesConfig::monitorShowEvent()
m_form->monitorItemSetEnabled(TabBoxAlternative, reasonable);
// Disable Edge if ElectricBorders group entries are immutable
m_form->monitorEnableEdge(ElectricTop, !m_settings->isTopImmutable());
m_form->monitorEnableEdge(ElectricTopRight, !m_settings->isTopRightImmutable());
m_form->monitorEnableEdge(ElectricRight, !m_settings->isRightImmutable());
m_form->monitorEnableEdge(ElectricBottomRight, !m_settings->isBottomRightImmutable());
m_form->monitorEnableEdge(ElectricBottom, !m_settings->isBottomImmutable());
m_form->monitorEnableEdge(ElectricBottomLeft, !m_settings->isBottomLeftImmutable());
m_form->monitorEnableEdge(ElectricLeft, !m_settings->isLeftImmutable());
m_form->monitorEnableEdge(ElectricTopLeft, !m_settings->isTopLeftImmutable());
m_form->monitorEnableEdge(ElectricTop, !m_data->settings()->isTopImmutable());
m_form->monitorEnableEdge(ElectricTopRight, !m_data->settings()->isTopRightImmutable());
m_form->monitorEnableEdge(ElectricRight, !m_data->settings()->isRightImmutable());
m_form->monitorEnableEdge(ElectricBottomRight, !m_data->settings()->isBottomRightImmutable());
m_form->monitorEnableEdge(ElectricBottom, !m_data->settings()->isBottomImmutable());
m_form->monitorEnableEdge(ElectricBottomLeft, !m_data->settings()->isBottomLeftImmutable());
m_form->monitorEnableEdge(ElectricLeft, !m_data->settings()->isLeftImmutable());
m_form->monitorEnableEdge(ElectricTopLeft, !m_data->settings()->isTopLeftImmutable());
// Disable ElectricBorderCornerRatio if entry is immutable
m_form->setElectricBorderCornerRatioEnabled(!m_settings->isElectricBorderCornerRatioImmutable());
m_form->setElectricBorderCornerRatioEnabled(!m_data->settings()->isElectricBorderCornerRatioImmutable());
}
ElectricBorderAction KWinScreenEdgesConfig::electricBorderActionFromString(const QString &string)

View file

@ -20,8 +20,8 @@ class QShowEvent;
namespace KWin
{
class KWinScreenEdgeData;
class KWinScreenEdgesConfigForm;
class KWinScreenEdgeSettings;
class KWinScreenEdgeScriptSettings;
enum class BuiltInEffect;
@ -46,7 +46,7 @@ private:
KSharedConfigPtr m_config;
QStringList m_scripts; //list of script IDs ordered in the list they are presented in the menu
QHash<QString, KWinScreenEdgeScriptSettings*> m_scriptSettings;
KWinScreenEdgeSettings *m_settings;
KWinScreenEdgeData *m_data;
enum EffectActions {
PresentWindowsAll = ELECTRIC_ACTION_COUNT, // Start at the end of built in actions

View file

@ -23,10 +23,11 @@
#include <QVBoxLayout>
#include "kwintouchscreenedgeconfigform.h"
#include "kwintouchscreendata.h"
#include "kwintouchscreensettings.h"
#include "kwintouchscreenscriptsettings.h"
K_PLUGIN_FACTORY(KWinScreenEdgesConfigFactory, registerPlugin<KWin::KWinScreenEdgesConfig>();)
K_PLUGIN_FACTORY(KWinScreenEdgesConfigFactory, registerPlugin<KWin::KWinScreenEdgesConfig>(); registerPlugin<KWin::KWinTouchScreenData>();)
namespace KWin
{
@ -35,7 +36,7 @@ KWinScreenEdgesConfig::KWinScreenEdgesConfig(QWidget *parent, const QVariantList
: KCModule(parent, args)
, m_form(new KWinTouchScreenEdgeConfigForm(this))
, m_config(KSharedConfig::openConfig("kwinrc"))
, m_settings(new KWinTouchScreenSettings(this))
, m_data(new KWinTouchScreenData(this))
{
QVBoxLayout* layout = new QVBoxLayout(this);
layout->addWidget(m_form);
@ -53,7 +54,7 @@ KWinScreenEdgesConfig::~KWinScreenEdgesConfig()
void KWinScreenEdgesConfig::load()
{
KCModule::load();
m_settings->load();
m_data->settings()->load();
for (KWinTouchScreenScriptSettings *setting : qAsConst(m_scriptSettings)) {
setting->load();
}
@ -66,7 +67,7 @@ void KWinScreenEdgesConfig::load()
void KWinScreenEdgesConfig::save()
{
monitorSaveSettings();
m_settings->save();
m_data->settings()->save();
for (KWinTouchScreenScriptSettings *setting : qAsConst(m_scriptSettings)) {
setting->save();
}
@ -163,34 +164,34 @@ void KWinScreenEdgesConfig::monitorInit()
void KWinScreenEdgesConfig::monitorLoadSettings()
{
// Load ElectricBorderActions
m_form->monitorChangeEdge(ElectricTop, KWinScreenEdgesConfig::electricBorderActionFromString(m_settings->top()));
m_form->monitorChangeEdge(ElectricRight, KWinScreenEdgesConfig::electricBorderActionFromString(m_settings->right()));
m_form->monitorChangeEdge(ElectricBottom, KWinScreenEdgesConfig::electricBorderActionFromString(m_settings->bottom()));
m_form->monitorChangeEdge(ElectricLeft, KWinScreenEdgesConfig::electricBorderActionFromString(m_settings->left()));
m_form->monitorChangeEdge(ElectricTop, KWinScreenEdgesConfig::electricBorderActionFromString(m_data->settings()->top()));
m_form->monitorChangeEdge(ElectricRight, KWinScreenEdgesConfig::electricBorderActionFromString(m_data->settings()->right()));
m_form->monitorChangeEdge(ElectricBottom, KWinScreenEdgesConfig::electricBorderActionFromString(m_data->settings()->bottom()));
m_form->monitorChangeEdge(ElectricLeft, KWinScreenEdgesConfig::electricBorderActionFromString(m_data->settings()->left()));
// Load effect-specific actions:
// Present Windows BorderActivateAll
m_form->monitorChangeEdge(m_settings->touchBorderActivateAll(), PresentWindowsAll);
m_form->monitorChangeEdge(m_data->settings()->touchBorderActivateAll(), PresentWindowsAll);
// PresentWindows BorderActivate
m_form->monitorChangeEdge(m_settings->touchBorderActivatePresentWindows(), PresentWindowsCurrent);
m_form->monitorChangeEdge(m_data->settings()->touchBorderActivatePresentWindows(), PresentWindowsCurrent);
// PresentWindows BorderActivateClass
m_form->monitorChangeEdge(m_settings->touchBorderActivateClass(), PresentWindowsClass);
m_form->monitorChangeEdge(m_data->settings()->touchBorderActivateClass(), PresentWindowsClass);
// Desktop Grid BorderActivate
m_form->monitorChangeEdge(m_settings->touchBorderActivateDesktopGrid(), DesktopGrid);
m_form->monitorChangeEdge(m_data->settings()->touchBorderActivateDesktopGrid(), DesktopGrid);
// Desktop Cube BorderActivate
m_form->monitorChangeEdge(m_settings->touchBorderActivateCube(), Cube);
m_form->monitorChangeEdge(m_data->settings()->touchBorderActivateCube(), Cube);
// Desktop Cube BorderActivateCylinder
m_form->monitorChangeEdge(m_settings->touchBorderActivateCylinder(), Cylinder);
m_form->monitorChangeEdge(m_data->settings()->touchBorderActivateCylinder(), Cylinder);
// Desktop Cube BorderActivateSphere
m_form->monitorChangeEdge(m_settings->touchBorderActivateSphere(), Sphere);
m_form->monitorChangeEdge(m_data->settings()->touchBorderActivateSphere(), Sphere);
// TabBox BorderActivate
m_form->monitorChangeEdge(m_settings->touchBorderActivateTabBox(), TabBox);
m_form->monitorChangeEdge(m_data->settings()->touchBorderActivateTabBox(), TabBox);
// Alternative TabBox
m_form->monitorChangeEdge(m_settings->touchBorderAlternativeActivate(), TabBoxAlternative);
m_form->monitorChangeEdge(m_data->settings()->touchBorderAlternativeActivate(), TabBoxAlternative);
// Scripts
for (int i=0; i < m_scripts.size(); i++) {
@ -201,60 +202,60 @@ void KWinScreenEdgesConfig::monitorLoadSettings()
void KWinScreenEdgesConfig::monitorLoadDefaultSettings()
{
m_form->monitorChangeDefaultEdge(ElectricTop, KWinScreenEdgesConfig::electricBorderActionFromString(m_settings->defaultTopValue()));
m_form->monitorChangeDefaultEdge(ElectricRight, KWinScreenEdgesConfig::electricBorderActionFromString(m_settings->defaultRightValue()));
m_form->monitorChangeDefaultEdge(ElectricBottom, KWinScreenEdgesConfig::electricBorderActionFromString(m_settings->defaultBottomValue()));
m_form->monitorChangeDefaultEdge(ElectricLeft, KWinScreenEdgesConfig::electricBorderActionFromString(m_settings->defaultLeftValue()));
m_form->monitorChangeDefaultEdge(ElectricTop, KWinScreenEdgesConfig::electricBorderActionFromString(m_data->settings()->defaultTopValue()));
m_form->monitorChangeDefaultEdge(ElectricRight, KWinScreenEdgesConfig::electricBorderActionFromString(m_data->settings()->defaultRightValue()));
m_form->monitorChangeDefaultEdge(ElectricBottom, KWinScreenEdgesConfig::electricBorderActionFromString(m_data->settings()->defaultBottomValue()));
m_form->monitorChangeDefaultEdge(ElectricLeft, KWinScreenEdgesConfig::electricBorderActionFromString(m_data->settings()->defaultLeftValue()));
// Present Windows BorderActivateAll
m_form->monitorChangeDefaultEdge(m_settings->defaultTouchBorderActivateAllValue(), PresentWindowsAll);
m_form->monitorChangeDefaultEdge(m_data->settings()->defaultTouchBorderActivateAllValue(), PresentWindowsAll);
// PresentWindows BorderActivate
m_form->monitorChangeDefaultEdge(m_settings->defaultTouchBorderActivatePresentWindowsValue(), PresentWindowsCurrent);
m_form->monitorChangeDefaultEdge(m_data->settings()->defaultTouchBorderActivatePresentWindowsValue(), PresentWindowsCurrent);
// PresentWindows BorderActivateClass
m_form->monitorChangeDefaultEdge(m_settings->defaultTouchBorderActivateClassValue(), PresentWindowsClass);
m_form->monitorChangeDefaultEdge(m_data->settings()->defaultTouchBorderActivateClassValue(), PresentWindowsClass);
// Desktop Grid BorderActivate
m_form->monitorChangeDefaultEdge(m_settings->defaultTouchBorderActivateDesktopGridValue(), DesktopGrid);
m_form->monitorChangeDefaultEdge(m_data->settings()->defaultTouchBorderActivateDesktopGridValue(), DesktopGrid);
// Desktop Cube BorderActivate
m_form->monitorChangeDefaultEdge(m_settings->defaultTouchBorderActivateCubeValue(), Cube);
m_form->monitorChangeDefaultEdge(m_data->settings()->defaultTouchBorderActivateCubeValue(), Cube);
// Desktop Cube BorderActivateCylinder
m_form->monitorChangeDefaultEdge(m_settings->defaultTouchBorderActivateCylinderValue(), Cylinder);
m_form->monitorChangeDefaultEdge(m_data->settings()->defaultTouchBorderActivateCylinderValue(), Cylinder);
// Desktop Cube BorderActivateSphere
m_form->monitorChangeDefaultEdge(m_settings->defaultTouchBorderActivateSphereValue(), Sphere);
m_form->monitorChangeDefaultEdge(m_data->settings()->defaultTouchBorderActivateSphereValue(), Sphere);
// TabBox BorderActivate
m_form->monitorChangeDefaultEdge(m_settings->defaultTouchBorderActivateTabBoxValue(), TabBox);
m_form->monitorChangeDefaultEdge(m_data->settings()->defaultTouchBorderActivateTabBoxValue(), TabBox);
// Alternative TabBox
m_form->monitorChangeDefaultEdge(m_settings->defaultTouchBorderAlternativeActivateValue(), TabBoxAlternative);
m_form->monitorChangeDefaultEdge(m_data->settings()->defaultTouchBorderAlternativeActivateValue(), TabBoxAlternative);
}
void KWinScreenEdgesConfig::monitorSaveSettings()
{
// Save ElectricBorderActions
m_settings->setTop(KWinScreenEdgesConfig::electricBorderActionToString(m_form->selectedEdgeItem(ElectricTop)));
m_settings->setRight(KWinScreenEdgesConfig::electricBorderActionToString(m_form->selectedEdgeItem(ElectricRight)));
m_settings->setBottom(KWinScreenEdgesConfig::electricBorderActionToString(m_form->selectedEdgeItem(ElectricBottom)));
m_settings->setLeft(KWinScreenEdgesConfig::electricBorderActionToString(m_form->selectedEdgeItem(ElectricLeft)));
m_data->settings()->setTop(KWinScreenEdgesConfig::electricBorderActionToString(m_form->selectedEdgeItem(ElectricTop)));
m_data->settings()->setRight(KWinScreenEdgesConfig::electricBorderActionToString(m_form->selectedEdgeItem(ElectricRight)));
m_data->settings()->setBottom(KWinScreenEdgesConfig::electricBorderActionToString(m_form->selectedEdgeItem(ElectricBottom)));
m_data->settings()->setLeft(KWinScreenEdgesConfig::electricBorderActionToString(m_form->selectedEdgeItem(ElectricLeft)));
// Save effect-specific actions:
// Present Windows
m_settings->setTouchBorderActivateAll(m_form->monitorCheckEffectHasEdge(PresentWindowsAll));
m_settings->setTouchBorderActivatePresentWindows(m_form->monitorCheckEffectHasEdge(PresentWindowsCurrent));
m_settings->setTouchBorderActivateClass(m_form->monitorCheckEffectHasEdge(PresentWindowsClass));
m_data->settings()->setTouchBorderActivateAll(m_form->monitorCheckEffectHasEdge(PresentWindowsAll));
m_data->settings()->setTouchBorderActivatePresentWindows(m_form->monitorCheckEffectHasEdge(PresentWindowsCurrent));
m_data->settings()->setTouchBorderActivateClass(m_form->monitorCheckEffectHasEdge(PresentWindowsClass));
// Desktop Grid
m_settings->setTouchBorderActivateDesktopGrid(m_form->monitorCheckEffectHasEdge(DesktopGrid));
m_data->settings()->setTouchBorderActivateDesktopGrid(m_form->monitorCheckEffectHasEdge(DesktopGrid));
// Desktop Cube
m_settings->setTouchBorderActivateCube(m_form->monitorCheckEffectHasEdge(Cube));
m_settings->setTouchBorderActivateCylinder(m_form->monitorCheckEffectHasEdge(Cylinder));
m_settings->setTouchBorderActivateSphere(m_form->monitorCheckEffectHasEdge(Sphere));
m_data->settings()->setTouchBorderActivateCube(m_form->monitorCheckEffectHasEdge(Cube));
m_data->settings()->setTouchBorderActivateCylinder(m_form->monitorCheckEffectHasEdge(Cylinder));
m_data->settings()->setTouchBorderActivateSphere(m_form->monitorCheckEffectHasEdge(Sphere));
// TabBox
m_settings->setTouchBorderActivateTabBox(m_form->monitorCheckEffectHasEdge(TabBox));
m_settings->setTouchBorderAlternativeActivate(m_form->monitorCheckEffectHasEdge(TabBoxAlternative));
m_data->settings()->setTouchBorderActivateTabBox(m_form->monitorCheckEffectHasEdge(TabBox));
m_data->settings()->setTouchBorderAlternativeActivate(m_form->monitorCheckEffectHasEdge(TabBoxAlternative));
// Scripts
for (int i = 0; i < m_scripts.size(); i++) {
@ -290,10 +291,10 @@ void KWinScreenEdgesConfig::monitorShowEvent()
m_form->monitorItemSetEnabled(TabBoxAlternative, reasonable);
// Disable Edge if TouchEdges group entries are immutable
m_form->monitorEnableEdge(ElectricTop, !m_settings->isTopImmutable());
m_form->monitorEnableEdge(ElectricRight, !m_settings->isRightImmutable());
m_form->monitorEnableEdge(ElectricBottom, !m_settings->isBottomImmutable());
m_form->monitorEnableEdge(ElectricLeft, !m_settings->isLeftImmutable());
m_form->monitorEnableEdge(ElectricTop, !m_data->settings()->isTopImmutable());
m_form->monitorEnableEdge(ElectricRight, !m_data->settings()->isRightImmutable());
m_form->monitorEnableEdge(ElectricBottom, !m_data->settings()->isBottomImmutable());
m_form->monitorEnableEdge(ElectricLeft, !m_data->settings()->isLeftImmutable());
}
ElectricBorderAction KWinScreenEdgesConfig::electricBorderActionFromString(const QString &string)

View file

@ -20,8 +20,8 @@ class QShowEvent;
namespace KWin
{
class KWinTouchScreenData;
class KWinTouchScreenEdgeConfigForm;
class KWinTouchScreenSettings;
class KWinTouchScreenScriptSettings;
enum class BuiltInEffect;
@ -46,7 +46,7 @@ private:
KSharedConfigPtr m_config;
QStringList m_scripts; //list of script IDs ordered in the list they are presented in the menu
QHash<QString, KWinTouchScreenScriptSettings*> m_scriptSettings;
KWinTouchScreenSettings *m_settings;
KWinTouchScreenData *m_data;
enum EffectActions {
PresentWindowsAll = ELECTRIC_ACTION_COUNT, // Start at the end of built in actions