annotate widgets/ItemEditDialog.h @ 1586:bbc3f537564c

Add context menu to Thumbwheel
author Chris Cannam
date Fri, 27 Mar 2020 11:04:56 +0000
parents 0fa49a6ce64f
children
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@1407 16 #ifndef SV_ITEM_EDIT_DIALOG_H
Chris@1407 17 #define SV_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@1515 37 ShowText = 1 << 3,
Chris@1515 38 ShowLevel = 1 << 4
Chris@70 39 };
Chris@70 40
Chris@1515 41 struct LabelOptions {
Chris@1515 42 LabelOptions();
Chris@1515 43 QString valueLabel;
Chris@1515 44 QString levelLabel;
Chris@1515 45 QString valueUnits;
Chris@1515 46 QString levelUnits;
Chris@1515 47 };
Chris@1515 48
Chris@1515 49 ItemEditDialog(sv_samplerate_t sampleRate,
Chris@1515 50 int options,
Chris@1515 51 LabelOptions labelOptions = {},
Chris@1515 52 QWidget *parent = 0);
Chris@1515 53
Chris@1515 54 ItemEditDialog(sv_samplerate_t sampleRate,
Chris@1515 55 int options,
Chris@1515 56 QString scaleUnits,
Chris@73 57 QWidget *parent = 0);
Chris@70 58
Chris@904 59 void setFrameTime(sv_frame_t frame);
Chris@904 60 sv_frame_t getFrameTime() const;
Chris@70 61
Chris@70 62 void setRealTime(RealTime rt);
Chris@70 63 RealTime getRealTime() const;
Chris@70 64
Chris@904 65 void setFrameDuration(sv_frame_t frame);
Chris@904 66 sv_frame_t getFrameDuration() const;
Chris@70 67
Chris@70 68 void setRealDuration(RealTime rt);
Chris@70 69 RealTime getRealDuration() const;
Chris@70 70
Chris@70 71 void setValue(float value);
Chris@70 72 float getValue() const;
Chris@73 73
Chris@1515 74 void setLevel(float level);
Chris@1515 75 float getLevel() const;
Chris@1515 76
Chris@70 77 void setText(QString text);
Chris@70 78 QString getText() const;
Chris@70 79
Chris@70 80 protected slots:
Chris@938 81 void frameTimeChanged(int); // must be int as invoked from int signal
Chris@73 82 void realTimeSecsChanged(int);
Chris@73 83 void realTimeUSecsChanged(int);
Chris@938 84 void frameDurationChanged(int); // must be int as invoked from int signal
Chris@73 85 void realDurationSecsChanged(int);
Chris@73 86 void realDurationUSecsChanged(int);
Chris@70 87 void valueChanged(double);
Chris@1515 88 void levelChanged(double);
Chris@70 89 void textChanged(QString);
Chris@73 90 void reset();
Chris@70 91
Chris@70 92 protected:
Chris@904 93 sv_samplerate_t m_sampleRate;
Chris@904 94 sv_frame_t m_defaultFrame;
Chris@904 95 sv_frame_t m_defaultDuration;
Chris@73 96 float m_defaultValue;
Chris@1515 97 float m_defaultLevel;
Chris@73 98 QString m_defaultText;
Chris@73 99 QSpinBox *m_frameTimeSpinBox;
Chris@73 100 QSpinBox *m_realTimeSecsSpinBox;
Chris@73 101 QSpinBox *m_realTimeUSecsSpinBox;
Chris@73 102 QSpinBox *m_frameDurationSpinBox;
Chris@73 103 QSpinBox *m_realDurationSecsSpinBox;
Chris@73 104 QSpinBox *m_realDurationUSecsSpinBox;
Chris@73 105 QDoubleSpinBox *m_valueSpinBox;
Chris@1515 106 QDoubleSpinBox *m_levelSpinBox;
Chris@73 107 QLineEdit *m_textField;
Chris@73 108 QPushButton *m_resetButton;
Chris@70 109 };
Chris@70 110
Chris@70 111 #endif