Mercurial > hg > svcore
comparison data/model/SparseOneDimensionalModel.h @ 1599:ce185d4dd408 bqaudiostream
Merge from default branch
author | Chris Cannam |
---|---|
date | Wed, 23 Jan 2019 14:43:43 +0000 |
parents | ad5f892c0c4d |
children | 560453546749 |
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 _SPARSE_ONE_DIMENSIONAL_MODEL_H_ | 16 #ifndef SV_SPARSE_ONE_DIMENSIONAL_MODEL_H |
17 #define _SPARSE_ONE_DIMENSIONAL_MODEL_H_ | 17 #define SV_SPARSE_ONE_DIMENSIONAL_MODEL_H |
18 | 18 |
19 #include "SparseModel.h" | 19 #include "SparseModel.h" |
20 #include "NoteData.h" | 20 #include "NoteData.h" |
21 #include "base/PlayParameterRepository.h" | 21 #include "base/PlayParameterRepository.h" |
22 #include "base/RealTime.h" | 22 #include "base/RealTime.h" |
86 virtual ~SparseOneDimensionalModel() | 86 virtual ~SparseOneDimensionalModel() |
87 { | 87 { |
88 PlayParameterRepository::getInstance()->removePlayable(this); | 88 PlayParameterRepository::getInstance()->removePlayable(this); |
89 } | 89 } |
90 | 90 |
91 virtual bool canPlay() const { return true; } | 91 bool canPlay() const override { return true; } |
92 | 92 |
93 virtual QString getDefaultPlayClipId() const | 93 QString getDefaultPlayClipId() const override |
94 { | 94 { |
95 return "tap"; | 95 return "tap"; |
96 } | 96 } |
97 | 97 |
98 int getIndexOf(const Point &point) | 98 int getIndexOf(const Point &point) |
105 if (!comparator(*j, point) && !comparator(point, *j)) return i; | 105 if (!comparator(*j, point) && !comparator(point, *j)) return i; |
106 } | 106 } |
107 return -1; | 107 return -1; |
108 } | 108 } |
109 | 109 |
110 QString getTypeName() const { return tr("Sparse 1-D"); } | 110 QString getTypeName() const override { return tr("Sparse 1-D"); } |
111 | 111 |
112 /** | 112 /** |
113 * TabularModel methods. | 113 * TabularModel methods. |
114 */ | 114 */ |
115 | 115 |
116 virtual int getColumnCount() const | 116 int getColumnCount() const override |
117 { | 117 { |
118 return 3; | 118 return 3; |
119 } | 119 } |
120 | 120 |
121 virtual QString getHeading(int column) const | 121 QString getHeading(int column) const override |
122 { | 122 { |
123 switch (column) { | 123 switch (column) { |
124 case 0: return tr("Time"); | 124 case 0: return tr("Time"); |
125 case 1: return tr("Frame"); | 125 case 1: return tr("Frame"); |
126 case 2: return tr("Label"); | 126 case 2: return tr("Label"); |
127 default: return tr("Unknown"); | 127 default: return tr("Unknown"); |
128 } | 128 } |
129 } | 129 } |
130 | 130 |
131 virtual QVariant getData(int row, int column, int role) const | 131 QVariant getData(int row, int column, int role) const override |
132 { | 132 { |
133 if (column < 2) { | 133 if (column < 2) { |
134 return SparseModel<OneDimensionalPoint>::getData | 134 return SparseModel<OneDimensionalPoint>::getData |
135 (row, column, role); | 135 (row, column, role); |
136 } | 136 } |
142 case 2: return i->label; | 142 case 2: return i->label; |
143 default: return QVariant(); | 143 default: return QVariant(); |
144 } | 144 } |
145 } | 145 } |
146 | 146 |
147 virtual Command *getSetDataCommand(int row, int column, const QVariant &value, int role) | 147 Command *getSetDataCommand(int row, int column, const QVariant &value, int role) override |
148 { | 148 { |
149 if (column < 2) { | 149 if (column < 2) { |
150 return SparseModel<OneDimensionalPoint>::getSetDataCommand | 150 return SparseModel<OneDimensionalPoint>::getSetDataCommand |
151 (row, column, value, role); | 151 (row, column, value, role); |
152 } | 152 } |
166 command->addPoint(point); | 166 command->addPoint(point); |
167 return command->finish(); | 167 return command->finish(); |
168 } | 168 } |
169 | 169 |
170 | 170 |
171 virtual bool isColumnTimeValue(int column) const | 171 bool isColumnTimeValue(int column) const override |
172 { | 172 { |
173 return (column < 2); | 173 return (column < 2); |
174 } | 174 } |
175 | 175 |
176 virtual SortType getSortType(int column) const | 176 SortType getSortType(int column) const override |
177 { | 177 { |
178 if (column == 2) return SortAlphabetical; | 178 if (column == 2) return SortAlphabetical; |
179 return SortNumeric; | 179 return SortNumeric; |
180 } | 180 } |
181 | 181 |
182 /** | 182 /** |
183 * NoteExportable methods. | 183 * NoteExportable methods. |
184 */ | 184 */ |
185 | 185 |
186 NoteList getNotes() const { | 186 NoteList getNotes() const override { |
187 return getNotesWithin(getStartFrame(), getEndFrame()); | 187 return getNotesWithin(getStartFrame(), getEndFrame()); |
188 } | 188 } |
189 | 189 |
190 NoteList getNotesWithin(sv_frame_t startFrame, sv_frame_t endFrame) const { | 190 NoteList getNotesWithin(sv_frame_t startFrame, sv_frame_t endFrame) const override { |
191 | 191 |
192 PointList points = getPoints(startFrame, endFrame); | 192 PointList points = getPoints(startFrame, endFrame); |
193 NoteList notes; | 193 NoteList notes; |
194 | 194 |
195 for (PointList::iterator pli = | 195 for (PointList::iterator pli = |