Commit 51a1e06d authored by Cyril Rossi's avatar Cyril Rossi

KCM KWinTabBox manage KCModule states

Summary:
Following D27323, manage KCModule states for reinitialize/defaults/apply

Also, this should solve :

BUG: 414567
BUG: 387160
FIXED-IN: 5.19

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

Reviewed By: #kwin, ervin, meven, zzag

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D27784
parent d876dde0
......@@ -10,6 +10,7 @@ set(kcm_kwintabbox_PART_SRCS
layoutpreview.cpp
main.cpp
thumbnailitem.cpp
kwintabboxconfigform.cpp
)
ki18n_wrap_ui(kcm_kwintabbox_PART_SRCS main.ui)
......
This diff is collapsed.
/********************************************************************
KWin - the KDE window manager
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
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************/
#ifndef __KWINTABBOXCONFIGFORM_H__
#define __KWINTABBOXCONFIGFORM_H__
#include <QWidget>
#include <QStandardItemModel>
#include "tabboxconfig.h"
class KShortcutsEditor;
class KActionCollection;
namespace Ui
{
class KWinTabBoxConfigForm;
}
namespace KWin
{
class KWinTabBoxConfigForm : public QWidget
{
Q_OBJECT
public:
enum class TabboxType
{
Main,
Alternative,
};
enum EffectComboRole
{
LayoutPath = Qt::UserRole + 1,
AddonEffect, // i.e not builtin effects
};
explicit KWinTabBoxConfigForm(TabboxType type, QWidget *parent = nullptr);
~KWinTabBoxConfigForm() override;
bool highlightWindows() const;
bool showTabBox() const;
int filterScreen() const;
int filterDesktop() const;
int filterActivities() const;
int filterMinimization() const;
int applicationMode() const;
int showDesktopMode() const;
int switchingMode() const;
QString layoutName() const;
void setFilterScreen(TabBox::TabBoxConfig::ClientMultiScreenMode mode);
void setFilterDesktop(TabBox::TabBoxConfig::ClientDesktopMode mode);
void setFilterActivities(TabBox::TabBoxConfig::ClientActivitiesMode mode);
void setFilterMinimization(TabBox::TabBoxConfig::ClientMinimizedMode mode);
void setApplicationMode(TabBox::TabBoxConfig::ClientApplicationsMode mode);
void setShowDesktopMode(TabBox::TabBoxConfig::ShowDesktopMode mode);
void setSwitchingModeChanged(TabBox::TabBoxConfig::ClientSwitchingMode mode);
void setLayoutName(const QString &layoutName);
// EffectCombo Data Model
void setEffectComboModel(QStandardItemModel *model);
QVariant effectComboCurrentData(int role = Qt::UserRole) const;
void loadShortcuts();
void resetShortcuts();
Q_SIGNALS:
void filterScreenChanged(int value);
void filterDesktopChanged(int value);
void filterActivitiesChanged(int value);
void filterMinimizationChanged(int value);
void applicationModeChanged(int value);
void showDesktopModeChanged(int value);
void switchingModeChanged(int value);
void layoutNameChanged(const QString &layoutName);
void effectConfigButtonClicked();
private Q_SLOTS:
void tabBoxToggled(bool on);
void onFilterScreen();
void onFilterDesktop();
void onFilterActivites();
void onFilterMinimization();
void onApplicationMode();
void onShowDesktopMode();
void onSwitchingMode();
void onEffectCombo();
void shortcutChanged(const QKeySequence &seq);
private:
KActionCollection *m_actionCollection = nullptr;
KShortcutsEditor *m_editor = nullptr;
TabboxType m_type;
Ui::KWinTabBoxConfigForm *ui;
};
} // namespace
#endif
This diff is collapsed.
......@@ -24,14 +24,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <kcmodule.h>
#include <ksharedconfig.h>
#include "ui_main.h"
class KShortcutsEditor;
class KActionCollection;
#include "tabboxconfig.h"
namespace KWin
{
class KWinTabBoxConfigForm;
enum class BuiltInEffect;
namespace TabBox
{
......@@ -41,15 +38,6 @@ class PluginsSettings;
}
class KWinTabBoxConfigForm : public QWidget, public Ui::KWinTabBoxConfigForm
{
Q_OBJECT
public:
explicit KWinTabBoxConfigForm(QWidget* parent);
};
class KWinTabBoxConfig : public KCModule
{
Q_OBJECT
......@@ -64,33 +52,33 @@ public Q_SLOTS:
void defaults() override;
private Q_SLOTS:
void effectSelectionChanged(int index);
void updateUnmanagedState();
void configureEffectClicked();
void tabBoxToggled(bool on);
void shortcutChanged(const QKeySequence &seq);
void slotGHNS();
private:
void updateUiFromConfig(KWinTabBoxConfigForm *ui, const TabBox::TabBoxSettings *config);
void updateConfigFromUi(const KWinTabBoxConfigForm *ui, TabBox::TabBoxSettings *config);
void updateUiFromConfig(KWinTabBoxConfigForm *form, const TabBox::TabBoxSettings *config);
void updateConfigFromUi(const KWinTabBoxConfigForm *form, TabBox::TabBoxSettings *config);
void updateUiFromDefaultConfig(KWinTabBoxConfigForm *form, const TabBox::TabBoxSettings *config);
void initLayoutLists();
void createConnections(KWinTabBoxConfigForm *form, TabBox::TabBoxSettings *config);
bool updateUnmanagedIsNeedSave(const KWinTabBoxConfigForm *form, const TabBox::TabBoxSettings *config);
bool updateUnmanagedIsDefault(const KWinTabBoxConfigForm *form, const TabBox::TabBoxSettings *config);
private:
enum Mode {
CoverSwitch = 0,
FlipSwitch = 1,
Layout = 2
};
KWinTabBoxConfigForm* m_primaryTabBoxUi;
KWinTabBoxConfigForm* m_alternativeTabBoxUi;
KWinTabBoxConfigForm *m_primaryTabBoxUi = nullptr;
KWinTabBoxConfigForm *m_alternativeTabBoxUi = nullptr;
KSharedConfigPtr m_config;
KActionCollection* m_actionCollection;
KShortcutsEditor* m_editor;
TabBox::TabBoxSettings *m_tabBoxConfig;
TabBox::TabBoxSettings *m_tabBoxAlternativeConfig;
TabBox::SwitchEffectSettings *m_coverSwitchConfig;
TabBox::SwitchEffectSettings *m_flipSwitchConfig;
TabBox::PluginsSettings *m_pluginsConfig;
// Builtin effects' names
QString m_coverSwitch;
QString m_flipSwitch;
};
} // namespace
......
......@@ -534,7 +534,7 @@
</widget>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="showTabBox">
<widget class="QCheckBox" name="kcfg_ShowTabBox">
<property name="text">
<string/>
</property>
......@@ -544,7 +544,7 @@
</widget>
</item>
<item row="0" column="0" colspan="2">
<widget class="QCheckBox" name="highlightWindowCheck">
<widget class="QCheckBox" name="kcfg_HighlightWindows">
<property name="toolTip">
<string>The currently selected window will be highlighted by fading out all other windows. This option requires desktop effects to be active.</string>
</property>
......@@ -593,8 +593,8 @@
</customwidget>
</customwidgets>
<tabstops>
<tabstop>highlightWindowCheck</tabstop>
<tabstop>showTabBox</tabstop>
<tabstop>kcfg_HighlightWindows</tabstop>
<tabstop>kcfg_ShowTabBox</tabstop>
<tabstop>effectCombo</tabstop>
<tabstop>effectConfigButton</tabstop>
<tabstop>switchingModeCombo</tabstop>
......@@ -680,7 +680,7 @@
</hints>
</connection>
<connection>
<sender>showTabBox</sender>
<sender>kcfg_ShowTabBox</sender>
<signal>toggled(bool)</signal>
<receiver>widget_6</receiver>
<slot>setEnabled(bool)</slot>
......
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