KWin
Loading...
Searching...
No Matches
showpaint_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: 2018 Vlad Zahorodnii <vlad.zahorodnii@kde.org>
6
7 SPDX-License-Identifier: GPL-2.0-or-later
8*/
9
10#include "showpaint_config.h"
11
12#include <KActionCollection>
13#include <KGlobalAccel>
14#include <KLocalizedString>
15#include <KPluginFactory>
16#include <KShortcutsEditor>
17
18#include <QAction>
19
20K_PLUGIN_CLASS(KWin::ShowPaintEffectConfig)
21
22namespace KWin
23{
24
25ShowPaintEffectConfig::ShowPaintEffectConfig(QObject *parent, const KPluginMetaData &data)
26 : KCModule(parent, data)
27{
28 m_ui.setupUi(widget());
29
30 auto *actionCollection = new KActionCollection(this, QStringLiteral("kwin"));
31
32 actionCollection->setComponentDisplayName(i18n("KWin"));
33 actionCollection->setConfigGroup(QStringLiteral("ShowPaint"));
34 actionCollection->setConfigGlobal(true);
35
36 QAction *toggleAction = actionCollection->addAction(QStringLiteral("Toggle"));
37 toggleAction->setText(i18n("Toggle Show Paint"));
38 toggleAction->setProperty("isConfigurationAction", true);
39 KGlobalAccel::self()->setDefaultShortcut(toggleAction, {});
40 KGlobalAccel::self()->setShortcut(toggleAction, {});
41
42 m_ui.shortcutsEditor->addCollection(actionCollection);
43
44 connect(m_ui.shortcutsEditor, &KShortcutsEditor::keyChange, this, &KCModule::markAsChanged);
45}
46
48{
49 KCModule::save();
50 m_ui.shortcutsEditor->save();
51}
52
54{
55 m_ui.shortcutsEditor->allDefault();
56 KCModule::defaults();
57}
58
59} // namespace KWin
60
61#include "showpaint_config.moc"
62
63#include "moc_showpaint_config.cpp"
ShowPaintEffectConfig(QObject *parent, const KPluginMetaData &data)