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
69 bool hasView() const noexcept { return m_settingsView != nullptr; }
70
71 auto& settings() const { return m_settings; }
72
73private:
74 SettingsView<SettingsDelegateModel>* m_settingsView{};
75 SettingsPresenter<SettingsDelegateModel>* m_settingsPresenter{};
76
77 std::vector<std::unique_ptr<SettingsDelegateModel>> m_settings;
78};
79
80class SCORE_LIB_BASE_EXPORT ProjectSettings final
81{
82public:
85
86 void setupView();
87
88 ProjectSettings(const ProjectSettings&) = delete;
90 ProjectSettings& operator=(const ProjectSettings&) = delete;
91 ProjectSettings& operator=(ProjectSettings&&) = delete;
92
93 SettingsView<ProjectSettingsModel>& view() const { return *m_settingsView; }
94
95 auto& settings() const { return m_settings; }
96
97 void setup(const score::DocumentContext& ctx);
98
99private:
100 SettingsView<ProjectSettingsModel>* m_settingsView{};
101 SettingsPresenter<ProjectSettingsModel>* m_settingsPresenter{};
102
103 std::vector<ProjectSettingsModel*> m_settings;
104};
105}
Definition lib/core/settings/Settings.hpp:81
The SettingsDelegateFactory class.
Definition SettingsDelegateFactory.hpp:23
Application-wide user settings registering and handling.
Definition lib/core/settings/Settings.hpp:42
bool hasView() const noexcept
Definition lib/core/settings/Settings.hpp:69
Definition SettingsPresenter.hpp:24
Definition SettingsView.hpp:21
Base toolkit upon which the software is built.
Definition Application.cpp:117
Used to access all the application-wide state and structures.
Definition ApplicationContext.hpp:25
Definition DocumentContext.hpp:18