ItemEditDialog.h
Go to the documentation of this file.
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
2 
3 /*
4  Sonic Visualiser
5  An audio file viewer and annotation editor.
6  Centre for Digital Music, Queen Mary, University of London.
7  This file copyright 2006 Chris Cannam.
8 
9  This program is free software; you can redistribute it and/or
10  modify it under the terms of the GNU General Public License as
11  published by the Free Software Foundation; either version 2 of the
12  License, or (at your option) any later version. See the file
13  COPYING included with this distribution for more information.
14 */
15 
16 #ifndef SV_ITEM_EDIT_DIALOG_H
17 #define SV_ITEM_EDIT_DIALOG_H
18 
19 #include <QDialog>
20 #include <QString>
21 
22 #include "base/RealTime.h"
23 
24 class QSpinBox;
25 class QDoubleSpinBox;
26 class QLineEdit;
27 
28 class ItemEditDialog : public QDialog
29 {
30  Q_OBJECT
31 
32 public:
33  enum {
34  ShowTime = 1 << 0,
35  ShowDuration = 1 << 1,
36  ShowValue = 1 << 2,
37  ShowText = 1 << 3,
38  ShowLevel = 1 << 4
39  };
40 
41  struct LabelOptions {
42  LabelOptions();
43  QString valueLabel;
44  QString levelLabel;
45  QString valueUnits;
46  QString levelUnits;
47  };
48 
49  ItemEditDialog(sv_samplerate_t sampleRate,
50  int options,
51  LabelOptions labelOptions = {},
52  QWidget *parent = 0);
53 
54  ItemEditDialog(sv_samplerate_t sampleRate,
55  int options,
56  QString scaleUnits,
57  QWidget *parent = 0);
58 
59  void setFrameTime(sv_frame_t frame);
60  sv_frame_t getFrameTime() const;
61 
62  void setRealTime(RealTime rt);
63  RealTime getRealTime() const;
64 
65  void setFrameDuration(sv_frame_t frame);
66  sv_frame_t getFrameDuration() const;
67 
68  void setRealDuration(RealTime rt);
69  RealTime getRealDuration() const;
70 
71  void setValue(float value);
72  float getValue() const;
73 
74  void setLevel(float level);
75  float getLevel() const;
76 
77  void setText(QString text);
78  QString getText() const;
79 
80 protected slots:
81  void frameTimeChanged(int); // must be int as invoked from int signal
82  void realTimeSecsChanged(int);
83  void realTimeUSecsChanged(int);
84  void frameDurationChanged(int); // must be int as invoked from int signal
85  void realDurationSecsChanged(int);
86  void realDurationUSecsChanged(int);
87  void valueChanged(double);
88  void levelChanged(double);
89  void textChanged(QString);
90  void reset();
91 
92 protected:
93  sv_samplerate_t m_sampleRate;
94  sv_frame_t m_defaultFrame;
95  sv_frame_t m_defaultDuration;
98  QString m_defaultText;
99  QSpinBox *m_frameTimeSpinBox;
105  QDoubleSpinBox *m_valueSpinBox;
106  QDoubleSpinBox *m_levelSpinBox;
107  QLineEdit *m_textField;
108  QPushButton *m_resetButton;
109 };
110 
111 #endif
RealTime getRealDuration() const
float getValue() const
QSpinBox * m_realDurationSecsSpinBox
QSpinBox * m_frameTimeSpinBox
void levelChanged(double)
void valueChanged(double)
void setFrameDuration(sv_frame_t frame)
sv_samplerate_t m_sampleRate
void frameDurationChanged(int)
void realDurationUSecsChanged(int)
QString m_defaultText
QSpinBox * m_realTimeUSecsSpinBox
sv_frame_t m_defaultDuration
QSpinBox * m_realTimeSecsSpinBox
void setFrameTime(sv_frame_t frame)
sv_frame_t getFrameTime() const
void setText(QString text)
RealTime getRealTime() const
QLineEdit * m_textField
void setRealDuration(RealTime rt)
void realTimeUSecsChanged(int)
QDoubleSpinBox * m_valueSpinBox
QPushButton * m_resetButton
QSpinBox * m_frameDurationSpinBox
sv_frame_t m_defaultFrame
void realDurationSecsChanged(int)
ItemEditDialog(sv_samplerate_t sampleRate, int options, LabelOptions labelOptions={}, QWidget *parent=0)
void setRealTime(RealTime rt)
QString getText() const
void frameTimeChanged(int)
void textChanged(QString)
float getLevel() const
QSpinBox * m_realDurationUSecsSpinBox
QDoubleSpinBox * m_levelSpinBox
void setLevel(float level)
sv_frame_t getFrameDuration() const
void realTimeSecsChanged(int)
void setValue(float value)