comparison layer/TextLayer.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 05c41701dc6c
comparison
equal deleted inserted replaced
86:93a7efc75fb7 87:4b98bda7e94d
61 61
62 Layer::PropertyList 62 Layer::PropertyList
63 TextLayer::getProperties() const 63 TextLayer::getProperties() const
64 { 64 {
65 PropertyList list; 65 PropertyList list;
66 list.push_back(tr("Colour")); 66 list.push_back("Colour");
67 return list; 67 return list;
68 }
69
70 QString
71 TextLayer::getPropertyLabel(const PropertyName &name) const
72 {
73 if (name == "Colour") return tr("Colour");
68 } 74 }
69 75
70 Layer::PropertyType 76 Layer::PropertyType
71 TextLayer::getPropertyType(const PropertyName &name) const 77 TextLayer::getPropertyType(const PropertyName &name) const
72 { 78 {
79 { 85 {
80 //!!! factor this colour handling stuff out into a colour manager class 86 //!!! factor this colour handling stuff out into a colour manager class
81 87
82 int deft = 0; 88 int deft = 0;
83 89
84 if (name == tr("Colour")) { 90 if (name == "Colour") {
85 91
86 if (min) *min = 0; 92 if (min) *min = 0;
87 if (max) *max = 5; 93 if (max) *max = 5;
88 94
89 if (m_colour == Qt::black) deft = 0; 95 if (m_colour == Qt::black) deft = 0;
103 109
104 QString 110 QString
105 TextLayer::getPropertyValueLabel(const PropertyName &name, 111 TextLayer::getPropertyValueLabel(const PropertyName &name,
106 int value) const 112 int value) const
107 { 113 {
108 if (name == tr("Colour")) { 114 if (name == "Colour") {
109 switch (value) { 115 switch (value) {
110 default: 116 default:
111 case 0: return tr("Black"); 117 case 0: return tr("Black");
112 case 1: return tr("Red"); 118 case 1: return tr("Red");
113 case 2: return tr("Blue"); 119 case 2: return tr("Blue");
120 } 126 }
121 127
122 void 128 void
123 TextLayer::setProperty(const PropertyName &name, int value) 129 TextLayer::setProperty(const PropertyName &name, int value)
124 { 130 {
125 if (name == tr("Colour")) { 131 if (name == "Colour") {
126 switch (value) { 132 switch (value) {
127 default: 133 default:
128 case 0: setBaseColour(Qt::black); break; 134 case 0: setBaseColour(Qt::black); break;
129 case 1: setBaseColour(Qt::darkRed); break; 135 case 1: setBaseColour(Qt::darkRed); break;
130 case 2: setBaseColour(Qt::darkBlue); break; 136 case 2: setBaseColour(Qt::darkBlue); break;