File indexing completed on 2024-11-10 04:56:52
0001 /* 0002 KWin - the KDE window manager 0003 This file is part of the KDE project. 0004 0005 SPDX-FileCopyrightText: 2011, 2014 Martin Gräßlin <mgraesslin@kde.org> 0006 0007 SPDX-License-Identifier: GPL-2.0-or-later 0008 */ 0009 0010 #pragma once 0011 0012 #include <QImage> 0013 #include <QQuickItem> 0014 0015 namespace KWin 0016 { 0017 0018 class WindowThumbnailItem : public QQuickItem 0019 { 0020 Q_OBJECT 0021 Q_PROPERTY(qulonglong wId READ wId WRITE setWId NOTIFY wIdChanged SCRIPTABLE true) 0022 Q_PROPERTY(QSize sourceSize READ sourceSize WRITE setSourceSize NOTIFY sourceSizeChanged) 0023 public: 0024 explicit WindowThumbnailItem(QQuickItem *parent = nullptr); 0025 ~WindowThumbnailItem() override; 0026 0027 qulonglong wId() const 0028 { 0029 return m_wId; 0030 } 0031 QSize sourceSize() const; 0032 void setWId(qulonglong wId); 0033 void setSourceSize(const QSize &size); 0034 QSGNode *updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *updatePaintNodeData) override; 0035 0036 enum Thumbnail { 0037 Konqueror = 1, 0038 KMail, 0039 Systemsettings, 0040 Dolphin, 0041 Desktop, 0042 }; 0043 Q_SIGNALS: 0044 void wIdChanged(qulonglong wid); 0045 void sourceSizeChanged(); 0046 0047 private: 0048 void findImage(); 0049 qulonglong m_wId; 0050 QImage m_image; 0051 QSize m_sourceSize; 0052 }; 0053 0054 } // KWin