Mercurial > hg > svcore
comparison data/model/SparseTimeValueModel.h @ 1599:ce185d4dd408 bqaudiostream
Merge from default branch
author | Chris Cannam |
---|---|
date | Wed, 23 Jan 2019 14:43:43 +0000 |
parents | ad5f892c0c4d |
children | 7a56bb85030f |
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_TIME_VALUE_MODEL_H_ | 16 #ifndef SV_SPARSE_TIME_VALUE_MODEL_H |
17 #define _SPARSE_TIME_VALUE_MODEL_H_ | 17 #define SV_SPARSE_TIME_VALUE_MODEL_H |
18 | 18 |
19 #include "SparseValueModel.h" | 19 #include "SparseValueModel.h" |
20 #include "base/PlayParameterRepository.h" | 20 #include "base/PlayParameterRepository.h" |
21 #include "base/RealTime.h" | 21 #include "base/RealTime.h" |
22 | 22 |
106 virtual ~SparseTimeValueModel() | 106 virtual ~SparseTimeValueModel() |
107 { | 107 { |
108 PlayParameterRepository::getInstance()->removePlayable(this); | 108 PlayParameterRepository::getInstance()->removePlayable(this); |
109 } | 109 } |
110 | 110 |
111 QString getTypeName() const { return tr("Sparse Time-Value"); } | 111 QString getTypeName() const override { return tr("Sparse Time-Value"); } |
112 | 112 |
113 virtual bool canPlay() const { return true; } | 113 bool canPlay() const override { return true; } |
114 virtual bool getDefaultPlayAudible() const { return false; } // user must unmute | 114 bool getDefaultPlayAudible() const override { return false; } // user must unmute |
115 | 115 |
116 /** | 116 /** |
117 * TabularModel methods. | 117 * TabularModel methods. |
118 */ | 118 */ |
119 | 119 |
120 virtual int getColumnCount() const | 120 int getColumnCount() const override |
121 { | 121 { |
122 return 4; | 122 return 4; |
123 } | 123 } |
124 | 124 |
125 virtual QString getHeading(int column) const | 125 QString getHeading(int column) const override |
126 { | 126 { |
127 switch (column) { | 127 switch (column) { |
128 case 0: return tr("Time"); | 128 case 0: return tr("Time"); |
129 case 1: return tr("Frame"); | 129 case 1: return tr("Frame"); |
130 case 2: return tr("Value"); | 130 case 2: return tr("Value"); |
131 case 3: return tr("Label"); | 131 case 3: return tr("Label"); |
132 default: return tr("Unknown"); | 132 default: return tr("Unknown"); |
133 } | 133 } |
134 } | 134 } |
135 | 135 |
136 virtual QVariant getData(int row, int column, int role) const | 136 QVariant getData(int row, int column, int role) const override |
137 { | 137 { |
138 if (column < 2) { | 138 if (column < 2) { |
139 return SparseValueModel<TimeValuePoint>::getData | 139 return SparseValueModel<TimeValuePoint>::getData |
140 (row, column, role); | 140 (row, column, role); |
141 } | 141 } |
150 case 3: return i->label; | 150 case 3: return i->label; |
151 default: return QVariant(); | 151 default: return QVariant(); |
152 } | 152 } |
153 } | 153 } |
154 | 154 |
155 virtual Command *getSetDataCommand(int row, int column, const QVariant &value, int role) | 155 Command *getSetDataCommand(int row, int column, const QVariant &value, int role) override |
156 { | 156 { |
157 if (column < 2) { | 157 if (column < 2) { |
158 return SparseValueModel<TimeValuePoint>::getSetDataCommand | 158 return SparseValueModel<TimeValuePoint>::getSetDataCommand |
159 (row, column, value, role); | 159 (row, column, value, role); |
160 } | 160 } |
174 | 174 |
175 command->addPoint(point); | 175 command->addPoint(point); |
176 return command->finish(); | 176 return command->finish(); |
177 } | 177 } |
178 | 178 |
179 virtual bool isColumnTimeValue(int column) const | 179 bool isColumnTimeValue(int column) const override |
180 { | 180 { |
181 return (column < 2); | 181 return (column < 2); |
182 } | 182 } |
183 | 183 |
184 virtual SortType getSortType(int column) const | 184 SortType getSortType(int column) const override |
185 { | 185 { |
186 if (column == 3) return SortAlphabetical; | 186 if (column == 3) return SortAlphabetical; |
187 return SortNumeric; | 187 return SortNumeric; |
188 } | 188 } |
189 }; | 189 }; |