ExplorerModel.hpp
1 #pragma once
2 #include <score/plugins/ProjectSettings/ProjectSettingsModel.hpp>
3 #include <score/plugins/settingsdelegate/SettingsDelegateModel.hpp>
4 
5 #include <score_plugin_deviceexplorer_export.h>
6 
7 #include <verdigris>
8 namespace Explorer::Settings
9 {
11 {
12  QString logNothing{"Nothing"};
13  QString logUnfolded{"Unfolded"};
14  QString logEverything{"Everything"};
15  operator QStringList() const { return {logNothing, logUnfolded, logEverything}; }
16 };
17 
18 class SCORE_PLUGIN_DEVICEEXPLORER_EXPORT Model : public score::SettingsDelegateModel
19 {
20  W_OBJECT(Model)
21 
22  bool m_LocalTree = false;
23  QString m_LogLevel;
24 
25 public:
26  Model(QSettings& set, const score::ApplicationContext& ctx);
27 
28  SCORE_SETTINGS_PARAMETER_HPP(SCORE_PLUGIN_DEVICEEXPLORER_EXPORT, bool, LocalTree)
29  SCORE_SETTINGS_PARAMETER_HPP(SCORE_PLUGIN_DEVICEEXPLORER_EXPORT, QString, LogLevel)
30 };
31 
32 SCORE_SETTINGS_PARAMETER(Model, LogLevel)
33 SCORE_SETTINGS_DEFERRED_PARAMETER(Model, LocalTree)
34 }
35 
36 namespace Explorer::ProjectSettings
37 {
38 class Model;
39 }
40 
41 UUID_METADATA(
42  , score::DocumentPluginFactory, Explorer::ProjectSettings::Model,
43  "1f923578-08c3-49be-9ba9-69c144ee2e32")
44 
45 namespace Explorer::ProjectSettings
46 {
47 class SCORE_PLUGIN_DEVICEEXPLORER_EXPORT Model final : public score::ProjectSettingsModel
48 {
49  W_OBJECT(Model)
50  SCORE_SERIALIZE_FRIENDS
51  MODEL_METADATA_IMPL(Model)
52 
53  qreal m_MidiImportRatio = 1.;
54  bool m_RefreshOnStart = false;
55  bool m_ReconnectOnStart = false;
56 
57 public:
58  Model(const score::DocumentContext&, QObject* parent);
59  ~Model() override;
60 
61  template <typename Impl>
62  Model(const score::DocumentContext& ctx, Impl& vis, QObject* parent)
63  : score::ProjectSettingsModel{ctx, vis, parent}
64  {
65  vis.writeTo(*this);
66  }
67 
68  SCORE_SETTINGS_PARAMETER_HPP(
69  SCORE_PLUGIN_DEVICEEXPLORER_EXPORT, qreal, MidiImportRatio)
70  SCORE_SETTINGS_PARAMETER_HPP(SCORE_PLUGIN_DEVICEEXPLORER_EXPORT, bool, RefreshOnStart)
71  SCORE_SETTINGS_PARAMETER_HPP(
72  SCORE_PLUGIN_DEVICEEXPLORER_EXPORT, bool, ReconnectOnStart)
73 };
74 
75 SCORE_SETTINGS_PARAMETER(Model, MidiImportRatio)
76 SCORE_SETTINGS_PARAMETER(Model, RefreshOnStart)
77 SCORE_SETTINGS_PARAMETER(Model, ReconnectOnStart)
78 }
Definition: ExplorerModel.hpp:19
Reimplement to instantiate document plug-ins.
Definition: DocumentPluginCreator.hpp:25
Definition: ProjectSettingsModel.hpp:9
Definition: SettingsDelegateModel.hpp:16
Local tree provides a way to extend the tree given through the Engine::Network::LocalDevice.
Definition: BaseCallbackWrapper.hpp:9
Base toolkit upon which the software is built.
Definition: Application.cpp:90
Definition: ExplorerModel.hpp:11
Used to access all the application-wide state and structures.
Definition: ApplicationContext.hpp:24
Definition: DocumentContext.hpp:18