Mercurial > hg > svcore
comparison data/model/RegionModel.h @ 1599:ce185d4dd408 bqaudiostream
Merge from default branch
author | Chris Cannam |
---|---|
date | Wed, 23 Jan 2019 14:43:43 +0000 |
parents | ad5f892c0c4d |
children | 1cc9a0d4b1b6 |
comparison
equal
deleted
inserted
replaced
1598:d2555df635ec | 1599:ce185d4dd408 |
---|---|
11 published by the Free Software Foundation; either version 2 of the | 11 published by the Free Software Foundation; either version 2 of the |
12 License, or (at your option) any later version. See the file | 12 License, or (at your option) any later version. See the file |
13 COPYING included with this distribution for more information. | 13 COPYING included with this distribution for more information. |
14 */ | 14 */ |
15 | 15 |
16 #ifndef _REGION_MODEL_H_ | 16 #ifndef SV_REGION_MODEL_H |
17 #define _REGION_MODEL_H_ | 17 #define SV_REGION_MODEL_H |
18 | 18 |
19 #include "IntervalModel.h" | 19 #include "IntervalModel.h" |
20 #include "base/RealTime.h" | 20 #include "base/RealTime.h" |
21 | 21 |
22 /** | 22 /** |
120 float getValueQuantization() const { return m_valueQuantization; } | 120 float getValueQuantization() const { return m_valueQuantization; } |
121 void setValueQuantization(float q) { m_valueQuantization = q; } | 121 void setValueQuantization(float q) { m_valueQuantization = q; } |
122 | 122 |
123 bool haveDistinctValues() const { return m_haveDistinctValues; } | 123 bool haveDistinctValues() const { return m_haveDistinctValues; } |
124 | 124 |
125 QString getTypeName() const { return tr("Region"); } | 125 QString getTypeName() const override { return tr("Region"); } |
126 | 126 |
127 virtual void toXml(QTextStream &out, | 127 void toXml(QTextStream &out, |
128 QString indent = "", | 128 QString indent = "", |
129 QString extraAttributes = "") const | 129 QString extraAttributes = "") const override |
130 { | 130 { |
131 std::cerr << "RegionModel::toXml: extraAttributes = \"" | 131 std::cerr << "RegionModel::toXml: extraAttributes = \"" |
132 << extraAttributes.toStdString() << std::endl; | 132 << extraAttributes.toStdString() << std::endl; |
133 | 133 |
134 IntervalModel<RegionRec>::toXml | 134 IntervalModel<RegionRec>::toXml |
140 | 140 |
141 /** | 141 /** |
142 * TabularModel methods. | 142 * TabularModel methods. |
143 */ | 143 */ |
144 | 144 |
145 virtual int getColumnCount() const | 145 int getColumnCount() const override |
146 { | 146 { |
147 return 5; | 147 return 5; |
148 } | 148 } |
149 | 149 |
150 virtual QString getHeading(int column) const | 150 QString getHeading(int column) const override |
151 { | 151 { |
152 switch (column) { | 152 switch (column) { |
153 case 0: return tr("Time"); | 153 case 0: return tr("Time"); |
154 case 1: return tr("Frame"); | 154 case 1: return tr("Frame"); |
155 case 2: return tr("Value"); | 155 case 2: return tr("Value"); |
157 case 4: return tr("Label"); | 157 case 4: return tr("Label"); |
158 default: return tr("Unknown"); | 158 default: return tr("Unknown"); |
159 } | 159 } |
160 } | 160 } |
161 | 161 |
162 virtual QVariant getData(int row, int column, int role) const | 162 QVariant getData(int row, int column, int role) const override |
163 { | 163 { |
164 if (column < 4) { | 164 if (column < 4) { |
165 return IntervalModel<RegionRec>::getData(row, column, role); | 165 return IntervalModel<RegionRec>::getData(row, column, role); |
166 } | 166 } |
167 | 167 |
172 case 4: return i->label; | 172 case 4: return i->label; |
173 default: return QVariant(); | 173 default: return QVariant(); |
174 } | 174 } |
175 } | 175 } |
176 | 176 |
177 virtual Command *getSetDataCommand(int row, int column, const QVariant &value, int role) | 177 Command *getSetDataCommand(int row, int column, const QVariant &value, int role) override |
178 { | 178 { |
179 if (column < 4) { | 179 if (column < 4) { |
180 return IntervalModel<RegionRec>::getSetDataCommand | 180 return IntervalModel<RegionRec>::getSetDataCommand |
181 (row, column, value, role); | 181 (row, column, value, role); |
182 } | 182 } |
195 | 195 |
196 command->addPoint(point); | 196 command->addPoint(point); |
197 return command->finish(); | 197 return command->finish(); |
198 } | 198 } |
199 | 199 |
200 virtual SortType getSortType(int column) const | 200 SortType getSortType(int column) const override |
201 { | 201 { |
202 if (column == 4) return SortAlphabetical; | 202 if (column == 4) return SortAlphabetical; |
203 return SortNumeric; | 203 return SortNumeric; |
204 } | 204 } |
205 | 205 |
206 virtual void addPoint(const Point &point) | 206 void addPoint(const Point &point) override |
207 { | 207 { |
208 if (point.value != 0.f) m_haveDistinctValues = true; | 208 if (point.value != 0.f) m_haveDistinctValues = true; |
209 IntervalModel<RegionRec>::addPoint(point); | 209 IntervalModel<RegionRec>::addPoint(point); |
210 } | 210 } |
211 | 211 |