Changeset View
Changeset View
Standalone View
Standalone View
kcms/touchpad/src/kcm/touchpadconfigcontainer.cpp
- This file was added.
1 | /* | ||||
---|---|---|---|---|---|
2 | * Copyright 2017 Roman Gilg <subdiff@gmail.com> | ||||
3 | * | ||||
4 | * This program is free software; you can redistribute it and/or modify | ||||
5 | * it under the terms of the GNU General Public License as published by | ||||
6 | * the Free Software Foundation; either version 2 of the License, or | ||||
7 | * (at your option) any later version. | ||||
8 | * | ||||
9 | * This program is distributed in the hope that it will be useful, | ||||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
12 | * GNU General Public License for more details. | ||||
13 | * | ||||
14 | * You should have received a copy of the GNU General Public License | ||||
15 | * along with this program; if not, write to the Free Software | ||||
16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||||
17 | */ | ||||
18 | | ||||
19 | #include "touchpadconfigcontainer.h" | ||||
20 | #include "touchpadconfigplugin.h" | ||||
21 | #include "kcm/libinput/touchpadconfiglibinput.h" | ||||
22 | #include "kcm/xlib/touchpadconfigxlib.h" | ||||
23 | | ||||
24 | #include <KWindowSystem/kwindowsystem.h> | ||||
25 | | ||||
26 | extern "C" | ||||
27 | { | ||||
28 | Q_DECL_EXPORT void kcminit_touchpad() | ||||
29 | { | ||||
30 | if (KWindowSystem::isPlatformX11()) { | ||||
31 | TouchpadConfigXlib::kcmInit(); | ||||
32 | } | ||||
33 | } | ||||
34 | } | ||||
35 | | ||||
36 | TouchpadConfigContainer::TouchpadConfigContainer(QWidget *parent, const QVariantList &args) | ||||
37 | : KCModule(parent, args) | ||||
38 | { | ||||
39 | if (KWindowSystem::isPlatformX11()) { | ||||
40 | m_plugin = new TouchpadConfigXlib(this); | ||||
41 | } else if (KWindowSystem::isPlatformWayland()) { | ||||
42 | m_plugin = new TouchpadConfigLibinput(this); | ||||
43 | } | ||||
44 | } | ||||
45 | | ||||
46 | QSize TouchpadConfigContainer::minimumSizeHint() const | ||||
47 | { | ||||
48 | return m_plugin->minimumSizeHint(); | ||||
49 | } | ||||
50 | QSize TouchpadConfigContainer::sizeHint() const | ||||
51 | { | ||||
52 | return m_plugin->sizeHint(); | ||||
53 | } | ||||
54 | void TouchpadConfigContainer::resizeEvent(QResizeEvent *event) | ||||
55 | { | ||||
56 | Q_EMIT changed(false); | ||||
57 | m_plugin->resize(this->size()); | ||||
58 | } | ||||
59 | | ||||
60 | void TouchpadConfigContainer::load() | ||||
61 | { | ||||
62 | m_plugin->load(); | ||||
63 | } | ||||
64 | | ||||
65 | void TouchpadConfigContainer::save() | ||||
66 | { | ||||
67 | m_plugin->save(); | ||||
68 | } | ||||
69 | | ||||
70 | void TouchpadConfigContainer::defaults() | ||||
71 | { | ||||
72 | m_plugin->defaults(); | ||||
73 | } | ||||
74 | | ||||
75 | void TouchpadConfigContainer::hideEvent(QHideEvent *e) | ||||
76 | { | ||||
77 | m_plugin->hideEvent(e); | ||||
78 | KCModule::hideEvent(e); | ||||
79 | } |