Line data Source code
1 : /*
2 : * SPDX-License-Identifier: GPL-3.0-only
3 : * MuseScore-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 : #pragma once
24 :
25 : #include <QObject>
26 :
27 : namespace muse::ui {
28 : /**
29 : * @brief The MusicalSymbolCodes class simplifies access to the icons from the musical font
30 : *
31 : * @details Each enum value is a UTF-16-like address of the icon in the icon font.
32 : * The current default musical font (Leland.otf) is located in the 'MuseScore/fonts/leland' folder,
33 : * The most actual version can be found by this persistent URL: @link https://www.dropbox.com/s/fhiu26x7sgboxjf/Leland.otf?dl=0
34 : */
35 :
36 : namespace MusicalSymbolCodes {
37 : Q_NAMESPACE
38 :
39 : enum class Code : char16_t {
40 : ZERO = 0xE080,
41 : ONE = 0xE081,
42 : TWO = 0xE082,
43 : THREE = 0xE083,
44 : FOUR = 0xE084,
45 : FIVE = 0xE085,
46 : SIX = 0xE086,
47 : SEVEN = 0xE087,
48 : EIGHT = 0xE088,
49 : NINE = 0xE089,
50 : TIMESIG_COMMON = 0xE08A,
51 : TIMESIG_CUT = 0xE08B,
52 :
53 : NOTEHEAD_NORMAL = 0xE0A4,
54 : NOTEHEAD_CROSS = 0xE0A9,
55 : NOTEHEAD_PLUS = 0xE0AF,
56 : NOTEHEAD_XCIRCLE = 0xE0B3,
57 : NOTEHEAD_WITHX = 0xE0B7,
58 : NOTEHEAD_TRIANGLE_UP = 0xE0BE,
59 : NOTEHEAD_TRIANGLE_DOWN = 0xE0C7,
60 : NOTEHEAD_SLASHED1 = 0xE0CF,
61 : NOTEHEAD_SLASHED2 = 0xE0D0,
62 : NOTEHEAD_DIAMOND = 0xE0DB,
63 : NOTEHEAD_DIAMOND_OLD = 0xE0E2,
64 : NOTEHEAD_CIRCLED = 0xE0E4,
65 : NOTEHEAD_CIRCLED_LARGE = 0xE0E8,
66 : NOTEHEAD_LARGE_ARROW = 0xE0F0,
67 :
68 : NOTEHEAD_SLASH = 0xE101,
69 : NOTEHEAD_LARGE_DIAMOND = 0xE104,
70 : NOTEHEAD_SOL = 0xE1B1,
71 : NOTEHEAD_LA = 0xE1B3,
72 : NOTEHEAD_FA = 0xE1B5,
73 : NOTEHEAD_MI = 0xE1B9,
74 : NOTEHEAD_DO = 0xE1BB,
75 : NOTEHEAD_RE = 0xE1BD,
76 : NOTEHEAD_TI = 0xE1BF,
77 :
78 : NOTEHEAD_HEAVY_CROSS = 0xE0FA,
79 : NOTEHEAD_HEAVY_CROSS_HAT = 0xE0F9,
80 :
81 : SEMIBREVE = 0xE1D2,
82 : MINIM = 0xE1D3,
83 : CROTCHET = 0xE1D5,
84 : QUAVER = 0xE1D7,
85 : SEMIQUAVER = 0xE1D9,
86 : DEMISEMIQUAVER = 0xE1DB,
87 : DOT = 0xE1E7,
88 :
89 : MENSURAL_PROLATION_1 = 0xE910,
90 : MENSURAL_PROLATION_2 = 0xE911,
91 : MENSURAL_PROLATION_3 = 0xE912,
92 : MENSURAL_PROLATION_4 = 0xE913,
93 : MENSURAL_PROLATION_5 = 0xE914,
94 : MENSURAL_PROLATION_6 = 0xE915,
95 : MENSURAL_PROLATION_7 = 0xE916,
96 : MENSURAL_PROLATION_8 = 0xE917,
97 : MENSURAL_PROLATION_9 = 0xE918,
98 : MENSURAL_PROLATION_10 = 0xE919,
99 : MENSURAL_PROLATION_11 = 0xE91A,
100 :
101 : NOTEHEAD_BREVIS_ALT = 0xF43F,
102 :
103 : NONE
104 : };
105 :
106 0 : Q_ENUM_NS(Code)
107 : }
108 :
109 0 : inline QString musicalSymbolToString(MusicalSymbolCodes::Code symbolCode, bool withDot = false)
110 : {
111 0 : QString noteSymbol = QString(QChar(static_cast<char16_t>(symbolCode)));
112 :
113 0 : if (withDot) {
114 0 : noteSymbol += QChar(static_cast<char16_t>(MusicalSymbolCodes::Code::DOT));
115 : }
116 :
117 0 : return noteSymbol;
118 0 : }
119 : }
|