File indexing completed on 2024-05-19 05:32:22

0001 /*
0002     SPDX-FileCopyrightText: 2021 Vlad Zahorodnii <vlad.zahorodnii@kde.org>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include "windowthumbnailitem.h"
0010 
0011 namespace KWin
0012 {
0013 
0014 class Output;
0015 class VirtualDesktop;
0016 
0017 /**
0018  * The DesktopBackgroundItem type is a convenience helper that represents the desktop
0019  * background on the specified screen, virtual desktop, and activity.
0020  */
0021 class DesktopBackgroundItem : public WindowThumbnailItem
0022 {
0023     Q_OBJECT
0024     Q_PROPERTY(QString outputName READ outputName WRITE setOutputName NOTIFY outputChanged)
0025     Q_PROPERTY(KWin::Output *output READ output WRITE setOutput NOTIFY outputChanged)
0026     Q_PROPERTY(QString activity READ activity WRITE setActivity NOTIFY activityChanged)
0027     Q_PROPERTY(KWin::VirtualDesktop *desktop READ desktop WRITE setDesktop NOTIFY desktopChanged)
0028 
0029 public:
0030     explicit DesktopBackgroundItem(QQuickItem *parent = nullptr);
0031 
0032     void componentComplete() override;
0033 
0034     QString outputName() const;
0035     void setOutputName(const QString &name);
0036 
0037     Output *output() const;
0038     void setOutput(Output *output);
0039 
0040     VirtualDesktop *desktop() const;
0041     void setDesktop(VirtualDesktop *desktop);
0042 
0043     QString activity() const;
0044     void setActivity(const QString &activity);
0045 
0046 Q_SIGNALS:
0047     void outputChanged();
0048     void desktopChanged();
0049     void activityChanged();
0050 
0051 private:
0052     void updateWindow();
0053 
0054     Output *m_output = nullptr;
0055     VirtualDesktop *m_desktop = nullptr;
0056     QString m_activity;
0057 };
0058 
0059 } // namespace KWin