Mercurial > hg > svgui
comparison layer/NoteLayer.cpp @ 87:4b98bda7e94d
* Add property labels to property containers (so i18n() won't affect file format)
author | Chris Cannam |
---|---|
date | Wed, 03 May 2006 16:48:03 +0000 |
parents | 01f27a282c90 |
children | 453f7da3534e |
comparison
equal
deleted
inserted
replaced
86:93a7efc75fb7 | 87:4b98bda7e94d |
---|---|
67 | 67 |
68 Layer::PropertyList | 68 Layer::PropertyList |
69 NoteLayer::getProperties() const | 69 NoteLayer::getProperties() const |
70 { | 70 { |
71 PropertyList list; | 71 PropertyList list; |
72 list.push_back(tr("Colour")); | 72 list.push_back("Colour"); |
73 list.push_back(tr("Vertical Scale")); | 73 list.push_back("Vertical Scale"); |
74 return list; | 74 return list; |
75 } | |
76 | |
77 QString | |
78 NoteLayer::getPropertyLabel(const PropertyName &name) const | |
79 { | |
80 if (name == "Colour") return tr("Colour"); | |
81 if (name == "Vertical Scale") return tr("Vertical Scale"); | |
82 return ""; | |
75 } | 83 } |
76 | 84 |
77 Layer::PropertyType | 85 Layer::PropertyType |
78 NoteLayer::getPropertyType(const PropertyName &) const | 86 NoteLayer::getPropertyType(const PropertyName &) const |
79 { | 87 { |
86 { | 94 { |
87 //!!! factor this colour handling stuff out into a colour manager class | 95 //!!! factor this colour handling stuff out into a colour manager class |
88 | 96 |
89 int deft = 0; | 97 int deft = 0; |
90 | 98 |
91 if (name == tr("Colour")) { | 99 if (name == "Colour") { |
92 | 100 |
93 if (min) *min = 0; | 101 if (min) *min = 0; |
94 if (max) *max = 5; | 102 if (max) *max = 5; |
95 | 103 |
96 if (m_colour == Qt::black) deft = 0; | 104 if (m_colour == Qt::black) deft = 0; |
98 else if (m_colour == Qt::darkBlue) deft = 2; | 106 else if (m_colour == Qt::darkBlue) deft = 2; |
99 else if (m_colour == Qt::darkGreen) deft = 3; | 107 else if (m_colour == Qt::darkGreen) deft = 3; |
100 else if (m_colour == QColor(200, 50, 255)) deft = 4; | 108 else if (m_colour == QColor(200, 50, 255)) deft = 4; |
101 else if (m_colour == QColor(255, 150, 50)) deft = 5; | 109 else if (m_colour == QColor(255, 150, 50)) deft = 5; |
102 | 110 |
103 } else if (name == tr("Vertical Scale")) { | 111 } else if (name == "Vertical Scale") { |
104 | 112 |
105 if (min) *min = 0; | 113 if (min) *min = 0; |
106 if (max) *max = 2; | 114 if (max) *max = 2; |
107 | 115 |
108 deft = int(m_verticalScale); | 116 deft = int(m_verticalScale); |
117 | 125 |
118 QString | 126 QString |
119 NoteLayer::getPropertyValueLabel(const PropertyName &name, | 127 NoteLayer::getPropertyValueLabel(const PropertyName &name, |
120 int value) const | 128 int value) const |
121 { | 129 { |
122 if (name == tr("Colour")) { | 130 if (name == "Colour") { |
123 switch (value) { | 131 switch (value) { |
124 default: | 132 default: |
125 case 0: return tr("Black"); | 133 case 0: return tr("Black"); |
126 case 1: return tr("Red"); | 134 case 1: return tr("Red"); |
127 case 2: return tr("Blue"); | 135 case 2: return tr("Blue"); |
128 case 3: return tr("Green"); | 136 case 3: return tr("Green"); |
129 case 4: return tr("Purple"); | 137 case 4: return tr("Purple"); |
130 case 5: return tr("Orange"); | 138 case 5: return tr("Orange"); |
131 } | 139 } |
132 } else if (name == tr("Vertical Scale")) { | 140 } else if (name == "Vertical Scale") { |
133 switch (value) { | 141 switch (value) { |
134 default: | 142 default: |
135 case 0: return tr("Note Range In Use"); | 143 case 0: return tr("Note Range In Use"); |
136 case 1: return tr("MIDI Note Range"); | 144 case 1: return tr("MIDI Note Range"); |
137 case 2: return tr("Frequency"); | 145 case 2: return tr("Frequency"); |
141 } | 149 } |
142 | 150 |
143 void | 151 void |
144 NoteLayer::setProperty(const PropertyName &name, int value) | 152 NoteLayer::setProperty(const PropertyName &name, int value) |
145 { | 153 { |
146 if (name == tr("Colour")) { | 154 if (name == "Colour") { |
147 switch (value) { | 155 switch (value) { |
148 default: | 156 default: |
149 case 0: setBaseColour(Qt::black); break; | 157 case 0: setBaseColour(Qt::black); break; |
150 case 1: setBaseColour(Qt::darkRed); break; | 158 case 1: setBaseColour(Qt::darkRed); break; |
151 case 2: setBaseColour(Qt::darkBlue); break; | 159 case 2: setBaseColour(Qt::darkBlue); break; |
152 case 3: setBaseColour(Qt::darkGreen); break; | 160 case 3: setBaseColour(Qt::darkGreen); break; |
153 case 4: setBaseColour(QColor(200, 50, 255)); break; | 161 case 4: setBaseColour(QColor(200, 50, 255)); break; |
154 case 5: setBaseColour(QColor(255, 150, 50)); break; | 162 case 5: setBaseColour(QColor(255, 150, 50)); break; |
155 } | 163 } |
156 } else if (name == tr("Vertical Scale")) { | 164 } else if (name == "Vertical Scale") { |
157 setVerticalScale(VerticalScale(value)); | 165 setVerticalScale(VerticalScale(value)); |
158 } | 166 } |
159 } | 167 } |
160 | 168 |
161 void | 169 void |