Line data Source code
1 : /*
2 : * SPDX-License-Identifier: GPL-3.0-only
3 : * MuseScore-Studio-CLA-applies
4 : *
5 : * MuseScore Studio
6 : * Music Composition & Notation
7 : *
8 : * Copyright (C) 2021 MuseScore Limited and others
9 : *
10 : * This program is free software: you can redistribute it and/or modify
11 : * it under the terms of the GNU General Public License version 3 as
12 : * published by the Free Software Foundation.
13 : *
14 : * This program is distributed in the hope that it will be useful,
15 : * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 : * GNU General Public License for more details.
18 : *
19 : * You should have received a copy of the GNU General Public License
20 : * along with this program. If not, see <https://www.gnu.org/licenses/>.
21 : */
22 : #include "meiconfiguration.h"
23 :
24 : #include "settings.h"
25 :
26 : using namespace mu;
27 : using namespace mu::iex::mei;
28 : using namespace muse;
29 :
30 : static const std::string module_name("iex_mei");
31 :
32 : static const Settings::Key MEI_IMPORT_LAYOUT_KEY(module_name, "import/mei/importMeiLayout");
33 : static const Settings::Key MEI_EXPORT_LAYOUT_KEY(module_name, "export/mei/exportMeiLayout");
34 : static const Settings::Key MEI_USE_MUSESCORE_IDS_KEY(module_name, "export/mei/useMuseScoreIds");
35 :
36 1 : void MeiConfiguration::init()
37 : {
38 1 : settings()->setDefaultValue(MEI_IMPORT_LAYOUT_KEY, Val(true));
39 1 : settings()->valueChanged(MEI_IMPORT_LAYOUT_KEY).onReceive(this, [this](const Val& val) {
40 0 : m_meiImportLayoutChanged.send(val.toBool());
41 0 : });
42 :
43 1 : settings()->setDefaultValue(MEI_EXPORT_LAYOUT_KEY, Val(true));
44 1 : settings()->setDefaultValue(MEI_USE_MUSESCORE_IDS_KEY, Val(false));
45 1 : }
46 :
47 0 : bool MeiConfiguration::meiImportLayout() const
48 : {
49 0 : return settings()->value(MEI_IMPORT_LAYOUT_KEY).toBool();
50 : }
51 :
52 0 : void MeiConfiguration::setMeiImportLayout(bool value)
53 : {
54 0 : settings()->setSharedValue(MEI_IMPORT_LAYOUT_KEY, Val(value));
55 0 : }
56 :
57 0 : async::Channel<bool> MeiConfiguration::meiImportLayoutChanged() const
58 : {
59 0 : return m_meiImportLayoutChanged;
60 : }
61 :
62 64 : bool MeiConfiguration::meiExportLayout() const
63 : {
64 64 : return settings()->value(MEI_EXPORT_LAYOUT_KEY).toBool();
65 : }
66 :
67 64 : void MeiConfiguration::setMeiExportLayout(bool value)
68 : {
69 64 : settings()->setSharedValue(MEI_EXPORT_LAYOUT_KEY, Val(value));
70 64 : }
71 :
72 3609 : bool MeiConfiguration::meiUseMuseScoreIds() const
73 : {
74 3609 : return settings()->value(MEI_USE_MUSESCORE_IDS_KEY).toBool();
75 : }
76 :
77 0 : void MeiConfiguration::setMeiUseMuseScoreIds(bool value)
78 : {
79 0 : settings()->setSharedValue(MEI_USE_MUSESCORE_IDS_KEY, Val(value));
80 0 : }
|