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:10:35 +00:00
|
|
|
* SPDX-FileCopyrightText: 2020 Ismael Asensio <isma.af@gmail.com>
|
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:10:35 +00:00
|
|
|
* 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_RULEITEM_H
|
|
|
|
#define KWIN_RULEITEM_H
|
|
|
|
|
|
|
|
#include "optionsmodel.h"
|
|
|
|
|
|
|
|
#include <QFlag>
|
|
|
|
#include <QIcon>
|
|
|
|
|
|
|
|
|
|
|
|
namespace KWin
|
|
|
|
{
|
|
|
|
|
|
|
|
class RuleItem : public QObject
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
enum Type {
|
|
|
|
Undefined,
|
|
|
|
Boolean,
|
|
|
|
String,
|
|
|
|
Integer,
|
|
|
|
Option,
|
2020-06-19 18:56:12 +00:00
|
|
|
NetTypes,
|
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
|
|
|
Percentage,
|
[kcm/kwinrules] Fix size properties not being stored
Summary:
Use `QSize`/`QPoint` to handle and store coordinate values (size and position)
Previously, the rules model stored the "coordinate" type properties as a
`QString` with format `x, y`.
This fails when setting the properties to the config schema, as it requires
a proper `QPoint` or `QSize` value, specially the latter which can't be
convert from such a string.
BUG: 421055
FIXED-IN: 5.19.0
Test Plan:
- Add a new rule and set its position and size properties
- Hitting apply stores the right values in `~\.config\kwinrulesrc`
- Close the kcm and reopen, the values are loaded
- Property detection still works for size and position
Please note that there is a pre-existing bug of some position/sizes not being
applied to the windows in some cases, when using `Apply Initially`.
Better try using the `Force` policy.
Reviewers: ngraham, #kwin, #plasma, zzag
Reviewed By: #kwin, #plasma, zzag
Subscribers: zzag, ltoscano, yurchor, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D29764
2020-05-14 20:46:15 +00:00
|
|
|
Point,
|
|
|
|
Size,
|
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
|
|
|
Shortcut
|
|
|
|
};
|
|
|
|
Q_ENUM(Type)
|
|
|
|
|
|
|
|
enum Flags {
|
|
|
|
NoFlags = 0,
|
|
|
|
AlwaysEnabled = 1u << 0,
|
|
|
|
StartEnabled = 1u << 1,
|
|
|
|
AffectsWarning = 1u << 2,
|
|
|
|
AffectsDescription = 1u << 3,
|
[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
|
|
|
SuggestionOnly = 1u << 4,
|
|
|
|
AllFlags = 0b11111
|
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
|
|
|
};
|
|
|
|
|
|
|
|
public:
|
|
|
|
RuleItem() {};
|
|
|
|
RuleItem(const QString &key,
|
|
|
|
const RulePolicy::Type policyType,
|
|
|
|
const Type type,
|
|
|
|
const QString &name,
|
|
|
|
const QString §ion,
|
|
|
|
const QIcon &icon = QIcon::fromTheme("window"),
|
|
|
|
const QString &description = QString("")
|
|
|
|
);
|
|
|
|
~RuleItem();
|
|
|
|
|
|
|
|
QString key() const;
|
|
|
|
QString name() const;
|
|
|
|
QString section() const;
|
|
|
|
QIcon icon() const;
|
|
|
|
QString iconName() const;
|
|
|
|
QString description() const;
|
|
|
|
|
|
|
|
bool isEnabled() const;
|
|
|
|
void setEnabled(bool enabled);
|
|
|
|
|
|
|
|
bool hasFlag(RuleItem::Flags flag) const;
|
|
|
|
void setFlag(RuleItem::Flags flag, bool active=true);
|
|
|
|
|
|
|
|
Type type() const;
|
|
|
|
QVariant value() const;
|
|
|
|
void setValue(QVariant value);
|
|
|
|
QVariant suggestedValue() const;
|
|
|
|
void setSuggestedValue(QVariant value, bool forceValue = false);
|
|
|
|
|
|
|
|
QVariant options() const;
|
|
|
|
void setOptionsData(const QList<OptionsModel::Data> &data);
|
2020-06-24 17:38:30 +00:00
|
|
|
uint optionsMask() 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
|
|
|
|
|
|
|
RulePolicy::Type policyType() const;
|
|
|
|
int policy() const; // int belongs to anonymous enum in Rules::
|
|
|
|
void setPolicy(int policy); // int belongs to anonymous enum in Rules::
|
|
|
|
QVariant policyModel() const;
|
|
|
|
QString policyKey() const;
|
|
|
|
|
|
|
|
void reset();
|
|
|
|
|
|
|
|
private:
|
2020-06-24 17:38:30 +00:00
|
|
|
QVariant typedValue(const QVariant &value) 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
|
|
|
|
|
|
|
private:
|
|
|
|
QString m_key;
|
|
|
|
RuleItem::Type m_type;
|
|
|
|
QString m_name;
|
|
|
|
QString m_section;
|
|
|
|
QIcon m_icon;
|
|
|
|
QString m_description;
|
|
|
|
QFlags<Flags> m_flags;
|
|
|
|
|
|
|
|
bool m_enabled;
|
|
|
|
|
|
|
|
QVariant m_value;
|
|
|
|
QVariant m_suggestedValue;
|
|
|
|
|
|
|
|
RulePolicy *m_policy;
|
|
|
|
OptionsModel *m_options;
|
2020-06-24 17:38:30 +00:00
|
|
|
uint m_optionsMask;
|
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
|
|
|
};
|
|
|
|
|
|
|
|
} //namespace
|
|
|
|
|
|
|
|
#endif //KWIN_RULEITEM_H
|