Commit c0afbb2c authored by Cyril Rossi's avatar Cyril Rossi

KCM KWinTabBox port to KConfigXT : use generated kcfg settings to load and save config

Reviewers: ervin, bport, meven, #kwin, zzag

Reviewed By: meven, #kwin, zzag

Subscribers: zzag, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D27323
parent 63fa0133
......@@ -15,6 +15,7 @@ set(kcm_kwintabbox_PART_SRCS
ki18n_wrap_ui(kcm_kwintabbox_PART_SRCS main.ui)
qt5_add_dbus_interface(kcm_kwintabbox_PART_SRCS ${KWin_SOURCE_DIR}/org.kde.kwin.Effects.xml kwin_effects_interface)
kconfig_add_kcfg_files(kcm_kwintabbox_PART_SRCS kwintabboxsettings.kcfgc kwinswitcheffectsettings.kcfgc kwinpluginssettings.kcfgc)
add_library(kcm_kwintabbox MODULE ${kcm_kwintabbox_PART_SRCS})
target_link_libraries(kcm_kwintabbox
......
<?xml version="1.0" encoding="UTF-8"?>
<kcfg xmlns="http://www.kde.org/standards/kcfg/1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0
http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" >
<kcfgfile name="kwinrc" />
<group name="Plugins">
<entry key="coverswitchEnabled" type="Bool">
<default code="true">BuiltInEffects::enabledByDefault(BuiltInEffect::CoverSwitch)</default>
</entry>
<entry key="flipswitchEnabled" type="Bool">
<default code="true">BuiltInEffects::enabledByDefault(BuiltInEffect::FlipSwitch)</default>
</entry>
<entry key="highlightwindowEnabled" type="Bool">
<default>false</default>
</entry>
</group>
</kcfg>
File=kwinpluginssettings.kcfg
NameSpace=KWin::TabBox
ClassName=PluginsSettings
IncludeFiles=effect_builtins.h
Mutators=true
DefaultValueGetters=true
ParentInConstructor=true
<?xml version="1.0" encoding="UTF-8"?>
<kcfg xmlns="http://www.kde.org/standards/kcfg/1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0
http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" >
<kcfgfile name="kwinrc">
<parameter name="EffectGroup"/>
</kcfgfile>
<group name="$(EffectGroup)">
<entry key="TabBox" type="Bool">
<default>false</default>
</entry>
<entry key="TabBoxAlternative" type="Bool">
<default>false</default>
</entry>
</group>
</kcfg>
File=kwinswitcheffectsettings.kcfg
NameSpace=KWin::TabBox
ClassName=SwitchEffectSettings
Mutators=true
DefaultValueGetters=true
ParentInConstructor=true
<?xml version="1.0" encoding="UTF-8"?>
<kcfg xmlns="http://www.kde.org/standards/kcfg/1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0
http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" >
<kcfgfile name="kwinrc">
<parameter name="TabBoxGroup"/>
</kcfgfile>
<group name="$(TabBoxGroup)">
<entry key="DesktopMode" type="Int">
<default code="true">TabBoxConfig::defaultDesktopMode()</default>
</entry>
<entry key="ActivitiesMode" type="Int">
<default code="true">TabBoxConfig::defaultActivitiesMode()</default>
</entry>
<entry key="ApplicationsMode" type="Int">
<default code="true">TabBoxConfig::defaultApplicationsMode()</default>
</entry>
<entry key="MinimizedMode" type="Int">
<default code="true">TabBoxConfig::defaultMinimizedMode()</default>
</entry>
<entry key="ShowDesktopMode" type="Int">
<default code="true">TabBoxConfig::defaultShowDesktopMode()</default>
</entry>
<entry key="MultiScreenMode" type="Int">
<default code="true">TabBoxConfig::defaultMultiScreenMode()</default>
</entry>
<entry key="SwitchingMode" type="Int">
<default code="true">TabBoxConfig::defaultSwitchingMode()</default>
</entry>
<entry key="LayoutName" type="String">
<default code="true">TabBoxConfig::defaultLayoutName()</default>
</entry>
<entry key="ShowTabBox" type="Bool">
<default code="true">TabBoxConfig::defaultShowTabBox()</default>
</entry>
<entry key="HighlightWindows" type="Bool">
<default code="true">TabBoxConfig::defaultHighlightWindow()</default>
</entry>
</group>
</kcfg>
File=kwintabboxsettings.kcfg
NameSpace=KWin::TabBox
ClassName=TabBoxSettings
IncludeFiles=\"tabboxconfig.h\"
Mutators=true
DefaultValueGetters=true
ParentInConstructor=true
This diff is collapsed.
......@@ -3,6 +3,7 @@
This file is part of the KDE project.
Copyright (C) 2009 Martin Gräßlin <mgraesslin@kde.org>
Copyright (C) 2020 Cyril Rossi <cyril.rossi@enioka.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
......@@ -23,7 +24,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <kcmodule.h>
#include <ksharedconfig.h>
#include "tabboxconfig.h"
#include "ui_main.h"
......@@ -35,7 +35,9 @@ namespace KWin
enum class BuiltInEffect;
namespace TabBox
{
class TabBoxSettings;
class SwitchEffectSettings;
class PluginsSettings;
}
......@@ -68,10 +70,8 @@ private Q_SLOTS:
void shortcutChanged(const QKeySequence &seq);
void slotGHNS();
private:
void updateUiFromConfig(KWinTabBoxConfigForm* ui, const TabBox::TabBoxConfig& config);
void updateConfigFromUi(const KWinTabBoxConfigForm* ui, TabBox::TabBoxConfig& config);
void loadConfig(const KConfigGroup& config, KWin::TabBox::TabBoxConfig& tabBoxConfig);
void saveConfig(KConfigGroup& config, const KWin::TabBox::TabBoxConfig& tabBoxConfig);
void updateUiFromConfig(KWinTabBoxConfigForm *ui, const TabBox::TabBoxSettings *config);
void updateConfigFromUi(const KWinTabBoxConfigForm *ui, TabBox::TabBoxSettings *config);
void initLayoutLists();
private:
......@@ -85,10 +85,12 @@ private:
KSharedConfigPtr m_config;
KActionCollection* m_actionCollection;
KShortcutsEditor* m_editor;
TabBox::TabBoxConfig m_tabBoxConfig;
TabBox::TabBoxConfig m_tabBoxAlternativeConfig;
TabBox::TabBoxSettings *m_tabBoxConfig;
TabBox::TabBoxSettings *m_tabBoxAlternativeConfig;
TabBox::SwitchEffectSettings *m_coverSwitchConfig;
TabBox::SwitchEffectSettings *m_flipSwitchConfig;
TabBox::PluginsSettings *m_pluginsConfig;
bool effectEnabled(const BuiltInEffect& effect, const KConfigGroup& cfg) const;
};
} // namespace
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment