wfview/wfmain.h

1018 wiersze
32 KiB
C
Czysty Zwykły widok Historia

#ifdef BUILD_WFSERVER
2022-01-17 17:23:55 +00:00
#include "servermain.h"
#else
2018-06-19 19:58:52 +00:00
#ifndef WFMAIN_H
#define WFMAIN_H
#include <QMainWindow>
#include <QCloseEvent>
2018-06-19 19:58:52 +00:00
#include <QThread>
#include <QString>
#include <QVector>
#include <QTimer>
#include <QSettings>
2018-11-28 06:02:37 +00:00
#include <QShortcut>
2021-06-01 16:48:19 +00:00
#include <QThread>
#include <QMetaType>
2022-08-18 05:38:44 +00:00
#include <QMutex>
#include <QMutexLocker>
#include <QColorDialog>
#include <QColor>
2018-06-19 19:58:52 +00:00
2021-02-07 20:07:26 +00:00
#include "logcategories.h"
#include "wfviewtypes.h"
#include "prefs.h"
2018-06-19 19:58:52 +00:00
#include "commhandler.h"
#include "rigcommander.h"
2021-11-23 00:39:10 +00:00
#include "rigstate.h"
#include "freqmemory.h"
#include "rigidentities.h"
#include "repeaterattributes.h"
2022-01-22 15:28:41 +00:00
#include "packettypes.h"
#include "calibrationwindow.h"
#include "repeatersetup.h"
#include "satellitesetup.h"
#include "transceiveradjustments.h"
#include "cwsender.h"
2023-02-10 21:03:37 +00:00
#include "bandbuttons.h"
2023-02-12 02:39:02 +00:00
#include "frequencyinputwidget.h"
#include "settingswidget.h"
#include "udpserver.h"
#include "qledlabel.h"
#include "rigctld.h"
2021-07-08 07:31:59 +00:00
#include "aboutbox.h"
#include "selectradio.h"
#include "colorprefs.h"
#include "loggingwindow.h"
2022-09-29 16:17:51 +00:00
#include "cluster.h"
#include "audiodevices.h"
#include "sidebandchooser.h"
2018-06-19 19:58:52 +00:00
#include <qcustomplot.h>
#include <qserialportinfo.h>
2022-04-22 10:11:21 +00:00
#include "usbcontroller.h"
2022-10-22 19:55:08 +00:00
#include "controllersetup.h"
2018-06-19 19:58:52 +00:00
#include <deque>
#include <memory>
#include <portaudio.h>
2022-05-14 14:05:48 +00:00
#ifndef Q_OS_LINUX
#include "RtAudio.h"
#else
#include "rtaudio/RtAudio.h"
#endif
#define numColorPresetsTotal (5)
2018-06-19 19:58:52 +00:00
namespace Ui {
class wfmain;
}
class wfmain : public QMainWindow
{
Q_OBJECT
public:
2022-09-23 16:42:36 +00:00
explicit wfmain(const QString settingsFile, const QString logFile, bool debugMode, QWidget *parent = 0);
2018-06-19 19:58:52 +00:00
~wfmain();
static void messageHandler(QtMsgType type, const QMessageLogContext& context, const QString& msg);
void handleLogText(QString text);
2018-06-19 19:58:52 +00:00
signals:
// Basic to rig:
void setCIVAddr(unsigned char newRigCIVAddr);
void setRigID(unsigned char rigID);
2021-12-30 09:52:23 +00:00
void setRTSforPTT(bool enabled);
2022-09-26 00:44:49 +00:00
void sendPowerOn();
void sendPowerOff();
// Frequency, mode, band:
2018-06-19 19:58:52 +00:00
void getFrequency();
void setFrequency(unsigned char vfo, freqt freq);
2018-06-19 19:58:52 +00:00
void getMode();
void setMode(unsigned char modeIndex, unsigned char modeFilter);
void setMode(mode_info);
2023-01-27 20:44:23 +00:00
void selectVFO(vfo_t vfo);
void sendVFOSwap();
void sendVFOEqualAB();
void sendVFOEqualMS();
void setDataMode(bool dataOn, unsigned char filter);
void getDataMode();
void getModInput(bool dataOn);
void setModInput(rigInput input, bool dataOn);
void getBandStackReg(char band, char regCode);
void getDebug();
void getRitEnabled();
void getRitValue();
void setRitValue(int ritValue);
void setRitEnable(bool ritEnabled);
// Repeater:
void getDuplexMode();
2023-02-01 17:21:17 +00:00
void setQuickSplit(bool qsOn);
void getTone();
void getTSQL();
void getDTCS();
void getRptAccessMode();
void setRepeaterAccessMode(rptrAccessData_t rd);
void setTone(rptrTone_t t);
void setTSQL(rptrTone_t t);
2023-02-01 02:00:12 +00:00
void getToneEnabled();
void getTSQLEnabled();
2023-02-01 05:52:24 +00:00
void setToneEnabled(bool enabled);
void setTSQLEnabled(bool enabled);
void setRptDuplexOffset(freqt f);
void getRptDuplexOffset();
// Level get:
void getLevels(); // get all levels
void getRfGain();
void getAfGain();
2018-11-18 08:01:20 +00:00
void getSql();
void getIfShift();
void getTPBFInner();
void getTPBFOuter();
void getTxPower();
void getMicGain();
void getSpectrumRefLevel();
void getModInputLevel(rigInput input);
void getMeters(meterKind meter);
void getPassband();
void getCwPitch();
void getPskTone();
void getRttyMark();
// Level set:
void setRfGain(unsigned char level);
void setAfGain(unsigned char level);
void setSql(unsigned char level);
void setIFShift(unsigned char level);
void setTPBFInner(unsigned char level);
void setTPBFOuter(unsigned char level);
void setIFShiftWindow(unsigned char level);
void setTPBFInnerWindow(unsigned char level);
void setTPBFOuterWindow(unsigned char level);
void setMicGain(unsigned char);
void setCompLevel(unsigned char);
void setTxPower(unsigned char);
void setMonitorLevel(unsigned char);
void setVoxGain(unsigned char);
void setAntiVoxGain(unsigned char);
void setSpectrumRefLevel(int);
void setModLevel(rigInput input, unsigned char level);
void setACCGain(unsigned char level);
void setACCAGain(unsigned char level);
void setACCBGain(unsigned char level);
void setUSBGain(unsigned char level);
void setLANGain(unsigned char level);
void setPassband(quint16 pass);
// PTT, ATU, ATT, Antenna, Preamp:
void getPTT();
void setPTT(bool pttOn);
void getAttenuator();
void getPreamp();
void getAntenna();
void setAttenuator(unsigned char att);
void setPreamp(unsigned char pre);
void setAntenna(unsigned char ant, bool rx);
void startATU();
2018-11-17 07:13:59 +00:00
void setATU(bool atuEnabled);
2018-12-20 18:56:54 +00:00
void getATUStatus();
// CW Keying:
void sendCW(QString message);
void stopCW();
void getKeySpeed();
void setKeySpeed(unsigned char wpm);
2023-01-25 18:01:24 +00:00
void setCwPitch(unsigned char pitch);
void setCWBreakMode(unsigned char breakMode);
void getCWBreakMode();
// Time and date:
void setTime(timekind t);
void setDate(datekind d);
void setUTCOffset(timekind t);
void getRigID(); // this is the model of the rig
void getRigCIV(); // get the rig's CIV addr
2018-06-19 19:58:52 +00:00
void spectOutputEnable();
void spectOutputDisable();
void scopeDisplayEnable();
void scopeDisplayDisable();
void setScopeMode(spectrumMode spectMode);
2018-06-19 19:58:52 +00:00
void setScopeSpan(char span);
void setScopeEdge(char edge);
void setScopeFixedEdge(double startFreq, double endFreq, unsigned char edgeNumber);
void getScopeMode();
void getScopeEdge();
void getScopeSpan();
void sayFrequency();
void sayMode();
void sayAll();
void sendCommSetup(unsigned char rigCivAddr, QString rigSerialPort, quint32 rigBaudRate,QString vsp, quint16 tcp, quint8 wf);
void sendCommSetup(unsigned char rigCivAddr, udpPreferences prefs, audioSetup rxSetup, audioSetup txSetup, QString vsp, quint16 tcp);
void sendCloseComm();
void sendChangeLatency(quint16 latency);
void initServer();
2021-02-28 20:10:07 +00:00
void sendRigCaps(rigCapabilities caps);
2021-06-01 16:48:19 +00:00
void openShuttle();
void requestRigState();
void stateUpdated();
void initUsbController(int sens);
2022-09-18 16:42:41 +00:00
void sendUsbControllerCommands(QVector<COMMAND>* cmds);
2022-09-18 20:00:44 +00:00
void sendUsbControllerButtons(QVector<BUTTON>* buts);
2022-09-29 16:17:51 +00:00
void setClusterUdpPort(int port);
void setClusterEnableUdp(bool udp);
void setClusterEnableTcp(bool tcp);
2022-09-30 16:05:42 +00:00
void setClusterServerName(QString name);
void setClusterTcpPort(int port);
void setClusterUserName(QString name);
void setClusterPassword(QString pass);
void setClusterTimeout(int timeout);
void setClusterSkimmerSpots(bool enable);
void setFrequencyRange(double low, double high);
2018-06-19 19:58:52 +00:00
private slots:
// Triggered from external preference changes:
void extChangedIfPrefs(int items);
void extChangedRaPrefs(int items);
void extChangedCtPrefs(int items);
void extChangedLanPrefs(int items);
void extChangedClusterPrefs(int items);
void extChangedUdpPrefs(int items);
void extChangedIfPref(prefIfItem i);
void extChangedRaPref(prefRaItem i);
void extChangedCtPref(prefCtItem i);
void extChangedLanPref(prefLanItem i);
void extChangedClusterPref(prefClusterItem i);
void extChangedUdpPref(udpPrefsItem i);
2023-01-12 18:50:18 +00:00
void setAudioDevicesUI();
void updateSizes(int tabIndex);
2018-11-28 06:02:37 +00:00
void shortcutF1();
void shortcutF2();
void shortcutF3();
void shortcutF4();
void shortcutF5();
void shortcutF6();
void shortcutF7();
void shortcutF8();
void shortcutF9();
void shortcutF10();
void shortcutF11();
void shortcutF12();
void shortcutControlT();
void shortcutControlR();
void shortcutControlI();
void shortcutControlU();
2018-11-28 06:02:37 +00:00
void shortcutStar();
void shortcutSlash();
void shortcutMinus();
void shortcutPlus();
void shortcutStepMinus();
void shortcutStepPlus();
void shortcutShiftMinus();
void shortcutShiftPlus();
void shortcutControlMinus();
void shortcutControlPlus();
2018-11-28 06:02:37 +00:00
2020-03-17 22:15:01 +00:00
void shortcutPageUp();
void shortcutPageDown();
void shortcutF();
void shortcutM();
2019-01-24 01:19:35 +00:00
void handlePttLimit(); // hit at 3 min transmit length
2018-11-28 06:02:37 +00:00
void doShuttle(bool up, unsigned char level);
2021-06-08 07:04:41 +00:00
void receiveCommReady();
void receiveFreq(freqt);
void receiveMode(unsigned char mode, unsigned char filter);
2018-06-19 19:58:52 +00:00
void receiveSpectrumData(QByteArray spectrum, double startFreq, double endFreq);
void receiveSpectrumMode(spectrumMode spectMode);
void receiveSpectrumSpan(freqt freqspan, bool isSub);
void handleScopeOutOfRange(bool outOfRange);
2018-11-07 23:54:03 +00:00
void receivePTTstatus(bool pttOn);
void receiveDataModeStatus(bool dataOn);
2023-02-10 21:03:37 +00:00
void handleBandStackReg(freqt f, char mode, char filter, bool dataOn); // freq, mode, (filter,) datamode
void receiveRITStatus(bool ritEnabled);
void receiveRITValue(int ritValHz);
void receiveModInput(rigInput input, bool dataOn);
//void receiveDuplexMode(duplexMode dm);
void receivePassband(quint16 pass);
void receiveCwPitch(unsigned char pitch);
2023-01-16 12:24:22 +00:00
void receiveTPBFInner(unsigned char level);
void receiveTPBFOuter(unsigned char level);
// Levels:
void receiveRfGain(unsigned char level);
void receiveAfGain(unsigned char level);
2018-11-18 08:01:20 +00:00
void receiveSql(unsigned char level);
void receiveIFShift(unsigned char level);
void receiveTBPFInner(unsigned char level);
void receiveTBPFOuter(unsigned char level);
// 'change' from data in transceiver controls window:
void changeIFShift(unsigned char level);
void changeTPBFInner(unsigned char level);
void changeTPBFOuter(unsigned char level);
void receiveTxPower(unsigned char power);
void receiveMicGain(unsigned char gain);
void receiveCompLevel(unsigned char compLevel);
void receiveMonitorGain(unsigned char monitorGain);
void receiveVoxGain(unsigned char voxGain);
void receiveAntiVoxGain(unsigned char antiVoxGain);
void receiveSpectrumRefLevel(int level);
void receiveACCGain(unsigned char level, unsigned char ab);
void receiveUSBGain(unsigned char level);
void receiveLANGain(unsigned char level);
// Meters:
void receiveMeter(meterKind meter, unsigned char level);
// void receiveSMeter(unsigned char level);
// void receivePowerMeter(unsigned char level);
// void receiveALCMeter(unsigned char level);
// void receiveCompMeter(unsigned char level);
2018-12-19 20:31:44 +00:00
void receiveATUStatus(unsigned char atustatus);
void receivePreamp(unsigned char pre);
void receiveAttenuator(unsigned char att);
void receiveAntennaSel(unsigned char ant, bool rx);
void receiveRigID(rigCapabilities rigCaps);
void receiveFoundRigID(rigCapabilities rigCaps);
2023-01-05 19:37:53 +00:00
void receivePortError(errorType err);
void receiveStatusUpdate(networkStatus status);
void receiveNetworkAudioLevels(networkAudioLevels l);
2018-06-19 19:58:52 +00:00
void handlePlotClick(QMouseEvent *);
void handlePlotMouseRelease(QMouseEvent *);
void handlePlotMouseMove(QMouseEvent *);
2018-06-19 19:58:52 +00:00
void handlePlotDoubleClick(QMouseEvent *);
void handleWFClick(QMouseEvent *);
void handleWFDoubleClick(QMouseEvent *);
void handleWFScroll(QWheelEvent *);
void handlePlotScroll(QWheelEvent *);
void sendRadioCommandLoop();
2018-11-07 23:54:03 +00:00
void showStatusBarText(QString text);
void receiveBaudRate(quint32 baudrate);
void radioSelection(QList<radio_cap_packet> radios);
void receiveUsbSensitivity(int val);
2018-06-19 19:58:52 +00:00
2022-04-22 10:11:21 +00:00
// Added for RC28/Shuttle support
void pttToggle(bool);
void stepUp();
void stepDown();
void changeFrequency(int value);
void setBand(int band);
void setRadioTimeDateSend();
void logCheck();
void setDebugLogging(bool debugModeOn);
2022-04-27 11:56:54 +00:00
void buttonControl(const COMMAND* cmd);
2018-06-19 19:58:52 +00:00
void on_clearPeakBtn_clicked();
void changeFullScreenMode(bool checked);
2018-06-19 19:58:52 +00:00
2022-05-17 07:53:24 +00:00
void on_usbControllerBtn_clicked();
2023-01-30 16:15:43 +00:00
void on_usbButtonsResetBtn_clicked();
void on_usbCommandsResetBtn_clicked();
2023-02-20 06:11:48 +00:00
void enableUsbControllers(bool enabled);
2018-06-19 19:58:52 +00:00
void on_scopeBWCombo_currentIndexChanged(int index);
void on_scopeEdgeCombo_currentIndexChanged(int index);
void on_modeSelectCombo_activated(int index);
void on_freqDial_valueChanged(int value);
void on_aboutBtn_clicked();
void on_rfGainSlider_valueChanged(int value);
void on_afGainSlider_valueChanged(int value);
void on_tuneNowBtn_clicked();
2018-11-17 07:13:59 +00:00
void on_tuneEnableChk_clicked(bool checked);
void on_exitBtn_clicked();
void on_pttOnBtn_clicked();
void on_pttOffBtn_clicked();
2018-11-27 07:10:23 +00:00
void on_saveSettingsBtn_clicked();
void on_debugBtn_clicked();
void on_lanEnableBtn_clicked(bool checked);
void on_ipAddressTxt_textChanged(QString text);
void on_controlPortTxt_textChanged(QString text);
void on_usernameTxt_textChanged(QString text);
void on_passwordTxt_textChanged(QString text);
void on_audioDuplexCombo_currentIndexChanged(int value);
2021-05-16 20:16:59 +00:00
void on_audioOutputCombo_currentIndexChanged(int value);
void on_audioInputCombo_currentIndexChanged(int value);
void on_toFixedBtn_clicked();
void on_connectBtn_clicked();
void on_rxLatencySlider_valueChanged(int value);
void on_txLatencySlider_valueChanged(int value);
void on_audioRXCodecCombo_currentIndexChanged(int value);
void on_audioTXCodecCombo_currentIndexChanged(int value);
2022-08-22 22:09:09 +00:00
void on_audioSampleRateCombo_currentIndexChanged(int value);
void on_scopeEnableWFBtn_clicked(bool checked);
void on_sqlSlider_valueChanged(int value);
void on_modeFilterCombo_activated(int index);
2021-02-13 06:49:42 +00:00
void on_dataModeBtn_toggled(bool checked);
void on_transmitBtn_clicked();
void on_adjRefBtn_clicked();
void on_satOpsBtn_clicked();
void on_txPowerSlider_valueChanged(int value);
void on_micGainSlider_valueChanged(int value);
void on_scopeRefLevelSlider_valueChanged(int value);
void useSystemTheme(bool checked);
void on_modInputCombo_activated(int index);
void on_modInputDataCombo_activated(int index);
2021-02-22 07:58:23 +00:00
void on_tuneLockChk_clicked(bool checked);
void on_spectrumModeCombo_currentIndexChanged(int index);
void on_serialEnableBtn_clicked(bool checked);
void on_tuningStepCombo_currentIndexChanged(int index);
2022-08-22 22:09:09 +00:00
void on_serialDeviceListCombo_textActivated(const QString &arg1);
void on_rptSetupBtn_clicked();
void on_attSelCombo_activated(int index);
void on_preampSelCombo_activated(int index);
void on_antennaSelCombo_activated(int index);
void on_rxAntennaCheck_clicked(bool value);
2021-04-10 06:38:36 +00:00
void on_wfthemeCombo_activated(int index);
void on_rigPowerOnBtn_clicked();
void on_rigPowerOffBtn_clicked();
void on_ritTuneDial_valueChanged(int value);
void on_ritEnableChk_clicked(bool checked);
void on_rigCIVManualAddrChk_clicked(bool checked);
void on_rigCIVaddrHexLine_editingFinished();
2021-05-20 22:17:10 +00:00
void on_baudRateCombo_activated(int);
void on_wfLengthSlider_valueChanged(int value);
void on_wfAntiAliasChk_clicked(bool checked);
void on_wfInterpolateChk_clicked(bool checked);
void changeMeter2Type(meterKind m);
void on_waterfallFormatCombo_activated(int index);
void on_enableRigctldChk_clicked(bool checked);
2021-08-05 00:23:15 +00:00
void on_rigctldPortTxt_editingFinished();
void on_tcpServerPortTxt_editingFinished();
void on_moreControlsBtn_clicked();
void on_useCIVasRigIDChk_clicked(bool checked);
void receiveStateInfo(rigstate* state);
2021-12-24 03:45:58 +00:00
void on_settingsList_currentRowChanged(int currentRow);
2021-12-24 04:05:34 +00:00
void on_setClockBtn_clicked();
void on_serverEnableCheckbox_clicked(bool checked);
2021-12-30 11:17:54 +00:00
void on_serverControlPortText_textChanged(QString text);
void on_serverCivPortText_textChanged(QString text);
void on_serverAudioPortText_textChanged(QString text);
void on_serverTXAudioOutputCombo_currentIndexChanged(int value);
void on_serverRXAudioInputCombo_currentIndexChanged(int value);
2022-09-18 13:59:03 +00:00
void onServerUserFieldChanged();
void on_serverAddUserBtn_clicked();
2022-01-21 23:58:18 +00:00
void on_radioStatusBtn_clicked();
void on_audioSystemCombo_currentIndexChanged(int value);
void on_topLevelSlider_valueChanged(int value);
void on_botLevelSlider_valueChanged(int value);
2022-08-18 01:41:35 +00:00
void on_underlayBufferSlider_valueChanged(int value);
void on_underlayNone_toggled(bool checked);
void on_underlayPeakHold_toggled(bool checked);
void on_underlayPeakBuffer_toggled(bool checked);
void on_underlayAverageBuffer_toggled(bool checked);
void on_colorSetBtnGrid_clicked();
2022-08-19 17:32:06 +00:00
void on_colorSetBtnPlotBackground_clicked();
void on_colorSetBtnText_clicked();
void on_colorSetBtnSpecLine_clicked();
void on_colorSetBtnSpecFill_clicked();
void on_colorEditPlotBackground_editingFinished();
void on_colorPopOutBtn_clicked();
void on_colorPresetCombo_currentIndexChanged(int index);
void on_colorEditSpecLine_editingFinished();
void on_colorEditGrid_editingFinished();
void on_colorEditText_editingFinished();
void on_colorEditSpecFill_editingFinished();
2022-08-22 00:52:52 +00:00
void on_colorSetBtnAxis_clicked();
void on_colorEditAxis_editingFinished();
void on_colorSetBtnUnderlayLine_clicked();
void on_colorEditUnderlayLine_editingFinished();
void on_colorSetBtnUnderlayFill_clicked();
void on_colorEditUnderlayFill_editingFinished();
void on_colorSetBtnwfBackground_clicked();
void on_colorEditWfBackground_editingFinished();
void on_colorSetBtnWfGrid_clicked();
void on_colorEditWfGrid_editingFinished();
void on_colorSetBtnWfAxis_clicked();
void on_colorEditWfAxis_editingFinished();
void on_colorSetBtnWfText_clicked();
void on_colorEditWfText_editingFinished();
void on_colorSetBtnTuningLine_clicked();
void on_colorEditTuningLine_editingFinished();
2022-09-26 10:59:16 +00:00
void on_colorSetBtnPassband_clicked();
void on_colorEditPassband_editingFinished();
2023-02-05 13:21:12 +00:00
void on_colorSetBtnPBT_clicked();
void on_colorEditPBT_editingFinished();
2022-08-22 00:52:52 +00:00
void on_colorSetBtnMeterLevel_clicked();
void on_colorEditMeterLevel_editingFinished();
void on_colorSetBtnMeterAvg_clicked();
void on_colorEditMeterAvg_editingFinished();
void on_colorSetBtnMeterScale_clicked();
void on_colorEditMeterScale_editingFinished();
void on_colorSetBtnMeterText_clicked();
void on_colorEditMeterText_editingFinished();
2022-10-09 13:23:07 +00:00
void on_colorSetBtnClusterSpots_clicked();
void on_colorEditClusterSpots_editingFinished();
2022-08-22 16:44:00 +00:00
void on_colorRenamePresetBtn_clicked();
void on_colorRevertPresetBtn_clicked();
void on_colorSetBtnMeterPeakLevel_clicked();
void on_colorEditMeterPeakLevel_editingFinished();
void on_colorSetBtnMeterPeakScale_clicked();
void on_colorEditMeterPeakScale_editingFinished();
void on_colorSavePresetBtn_clicked();
void on_showLogBtn_clicked();
void on_audioSystemServerCombo_currentIndexChanged(int index);
void on_customEdgeBtn_clicked();
2022-09-30 16:05:42 +00:00
void on_clusterUdpEnable_clicked(bool enable);
void on_clusterTcpEnable_clicked(bool enable);
void on_clusterUdpPortLineEdit_editingFinished();
void on_clusterServerNameCombo_currentTextChanged(QString text);
void on_clusterServerNameCombo_currentIndexChanged(int index);
void on_clusterTcpPortLineEdit_editingFinished();
void on_clusterUsernameLineEdit_editingFinished();
void on_clusterPasswordLineEdit_editingFinished();
void on_clusterTimeoutLineEdit_editingFinished();
2022-10-09 13:32:09 +00:00
void on_clusterPopOutBtn_clicked();
void on_clusterSkimmerSpotsEnable_clicked(bool enable);
2022-10-09 13:32:09 +00:00
2022-10-11 12:17:23 +00:00
void on_clickDragTuningEnableChk_clicked(bool checked);
2022-09-30 16:05:42 +00:00
void receiveClusterOutput(QString text);
void receiveSpots(QList<spotData> spots);
2022-09-29 16:17:51 +00:00
void on_cwButton_clicked();
void on_showBandsBtn_clicked();
2023-02-12 02:39:02 +00:00
void on_showFreqBtn_clicked();
void on_showSettingsBtn_clicked();
2018-06-19 19:58:52 +00:00
private:
Ui::wfmain *ui;
void closeEvent(QCloseEvent *event);
2022-09-23 16:02:06 +00:00
QString logFilename;
bool debugMode;
QString version;
QSettings *settings=Q_NULLPTR;
void loadSettings();
void saveSettings();
void connectSettingsWidget();
void createSettingsListItems();
void initLogging();
QTimer logCheckingTimer;
int logCheckingOldPosition = 0;
2018-06-19 19:58:52 +00:00
QCustomPlot *plot; // line plot
QCustomPlot *wf; // waterfall image
QCPItemLine * freqIndicatorLine;
2022-09-26 00:44:49 +00:00
QCPItemRect* passbandIndicator;
2023-01-19 16:16:47 +00:00
QCPItemRect* pbtIndicator;
void setAppTheme(bool isCustom);
void prepareWf();
void prepareWf(unsigned int wfLength);
void preparePlasma();
bool plasmaPrepared = false;
2022-08-17 22:10:07 +00:00
void computePlasma();
void showHideSpectrum(bool show);
void getInitialRigState();
void showButton(QPushButton *btn);
void hideButton(QPushButton *btn);
void openRig();
void powerRigOff();
void powerRigOn();
QStringList portList;
QString serialPortRig;
2018-11-28 06:02:37 +00:00
QShortcut *keyF1;
QShortcut *keyF2;
QShortcut *keyF3;
QShortcut *keyF4;
QShortcut *keyF5;
QShortcut *keyF6;
QShortcut *keyF7;
QShortcut *keyF8;
QShortcut *keyF9;
QShortcut *keyF10;
QShortcut *keyF11;
QShortcut *keyF12;
QShortcut *keyControlT;
QShortcut *keyControlR;
QShortcut *keyControlI;
QShortcut *keyControlU;
2018-11-28 06:02:37 +00:00
QShortcut *keyStar;
QShortcut *keySlash;
QShortcut *keyMinus;
QShortcut *keyPlus;
2018-11-28 06:02:37 +00:00
QShortcut *keyShiftMinus;
QShortcut *keyShiftPlus;
QShortcut *keyControlMinus;
QShortcut *keyControlPlus;
2020-03-10 18:08:36 +00:00
QShortcut *keyQuit;
2020-03-17 22:15:01 +00:00
QShortcut *keyPageUp;
QShortcut *keyPageDown;
QShortcut *keyF;
QShortcut *keyM;
QShortcut *keyH;
QShortcut *keyK; // alternate +
QShortcut *keyJ; // alternate -
QShortcut *keyL;
QShortcut *keyShiftK;
QShortcut *keyShiftJ;
QShortcut *keyControlK;
QShortcut *keyControlJ;
QShortcut *keyDebug;
2018-11-28 06:02:37 +00:00
rigCommander * rig=Q_NULLPTR;
QThread* rigThread = Q_NULLPTR;
2018-06-19 19:58:52 +00:00
QCPColorMap * colorMap;
QCPColorMapData * colorMapData;
QCPColorScale * colorScale;
QTimer * delayedCommand;
2019-01-24 01:19:35 +00:00
QTimer * pttTimer;
uint16_t loopTickCounter;
uint16_t slowCmdNum=0;
uint16_t rapidCmdNum=0;
2018-06-19 19:58:52 +00:00
void setupPlots();
void makeRig();
void rigConnections();
void removeRig();
void findSerialPort();
void setupKeyShortcuts();
void setupMainUI();
void setUIToPrefs();
void setSerialDevicesUI();
2021-05-29 04:27:06 +00:00
void setServerToPrefs();
2022-04-22 10:11:21 +00:00
void setupUsbControllerDevice();
2021-05-29 04:27:06 +00:00
void setInitialTiming();
void getSettingsFilePath(QString settingsFile);
2018-06-19 19:58:52 +00:00
QStringList modes;
int currentModeIndex;
QStringList spans;
QStringList edges;
QStringList commPorts;
2021-02-05 20:26:18 +00:00
QLabel* rigStatus;
QLabel* rigName;
QLedLabel* pttLed;
QLedLabel* connectedLed;
2018-06-19 19:58:52 +00:00
quint16 spectWidth;
quint16 wfLength;
bool spectrumDrawLock;
2018-06-19 19:58:52 +00:00
QByteArray spectrumPeaks;
2022-08-17 22:10:07 +00:00
QVector <double> spectrumPlasmaLine;
QVector <QByteArray> spectrumPlasma;
unsigned int spectrumPlasmaSize = 64;
2022-08-18 01:41:35 +00:00
underlay_t underlayMode = underlayNone;
2022-08-18 05:38:44 +00:00
QMutex plasmaMutex;
void resizePlasmaBuffer(int newSize);
void clearPlasmaBuffer();
2018-06-19 19:58:52 +00:00
double plotFloor = 0;
double plotCeiling = 160;
double wfFloor = 0;
double wfCeiling = 160;
double oldPlotFloor = -1;
double oldPlotCeiling = 999;
double passbandWidth = 0.0;
double mousePressFreq = 0.0;
double mouseReleaseFreq = 0.0;
2018-06-19 19:58:52 +00:00
QVector <QByteArray> wfimage;
unsigned int wfLengthMax;
2018-06-19 19:58:52 +00:00
2018-11-28 06:02:37 +00:00
bool onFullscreen;
2018-06-19 19:58:52 +00:00
bool freqTextSelected;
void setUISpectrumControlsToMode(spectrumMode smode);
2018-06-19 19:58:52 +00:00
double oldLowerFreq;
double oldUpperFreq;
freqt freq;
float tsKnobMHz;
2021-05-07 22:46:47 +00:00
unsigned char setModeVal=0;
unsigned char setFilterVal=0;
std::deque <commandtype> delayedCmdQue; // rapid commands from user interaction
std::deque <cmds> periodicCmdQueue; // rapid que for metering
std::deque <cmds> slowPollCmdQueue; // slow, regular checking for UI sync
std::deque <cmds> rapidPollCmdQueue; // rapid regular polling for non-meter actions
void doCmd(cmds cmd);
void doCmd(commandtype cmddata);
bool rapidPollCmdQueueEnabled = false;
void issueCmd(cmds cmd, freqt f);
void issueCmd(cmds cmd, mode_info m);
2023-01-27 20:44:23 +00:00
void issueCmd(cmds cmd, vfo_t v);
void issueCmd(cmds cmd, rptrTone_t t);
void issueCmd(cmds cmd, rptrAccessData_t rd);
void issueCmd(cmds cmd, timekind t);
void issueCmd(cmds cmd, datekind d);
void issueCmd(cmds cmd, int i);
void issueCmd(cmds cmd, unsigned char c);
void issueCmd(cmds cmd, char c);
void issueCmd(cmds cmd, bool b);
void issueCmd(cmds cmd, quint16 c);
2023-01-16 12:24:22 +00:00
void issueCmd(cmds cmd, qint16 c);
void issueCmd(cmds cmd, QString s);
// These commands pop_front and remove similar commands:
2021-06-26 02:47:40 +00:00
void issueCmdUniquePriority(cmds cmd, bool b);
void issueCmdUniquePriority(cmds cmd, unsigned char c);
void issueCmdUniquePriority(cmds cmd, char c);
void issueCmdUniquePriority(cmds cmd, freqt f);
void issueCmdUniquePriority(cmds cmd, quint16 c);
2023-01-16 12:24:22 +00:00
void issueCmdUniquePriority(cmds cmd, qint16 c);
void removeSimilarCommand(cmds cmd);
qint64 lastFreqCmdTime_ms;
int pCmdNum = 0;
int delayedCmdIntervalLAN_ms = 100;
int delayedCmdIntervalSerial_ms = 100;
int delayedCmdStartupInterval_ms = 100;
bool runPeriodicCommands;
bool usingLAN = false;
// Radio time sync:
QTimer *timeSync;
bool waitingToSetTimeDate;
void setRadioTimeDatePrep();
timekind timesetpoint;
timekind utcsetting;
datekind datesetpoint;
freqMemory mem;
2023-02-12 02:39:02 +00:00
void gotoMemoryPreset(int presetNumber);
void saveMemoryPreset(int presetNumber);
colorPrefsType colorPreset[numColorPresetsTotal];
preferences prefs;
preferences defPrefs;
udpPreferences udpPrefs;
udpPreferences udpDefPrefs;
2021-04-19 16:49:51 +00:00
2021-06-04 07:24:26 +00:00
// Configuration for audio output and input.
audioSetup rxSetup;
audioSetup txSetup;
void setDefaultColors(int presetNumber); // populate with default values
void useColors(); // set the plot up
void setDefPrefs(); // populate default values to default prefs
2021-02-22 07:58:23 +00:00
void setTuningSteps();
void setColorElement(QColor color, QLedLabel *led, QLabel *label);
void setColorElement(QColor color, QLedLabel *led, QLineEdit *lineText);
void setColorElement(QColor color, QLedLabel *led, QLabel *label, QLineEdit *lineText);
QColor getColorFromPicker(QColor initialColor);
void getSetColor(QLedLabel *led, QLabel *label);
void getSetColor(QLedLabel *led, QLineEdit *line);
2022-08-19 17:32:06 +00:00
QString setColorFromString(QString aarrggbb, QLedLabel *led);
void setDefaultColorPresets();
void loadColorPresetToUIandPlots(int presetNumber);
void useColorPreset(colorPrefsType *cp);
void useCurrentColorPreset();
void setEditAndLedFromColor(QColor c, QLineEdit *e, QLedLabel *d);
void setColorButtonOperations(QColor *colorStore, QLineEdit *e, QLedLabel *d);
void setColorLineEditOperations(QColor *colorStore, QLineEdit *e, QLedLabel *d);
void detachSettingsTab();
void reattachSettingsTab();
void prepareSettingsWindow();
QWidget *settingsWidgetWindow;
QWidget *settingsTab;
QGridLayout *settingsWidgetLayout;
QTabWidget *settingsWidgetTab;
bool settingsTabisAttached = true;
quint64 roundFrequency(quint64 frequency, unsigned int tsHz);
quint64 roundFrequencyWithStep(quint64 oldFreq, int steps,\
unsigned int tsHz);
void setUIFreq(double frequency);
void setUIFreq();
void changeTxBtn();
void issueDelayedCommand(cmds cmd);
void issueDelayedCommandPriority(cmds cmd);
void issueDelayedCommandUnique(cmds cmd);
void changeSliderQuietly(QSlider *slider, int value);
void showAndRaiseWidget(QWidget *w);
2021-06-19 23:16:07 +00:00
void statusFromSliderPercent(QString name, int percentValue);
void statusFromSliderRaw(QString name, int rawValue);
void processModLevel(rigInput source, unsigned char level);
void processChangingCurrentModLevel(unsigned char level);
void changeModLabel(rigInput source);
void changeModLabel(rigInput source, bool updateLevel);
void changeModLabelAndSlider(rigInput source);
void initPeriodicCommands();
// Fast command queue for S-Meter:
void insertPeriodicCommand(cmds cmd, unsigned char priority);
void insertPeriodicCommandUnique(cmds cmd);
void removePeriodicCommand(cmds cmd);
// Fast command queue for other functions:
void insertPeriodicRapidCmd(cmds cmd);
void insertPeriodicRapidCmdUnique(cmds cmd);
void removePeriodicRapidCmd(cmds cmd);
void insertSlowPeriodicCommand(cmds cmd, unsigned char priority);
2023-01-29 13:09:04 +00:00
void removeSlowPeriodicCommand(cmds cmd);
void calculateTimingParameters();
void changePollTiming(int timing_ms, bool setUI=false);
void changeMode(mode_kind mode);
void changeMode(mode_kind mode, bool dataOn);
void connectionHandler(bool connect);
cmds meterKindToMeterCommand(meterKind m);
2022-05-17 07:53:24 +00:00
void updateUsbButtons();
2023-01-30 16:15:43 +00:00
void resetUsbButtons();
void resetUsbCommands();
int oldFreqDialVal;
2018-06-19 19:58:52 +00:00
rigCapabilities rigCaps;
rigInput currentModSrc = inputUnknown;
rigInput currentModDataSrc = inputUnknown;
mode_kind currentMode = modeUSB;
mode_info currentModeInfo;
bool haveRigCaps;
2023-01-29 18:39:24 +00:00
bool amTransmitting = false;
bool splitModeEnabled = false;
bool usingDataMode = false;
unsigned char micGain=0;
unsigned char accAGain=0;
unsigned char accBGain=0;
unsigned char accGain=0;
unsigned char usbGain=0;
unsigned char lanGain=0;
// Widgets and Special Windows:
calibrationWindow *cal;
repeaterSetup *rpt;
satelliteSetup *sat;
transceiverAdjustments *trxadj;
cwSender *cw;
2022-10-22 19:55:08 +00:00
controllerSetup* shut;
2021-07-08 07:31:59 +00:00
aboutbox *abtBox;
selectRadio *selRad;
loggingWindow *logWindow;
2023-02-10 21:03:37 +00:00
bandbuttons *bandbtns;
2023-02-12 02:39:02 +00:00
frequencyinputwidget *finputbtns;
settingswidget *setupui;
2021-02-19 09:28:03 +00:00
udpServer* udp = Q_NULLPTR;
rigCtlD* rigCtl = Q_NULLPTR;
QThread* serverThread = Q_NULLPTR;
void bandStackBtnClick();
bool waitingForBandStackRtn;
char bandStkBand;
char bandStkRegCode;
2021-02-22 07:58:23 +00:00
bool freqLock;
float tsPlus;
float tsPlusShift;
float tsPlusControl;
float tsPage;
float tsPageShift;
float tsWfScroll;
2021-02-22 07:58:23 +00:00
unsigned int tsPlusHz;
unsigned int tsPlusShiftHz;
unsigned int tsPlusControlHz;
unsigned int tsPageHz;
unsigned int tsPageShiftHz;
unsigned int tsWfScrollHz;
unsigned int tsKnobHz;
2021-02-22 07:58:23 +00:00
rigstate* rigState = Q_NULLPTR;
2021-02-22 07:58:23 +00:00
2023-01-16 12:24:22 +00:00
passbandActions passbandAction = passbandStatic;
double TPBFInner = 0.0;
double TPBFOuter = 0.0;
double passbandCenterFrequency = 0.0;
double pbtDefault = 0.0;
quint16 cwPitch = 600;
2023-01-29 19:46:13 +00:00
availableBands lastRequestedBand=bandGen;
SERVERCONFIG serverConfig;
2022-04-22 10:11:21 +00:00
void serverAddUserLine(const QString& user, const QString& pass, const int& type);
#if defined (USB_CONTROLLER)
2022-04-22 10:11:21 +00:00
usbController *usbControllerDev = Q_NULLPTR;
QThread *usbControllerThread = Q_NULLPTR;
2022-05-17 07:53:24 +00:00
QString usbDeviceName;
QVector<COMMAND> usbCommands;
2022-09-18 20:00:44 +00:00
QVector<BUTTON> usbButtons;
#endif
2021-06-04 13:43:27 +00:00
2022-09-29 16:17:51 +00:00
dxClusterClient* cluster = Q_NULLPTR;
QThread* clusterThread = Q_NULLPTR;
QMap<QString, spotData*> clusterSpots;
QTimer clusterTimer;
QCPItemText* text=Q_NULLPTR;
2022-09-30 16:05:42 +00:00
QList<clusterSettings> clusters;
QMutex clusterMutex;
2022-10-09 13:23:07 +00:00
QColor clusterColor;
audioDevices* audioDev = Q_NULLPTR;
2018-06-19 19:58:52 +00:00
};
Q_DECLARE_METATYPE(struct rigCapabilities)
Q_DECLARE_METATYPE(struct freqt)
Q_DECLARE_METATYPE(struct mode_info)
Q_DECLARE_METATYPE(struct udpPreferences)
Q_DECLARE_METATYPE(struct preferences)
Q_DECLARE_METATYPE(enum prefIfItem)
Q_DECLARE_METATYPE(enum prefRaItem)
Q_DECLARE_METATYPE(enum prefCtItem)
Q_DECLARE_METATYPE(enum prefLanItem)
Q_DECLARE_METATYPE(enum prefClusterItem)
Q_DECLARE_METATYPE(enum udpPrefsItem)
2021-05-17 15:19:36 +00:00
Q_DECLARE_METATYPE(struct audioPacket)
2021-06-04 07:24:26 +00:00
Q_DECLARE_METATYPE(struct audioSetup)
2022-01-04 19:55:48 +00:00
Q_DECLARE_METATYPE(struct SERVERCONFIG)
Q_DECLARE_METATYPE(struct timekind)
Q_DECLARE_METATYPE(struct datekind)
2022-01-22 15:28:41 +00:00
Q_DECLARE_METATYPE(struct networkStatus)
Q_DECLARE_METATYPE(struct networkAudioLevels)
2022-09-29 16:17:51 +00:00
Q_DECLARE_METATYPE(struct spotData)
Q_DECLARE_METATYPE(enum rigInput)
Q_DECLARE_METATYPE(enum meterKind)
Q_DECLARE_METATYPE(enum spectrumMode)
2022-09-26 00:44:49 +00:00
Q_DECLARE_METATYPE(enum mode_kind)
Q_DECLARE_METATYPE(enum vfo_t)
Q_DECLARE_METATYPE(QList<radio_cap_packet>)
Q_DECLARE_METATYPE(QList<spotData>)
2021-11-23 00:39:10 +00:00
Q_DECLARE_METATYPE(rigstate*)
2022-04-22 10:11:21 +00:00
Q_DECLARE_METATYPE(QVector <BUTTON>*)
2022-05-17 07:53:24 +00:00
Q_DECLARE_METATYPE(struct BUTTON*)
2022-04-25 16:40:41 +00:00
Q_DECLARE_METATYPE(QVector <COMMAND>*)
2022-04-27 11:56:54 +00:00
Q_DECLARE_METATYPE(const COMMAND*)
Q_DECLARE_METATYPE(codecType)
2023-01-05 19:37:53 +00:00
Q_DECLARE_METATYPE(errorType)
Q_DECLARE_METATYPE(enum duplexMode)
Q_DECLARE_METATYPE(enum rptAccessTxRx)
Q_DECLARE_METATYPE(struct rptrTone_t)
Q_DECLARE_METATYPE(struct rptrAccessData_t)
//void (*wfmain::logthistext)(QString text) = NULL;
2018-06-19 19:58:52 +00:00
#endif // WFMAIN_H
2022-05-14 14:05:48 +00:00
#endif