Changeset View
Changeset View
Standalone View
Standalone View
common/control.h
Show All 32 Lines | 28 | public: | |||
---|---|---|---|---|---|
33 | }; | 33 | }; | ||
34 | Q_ENUM(OutputRetention) | 34 | Q_ENUM(OutputRetention) | ||
35 | 35 | | |||
36 | explicit Control(QObject *parent = nullptr); | 36 | explicit Control(QObject *parent = nullptr); | ||
37 | 37 | | |||
38 | 38 | | |||
39 | ~Control() override = default; | 39 | ~Control() override = default; | ||
40 | 40 | | |||
41 | bool writeFile(); | ||||
42 | | ||||
41 | protected: | 43 | protected: | ||
42 | virtual QString dirPath() const; | 44 | virtual QString dirPath() const; | ||
43 | virtual QString filePath() const = 0; | 45 | virtual QString filePath() const = 0; | ||
44 | QString filePathFromHash(const QString &hash) const; | 46 | QString filePathFromHash(const QString &hash) const; | ||
47 | void readFile(); | ||||
48 | QVariantMap& info(); | ||||
49 | const QVariantMap& constInfo() const; | ||||
45 | 50 | | |||
46 | static OutputRetention convertVariantToOutputRetention(QVariant variant); | 51 | static OutputRetention convertVariantToOutputRetention(QVariant variant); | ||
47 | 52 | | |||
48 | private: | 53 | private: | ||
49 | static QString s_dirName; | 54 | static QString s_dirName; | ||
55 | QVariantMap m_info; | ||||
50 | }; | 56 | }; | ||
51 | 57 | | |||
52 | class ControlConfig : public Control | 58 | class ControlConfig : public Control | ||
53 | { | 59 | { | ||
54 | Q_OBJECT | 60 | Q_OBJECT | ||
55 | public: | 61 | public: | ||
56 | explicit ControlConfig(KScreen::ConfigPtr config, QObject *parent = nullptr); | 62 | explicit ControlConfig(KScreen::ConfigPtr config, QObject *parent = nullptr); | ||
57 | 63 | | |||
58 | OutputRetention getOutputRetention(const KScreen::OutputPtr &output) const; | 64 | OutputRetention getOutputRetention(const KScreen::OutputPtr &output) const; | ||
59 | OutputRetention getOutputRetention(const QString &outputId, const QString &outputName) const; | 65 | OutputRetention getOutputRetention(const QString &outputId, const QString &outputName) const; | ||
60 | void setOutputRetention(const KScreen::OutputPtr &output, OutputRetention value); | 66 | void setOutputRetention(const KScreen::OutputPtr &output, OutputRetention value); | ||
61 | void setOutputRetention(const QString &outputId, const QString &outputName, OutputRetention value); | 67 | void setOutputRetention(const QString &outputId, const QString &outputName, OutputRetention value); | ||
62 | 68 | | |||
63 | bool writeFile(); | | |||
64 | | ||||
65 | QString dirPath() const override; | 69 | QString dirPath() const override; | ||
66 | QString filePath() const override; | 70 | QString filePath() const override; | ||
67 | 71 | | |||
68 | private: | 72 | private: | ||
69 | QVariantList getOutputs() const; | 73 | QVariantList getOutputs() const; | ||
70 | void setOutputs(QVariantList outputsInfo); | 74 | void setOutputs(QVariantList outputsInfo); | ||
71 | bool infoIsOutput(const QVariantMap &info, const QString &outputId, const QString &outputName) const; | 75 | bool infoIsOutput(const QVariantMap &info, const QString &outputId, const QString &outputName) const; | ||
72 | 76 | | |||
73 | KScreen::ConfigPtr m_config; | 77 | KScreen::ConfigPtr m_config; | ||
74 | QVariantMap m_info; | | |||
75 | QStringList m_duplicateOutputIds; | 78 | QStringList m_duplicateOutputIds; | ||
76 | }; | 79 | }; | ||
77 | 80 | | |||
78 | class ControlOutput : public Control | 81 | class ControlOutput : public Control | ||
79 | { | 82 | { | ||
80 | Q_OBJECT | 83 | Q_OBJECT | ||
81 | public: | 84 | public: | ||
82 | explicit ControlOutput(KScreen::OutputPtr output, QObject *parent = nullptr); | 85 | explicit ControlOutput(KScreen::OutputPtr output, QObject *parent = nullptr); | ||
Show All 11 Lines |