2021-02-24 08:18:19 +00:00
|
|
|
#ifndef METER_H
|
|
|
|
#define METER_H
|
|
|
|
|
|
|
|
#include <QWidget>
|
|
|
|
#include <QPainter>
|
2021-07-18 21:27:21 +00:00
|
|
|
#include <vector>
|
|
|
|
#include <algorithm>
|
|
|
|
#include <numeric>
|
2021-07-20 06:46:11 +00:00
|
|
|
#include <cmath>
|
2021-02-24 08:18:19 +00:00
|
|
|
|
2021-07-17 00:45:07 +00:00
|
|
|
#include "rigcommander.h" // for meter types
|
|
|
|
|
2021-02-24 08:18:19 +00:00
|
|
|
class meter : public QWidget
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
explicit meter(QWidget *parent = nullptr);
|
|
|
|
|
|
|
|
signals:
|
|
|
|
|
|
|
|
public slots:
|
|
|
|
void paintEvent(QPaintEvent *);
|
|
|
|
|
|
|
|
void updateDrawing(int num);
|
|
|
|
void setLevels(int current, int peak, int average);
|
2021-07-19 23:56:04 +00:00
|
|
|
void setLevel(int current);
|
2021-08-21 05:19:47 +00:00
|
|
|
void clearMeterOnPTTtoggle();
|
|
|
|
void clearMeter();
|
2021-07-17 00:45:07 +00:00
|
|
|
void setMeterType(meterKind type);
|
2021-07-20 06:46:11 +00:00
|
|
|
void setMeterShortString(QString);
|
|
|
|
QString getMeterShortString();
|
2021-07-18 06:39:40 +00:00
|
|
|
meterKind getMeterType();
|
2021-02-24 08:18:19 +00:00
|
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
//QPainter painter;
|
2021-07-17 00:45:07 +00:00
|
|
|
meterKind meterType;
|
2021-07-20 06:46:11 +00:00
|
|
|
QString meterShortString;
|
|
|
|
int fontSize = 10;
|
2021-02-24 08:18:19 +00:00
|
|
|
int length=30;
|
|
|
|
int current=0;
|
|
|
|
int peak = 0;
|
|
|
|
int average = 0;
|
|
|
|
|
2021-07-18 21:27:21 +00:00
|
|
|
int averageBalisticLength = 30;
|
|
|
|
int peakBalisticLength = 30;
|
|
|
|
int avgPosition=0;
|
|
|
|
int peakPosition=0;
|
|
|
|
std::vector<unsigned char> avgLevels;
|
|
|
|
std::vector<unsigned char> peakLevels;
|
|
|
|
|
2021-07-18 06:39:40 +00:00
|
|
|
int peakRedLevel=0;
|
2021-08-17 06:25:11 +00:00
|
|
|
bool drawLabels = true;
|
2021-07-20 06:46:11 +00:00
|
|
|
int mXstart = 0; // Starting point for S=0.
|
2021-07-17 00:45:07 +00:00
|
|
|
int mYstart = 14; // height, down from top, where the drawing starts
|
|
|
|
int barHeight = 10; // Height of meter "bar" indicators
|
|
|
|
int scaleLineYstart = 12;
|
2021-07-17 07:37:27 +00:00
|
|
|
int scaleTextYstart = 10;
|
2021-07-17 00:45:07 +00:00
|
|
|
|
2021-07-20 06:46:11 +00:00
|
|
|
int widgetWindowHeight = mYstart + barHeight + 0; // height of drawing canvis.
|
2021-02-24 08:18:19 +00:00
|
|
|
|
2021-07-17 00:45:07 +00:00
|
|
|
void drawScaleS(QPainter *qp);
|
2021-07-18 21:27:21 +00:00
|
|
|
void drawScaleCenter(QPainter *qp);
|
2021-07-17 00:45:07 +00:00
|
|
|
void drawScalePo(QPainter *qp);
|
|
|
|
void drawScaleRxdB(QPainter *qp);
|
|
|
|
void drawScaleALC(QPainter *qp);
|
2021-07-17 07:37:27 +00:00
|
|
|
void drawScaleSWR(QPainter *qp);
|
2021-07-17 00:45:07 +00:00
|
|
|
void drawScaleVd(QPainter *qp);
|
|
|
|
void drawScaleId(QPainter *qp);
|
2021-08-17 06:25:11 +00:00
|
|
|
void drawScaleComp(QPainter *qp);
|
2021-07-18 21:27:21 +00:00
|
|
|
void drawScaleRaw(QPainter *qp);
|
2021-02-24 08:18:19 +00:00
|
|
|
|
2021-08-17 06:25:11 +00:00
|
|
|
void drawLabel(QPainter *qp);
|
|
|
|
|
|
|
|
QString label;
|
|
|
|
|
2021-02-24 08:18:19 +00:00
|
|
|
QColor currentColor;
|
|
|
|
QColor averageColor;
|
|
|
|
QColor peakColor;
|
|
|
|
// S0-S9:
|
|
|
|
QColor lowTextColor;
|
|
|
|
QColor lowLineColor;
|
|
|
|
// S9+:
|
|
|
|
QColor highTextColor;
|
|
|
|
QColor highLineColor;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // METER_H
|