Loading...
Searching...
No Matches
lib/core/settings/Settings.hpp
1#pragma once
2#include <QSettings>
3
4#include <score_lib_base_export.h>
5
6#include <memory>
7namespace score
8{
9class SettingsDelegateFactory;
10class SettingsDelegateModel;
11class SettingsModel;
12template <class Model>
13class SettingsPresenter;
14template <class Model>
15class SettingsView;
16class ProjectSettingsModel;
17
18struct DocumentContext;
19struct ApplicationContext;
20} // namespace score
21
22namespace score
23{
41class SCORE_LIB_BASE_EXPORT Settings final
42{
43public:
44 Settings();
45 ~Settings();
46
47 void setupView();
48 void teardownView();
49
55 void teardownModels() noexcept;
56
57 Settings(const Settings&) = delete;
58 Settings(Settings&&) = delete;
59 Settings& operator=(const Settings&) = delete;
60 Settings& operator=(Settings&&) = delete;
61
62 void setupSettingsPlugin(
63 QSettings& s, const score::ApplicationContext& ctx,
65 SettingsView<SettingsDelegateModel>& view() const { return *m_settingsView; }
66
67 auto& settings() const { return m_settings; }
68
69private:
71 SettingsPresenter<SettingsDelegateModel>* m_settingsPresenter{};
72
73 std::vector<std::unique_ptr<SettingsDelegateModel>> m_settings;
74};
75
76class SCORE_LIB_BASE_EXPORT ProjectSettings final
77{
78public:
81
82 void setupView();
83
84 ProjectSettings(const ProjectSettings&) = delete;
86 ProjectSettings& operator=(const ProjectSettings&) = delete;
87 ProjectSettings& operator=(ProjectSettings&&) = delete;
88
89 SettingsView<ProjectSettingsModel>& view() const { return *m_settingsView; }
90
91 auto& settings() const { return m_settings; }
92
93 void setup(const score::DocumentContext& ctx);
94
95private:
96 SettingsView<ProjectSettingsModel>* m_settingsView{};
97 SettingsPresenter<ProjectSettingsModel>* m_settingsPresenter{};
98
99 std::vector<ProjectSettingsModel*> m_settings;
100};
101}
Definition lib/core/settings/Settings.hpp:77
The SettingsDelegateFactory class.
Definition SettingsDelegateFactory.hpp:23
Application-wide user settings registering and handling.
Definition lib/core/settings/Settings.hpp:42
Definition SettingsPresenter.hpp:24
Definition SettingsView.hpp:21
Base toolkit upon which the software is built.
Definition Application.cpp:113
Used to access all the application-wide state and structures.
Definition ApplicationContext.hpp:25
Definition DocumentContext.hpp:18