From b25c8a93f3f0c7fbb860ed645bf62e0f159bc2f3 Mon Sep 17 00:00:00 2001 From: Elliott Liggett Date: Sat, 26 Nov 2022 20:45:32 -0800 Subject: [PATCH] Moved preferences to prefs.h, which should make it easier to add new preferences. Moved custom types (as it seemed useful here and there) to wfviewtypes.h. Let's use the wfviewtypes.h file for any kind of datatype which more than one module can make use of. --- audioconverter.h | 2 +- prefs.h | 50 +++++++++++++++++++++++++++++++++++++++++++++++ rigcommander.h | 44 +---------------------------------------- wfmain.h | 47 +++----------------------------------------- wfview.pro | 4 +++- wfviewtypes.h | 51 ++++++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 109 insertions(+), 89 deletions(-) create mode 100644 prefs.h create mode 100644 wfviewtypes.h diff --git a/audioconverter.h b/audioconverter.h index b3a1492..b0eb1ad 100644 --- a/audioconverter.h +++ b/audioconverter.h @@ -17,7 +17,7 @@ #include #endif -enum audioType {qtAudio,portAudio,rtAudio}; +#include "wfviewtypes.h" #include "resampler/speex_resampler.h" diff --git a/prefs.h b/prefs.h new file mode 100644 index 0000000..5afbe6c --- /dev/null +++ b/prefs.h @@ -0,0 +1,50 @@ +#ifndef PREFS_H +#define PREFS_H + +#include + +#include "wfviewtypes.h" + +struct preferences { + bool useFullScreen; + bool useSystemTheme; + bool drawPeaks; + underlay_t underlayMode = underlayNone; + int underlayBufferSize = 64; + bool wfAntiAlias; + bool wfInterpolate; + QString stylesheetPath; + unsigned char radioCIVAddr; + bool CIVisRadioModel; + bool forceRTSasPTT; + QString serialPortRadio; + quint32 serialPortBaud; + bool enablePTT; + bool niceTS; + bool enableLAN; + bool enableRigCtlD; + quint16 rigCtlPort; + int currentColorPresetNumber = 0; + QString virtualSerialPort; + unsigned char localAFgain; + unsigned int wflength; + int wftheme; + int plotFloor; + int plotCeiling; + bool confirmExit; + bool confirmPowerOff; + meterKind meter2Type; + quint16 tcpPort; + quint8 waterfallFormat; + audioType audioSystem; + bool clusterUdpEnable; + bool clusterTcpEnable; + int clusterUdpPort; + QString clusterTcpServerName; + QString clusterTcpUserName; + QString clusterTcpPassword; + int clusterTimeout; + bool clickDragTuningEnable; +}; + +#endif // PREFS_H diff --git a/rigcommander.h b/rigcommander.h index 3655e41..9f51f5c 100644 --- a/rigcommander.h +++ b/rigcommander.h @@ -5,7 +5,7 @@ #include #include - +#include "wfviewtypes.h" #include "commhandler.h" #include "pttyhandler.h" #include "udphandler.h" @@ -23,48 +23,6 @@ // note: using a define because switch case doesn't even work with const unsigned char. Surprised me. #define compCivAddr 0xE1 -enum meterKind { - meterNone=0, - meterS, - meterCenter, - meterSWR, - meterPower, - meterALC, - meterComp, - meterVoltage, - meterCurrent, - meterRxdB, - meterTxMod, - meterRxAudio, - meterAudio, - meterLatency -}; - -enum spectrumMode { - spectModeCenter=0x00, - spectModeFixed=0x01, - spectModeScrollC=0x02, - spectModeScrollF=0x03, - spectModeUnknown=0xff -}; - -struct freqt { - quint64 Hz; - double MHzDouble; -}; - -struct datekind { - uint16_t year; - unsigned char month; - unsigned char day; -}; - -struct timekind { - unsigned char hours; - unsigned char minutes; - bool isMinus; -}; - class rigCommander : public QObject { Q_OBJECT diff --git a/wfmain.h b/wfmain.h index 826e902..b27f16f 100644 --- a/wfmain.h +++ b/wfmain.h @@ -20,6 +20,8 @@ #include #include "logcategories.h" +#include "wfviewtypes.h" +#include "prefs.h" #include "commhandler.h" #include "rigcommander.h" #include "rigstate.h" @@ -799,9 +801,6 @@ private: quint16 wfLength; bool spectrumDrawLock; - enum underlay_t { underlayNone, underlayPeakHold, underlayPeakBuffer, underlayAverageBuffer }; - - QByteArray spectrumPeaks; QVector spectrumPlasmaLine; QVector spectrumPlasma; @@ -902,47 +901,7 @@ private: colorPrefsType colorPreset[numColorPresetsTotal]; - struct preferences { - bool useFullScreen; - bool useSystemTheme; - bool drawPeaks; - underlay_t underlayMode = underlayNone; - int underlayBufferSize = 64; - bool wfAntiAlias; - bool wfInterpolate; - QString stylesheetPath; - unsigned char radioCIVAddr; - bool CIVisRadioModel; - bool forceRTSasPTT; - QString serialPortRadio; - quint32 serialPortBaud; - bool enablePTT; - bool niceTS; - bool enableLAN; - bool enableRigCtlD; - quint16 rigCtlPort; - int currentColorPresetNumber = 0; - QString virtualSerialPort; - unsigned char localAFgain; - unsigned int wflength; - int wftheme; - int plotFloor; - int plotCeiling; - bool confirmExit; - bool confirmPowerOff; - meterKind meter2Type; - quint16 tcpPort; - quint8 waterfallFormat; - audioType audioSystem; - bool clusterUdpEnable; - bool clusterTcpEnable; - int clusterUdpPort; - QString clusterTcpServerName; - QString clusterTcpUserName; - QString clusterTcpPassword; - int clusterTimeout; - bool clickDragTuningEnable; - } prefs; + preferences prefs; preferences defPrefs; udpPreferences udpPrefs; diff --git a/wfview.pro b/wfview.pro index ce40277..72163a8 100644 --- a/wfview.pro +++ b/wfview.pro @@ -185,6 +185,7 @@ HEADERS += wfmain.h \ colorprefs.h \ commhandler.h \ loggingwindow.h \ + prefs.h \ rigcommander.h \ freqmemory.h \ rigidentities.h \ @@ -217,7 +218,8 @@ HEADERS += wfmain.h \ tcpserver.h \ cluster.h \ database.h \ - aboutbox.h + aboutbox.h \ + wfviewtypes.h FORMS += wfmain.ui \ diff --git a/wfviewtypes.h b/wfviewtypes.h new file mode 100644 index 0000000..46876b8 --- /dev/null +++ b/wfviewtypes.h @@ -0,0 +1,51 @@ +#ifndef WFVIEWTYPES_H +#define WFVIEWTYPES_H + +enum underlay_t { underlayNone, underlayPeakHold, underlayPeakBuffer, underlayAverageBuffer }; + +enum meterKind { + meterNone=0, + meterS, + meterCenter, + meterSWR, + meterPower, + meterALC, + meterComp, + meterVoltage, + meterCurrent, + meterRxdB, + meterTxMod, + meterRxAudio, + meterAudio, + meterLatency +}; + +enum spectrumMode { + spectModeCenter=0x00, + spectModeFixed=0x01, + spectModeScrollC=0x02, + spectModeScrollF=0x03, + spectModeUnknown=0xff +}; + +struct freqt { + quint64 Hz; + double MHzDouble; +}; + +struct datekind { + uint16_t year; + unsigned char month; + unsigned char day; +}; + +struct timekind { + unsigned char hours; + unsigned char minutes; + bool isMinus; +}; + +enum audioType {qtAudio,portAudio,rtAudio}; + + +#endif // WFVIEWTYPES_H