File indexing completed on 2024-11-10 04:57:09
0001 /* 0002 KWin - the KDE window manager 0003 This file is part of the KDE project. 0004 0005 SPDX-FileCopyrightText: 2018 Vlad Zahorodnii <vlad.zahorodnii@kde.org> 0006 0007 SPDX-License-Identifier: GPL-2.0-or-later 0008 */ 0009 0010 #include "showpaint_config.h" 0011 0012 #include <KActionCollection> 0013 #include <KGlobalAccel> 0014 #include <KLocalizedString> 0015 #include <KPluginFactory> 0016 #include <KShortcutsEditor> 0017 0018 #include <QAction> 0019 0020 K_PLUGIN_CLASS(KWin::ShowPaintEffectConfig) 0021 0022 namespace KWin 0023 { 0024 0025 ShowPaintEffectConfig::ShowPaintEffectConfig(QObject *parent, const KPluginMetaData &data) 0026 : KCModule(parent, data) 0027 { 0028 m_ui.setupUi(widget()); 0029 0030 auto *actionCollection = new KActionCollection(this, QStringLiteral("kwin")); 0031 0032 actionCollection->setComponentDisplayName(i18n("KWin")); 0033 actionCollection->setConfigGroup(QStringLiteral("ShowPaint")); 0034 actionCollection->setConfigGlobal(true); 0035 0036 QAction *toggleAction = actionCollection->addAction(QStringLiteral("Toggle")); 0037 toggleAction->setText(i18n("Toggle Show Paint")); 0038 toggleAction->setProperty("isConfigurationAction", true); 0039 KGlobalAccel::self()->setDefaultShortcut(toggleAction, {}); 0040 KGlobalAccel::self()->setShortcut(toggleAction, {}); 0041 0042 m_ui.shortcutsEditor->addCollection(actionCollection); 0043 0044 connect(m_ui.shortcutsEditor, &KShortcutsEditor::keyChange, this, &KCModule::markAsChanged); 0045 } 0046 0047 void ShowPaintEffectConfig::save() 0048 { 0049 KCModule::save(); 0050 m_ui.shortcutsEditor->save(); 0051 } 0052 0053 void ShowPaintEffectConfig::defaults() 0054 { 0055 m_ui.shortcutsEditor->allDefault(); 0056 KCModule::defaults(); 0057 } 0058 0059 } // namespace KWin 0060 0061 #include "showpaint_config.moc" 0062 0063 #include "moc_showpaint_config.cpp"