Changeset View
Changeset View
Standalone View
Standalone View
common/control.h
Show All 24 Lines | |||||
25 | { | 25 | { | ||
26 | public: | 26 | public: | ||
27 | enum class OutputRetention { | 27 | enum class OutputRetention { | ||
28 | Undefined = -1, | 28 | Undefined = -1, | ||
29 | Global = 0, | 29 | Global = 0, | ||
30 | Individual = 1, | 30 | Individual = 1, | ||
31 | }; | 31 | }; | ||
32 | 32 | | |||
33 | static QMap<QString, OutputRetention> readInOutputRetentionValues(const QString &configId); | 33 | virtual ~Control() = default; | ||
34 | | ||||
34 | static OutputRetention getOutputRetention(const QString &outputId, const QMap<QString, OutputRetention> &retentions); | 35 | static OutputRetention getOutputRetention(const QString &outputId, const QMap<QString, OutputRetention> &retentions); | ||
35 | 36 | | |||
36 | static QString configFilePath(const QString &hash); | 37 | virtual QString filePath() = 0; | ||
37 | static QString outputFilePath(const QString &hash); | | |||
38 | 38 | | |||
39 | private: | 39 | protected: | ||
40 | static QString dirPath(); | 40 | static QString dirPath(); | ||
41 | static OutputRetention convertVariantToOutputRetention(QVariant variant); | 41 | static OutputRetention convertVariantToOutputRetention(QVariant variant); | ||
42 | 42 | | |||
43 | private: | ||||
43 | static QString s_dirName; | 44 | static QString s_dirName; | ||
44 | }; | 45 | }; | ||
45 | 46 | | |||
47 | class ControlConfig : public Control | ||||
48 | { | ||||
49 | public: | ||||
50 | ControlConfig(KScreen::ConfigPtr config); | ||||
51 | | ||||
52 | QMap<QString, OutputRetention> readInOutputRetentionValues(); | ||||
53 | | ||||
54 | QString filePath() override; | ||||
55 | static QString filePath(const QString &hash); | ||||
56 | | ||||
57 | private: | ||||
58 | KScreen::ConfigPtr m_config; | ||||
59 | }; | ||||
60 | | ||||
61 | class ControlOutput : public Control | ||||
62 | { | ||||
63 | public: | ||||
64 | ControlOutput(KScreen::OutputPtr output); | ||||
65 | | ||||
66 | // TODO: scale auto value | ||||
67 | | ||||
68 | QString filePath() override; | ||||
69 | static QString filePath(const QString &hash); | ||||
70 | | ||||
71 | private: | ||||
72 | KScreen::OutputPtr m_output; | ||||
73 | }; | ||||
74 | | ||||
46 | #endif | 75 | #endif |