svgui  1.9
ItemEditDialog.h
Go to the documentation of this file.
00001 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*-  vi:set ts=8 sts=4 sw=4: */
00002 
00003 /*
00004     Sonic Visualiser
00005     An audio file viewer and annotation editor.
00006     Centre for Digital Music, Queen Mary, University of London.
00007     This file copyright 2006 Chris Cannam.
00008     
00009     This program is free software; you can redistribute it and/or
00010     modify it under the terms of the GNU General Public License as
00011     published by the Free Software Foundation; either version 2 of the
00012     License, or (at your option) any later version.  See the file
00013     COPYING included with this distribution for more information.
00014 */
00015 
00016 #ifndef _ITEM_EDIT_DIALOG_H_
00017 #define _ITEM_EDIT_DIALOG_H_
00018 
00019 #include <QDialog>
00020 #include <QString>
00021 
00022 #include "base/RealTime.h"
00023 
00024 class QSpinBox;
00025 class QDoubleSpinBox;
00026 class QLineEdit;
00027 
00028 class ItemEditDialog : public QDialog
00029 {
00030     Q_OBJECT
00031 
00032 public:
00033     enum {
00034         ShowTime       = 1 << 0,
00035         ShowDuration   = 1 << 1,
00036         ShowValue      = 1 << 2,
00037         ShowText       = 1 << 3
00038     };
00039 
00040     ItemEditDialog(int sampleRate, int options, QString valueUnits = "",
00041                    QWidget *parent = 0);
00042 
00043     void setFrameTime(int frame);
00044     int getFrameTime() const;
00045 
00046     void setRealTime(RealTime rt);
00047     RealTime getRealTime() const;
00048 
00049     void setFrameDuration(int frame);
00050     int getFrameDuration() const;
00051     
00052     void setRealDuration(RealTime rt);
00053     RealTime getRealDuration() const;
00054 
00055     void setValue(float value);
00056     float getValue() const;
00057 
00058     void setText(QString text);
00059     QString getText() const;
00060 
00061 protected slots:
00062     void frameTimeChanged(int);
00063     void realTimeSecsChanged(int);
00064     void realTimeUSecsChanged(int);
00065     void frameDurationChanged(int);
00066     void realDurationSecsChanged(int);
00067     void realDurationUSecsChanged(int);
00068     void valueChanged(double);
00069     void textChanged(QString);
00070     void reset();
00071 
00072 protected:
00073     int m_sampleRate;
00074     int m_defaultFrame;
00075     int m_defaultDuration;
00076     float m_defaultValue;
00077     QString m_defaultText;
00078     QSpinBox *m_frameTimeSpinBox;
00079     QSpinBox *m_realTimeSecsSpinBox;
00080     QSpinBox *m_realTimeUSecsSpinBox;
00081     QSpinBox *m_frameDurationSpinBox;
00082     QSpinBox *m_realDurationSecsSpinBox;
00083     QSpinBox *m_realDurationUSecsSpinBox;
00084     QDoubleSpinBox *m_valueSpinBox;
00085     QLineEdit *m_textField;
00086     QPushButton *m_resetButton;
00087 };
00088 
00089 #endif