File indexing completed on 2024-11-10 04:56:50
0001 /* 0002 KWin - the KDE window manager 0003 This file is part of the KDE project. 0004 0005 SPDX-FileCopyrightText: 2009 Lucas Murray <lmurray@undefinedfire.com> 0006 SPDX-FileCopyrightText: 2020 Cyril Rossi <cyril.rossi@enioka.com> 0007 0008 SPDX-License-Identifier: GPL-2.0-or-later 0009 */ 0010 #pragma once 0011 0012 #include <QWidget> 0013 0014 #include "effect/globals.h" 0015 0016 namespace KWin 0017 { 0018 0019 class Monitor; 0020 0021 class KWinScreenEdge : public QWidget 0022 { 0023 Q_OBJECT 0024 0025 public: 0026 explicit KWinScreenEdge(QWidget *parent = nullptr); 0027 ~KWinScreenEdge() override; 0028 0029 void monitorHideEdge(ElectricBorder border, bool hidden); 0030 void monitorEnableEdge(ElectricBorder border, bool enabled); 0031 0032 void monitorAddItem(const QString &item); 0033 void monitorItemSetEnabled(int index, bool enabled); 0034 0035 QList<int> monitorCheckEffectHasEdge(int index) const; 0036 int selectedEdgeItem(ElectricBorder border) const; 0037 0038 void monitorChangeEdge(ElectricBorder border, int index); 0039 void monitorChangeEdge(const QList<int> &borderList, int index); 0040 0041 void monitorChangeDefaultEdge(ElectricBorder border, int index); 0042 void monitorChangeDefaultEdge(const QList<int> &borderList, int index); 0043 0044 // revert to reference settings and assess for saveNeeded and default changed 0045 virtual void reload(); 0046 // reset to default settings and assess for saveNeeded and default changed 0047 virtual void setDefaults(); 0048 0049 public Q_SLOTS: 0050 void onChanged(); 0051 void createConnection(); 0052 0053 Q_SIGNALS: 0054 void saveNeededChanged(bool isNeeded); 0055 void defaultChanged(bool isDefault); 0056 0057 private: 0058 virtual Monitor *monitor() const = 0; 0059 virtual bool isSaveNeeded() const; 0060 virtual bool isDefault() const; 0061 0062 // internal use, return Monitor::None if border equals ELECTRIC_COUNT or ElectricNone 0063 static int electricBorderToMonitorEdge(ElectricBorder border); 0064 static ElectricBorder monitorEdgeToElectricBorder(int edge); 0065 0066 private: 0067 QHash<ElectricBorder, int> m_reference; // reference settings 0068 QHash<ElectricBorder, int> m_default; // default settings 0069 }; 0070 0071 } // namespace