Mercurial > hg > svgui
comparison layer/TimeValueLayer.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 TimeValueLayer::getProperties() const | 69 TimeValueLayer::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("Plot Type")); | 73 list.push_back("Plot Type"); |
74 list.push_back(tr("Vertical Scale")); | 74 list.push_back("Vertical Scale"); |
75 return list; | 75 return list; |
76 } | |
77 | |
78 QString | |
79 TimeValueLayer::getPropertyLabel(const PropertyName &name) const | |
80 { | |
81 if (name == "Colour") return tr("Colour"); | |
82 if (name == "Plot Type") return tr("Plot Type"); | |
83 if (name == "Vertical Scale") return tr("Vertical Scale"); | |
84 return ""; | |
76 } | 85 } |
77 | 86 |
78 Layer::PropertyType | 87 Layer::PropertyType |
79 TimeValueLayer::getPropertyType(const PropertyName &name) const | 88 TimeValueLayer::getPropertyType(const PropertyName &name) const |
80 { | 89 { |
87 { | 96 { |
88 //!!! factor this colour handling stuff out into a colour manager class | 97 //!!! factor this colour handling stuff out into a colour manager class |
89 | 98 |
90 int deft = 0; | 99 int deft = 0; |
91 | 100 |
92 if (name == tr("Colour")) { | 101 if (name == "Colour") { |
93 | 102 |
94 if (min) *min = 0; | 103 if (min) *min = 0; |
95 if (max) *max = 5; | 104 if (max) *max = 5; |
96 | 105 |
97 if (m_colour == Qt::black) deft = 0; | 106 if (m_colour == Qt::black) deft = 0; |
99 else if (m_colour == Qt::darkBlue) deft = 2; | 108 else if (m_colour == Qt::darkBlue) deft = 2; |
100 else if (m_colour == Qt::darkGreen) deft = 3; | 109 else if (m_colour == Qt::darkGreen) deft = 3; |
101 else if (m_colour == QColor(200, 50, 255)) deft = 4; | 110 else if (m_colour == QColor(200, 50, 255)) deft = 4; |
102 else if (m_colour == QColor(255, 150, 50)) deft = 5; | 111 else if (m_colour == QColor(255, 150, 50)) deft = 5; |
103 | 112 |
104 } else if (name == tr("Plot Type")) { | 113 } else if (name == "Plot Type") { |
105 | 114 |
106 if (min) *min = 0; | 115 if (min) *min = 0; |
107 if (max) *max = 5; | 116 if (max) *max = 5; |
108 | 117 |
109 deft = int(m_plotStyle); | 118 deft = int(m_plotStyle); |
110 | 119 |
111 } else if (name == tr("Vertical Scale")) { | 120 } else if (name == "Vertical Scale") { |
112 | 121 |
113 if (min) *min = 0; | 122 if (min) *min = 0; |
114 if (max) *max = 3; | 123 if (max) *max = 3; |
115 | 124 |
116 deft = int(m_verticalScale); | 125 deft = int(m_verticalScale); |
125 | 134 |
126 QString | 135 QString |
127 TimeValueLayer::getPropertyValueLabel(const PropertyName &name, | 136 TimeValueLayer::getPropertyValueLabel(const PropertyName &name, |
128 int value) const | 137 int value) const |
129 { | 138 { |
130 if (name == tr("Colour")) { | 139 if (name == "Colour") { |
131 switch (value) { | 140 switch (value) { |
132 default: | 141 default: |
133 case 0: return tr("Black"); | 142 case 0: return tr("Black"); |
134 case 1: return tr("Red"); | 143 case 1: return tr("Red"); |
135 case 2: return tr("Blue"); | 144 case 2: return tr("Blue"); |
136 case 3: return tr("Green"); | 145 case 3: return tr("Green"); |
137 case 4: return tr("Purple"); | 146 case 4: return tr("Purple"); |
138 case 5: return tr("Orange"); | 147 case 5: return tr("Orange"); |
139 } | 148 } |
140 } else if (name == tr("Plot Type")) { | 149 } else if (name == "Plot Type") { |
141 switch (value) { | 150 switch (value) { |
142 default: | 151 default: |
143 case 0: return tr("Points"); | 152 case 0: return tr("Points"); |
144 case 1: return tr("Stems"); | 153 case 1: return tr("Stems"); |
145 case 2: return tr("Connected Points"); | 154 case 2: return tr("Connected Points"); |
146 case 3: return tr("Lines"); | 155 case 3: return tr("Lines"); |
147 case 4: return tr("Curve"); | 156 case 4: return tr("Curve"); |
148 case 5: return tr("Segmentation"); | 157 case 5: return tr("Segmentation"); |
149 } | 158 } |
150 } else if (name == tr("Vertical Scale")) { | 159 } else if (name == "Vertical Scale") { |
151 switch (value) { | 160 switch (value) { |
152 default: | 161 default: |
153 case 0: return tr("Linear Scale"); | 162 case 0: return tr("Linear Scale"); |
154 case 1: return tr("Log Scale"); | 163 case 1: return tr("Log Scale"); |
155 case 2: return tr("+/-1 Scale"); | 164 case 2: return tr("+/-1 Scale"); |
160 } | 169 } |
161 | 170 |
162 void | 171 void |
163 TimeValueLayer::setProperty(const PropertyName &name, int value) | 172 TimeValueLayer::setProperty(const PropertyName &name, int value) |
164 { | 173 { |
165 if (name == tr("Colour")) { | 174 if (name == "Colour") { |
166 switch (value) { | 175 switch (value) { |
167 default: | 176 default: |
168 case 0: setBaseColour(Qt::black); break; | 177 case 0: setBaseColour(Qt::black); break; |
169 case 1: setBaseColour(Qt::darkRed); break; | 178 case 1: setBaseColour(Qt::darkRed); break; |
170 case 2: setBaseColour(Qt::darkBlue); break; | 179 case 2: setBaseColour(Qt::darkBlue); break; |
171 case 3: setBaseColour(Qt::darkGreen); break; | 180 case 3: setBaseColour(Qt::darkGreen); break; |
172 case 4: setBaseColour(QColor(200, 50, 255)); break; | 181 case 4: setBaseColour(QColor(200, 50, 255)); break; |
173 case 5: setBaseColour(QColor(255, 150, 50)); break; | 182 case 5: setBaseColour(QColor(255, 150, 50)); break; |
174 } | 183 } |
175 } else if (name == tr("Plot Type")) { | 184 } else if (name == "Plot Type") { |
176 setPlotStyle(PlotStyle(value)); | 185 setPlotStyle(PlotStyle(value)); |
177 } else if (name == tr("Vertical Scale")) { | 186 } else if (name == "Vertical Scale") { |
178 setVerticalScale(VerticalScale(value)); | 187 setVerticalScale(VerticalScale(value)); |
179 } | 188 } |
180 } | 189 } |
181 | 190 |
182 void | 191 void |