Chris@885: /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*-  vi:set ts=8 sts=4 sw=4: */
Chris@885: 
Chris@885: /*
Chris@885:     Sonic Visualiser
Chris@885:     An audio file viewer and annotation editor.
Chris@885:     Centre for Digital Music, Queen Mary, University of London.
Chris@885:     
Chris@885:     This program is free software; you can redistribute it and/or
Chris@885:     modify it under the terms of the GNU General Public License as
Chris@885:     published by the Free Software Foundation; either version 2 of the
Chris@885:     License, or (at your option) any later version.  See the file
Chris@885:     COPYING included with this distribution for more information.
Chris@885: */
Chris@885: 
Chris@885: #ifndef UNIT_CONVERTER_H
Chris@885: #define UNIT_CONVERTER_H
Chris@885: 
Chris@885: #include <QDialog>
Chris@885: 
Chris@891: #include "base/PropertyContainer.h"
Chris@891: 
Chris@885: class QSpinBox;
Chris@885: class QDoubleSpinBox;
Chris@885: class QComboBox;
Chris@891: class QLabel;
Chris@885: 
Chris@885: class UnitConverter : public QDialog
Chris@885: {
Chris@885:     Q_OBJECT
Chris@885: 
Chris@885: public:
Chris@885:     UnitConverter(QWidget *parent = 0);
Chris@885:     virtual ~UnitConverter();
Chris@885: 
Chris@885: private slots:
Chris@893:     void freqChanged();
Chris@893:     void midiChanged();
Chris@893:     void noteChanged();
Chris@893:     void octaveChanged();
Chris@893:     void centsChanged();
Chris@889: 
Chris@893:     void samplesChanged();
Chris@893:     void periodChanged();
Chris@893:     void bpmChanged();
Chris@893:     void tempofreqChanged();
Chris@893:     void samplerateChanged();
Chris@892:     
Chris@891:     void preferenceChanged(PropertyContainer::PropertyName);
Chris@885:     
Chris@885: private:
Chris@889:     QDoubleSpinBox *m_freq;
Chris@885:     QSpinBox *m_midi;
Chris@885:     QComboBox *m_note;
Chris@885:     QSpinBox *m_octave;
Chris@885:     QDoubleSpinBox *m_cents;
Chris@891:     QLabel *m_pitchPrefsLabel;
Chris@891:     void updatePitchesFromFreq();
Chris@891:     void updatePitchPrefsLabel();
Chris@885: 
Chris@891:     QDoubleSpinBox *m_samples;
Chris@892:     QDoubleSpinBox *m_period;
Chris@892:     QDoubleSpinBox *m_bpm;
Chris@892:     QDoubleSpinBox *m_tempofreq;
Chris@892:     QComboBox *m_samplerate;
Chris@891:     void updateTempiFromSamples();
Chris@892: 
Chris@892:     double getSampleRate();
Chris@893: 
Chris@893:     void setTo(QSpinBox *, int);
Chris@893:     void setTo(QDoubleSpinBox *, double);
Chris@885: };
Chris@885: 
Chris@885: #endif