Mercurial > hg > svgui
comparison widgets/ItemEditDialog.cpp @ 946:36cddc3de023 alignment_view
Merge from default branch
author | Chris Cannam |
---|---|
date | Mon, 20 Apr 2015 09:19:52 +0100 |
parents | 2564d0865feb |
children | c8a6fd3f9dff |
comparison
equal
deleted
inserted
replaced
897:499b637f2a26 | 946:36cddc3de023 |
---|---|
26 #include <QDialogButtonBox> | 26 #include <QDialogButtonBox> |
27 | 27 |
28 #include <float.h> // for FLT_MIN/MAX | 28 #include <float.h> // for FLT_MIN/MAX |
29 | 29 |
30 | 30 |
31 ItemEditDialog::ItemEditDialog(int sampleRate, int options, | 31 ItemEditDialog::ItemEditDialog(sv_samplerate_t sampleRate, int options, |
32 QString valueUnits, QWidget *parent) : | 32 QString valueUnits, QWidget *parent) : |
33 QDialog(parent), | 33 QDialog(parent), |
34 m_sampleRate(sampleRate), | 34 m_sampleRate(sampleRate), |
35 m_defaultFrame(0), | 35 m_defaultFrame(0), |
36 m_defaultDuration(0), | 36 m_defaultDuration(0), |
191 connect(cancel, SIGNAL(clicked()), this, SLOT(reject())); | 191 connect(cancel, SIGNAL(clicked()), this, SLOT(reject())); |
192 m_resetButton->setEnabled(false); | 192 m_resetButton->setEnabled(false); |
193 } | 193 } |
194 | 194 |
195 void | 195 void |
196 ItemEditDialog::setFrameTime(int frame) | 196 ItemEditDialog::setFrameTime(sv_frame_t frame) |
197 { | 197 { |
198 if (!m_frameTimeSpinBox) return; | 198 if (!m_frameTimeSpinBox) return; |
199 | 199 |
200 RealTime rt(RealTime::frame2RealTime(frame, m_sampleRate)); | 200 RealTime rt(RealTime::frame2RealTime(frame, m_sampleRate)); |
201 m_realTimeSecsSpinBox->setValue(rt.sec); | 201 m_realTimeSecsSpinBox->setValue(rt.sec); |
202 m_realTimeUSecsSpinBox->setValue(rt.usec()); | 202 m_realTimeUSecsSpinBox->setValue(rt.usec()); |
203 m_frameTimeSpinBox->setValue(frame); | 203 m_frameTimeSpinBox->setValue(int(frame)); |
204 m_defaultFrame = frame; | 204 m_defaultFrame = frame; |
205 m_resetButton->setEnabled(false); | 205 m_resetButton->setEnabled(false); |
206 } | 206 } |
207 | 207 |
208 int | 208 sv_frame_t |
209 ItemEditDialog::getFrameTime() const | 209 ItemEditDialog::getFrameTime() const |
210 { | 210 { |
211 return m_frameTimeSpinBox->value(); | 211 return m_frameTimeSpinBox->value(); |
212 } | 212 } |
213 | 213 |
222 { | 222 { |
223 return RealTime::frame2RealTime(getFrameTime(), m_sampleRate); | 223 return RealTime::frame2RealTime(getFrameTime(), m_sampleRate); |
224 } | 224 } |
225 | 225 |
226 void | 226 void |
227 ItemEditDialog::setFrameDuration(int duration) | 227 ItemEditDialog::setFrameDuration(sv_frame_t duration) |
228 { | 228 { |
229 if (!m_frameDurationSpinBox) return; | 229 if (!m_frameDurationSpinBox) return; |
230 | 230 |
231 RealTime rt(RealTime::frame2RealTime(duration, m_sampleRate)); | 231 RealTime rt(RealTime::frame2RealTime(duration, m_sampleRate)); |
232 m_realDurationSecsSpinBox->setValue(rt.sec); | 232 m_realDurationSecsSpinBox->setValue(rt.sec); |
233 m_realDurationUSecsSpinBox->setValue(rt.usec()); | 233 m_realDurationUSecsSpinBox->setValue(rt.usec()); |
234 m_frameDurationSpinBox->setValue(duration); | 234 m_frameDurationSpinBox->setValue(int(duration)); |
235 m_defaultDuration = duration; | 235 m_defaultDuration = duration; |
236 m_resetButton->setEnabled(false); | 236 m_resetButton->setEnabled(false); |
237 } | 237 } |
238 | 238 |
239 int | 239 sv_frame_t |
240 ItemEditDialog::getFrameDuration() const | 240 ItemEditDialog::getFrameDuration() const |
241 { | 241 { |
242 return m_frameDurationSpinBox->value(); | 242 return m_frameDurationSpinBox->value(); |
243 } | 243 } |
244 | 244 |
265 } | 265 } |
266 | 266 |
267 float | 267 float |
268 ItemEditDialog::getValue() const | 268 ItemEditDialog::getValue() const |
269 { | 269 { |
270 return m_valueSpinBox->value(); | 270 return float(m_valueSpinBox->value()); |
271 } | 271 } |
272 | 272 |
273 void | 273 void |
274 ItemEditDialog::setText(QString text) | 274 ItemEditDialog::setText(QString text) |
275 { | 275 { |
304 void | 304 void |
305 ItemEditDialog::realTimeSecsChanged(int i) | 305 ItemEditDialog::realTimeSecsChanged(int i) |
306 { | 306 { |
307 RealTime rt = getRealTime(); | 307 RealTime rt = getRealTime(); |
308 rt.sec = i; | 308 rt.sec = i; |
309 int frame = RealTime::realTime2Frame(rt, m_sampleRate); | 309 sv_frame_t frame = RealTime::realTime2Frame(rt, m_sampleRate); |
310 m_frameTimeSpinBox->setValue(frame); | 310 m_frameTimeSpinBox->setValue(int(frame)); |
311 m_resetButton->setEnabled(true); | 311 m_resetButton->setEnabled(true); |
312 } | 312 } |
313 | 313 |
314 void | 314 void |
315 ItemEditDialog::realTimeUSecsChanged(int i) | 315 ItemEditDialog::realTimeUSecsChanged(int i) |
316 { | 316 { |
317 RealTime rt = getRealTime(); | 317 RealTime rt = getRealTime(); |
318 rt.nsec = i * 1000; | 318 rt.nsec = i * 1000; |
319 int frame = RealTime::realTime2Frame(rt, m_sampleRate); | 319 sv_frame_t frame = RealTime::realTime2Frame(rt, m_sampleRate); |
320 m_frameTimeSpinBox->setValue(frame); | 320 m_frameTimeSpinBox->setValue(int(frame)); |
321 m_resetButton->setEnabled(true); | 321 m_resetButton->setEnabled(true); |
322 } | 322 } |
323 | 323 |
324 void | 324 void |
325 ItemEditDialog::frameDurationChanged(int i) | 325 ItemEditDialog::frameDurationChanged(int i) |
339 void | 339 void |
340 ItemEditDialog::realDurationSecsChanged(int i) | 340 ItemEditDialog::realDurationSecsChanged(int i) |
341 { | 341 { |
342 RealTime rt = getRealDuration(); | 342 RealTime rt = getRealDuration(); |
343 rt.sec = i; | 343 rt.sec = i; |
344 int frame = RealTime::realTime2Frame(rt, m_sampleRate); | 344 sv_frame_t frame = RealTime::realTime2Frame(rt, m_sampleRate); |
345 m_frameDurationSpinBox->setValue(frame); | 345 m_frameDurationSpinBox->setValue(int(frame)); |
346 m_resetButton->setEnabled(true); | 346 m_resetButton->setEnabled(true); |
347 } | 347 } |
348 | 348 |
349 void | 349 void |
350 ItemEditDialog::realDurationUSecsChanged(int i) | 350 ItemEditDialog::realDurationUSecsChanged(int i) |
351 { | 351 { |
352 RealTime rt = getRealDuration(); | 352 RealTime rt = getRealDuration(); |
353 rt.nsec = i * 1000; | 353 rt.nsec = i * 1000; |
354 int frame = RealTime::realTime2Frame(rt, m_sampleRate); | 354 sv_frame_t frame = RealTime::realTime2Frame(rt, m_sampleRate); |
355 m_frameDurationSpinBox->setValue(frame); | 355 m_frameDurationSpinBox->setValue(int(frame)); |
356 m_resetButton->setEnabled(true); | 356 m_resetButton->setEnabled(true); |
357 } | 357 } |
358 | 358 |
359 void | 359 void |
360 ItemEditDialog::valueChanged(double) | 360 ItemEditDialog::valueChanged(double) |