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 :
23 : #include "brailleconfiguration.h"
24 :
25 : #include "settings.h"
26 :
27 : using namespace mu::braille;
28 : using namespace muse;
29 :
30 : namespace mu::engraving {
31 : static const std::string module_name("braille");
32 :
33 : static const Settings::Key BRAILLE_STATUS(module_name, "score/braille/status");
34 : static const Settings::Key BRAILLE_TABLE(module_name, "score/braille/table");
35 : static const Settings::Key BRAILLE_INTERVAL_DIRECTION(module_name, "score/braille/intervalDirection");
36 :
37 0 : void BrailleConfiguration::init()
38 : {
39 0 : settings()->setDefaultValue(BRAILLE_STATUS, Val(false));
40 0 : settings()->valueChanged(BRAILLE_STATUS).onReceive(this, [this](const Val&) {
41 0 : m_braillePanelEnabledChanged.notify();
42 0 : });
43 0 : settings()->setDefaultValue(BRAILLE_TABLE, Val("Unified English uncontracted braille [en-ueb-g1.ctb]"));
44 0 : settings()->valueChanged(BRAILLE_TABLE).onReceive(this, [this](const Val&) {
45 0 : m_brailleTableChanged.notify();
46 0 : });
47 0 : settings()->setDefaultValue(BRAILLE_INTERVAL_DIRECTION, Val(BrailleIntervalDirection::Auto));
48 0 : settings()->valueChanged(BRAILLE_INTERVAL_DIRECTION).onReceive(this, [this](const Val&) {
49 0 : m_intervalDirectionChanged.notify();
50 0 : });
51 0 : }
52 :
53 0 : muse::async::Notification BrailleConfiguration::braillePanelEnabledChanged() const
54 : {
55 0 : return m_braillePanelEnabledChanged;
56 : }
57 :
58 0 : bool BrailleConfiguration::braillePanelEnabled() const
59 : {
60 0 : return settings()->value(BRAILLE_STATUS).toBool();
61 : }
62 :
63 0 : void BrailleConfiguration::setBraillePanelEnabled(const bool enabled)
64 : {
65 0 : settings()->setSharedValue(BRAILLE_STATUS, Val(enabled));
66 0 : }
67 :
68 0 : muse::async::Notification BrailleConfiguration::intervalDirectionChanged() const
69 : {
70 0 : return m_intervalDirectionChanged;
71 : }
72 :
73 0 : BrailleIntervalDirection BrailleConfiguration::intervalDirection() const
74 : {
75 0 : return settings()->value(BRAILLE_INTERVAL_DIRECTION).toEnum<BrailleIntervalDirection>();
76 : }
77 :
78 0 : void BrailleConfiguration::setIntervalDirection(const BrailleIntervalDirection direction)
79 : {
80 0 : settings()->setSharedValue(BRAILLE_INTERVAL_DIRECTION, Val(direction));
81 0 : }
82 :
83 0 : muse::async::Notification BrailleConfiguration::brailleTableChanged() const
84 : {
85 0 : return m_brailleTableChanged;
86 : }
87 :
88 0 : QString BrailleConfiguration::brailleTable() const
89 : {
90 0 : return settings()->value(BRAILLE_TABLE).toQString();
91 : }
92 :
93 0 : void BrailleConfiguration::setBrailleTable(const QString& table)
94 : {
95 0 : settings()->setSharedValue(BRAILLE_TABLE, Val(table));
96 0 : }
97 :
98 0 : QStringList BrailleConfiguration::brailleTableList() const
99 : {
100 : return {
101 : "Afrikaans uncontracted braille [afr-za-g1.ctb]",
102 : "Afrikaans contracted braille [afr-za-g2.ctb]",
103 : "Arabic uncontracted braille [ar.tbl]",
104 : "Arabic contracted braille [ar-ar-g2.ctb]",
105 : "Arabic computer braille [ar-ar-comp8.utb]",
106 : "Assamese braille [as.tbl]",
107 : "Awadhi braille [awa.tbl]",
108 : "Bashkir braille [ba.utb]",
109 : "Belarusian braille [bel.utb]",
110 : "Belarusian computer braille [bel-comp.utb]",
111 : "Bulgarian computer braille [bg.tbl]",
112 : "Bulgarian braille [bg.utb]",
113 : "Bihari braille [bh.tbl]",
114 : "Bengali braille [bn.tbl]",
115 : "Tibetan computer braille [bo.tbl]",
116 : "Braj braille [bra.tbl]",
117 : "Catalan braille [ca.tbl]",
118 : "Cherokee braille [chr-us-g1.ctb]",
119 : "Coptic computer braille [cop-eg-comp8.utb]",
120 : "Kurdish braille [ckb.tbl]",
121 : "Czech braille [cs.tbl]",
122 : "Czech computer braille [cs-comp8.utb]",
123 : "Welsh uncontracted braille [cy-cy-g1.utb]",
124 : "Welsh contracted braille [cy.tbl]",
125 : "Danish computer braille (1993 standard) [da-dk-g08_1993.ctb]",
126 : "Danish 6-dot uncontracted braille (1993 standard) [da-dk-g16-lit_1993.ctb]",
127 : "Danish 6-dot uncontracted braille (1993 standard) [da-dk-g16_1993.ctb]",
128 : "Danish 8-dot uncontracted braille (1993 standard) [da-dk-g18_1993.ctb]",
129 : "Danish 6-dot contracted braille (1993 standard) [da-dk-g26-lit_1993.ctb]",
130 : "Danish 6-dot contracted braille (1993 standard) [da-dk-g26_1993.ctb]",
131 : "Danish 6-dot partially contracted braille (1993 standard) [da-dk-g26l-lit_1993.ctb]",
132 : "Danish 6-dot partially contracted braille (1993 standard) [da-dk-g26l_1993.ctb]",
133 : "Danish 8-dot contracted braille (1993 standard) [da-dk-g28_1993.ctb]",
134 : "Danish 8-dot partially contracted braille (1993 standard) [da-dk-g28l_1993.ctb]",
135 : "Danish computer braille (2022 standard) [da-dk-g08.ctb]",
136 : "Danish 6-dot uncontracted braille (2022 standard) [da-dk-g16.ctb]",
137 : "Danish 8-dot uncontracted braille (2022 standard) [da-dk-g18.ctb]",
138 : "Danish 6-dot contracted braille (2022 standard) [da-dk-g26.ctb]",
139 : "Danish 8-dot contracted braille (2022 standard) [da-dk-g28.ctb]",
140 : "German 8-dot computer braille [de-de-comp8.ctb]",
141 : "German 6-dot computer braille [de-comp6.utb]",
142 : "German uncontracted braille [de-g0.utb]",
143 : "German uncontracted braille with indication of capitals [de-g0-detailed.utb]",
144 : "German partially contracted braille [de-g1.ctb]",
145 : "German partially contracted braille with indication of capitals [de-g1-detailed.ctb]",
146 : "German contracted braille [de-g2.ctb]",
147 : "German contracted braille with indication of capitals [de-g2-detailed.ctb]",
148 : "Dravidian computer braille [dra.tbl]",
149 : "Greek braille [el.ctb]",
150 : "Greek internationalized braille as used by English speakers [grc-international-en.utb]",
151 : "Persian computer braille [fa-ir-comp8.ctb]",
152 : "Persian braille [fa-ir-g1.utb]",
153 : "Unified English uncontracted braille [en-ueb-g1.ctb]",
154 : "Unified English contracted braille [en-ueb-g2.ctb]",
155 : "English computer braille as used in Canada [en_CA.tbl]",
156 : "English uncontracted braille as used in the U.K. [en-gb-g1.utb]",
157 : "English contracted braille as used in the U.K. [en_GB.tbl]",
158 : "English computer braille as used in the U.K. [en-gb-comp8.ctb]",
159 : "North American Braille Computer Code [en-nabcc.utb]",
160 : "English uncontracted braille as used in the U.S. [en-us-g1.ctb]",
161 : "English 6-dot computer braille as used in the U.S. [en-us-comp6.ctb]",
162 : "English 8-dot computer braille as used in the U.S. [en_US-comp8-ext.tbl]",
163 : "English contracted braille as used in the U.S. [en_US.tbl]",
164 : "Esperanto braille [eo.tbl]",
165 : "Esperanto x-system braille [eo-g1-x-system.ctb]",
166 : "Spanish uncontracted braille [es.tbl]",
167 : "Spanish contracted braille [es-g2.ctb]",
168 : "Spanish computer braille [Es-Es-G0.utb]",
169 : "Estonian computer braille [et.tbl]",
170 : "Finnish braille [fi.utb]",
171 : "Finnish computer braille [fi-fi-8dot.ctb]",
172 : "French uncontracted braille [fr-bfu-comp6.utb]",
173 : "French computer braille [fr-bfu-comp8.utb]",
174 : "French contracted braille [fr-bfu-g2.ctb]",
175 : "Irish uncontracted braille [ga-g1.utb]",
176 : "Irish contracted braille [ga-g2.ctb]",
177 : "Scottish Gaelic computer braille [gd.tbl]",
178 : "Ethiopic braille [gez.tbl]",
179 : "Gondi braille [gon.tbl]",
180 : "Gujarati braille [gu.tbl]",
181 : "Hawaiian braille [haw-us-g1.ctb]",
182 : "Hebrew computer braille [he-IL-comp8.utb]",
183 : "Israeli braille [he-IL.utb]",
184 : "Hindi braille [hi.tbl]",
185 : "Croatian braille [hr-g1.tbl]",
186 : "Croatian computer braille [hr-comp8.tbl]",
187 : "Hungarian computer braille [hu-hu-comp8.ctb]",
188 : "Hungarian partially contracted braille [hu.tbl]",
189 : "Hungarian contracted braille [hu-hu-g2.ctb]",
190 : "Armenian computer braille [hy.tbl]",
191 : "Icelandic braille [is.tbl]",
192 : "Italian braille [it.tbl]",
193 : "Italian computer braille [it-it-comp8.utb]",
194 : "Inuktitut braille [iu-ca-g1.ctb]",
195 : "Kantenji [ja-kantenji.utb]",
196 : "Georgian braille [ka.utb]",
197 : "Khasi braille [kha.tbl]",
198 : "Kazakh braille [kk.utb]",
199 : "Khmer braille [km-g1.utb]",
200 : "Northern Kurdish braille [kmr.tbl]",
201 : "Kannada braille [kn.tbl]",
202 : "Korean contracted braille (2006 standard) [ko-2006-g2.ctb]",
203 : "Korean uncontracted braille (2006 standard) [ko-2006-g1.ctb]",
204 : "Korean contracted braille [ko-g2.ctb]",
205 : "Korean uncontracted braille [ko-g1.ctb]",
206 : "Konkani braille [kok.tbl]",
207 : "Kurukh braille [kru.tbl]",
208 : "Luganda braille [lg-ug-g1.utb]",
209 : "Lithuanian 8-dot braille [lt.tbl]",
210 : "Lithuanian 6-dot braille [lt-6dot.tbl]",
211 : "Latvian braille [lv.tbl]",
212 : "Maori braille [mao-nz-g1.ctb]",
213 : "Malayalam braille [ml.tbl]",
214 : "Mongolian uncontracted braille [mn-MN-g1.utb]",
215 : "Mongolian contracted braille [mn-MN-g2.ctb]",
216 : "Manipuri braille [mni.tbl]",
217 : "Marathi braille [mr.tbl]",
218 : "Malay braille [ms-my-g2.ctb]",
219 : "Maltese computer braille [mt.tbl]",
220 : "Munda braille [mun.tbl]",
221 : "Marwari braille [mwr.tbl]",
222 : "Burmese uncontracted braille [my-g1.utb]",
223 : "Burmese contracted braille [my-g2.ctb]",
224 : "Norwegian computer braille [no-no-comp8.ctb]",
225 : "Norwegian 6-dot uncontracted braille [no-no-g0.utb]",
226 : "Norwegian 8-dot uncontracted braille [no-no-8dot.utb]",
227 : "Norwegian 8-dot uncontracted braille with 6-dot fallback [no-no-8dot-fallback-6dot-g0.utb]",
228 : "Norwegian grade 1 contracted braille [no-no-g1.ctb]",
229 : "Norwegian grade 2 contracted braille [no-no-g2.ctb]",
230 : "Norwegian grade 3 contracted braille [no-no-g3.ctb]",
231 : "Nepali braille [ne.tbl]",
232 : "Dutch braille [nl.tbl]",
233 : "Dutch computer braille [nl-comp8.utb]",
234 : "Sepedi uncontracted braille [nso-za-g1.utb]",
235 : "Sepedi contracted braille [nso-za-g2.ctb]",
236 : "Chichewa braille [ny-mw.utb]",
237 : "Oriya braille [or.tbl]",
238 : "Punjabi braille [pa.tbl]",
239 : "Pali braille [pi.tbl]",
240 : "Polish computer braille [pl-pl-comp8.ctb]",
241 : "Polish braille [pl.tbl]",
242 : "Portuguese contracted braille [pt.tbl]",
243 : "Portuguese uncontracted braille [pt-pt-g1.utb]",
244 : "Portuguese computer braille [pt-pt-comp8.ctb]",
245 : "Romanian computer braille [ro.tbl]",
246 : "Russian computer braille [ru.ctb]",
247 : "Russian braille [ru-litbrl.ctb]",
248 : "Russian braille with indication of capitals [ru-litbrl-detailed.utb]",
249 : "Russian braille for program sources [ru-compbrl.ctb]",
250 : "Russian contracted braille [ru-ru-g1.ctb]",
251 : "Kinyarwanda braille [rw-rw-g1.utb]",
252 : "Sanskrit braille [sa.tbl]",
253 : "Yakut braille [sah.utb]",
254 : "Sindhi braille [sd.tbl]",
255 : "Slovak braille [sk-g1.ctb]",
256 : "Slovenian braille [sl.tbl]",
257 : "Slovenian computer braille [sl-si-comp8.ctb]",
258 : "Sesotho uncontracted braille [sot-za-g1.ctb]",
259 : "Sesotho contracted braille [sot-za-g2.ctb]",
260 : "Serbian braille [sr.tbl]",
261 : "Swedish computer braille (1996 standard) [sv-1996.ctb]",
262 : "Swedish computer braille (1989 standard) [sv-1989.ctb]",
263 : "Swedish uncontracted braille [sv-g0.utb]",
264 : "Swedish partially contracted braille [sv-g1.ctb]",
265 : "Swedish contracted braille [sv-g2.ctb]",
266 : "Swahili grade 1.2 contracted braille [sw-ke-g1-2.ctb]",
267 : "Swahili grade 1.3 contracted braille [sw-ke-g1-3.ctb]",
268 : "Swahili grade 1.4 contracted braille [sw-ke-g1-4.ctb]",
269 : "Swahili grade 1.5 contracted braille [sw-ke-g1-5.ctb]",
270 : "Swahili uncontracted braille [sw-ke-g1.utb]",
271 : "Swahili grade 2 contracted braille [sw-ke-g2.ctb]",
272 : "Tamil braille [ta-ta-g1.ctb]",
273 : "Tamil computer braille [ta.tbl]",
274 : "Telugu braille [te.tbl]",
275 : "Turkish computer braille [tr.tbl]",
276 : "Turkish braille [tr-g2.tbl]",
277 : "Setswana uncontracted braille [tsn-za-g1.ctb]",
278 : "Setswana contracted braille [tsn-za-g2.ctb]",
279 : "Tatar braille [tt.utb]",
280 : "Ukrainian braille [uk.utb]",
281 : "Ukrainian computer braille [uk-comp.utb]",
282 : "Uzbek braille [uz-g1.utb]",
283 : "Urdu uncontracted braille [ur-pk-g1.utb]",
284 : "Urdu contracted braille [ur-pk-g2.ctb]",
285 : "Tshivenda uncontracted braille [ve-za-g1.utb]",
286 : "Tshivenda contracted braille [ve-za-g2.ctb]",
287 : "Vietnamese computer braille [vi.ctb]",
288 : "Vietnamese uncontracted braille [vi-vn-g0.utb]",
289 : "Vietnamese partially contracted braille [vi-vn-g1.ctb]",
290 : "Vietnamese contracted braille [vi-vn-g2.ctb]",
291 : "Southern Vietnamese braille [vi-saigon-g1.ctb]",
292 : "isiXhosa uncontracted braille [xh-za-g1.utb]",
293 : "isiXhosa contracted braille [xh-za-g2.ctb]",
294 : "Chinese current braille without tones, for simplified Chinese characters [zh_CHN.tbl]",
295 : "Cantonese braille [zh_HK.tbl]",
296 : "Taiwanese bopomofo braille [zh-tw.ctb]",
297 : "Chinese common braille, for simplified Chinese characters [zhcn-cbs.ctb]",
298 : "Chinese current braille with tones [zhcn-g1.ctb]",
299 : "Chinese double-phonic braille [zhcn-g2.ctb]",
300 : "isiZulu uncontracted braille [zu-za-g1.utb]",
301 : "isiZulu contracted braille [zu-za-g2.ctb]",
302 0 : };
303 : }
304 : }
|