comparison layer/TimeRulerLayer.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 bf306158803d
children 33929e0c3c6b
comparison
equal deleted inserted replaced
86:93a7efc75fb7 87:4b98bda7e94d
53 53
54 Layer::PropertyList 54 Layer::PropertyList
55 TimeRulerLayer::getProperties() const 55 TimeRulerLayer::getProperties() const
56 { 56 {
57 PropertyList list; 57 PropertyList list;
58 list.push_back(tr("Colour")); 58 list.push_back("Colour");
59 return list; 59 return list;
60 }
61
62 QString
63 TimeRulerLayer::getPropertyLabel(const PropertyName &name) const
64 {
65 if (name == "Colour") return tr("Colour");
66 return "";
60 } 67 }
61 68
62 Layer::PropertyType 69 Layer::PropertyType
63 TimeRulerLayer::getPropertyType(const PropertyName &name) const 70 TimeRulerLayer::getPropertyType(const PropertyName &name) const
64 { 71 {
69 TimeRulerLayer::getPropertyRangeAndValue(const PropertyName &name, 76 TimeRulerLayer::getPropertyRangeAndValue(const PropertyName &name,
70 int *min, int *max) const 77 int *min, int *max) const
71 { 78 {
72 int deft = 0; 79 int deft = 0;
73 80
74 if (name == tr("Colour")) { 81 if (name == "Colour") {
75 82
76 if (min) *min = 0; 83 if (min) *min = 0;
77 if (max) *max = 5; 84 if (max) *max = 5;
78 85
79 if (m_colour == Qt::black) deft = 0; 86 if (m_colour == Qt::black) deft = 0;
93 100
94 QString 101 QString
95 TimeRulerLayer::getPropertyValueLabel(const PropertyName &name, 102 TimeRulerLayer::getPropertyValueLabel(const PropertyName &name,
96 int value) const 103 int value) const
97 { 104 {
98 if (name == tr("Colour")) { 105 if (name == "Colour") {
99 switch (value) { 106 switch (value) {
100 default: 107 default:
101 case 0: return tr("Black"); 108 case 0: return tr("Black");
102 case 1: return tr("Red"); 109 case 1: return tr("Red");
103 case 2: return tr("Blue"); 110 case 2: return tr("Blue");
110 } 117 }
111 118
112 void 119 void
113 TimeRulerLayer::setProperty(const PropertyName &name, int value) 120 TimeRulerLayer::setProperty(const PropertyName &name, int value)
114 { 121 {
115 if (name == tr("Colour")) { 122 if (name == "Colour") {
116 switch (value) { 123 switch (value) {
117 default: 124 default:
118 case 0: setBaseColour(Qt::black); break; 125 case 0: setBaseColour(Qt::black); break;
119 case 1: setBaseColour(Qt::darkRed); break; 126 case 1: setBaseColour(Qt::darkRed); break;
120 case 2: setBaseColour(Qt::darkBlue); break; 127 case 2: setBaseColour(Qt::darkBlue); break;