2020-08-02 22:22:19 +00:00
|
|
|
/*
|
|
|
|
KWin - the KDE window manager
|
|
|
|
This file is part of the KDE project.
|
[kcmkwin] Move effects model into a shared library
Summary:
The main motivation for moving it into a shared library is to share the
model between Desktop Effects and Virtual Desktops KCM.
The extracted model is quite the same as the one in Desktop Effects KCM,
except some minor changes, e.g. rename loadEffect and syncConfig to more
convenient names, add comments, some whitespace changes, fix coding
style in some parts, etc.
Test Plan: effectModelTest passes, Desktop Effects KCM works.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: hein, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D17765
2018-12-22 10:50:28 +00:00
|
|
|
|
2020-08-02 22:22:19 +00:00
|
|
|
SPDX-FileCopyrightText: 2013 Antonis Tsiapaliokas <kok3rs@gmail.com>
|
|
|
|
SPDX-FileCopyrightText: 2018 Vlad Zahorodnii <vlad.zahorodnii@kde.org>
|
[kcmkwin] Move effects model into a shared library
Summary:
The main motivation for moving it into a shared library is to share the
model between Desktop Effects and Virtual Desktops KCM.
The extracted model is quite the same as the one in Desktop Effects KCM,
except some minor changes, e.g. rename loadEffect and syncConfig to more
convenient names, add comments, some whitespace changes, fix coding
style in some parts, etc.
Test Plan: effectModelTest passes, Desktop Effects KCM works.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: hein, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D17765
2018-12-22 10:50:28 +00:00
|
|
|
|
2020-08-02 22:22:19 +00:00
|
|
|
SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
*/
|
[kcmkwin] Move effects model into a shared library
Summary:
The main motivation for moving it into a shared library is to share the
model between Desktop Effects and Virtual Desktops KCM.
The extracted model is quite the same as the one in Desktop Effects KCM,
except some minor changes, e.g. rename loadEffect and syncConfig to more
convenient names, add comments, some whitespace changes, fix coding
style in some parts, etc.
Test Plan: effectModelTest passes, Desktop Effects KCM works.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: hein, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D17765
2018-12-22 10:50:28 +00:00
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <kwin_export.h>
|
|
|
|
|
|
|
|
#include <KSharedConfig>
|
|
|
|
|
|
|
|
#include <QAbstractItemModel>
|
|
|
|
#include <QString>
|
|
|
|
#include <QUrl>
|
2019-02-03 15:18:42 +00:00
|
|
|
#include <QWindow>
|
[kcmkwin] Move effects model into a shared library
Summary:
The main motivation for moving it into a shared library is to share the
model between Desktop Effects and Virtual Desktops KCM.
The extracted model is quite the same as the one in Desktop Effects KCM,
except some minor changes, e.g. rename loadEffect and syncConfig to more
convenient names, add comments, some whitespace changes, fix coding
style in some parts, etc.
Test Plan: effectModelTest passes, Desktop Effects KCM works.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: hein, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D17765
2018-12-22 10:50:28 +00:00
|
|
|
|
|
|
|
namespace KWin
|
|
|
|
{
|
|
|
|
|
2019-02-03 20:04:09 +00:00
|
|
|
class KWIN_EXPORT EffectsModel : public QAbstractItemModel
|
[kcmkwin] Move effects model into a shared library
Summary:
The main motivation for moving it into a shared library is to share the
model between Desktop Effects and Virtual Desktops KCM.
The extracted model is quite the same as the one in Desktop Effects KCM,
except some minor changes, e.g. rename loadEffect and syncConfig to more
convenient names, add comments, some whitespace changes, fix coding
style in some parts, etc.
Test Plan: effectModelTest passes, Desktop Effects KCM works.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: hein, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D17765
2018-12-22 10:50:28 +00:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
/**
|
|
|
|
* This enum type is used to specify data roles.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
[kcmkwin] Move effects model into a shared library
Summary:
The main motivation for moving it into a shared library is to share the
model between Desktop Effects and Virtual Desktops KCM.
The extracted model is quite the same as the one in Desktop Effects KCM,
except some minor changes, e.g. rename loadEffect and syncConfig to more
convenient names, add comments, some whitespace changes, fix coding
style in some parts, etc.
Test Plan: effectModelTest passes, Desktop Effects KCM works.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: hein, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D17765
2018-12-22 10:50:28 +00:00
|
|
|
enum AdditionalRoles {
|
|
|
|
/**
|
|
|
|
* The user-friendly name of the effect.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
[kcmkwin] Move effects model into a shared library
Summary:
The main motivation for moving it into a shared library is to share the
model between Desktop Effects and Virtual Desktops KCM.
The extracted model is quite the same as the one in Desktop Effects KCM,
except some minor changes, e.g. rename loadEffect and syncConfig to more
convenient names, add comments, some whitespace changes, fix coding
style in some parts, etc.
Test Plan: effectModelTest passes, Desktop Effects KCM works.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: hein, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D17765
2018-12-22 10:50:28 +00:00
|
|
|
NameRole = Qt::UserRole + 1,
|
|
|
|
/**
|
|
|
|
* The description of the effect.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
[kcmkwin] Move effects model into a shared library
Summary:
The main motivation for moving it into a shared library is to share the
model between Desktop Effects and Virtual Desktops KCM.
The extracted model is quite the same as the one in Desktop Effects KCM,
except some minor changes, e.g. rename loadEffect and syncConfig to more
convenient names, add comments, some whitespace changes, fix coding
style in some parts, etc.
Test Plan: effectModelTest passes, Desktop Effects KCM works.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: hein, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D17765
2018-12-22 10:50:28 +00:00
|
|
|
DescriptionRole,
|
|
|
|
/**
|
|
|
|
* The name of the effect's author. If there are several authors, they
|
|
|
|
* will be comma separated.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
[kcmkwin] Move effects model into a shared library
Summary:
The main motivation for moving it into a shared library is to share the
model between Desktop Effects and Virtual Desktops KCM.
The extracted model is quite the same as the one in Desktop Effects KCM,
except some minor changes, e.g. rename loadEffect and syncConfig to more
convenient names, add comments, some whitespace changes, fix coding
style in some parts, etc.
Test Plan: effectModelTest passes, Desktop Effects KCM works.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: hein, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D17765
2018-12-22 10:50:28 +00:00
|
|
|
AuthorNameRole,
|
|
|
|
/**
|
|
|
|
* The email of the effect's author. If there are several authors, the
|
|
|
|
* emails will be comma separated.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
[kcmkwin] Move effects model into a shared library
Summary:
The main motivation for moving it into a shared library is to share the
model between Desktop Effects and Virtual Desktops KCM.
The extracted model is quite the same as the one in Desktop Effects KCM,
except some minor changes, e.g. rename loadEffect and syncConfig to more
convenient names, add comments, some whitespace changes, fix coding
style in some parts, etc.
Test Plan: effectModelTest passes, Desktop Effects KCM works.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: hein, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D17765
2018-12-22 10:50:28 +00:00
|
|
|
AuthorEmailRole,
|
|
|
|
/**
|
|
|
|
* The license of the effect.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
[kcmkwin] Move effects model into a shared library
Summary:
The main motivation for moving it into a shared library is to share the
model between Desktop Effects and Virtual Desktops KCM.
The extracted model is quite the same as the one in Desktop Effects KCM,
except some minor changes, e.g. rename loadEffect and syncConfig to more
convenient names, add comments, some whitespace changes, fix coding
style in some parts, etc.
Test Plan: effectModelTest passes, Desktop Effects KCM works.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: hein, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D17765
2018-12-22 10:50:28 +00:00
|
|
|
LicenseRole,
|
|
|
|
/**
|
|
|
|
* The version of the effect.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
[kcmkwin] Move effects model into a shared library
Summary:
The main motivation for moving it into a shared library is to share the
model between Desktop Effects and Virtual Desktops KCM.
The extracted model is quite the same as the one in Desktop Effects KCM,
except some minor changes, e.g. rename loadEffect and syncConfig to more
convenient names, add comments, some whitespace changes, fix coding
style in some parts, etc.
Test Plan: effectModelTest passes, Desktop Effects KCM works.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: hein, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D17765
2018-12-22 10:50:28 +00:00
|
|
|
VersionRole,
|
|
|
|
/**
|
|
|
|
* The category of the effect.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
[kcmkwin] Move effects model into a shared library
Summary:
The main motivation for moving it into a shared library is to share the
model between Desktop Effects and Virtual Desktops KCM.
The extracted model is quite the same as the one in Desktop Effects KCM,
except some minor changes, e.g. rename loadEffect and syncConfig to more
convenient names, add comments, some whitespace changes, fix coding
style in some parts, etc.
Test Plan: effectModelTest passes, Desktop Effects KCM works.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: hein, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D17765
2018-12-22 10:50:28 +00:00
|
|
|
CategoryRole,
|
|
|
|
/**
|
|
|
|
* The service name(plugin name) of the effect.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
[kcmkwin] Move effects model into a shared library
Summary:
The main motivation for moving it into a shared library is to share the
model between Desktop Effects and Virtual Desktops KCM.
The extracted model is quite the same as the one in Desktop Effects KCM,
except some minor changes, e.g. rename loadEffect and syncConfig to more
convenient names, add comments, some whitespace changes, fix coding
style in some parts, etc.
Test Plan: effectModelTest passes, Desktop Effects KCM works.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: hein, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D17765
2018-12-22 10:50:28 +00:00
|
|
|
ServiceNameRole,
|
|
|
|
/**
|
|
|
|
* The icon name of the effect.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
[kcmkwin] Move effects model into a shared library
Summary:
The main motivation for moving it into a shared library is to share the
model between Desktop Effects and Virtual Desktops KCM.
The extracted model is quite the same as the one in Desktop Effects KCM,
except some minor changes, e.g. rename loadEffect and syncConfig to more
convenient names, add comments, some whitespace changes, fix coding
style in some parts, etc.
Test Plan: effectModelTest passes, Desktop Effects KCM works.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: hein, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D17765
2018-12-22 10:50:28 +00:00
|
|
|
IconNameRole,
|
|
|
|
/**
|
|
|
|
* Whether the effect is enabled or disabled.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2019-02-03 17:19:16 +00:00
|
|
|
StatusRole,
|
[kcmkwin] Move effects model into a shared library
Summary:
The main motivation for moving it into a shared library is to share the
model between Desktop Effects and Virtual Desktops KCM.
The extracted model is quite the same as the one in Desktop Effects KCM,
except some minor changes, e.g. rename loadEffect and syncConfig to more
convenient names, add comments, some whitespace changes, fix coding
style in some parts, etc.
Test Plan: effectModelTest passes, Desktop Effects KCM works.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: hein, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D17765
2018-12-22 10:50:28 +00:00
|
|
|
/**
|
|
|
|
* Link to a video demonstration of the effect.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
[kcmkwin] Move effects model into a shared library
Summary:
The main motivation for moving it into a shared library is to share the
model between Desktop Effects and Virtual Desktops KCM.
The extracted model is quite the same as the one in Desktop Effects KCM,
except some minor changes, e.g. rename loadEffect and syncConfig to more
convenient names, add comments, some whitespace changes, fix coding
style in some parts, etc.
Test Plan: effectModelTest passes, Desktop Effects KCM works.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: hein, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D17765
2018-12-22 10:50:28 +00:00
|
|
|
VideoRole,
|
|
|
|
/**
|
|
|
|
* Link to the home page of the effect.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
[kcmkwin] Move effects model into a shared library
Summary:
The main motivation for moving it into a shared library is to share the
model between Desktop Effects and Virtual Desktops KCM.
The extracted model is quite the same as the one in Desktop Effects KCM,
except some minor changes, e.g. rename loadEffect and syncConfig to more
convenient names, add comments, some whitespace changes, fix coding
style in some parts, etc.
Test Plan: effectModelTest passes, Desktop Effects KCM works.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: hein, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D17765
2018-12-22 10:50:28 +00:00
|
|
|
WebsiteRole,
|
|
|
|
/**
|
|
|
|
* Whether the effect is supported.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
[kcmkwin] Move effects model into a shared library
Summary:
The main motivation for moving it into a shared library is to share the
model between Desktop Effects and Virtual Desktops KCM.
The extracted model is quite the same as the one in Desktop Effects KCM,
except some minor changes, e.g. rename loadEffect and syncConfig to more
convenient names, add comments, some whitespace changes, fix coding
style in some parts, etc.
Test Plan: effectModelTest passes, Desktop Effects KCM works.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: hein, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D17765
2018-12-22 10:50:28 +00:00
|
|
|
SupportedRole,
|
|
|
|
/**
|
|
|
|
* The exclusive group of the effect.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
[kcmkwin] Move effects model into a shared library
Summary:
The main motivation for moving it into a shared library is to share the
model between Desktop Effects and Virtual Desktops KCM.
The extracted model is quite the same as the one in Desktop Effects KCM,
except some minor changes, e.g. rename loadEffect and syncConfig to more
convenient names, add comments, some whitespace changes, fix coding
style in some parts, etc.
Test Plan: effectModelTest passes, Desktop Effects KCM works.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: hein, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D17765
2018-12-22 10:50:28 +00:00
|
|
|
ExclusiveRole,
|
|
|
|
/**
|
|
|
|
* Whether the effect is internal.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
[kcmkwin] Move effects model into a shared library
Summary:
The main motivation for moving it into a shared library is to share the
model between Desktop Effects and Virtual Desktops KCM.
The extracted model is quite the same as the one in Desktop Effects KCM,
except some minor changes, e.g. rename loadEffect and syncConfig to more
convenient names, add comments, some whitespace changes, fix coding
style in some parts, etc.
Test Plan: effectModelTest passes, Desktop Effects KCM works.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: hein, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D17765
2018-12-22 10:50:28 +00:00
|
|
|
InternalRole,
|
|
|
|
/**
|
|
|
|
* Whether the effect has a KCM.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
[kcmkwin] Move effects model into a shared library
Summary:
The main motivation for moving it into a shared library is to share the
model between Desktop Effects and Virtual Desktops KCM.
The extracted model is quite the same as the one in Desktop Effects KCM,
except some minor changes, e.g. rename loadEffect and syncConfig to more
convenient names, add comments, some whitespace changes, fix coding
style in some parts, etc.
Test Plan: effectModelTest passes, Desktop Effects KCM works.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: hein, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D17765
2018-12-22 10:50:28 +00:00
|
|
|
ConfigurableRole,
|
|
|
|
/**
|
|
|
|
* Whether this is a scripted effect.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
[kcmkwin] Move effects model into a shared library
Summary:
The main motivation for moving it into a shared library is to share the
model between Desktop Effects and Virtual Desktops KCM.
The extracted model is quite the same as the one in Desktop Effects KCM,
except some minor changes, e.g. rename loadEffect and syncConfig to more
convenient names, add comments, some whitespace changes, fix coding
style in some parts, etc.
Test Plan: effectModelTest passes, Desktop Effects KCM works.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: hein, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D17765
2018-12-22 10:50:28 +00:00
|
|
|
ScriptedRole,
|
|
|
|
/**
|
|
|
|
* Whether the effect is enabled by default.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2020-09-30 11:53:44 +00:00
|
|
|
EnabledByDefaultRole,
|
|
|
|
/**
|
|
|
|
* Id of the effect's config module, empty if the effect has no config.
|
|
|
|
*/
|
|
|
|
ConfigModuleRole
|
[kcmkwin] Move effects model into a shared library
Summary:
The main motivation for moving it into a shared library is to share the
model between Desktop Effects and Virtual Desktops KCM.
The extracted model is quite the same as the one in Desktop Effects KCM,
except some minor changes, e.g. rename loadEffect and syncConfig to more
convenient names, add comments, some whitespace changes, fix coding
style in some parts, etc.
Test Plan: effectModelTest passes, Desktop Effects KCM works.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: hein, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D17765
2018-12-22 10:50:28 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This enum type is used to specify the status of a given effect.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
[kcmkwin] Move effects model into a shared library
Summary:
The main motivation for moving it into a shared library is to share the
model between Desktop Effects and Virtual Desktops KCM.
The extracted model is quite the same as the one in Desktop Effects KCM,
except some minor changes, e.g. rename loadEffect and syncConfig to more
convenient names, add comments, some whitespace changes, fix coding
style in some parts, etc.
Test Plan: effectModelTest passes, Desktop Effects KCM works.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: hein, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D17765
2018-12-22 10:50:28 +00:00
|
|
|
enum class Status {
|
|
|
|
/**
|
|
|
|
* The effect is disabled.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
[kcmkwin] Move effects model into a shared library
Summary:
The main motivation for moving it into a shared library is to share the
model between Desktop Effects and Virtual Desktops KCM.
The extracted model is quite the same as the one in Desktop Effects KCM,
except some minor changes, e.g. rename loadEffect and syncConfig to more
convenient names, add comments, some whitespace changes, fix coding
style in some parts, etc.
Test Plan: effectModelTest passes, Desktop Effects KCM works.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: hein, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D17765
2018-12-22 10:50:28 +00:00
|
|
|
Disabled = Qt::Unchecked,
|
|
|
|
/**
|
|
|
|
* An enable function is used to determine whether the effect is enabled.
|
|
|
|
* For example, such function can be useful to disable the blur effect
|
|
|
|
* when running in a virtual machine.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
[kcmkwin] Move effects model into a shared library
Summary:
The main motivation for moving it into a shared library is to share the
model between Desktop Effects and Virtual Desktops KCM.
The extracted model is quite the same as the one in Desktop Effects KCM,
except some minor changes, e.g. rename loadEffect and syncConfig to more
convenient names, add comments, some whitespace changes, fix coding
style in some parts, etc.
Test Plan: effectModelTest passes, Desktop Effects KCM works.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: hein, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D17765
2018-12-22 10:50:28 +00:00
|
|
|
EnabledUndeterminded = Qt::PartiallyChecked,
|
|
|
|
/**
|
|
|
|
* The effect is enabled.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
[kcmkwin] Move effects model into a shared library
Summary:
The main motivation for moving it into a shared library is to share the
model between Desktop Effects and Virtual Desktops KCM.
The extracted model is quite the same as the one in Desktop Effects KCM,
except some minor changes, e.g. rename loadEffect and syncConfig to more
convenient names, add comments, some whitespace changes, fix coding
style in some parts, etc.
Test Plan: effectModelTest passes, Desktop Effects KCM works.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: hein, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D17765
2018-12-22 10:50:28 +00:00
|
|
|
Enabled = Qt::Checked
|
|
|
|
};
|
|
|
|
|
2019-02-03 20:04:09 +00:00
|
|
|
explicit EffectsModel(QObject *parent = nullptr);
|
[kcmkwin] Move effects model into a shared library
Summary:
The main motivation for moving it into a shared library is to share the
model between Desktop Effects and Virtual Desktops KCM.
The extracted model is quite the same as the one in Desktop Effects KCM,
except some minor changes, e.g. rename loadEffect and syncConfig to more
convenient names, add comments, some whitespace changes, fix coding
style in some parts, etc.
Test Plan: effectModelTest passes, Desktop Effects KCM works.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: hein, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D17765
2018-12-22 10:50:28 +00:00
|
|
|
|
|
|
|
// Reimplemented from QAbstractItemModel.
|
|
|
|
QHash<int, QByteArray> roleNames() const override;
|
|
|
|
QModelIndex index(int row, int column, const QModelIndex &parent = {}) const override;
|
|
|
|
QModelIndex parent(const QModelIndex &child) const override;
|
|
|
|
int rowCount(const QModelIndex &parent = {}) const override;
|
|
|
|
int columnCount(const QModelIndex &parent = {}) const override;
|
|
|
|
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
|
|
|
bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Changes the status of a given effect.
|
|
|
|
*
|
|
|
|
* @param rowIndex An effect represented by the given index.
|
|
|
|
* @param effectState The new state.
|
|
|
|
* @note In order to actually apply the change, you have to call save().
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
[kcmkwin] Move effects model into a shared library
Summary:
The main motivation for moving it into a shared library is to share the
model between Desktop Effects and Virtual Desktops KCM.
The extracted model is quite the same as the one in Desktop Effects KCM,
except some minor changes, e.g. rename loadEffect and syncConfig to more
convenient names, add comments, some whitespace changes, fix coding
style in some parts, etc.
Test Plan: effectModelTest passes, Desktop Effects KCM works.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: hein, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D17765
2018-12-22 10:50:28 +00:00
|
|
|
void updateEffectStatus(const QModelIndex &rowIndex, Status effectState);
|
|
|
|
|
2019-02-03 16:06:05 +00:00
|
|
|
/**
|
|
|
|
* This enum type is used to specify load options.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2019-02-03 16:06:05 +00:00
|
|
|
enum class LoadOptions {
|
|
|
|
None,
|
|
|
|
/**
|
|
|
|
* Do not discard unsaved changes when reloading the model.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2019-02-03 16:06:05 +00:00
|
|
|
KeepDirty
|
|
|
|
};
|
|
|
|
|
[kcmkwin] Move effects model into a shared library
Summary:
The main motivation for moving it into a shared library is to share the
model between Desktop Effects and Virtual Desktops KCM.
The extracted model is quite the same as the one in Desktop Effects KCM,
except some minor changes, e.g. rename loadEffect and syncConfig to more
convenient names, add comments, some whitespace changes, fix coding
style in some parts, etc.
Test Plan: effectModelTest passes, Desktop Effects KCM works.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: hein, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D17765
2018-12-22 10:50:28 +00:00
|
|
|
/**
|
|
|
|
* Loads effects.
|
|
|
|
*
|
|
|
|
* You have to call this method in order to populate the model.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2019-02-03 16:06:05 +00:00
|
|
|
void load(LoadOptions options = LoadOptions::None);
|
[kcmkwin] Move effects model into a shared library
Summary:
The main motivation for moving it into a shared library is to share the
model between Desktop Effects and Virtual Desktops KCM.
The extracted model is quite the same as the one in Desktop Effects KCM,
except some minor changes, e.g. rename loadEffect and syncConfig to more
convenient names, add comments, some whitespace changes, fix coding
style in some parts, etc.
Test Plan: effectModelTest passes, Desktop Effects KCM works.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: hein, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D17765
2018-12-22 10:50:28 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Saves status of each modified effect.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
[kcmkwin] Move effects model into a shared library
Summary:
The main motivation for moving it into a shared library is to share the
model between Desktop Effects and Virtual Desktops KCM.
The extracted model is quite the same as the one in Desktop Effects KCM,
except some minor changes, e.g. rename loadEffect and syncConfig to more
convenient names, add comments, some whitespace changes, fix coding
style in some parts, etc.
Test Plan: effectModelTest passes, Desktop Effects KCM works.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: hein, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D17765
2018-12-22 10:50:28 +00:00
|
|
|
void save();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Resets the status of each effect to the default state.
|
|
|
|
*
|
|
|
|
* @note In order to actually apply the change, you have to call save().
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
[kcmkwin] Move effects model into a shared library
Summary:
The main motivation for moving it into a shared library is to share the
model between Desktop Effects and Virtual Desktops KCM.
The extracted model is quite the same as the one in Desktop Effects KCM,
except some minor changes, e.g. rename loadEffect and syncConfig to more
convenient names, add comments, some whitespace changes, fix coding
style in some parts, etc.
Test Plan: effectModelTest passes, Desktop Effects KCM works.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: hein, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D17765
2018-12-22 10:50:28 +00:00
|
|
|
void defaults();
|
|
|
|
|
2019-02-02 20:49:38 +00:00
|
|
|
/**
|
2019-12-16 09:23:18 +00:00
|
|
|
* Whether the status of each effect is its default state.
|
|
|
|
*/
|
|
|
|
bool isDefaults() const;
|
|
|
|
|
|
|
|
/**
|
2019-02-02 20:49:38 +00:00
|
|
|
* Whether the model has unsaved changes.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2019-02-02 20:49:38 +00:00
|
|
|
bool needsSave() const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Finds an effect with the given plugin id.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2019-02-02 20:49:38 +00:00
|
|
|
QModelIndex findByPluginId(const QString &pluginId) const;
|
|
|
|
|
2019-02-03 15:18:42 +00:00
|
|
|
/**
|
|
|
|
* Shows a configuration dialog for a given effect.
|
|
|
|
*
|
|
|
|
* @param index An effect represented by the given index.
|
|
|
|
* @param transientParent The transient parent of the configuration dialog.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2019-02-03 15:18:42 +00:00
|
|
|
void requestConfigure(const QModelIndex &index, QWindow *transientParent);
|
|
|
|
|
2019-02-04 14:20:33 +00:00
|
|
|
Q_SIGNALS:
|
|
|
|
/**
|
|
|
|
* This signal is emitted when the model is loaded or reloaded.
|
|
|
|
*
|
|
|
|
* @see load
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2019-02-04 14:20:33 +00:00
|
|
|
void loaded();
|
|
|
|
|
[kcmkwin] Move effects model into a shared library
Summary:
The main motivation for moving it into a shared library is to share the
model between Desktop Effects and Virtual Desktops KCM.
The extracted model is quite the same as the one in Desktop Effects KCM,
except some minor changes, e.g. rename loadEffect and syncConfig to more
convenient names, add comments, some whitespace changes, fix coding
style in some parts, etc.
Test Plan: effectModelTest passes, Desktop Effects KCM works.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: hein, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D17765
2018-12-22 10:50:28 +00:00
|
|
|
protected:
|
|
|
|
enum class Kind {
|
|
|
|
BuiltIn,
|
|
|
|
Binary,
|
|
|
|
Scripted
|
|
|
|
};
|
|
|
|
|
|
|
|
struct EffectData {
|
|
|
|
QString name;
|
|
|
|
QString description;
|
|
|
|
QString authorName;
|
|
|
|
QString authorEmail;
|
|
|
|
QString license;
|
|
|
|
QString version;
|
|
|
|
QString untranslatedCategory;
|
|
|
|
QString category;
|
|
|
|
QString serviceName;
|
|
|
|
QString iconName;
|
2019-02-03 17:19:16 +00:00
|
|
|
Status status;
|
2019-02-02 20:49:38 +00:00
|
|
|
Status originalStatus;
|
[kcmkwin] Move effects model into a shared library
Summary:
The main motivation for moving it into a shared library is to share the
model between Desktop Effects and Virtual Desktops KCM.
The extracted model is quite the same as the one in Desktop Effects KCM,
except some minor changes, e.g. rename loadEffect and syncConfig to more
convenient names, add comments, some whitespace changes, fix coding
style in some parts, etc.
Test Plan: effectModelTest passes, Desktop Effects KCM works.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: hein, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D17765
2018-12-22 10:50:28 +00:00
|
|
|
bool enabledByDefault;
|
|
|
|
bool enabledByDefaultFunction;
|
|
|
|
QUrl video;
|
|
|
|
QUrl website;
|
|
|
|
bool supported;
|
|
|
|
QString exclusiveGroup;
|
|
|
|
bool internal;
|
|
|
|
bool configurable;
|
|
|
|
Kind kind;
|
|
|
|
bool changed = false;
|
2020-09-30 11:53:44 +00:00
|
|
|
QString configModule;
|
[kcmkwin] Move effects model into a shared library
Summary:
The main motivation for moving it into a shared library is to share the
model between Desktop Effects and Virtual Desktops KCM.
The extracted model is quite the same as the one in Desktop Effects KCM,
except some minor changes, e.g. rename loadEffect and syncConfig to more
convenient names, add comments, some whitespace changes, fix coding
style in some parts, etc.
Test Plan: effectModelTest passes, Desktop Effects KCM works.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: hein, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D17765
2018-12-22 10:50:28 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns whether the given effect should be stored in the model.
|
|
|
|
*
|
|
|
|
* @param data The effect.
|
|
|
|
* @returns @c true if the effect should be stored, otherwise @c false.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
[kcmkwin] Move effects model into a shared library
Summary:
The main motivation for moving it into a shared library is to share the
model between Desktop Effects and Virtual Desktops KCM.
The extracted model is quite the same as the one in Desktop Effects KCM,
except some minor changes, e.g. rename loadEffect and syncConfig to more
convenient names, add comments, some whitespace changes, fix coding
style in some parts, etc.
Test Plan: effectModelTest passes, Desktop Effects KCM works.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: hein, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D17765
2018-12-22 10:50:28 +00:00
|
|
|
virtual bool shouldStore(const EffectData &data) const;
|
|
|
|
|
|
|
|
private:
|
2020-09-30 11:53:44 +00:00
|
|
|
void loadBuiltInEffects(const KConfigGroup &kwinConfig);
|
[kcmkwin] Move effects model into a shared library
Summary:
The main motivation for moving it into a shared library is to share the
model between Desktop Effects and Virtual Desktops KCM.
The extracted model is quite the same as the one in Desktop Effects KCM,
except some minor changes, e.g. rename loadEffect and syncConfig to more
convenient names, add comments, some whitespace changes, fix coding
style in some parts, etc.
Test Plan: effectModelTest passes, Desktop Effects KCM works.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: hein, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D17765
2018-12-22 10:50:28 +00:00
|
|
|
void loadJavascriptEffects(const KConfigGroup &kwinConfig);
|
2020-09-30 11:53:44 +00:00
|
|
|
void loadPluginEffects(const KConfigGroup &kwinConfig);
|
[kcmkwin] Move effects model into a shared library
Summary:
The main motivation for moving it into a shared library is to share the
model between Desktop Effects and Virtual Desktops KCM.
The extracted model is quite the same as the one in Desktop Effects KCM,
except some minor changes, e.g. rename loadEffect and syncConfig to more
convenient names, add comments, some whitespace changes, fix coding
style in some parts, etc.
Test Plan: effectModelTest passes, Desktop Effects KCM works.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: hein, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D17765
2018-12-22 10:50:28 +00:00
|
|
|
|
2019-02-03 20:27:47 +00:00
|
|
|
QVector<EffectData> m_effects;
|
2019-02-04 14:20:33 +00:00
|
|
|
QVector<EffectData> m_pendingEffects;
|
|
|
|
int m_lastSerial = -1;
|
[kcmkwin] Move effects model into a shared library
Summary:
The main motivation for moving it into a shared library is to share the
model between Desktop Effects and Virtual Desktops KCM.
The extracted model is quite the same as the one in Desktop Effects KCM,
except some minor changes, e.g. rename loadEffect and syncConfig to more
convenient names, add comments, some whitespace changes, fix coding
style in some parts, etc.
Test Plan: effectModelTest passes, Desktop Effects KCM works.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: hein, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D17765
2018-12-22 10:50:28 +00:00
|
|
|
|
2019-02-03 20:04:09 +00:00
|
|
|
Q_DISABLE_COPY(EffectsModel)
|
[kcmkwin] Move effects model into a shared library
Summary:
The main motivation for moving it into a shared library is to share the
model between Desktop Effects and Virtual Desktops KCM.
The extracted model is quite the same as the one in Desktop Effects KCM,
except some minor changes, e.g. rename loadEffect and syncConfig to more
convenient names, add comments, some whitespace changes, fix coding
style in some parts, etc.
Test Plan: effectModelTest passes, Desktop Effects KCM works.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: hein, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D17765
2018-12-22 10:50:28 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|