Chris@70: /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*-  vi:set ts=8 sts=4 sw=4: */
Chris@70: 
Chris@70: /*
Chris@70:     Sonic Visualiser
Chris@70:     An audio file viewer and annotation editor.
Chris@70:     Centre for Digital Music, Queen Mary, University of London.
Chris@70:     This file copyright 2006 Chris Cannam.
Chris@70:     
Chris@70:     This program is free software; you can redistribute it and/or
Chris@70:     modify it under the terms of the GNU General Public License as
Chris@70:     published by the Free Software Foundation; either version 2 of the
Chris@70:     License, or (at your option) any later version.  See the file
Chris@70:     COPYING included with this distribution for more information.
Chris@70: */
Chris@70: 
Chris@70: #ifndef _ITEM_EDIT_DIALOG_H_
Chris@70: #define _ITEM_EDIT_DIALOG_H_
Chris@70: 
Chris@70: #include <QDialog>
Chris@70: #include <QString>
Chris@70: 
Chris@70: #include "base/RealTime.h"
Chris@70: 
Chris@73: class QSpinBox;
Chris@73: class QDoubleSpinBox;
Chris@73: class QLineEdit;
Chris@73: 
Chris@70: class ItemEditDialog : public QDialog
Chris@70: {
Chris@70:     Q_OBJECT
Chris@70: 
Chris@70: public:
Chris@70:     enum {
Chris@70:         ShowTime       = 1 << 0,
Chris@70:         ShowDuration   = 1 << 1,
Chris@70:         ShowValue      = 1 << 2,
Chris@70:         ShowText       = 1 << 3
Chris@70:     };
Chris@70: 
Chris@73:     ItemEditDialog(size_t sampleRate, int options, QString valueUnits = "",
Chris@73:                    QWidget *parent = 0);
Chris@70: 
Chris@70:     void setFrameTime(long frame);
Chris@70:     long getFrameTime() const;
Chris@70: 
Chris@70:     void setRealTime(RealTime rt);
Chris@70:     RealTime getRealTime() const;
Chris@70: 
Chris@70:     void setFrameDuration(long frame);
Chris@70:     long getFrameDuration() const;
Chris@70:     
Chris@70:     void setRealDuration(RealTime rt);
Chris@70:     RealTime getRealDuration() const;
Chris@70: 
Chris@70:     void setValue(float value);
Chris@70:     float getValue() const;
Chris@73: 
Chris@70:     void setText(QString text);
Chris@70:     QString getText() const;
Chris@70: 
Chris@70: protected slots:
Chris@73:     void frameTimeChanged(int);
Chris@73:     void realTimeSecsChanged(int);
Chris@73:     void realTimeUSecsChanged(int);
Chris@73:     void frameDurationChanged(int);
Chris@73:     void realDurationSecsChanged(int);
Chris@73:     void realDurationUSecsChanged(int);
Chris@70:     void valueChanged(double);
Chris@70:     void textChanged(QString);
Chris@73:     void reset();
Chris@70: 
Chris@70: protected:
Chris@70:     size_t m_sampleRate;
Chris@73:     long m_defaultFrame;
Chris@73:     long m_defaultDuration;
Chris@73:     float m_defaultValue;
Chris@73:     QString m_defaultText;
Chris@73:     QSpinBox *m_frameTimeSpinBox;
Chris@73:     QSpinBox *m_realTimeSecsSpinBox;
Chris@73:     QSpinBox *m_realTimeUSecsSpinBox;
Chris@73:     QSpinBox *m_frameDurationSpinBox;
Chris@73:     QSpinBox *m_realDurationSecsSpinBox;
Chris@73:     QSpinBox *m_realDurationUSecsSpinBox;
Chris@73:     QDoubleSpinBox *m_valueSpinBox;
Chris@73:     QLineEdit *m_textField;
Chris@73:     QPushButton *m_resetButton;
Chris@70: };
Chris@70: 
Chris@70: #endif