2011-11-10 13:28:06 +00:00
|
|
|
/********************************************************************
|
|
|
|
KWin - the KDE window manager
|
|
|
|
This file is part of the KDE project.
|
|
|
|
|
|
|
|
Copyright (C) 2011 Martin Gräßlin <mgraesslin@kde.org>
|
|
|
|
|
|
|
|
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 KWIN_THUMBNAILITEM_H
|
|
|
|
#define KWIN_THUMBNAILITEM_H
|
|
|
|
|
2013-08-08 09:39:39 +00:00
|
|
|
#include <QPointer>
|
2013-02-26 08:00:51 +00:00
|
|
|
#include <QWeakPointer>
|
2013-08-08 09:39:39 +00:00
|
|
|
#include <QQuickPaintedItem>
|
2011-11-10 13:28:06 +00:00
|
|
|
|
|
|
|
namespace KWin
|
|
|
|
{
|
|
|
|
|
2015-05-20 14:23:42 +00:00
|
|
|
class AbstractClient;
|
2011-11-10 13:28:06 +00:00
|
|
|
class EffectWindow;
|
|
|
|
class EffectWindowImpl;
|
|
|
|
|
2013-08-08 09:39:39 +00:00
|
|
|
class AbstractThumbnailItem : public QQuickPaintedItem
|
2011-11-10 13:28:06 +00:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
2013-03-19 08:08:32 +00:00
|
|
|
Q_PROPERTY(qreal brightness READ brightness WRITE setBrightness NOTIFY brightnessChanged)
|
|
|
|
Q_PROPERTY(qreal saturation READ saturation WRITE setSaturation NOTIFY saturationChanged)
|
2013-08-08 09:39:39 +00:00
|
|
|
Q_PROPERTY(QQuickItem *clipTo READ clipTo WRITE setClipTo NOTIFY clipToChanged)
|
2011-11-10 13:28:06 +00:00
|
|
|
public:
|
2012-03-29 13:32:41 +00:00
|
|
|
virtual ~AbstractThumbnailItem();
|
2013-03-19 08:08:32 +00:00
|
|
|
qreal brightness() const;
|
|
|
|
qreal saturation() const;
|
2013-08-08 09:39:39 +00:00
|
|
|
QQuickItem *clipTo() const;
|
2013-03-19 08:08:32 +00:00
|
|
|
|
|
|
|
public Q_SLOTS:
|
|
|
|
void setBrightness(qreal brightness);
|
|
|
|
void setSaturation(qreal saturation);
|
2013-08-08 09:39:39 +00:00
|
|
|
void setClipTo(QQuickItem *clip);
|
2013-03-19 08:08:32 +00:00
|
|
|
|
2011-11-10 13:28:06 +00:00
|
|
|
Q_SIGNALS:
|
2013-03-19 08:08:32 +00:00
|
|
|
void brightnessChanged();
|
|
|
|
void saturationChanged();
|
2013-08-08 09:39:39 +00:00
|
|
|
void clipToChanged();
|
2012-03-29 13:32:41 +00:00
|
|
|
|
|
|
|
protected:
|
2013-08-08 09:39:39 +00:00
|
|
|
explicit AbstractThumbnailItem(QQuickItem *parent = 0);
|
2012-03-29 13:32:41 +00:00
|
|
|
|
2012-03-29 18:17:57 +00:00
|
|
|
protected Q_SLOTS:
|
|
|
|
virtual void repaint(KWin::EffectWindow* w) = 0;
|
|
|
|
|
2011-11-10 13:28:06 +00:00
|
|
|
private Q_SLOTS:
|
|
|
|
void init();
|
|
|
|
void effectWindowAdded();
|
2013-03-06 08:46:25 +00:00
|
|
|
void compositingToggled();
|
2012-03-29 13:32:41 +00:00
|
|
|
|
2011-11-10 13:28:06 +00:00
|
|
|
private:
|
|
|
|
void findParentEffectWindow();
|
|
|
|
QWeakPointer<EffectWindowImpl> m_parent;
|
2013-03-19 08:08:32 +00:00
|
|
|
qreal m_brightness;
|
|
|
|
qreal m_saturation;
|
2013-08-08 09:39:39 +00:00
|
|
|
QPointer<QQuickItem> m_clipToItem;
|
2011-11-10 13:28:06 +00:00
|
|
|
};
|
|
|
|
|
2012-03-29 13:46:53 +00:00
|
|
|
class WindowThumbnailItem : public AbstractThumbnailItem
|
2012-03-29 13:32:41 +00:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
Q_PROPERTY(qulonglong wId READ wId WRITE setWId NOTIFY wIdChanged SCRIPTABLE true)
|
2015-05-20 14:23:42 +00:00
|
|
|
Q_PROPERTY(KWin::AbstractClient *client READ client WRITE setClient NOTIFY clientChanged)
|
2012-03-29 13:32:41 +00:00
|
|
|
public:
|
2013-08-08 09:39:39 +00:00
|
|
|
explicit WindowThumbnailItem(QQuickItem *parent = 0);
|
2012-03-29 13:46:53 +00:00
|
|
|
virtual ~WindowThumbnailItem();
|
2012-03-29 13:32:41 +00:00
|
|
|
|
|
|
|
qulonglong wId() const {
|
|
|
|
return m_wId;
|
|
|
|
}
|
|
|
|
void setWId(qulonglong wId);
|
2015-05-20 14:23:42 +00:00
|
|
|
AbstractClient *client() const;
|
|
|
|
void setClient(AbstractClient *client);
|
2013-08-08 09:39:39 +00:00
|
|
|
virtual void paint(QPainter *painter);
|
2012-03-29 13:32:41 +00:00
|
|
|
Q_SIGNALS:
|
|
|
|
void wIdChanged(qulonglong wid);
|
|
|
|
void clientChanged();
|
2012-03-29 18:17:57 +00:00
|
|
|
protected Q_SLOTS:
|
|
|
|
virtual void repaint(KWin::EffectWindow* w);
|
2012-03-29 13:32:41 +00:00
|
|
|
private:
|
|
|
|
qulonglong m_wId;
|
2015-05-20 14:23:42 +00:00
|
|
|
AbstractClient *m_client;
|
2012-03-29 13:32:41 +00:00
|
|
|
};
|
|
|
|
|
2012-03-29 18:17:57 +00:00
|
|
|
class DesktopThumbnailItem : public AbstractThumbnailItem
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
Q_PROPERTY(int desktop READ desktop WRITE setDesktop NOTIFY desktopChanged)
|
|
|
|
public:
|
2013-08-08 09:39:39 +00:00
|
|
|
DesktopThumbnailItem(QQuickItem *parent = 0);
|
2012-03-29 18:17:57 +00:00
|
|
|
virtual ~DesktopThumbnailItem();
|
|
|
|
|
|
|
|
int desktop() const {
|
|
|
|
return m_desktop;
|
|
|
|
}
|
|
|
|
void setDesktop(int desktop);
|
2013-08-08 09:39:39 +00:00
|
|
|
virtual void paint(QPainter *painter);
|
2012-03-29 18:17:57 +00:00
|
|
|
Q_SIGNALS:
|
|
|
|
void desktopChanged(int desktop);
|
|
|
|
protected Q_SLOTS:
|
|
|
|
virtual void repaint(KWin::EffectWindow* w);
|
|
|
|
private:
|
|
|
|
int m_desktop;
|
|
|
|
};
|
|
|
|
|
2013-03-19 08:08:32 +00:00
|
|
|
inline
|
2012-03-29 13:32:41 +00:00
|
|
|
qreal AbstractThumbnailItem::brightness() const
|
2013-03-19 08:08:32 +00:00
|
|
|
{
|
|
|
|
return m_brightness;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline
|
2012-03-29 13:32:41 +00:00
|
|
|
qreal AbstractThumbnailItem::saturation() const
|
2013-03-19 08:08:32 +00:00
|
|
|
{
|
|
|
|
return m_saturation;
|
|
|
|
}
|
|
|
|
|
2013-08-08 09:39:39 +00:00
|
|
|
inline
|
|
|
|
QQuickItem* AbstractThumbnailItem::clipTo() const
|
|
|
|
{
|
|
|
|
return m_clipToItem.data();
|
|
|
|
}
|
|
|
|
|
2013-03-26 13:43:36 +00:00
|
|
|
inline
|
2015-05-20 14:23:42 +00:00
|
|
|
AbstractClient *WindowThumbnailItem::client() const
|
2013-03-26 13:43:36 +00:00
|
|
|
{
|
|
|
|
return m_client;
|
|
|
|
}
|
|
|
|
|
2011-11-10 13:28:06 +00:00
|
|
|
} // KWin
|
|
|
|
|
|
|
|
#endif // KWIN_THUMBNAILITEM_H
|