KWinRules KCM Redesign
Summary:
Replacement KCM to configure kwin rules, using a QML-based UI.
After some work on the task T12729, it is almost feature-par with the previous module, and adapted to the recent move to KConfigXT.
Test Plan:
{F8208046}
{F8208047}
Reviewers: #plasma, #kwin, #vdg, ngraham, davidedmundson, zzag
Reviewed By: #plasma, #kwin, #vdg, ngraham, davidedmundson, zzag
Subscribers: ngraham, davidedmundson, hchain, broulik, zzag, kwin
Tags: #kwin, #vdg
Differential Revision: https://phabricator.kde.org/D28152
2020-04-20 20:01:55 +00:00
|
|
|
/*
|
2020-08-02 22:22:19 +00:00
|
|
|
SPDX-FileCopyrightText: 2020 Ismael Asensio <isma.af@gmail.com>
|
|
|
|
|
|
|
|
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
|
|
|
|
*/
|
KWinRules KCM Redesign
Summary:
Replacement KCM to configure kwin rules, using a QML-based UI.
After some work on the task T12729, it is almost feature-par with the previous module, and adapted to the recent move to KConfigXT.
Test Plan:
{F8208046}
{F8208047}
Reviewers: #plasma, #kwin, #vdg, ngraham, davidedmundson, zzag
Reviewed By: #plasma, #kwin, #vdg, ngraham, davidedmundson, zzag
Subscribers: ngraham, davidedmundson, hchain, broulik, zzag, kwin
Tags: #kwin, #vdg
Differential Revision: https://phabricator.kde.org/D28152
2020-04-20 20:01:55 +00:00
|
|
|
|
|
|
|
#ifndef KWIN_RULES_MODEL_H
|
|
|
|
#define KWIN_RULES_MODEL_H
|
|
|
|
|
|
|
|
#include "ruleitem.h"
|
|
|
|
#include <rules.h>
|
2020-05-17 01:34:21 +00:00
|
|
|
#include <rulesettings.h>
|
|
|
|
#include <virtualdesktopsdbustypes.h>
|
KWinRules KCM Redesign
Summary:
Replacement KCM to configure kwin rules, using a QML-based UI.
After some work on the task T12729, it is almost feature-par with the previous module, and adapted to the recent move to KConfigXT.
Test Plan:
{F8208046}
{F8208047}
Reviewers: #plasma, #kwin, #vdg, ngraham, davidedmundson, zzag
Reviewed By: #plasma, #kwin, #vdg, ngraham, davidedmundson, zzag
Subscribers: ngraham, davidedmundson, hchain, broulik, zzag, kwin
Tags: #kwin, #vdg
Differential Revision: https://phabricator.kde.org/D28152
2020-04-20 20:01:55 +00:00
|
|
|
|
|
|
|
#include <QAbstractListModel>
|
|
|
|
#include <QSortFilterProxyModel>
|
|
|
|
#include <QObject>
|
|
|
|
|
|
|
|
#ifdef KWIN_BUILD_ACTIVITIES
|
|
|
|
#include <KActivities/Consumer>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
namespace KWin
|
|
|
|
{
|
|
|
|
|
|
|
|
class RulesModel : public QAbstractListModel
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
Q_PROPERTY(QString description READ description WRITE setDescription NOTIFY descriptionChanged)
|
|
|
|
Q_PROPERTY(QString warningMessage READ warningMessage NOTIFY warningMessageChanged)
|
|
|
|
|
|
|
|
public:
|
|
|
|
enum RulesRole {
|
|
|
|
NameRole = Qt::DisplayRole,
|
|
|
|
DescriptionRole = Qt::ToolTipRole,
|
|
|
|
IconRole = Qt::DecorationRole,
|
|
|
|
IconNameRole = Qt::UserRole + 1,
|
|
|
|
KeyRole,
|
|
|
|
SectionRole,
|
|
|
|
EnabledRole,
|
|
|
|
SelectableRole,
|
|
|
|
ValueRole,
|
|
|
|
TypeRole,
|
|
|
|
PolicyRole,
|
|
|
|
PolicyModelRole,
|
|
|
|
OptionsModelRole,
|
2020-06-24 17:38:30 +00:00
|
|
|
OptionsMaskRole,
|
KWinRules KCM Redesign
Summary:
Replacement KCM to configure kwin rules, using a QML-based UI.
After some work on the task T12729, it is almost feature-par with the previous module, and adapted to the recent move to KConfigXT.
Test Plan:
{F8208046}
{F8208047}
Reviewers: #plasma, #kwin, #vdg, ngraham, davidedmundson, zzag
Reviewed By: #plasma, #kwin, #vdg, ngraham, davidedmundson, zzag
Subscribers: ngraham, davidedmundson, hchain, broulik, zzag, kwin
Tags: #kwin, #vdg
Differential Revision: https://phabricator.kde.org/D28152
2020-04-20 20:01:55 +00:00
|
|
|
SuggestedValueRole
|
|
|
|
};
|
|
|
|
Q_ENUM(RulesRole)
|
|
|
|
|
|
|
|
public:
|
|
|
|
explicit RulesModel(QObject *parent = nullptr);
|
|
|
|
~RulesModel();
|
|
|
|
|
|
|
|
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
|
|
|
QHash<int, QByteArray> roleNames() const override;
|
|
|
|
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
|
|
|
bool setData(const QModelIndex & index, const QVariant & value, int role) override;
|
|
|
|
|
[kcm/kwinrules] Detect also window complete class
Summary:
When detecting the properties of a window, now it shows and lets the user select the window complete class.
If this property is selected in the overlay, `Window class` takes the whole class value, and the option `Match window whole class` is set.
This adds back a feature the old kcm was offering.
BUG: 421542
FIXED-IN: 5.20
Test Plan:
- `Detect window properties` and pick a firefox window
- The property selector shows: `Window class: navigator` and `Whole window class: navigator firefox`
- Selecting the latter set the properties as per summary
{F8334118}
Reviewers: ngraham, #kwin, #plasma, meven
Reviewed By: ngraham, #kwin, #plasma, meven
Subscribers: broulik, davidedmundson, meven, anthonyfieroni, zzag, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D29791
2020-05-28 21:41:39 +00:00
|
|
|
QModelIndex indexOf(const QString &key) const;
|
KWinRules KCM Redesign
Summary:
Replacement KCM to configure kwin rules, using a QML-based UI.
After some work on the task T12729, it is almost feature-par with the previous module, and adapted to the recent move to KConfigXT.
Test Plan:
{F8208046}
{F8208047}
Reviewers: #plasma, #kwin, #vdg, ngraham, davidedmundson, zzag
Reviewed By: #plasma, #kwin, #vdg, ngraham, davidedmundson, zzag
Subscribers: ngraham, davidedmundson, hchain, broulik, zzag, kwin
Tags: #kwin, #vdg
Differential Revision: https://phabricator.kde.org/D28152
2020-04-20 20:01:55 +00:00
|
|
|
bool hasRule(const QString &key) const;
|
|
|
|
RuleItem *ruleItem(const QString &key) const;
|
|
|
|
|
|
|
|
void readFromSettings(RuleSettings *settings);
|
|
|
|
void writeToSettings(RuleSettings *settings) const;
|
|
|
|
|
|
|
|
void importFromRules(Rules *rules);
|
|
|
|
Rules *exportToRules() const;
|
|
|
|
|
2020-10-27 20:57:02 +00:00
|
|
|
void setSuggestedProperties(const QVariantMap &info);
|
KWinRules KCM Redesign
Summary:
Replacement KCM to configure kwin rules, using a QML-based UI.
After some work on the task T12729, it is almost feature-par with the previous module, and adapted to the recent move to KConfigXT.
Test Plan:
{F8208046}
{F8208047}
Reviewers: #plasma, #kwin, #vdg, ngraham, davidedmundson, zzag
Reviewed By: #plasma, #kwin, #vdg, ngraham, davidedmundson, zzag
Subscribers: ngraham, davidedmundson, hchain, broulik, zzag, kwin
Tags: #kwin, #vdg
Differential Revision: https://phabricator.kde.org/D28152
2020-04-20 20:01:55 +00:00
|
|
|
|
|
|
|
QString description() const;
|
|
|
|
void setDescription(const QString &description);
|
|
|
|
QString warningMessage() const;
|
|
|
|
|
|
|
|
|
|
|
|
public slots:
|
|
|
|
void detectWindowProperties(int secs);
|
|
|
|
|
|
|
|
signals:
|
|
|
|
void descriptionChanged();
|
|
|
|
void warningMessageChanged();
|
|
|
|
void suggestionsChanged();
|
|
|
|
|
2020-05-17 01:34:21 +00:00
|
|
|
void virtualDesktopsUpdated();
|
|
|
|
|
KWinRules KCM Redesign
Summary:
Replacement KCM to configure kwin rules, using a QML-based UI.
After some work on the task T12729, it is almost feature-par with the previous module, and adapted to the recent move to KConfigXT.
Test Plan:
{F8208046}
{F8208047}
Reviewers: #plasma, #kwin, #vdg, ngraham, davidedmundson, zzag
Reviewed By: #plasma, #kwin, #vdg, ngraham, davidedmundson, zzag
Subscribers: ngraham, davidedmundson, hchain, broulik, zzag, kwin
Tags: #kwin, #vdg
Differential Revision: https://phabricator.kde.org/D28152
2020-04-20 20:01:55 +00:00
|
|
|
private:
|
|
|
|
void populateRuleList();
|
|
|
|
bool wmclassWarning() const;
|
|
|
|
RuleItem *addRule(RuleItem *rule);
|
|
|
|
QString defaultDescription() const;
|
[kcm/kwinrules] Detect also window complete class
Summary:
When detecting the properties of a window, now it shows and lets the user select the window complete class.
If this property is selected in the overlay, `Window class` takes the whole class value, and the option `Match window whole class` is set.
This adds back a feature the old kcm was offering.
BUG: 421542
FIXED-IN: 5.20
Test Plan:
- `Detect window properties` and pick a firefox window
- The property selector shows: `Window class: navigator` and `Whole window class: navigator firefox`
- Selecting the latter set the properties as per summary
{F8334118}
Reviewers: ngraham, #kwin, #plasma, meven
Reviewed By: ngraham, #kwin, #plasma, meven
Subscribers: broulik, davidedmundson, meven, anthonyfieroni, zzag, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D29791
2020-05-28 21:41:39 +00:00
|
|
|
void processSuggestion(const QString &key, const QVariant &value);
|
KWinRules KCM Redesign
Summary:
Replacement KCM to configure kwin rules, using a QML-based UI.
After some work on the task T12729, it is almost feature-par with the previous module, and adapted to the recent move to KConfigXT.
Test Plan:
{F8208046}
{F8208047}
Reviewers: #plasma, #kwin, #vdg, ngraham, davidedmundson, zzag
Reviewed By: #plasma, #kwin, #vdg, ngraham, davidedmundson, zzag
Subscribers: ngraham, davidedmundson, hchain, broulik, zzag, kwin
Tags: #kwin, #vdg
Differential Revision: https://phabricator.kde.org/D28152
2020-04-20 20:01:55 +00:00
|
|
|
|
|
|
|
static const QHash<QString, QString> x11PropertyHash();
|
2020-05-17 01:34:21 +00:00
|
|
|
void updateVirtualDesktops();
|
KWinRules KCM Redesign
Summary:
Replacement KCM to configure kwin rules, using a QML-based UI.
After some work on the task T12729, it is almost feature-par with the previous module, and adapted to the recent move to KConfigXT.
Test Plan:
{F8208046}
{F8208047}
Reviewers: #plasma, #kwin, #vdg, ngraham, davidedmundson, zzag
Reviewed By: #plasma, #kwin, #vdg, ngraham, davidedmundson, zzag
Subscribers: ngraham, davidedmundson, hchain, broulik, zzag, kwin
Tags: #kwin, #vdg
Differential Revision: https://phabricator.kde.org/D28152
2020-04-20 20:01:55 +00:00
|
|
|
|
|
|
|
QList<OptionsModel::Data> windowTypesModelData() const;
|
|
|
|
QList<OptionsModel::Data> virtualDesktopsModelData() const;
|
|
|
|
QList<OptionsModel::Data> activitiesModelData() const;
|
|
|
|
QList<OptionsModel::Data> placementModelData() const;
|
|
|
|
QList<OptionsModel::Data> focusModelData() const;
|
|
|
|
QList<OptionsModel::Data> colorSchemesModelData() const;
|
|
|
|
|
|
|
|
private slots:
|
|
|
|
void selectX11Window();
|
|
|
|
|
|
|
|
private:
|
|
|
|
QList<RuleItem *> m_ruleList;
|
|
|
|
QHash<QString, RuleItem *> m_rules;
|
2020-05-17 01:34:21 +00:00
|
|
|
DBusDesktopDataVector m_virtualDesktops;
|
KWinRules KCM Redesign
Summary:
Replacement KCM to configure kwin rules, using a QML-based UI.
After some work on the task T12729, it is almost feature-par with the previous module, and adapted to the recent move to KConfigXT.
Test Plan:
{F8208046}
{F8208047}
Reviewers: #plasma, #kwin, #vdg, ngraham, davidedmundson, zzag
Reviewed By: #plasma, #kwin, #vdg, ngraham, davidedmundson, zzag
Subscribers: ngraham, davidedmundson, hchain, broulik, zzag, kwin
Tags: #kwin, #vdg
Differential Revision: https://phabricator.kde.org/D28152
2020-04-20 20:01:55 +00:00
|
|
|
#ifdef KWIN_BUILD_ACTIVITIES
|
|
|
|
KActivities::Consumer *m_activities;
|
|
|
|
#endif
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|