annotate widgets/ItemEditDialog.h @ 854:c17719e488c9

Fix some potential null-pointer derefs, and simplify some logic where loops were used with an unconditional "break" that meant they could only happen once (from coverity scan)
author Chris Cannam
date Wed, 03 Sep 2014 12:04:22 +0100
parents e4773943c9c1
children e0f08e108064
rev   line source
Chris@70 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
Chris@70 2
Chris@70 3 /*
Chris@70 4 Sonic Visualiser
Chris@70 5 An audio file viewer and annotation editor.
Chris@70 6 Centre for Digital Music, Queen Mary, University of London.
Chris@70 7 This file copyright 2006 Chris Cannam.
Chris@70 8
Chris@70 9 This program is free software; you can redistribute it and/or
Chris@70 10 modify it under the terms of the GNU General Public License as
Chris@70 11 published by the Free Software Foundation; either version 2 of the
Chris@70 12 License, or (at your option) any later version. See the file
Chris@70 13 COPYING included with this distribution for more information.
Chris@70 14 */
Chris@70 15
Chris@70 16 #ifndef _ITEM_EDIT_DIALOG_H_
Chris@70 17 #define _ITEM_EDIT_DIALOG_H_
Chris@70 18
Chris@70 19 #include <QDialog>
Chris@70 20 #include <QString>
Chris@70 21
Chris@70 22 #include "base/RealTime.h"
Chris@70 23
Chris@73 24 class QSpinBox;
Chris@73 25 class QDoubleSpinBox;
Chris@73 26 class QLineEdit;
Chris@73 27
Chris@70 28 class ItemEditDialog : public QDialog
Chris@70 29 {
Chris@70 30 Q_OBJECT
Chris@70 31
Chris@70 32 public:
Chris@70 33 enum {
Chris@70 34 ShowTime = 1 << 0,
Chris@70 35 ShowDuration = 1 << 1,
Chris@70 36 ShowValue = 1 << 2,
Chris@70 37 ShowText = 1 << 3
Chris@70 38 };
Chris@70 39
Chris@807 40 ItemEditDialog(int sampleRate, int options, QString valueUnits = "",
Chris@73 41 QWidget *parent = 0);
Chris@70 42
Chris@807 43 void setFrameTime(int frame);
Chris@807 44 int getFrameTime() const;
Chris@70 45
Chris@70 46 void setRealTime(RealTime rt);
Chris@70 47 RealTime getRealTime() const;
Chris@70 48
Chris@807 49 void setFrameDuration(int frame);
Chris@807 50 int getFrameDuration() const;
Chris@70 51
Chris@70 52 void setRealDuration(RealTime rt);
Chris@70 53 RealTime getRealDuration() const;
Chris@70 54
Chris@70 55 void setValue(float value);
Chris@70 56 float getValue() const;
Chris@73 57
Chris@70 58 void setText(QString text);
Chris@70 59 QString getText() const;
Chris@70 60
Chris@70 61 protected slots:
Chris@73 62 void frameTimeChanged(int);
Chris@73 63 void realTimeSecsChanged(int);
Chris@73 64 void realTimeUSecsChanged(int);
Chris@73 65 void frameDurationChanged(int);
Chris@73 66 void realDurationSecsChanged(int);
Chris@73 67 void realDurationUSecsChanged(int);
Chris@70 68 void valueChanged(double);
Chris@70 69 void textChanged(QString);
Chris@73 70 void reset();
Chris@70 71
Chris@70 72 protected:
Chris@807 73 int m_sampleRate;
Chris@807 74 int m_defaultFrame;
Chris@807 75 int m_defaultDuration;
Chris@73 76 float m_defaultValue;
Chris@73 77 QString m_defaultText;
Chris@73 78 QSpinBox *m_frameTimeSpinBox;
Chris@73 79 QSpinBox *m_realTimeSecsSpinBox;
Chris@73 80 QSpinBox *m_realTimeUSecsSpinBox;
Chris@73 81 QSpinBox *m_frameDurationSpinBox;
Chris@73 82 QSpinBox *m_realDurationSecsSpinBox;
Chris@73 83 QSpinBox *m_realDurationUSecsSpinBox;
Chris@73 84 QDoubleSpinBox *m_valueSpinBox;
Chris@73 85 QLineEdit *m_textField;
Chris@73 86 QPushButton *m_resetButton;
Chris@70 87 };
Chris@70 88
Chris@70 89 #endif