comparison base/PropertyContainer.h @ 1429:48e9f538e6e9

Untabify
author Chris Cannam
date Thu, 01 Mar 2018 18:02:22 +0000
parents 576be7933ec7
children c01cbe41aeb5
comparison
equal deleted inserted replaced
1428:87ae75da6527 1429:48e9f538e6e9
34 34
35 typedef QString PropertyName; 35 typedef QString PropertyName;
36 typedef std::vector<PropertyName> PropertyList; 36 typedef std::vector<PropertyName> PropertyList;
37 37
38 enum PropertyType { 38 enum PropertyType {
39 ToggleProperty, // on or off 39 ToggleProperty, // on or off
40 RangeProperty, // range of integers 40 RangeProperty, // range of integers
41 ValueProperty, // range of integers given string labels 41 ValueProperty, // range of integers given string labels
42 ColourProperty, // colours, get/set as ColourDatabase indices 42 ColourProperty, // colours, get/set as ColourDatabase indices
43 ColourMapProperty, // colour maps, get/set as ColourMapper::StandardMap enum 43 ColourMapProperty, // colour maps, get/set as ColourMapper::StandardMap enum
44 UnitsProperty, // unit from UnitDatabase, get/set unit id 44 UnitsProperty, // unit from UnitDatabase, get/set unit id
45 InvalidProperty, // property not found! 45 InvalidProperty, // property not found!
46 }; 46 };
47 47
48 /** 48 /**
49 * Get a list of the names of all the supported properties on this 49 * Get a list of the names of all the supported properties on this
50 * container. These should be fixed (i.e. not internationalized). 50 * container. These should be fixed (i.e. not internationalized).
80 * Return the minimum and maximum values for the given property 80 * Return the minimum and maximum values for the given property
81 * and its current value in this container. Min and/or max may be 81 * and its current value in this container. Min and/or max may be
82 * passed as NULL if their values are not required. 82 * passed as NULL if their values are not required.
83 */ 83 */
84 virtual int getPropertyRangeAndValue(const PropertyName &, 84 virtual int getPropertyRangeAndValue(const PropertyName &,
85 int *min, int *max, int *deflt) const; 85 int *min, int *max, int *deflt) const;
86 86
87 /** 87 /**
88 * If the given property is a ValueProperty, return the display 88 * If the given property is a ValueProperty, return the display
89 * label to be used for the given value for that property. 89 * label to be used for the given value for that property.
90 */ 90 */
91 virtual QString getPropertyValueLabel(const PropertyName &, 91 virtual QString getPropertyValueLabel(const PropertyName &,
92 int value) const; 92 int value) const;
93 93
94 /** 94 /**
95 * If the given property is a ValueProperty, return the icon to be 95 * If the given property is a ValueProperty, return the icon to be
96 * used for the given value for that property, if any. 96 * used for the given value for that property, if any.
97 */ 97 */
157 protected: 157 protected:
158 158
159 class SetPropertyCommand : public Command 159 class SetPropertyCommand : public Command
160 { 160 {
161 public: 161 public:
162 SetPropertyCommand(PropertyContainer *pc, const PropertyName &pn, int); 162 SetPropertyCommand(PropertyContainer *pc, const PropertyName &pn, int);
163 virtual ~SetPropertyCommand() { } 163 virtual ~SetPropertyCommand() { }
164 164
165 virtual void execute(); 165 virtual void execute();
166 virtual void unexecute(); 166 virtual void unexecute();
167 virtual QString getName() const; 167 virtual QString getName() const;
168 168
169 protected: 169 protected:
170 PropertyContainer *m_pc; 170 PropertyContainer *m_pc;
171 PropertyName m_pn; 171 PropertyName m_pn;
172 int m_value; 172 int m_value;
173 int m_oldValue; 173 int m_oldValue;
174 }; 174 };
175 175
176 virtual bool convertPropertyStrings(QString nameString, QString valueString, 176 virtual bool convertPropertyStrings(QString nameString, QString valueString,
177 PropertyName &name, int &value); 177 PropertyName &name, int &value);
178 }; 178 };