KWin
Loading...
Searching...
No Matches
src
plugins
wobblywindows
wobblywindows_config.cpp
Go to the documentation of this file.
1
/*
2
KWin - the KDE window manager
3
This file is part of the KDE project.
4
5
SPDX-FileCopyrightText: 2008 Cédric Borgese <cedric.borgese@gmail.com>
6
SPDX-FileCopyrightText: 2008 Lucas Murray <lmurray@undefinedfire.com>
7
8
SPDX-License-Identifier: GPL-2.0-or-later
9
*/
10
#include "
wobblywindows_config.h
"
11
12
#include <config-kwin.h>
13
14
// KConfigSkeleton
15
#include "wobblywindowsconfig.h"
16
#include <kwineffects_interface.h>
17
18
#include <KLocalizedString>
19
#include <KPluginFactory>
20
#include <kconfiggroup.h>
21
22
K_PLUGIN_CLASS(
KWin::WobblyWindowsEffectConfig
)
23
24
namespace
KWin
25
{
26
27
//-----------------------------------------------------------------------------
28
// WARNING: This is (kinda) copied from wobblywindows.cpp
29
30
struct
ParameterSet
31
{
32
int
stiffness
;
33
int
drag
;
34
int
move_factor
;
35
};
36
37
static
const
ParameterSet
set_0 = {
38
15,
39
80,
40
10};
41
42
static
const
ParameterSet set_1 = {
43
10,
44
85,
45
10};
46
47
static
const
ParameterSet set_2 = {
48
6,
49
90,
50
10};
51
52
static
const
ParameterSet set_3 = {
53
3,
54
92,
55
20};
56
57
static
const
ParameterSet set_4 = {
58
1,
59
97,
60
25};
61
62
ParameterSet pset[5] = {set_0, set_1, set_2, set_3, set_4};
63
64
//-----------------------------------------------------------------------------
65
66
WobblyWindowsEffectConfig::WobblyWindowsEffectConfig
(QObject *parent,
const
KPluginMetaData &data)
67
: KCModule(parent, data)
68
{
69
WobblyWindowsConfig::instance(KWIN_CONFIG);
70
m_ui.setupUi(widget());
71
72
addConfig(WobblyWindowsConfig::self(), widget());
73
connect(m_ui.kcfg_WobblynessLevel, &QSlider::valueChanged,
this
, &WobblyWindowsEffectConfig::wobblinessChanged);
74
}
75
76
WobblyWindowsEffectConfig::~WobblyWindowsEffectConfig
()
77
{
78
}
79
80
void
WobblyWindowsEffectConfig::save
()
81
{
82
KCModule::save();
83
84
OrgKdeKwinEffectsInterface interface(QStringLiteral(
"org.kde.KWin"
),
85
QStringLiteral(
"/Effects"
),
86
QDBusConnection::sessionBus());
87
interface.reconfigureEffect(QStringLiteral(
"wobblywindows"
));
88
}
89
90
void
WobblyWindowsEffectConfig::wobblinessChanged()
91
{
92
ParameterSet
preset = pset[m_ui.kcfg_WobblynessLevel->value()];
93
94
m_ui.kcfg_Stiffness->setValue(preset.stiffness);
95
m_ui.kcfg_Drag->setValue(preset.drag);
96
m_ui.kcfg_MoveFactor->setValue(preset.move_factor);
97
}
98
99
}
// namespace
100
101
#include "wobblywindows_config.moc"
102
103
#include "moc_wobblywindows_config.cpp"
KWin::WobblyWindowsEffectConfig
Definition
wobblywindows_config.h:21
KWin::WobblyWindowsEffectConfig::~WobblyWindowsEffectConfig
~WobblyWindowsEffectConfig() override
Definition
wobblywindows_config.cpp:76
KWin::WobblyWindowsEffectConfig::WobblyWindowsEffectConfig
WobblyWindowsEffectConfig(QObject *parent, const KPluginMetaData &data)
Definition
wobblywindows_config.cpp:66
KWin::WobblyWindowsEffectConfig::save
void save() override
Definition
wobblywindows_config.cpp:80
KWin
Definition
activation_test.cpp:20
KWin::ParameterSet
Definition
wobblywindows.cpp:35
KWin::ParameterSet::move_factor
int move_factor
Definition
wobblywindows_config.cpp:34
KWin::ParameterSet::drag
int drag
Definition
wobblywindows_config.cpp:33
KWin::ParameterSet::stiffness
int stiffness
Definition
wobblywindows_config.cpp:32
wobblywindows_config.h
Generated on Sat Feb 17 2024 01:42:10 for KWin by
1.10.0