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
50 Settings(const Settings&) = delete;
51 Settings(Settings&&) = delete;
52 Settings& operator=(const Settings&) = delete;
53 Settings& operator=(Settings&&) = delete;
54
55 void setupSettingsPlugin(
56 QSettings& s, const score::ApplicationContext& ctx,
58 SettingsView<SettingsDelegateModel>& view() const { return *m_settingsView; }
59
60 auto& settings() const { return m_settings; }
61
62private:
64 SettingsPresenter<SettingsDelegateModel>* m_settingsPresenter{};
65
66 std::vector<std::unique_ptr<SettingsDelegateModel>> m_settings;
67};
68
69class SCORE_LIB_BASE_EXPORT ProjectSettings final
70{
71public:
74
75 void setupView();
76
77 ProjectSettings(const ProjectSettings&) = delete;
79 ProjectSettings& operator=(const ProjectSettings&) = delete;
80 ProjectSettings& operator=(ProjectSettings&&) = delete;
81
82 SettingsView<ProjectSettingsModel>& view() const { return *m_settingsView; }
83
84 auto& settings() const { return m_settings; }
85
86 void setup(const score::DocumentContext& ctx);
87
88private:
89 SettingsView<ProjectSettingsModel>* m_settingsView{};
90 SettingsPresenter<ProjectSettingsModel>* m_settingsPresenter{};
91
92 std::vector<ProjectSettingsModel*> m_settings;
93};
94}
Definition lib/core/settings/Settings.hpp:70
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:90
Used to access all the application-wide state and structures.
Definition ApplicationContext.hpp:24
Definition DocumentContext.hpp:18