comparison data/model/SparseTimeValueModel.h @ 423:6a96bff0bd59

* Update translations, and add change counter to name of bundle command
author Chris Cannam
date Thu, 12 Jun 2008 10:47:11 +0000
parents 4caa28a0a8a2
children eafef13bb0b3
comparison
equal deleted inserted replaced
422:4caa28a0a8a2 423:6a96bff0bd59
75 }; 75 };
76 76
77 77
78 class SparseTimeValueModel : public SparseValueModel<TimeValuePoint> 78 class SparseTimeValueModel : public SparseValueModel<TimeValuePoint>
79 { 79 {
80 Q_OBJECT
81
80 public: 82 public:
81 SparseTimeValueModel(size_t sampleRate, size_t resolution, 83 SparseTimeValueModel(size_t sampleRate, size_t resolution,
82 bool notifyOnAdd = true) : 84 bool notifyOnAdd = true) :
83 SparseValueModel<TimeValuePoint>(sampleRate, resolution, 85 SparseValueModel<TimeValuePoint>(sampleRate, resolution,
84 notifyOnAdd) 86 notifyOnAdd)
141 } 143 }
142 } 144 }
143 145
144 virtual Command *getSetDataCommand(int row, int column, const QVariant &value, int role) const 146 virtual Command *getSetDataCommand(int row, int column, const QVariant &value, int role) const
145 { 147 {
146 std::cerr << "SparseTimeValueModel::setData: row = " << row << ", column = " << column << ", role = " << role << std::endl;
147
148 if (role != Qt::EditRole) return false; 148 if (role != Qt::EditRole) return false;
149 PointListIterator i = getPointListIteratorForRow(row); 149 PointListIterator i = getPointListIteratorForRow(row);
150 if (i == m_points.end()) { 150 if (i == m_points.end()) {
151 std::cerr << "Failed to find point iterator for row " << row << std::endl; 151 std::cerr << "Failed to find point iterator for row " << row << std::endl;
152 return false; 152 return false;
157 command->deletePoint(point); 157 command->deletePoint(point);
158 158
159 switch (column) { 159 switch (column) {
160 case 0: break; 160 case 0: break;
161 case 1: break; 161 case 1: break;
162 case 2: point.value = value.toDouble(); 162 case 2: point.value = value.toDouble(); break;
163 std::cerr << "setting value of point at " << point.frame << " to " << point.value << std::endl;
164 break;
165 case 3: point.label = value.toString(); break; 163 case 3: point.label = value.toString(); break;
166 } 164 }
167 165
168 command->addPoint(point); 166 command->addPoint(point);
169 return command->finish(); 167 return command->finish();