Changeset View
Changeset View
Standalone View
Standalone View
common/control.h
Show All 13 Lines | |||||
14 | You should have received a copy of the GNU General Public License | 14 | You should have received a copy of the GNU General Public License | ||
15 | along with this program. If not, see <http://www.gnu.org/licenses/>. | 15 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
16 | *********************************************************************/ | 16 | *********************************************************************/ | ||
17 | #ifndef COMMON_CONTROL_H | 17 | #ifndef COMMON_CONTROL_H | ||
18 | #define COMMON_CONTROL_H | 18 | #define COMMON_CONTROL_H | ||
19 | 19 | | |||
20 | #include <kscreen/types.h> | 20 | #include <kscreen/types.h> | ||
21 | 21 | | |||
22 | #include <QObject> | ||||
22 | #include <QVariantMap> | 23 | #include <QVariantMap> | ||
23 | 24 | | |||
24 | class Control | 25 | class Control | ||
25 | { | 26 | { | ||
27 | Q_GADGET | ||||
26 | public: | 28 | public: | ||
27 | enum class OutputRetention { | 29 | enum class OutputRetention { | ||
28 | Undefined = -1, | 30 | Undefined = -1, | ||
29 | Global = 0, | 31 | Global = 0, | ||
30 | Individual = 1, | 32 | Individual = 1, | ||
31 | }; | 33 | }; | ||
34 | Q_ENUM(OutputRetention) | ||||
35 | | ||||
32 | 36 | | |||
33 | virtual ~Control() = default; | 37 | virtual ~Control() = default; | ||
34 | 38 | | |||
35 | virtual QString filePath() = 0; | 39 | virtual QString filePath() = 0; | ||
36 | 40 | | |||
37 | protected: | 41 | protected: | ||
38 | static QString dirPath(); | 42 | static QString dirPath(); | ||
39 | static OutputRetention convertVariantToOutputRetention(QVariant variant); | 43 | static OutputRetention convertVariantToOutputRetention(QVariant variant); | ||
40 | 44 | | |||
41 | private: | 45 | private: | ||
42 | static QString s_dirName; | 46 | static QString s_dirName; | ||
43 | }; | 47 | }; | ||
44 | 48 | | |||
45 | class ControlConfig : public Control | 49 | class ControlConfig : public Control | ||
46 | { | 50 | { | ||
51 | Q_GADGET | ||||
47 | public: | 52 | public: | ||
48 | ControlConfig(KScreen::ConfigPtr config); | 53 | ControlConfig(KScreen::ConfigPtr config); | ||
49 | 54 | | |||
50 | OutputRetention getOutputRetention(const KScreen::OutputPtr &output) const; | 55 | OutputRetention getOutputRetention(const KScreen::OutputPtr &output) const; | ||
51 | OutputRetention getOutputRetention(const QString &outputId, const QString &outputName) const; | 56 | OutputRetention getOutputRetention(const QString &outputId, const QString &outputName) const; | ||
52 | void setOutputRetention(const KScreen::OutputPtr &output, OutputRetention value); | 57 | void setOutputRetention(const KScreen::OutputPtr &output, OutputRetention value); | ||
53 | void setOutputRetention(const QString &outputId, const QString &outputName, OutputRetention value); | 58 | void setOutputRetention(const QString &outputId, const QString &outputName, OutputRetention value); | ||
54 | 59 | | |||
Show All 9 Lines | 65 | private: | |||
64 | 69 | | |||
65 | KScreen::ConfigPtr m_config; | 70 | KScreen::ConfigPtr m_config; | ||
66 | QVariantMap m_info; | 71 | QVariantMap m_info; | ||
67 | QStringList m_duplicateOutputIds; | 72 | QStringList m_duplicateOutputIds; | ||
68 | }; | 73 | }; | ||
69 | 74 | | |||
70 | class ControlOutput : public Control | 75 | class ControlOutput : public Control | ||
71 | { | 76 | { | ||
77 | Q_GADGET | ||||
72 | public: | 78 | public: | ||
73 | ControlOutput(KScreen::OutputPtr output); | 79 | ControlOutput(KScreen::OutputPtr output); | ||
74 | 80 | | |||
75 | // TODO: scale auto value | 81 | // TODO: scale auto value | ||
76 | 82 | | |||
77 | QString filePath() override; | 83 | QString filePath() override; | ||
78 | static QString filePath(const QString &hash); | 84 | static QString filePath(const QString &hash); | ||
79 | 85 | | |||
80 | private: | 86 | private: | ||
81 | KScreen::OutputPtr m_output; | 87 | KScreen::OutputPtr m_output; | ||
82 | }; | 88 | }; | ||
83 | 89 | | |||
84 | #endif | 90 | #endif |