File indexing completed on 2024-04-28 16:45:10
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 enum Action { 0030 SwitchToExternal, 0031 SwitchToInternal, 0032 Clone, 0033 ExtendLeft, 0034 ExtendRight, 0035 }; 0036 Q_ENUM(Action) 0037 0038 void init() override; 0039 0040 int connectedOutputCount() const; 0041 0042 Q_INVOKABLE void applyLayoutPreset(KScreenApplet::Action action); 0043 0044 Q_INVOKABLE QVariant availableActions(); 0045 0046 Q_SIGNALS: 0047 void connectedOutputCountChanged(); 0048 0049 private: 0050 void checkOutputs(); 0051 0052 KScreen::ConfigPtr m_screenConfiguration; 0053 int m_connectedOutputCount = 0; 0054 };