2013-06-25 14:07:48 +00:00
|
|
|
/**************************************************************************
|
|
|
|
* KWin - the KDE window manager *
|
|
|
|
* This file is part of the KDE project. *
|
|
|
|
* *
|
|
|
|
* Copyright (C) 2013 Antonis Tsiapaliokas <kok3rs@gmail.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 MODEL_H
|
|
|
|
#define MODEL_H
|
2013-09-13 10:34:40 +00:00
|
|
|
|
2014-01-08 17:06:08 +00:00
|
|
|
#include <KColorScheme>
|
|
|
|
#include <KSharedConfig>
|
2018-03-05 19:01:23 +00:00
|
|
|
#include <QQuickWidget>
|
2013-08-09 12:29:05 +00:00
|
|
|
#include <QSortFilterProxyModel>
|
2013-06-25 14:07:48 +00:00
|
|
|
#include <QString>
|
|
|
|
|
2013-08-07 16:52:45 +00:00
|
|
|
namespace KWin {
|
2013-08-27 09:57:21 +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
|
|
|
class EffectModel;
|
2013-08-27 18:21:07 +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
|
|
|
namespace Compositing {
|
2013-06-25 14:07:48 +00:00
|
|
|
|
2018-03-05 19:01:23 +00:00
|
|
|
class EffectView : public QQuickWidget
|
2013-08-28 07:36:53 +00:00
|
|
|
{
|
2013-06-25 14:07:48 +00:00
|
|
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2014-03-07 09:09:47 +00:00
|
|
|
enum ViewType {
|
|
|
|
DesktopEffectsView,
|
|
|
|
CompositingSettingsView
|
|
|
|
};
|
2018-03-05 19:01:23 +00:00
|
|
|
EffectView(ViewType type, QWidget *parent = 0);
|
2013-09-13 12:29:53 +00:00
|
|
|
|
2013-12-02 14:27:58 +00:00
|
|
|
void save();
|
2013-12-02 14:40:16 +00:00
|
|
|
void load();
|
2013-12-02 14:59:31 +00:00
|
|
|
void defaults();
|
2013-12-02 14:27:58 +00:00
|
|
|
|
2013-12-02 10:26:37 +00:00
|
|
|
Q_SIGNALS:
|
|
|
|
void changed();
|
2014-03-26 11:06:01 +00:00
|
|
|
|
|
|
|
private Q_SLOTS:
|
|
|
|
void slotImplicitSizeChanged();
|
2013-12-02 10:27:36 +00:00
|
|
|
private:
|
2014-03-07 09:09:47 +00:00
|
|
|
void init(ViewType type);
|
2013-06-25 14:07:48 +00:00
|
|
|
};
|
2013-08-07 16:52:45 +00:00
|
|
|
|
2013-08-09 12:29:05 +00:00
|
|
|
|
|
|
|
class EffectFilterModel : public QSortFilterProxyModel
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
Q_PROPERTY(QString filter READ filter WRITE setFilter NOTIFY filterChanged)
|
2014-03-09 09:02:12 +00:00
|
|
|
/**
|
|
|
|
* If @c true not supported effects are excluded, if @c false no restriction on supported.
|
|
|
|
* Default value is @c true.
|
|
|
|
**/
|
2014-03-13 18:50:17 +00:00
|
|
|
Q_PROPERTY(bool filterOutUnsupported MEMBER m_filterOutUnsupported NOTIFY filterOutUnsupportedChanged)
|
|
|
|
/**
|
|
|
|
* If @c true internal effects are excluded, if @c false no restriction on internal.
|
|
|
|
* Default value is @c true.
|
|
|
|
**/
|
|
|
|
Q_PROPERTY(bool filterOutInternal MEMBER m_filterOutInternal NOTIFY filterOutInternalChanged)
|
2016-07-16 17:14:44 +00:00
|
|
|
Q_PROPERTY(QColor backgroundActiveColor READ backgroundActiveColor CONSTANT)
|
|
|
|
Q_PROPERTY(QColor backgroundNormalColor READ backgroundNormalColor CONSTANT)
|
|
|
|
Q_PROPERTY(QColor backgroundAlternateColor READ backgroundAlternateColor CONSTANT)
|
2014-03-11 08:02:23 +00:00
|
|
|
Q_PROPERTY(QColor sectionColor READ sectionColor CONSTANT)
|
2013-08-09 12:29:05 +00:00
|
|
|
public:
|
|
|
|
EffectFilterModel(QObject *parent = 0);
|
|
|
|
const QString &filter() const;
|
|
|
|
|
2014-06-11 06:44:04 +00:00
|
|
|
Q_INVOKABLE void updateEffectStatus(int rowIndex, int effectState);
|
2013-08-27 18:21:07 +00:00
|
|
|
Q_INVOKABLE void syncConfig();
|
2014-01-12 19:27:10 +00:00
|
|
|
Q_INVOKABLE void load();
|
2013-08-27 18:21:07 +00:00
|
|
|
|
2013-09-13 10:34:40 +00:00
|
|
|
QColor backgroundActiveColor() { return KColorScheme(QPalette::Active, KColorScheme::Selection, KSharedConfigPtr(0)).background(KColorScheme::LinkBackground).color(); };
|
|
|
|
QColor backgroundNormalColor() { return KColorScheme(QPalette::Active, KColorScheme::View, KSharedConfigPtr(0)).background(KColorScheme::NormalBackground).color(); };
|
|
|
|
QColor backgroundAlternateColor() { return KColorScheme(QPalette::Active, KColorScheme::View, KSharedConfigPtr(0)).background(KColorScheme::AlternateBackground).color(); };
|
|
|
|
|
2014-03-11 08:02:23 +00:00
|
|
|
QColor sectionColor() const {
|
|
|
|
QColor color = KColorScheme(QPalette::Active).foreground().color();
|
|
|
|
color.setAlphaF(0.6);
|
|
|
|
return color;
|
|
|
|
}
|
|
|
|
|
2013-12-02 14:59:31 +00:00
|
|
|
void defaults();
|
2013-12-02 14:40:16 +00:00
|
|
|
|
2013-08-09 12:29:05 +00:00
|
|
|
public Q_SLOTS:
|
|
|
|
void setFilter(const QString &filter);
|
|
|
|
|
|
|
|
protected:
|
|
|
|
virtual bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const;
|
|
|
|
|
|
|
|
Q_SIGNALS:
|
|
|
|
void effectModelChanged();
|
|
|
|
void filterChanged();
|
2014-03-13 18:50:17 +00:00
|
|
|
void filterOutUnsupportedChanged();
|
|
|
|
void filterOutInternalChanged();
|
2013-08-09 12:29:05 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
EffectModel *m_effectModel;
|
|
|
|
QString m_filter;
|
2014-03-13 18:50:17 +00:00
|
|
|
bool m_filterOutUnsupported;
|
|
|
|
bool m_filterOutInternal;
|
2013-08-09 12:29:05 +00:00
|
|
|
};
|
2013-08-07 16:52:45 +00:00
|
|
|
}
|
|
|
|
}
|
2013-06-25 14:07:48 +00:00
|
|
|
#endif
|