From f820d289b2b92a0ebe28176773c85a6468f553eb Mon Sep 17 00:00:00 2001 From: Elliott Liggett Date: Tue, 17 Jan 2023 21:09:54 -0800 Subject: [PATCH] Re-arranged the preference structure to match how we save the preferences. --- prefs.h | 38 ++++++++++++++++++++++++++------------ wfmain.cpp | 10 +++++++++- 2 files changed, 35 insertions(+), 13 deletions(-) diff --git a/prefs.h b/prefs.h index 4309e33..9b2a669 100644 --- a/prefs.h +++ b/prefs.h @@ -6,7 +6,13 @@ #include "wfviewtypes.h" struct preferences { + // Program: QString version; + int majorVersion = 0; + int minorVersion = 0; + QString gitShort; + + // Interface: bool useFullScreen; bool useSystemTheme; bool drawPeaks; @@ -14,31 +20,40 @@ struct preferences { int underlayBufferSize = 64; bool wfAntiAlias; bool wfInterpolate; + int wftheme; + int plotFloor; + int plotCeiling; QString stylesheetPath; + unsigned int wflength; + bool confirmExit; + bool confirmPowerOff; + meterKind meter2Type; + bool clickDragTuningEnable; + + // Radio: unsigned char radioCIVAddr; bool CIVisRadioModel; bool forceRTSasPTT; + int polling_ms; QString serialPortRadio; quint32 serialPortBaud; - int polling_ms; + QString virtualSerialPort; + unsigned char localAFgain; + audioType audioSystem; + + // Controls: bool enablePTT; bool niceTS; + + // LAN: 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; + + // Cluster: bool clusterUdpEnable; bool clusterTcpEnable; int clusterUdpPort; @@ -46,7 +61,6 @@ struct preferences { QString clusterTcpUserName; QString clusterTcpPassword; int clusterTimeout; - bool clickDragTuningEnable; bool clusterSkimmerSpotsEnable; }; diff --git a/wfmain.cpp b/wfmain.cpp index 832b70a..ef3aaf6 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -2439,8 +2439,16 @@ void wfmain::saveSettings() qInfo(logSystem()) << "Saving settings to " << settings->fileName(); // Basic things to load: + QString versionstr = QString(WFVIEW_VERSION); + QString majorVersion = versionstr.split(".").at(0); + QString minorVersion = versionstr.split(".").at(1); + + settings->beginGroup("Program"); - settings->setValue("version", QString(WFVIEW_VERSION)); + settings->setValue("version", versionstr); + settings->setValue("majorVersion", int(majorVersion.toInt()); + settings->setValue("minorVersion", int(minorVersion.toInt()); + settings->setValue("gitShort", QString(GITSHORT)); settings->endGroup(); // UI: (full screen, dark theme, draw peaks, colors, etc)