File indexing completed on 2024-04-28 05:27:40

0001 /*
0002     Work sponsored by the LiMux project of the city of Munich:
0003     SPDX-FileCopyrightText: 2018 Kai Uwe Broulik <kde@broulik.de>
0004 
0005     SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0006 */
0007 
0008 #pragma once
0009 
0010 #include <Plasma/Applet>
0011 
0012 #include <KScreen/Types>
0013 
0014 #include "../common/osdaction.h"
0015 
0016 class KScreenApplet : public Plasma::Applet
0017 {
0018     Q_OBJECT
0019 
0020     /**
0021      * The number of currently connected (not necessarily enabled) outputs
0022      */
0023     Q_PROPERTY(int connectedOutputCount READ connectedOutputCount NOTIFY connectedOutputCountChanged)
0024 
0025 public:
0026     explicit KScreenApplet(QObject *parent, const KPluginMetaData &data, const QVariantList &args);
0027     ~KScreenApplet() override;
0028 
0029     void init() override;
0030 
0031     int connectedOutputCount() const;
0032 
0033     Q_INVOKABLE void applyLayoutPreset(KScreen::OsdAction::Action action);
0034 
0035     Q_INVOKABLE QVariant availableActions();
0036 
0037 Q_SIGNALS:
0038     void connectedOutputCountChanged();
0039 
0040 private:
0041     void checkOutputs();
0042 
0043     KScreen::ConfigPtr m_screenConfiguration;
0044     int m_connectedOutputCount = 0;
0045 };