File indexing completed on 2024-04-28 15:51:43
0001 /* 0002 SPDX-FileCopyrightText: 2006, 2008 Pino Toscano <pino@kde.org> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #ifndef _DLGPRESENTATION_H 0008 #define _DLGPRESENTATION_H 0009 0010 #include <QComboBox> 0011 #include <QWidget> 0012 0013 class DlgPresentation : public QWidget 0014 { 0015 Q_OBJECT 0016 0017 public: 0018 explicit DlgPresentation(QWidget *parent = nullptr); 0019 }; 0020 0021 /** 0022 * We need this because there are some special screens, 0023 * which are not represented by the typical currentIndex(), 0024 * which would be used by KConfigWidgets. 0025 * 0026 * Additionally this class allows to remember a disconnected screen. 0027 */ 0028 class PreferredScreenSelector : public QComboBox 0029 { 0030 Q_OBJECT 0031 0032 Q_PROPERTY(int preferredScreen READ preferredScreen WRITE setPreferredScreen NOTIFY preferredScreenChanged) 0033 0034 public: 0035 explicit PreferredScreenSelector(QWidget *parent); 0036 int preferredScreen() const; 0037 0038 Q_SIGNALS: 0039 void preferredScreenChanged(int screen); 0040 0041 public Q_SLOTS: 0042 void setPreferredScreen(int newScreen); 0043 0044 protected: 0045 // These two variables protect the screen setting from changing 0046 // when the configured screen is currently disconnected. 0047 0048 /** 0049 * When setScreen() is called with a disconnected screen, 0050 * a “disconnected” entry is created at this index: 0051 */ 0052 int m_disconnectedScreenIndex; 0053 0054 /** 0055 * Which screen is referred by @c m_disconnectedScreenIndex. 0056 * Until @c m_disconnectedScreenIndex entry is created, this is @c k_noDisconnectedScreenNumber. 0057 */ 0058 int m_disconnectedScreenNumber; 0059 0060 protected Q_SLOTS: 0061 /** 0062 * Populates the combobox list with items for the special screens, 0063 * and for every connected screen. 0064 * If @c m_disconnectedScreenNumber is set, adds an item for this disconnected screen. 0065 */ 0066 void repopulateList(); 0067 }; 0068 0069 /** “Current” and “Default” */ 0070 const int k_specialScreenCount = 2; 0071 /** Default value of m_disconnectedScreenNumber when no disconnected screen is remembered */ 0072 const int k_noDisconnectedScreenNumber = -3; 0073 0074 #endif