Mercurial > hg > svcore
comparison data/model/NoteModel.h @ 1580:c01cbe41aeb5 fix-static-analysis
Use override throughout
author | Chris Cannam |
---|---|
date | Mon, 26 Nov 2018 13:48:45 +0000 |
parents | 6965c83c8fa7 |
children | b2f32c554199 |
comparison
equal
deleted
inserted
replaced
1579:232d6ddf257d | 1580:c01cbe41aeb5 |
---|---|
124 } | 124 } |
125 | 125 |
126 float getValueQuantization() const { return m_valueQuantization; } | 126 float getValueQuantization() const { return m_valueQuantization; } |
127 void setValueQuantization(float q) { m_valueQuantization = q; } | 127 void setValueQuantization(float q) { m_valueQuantization = q; } |
128 | 128 |
129 QString getTypeName() const { return tr("Note"); } | 129 QString getTypeName() const override { return tr("Note"); } |
130 | 130 |
131 virtual bool canPlay() const { return true; } | 131 bool canPlay() const override { return true; } |
132 | 132 |
133 virtual QString getDefaultPlayClipId() const | 133 QString getDefaultPlayClipId() const override |
134 { | 134 { |
135 return "elecpiano"; | 135 return "elecpiano"; |
136 } | 136 } |
137 | 137 |
138 virtual void toXml(QTextStream &out, | 138 void toXml(QTextStream &out, |
139 QString indent = "", | 139 QString indent = "", |
140 QString extraAttributes = "") const | 140 QString extraAttributes = "") const override |
141 { | 141 { |
142 std::cerr << "NoteModel::toXml: extraAttributes = \"" | 142 std::cerr << "NoteModel::toXml: extraAttributes = \"" |
143 << extraAttributes.toStdString() << std::endl; | 143 << extraAttributes.toStdString() << std::endl; |
144 | 144 |
145 IntervalModel<Note>::toXml | 145 IntervalModel<Note>::toXml |
151 | 151 |
152 /** | 152 /** |
153 * TabularModel methods. | 153 * TabularModel methods. |
154 */ | 154 */ |
155 | 155 |
156 virtual int getColumnCount() const | 156 int getColumnCount() const override |
157 { | 157 { |
158 return 6; | 158 return 6; |
159 } | 159 } |
160 | 160 |
161 virtual QString getHeading(int column) const | 161 QString getHeading(int column) const override |
162 { | 162 { |
163 switch (column) { | 163 switch (column) { |
164 case 0: return tr("Time"); | 164 case 0: return tr("Time"); |
165 case 1: return tr("Frame"); | 165 case 1: return tr("Frame"); |
166 case 2: return tr("Pitch"); | 166 case 2: return tr("Pitch"); |
169 case 5: return tr("Label"); | 169 case 5: return tr("Label"); |
170 default: return tr("Unknown"); | 170 default: return tr("Unknown"); |
171 } | 171 } |
172 } | 172 } |
173 | 173 |
174 virtual QVariant getData(int row, int column, int role) const | 174 QVariant getData(int row, int column, int role) const override |
175 { | 175 { |
176 if (column < 4) { | 176 if (column < 4) { |
177 return IntervalModel<Note>::getData(row, column, role); | 177 return IntervalModel<Note>::getData(row, column, role); |
178 } | 178 } |
179 | 179 |
185 case 5: return i->label; | 185 case 5: return i->label; |
186 default: return QVariant(); | 186 default: return QVariant(); |
187 } | 187 } |
188 } | 188 } |
189 | 189 |
190 virtual Command *getSetDataCommand(int row, int column, const QVariant &value, int role) | 190 Command *getSetDataCommand(int row, int column, const QVariant &value, int role) override |
191 { | 191 { |
192 if (column < 4) { | 192 if (column < 4) { |
193 return IntervalModel<Note>::getSetDataCommand | 193 return IntervalModel<Note>::getSetDataCommand |
194 (row, column, value, role); | 194 (row, column, value, role); |
195 } | 195 } |
209 | 209 |
210 command->addPoint(point); | 210 command->addPoint(point); |
211 return command->finish(); | 211 return command->finish(); |
212 } | 212 } |
213 | 213 |
214 virtual SortType getSortType(int column) const | 214 SortType getSortType(int column) const override |
215 { | 215 { |
216 if (column == 5) return SortAlphabetical; | 216 if (column == 5) return SortAlphabetical; |
217 return SortNumeric; | 217 return SortNumeric; |
218 } | 218 } |
219 | 219 |
220 /** | 220 /** |
221 * NoteExportable methods. | 221 * NoteExportable methods. |
222 */ | 222 */ |
223 | 223 |
224 NoteList getNotes() const { | 224 NoteList getNotes() const override { |
225 return getNotesWithin(getStartFrame(), getEndFrame()); | 225 return getNotesWithin(getStartFrame(), getEndFrame()); |
226 } | 226 } |
227 | 227 |
228 NoteList getNotesWithin(sv_frame_t startFrame, sv_frame_t endFrame) const { | 228 NoteList getNotesWithin(sv_frame_t startFrame, sv_frame_t endFrame) const override { |
229 | 229 |
230 PointList points = getPoints(startFrame, endFrame); | 230 PointList points = getPoints(startFrame, endFrame); |
231 NoteList notes; | 231 NoteList notes; |
232 | 232 |
233 for (PointList::iterator pli = | 233 for (PointList::iterator pli = |