diff options
Diffstat (limited to 'src/gui_class.h')
-rw-r--r-- | src/gui_class.h | 217 |
1 files changed, 217 insertions, 0 deletions
diff --git a/src/gui_class.h b/src/gui_class.h new file mode 100644 index 0000000..2b17ff3 --- /dev/null +++ b/src/gui_class.h @@ -0,0 +1,217 @@ +#ifndef GUI_CLASS__H +#define GUI_CLASS__H + +#include <cmath> +#include <vector> +#include <valarray> +#include <QApplication> +#include <QTextEdit> +#include <QtGui> +#include <QLabel> + +#include <qwt_plot.h> +#include <qwt_plot_curve.h> +#include <qwt_plot_grid.h> + +#include <QDoubleSpinBox> +#include <QGroupBox> +#include <QGridLayout> +#include <QPushButton> + +class myWindow; // forward reference +class indicator; + +//////////////////////////////////////// +class myPlot : public QwtPlot { +public: + std::vector<QwtPlotCurve*> curve; + QwtPlotGrid grid; + int divsPerUnit; + int need_replot; + + myPlot(const QString); +// the following could be a slot, but doesn't need to be + void setReading(const int, const double, const double, + const double, const double); + int assign_curve(); + void flush(); +}; + +//////////////////////////////////////// +class scaleBoxer : public QDoubleSpinBox { +public: + indicator* parent; + virtual void stepBy(int); + + scaleBoxer(indicator* parent); +}; + +//////////////////////////////////////// +class indicator : public QWidget { + + Q_OBJECT; + +// Note: Q_SLOTS is #defined to be nothing. +// Slots are handlers for inbound signals. +public Q_SLOTS: + void setIndication(const double, const double, const double, const double); + +public: + QGroupBox* group; + QGridLayout* layout; + QLabel* rpLabel; + QDoubleSpinBox* rpBox; + QLabel* ipLabel; + QDoubleSpinBox* ipBox; + QLabel* magLabel; + QDoubleSpinBox* magBox; + QLabel* phaseLabel; + QDoubleSpinBox* phaseBox; + QLabel* scaleLabel; + scaleBoxer* scaleBox; + myPlot* plot; + int plotcur; // which "curve" to use within the plot + int locker; + + indicator(myPlot* plot, int locker = 0); + void setDecim(const double newval); +}; + +//////////////////////////////////////// +class blockOfIndicators : public QWidget { +public: + QGroupBox* group; + QVBoxLayout* layout; + + blockOfIndicators(myWindow*, myPlot*); +}; + +//////////////////////////////////////// +class rslt_panel : public QWidget { +public: + myWindow* topWin; + QGroupBox* group; + QHBoxLayout* layout; + blockOfIndicators* block; + myPlot* plot; + + rslt_panel(myWindow*); +}; + +//////////////////////////////////////// +class entrails_grouper : public QWidget { + + Q_OBJECT + +public Q_SLOTS: + void VoChanged(double); + void ViChanged(double); + void rateChanged(double); + void timeShiftChanged(double); + void phaseShiftChanged(double); + void tweakButtonClicked(); + +public: + myWindow* topwin; + QGroupBox* group; + QVBoxLayout* layout; + + QLabel* VoCalLabel; + QDoubleSpinBox* VoCalBox; + QLabel* ViCalLabel; + QDoubleSpinBox* ViCalBox; + + QLabel* rateLabel; + QDoubleSpinBox* rateBox; // goal rate + + QLabel* actRateLabel; + QDoubleSpinBox* actRateBox; // actual rate + QLabel* pcmLabel; + QDoubleSpinBox* pcmBox; + QLabel* timeShiftLabel; + QDoubleSpinBox* timeShiftBox; // loopback time delay + QLabel* phaseShiftLabel; + QDoubleSpinBox* phaseShiftBox; // loopback phase lag + QPushButton* tweakButton; + + static const int tweakSize = 10; + std::valarray<double> tweakFreq; + std::valarray<double> tweakPhase; + unsigned int tweakPtr; + unsigned int howmany; + + entrails_grouper(myWindow*); +}; + +//////////////////////////////////////// +class refOut_grouper : public QWidget { + Q_OBJECT + +public Q_SLOTS: + void freqChanged(double); + void ampChanged(double); + +public: + myWindow* topwin; + QGroupBox* group; + QVBoxLayout* layout; + QLabel* freqLabel; + QDoubleSpinBox* freqBox; // goal frequency + QLabel* actFreqLabel; + QDoubleSpinBox* actFreqBox; // actual frequency + QLabel* dBLabel; + QDoubleSpinBox* dBBox; // amplitude in dB + QLabel* VLabel; + QDoubleSpinBox* VBox; // amplitude in V + + refOut_grouper(myWindow*); +}; + +//////////////////////////////////////// +class ctrl_column : public QWidget { + Q_OBJECT; +public: + QGroupBox* group; + QVBoxLayout* layout; + refOut_grouper* refOutGroup; + entrails_grouper* entrailsGroup; + + ctrl_column(myWindow* _parent); +// hack +// something trivial we can instantiate, to persuade the compiler to +// instantiate (emit) "vtables" for everything in this file: + ctrl_column(int){}; +}; + +////////////////////////////////////// + +class timer : public QWidget{ +public: + timer(QWidget *parent = 0); + void timerEvent(QTimerEvent *event); +}; + +//////////////////////////////////////// +class myWindow : public QWidget { + Q_OBJECT + +public: + myWindow(); + QHBoxLayout* topLayout; + + QDoubleSpinBox* updRateBox; + QLabel* updRateLabel; + + static const int numRsltPanels = 1; + ctrl_column* ctrlCol; + rslt_panel* rsltPanel[numRsltPanels]; + std::vector<indicator*> ndc8r; + timer* frameTimer; + + void actualFreqs(); + +public slots: + void flush(); +}; + +#endif /* GUI_CLASS__H */ |