Mercurial > hg > svgui
comparison layer/TimeInstantLayer.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 | 19bf27e4fb29 |
children | 453f7da3534e |
comparison
equal
deleted
inserted
replaced
86:93a7efc75fb7 | 87:4b98bda7e94d |
---|---|
63 | 63 |
64 Layer::PropertyList | 64 Layer::PropertyList |
65 TimeInstantLayer::getProperties() const | 65 TimeInstantLayer::getProperties() const |
66 { | 66 { |
67 PropertyList list; | 67 PropertyList list; |
68 list.push_back(tr("Colour")); | 68 list.push_back("Colour"); |
69 list.push_back(tr("Plot Type")); | 69 list.push_back("Plot Type"); |
70 return list; | 70 return list; |
71 } | |
72 | |
73 QString | |
74 TimeInstantLayer::getPropertyLabel(const PropertyName &name) const | |
75 { | |
76 if (name == "Colour") return tr("Colour"); | |
77 if (name == "Plot Type") return tr("Plot Type"); | |
78 return ""; | |
71 } | 79 } |
72 | 80 |
73 Layer::PropertyType | 81 Layer::PropertyType |
74 TimeInstantLayer::getPropertyType(const PropertyName &) const | 82 TimeInstantLayer::getPropertyType(const PropertyName &) const |
75 { | 83 { |
80 TimeInstantLayer::getPropertyRangeAndValue(const PropertyName &name, | 88 TimeInstantLayer::getPropertyRangeAndValue(const PropertyName &name, |
81 int *min, int *max) const | 89 int *min, int *max) const |
82 { | 90 { |
83 int deft = 0; | 91 int deft = 0; |
84 | 92 |
85 if (name == tr("Colour")) { | 93 if (name == "Colour") { |
86 | 94 |
87 if (min) *min = 0; | 95 if (min) *min = 0; |
88 if (max) *max = 5; | 96 if (max) *max = 5; |
89 | 97 |
90 if (m_colour == Qt::black) deft = 0; | 98 if (m_colour == Qt::black) deft = 0; |
92 else if (m_colour == Qt::darkBlue) deft = 2; | 100 else if (m_colour == Qt::darkBlue) deft = 2; |
93 else if (m_colour == Qt::darkGreen) deft = 3; | 101 else if (m_colour == Qt::darkGreen) deft = 3; |
94 else if (m_colour == QColor(200, 50, 255)) deft = 4; | 102 else if (m_colour == QColor(200, 50, 255)) deft = 4; |
95 else if (m_colour == QColor(255, 150, 50)) deft = 5; | 103 else if (m_colour == QColor(255, 150, 50)) deft = 5; |
96 | 104 |
97 } else if (name == tr("Plot Type")) { | 105 } else if (name == "Plot Type") { |
98 | 106 |
99 if (min) *min = 0; | 107 if (min) *min = 0; |
100 if (max) *max = 1; | 108 if (max) *max = 1; |
101 | 109 |
102 deft = int(m_plotStyle); | 110 deft = int(m_plotStyle); |
111 | 119 |
112 QString | 120 QString |
113 TimeInstantLayer::getPropertyValueLabel(const PropertyName &name, | 121 TimeInstantLayer::getPropertyValueLabel(const PropertyName &name, |
114 int value) const | 122 int value) const |
115 { | 123 { |
116 if (name == tr("Colour")) { | 124 if (name == "Colour") { |
117 switch (value) { | 125 switch (value) { |
118 default: | 126 default: |
119 case 0: return tr("Black"); | 127 case 0: return tr("Black"); |
120 case 1: return tr("Red"); | 128 case 1: return tr("Red"); |
121 case 2: return tr("Blue"); | 129 case 2: return tr("Blue"); |
122 case 3: return tr("Green"); | 130 case 3: return tr("Green"); |
123 case 4: return tr("Purple"); | 131 case 4: return tr("Purple"); |
124 case 5: return tr("Orange"); | 132 case 5: return tr("Orange"); |
125 } | 133 } |
126 } else if (name == tr("Plot Type")) { | 134 } else if (name == "Plot Type") { |
127 switch (value) { | 135 switch (value) { |
128 default: | 136 default: |
129 case 0: return tr("Instants"); | 137 case 0: return tr("Instants"); |
130 case 1: return tr("Segmentation"); | 138 case 1: return tr("Segmentation"); |
131 } | 139 } |
134 } | 142 } |
135 | 143 |
136 void | 144 void |
137 TimeInstantLayer::setProperty(const PropertyName &name, int value) | 145 TimeInstantLayer::setProperty(const PropertyName &name, int value) |
138 { | 146 { |
139 if (name == tr("Colour")) { | 147 if (name == "Colour") { |
140 switch (value) { | 148 switch (value) { |
141 default: | 149 default: |
142 case 0: setBaseColour(Qt::black); break; | 150 case 0: setBaseColour(Qt::black); break; |
143 case 1: setBaseColour(Qt::darkRed); break; | 151 case 1: setBaseColour(Qt::darkRed); break; |
144 case 2: setBaseColour(Qt::darkBlue); break; | 152 case 2: setBaseColour(Qt::darkBlue); break; |
145 case 3: setBaseColour(Qt::darkGreen); break; | 153 case 3: setBaseColour(Qt::darkGreen); break; |
146 case 4: setBaseColour(QColor(200, 50, 255)); break; | 154 case 4: setBaseColour(QColor(200, 50, 255)); break; |
147 case 5: setBaseColour(QColor(255, 150, 50)); break; | 155 case 5: setBaseColour(QColor(255, 150, 50)); break; |
148 } | 156 } |
149 } else if (name == tr("Plot Type")) { | 157 } else if (name == "Plot Type") { |
150 setPlotStyle(PlotStyle(value)); | 158 setPlotStyle(PlotStyle(value)); |
151 } | 159 } |
152 } | 160 } |
153 | 161 |
154 void | 162 void |