Loading...
Searching...
No Matches
LibrarySettings.hpp
1#pragma once
2
3#include <Process/TimeValue.hpp>
4
5#include <score/plugins/settingsdelegate/SettingsDelegateFactory.hpp>
6#include <score/plugins/settingsdelegate/SettingsDelegateModel.hpp>
7#include <score/plugins/settingsdelegate/SettingsDelegatePresenter.hpp>
8#include <score/plugins/settingsdelegate/SettingsDelegateView.hpp>
9#include <score/widgets/SpinBoxes.hpp>
10
11#include <score_plugin_library_export.h>
12
13#include <verdigris>
14
15#define SETTINGS_UI_PATH_HPP(Control) \
16public: \
17 void set##Control(QString); \
18 void Control##Changed(QString arg) W_SIGNAL(Control##Changed, arg); \
19 \
20private: \
21 QLineEdit* m_##Control{};
22
23#define SETTINGS_UI_PATH_SETUP(Text, Control) \
24 m_##Control = new QLineEdit{m_widg}; \
25 lay->addRow(tr(Text), m_##Control); \
26 connect(m_##Control, &QLineEdit::editingFinished, this, [this] { \
27 Control##Changed(m_##Control->text()); \
28 });
29
30#define SETTINGS_UI_PATH_IMPL(Control) \
31 void View::set##Control(QString val) \
32 { \
33 auto cur = m_##Control->text(); \
34 if(cur != val) \
35 m_##Control->setText(val); \
36 }
37
38namespace score
39{
40class FormWidget;
41}
42class QCheckBox;
43namespace Library::Settings
44{
45class SCORE_PLUGIN_LIBRARY_EXPORT Model final : public score::SettingsDelegateModel
46{
47 W_OBJECT(Model)
48 QString m_RootPath;
49
50public:
51 Model(QSettings& set, const score::ApplicationContext& ctx);
52
53 QString getPackagesPath() const noexcept;
54 QString getDefaultLibraryPath() const noexcept;
55 QString getUserLibraryPath() const noexcept;
56 QString getUserPresetsPath() const noexcept;
57 QString getSDKPath() const noexcept;
58
59 void rescanLibrary() E_SIGNAL(SCORE_PLUGIN_LIBRARY_EXPORT, rescanLibrary)
60
61 // List of include paths for the various script languages in score
62 QStringList getIncludePaths() const noexcept;
63
64 SCORE_SETTINGS_PARAMETER_HPP(SCORE_PLUGIN_LIBRARY_EXPORT, QString, RootPath)
65private:
66};
67
68SCORE_SETTINGS_PARAMETER(Model, RootPath)
69
70class View : public score::GlobalSettingsView
71{
72 W_OBJECT(View)
73public:
74 View();
75
76 SETTINGS_UI_PATH_HPP(RootPath)
77
78private:
79 QWidget* getWidget() override;
80 score::FormWidget* m_widg{};
81};
82
84{
85public:
86 using model_type = Model;
87 using view_type = View;
88 Presenter(Model&, View&, QObject* parent);
89
90private:
91 QString settingsName() override;
92 QIcon settingsIcon() override;
93};
94
95SCORE_DECLARE_SETTINGS_FACTORY(
96 Factory, Model, Presenter, View, "d6966670-f69f-48d0-96f6-72a5e2190cbc")
97}
Definition LibrarySettings.hpp:46
Definition LibrarySettings.hpp:84
Definition LibrarySettings.hpp:71
Definition FormWidget.hpp:11
Definition SettingsDelegateModel.hpp:16
Definition SettingsDelegatePresenter.hpp:17
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