2023-02-18 19:25:02 -08:00
# include "settingswidget.h"
2023-06-08 08:20:50 +01:00
# include "qserialportinfo.h"
2023-02-18 19:25:02 -08:00
# include "ui_settingswidget.h"
# define setchk(a,b) quietlyUpdateCheckbox(a,b)
2025-06-03 23:48:06 +01:00
2023-02-18 19:25:02 -08:00
settingswidget : : settingswidget ( QWidget * parent ) :
QWidget ( parent ) ,
ui ( new Ui : : settingswidget )
{
ui - > setupUi ( this ) ;
2023-05-28 22:11:59 +01:00
2023-06-11 22:31:32 +01:00
connect ( ui - > serverUsersTable , SIGNAL ( rowAdded ( int ) ) , this , SLOT ( serverAddUserLine ( int ) ) ) ;
2025-02-03 20:20:40 +00:00
connect ( ui - > serverUsersTable , SIGNAL ( rowDeleted ( int ) ) , this , SLOT ( serverDeleteUserLine ( int ) ) ) ;
2023-02-18 19:25:02 -08:00
createSettingsListItems ( ) ;
populateComboBoxes ( ) ;
2023-06-08 08:20:50 +01:00
# ifdef QT_DEBUG
ui - > debugBtn - > setVisible ( true ) ;
ui - > satOpsBtn - > setVisible ( true ) ;
2025-01-11 12:32:31 +00:00
ui - > adjRefBtn - > setVisible ( false ) ;
2023-06-08 08:20:50 +01:00
# else
ui - > debugBtn - > setVisible ( false ) ;
ui - > satOpsBtn - > setVisible ( false ) ;
2025-01-11 12:32:31 +00:00
ui - > adjRefBtn - > setVisible ( false ) ;
2023-06-08 08:20:50 +01:00
# endif
2025-02-23 12:32:01 -08:00
setupKeyShortcuts ( ) ;
2023-02-18 19:25:02 -08:00
}
settingswidget : : ~ settingswidget ( )
{
delete ui ;
2023-05-28 22:11:59 +01:00
2026-01-02 18:59:51 +00:00
if ( audioDev ! = nullptr ) {
2023-05-28 22:11:59 +01:00
delete audioDev ;
}
if ( prefs - > audioSystem = = portAudio ) {
Pa_Terminate ( ) ;
}
2023-02-18 19:25:02 -08:00
}
2023-02-18 23:26:58 -08:00
// Startup:
2023-02-18 19:25:02 -08:00
void settingswidget : : createSettingsListItems ( )
{
// Add items to the settings tab list widget
2024-05-23 16:47:23 -07:00
ui - > settingsList - > addItem ( tr ( " Radio Access " ) ) ; // 0
ui - > settingsList - > addItem ( tr ( " User Interface " ) ) ; // 1
ui - > settingsList - > addItem ( tr ( " Radio Settings " ) ) ; // 2
ui - > settingsList - > addItem ( tr ( " Radio Server " ) ) ; // 3
ui - > settingsList - > addItem ( tr ( " External Control " ) ) ; // 4
ui - > settingsList - > addItem ( tr ( " DX Cluster " ) ) ; // 5
ui - > settingsList - > addItem ( tr ( " Experimental " ) ) ; // 6
2023-02-18 19:25:02 -08:00
//ui->settingsList->addItem("Audio Processing"); // 7
ui - > settingsStack - > setCurrentIndex ( 0 ) ;
}
void settingswidget : : populateComboBoxes ( )
{
2023-02-19 23:12:36 -08:00
ui - > baudRateCombo - > blockSignals ( true ) ;
2023-02-18 19:25:02 -08:00
ui - > baudRateCombo - > insertItem ( 0 , QString ( " 115200 " ) , 115200 ) ;
ui - > baudRateCombo - > insertItem ( 1 , QString ( " 57600 " ) , 57600 ) ;
ui - > baudRateCombo - > insertItem ( 2 , QString ( " 38400 " ) , 38400 ) ;
ui - > baudRateCombo - > insertItem ( 3 , QString ( " 28800 " ) , 28800 ) ;
ui - > baudRateCombo - > insertItem ( 4 , QString ( " 19200 " ) , 19200 ) ;
ui - > baudRateCombo - > insertItem ( 5 , QString ( " 9600 " ) , 9600 ) ;
ui - > baudRateCombo - > insertItem ( 6 , QString ( " 4800 " ) , 4800 ) ;
ui - > baudRateCombo - > insertItem ( 7 , QString ( " 2400 " ) , 2400 ) ;
ui - > baudRateCombo - > insertItem ( 8 , QString ( " 1200 " ) , 1200 ) ;
ui - > baudRateCombo - > insertItem ( 9 , QString ( " 300 " ) , 300 ) ;
2023-02-19 23:12:36 -08:00
ui - > baudRateCombo - > blockSignals ( false ) ;
2023-02-18 19:25:02 -08:00
2023-02-19 22:34:42 -08:00
ui - > meter2selectionCombo - > blockSignals ( true ) ;
2023-02-18 19:25:02 -08:00
ui - > meter2selectionCombo - > addItem ( " None " , meterNone ) ;
2025-01-10 07:49:47 +00:00
ui - > meter2selectionCombo - > addItem ( " Sub S-Meter " , meterSubS ) ;
2023-02-18 19:25:02 -08:00
ui - > meter2selectionCombo - > addItem ( " SWR " , meterSWR ) ;
ui - > meter2selectionCombo - > addItem ( " ALC " , meterALC ) ;
ui - > meter2selectionCombo - > addItem ( " Compression " , meterComp ) ;
ui - > meter2selectionCombo - > addItem ( " Voltage " , meterVoltage ) ;
ui - > meter2selectionCombo - > addItem ( " Current " , meterCurrent ) ;
ui - > meter2selectionCombo - > addItem ( " Center " , meterCenter ) ;
ui - > meter2selectionCombo - > addItem ( " TxRxAudio " , meterAudio ) ;
ui - > meter2selectionCombo - > addItem ( " RxAudio " , meterRxAudio ) ;
ui - > meter2selectionCombo - > addItem ( " TxAudio " , meterTxMod ) ;
ui - > meter2selectionCombo - > show ( ) ;
2023-02-19 22:34:42 -08:00
ui - > meter2selectionCombo - > blockSignals ( false ) ;
2024-02-05 13:42:00 -08:00
ui - > meter3selectionCombo - > blockSignals ( true ) ;
ui - > meter3selectionCombo - > addItem ( " None " , meterNone ) ;
2025-01-10 07:49:47 +00:00
ui - > meter3selectionCombo - > addItem ( " Sub S-Meter " , meterSubS ) ;
2024-02-05 13:42:00 -08:00
ui - > meter3selectionCombo - > addItem ( " SWR " , meterSWR ) ;
ui - > meter3selectionCombo - > addItem ( " ALC " , meterALC ) ;
ui - > meter3selectionCombo - > addItem ( " Compression " , meterComp ) ;
ui - > meter3selectionCombo - > addItem ( " Voltage " , meterVoltage ) ;
ui - > meter3selectionCombo - > addItem ( " Current " , meterCurrent ) ;
ui - > meter3selectionCombo - > addItem ( " Center " , meterCenter ) ;
ui - > meter3selectionCombo - > addItem ( " TxRxAudio " , meterAudio ) ;
ui - > meter3selectionCombo - > addItem ( " RxAudio " , meterRxAudio ) ;
ui - > meter3selectionCombo - > addItem ( " TxAudio " , meterTxMod ) ;
ui - > meter3selectionCombo - > show ( ) ;
ui - > meter3selectionCombo - > blockSignals ( false ) ;
2023-02-18 19:25:02 -08:00
ui - > secondaryMeterSelectionLabel - > show ( ) ;
2023-02-19 23:12:36 -08:00
ui - > audioRXCodecCombo - > blockSignals ( true ) ;
2023-02-18 23:36:13 -08:00
ui - > audioRXCodecCombo - > addItem ( " LPCM 1ch 16bit " , 4 ) ;
ui - > audioRXCodecCombo - > addItem ( " LPCM 1ch 8bit " , 2 ) ;
ui - > audioRXCodecCombo - > addItem ( " uLaw 1ch 8bit " , 1 ) ;
ui - > audioRXCodecCombo - > addItem ( " LPCM 2ch 16bit " , 16 ) ;
ui - > audioRXCodecCombo - > addItem ( " uLaw 2ch 8bit " , 32 ) ;
ui - > audioRXCodecCombo - > addItem ( " PCM 2ch 8bit " , 8 ) ;
ui - > audioRXCodecCombo - > addItem ( " Opus 1ch " , 64 ) ;
2025-01-23 20:04:17 +00:00
ui - > audioRXCodecCombo - > addItem ( " Opus 2ch " , 65 ) ;
ui - > audioRXCodecCombo - > addItem ( " ADPCM 1ch " , 128 ) ;
2023-02-19 23:12:36 -08:00
ui - > audioRXCodecCombo - > blockSignals ( false ) ;
2023-02-18 23:36:13 -08:00
2023-02-19 23:12:36 -08:00
ui - > audioTXCodecCombo - > blockSignals ( true ) ;
2023-02-18 23:36:13 -08:00
ui - > audioTXCodecCombo - > addItem ( " LPCM 1ch 16bit " , 4 ) ;
ui - > audioTXCodecCombo - > addItem ( " LPCM 1ch 8bit " , 2 ) ;
ui - > audioTXCodecCombo - > addItem ( " uLaw 1ch 8bit " , 1 ) ;
ui - > audioTXCodecCombo - > addItem ( " Opus 1ch " , 64 ) ;
2025-01-23 20:04:17 +00:00
ui - > audioTXCodecCombo - > addItem ( " ADPCM 1ch " , 128 ) ;
2023-02-19 23:12:36 -08:00
ui - > audioTXCodecCombo - > blockSignals ( false ) ;
2023-02-18 19:25:02 -08:00
ui - > controlPortTxt - > setValidator ( new QIntValidator ( this ) ) ;
2023-05-27 20:26:53 +01:00
ui - > modInputData2ComboText - > setVisible ( false ) ;
ui - > modInputData2Combo - > setVisible ( false ) ;
ui - > modInputData3ComboText - > setVisible ( false ) ;
ui - > modInputData3Combo - > setVisible ( false ) ;
2023-05-28 22:11:59 +01:00
// Set color preset combo to an invalid value to force the current preset to be loaded
ui - > colorPresetCombo - > blockSignals ( true ) ;
ui - > colorPresetCombo - > setCurrentIndex ( - 1 ) ;
ui - > colorPresetCombo - > blockSignals ( false ) ;
2024-07-23 09:18:27 +01:00
ui - > decimalSeparatorsCombo - > blockSignals ( true ) ;
# if (QT_VERSION < QT_VERSION_CHECK(6,0,0))
2024-07-24 20:24:56 +01:00
ui - > decimalSeparatorsCombo - > addItem ( QString ( " \" %0 \" " ) . arg ( QLocale ( ) . decimalPoint ( ) ) , QLocale ( ) . decimalPoint ( ) ) ;
2024-07-23 09:18:27 +01:00
# else
2024-07-24 20:24:56 +01:00
ui - > decimalSeparatorsCombo - > addItem ( QString ( " \" %0 \" " ) . arg ( QLocale ( ) . decimalPoint ( ) ) , QLocale ( ) . decimalPoint ( ) . at ( 0 ) ) ;
2024-07-23 09:18:27 +01:00
# endif
ui - > decimalSeparatorsCombo - > addItem ( " \" , \" " , QChar ( ' , ' ) ) ;
ui - > decimalSeparatorsCombo - > addItem ( " \" . \" " , QChar ( ' . ' ) ) ;
2024-07-24 20:24:56 +01:00
ui - > decimalSeparatorsCombo - > addItem ( " \" : \" " , QChar ( ' : ' ) ) ;
2024-07-23 09:18:27 +01:00
ui - > decimalSeparatorsCombo - > addItem ( " \" \" " , QChar ( ' ' ) ) ;
ui - > decimalSeparatorsCombo - > setCurrentIndex ( 0 ) ;
ui - > decimalSeparatorsCombo - > blockSignals ( false ) ;
ui - > groupSeparatorsCombo - > blockSignals ( true ) ;
# if (QT_VERSION < QT_VERSION_CHECK(6,0,0))
2024-07-24 20:24:56 +01:00
ui - > groupSeparatorsCombo - > addItem ( QString ( " \" %0 \" " ) . arg ( QLocale ( ) . groupSeparator ( ) ) , QLocale ( ) . groupSeparator ( ) ) ;
2024-07-23 09:18:27 +01:00
# else
2024-07-24 20:24:56 +01:00
ui - > groupSeparatorsCombo - > addItem ( QString ( " \" %0 \" " ) . arg ( QLocale ( ) . groupSeparator ( ) ) , QLocale ( ) . groupSeparator ( ) . at ( 0 ) ) ;
2024-07-23 09:18:27 +01:00
# endif
ui - > groupSeparatorsCombo - > addItem ( " \" , \" " , QChar ( ' , ' ) ) ;
ui - > groupSeparatorsCombo - > addItem ( " \" . \" " , QChar ( ' . ' ) ) ;
2024-07-24 20:24:56 +01:00
ui - > groupSeparatorsCombo - > addItem ( " \" : \" " , QChar ( ' : ' ) ) ;
2024-07-23 09:18:27 +01:00
ui - > groupSeparatorsCombo - > addItem ( " \" \" " , QChar ( ' ' ) ) ;
ui - > groupSeparatorsCombo - > setCurrentIndex ( 0 ) ;
ui - > groupSeparatorsCombo - > blockSignals ( false ) ;
2025-01-11 13:43:40 +00:00
ui - > manufacturerCombo - > blockSignals ( true ) ;
ui - > manufacturerCombo - > addItem ( " Icom " , manufIcom ) ;
ui - > manufacturerCombo - > addItem ( " Kenwood " , manufKenwood ) ;
2025-05-10 12:35:35 +01:00
ui - > manufacturerCombo - > addItem ( " Yaesu " , manufYaesu ) ;
2025-01-14 14:17:53 +00:00
//ui->manufacturerCombo->addItem("FlexRadio",manufFlexRadio);
2025-01-11 13:43:40 +00:00
ui - > manufacturerCombo - > setCurrentIndex ( 0 ) ;
ui - > manufacturerCombo - > blockSignals ( false ) ;
2025-01-17 00:43:57 +00:00
ui - > networkConnectionTypeCombo - > blockSignals ( true ) ;
ui - > networkConnectionTypeCombo - > addItem ( " LAN " , connectionLAN ) ;
ui - > networkConnectionTypeCombo - > addItem ( " WiFi " , connectionWiFi ) ;
ui - > networkConnectionTypeCombo - > addItem ( " WAN " , connectionWAN ) ;
ui - > networkConnectionTypeCombo - > blockSignals ( false ) ;
2023-02-18 19:25:02 -08:00
}
2025-02-23 12:32:01 -08:00
QShortcut * settingswidget : : setupKeyShortcut ( const QKeySequence k )
{
QShortcut * sc = new QShortcut ( this ) ;
sc - > setKey ( k ) ;
sc - > setContext ( Qt : : WindowShortcut ) ; // for this widget, all assignments are window-only
connect ( sc , & QShortcut : : activated , this ,
[ = ] ( ) {
this - > runShortcut ( k ) ;
} ) ;
return sc ;
}
void settingswidget : : setupKeyShortcuts ( )
{
// Pages within the Settings widget
shortcuts . append ( setupKeyShortcut ( Qt : : Key_F1 | Qt : : SHIFT ) ) ;
shortcuts . append ( setupKeyShortcut ( Qt : : Key_F2 | Qt : : SHIFT ) ) ;
shortcuts . append ( setupKeyShortcut ( Qt : : Key_F3 | Qt : : SHIFT ) ) ;
shortcuts . append ( setupKeyShortcut ( Qt : : Key_F4 | Qt : : SHIFT ) ) ;
shortcuts . append ( setupKeyShortcut ( Qt : : Key_F5 | Qt : : SHIFT ) ) ;
shortcuts . append ( setupKeyShortcut ( Qt : : Key_F6 | Qt : : SHIFT ) ) ;
shortcuts . append ( setupKeyShortcut ( Qt : : Key_F7 | Qt : : SHIFT ) ) ;
//shortcuts.append(setupKeyShortcut(Qt::Key_F8 | Qt::SHIFT));
}
void settingswidget : : runShortcut ( const QKeySequence k ) {
qDebug ( ) < < " Settings widget, running shortcut for key: " < < k ;
if ( k = = ( Qt : : SHIFT | Qt : : Key : : Key_F1 ) ) {
ui - > settingsStack - > setCurrentIndex ( 0 ) ;
2025-02-23 13:04:48 -08:00
} else if ( k = = ( Qt : : SHIFT | Qt : : Key : : Key_F2 ) ) {
2025-02-23 12:32:01 -08:00
ui - > settingsStack - > setCurrentIndex ( 1 ) ;
} else if ( k = = ( Qt : : SHIFT | Qt : : Key : : Key_F3 ) ) {
ui - > settingsStack - > setCurrentIndex ( 2 ) ;
} else if ( k = = ( Qt : : SHIFT | Qt : : Key : : Key_F4 ) ) {
ui - > settingsStack - > setCurrentIndex ( 3 ) ;
} else if ( k = = ( Qt : : SHIFT | Qt : : Key : : Key_F5 ) ) {
ui - > settingsStack - > setCurrentIndex ( 4 ) ;
} else if ( k = = ( Qt : : SHIFT | Qt : : Key : : Key_F6 ) ) {
ui - > settingsStack - > setCurrentIndex ( 5 ) ;
} else if ( k = = ( Qt : : SHIFT | Qt : : Key : : Key_F7 ) ) {
ui - > settingsStack - > setCurrentIndex ( 6 ) ;
} else if ( k = = ( Qt : : SHIFT | Qt : : Key : : Key_F8 ) ) {
// ui->settingsStack->setCurrentIndex(7);
} else {
// no action
}
}
2023-02-18 23:26:58 -08:00
// Updating Preferences:
2023-02-18 19:25:02 -08:00
void settingswidget : : acceptPreferencesPtr ( preferences * pptr )
{
if ( pptr ! = NULL )
{
qDebug ( logGui ( ) ) < < " Accepting general preferences pointer into settings widget. " ;
prefs = pptr ;
havePrefs = true ;
}
}
void settingswidget : : acceptUdpPreferencesPtr ( udpPreferences * upptr )
{
if ( upptr ! = NULL )
{
qDebug ( logGui ( ) ) < < " Accepting UDP preferences pointer into settings widget. " ;
udpPrefs = upptr ;
haveUdpPrefs = true ;
}
2023-05-28 22:11:59 +01:00
// New we have prefs, we get audio information
2026-01-02 18:59:51 +00:00
if ( audioDev = = nullptr ) {
2023-05-28 22:11:59 +01:00
audioDev = new audioDevices ( prefs - > audioSystem , QFontMetrics ( ui - > audioSystemCombo - > font ( ) ) ) ;
connect ( audioDev , SIGNAL ( updated ( ) ) , this , SLOT ( setAudioDevicesUI ( ) ) ) ;
audioDev - > enumerate ( ) ;
}
2023-02-18 19:25:02 -08:00
}
2023-02-21 22:54:15 -08:00
void settingswidget : : acceptServerConfig ( SERVERCONFIG * sc )
{
if ( sc ! = NULL )
{
qDebug ( logGui ( ) ) < < " Accepting ServerConfig pointer into settings widget. " ;
serverConfig = sc ;
haveServerConfig = true ;
}
}
2023-05-28 22:11:59 +01:00
void settingswidget : : acceptColorPresetPtr ( colorPrefsType * cp )
{
if ( cp ! = NULL )
{
qDebug ( logGui ( ) ) < < " Accepting color preset pointer into settings widget. " ;
colorPreset = cp ;
}
}
2023-02-20 13:45:33 -08:00
2023-02-20 20:45:55 -08:00
void settingswidget : : insertClusterOutputText ( QString text )
{
ui - > clusterOutputTextEdit - > moveCursor ( QTextCursor : : End ) ;
ui - > clusterOutputTextEdit - > insertPlainText ( text ) ;
ui - > clusterOutputTextEdit - > moveCursor ( QTextCursor : : End ) ;
}
2023-02-20 13:45:33 -08:00
void settingswidget : : setUItoClustersList ( )
{
2023-06-11 10:33:16 +01:00
int defaultCluster = 0 ;
int numClusters = prefs - > clusters . size ( ) ;
if ( numClusters > 0 )
2023-02-20 13:45:33 -08:00
{
2023-06-11 10:33:16 +01:00
ui - > clusterServerNameCombo - > blockSignals ( true ) ;
for ( int f = 0 ; f < prefs - > clusters . size ( ) ; f + + )
2023-02-20 13:45:33 -08:00
{
2023-06-11 10:33:16 +01:00
ui - > clusterServerNameCombo - > addItem ( prefs - > clusters [ f ] . server ) ;
if ( prefs - > clusters [ f ] . isdefault ) {
defaultCluster = f ;
2023-02-20 13:45:33 -08:00
}
}
2023-06-11 10:33:16 +01:00
ui - > clusterServerNameCombo - > blockSignals ( false ) ;
if ( prefs - > clusters . size ( ) > defaultCluster )
{
ui - > clusterServerNameCombo - > setCurrentIndex ( defaultCluster ) ;
ui - > clusterTcpPortLineEdit - > blockSignals ( true ) ;
ui - > clusterUsernameLineEdit - > blockSignals ( true ) ;
ui - > clusterPasswordLineEdit - > blockSignals ( true ) ;
ui - > clusterTimeoutLineEdit - > blockSignals ( true ) ;
ui - > clusterTcpPortLineEdit - > setText ( QString : : number ( prefs - > clusters [ defaultCluster ] . port ) ) ;
ui - > clusterUsernameLineEdit - > setText ( prefs - > clusters [ defaultCluster ] . userName ) ;
ui - > clusterPasswordLineEdit - > setText ( prefs - > clusters [ defaultCluster ] . password ) ;
ui - > clusterTimeoutLineEdit - > setText ( QString : : number ( prefs - > clusters [ defaultCluster ] . timeout ) ) ;
ui - > clusterTcpPortLineEdit - > blockSignals ( false ) ;
ui - > clusterUsernameLineEdit - > blockSignals ( false ) ;
ui - > clusterPasswordLineEdit - > blockSignals ( false ) ;
ui - > clusterTimeoutLineEdit - > blockSignals ( false ) ;
}
2023-02-20 13:45:33 -08:00
}
}
2023-05-27 20:26:53 +01:00
void settingswidget : : updateIfPrefs ( quint64 items )
2023-02-18 19:25:02 -08:00
{
prefIfItem pif ;
if ( items & ( int ) if_all )
{
items = 0xffffffff ;
}
for ( int i = 1 ; i < ( int ) if_all ; i = i < < 1 )
{
if ( items & i )
{
qDebug ( logGui ( ) ) < < " Updating If pref " < < ( int ) i ;
pif = ( prefIfItem ) i ;
updateIfPref ( pif ) ;
}
}
}
2023-05-27 20:26:53 +01:00
void settingswidget : : updateColPrefs ( quint64 items )
{
prefColItem col ;
if ( items & ( int ) if_all )
{
items = 0xffffffff ;
}
for ( int i = 1 ; i < ( int ) col_all ; i = i < < 1 )
{
if ( items & i )
{
qDebug ( logGui ( ) ) < < " Updating Color pref " < < ( int ) i ;
col = ( prefColItem ) i ;
updateColPref ( col ) ;
}
}
}
void settingswidget : : updateRaPrefs ( quint64 items )
2023-02-18 19:25:02 -08:00
{
prefRaItem pra ;
if ( items & ( int ) ra_all )
{
items = 0xffffffff ;
}
for ( int i = 1 ; i < ( int ) ra_all ; i = i < < 1 )
{
if ( items & i )
{
qDebug ( logGui ( ) ) < < " Updating Ra pref " < < ( int ) i ;
pra = ( prefRaItem ) i ;
updateRaPref ( pra ) ;
}
}
}
2023-05-27 20:26:53 +01:00
void settingswidget : : updateRsPrefs ( quint64 items )
{
prefRsItem prs ;
if ( items & ( int ) rs_all )
{
items = 0xffffffff ;
}
for ( int i = 1 ; i < ( int ) rs_all ; i = i < < 1 )
{
if ( items & i )
{
2024-10-26 10:33:32 +01:00
qDebug ( logGui ( ) ) < < " Updating Rs pref " < < ( int ) i ;
2023-05-27 20:26:53 +01:00
prs = ( prefRsItem ) i ;
updateRsPref ( prs ) ;
}
}
}
void settingswidget : : updateCtPrefs ( quint64 items )
2023-02-18 19:25:02 -08:00
{
prefCtItem pct ;
if ( items & ( int ) ct_all )
{
items = 0xffffffff ;
}
for ( int i = 1 ; i < ( int ) ct_all ; i = i < < 1 )
{
if ( items & i )
{
qDebug ( logGui ( ) ) < < " Updating Ct pref " < < ( int ) i ;
pct = ( prefCtItem ) i ;
updateCtPref ( pct ) ;
}
}
}
2023-05-27 20:26:53 +01:00
void settingswidget : : updateServerConfigs ( quint64 items )
2023-06-08 21:58:22 +01:00
{
prefServerItem si ;
2023-02-21 22:54:15 -08:00
if ( items & ( int ) s_all )
{
items = 0xffffffff ;
}
for ( int i = 1 ; i < ( int ) s_all ; i = i < < 1 )
{
if ( items & i )
{
qDebug ( logGui ( ) ) < < " Updating ServerConfig " < < ( int ) i ;
2023-06-08 21:58:22 +01:00
si = ( prefServerItem ) i ;
2023-02-21 22:54:15 -08:00
updateServerConfig ( si ) ;
}
}
}
2023-05-27 20:26:53 +01:00
void settingswidget : : updateLanPrefs ( quint64 items )
2023-05-28 22:11:59 +01:00
{
2023-02-18 19:25:02 -08:00
prefLanItem plan ;
if ( items & ( int ) l_all )
{
items = 0xffffffff ;
}
for ( int i = 1 ; i < ( int ) l_all ; i = i < < 1 )
{
if ( items & i )
{
qDebug ( logGui ( ) ) < < " Updating Lan pref " < < ( int ) i ;
plan = ( prefLanItem ) i ;
updateLanPref ( plan ) ;
}
}
}
2023-05-27 20:26:53 +01:00
void settingswidget : : updateClusterPrefs ( quint64 items )
2023-02-18 19:25:02 -08:00
{
prefClusterItem pcl ;
if ( items & ( int ) cl_all )
{
items = 0xffffffff ;
2023-06-11 10:33:16 +01:00
// Initial setup, populate combobox
ui - > clusterServerNameCombo - > clear ( ) ;
2024-10-26 10:33:32 +01:00
for ( const auto & c : prefs - > clusters )
2023-06-11 10:33:16 +01:00
{
ui - > clusterServerNameCombo - > addItem ( c . server ) ;
}
2023-02-18 19:25:02 -08:00
}
2023-02-18 19:31:17 -08:00
for ( int i = 1 ; i < ( int ) cl_all ; i = i < < 1 )
2023-02-18 19:25:02 -08:00
{
2023-02-18 19:31:17 -08:00
if ( items & i )
2023-02-18 19:25:02 -08:00
{
qDebug ( logGui ( ) ) < < " Updating Cluster pref " < < ( int ) i ;
pcl = ( prefClusterItem ) i ;
updateClusterPref ( pcl ) ;
}
}
}
void settingswidget : : updateIfPref ( prefIfItem pif )
{
2023-02-21 22:54:15 -08:00
if ( prefs = = NULL )
return ;
2023-02-18 19:25:02 -08:00
updatingUIFromPrefs = true ;
switch ( pif )
{
case if_useFullScreen :
quietlyUpdateCheckbox ( ui - > fullScreenChk , prefs - > useFullScreen ) ;
break ;
case if_useSystemTheme :
quietlyUpdateCheckbox ( ui - > useSystemThemeChk , prefs - > useSystemTheme ) ;
break ;
case if_drawPeaks :
// depreciated;
break ;
case if_underlayMode :
updateUnderlayMode ( ) ;
break ;
case if_underlayBufferSize :
quietlyUpdateSlider ( ui - > underlayBufferSlider , prefs - > underlayBufferSize ) ;
break ;
case if_wfAntiAlias :
quietlyUpdateCheckbox ( ui - > wfAntiAliasChk , prefs - > wfAntiAlias ) ;
break ;
case if_wfInterpolate :
quietlyUpdateCheckbox ( ui - > wfInterpolateChk , prefs - > wfInterpolate ) ;
break ;
case if_wftheme :
// Not handled in settings.
break ;
case if_plotFloor :
// Not handled in settings.
break ;
case if_plotCeiling :
// Not handled in settings.
break ;
case if_stylesheetPath :
// No UI element for this.
break ;
case if_wflength :
// Not handled in settings.
break ;
case if_confirmExit :
// No UI element for this.
break ;
case if_confirmPowerOff :
// No UI element for this.
break ;
2024-11-05 18:46:21 +00:00
case if_meter1Type :
{
// No local widget for this
break ;
}
2023-02-19 18:29:22 -08:00
case if_meter2Type :
2023-02-18 19:25:02 -08:00
{
2023-02-19 22:34:42 -08:00
ui - > meter2selectionCombo - > blockSignals ( true ) ;
2023-02-18 19:25:02 -08:00
int m = ui - > meter2selectionCombo - > findData ( prefs - > meter2Type ) ;
ui - > meter2selectionCombo - > setCurrentIndex ( m ) ;
2023-02-19 22:34:42 -08:00
ui - > meter2selectionCombo - > blockSignals ( false ) ;
2024-02-05 14:03:24 -08:00
if ( prefs - > meter2Type ! = meterNone ) {
muteSingleComboItem ( ui - > meter3selectionCombo , m ) ;
}
2023-02-18 19:25:02 -08:00
break ;
}
2024-02-05 13:42:00 -08:00
case if_meter3Type :
{
ui - > meter3selectionCombo - > blockSignals ( true ) ;
int m = ui - > meter3selectionCombo - > findData ( prefs - > meter3Type ) ;
ui - > meter3selectionCombo - > setCurrentIndex ( m ) ;
ui - > meter3selectionCombo - > blockSignals ( false ) ;
2024-02-05 14:03:24 -08:00
if ( prefs - > meter3Type ! = meterNone ) {
muteSingleComboItem ( ui - > meter2selectionCombo , m ) ;
}
2024-02-05 13:42:00 -08:00
break ;
}
2024-02-06 11:06:50 -08:00
case if_compMeterReverse :
{
quietlyUpdateCheckbox ( ui - > revCompMeterBtn , prefs - > compMeterReverse ) ;
break ;
}
2023-02-18 19:25:02 -08:00
case if_clickDragTuningEnable :
quietlyUpdateCheckbox ( ui - > clickDragTuningEnableChk , prefs - > clickDragTuningEnable ) ;
break ;
case if_currentColorPresetNumber :
2023-05-28 22:11:59 +01:00
//ui->colorPresetCombo->blockSignals(true);
2023-06-08 08:20:50 +01:00
{
colorPrefsType p ;
for ( int pn = 0 ; pn < numColorPresetsTotal ; pn + + )
{
p = colorPreset [ pn ] ;
2026-01-02 18:59:51 +00:00
if ( p . presetName ! = nullptr )
2023-06-08 08:20:50 +01:00
ui - > colorPresetCombo - > setItemText ( pn , * p . presetName ) ;
}
ui - > colorPresetCombo - > setCurrentIndex ( prefs - > currentColorPresetNumber ) ;
//ui->colorPresetCombo->blockSignals(false);
// activate? or done when prefs load? Maybe some of each?
// TODO
break ;
}
2023-05-28 22:11:59 +01:00
case if_rigCreatorEnable :
quietlyUpdateCheckbox ( ui - > rigCreatorChk , prefs - > rigCreatorEnable ) ;
2023-09-19 23:04:48 +01:00
break ;
case if_frequencyUnits :
quietlyUpdateCombobox ( ui - > frequencyUnitsCombo , prefs - > frequencyUnits ) ;
break ;
2024-06-12 17:11:01 +01:00
case if_region :
quietlyUpdateLineEdit ( ui - > regionTxt , prefs - > region ) ;
break ;
case if_showBands :
quietlyUpdateCheckbox ( ui - > showBandsChk , prefs - > showBands ) ;
break ;
2024-07-23 09:18:27 +01:00
case if_separators :
quietlyUpdateCombobox ( ui - > groupSeparatorsCombo , QVariant ( prefs - > groupSeparator ) ) ;
quietlyUpdateCombobox ( ui - > decimalSeparatorsCombo , QVariant ( prefs - > decimalSeparator ) ) ;
2025-01-23 23:50:10 +00:00
break ;
2025-01-18 12:29:34 +00:00
case if_forceVfoMode :
quietlyUpdateCheckbox ( ui - > forceVfoModeChk , prefs - > forceVfoMode ) ;
2024-07-23 09:18:27 +01:00
break ;
2025-05-06 18:29:08 +01:00
case if_autoPowerOn :
quietlyUpdateCheckbox ( ui - > autoPowerOnChk , prefs - > autoPowerOn ) ;
break ;
2023-02-18 19:25:02 -08:00
default :
qWarning ( logGui ( ) ) < < " Did not understand if pref update item " < < ( int ) pif ;
break ;
}
updatingUIFromPrefs = false ;
}
2023-05-27 20:26:53 +01:00
void settingswidget : : updateColPref ( prefColItem col )
{
if ( prefs = = NULL )
return ;
updatingUIFromPrefs = true ;
2023-05-28 22:11:59 +01:00
int pos = ui - > colorPresetCombo - > currentIndex ( ) ;
2023-05-27 20:26:53 +01:00
switch ( col )
{
case col_grid :
2023-05-28 22:11:59 +01:00
{
QColor c = ( colorPreset [ pos ] . gridColor ) ;
setColorElement ( c , ui - > colorSwatchGrid , ui - > colorEditGrid ) ;
break ;
}
case col_axis :
{
QColor c = ( colorPreset [ pos ] . axisColor ) ;
setColorElement ( c , ui - > colorSwatchAxis , ui - > colorEditAxis ) ;
break ;
}
case col_text :
{
QColor c = ( colorPreset [ pos ] . textColor ) ;
setColorElement ( c , ui - > colorSwatchText , ui - > colorEditText ) ;
break ;
}
case col_plotBackground :
{
QColor c = ( colorPreset [ pos ] . plotBackground ) ;
setColorElement ( c , ui - > colorSwatchPlotBackground , ui - > colorEditPlotBackground ) ;
break ;
}
case col_spectrumLine :
{
QColor c = ( colorPreset [ pos ] . spectrumLine ) ;
setColorElement ( c , ui - > colorSwatchSpecLine , ui - > colorEditSpecLine ) ;
break ;
}
case col_spectrumFill :
{
QColor c = ( colorPreset [ pos ] . spectrumFill ) ;
setColorElement ( c , ui - > colorSwatchSpecFill , ui - > colorEditSpecFill ) ;
break ;
}
2024-04-14 21:56:34 -07:00
case col_useSpectrumFillGradient :
{
quietlyUpdateCheckbox ( ui - > useSpectrumFillGradientChk , colorPreset [ pos ] . useSpectrumFillGradient ) ;
break ;
}
case col_spectrumFillTop :
{
QColor c = ( colorPreset [ pos ] . spectrumFillTop ) ;
setColorElement ( c , ui - > colorSwatchSpecFillTop , ui - > colorEditSpecFillTop ) ;
break ;
}
case col_spectrumFillBot :
{
QColor c = ( colorPreset [ pos ] . spectrumFillBot ) ;
setColorElement ( c , ui - > colorSwatchSpecFillBot , ui - > colorEditSpecFillBot ) ;
break ;
}
2023-05-28 22:11:59 +01:00
case col_underlayLine :
{
QColor c = ( colorPreset [ pos ] . underlayLine ) ;
setColorElement ( c , ui - > colorSwatchUnderlayLine , ui - > colorEditUnderlayLine ) ;
break ;
}
case col_underlayFill :
{
QColor c = ( colorPreset [ pos ] . underlayFill ) ;
setColorElement ( c , ui - > colorSwatchUnderlayFill , ui - > colorEditUnderlayFill ) ;
2023-05-27 20:26:53 +01:00
break ;
2023-05-28 22:11:59 +01:00
}
2024-04-14 21:56:34 -07:00
case col_useUnderlayFillGradient :
{
quietlyUpdateCheckbox ( ui - > useUnderlayFillGradientChk , colorPreset [ pos ] . useUnderlayFillGradient ) ;
break ;
}
case col_underlayFillTop :
{
QColor c = ( colorPreset [ pos ] . underlayFillTop ) ;
setColorElement ( c , ui - > colorSwatchUnderlayFillTop , ui - > colorEditUnderlayFillTop ) ;
break ;
}
case col_underlayFillBot :
{
QColor c = ( colorPreset [ pos ] . underlayFillBot ) ;
setColorElement ( c , ui - > colorSwatchUnderlayFillBot , ui - > colorEditUnderlayFillBot ) ;
break ;
}
2023-05-28 22:11:59 +01:00
case col_tuningLine :
{
QColor c = ( colorPreset [ pos ] . tuningLine ) ;
setColorElement ( c , ui - > colorSwatchTuningLine , ui - > colorEditTuningLine ) ;
break ;
}
case col_passband :
{
QColor c = ( colorPreset [ pos ] . passband ) ;
setColorElement ( c , ui - > colorSwatchPassband , ui - > colorEditPassband ) ;
break ;
}
case col_pbtIndicator :
{
QColor c = ( colorPreset [ pos ] . pbt ) ;
setColorElement ( c , ui - > colorSwatchPBT , ui - > colorEditPBT ) ;
break ;
}
case col_meterLevel :
{
QColor c = ( colorPreset [ pos ] . meterLevel ) ;
setColorElement ( c , ui - > colorSwatchMeterLevel , ui - > colorEditMeterLevel ) ;
break ;
}
case col_meterAverage :
{
QColor c = ( colorPreset [ pos ] . meterAverage ) ;
setColorElement ( c , ui - > colorSwatchMeterAverage , ui - > colorEditMeterAvg ) ;
break ;
}
case col_meterPeakLevel :
{
QColor c = ( colorPreset [ pos ] . meterPeakLevel ) ;
setColorElement ( c , ui - > colorSwatchMeterPeakLevel , ui - > colorEditMeterPeakLevel ) ;
break ;
}
case col_meterHighScale :
{
QColor c = ( colorPreset [ pos ] . meterPeakScale ) ;
setColorElement ( c , ui - > colorSwatchMeterPeakScale , ui - > colorEditMeterPeakScale ) ;
break ;
}
case col_meterScale :
{
QColor c = ( colorPreset [ pos ] . meterScale ) ;
setColorElement ( c , ui - > colorSwatchMeterScale , ui - > colorEditMeterScale ) ;
break ;
}
case col_meterText :
{
QColor c = ( colorPreset [ pos ] . meterLowText ) ;
setColorElement ( c , ui - > colorSwatchMeterText , ui - > colorEditMeterText ) ;
break ;
}
case col_waterfallBack :
{
QColor c = ( colorPreset [ pos ] . wfBackground ) ;
setColorElement ( c , ui - > colorSwatchWfBackground , ui - > colorEditWfBackground ) ;
break ;
}
case col_waterfallGrid :
{
QColor c = ( colorPreset [ pos ] . wfGrid ) ;
setColorElement ( c , ui - > colorSwatchWfGrid , ui - > colorEditWfGrid ) ;
break ;
}
case col_waterfallAxis :
{
QColor c = ( colorPreset [ pos ] . wfAxis ) ;
setColorElement ( c , ui - > colorSwatchWfAxis , ui - > colorEditWfAxis ) ;
break ;
}
case col_waterfallText :
{
QColor c = ( colorPreset [ pos ] . wfText ) ;
setColorElement ( c , ui - > colorSwatchWfText , ui - > colorEditWfText ) ;
break ;
}
case col_clusterSpots :
{
QColor c = ( colorPreset [ pos ] . clusterSpots ) ;
setColorElement ( c , ui - > colorSwatchClusterSpots , ui - > colorEditClusterSpots ) ;
break ;
}
2024-12-30 19:22:26 +00:00
case col_buttonOff :
{
QColor c = ( colorPreset [ pos ] . buttonOff ) ;
setColorElement ( c , ui - > colorSwatchButtonOff , ui - > colorEditButtonOff ) ;
break ;
}
case col_buttonOn :
{
QColor c = ( colorPreset [ pos ] . buttonOn ) ;
setColorElement ( c , ui - > colorSwatchButtonOn , ui - > colorEditButtonOn ) ;
break ;
}
2023-05-27 20:26:53 +01:00
default :
qWarning ( logGui ( ) ) < < " Did not understand color pref update item " < < ( int ) col ;
break ;
}
updatingUIFromPrefs = false ;
}
2023-02-18 19:25:02 -08:00
void settingswidget : : updateRaPref ( prefRaItem pra )
{
2023-02-21 22:54:15 -08:00
if ( prefs = = NULL )
return ;
2023-02-18 19:25:02 -08:00
updatingUIFromPrefs = true ;
switch ( pra )
{
case ra_radioCIVAddr :
// It may be possible to ignore this value at this time.
// TODO
if ( prefs - > radioCIVAddr = = 0 )
{
ui - > rigCIVaddrHexLine - > setText ( " auto " ) ;
ui - > rigCIVaddrHexLine - > setEnabled ( false ) ;
} else {
ui - > rigCIVaddrHexLine - > setEnabled ( true ) ;
2025-05-10 12:35:35 +01:00
ui - > rigCIVaddrHexLine - > setText ( QString ( " %1 " ) . arg ( prefs - > radioCIVAddr , 4 , 16 ) ) ;
2023-02-18 19:25:02 -08:00
}
break ;
2023-05-28 22:11:59 +01:00
case ra_serialEnabled :
// Will be enabled/disabled by UDP connection prefs
break ;
2023-02-18 19:25:02 -08:00
case ra_CIVisRadioModel :
quietlyUpdateCheckbox ( ui - > useCIVasRigIDChk , prefs - > CIVisRadioModel ) ;
break ;
2024-12-30 14:19:52 +00:00
case ra_pttType :
quietlyUpdateCombobox ( ui - > pttTypeCombo , prefs - > pttType ) ;
2023-02-18 19:25:02 -08:00
break ;
case ra_polling_ms :
if ( prefs - > polling_ms = = 0 )
{
// Automatic
ui - > pollingButtonGroup - > blockSignals ( true ) ;
ui - > autoPollBtn - > setChecked ( true ) ;
ui - > manualPollBtn - > setChecked ( false ) ;
ui - > pollingButtonGroup - > blockSignals ( false ) ;
ui - > pollTimeMsSpin - > setEnabled ( false ) ;
} else {
// Manual
ui - > pollingButtonGroup - > blockSignals ( true ) ;
ui - > autoPollBtn - > setChecked ( false ) ;
ui - > manualPollBtn - > setChecked ( true ) ;
ui - > pollingButtonGroup - > blockSignals ( false ) ;
ui - > pollTimeMsSpin - > blockSignals ( true ) ;
ui - > pollTimeMsSpin - > setValue ( prefs - > polling_ms ) ;
ui - > pollTimeMsSpin - > blockSignals ( false ) ;
ui - > pollTimeMsSpin - > setEnabled ( true ) ;
}
break ;
case ra_serialPortRadio :
{
2023-06-08 08:20:50 +01:00
ui - > serialDeviceListCombo - > blockSignals ( true ) ;
ui - > serialDeviceListCombo - > clear ( ) ;
2025-01-14 13:35:14 +00:00
ui - > serialDeviceListCombo - > addItem ( " Auto " , " " ) ;
2024-10-26 10:33:32 +01:00
for ( const auto & serialPortInfo : QSerialPortInfo : : availablePorts ( ) )
2023-02-19 10:39:05 -08:00
{
2023-06-08 08:20:50 +01:00
# if defined(Q_OS_LINUX) || defined(Q_OS_MAC)
2025-01-14 13:52:37 +00:00
ui - > serialDeviceListCombo - > addItem ( QString ( " %0 (%1) " ) . arg ( serialPortInfo . portName ( ) , serialPortInfo . serialNumber ( ) ) , QString ( " /dev/%0 " ) . arg ( serialPortInfo . portName ( ) ) ) ;
2023-06-08 08:20:50 +01:00
# else
2025-01-14 13:35:14 +00:00
ui - > serialDeviceListCombo - > addItem ( QString ( " %0 (%1) " ) . arg ( serialPortInfo . portName ( ) , serialPortInfo . serialNumber ( ) ) , serialPortInfo . portName ( ) ) ;
2023-06-08 08:20:50 +01:00
# endif
2023-02-19 10:39:05 -08:00
}
2023-06-08 08:20:50 +01:00
# if defined(Q_OS_LINUX) || defined(Q_OS_MAC)
ui - > serialDeviceListCombo - > addItem ( " Manual... " , 256 ) ;
# endif
2025-01-14 13:35:14 +00:00
ui - > serialDeviceListCombo - > setCurrentIndex ( ui - > serialDeviceListCombo - > findData ( prefs - > serialPortRadio ) ) ;
2023-06-08 08:20:50 +01:00
ui - > serialDeviceListCombo - > blockSignals ( false ) ;
2023-02-18 19:25:02 -08:00
break ;
}
case ra_serialPortBaud :
2023-05-27 20:26:53 +01:00
quietlyUpdateCombobox ( ui - > baudRateCombo , QVariant : : fromValue ( prefs - > serialPortBaud ) ) ;
2023-02-18 19:25:02 -08:00
break ;
case ra_virtualSerialPort :
{
2023-06-08 08:20:50 +01:00
ui - > vspCombo - > blockSignals ( true ) ;
ui - > vspCombo - > clear ( ) ;
2024-12-30 10:09:27 +00:00
2023-06-08 08:20:50 +01:00
int i = 0 ;
2024-12-30 10:09:27 +00:00
# ifdef Q_OS_WIN
2025-01-14 13:35:14 +00:00
ui - > ptyDeviceLabel - > setText ( " Select one of a virtual serial port pair " ) ;
2024-12-30 10:09:27 +00:00
ui - > vspCombo - > addItem ( QString ( " None " ) , i + + ) ;
foreach ( const QSerialPortInfo & serialPortInfo , QSerialPortInfo : : availablePorts ( ) )
2023-02-19 10:39:05 -08:00
{
2025-01-14 13:35:14 +00:00
ui - > vspCombo - > addItem ( serialPortInfo . portName ( ) , serialPortInfo . portName ( ) ) ;
2024-12-30 10:09:27 +00:00
}
2023-06-08 08:20:50 +01:00
# else
2024-12-30 10:09:27 +00:00
// Provide reasonable names for the symbolic link to the pty device
# ifdef Q_OS_MAC
2025-01-14 13:35:14 +00:00
ui - > ptyDeviceLabel - > setText ( " pty devices located in: " + QStandardPaths : : standardLocations ( QStandardPaths : : DownloadLocation ) [ 0 ] ) ;
2024-12-30 10:09:27 +00:00
QString vspName = QStandardPaths : : standardLocations ( QStandardPaths : : DownloadLocation ) [ 0 ] + " /rig-pty " ;
# else
2025-01-14 13:35:14 +00:00
ui - > ptyDeviceLabel - > setText ( " pty devices located in: " + QDir : : homePath ( ) ) ;
2024-12-30 10:09:27 +00:00
QString vspName = QDir : : homePath ( ) + " /rig-pty " ;
2023-06-08 08:20:50 +01:00
# endif
2024-12-30 10:09:27 +00:00
for ( i = 1 ; i < 8 ; i + + ) {
2025-01-14 13:35:14 +00:00
ui - > vspCombo - > addItem ( " rig-pty " + QString : : number ( i ) , vspName + QString : : number ( i ) ) ;
2023-06-08 08:20:50 +01:00
2024-12-30 10:09:27 +00:00
if ( QFile : : exists ( vspName + QString : : number ( i ) ) ) {
auto * model = qobject_cast < QStandardItemModel * > ( ui - > vspCombo - > model ( ) ) ;
auto * item = model - > item ( ui - > vspCombo - > count ( ) - 1 ) ;
item - > setEnabled ( false ) ;
}
}
2025-01-14 13:35:14 +00:00
ui - > vspCombo - > addItem ( QString ( " None " ) , " None " ) ;
2024-12-30 10:09:27 +00:00
ui - > vspCombo - > setEditable ( true ) ;
2023-06-08 08:20:50 +01:00
# endif
2025-01-14 13:35:14 +00:00
ui - > vspCombo - > setCurrentIndex ( ui - > vspCombo - > findData ( prefs - > virtualSerialPort ) ) ;
2023-06-08 08:20:50 +01:00
if ( ui - > vspCombo - > currentIndex ( ) = = - 1 )
{
ui - > vspCombo - > setCurrentIndex ( 0 ) ;
2023-02-18 19:25:02 -08:00
}
2023-06-08 08:20:50 +01:00
ui - > vspCombo - > blockSignals ( false ) ;
2023-02-18 19:25:02 -08:00
break ;
}
case ra_localAFgain :
// Not handled here.
break ;
case ra_audioSystem :
2025-05-19 23:08:55 +01:00
quietlyUpdateCombobox ( ui - > audioSystemCombo , prefs - > audioSystem ) ;
quietlyUpdateCombobox ( ui - > audioSystemServerCombo , prefs - > audioSystem ) ;
2023-02-18 19:25:02 -08:00
break ;
2025-01-11 13:43:40 +00:00
case ra_manufacturer :
2025-05-19 23:08:55 +01:00
// Don't update quietly, to force the update to trigger.
ui - > manufacturerCombo - > setCurrentIndex ( ui - > manufacturerCombo - > findData ( prefs - > manufacturer ) ) ;
2025-01-11 13:43:40 +00:00
break ;
2023-02-18 19:25:02 -08:00
default :
qWarning ( logGui ( ) ) < < " Cannot update ra pref " < < ( int ) pra ;
}
updatingUIFromPrefs = false ;
}
2023-05-27 20:26:53 +01:00
void settingswidget : : updateRsPref ( prefRsItem prs )
{
if ( prefs = = NULL )
return ;
updatingUIFromPrefs = true ;
switch ( prs )
{
case rs_dataOffMod :
2023-09-30 11:08:20 +01:00
quietlyUpdateModCombo ( ui - > modInputCombo , QVariant : : fromValue ( prefs - > inputSource [ 0 ] ) ) ;
2023-05-27 20:26:53 +01:00
break ;
case rs_data1Mod :
2023-09-30 11:08:20 +01:00
quietlyUpdateModCombo ( ui - > modInputData1Combo , QVariant : : fromValue ( prefs - > inputSource [ 1 ] ) ) ;
2023-05-27 20:26:53 +01:00
break ;
case rs_data2Mod :
2023-09-30 11:08:20 +01:00
quietlyUpdateModCombo ( ui - > modInputData2Combo , QVariant : : fromValue ( prefs - > inputSource [ 2 ] ) ) ;
2023-05-27 20:26:53 +01:00
break ;
case rs_data3Mod :
2023-09-30 11:08:20 +01:00
quietlyUpdateModCombo ( ui - > modInputData3Combo , QVariant : : fromValue ( prefs - > inputSource [ 3 ] ) ) ;
2023-05-27 20:26:53 +01:00
break ;
2024-10-26 10:33:32 +01:00
case rs_clockUseUtc :
quietlyUpdateCheckbox ( ui - > useUTCChk , prefs - > useUTC ) ;
break ;
2025-01-11 12:32:31 +00:00
case rs_setRadioTime :
quietlyUpdateCheckbox ( ui - > setRadioTimeChk , prefs - > setRadioTime ) ;
break ;
2024-10-26 10:33:32 +01:00
// Not used
case rs_setClock :
case rs_pttOn :
case rs_pttOff :
case rs_satOps :
case rs_adjRef :
case rs_debug :
break ;
2023-05-27 20:26:53 +01:00
default :
qWarning ( logGui ( ) ) < < " Cannot update rs pref " < < ( int ) prs ;
}
updatingUIFromPrefs = false ;
}
2023-02-18 19:25:02 -08:00
void settingswidget : : updateCtPref ( prefCtItem pct )
{
2023-02-21 22:54:15 -08:00
if ( prefs = = NULL )
return ;
2023-02-18 19:25:02 -08:00
2023-02-21 22:54:15 -08:00
updatingUIFromPrefs = true ;
2023-02-18 19:25:02 -08:00
switch ( pct )
{
case ct_enablePTT :
quietlyUpdateCheckbox ( ui - > pttEnableChk , prefs - > enablePTT ) ;
break ;
case ct_niceTS :
quietlyUpdateCheckbox ( ui - > tuningFloorZerosChk , prefs - > niceTS ) ;
break ;
case ct_automaticSidebandSwitching :
quietlyUpdateCheckbox ( ui - > autoSSBchk , prefs - > automaticSidebandSwitching ) ;
break ;
case ct_enableUSBControllers :
quietlyUpdateCheckbox ( ui - > enableUsbChk , prefs - > enableUSBControllers ) ;
break ;
2024-12-31 13:23:15 +00:00
case ct_USBControllersReset :
case ct_USBControllersSetup :
break ;
2023-02-18 19:25:02 -08:00
default :
qWarning ( logGui ( ) ) < < " No UI element matches setting " < < ( int ) pct ;
break ;
}
2024-12-31 13:23:15 +00:00
2023-02-18 19:25:02 -08:00
updatingUIFromPrefs = false ;
}
void settingswidget : : updateLanPref ( prefLanItem plan )
{
2023-02-21 22:54:15 -08:00
if ( prefs = = NULL )
return ;
2023-02-18 19:25:02 -08:00
updatingUIFromPrefs = true ;
switch ( plan )
{
case l_enableLAN :
quietlyUpdateRadiobutton ( ui - > lanEnableBtn , prefs - > enableLAN ) ;
2023-09-22 19:06:09 +01:00
quietlyUpdateRadiobutton ( ui - > serialEnableBtn , ! prefs - > enableLAN ) ;
2024-04-14 15:59:16 -07:00
if ( ! connectedStatus ) {
ui - > groupNetwork - > setEnabled ( prefs - > enableLAN ) ;
ui - > groupSerial - > setEnabled ( ! prefs - > enableLAN ) ;
}
2023-02-18 19:25:02 -08:00
break ;
case l_enableRigCtlD :
quietlyUpdateCheckbox ( ui - > enableRigctldChk , prefs - > enableRigCtlD ) ;
break ;
case l_rigCtlPort :
ui - > rigctldPortTxt - > setText ( QString : : number ( prefs - > rigCtlPort ) ) ;
break ;
case l_tcpPort :
ui - > tcpServerPortTxt - > setText ( QString : : number ( prefs - > tcpPort ) ) ;
break ;
2023-07-06 10:36:11 +01:00
case l_tciPort :
ui - > tciServerPortTxt - > setText ( QString : : number ( prefs - > tciPort ) ) ;
break ;
2023-02-18 19:25:02 -08:00
case l_waterfallFormat :
2024-12-13 23:15:27 +00:00
quietlyUpdateCombobox ( ui - > waterfallFormatCombo , int ( prefs - > waterfallFormat ) ) ;
2023-02-18 19:25:02 -08:00
break ;
default :
2023-02-18 21:14:41 -08:00
qWarning ( logGui ( ) ) < < " Did not find matching preference for LAN ui update: " < < ( int ) plan ;
2023-02-18 19:25:02 -08:00
}
updatingUIFromPrefs = false ;
}
void settingswidget : : updateClusterPref ( prefClusterItem pcl )
{
2023-02-21 22:54:15 -08:00
if ( prefs = = NULL )
2023-06-11 10:33:16 +01:00
return ;
2023-02-21 22:54:15 -08:00
2023-02-18 19:25:02 -08:00
updatingUIFromPrefs = true ;
switch ( pcl )
{
case cl_clusterUdpEnable :
2023-06-11 10:33:16 +01:00
quietlyUpdateCheckbox ( ui - > clusterUdpGroup , prefs - > clusterUdpEnable ) ;
2023-02-18 19:25:02 -08:00
break ;
case cl_clusterTcpEnable :
2023-06-11 10:33:16 +01:00
quietlyUpdateCheckbox ( ui - > clusterTcpGroup , prefs - > clusterTcpEnable ) ;
2023-02-18 19:25:02 -08:00
break ;
case cl_clusterUdpPort :
2023-02-20 13:45:33 -08:00
ui - > clusterUdpPortLineEdit - > blockSignals ( true ) ;
2023-02-18 19:25:02 -08:00
ui - > clusterUdpPortLineEdit - > setText ( QString : : number ( prefs - > clusterUdpPort ) ) ;
2023-02-20 13:45:33 -08:00
ui - > clusterUdpPortLineEdit - > blockSignals ( false ) ;
2023-02-18 19:25:02 -08:00
break ;
case cl_clusterTcpServerName :
2023-02-20 13:45:33 -08:00
// Take this from the clusters list
2023-02-18 19:25:02 -08:00
break ;
case cl_clusterTcpUserName :
2023-02-20 13:45:33 -08:00
// Take this from the clusters list
2023-02-18 19:25:02 -08:00
break ;
case cl_clusterTcpPassword :
2023-02-20 13:45:33 -08:00
// Take this from the clusters list
break ;
case cl_clusterTcpPort :
2023-02-18 19:25:02 -08:00
break ;
case cl_clusterTimeout :
2023-02-20 13:45:33 -08:00
// Take this from the clusters list
2023-02-18 19:25:02 -08:00
break ;
case cl_clusterSkimmerSpotsEnable :
2023-06-11 10:33:16 +01:00
quietlyUpdateCheckbox ( ui - > clusterSkimmerSpotsEnable , prefs - > clusterSkimmerSpotsEnable ) ;
break ;
case cl_clusterTcpConnect :
case cl_clusterTcpDisconnect :
2023-02-18 19:25:02 -08:00
break ;
default :
qWarning ( logGui ( ) ) < < " Did not find matching UI element for cluster preference " < < ( int ) pcl ;
break ;
}
updatingUIFromPrefs = false ;
}
2023-06-08 21:58:22 +01:00
void settingswidget : : updateServerConfig ( prefServerItem si )
2023-02-21 22:54:15 -08:00
{
if ( serverConfig = = NULL )
{
qCritical ( logGui ( ) ) < < " serverConfig is NULL, cannot set preferences! " ;
return ;
}
updatingUIFromPrefs = true ;
switch ( si )
{
case s_enabled :
quietlyUpdateCheckbox ( ui - > serverEnableCheckbox , serverConfig - > enabled ) ;
break ;
2025-01-05 15:39:20 +00:00
case s_disableui :
quietlyUpdateCheckbox ( ui - > serverDisableUIChk , serverConfig - > disableUI ) ;
break ;
2023-02-21 22:54:15 -08:00
case s_lan :
// Not used here
break ;
case s_controlPort :
2023-06-08 21:58:22 +01:00
quietlyUpdateLineEdit ( ui - > serverControlPortText , QString : : number ( serverConfig - > controlPort ) ) ;
2023-02-21 22:54:15 -08:00
break ;
case s_civPort :
quietlyUpdateLineEdit ( ui - > serverCivPortText , QString : : number ( serverConfig - > civPort ) ) ;
break ;
case s_audioPort :
quietlyUpdateLineEdit ( ui - > serverAudioPortText , QString : : number ( serverConfig - > audioPort ) ) ;
break ;
case s_audioOutput :
2025-01-06 12:51:56 +00:00
if ( serverConfig - > enabled ) {
ui - > serverTXAudioOutputCombo - > setCurrentIndex ( audioDev - > findOutput ( " Server " ,
serverConfig - > rigs . first ( ) - > txAudioSetup . name , serverConfig - > rigs . first ( ) - > txAudioSetup . name . isEmpty ( ) ? false : true ) ) ;
if ( ui - > serverTXAudioOutputCombo - > currentIndex ( ) = = - 1 )
{
emit havePortError ( errorType ( true , serverConfig - > rigs . first ( ) - > rxAudioSetup . name ,
2025-01-09 00:35:26 +00:00
tr ( " \n Server audio output device does not exist, please check. \n Transmit audio will NOT work until this is corrected \n **** please disable the server if not required **** " ) ) ) ;
2025-01-06 12:51:56 +00:00
}
}
2023-02-21 22:54:15 -08:00
break ;
case s_audioInput :
2025-01-06 12:51:56 +00:00
if ( serverConfig - > enabled ) {
ui - > serverRXAudioInputCombo - > setCurrentIndex ( audioDev - > findInput ( " Server " ,
serverConfig - > rigs . first ( ) - > rxAudioSetup . name , serverConfig - > rigs . first ( ) - > rxAudioSetup . name . isEmpty ( ) ? false : true ) ) ;
if ( ui - > serverTXAudioOutputCombo - > currentIndex ( ) = = - 1 )
{
emit havePortError ( errorType ( true , serverConfig - > rigs . first ( ) - > rxAudioSetup . name ,
2025-01-09 00:35:26 +00:00
tr ( " \n Server audio input device does not exist, please check. \n Receive audio will NOT work until this is corrected \n **** please disable the server if not required **** " ) ) ) ;
2025-01-06 12:51:56 +00:00
}
}
2023-02-21 22:54:15 -08:00
break ;
case s_resampleQuality :
// Not used here
break ;
case s_baudRate :
// Not used here
break ;
case s_users :
// This is fairly complex
populateServerUsers ( ) ;
break ;
case s_rigs :
// Not used here
break ;
default :
qWarning ( logGui ( ) ) < < " Did not find matching UI element for ServerConfig " < < ( int ) si ;
}
updatingUIFromPrefs = false ;
}
2023-02-18 19:25:02 -08:00
void settingswidget : : updateUdpPrefs ( int items )
{
2023-06-08 21:58:22 +01:00
prefUDPItem upi ;
2023-02-18 19:25:02 -08:00
if ( items & ( int ) u_all )
{
items = 0xffffffff ;
}
2023-02-18 19:31:17 -08:00
for ( int i = 1 ; i < ( int ) u_all ; i = i < < 1 )
2023-02-18 19:25:02 -08:00
{
if ( items & i )
{
qDebug ( logGui ( ) ) < < " Updating UDP preference " < < i ;
2023-06-08 21:58:22 +01:00
upi = ( prefUDPItem ) i ;
2023-02-18 19:25:02 -08:00
updateUdpPref ( upi ) ;
}
}
}
2023-06-08 21:58:22 +01:00
void settingswidget : : updateUdpPref ( prefUDPItem upi )
2023-02-18 19:25:02 -08:00
{
updatingUIFromPrefs = true ;
switch ( upi )
{
2023-05-28 22:11:59 +01:00
case u_enabled :
// Call function directly
on_lanEnableBtn_clicked ( prefs - > enableLAN ) ;
break ;
2023-02-18 19:25:02 -08:00
case u_ipAddress :
2023-05-28 22:11:59 +01:00
quietlyUpdateLineEdit ( ui - > ipAddressTxt , udpPrefs - > ipAddress ) ;
2023-02-18 19:25:02 -08:00
break ;
case u_controlLANPort :
2023-05-28 22:11:59 +01:00
quietlyUpdateLineEdit ( ui - > controlPortTxt , QString : : number ( udpPrefs - > controlLANPort ) ) ;
2023-02-18 19:25:02 -08:00
break ;
case u_serialLANPort :
2025-06-04 00:29:12 +01:00
quietlyUpdateLineEdit ( ui - > catPortTxt , QString : : number ( udpPrefs - > serialLANPort ) ) ;
2023-02-18 19:25:02 -08:00
break ;
case u_audioLANPort :
2025-06-04 00:29:12 +01:00
quietlyUpdateLineEdit ( ui - > audioPortTxt , QString : : number ( udpPrefs - > audioLANPort ) ) ;
break ;
case u_scopeLANPort :
quietlyUpdateLineEdit ( ui - > scopePortTxt , QString : : number ( udpPrefs - > scopeLANPort ) ) ;
2023-02-18 19:25:02 -08:00
break ;
case u_username :
2023-05-28 22:11:59 +01:00
quietlyUpdateLineEdit ( ui - > usernameTxt , udpPrefs - > username ) ;
2023-02-18 19:25:02 -08:00
break ;
case u_password :
2023-05-28 22:11:59 +01:00
quietlyUpdateLineEdit ( ui - > passwordTxt , udpPrefs - > password ) ;
2023-02-18 19:25:02 -08:00
break ;
case u_clientName :
// Not used in the UI.
break ;
case u_halfDuplex :
2023-05-28 22:11:59 +01:00
quietlyUpdateCombobox ( ui - > audioDuplexCombo , int ( udpPrefs - > halfDuplex ) ) ;
break ;
case u_sampleRate :
quietlyUpdateCombobox ( ui - > audioSampleRateCombo , QString : : number ( prefs - > rxSetup . sampleRate ) ) ;
break ;
case u_rxCodec :
quietlyUpdateCombobox ( ui - > audioRXCodecCombo , QVariant : : fromValue ( prefs - > rxSetup . codec ) ) ;
break ;
case u_txCodec :
quietlyUpdateCombobox ( ui - > audioTXCodecCombo , QVariant : : fromValue ( prefs - > txSetup . codec ) ) ;
break ;
case u_rxLatency :
ui - > rxLatencySlider - > setValue ( prefs - > rxSetup . latency ) ; // We want the signal to fire on audio devices
break ;
case u_txLatency :
ui - > txLatencySlider - > setValue ( prefs - > txSetup . latency ) ;
break ;
case u_audioInput :
ui - > audioInputCombo - > setCurrentIndex ( audioDev - > findInput ( " Client " , prefs - > txSetup . name ) ) ;
break ;
case u_audioOutput :
ui - > audioOutputCombo - > setCurrentIndex ( audioDev - > findOutput ( " Client " , prefs - > rxSetup . name ) ) ;
2023-02-18 19:25:02 -08:00
break ;
2025-01-17 00:43:57 +00:00
case u_connectionType :
quietlyUpdateCombobox ( ui - > networkConnectionTypeCombo , QVariant : : fromValue ( udpPrefs - > connectionType ) ) ;
break ;
2025-01-24 12:37:52 +00:00
case u_adminLogin :
quietlyUpdateCheckbox ( ui - > adminLoginChk , udpPrefs - > adminLogin ) ;
break ;
2023-02-18 19:25:02 -08:00
default :
qWarning ( logGui ( ) ) < < " Did not find matching UI element for UDP pref item " < < ( int ) upi ;
break ;
}
updatingUIFromPrefs = false ;
}
2023-05-28 22:11:59 +01:00
void settingswidget : : setAudioDevicesUI ( )
{
qInfo ( ) < < " Looking for inputs " ;
ui - > audioInputCombo - > blockSignals ( true ) ;
ui - > audioInputCombo - > clear ( ) ;
ui - > audioInputCombo - > addItems ( audioDev - > getInputs ( ) ) ;
ui - > audioInputCombo - > setCurrentIndex ( - 1 ) ;
ui - > audioInputCombo - > setStyleSheet ( QString ( " QComboBox QAbstractItemView {min-width: %1px;} " ) . arg ( audioDev - > getNumCharsIn ( ) + 30 ) ) ;
ui - > audioInputCombo - > blockSignals ( false ) ;
2024-12-31 18:38:43 +00:00
ui - > serverRXAudioInputCombo - > blockSignals ( true ) ;
ui - > serverRXAudioInputCombo - > clear ( ) ;
ui - > serverRXAudioInputCombo - > addItems ( audioDev - > getInputs ( ) ) ;
ui - > serverRXAudioInputCombo - > setCurrentIndex ( - 1 ) ;
2025-01-06 12:51:56 +00:00
ui - > serverRXAudioInputCombo - > setStyleSheet ( QString ( " QComboBox QAbstractItemView {min-width: %0px;} " ) . arg ( audioDev - > getNumCharsIn ( ) + 30 ) ) ;
2024-12-31 18:38:43 +00:00
ui - > serverRXAudioInputCombo - > blockSignals ( false ) ;
2023-05-28 22:11:59 +01:00
qInfo ( ) < < " Looking for outputs " ;
ui - > audioOutputCombo - > blockSignals ( true ) ;
ui - > audioOutputCombo - > clear ( ) ;
ui - > audioOutputCombo - > addItems ( audioDev - > getOutputs ( ) ) ;
ui - > audioOutputCombo - > setCurrentIndex ( - 1 ) ;
ui - > audioOutputCombo - > setStyleSheet ( QString ( " QComboBox QAbstractItemView {min-width: %1px;} " ) . arg ( audioDev - > getNumCharsOut ( ) + 30 ) ) ;
ui - > audioOutputCombo - > blockSignals ( false ) ;
ui - > serverTXAudioOutputCombo - > blockSignals ( true ) ;
ui - > serverTXAudioOutputCombo - > clear ( ) ;
ui - > serverTXAudioOutputCombo - > addItems ( audioDev - > getOutputs ( ) ) ;
ui - > serverTXAudioOutputCombo - > setCurrentIndex ( - 1 ) ;
2025-01-06 12:51:56 +00:00
ui - > serverTXAudioOutputCombo - > setStyleSheet ( QString ( " QComboBox QAbstractItemView {min-width: %0px;} " ) . arg ( audioDev - > getNumCharsOut ( ) + 30 ) ) ;
2023-05-28 22:11:59 +01:00
ui - > serverTXAudioOutputCombo - > blockSignals ( false ) ;
prefs - > rxSetup . type = prefs - > audioSystem ;
prefs - > txSetup . type = prefs - > audioSystem ;
2024-12-31 18:38:43 +00:00
if ( serverConfig - > enabled & & ! serverConfig - > rigs . isEmpty ( ) )
2023-05-28 22:11:59 +01:00
{
serverConfig - > rigs . first ( ) - > rxAudioSetup . type = prefs - > audioSystem ;
serverConfig - > rigs . first ( ) - > txAudioSetup . type = prefs - > audioSystem ;
2025-01-06 12:51:56 +00:00
//ui->serverRXAudioInputCombo->setCurrentIndex(audioDev->findInput("Server", serverConfig->rigs.first()->rxAudioSetup.name,true));
//ui->serverTXAudioOutputCombo->setCurrentIndex(audioDev->findOutput("Server", serverConfig->rigs.first()->txAudioSetup.name,true));
2023-05-28 22:11:59 +01:00
}
qDebug ( logSystem ( ) ) < < " Audio devices done. " ;
}
2023-02-18 23:26:58 -08:00
void settingswidget : : updateAllPrefs ( )
{
// DEPRECIATED
// Maybe make this a public convenience function
// Review all the preferences. This is intended to be called
// after new settings are loaded in.
// Not sure if we actually want to always assume we should load prefs.
updatingUIFromPrefs = true ;
if ( havePrefs )
{
updateIfPrefs ( ( int ) if_all ) ;
updateRaPrefs ( ( int ) ra_all ) ;
updateCtPrefs ( ( int ) ct_all ) ;
updateClusterPrefs ( ( int ) cl_all ) ;
updateLanPrefs ( ( int ) l_all ) ;
}
if ( haveUdpPrefs )
{
updateUdpPrefs ( ( int ) u_all ) ;
}
updatingUIFromPrefs = false ;
}
2025-01-14 13:35:14 +00:00
void settingswidget : : enableModSource ( uchar num , bool en )
2024-05-04 23:40:34 +01:00
{
QComboBox * combo ;
2025-01-14 13:35:14 +00:00
QLabel * text ;
2024-05-04 23:40:34 +01:00
switch ( num )
{
case 0 :
combo = ui - > modInputCombo ;
2025-01-14 13:35:14 +00:00
text = ui - > modInputDataOffComboText ;
2024-05-04 23:40:34 +01:00
break ;
case 1 :
combo = ui - > modInputData1Combo ;
2025-01-14 13:35:14 +00:00
text = ui - > modInputData1ComboText ;
2024-05-04 23:40:34 +01:00
break ;
case 2 :
combo = ui - > modInputData2Combo ;
2025-01-14 13:35:14 +00:00
text = ui - > modInputData2ComboText ;
2024-05-04 23:40:34 +01:00
break ;
case 3 :
combo = ui - > modInputData3Combo ;
2025-01-14 13:35:14 +00:00
text = ui - > modInputData3ComboText ;
2024-05-04 23:40:34 +01:00
break ;
default :
return ;
}
2025-01-14 13:35:14 +00:00
combo - > setVisible ( en ) ;
text - > setVisible ( en ) ;
2024-05-04 23:40:34 +01:00
}
2023-02-18 23:26:58 -08:00
2023-05-27 20:26:53 +01:00
void settingswidget : : updateModSourceList ( uchar num , QVector < rigInput > data )
2023-02-20 20:45:55 -08:00
{
2023-05-27 20:26:53 +01:00
QComboBox * combo ;
switch ( num )
2023-02-20 20:45:55 -08:00
{
2023-05-27 20:26:53 +01:00
case 0 :
combo = ui - > modInputCombo ;
break ;
case 1 :
combo = ui - > modInputData1Combo ;
break ;
case 2 :
combo = ui - > modInputData2Combo ;
break ;
case 3 :
combo = ui - > modInputData3Combo ;
break ;
default :
return ;
2023-02-20 20:45:55 -08:00
}
2023-05-27 20:26:53 +01:00
combo - > blockSignals ( true ) ;
combo - > clear ( ) ;
2024-10-26 10:33:32 +01:00
for ( const auto & input : data )
2023-02-20 20:45:55 -08:00
{
2023-09-30 11:08:20 +01:00
combo - > addItem ( input . name , QVariant : : fromValue ( input ) ) ;
2023-02-20 20:45:55 -08:00
}
2023-05-27 20:26:53 +01:00
if ( data . length ( ) = = 0 ) {
2023-09-30 11:08:20 +01:00
combo - > addItem ( " None " , QVariant : : fromValue ( rigInput ( ) ) ) ;
2023-05-27 20:26:53 +01:00
}
combo - > blockSignals ( false ) ;
2023-02-20 20:45:55 -08:00
}
2023-02-19 10:39:05 -08:00
2025-01-14 13:35:14 +00:00
void settingswidget : : enableModSourceItem ( uchar num , rigInput ip , bool en )
{
QComboBox * combo ;
switch ( num )
{
case 0 :
combo = ui - > modInputCombo ;
break ;
case 1 :
combo = ui - > modInputData1Combo ;
break ;
case 2 :
combo = ui - > modInputData2Combo ;
break ;
case 3 :
combo = ui - > modInputData3Combo ;
break ;
default :
return ;
}
for ( int i = 0 ; i < combo - > count ( ) ; i + + )
{
if ( combo - > itemData ( i ) . value < rigInput > ( ) . reg = = ip . reg )
{
QStandardItemModel * model = qobject_cast < QStandardItemModel * > ( combo - > model ( ) ) ;
QStandardItem * item = model - > item ( i ) ;
item - > setFlags ( en ? item - > flags ( ) | Qt : : ItemIsEnabled : item - > flags ( ) & ~ Qt : : ItemIsEnabled ) ;
break ;
}
}
}
2023-02-21 22:54:15 -08:00
void settingswidget : : populateServerUsers ( )
{
// Copy data from serverConfig.users into the server UI table
// We will assume the data are safe to use.
bool blank = false ;
2023-02-22 10:42:23 -08:00
qDebug ( logGui ( ) ) < < " Adding server users. Size: " < < serverConfig - > users . size ( ) ;
2023-02-21 22:54:15 -08:00
QList < SERVERUSER > : : iterator user = serverConfig - > users . begin ( ) ;
while ( user ! = serverConfig - > users . end ( ) )
{
2023-06-11 22:31:32 +01:00
ui - > serverUsersTable - > insertRow ( ui - > serverUsersTable - > rowCount ( ) ) ;
serverAddUserLine ( ui - > serverUsersTable - > rowCount ( ) - 1 , user - > username , user - > password , user - > userType ) ;
2023-02-22 10:42:23 -08:00
if ( ( user - > username = = " " ) & & ! blank )
blank = true ;
2023-02-21 22:54:15 -08:00
user + + ;
}
}
2025-02-03 20:20:40 +00:00
void settingswidget : : serverDeleteUserLine ( int row )
{
qInfo ( ) < < " User row deleted " < < row ;
if ( serverConfig - > users . size ( ) > row )
{
serverConfig - > users . removeAt ( row ) ;
emit changedServerPref ( s_users ) ;
}
}
2023-06-11 22:31:32 +01:00
void settingswidget : : serverAddUserLine ( int row , const QString & user , const QString & pass , const int & type )
2023-02-21 22:54:15 -08:00
{
2023-11-27 15:53:19 +00:00
Q_UNUSED ( row )
2023-02-21 22:54:15 -08:00
// migration TODO: Review these signals/slots
ui - > serverUsersTable - > blockSignals ( true ) ;
ui - > serverUsersTable - > setItem ( ui - > serverUsersTable - > rowCount ( ) - 1 , 0 , new QTableWidgetItem ( ) ) ;
ui - > serverUsersTable - > setItem ( ui - > serverUsersTable - > rowCount ( ) - 1 , 1 , new QTableWidgetItem ( ) ) ;
ui - > serverUsersTable - > setItem ( ui - > serverUsersTable - > rowCount ( ) - 1 , 2 , new QTableWidgetItem ( ) ) ;
ui - > serverUsersTable - > setItem ( ui - > serverUsersTable - > rowCount ( ) - 1 , 3 , new QTableWidgetItem ( ) ) ;
QLineEdit * username = new QLineEdit ( ) ;
username - > setProperty ( " row " , ( int ) ui - > serverUsersTable - > rowCount ( ) - 1 ) ;
username - > setProperty ( " col " , ( int ) 0 ) ;
username - > setText ( user ) ;
connect ( username , SIGNAL ( editingFinished ( ) ) , this , SLOT ( onServerUserFieldChanged ( ) ) ) ;
ui - > serverUsersTable - > setCellWidget ( ui - > serverUsersTable - > rowCount ( ) - 1 , 0 , username ) ;
QLineEdit * password = new QLineEdit ( ) ;
password - > setProperty ( " row " , ( int ) ui - > serverUsersTable - > rowCount ( ) - 1 ) ;
password - > setProperty ( " col " , ( int ) 1 ) ;
password - > setEchoMode ( QLineEdit : : PasswordEchoOnEdit ) ;
password - > setText ( pass ) ;
connect ( password , SIGNAL ( editingFinished ( ) ) , this , SLOT ( onServerUserFieldChanged ( ) ) ) ;
ui - > serverUsersTable - > setCellWidget ( ui - > serverUsersTable - > rowCount ( ) - 1 , 1 , password ) ;
QComboBox * comboBox = new QComboBox ( ) ;
2024-05-30 09:55:36 -07:00
comboBox - > insertItems ( 0 , { tr ( " Admin User " ) , tr ( " Normal User " ) , tr ( " Normal with no TX " , " Monitor only " ) } ) ;
2023-02-21 22:54:15 -08:00
comboBox - > setProperty ( " row " , ( int ) ui - > serverUsersTable - > rowCount ( ) - 1 ) ;
comboBox - > setProperty ( " col " , ( int ) 2 ) ;
comboBox - > setCurrentIndex ( type ) ;
connect ( comboBox , SIGNAL ( currentIndexChanged ( int ) ) , this , SLOT ( onServerUserFieldChanged ( ) ) ) ;
ui - > serverUsersTable - > setCellWidget ( ui - > serverUsersTable - > rowCount ( ) - 1 , 2 , comboBox ) ;
QPushButton * button = new QPushButton ( ) ;
2024-05-30 09:55:36 -07:00
button - > setText ( tr ( " Delete " ) ) ;
2023-02-21 22:54:15 -08:00
button - > setProperty ( " row " , ( int ) ui - > serverUsersTable - > rowCount ( ) - 1 ) ;
button - > setProperty ( " col " , ( int ) 3 ) ;
connect ( button , SIGNAL ( clicked ( ) ) , this , SLOT ( onServerUserFieldChanged ( ) ) ) ;
ui - > serverUsersTable - > setCellWidget ( ui - > serverUsersTable - > rowCount ( ) - 1 , 3 , button ) ;
2025-02-03 20:20:40 +00:00
if ( ui - > serverUsersTable - > rowCount ( ) > serverConfig - > users . count ( ) )
{
serverConfig - > users . append ( SERVERUSER ( ) ) ;
}
2023-02-21 22:54:15 -08:00
ui - > serverUsersTable - > blockSignals ( false ) ;
}
2023-02-18 23:26:58 -08:00
// Utility Functions:
2023-02-18 19:25:02 -08:00
void settingswidget : : updateUnderlayMode ( )
{
quietlyUpdateRadiobutton ( ui - > underlayNone , false ) ;
quietlyUpdateRadiobutton ( ui - > underlayPeakHold , false ) ;
quietlyUpdateRadiobutton ( ui - > underlayPeakBuffer , false ) ;
quietlyUpdateRadiobutton ( ui - > underlayAverageBuffer , false ) ;
switch ( prefs - > underlayMode ) {
case underlayNone :
quietlyUpdateRadiobutton ( ui - > underlayNone , true ) ;
2023-02-19 18:29:22 -08:00
ui - > underlayBufferSlider - > setDisabled ( true ) ;
2023-02-18 19:25:02 -08:00
break ;
case underlayPeakHold :
quietlyUpdateRadiobutton ( ui - > underlayPeakHold , true ) ;
2023-02-19 18:29:22 -08:00
ui - > underlayBufferSlider - > setDisabled ( true ) ;
2023-02-18 19:25:02 -08:00
break ;
case underlayPeakBuffer :
quietlyUpdateRadiobutton ( ui - > underlayPeakBuffer , true ) ;
2023-02-19 18:29:22 -08:00
ui - > underlayBufferSlider - > setEnabled ( true ) ;
2023-02-18 19:25:02 -08:00
break ;
case underlayAverageBuffer :
quietlyUpdateRadiobutton ( ui - > underlayAverageBuffer , true ) ;
2023-02-19 18:29:22 -08:00
ui - > underlayBufferSlider - > setEnabled ( true ) ;
2023-02-18 19:25:02 -08:00
break ;
default :
qWarning ( ) < < " Do not understand underlay mode: " < < ( unsigned int ) prefs - > underlayMode ;
}
}
void settingswidget : : quietlyUpdateSlider ( QSlider * sl , int val )
{
sl - > blockSignals ( true ) ;
if ( ( val > = sl - > minimum ( ) ) & & ( val < = sl - > maximum ( ) ) )
sl - > setValue ( val ) ;
sl - > blockSignals ( false ) ;
}
2023-05-27 20:26:53 +01:00
void settingswidget : : quietlyUpdateCombobox ( QComboBox * cb , int index )
{
cb - > blockSignals ( true ) ;
cb - > setCurrentIndex ( index ) ;
cb - > blockSignals ( false ) ;
}
void settingswidget : : quietlyUpdateCombobox ( QComboBox * cb , QVariant val )
{
cb - > blockSignals ( true ) ;
cb - > setCurrentIndex ( cb - > findData ( val ) ) ;
cb - > blockSignals ( false ) ;
}
2023-09-30 11:08:20 +01:00
void settingswidget : : quietlyUpdateModCombo ( QComboBox * cb , QVariant val )
{
cb - > blockSignals ( true ) ;
for ( int i = 0 ; i < cb - > count ( ) ; i + + )
{
2025-01-11 13:43:40 +00:00
if ( cb - > itemData ( i ) . value < rigInput > ( ) . type = = val . value < rigInput > ( ) . type | | cb - > itemData ( i ) = = val )
2023-09-30 11:08:20 +01:00
{
cb - > setCurrentIndex ( i ) ;
break ;
}
}
cb - > blockSignals ( false ) ;
}
2023-05-28 22:11:59 +01:00
void settingswidget : : quietlyUpdateCombobox ( QComboBox * cb , QString val )
{
cb - > blockSignals ( true ) ;
cb - > setCurrentIndex ( cb - > findText ( val ) ) ;
cb - > blockSignals ( false ) ;
}
2023-02-18 23:26:58 -08:00
void settingswidget : : quietlyUpdateSpinbox ( QSpinBox * sb , int val )
{
sb - > blockSignals ( true ) ;
if ( ( val > = sb - > minimum ( ) ) & & ( val < = sb - > maximum ( ) ) )
sb - > setValue ( val ) ;
sb - > blockSignals ( false ) ;
}
2023-02-18 19:25:02 -08:00
void settingswidget : : quietlyUpdateCheckbox ( QCheckBox * cb , bool isChecked )
{
cb - > blockSignals ( true ) ;
cb - > setChecked ( isChecked ) ;
cb - > blockSignals ( false ) ;
}
2023-06-11 10:33:16 +01:00
void settingswidget : : quietlyUpdateCheckbox ( QGroupBox * gb , bool isChecked )
{
gb - > blockSignals ( true ) ;
gb - > setChecked ( isChecked ) ;
gb - > blockSignals ( false ) ;
}
2023-02-18 19:25:02 -08:00
void settingswidget : : quietlyUpdateRadiobutton ( QRadioButton * rb , bool isChecked )
{
rb - > blockSignals ( true ) ;
rb - > setChecked ( isChecked ) ;
rb - > blockSignals ( false ) ;
}
2023-02-21 22:54:15 -08:00
void settingswidget : : quietlyUpdateLineEdit ( QLineEdit * le , const QString text )
{
le - > blockSignals ( true ) ;
le - > setText ( text ) ;
le - > blockSignals ( false ) ;
}
2023-02-18 23:26:58 -08:00
// Resulting from User Interaction
2023-02-20 20:45:55 -08:00
void settingswidget : : on_debugBtn_clicked ( )
{
qDebug ( logGui ( ) ) < < " Debug button pressed in settings widget. " ;
}
2023-02-18 23:26:58 -08:00
void settingswidget : : on_settingsList_currentRowChanged ( int currentRow )
{
ui - > settingsStack - > setCurrentIndex ( currentRow ) ;
}
2023-02-18 19:25:02 -08:00
void settingswidget : : on_lanEnableBtn_clicked ( bool checked )
{
// TODO: prefs.enableLAN = checked;
2023-02-19 23:12:36 -08:00
// TOTO? ui->connectBtn->setEnabled(true); // move to other side
2023-05-28 22:11:59 +01:00
ui - > groupNetwork - > setEnabled ( checked ) ;
ui - > groupSerial - > setEnabled ( ! checked ) ;
2023-02-18 19:25:02 -08:00
prefs - > enableLAN = checked ;
2023-02-19 23:12:36 -08:00
emit changedLanPref ( l_enableLAN ) ;
}
void settingswidget : : on_serialEnableBtn_clicked ( bool checked )
{
2023-05-28 22:11:59 +01:00
ui - > groupSerial - > setEnabled ( checked ) ;
ui - > groupNetwork - > setEnabled ( ! checked ) ;
2023-06-08 21:58:22 +01:00
prefs - > enableLAN = ! checked ;
2023-02-19 23:12:36 -08:00
emit changedLanPref ( l_enableLAN ) ;
2023-02-18 19:25:02 -08:00
}
2023-02-18 23:26:58 -08:00
2024-12-30 14:19:52 +00:00
void settingswidget : : on_pttTypeCombo_currentIndexChanged ( int index )
2024-12-30 12:56:35 +00:00
{
2024-12-30 14:19:52 +00:00
prefs - > pttType = pttType_t ( index ) ;
emit changedRaPref ( ra_pttType ) ;
2024-12-30 12:56:35 +00:00
}
2023-06-08 08:20:50 +01:00
void settingswidget : : on_rigCIVManualAddrChk_clicked ( bool checked )
{
if ( checked )
{
ui - > rigCIVaddrHexLine - > setEnabled ( true ) ;
2025-05-10 12:35:35 +01:00
ui - > rigCIVaddrHexLine - > setText ( QString ( " %1 " ) . arg ( prefs - > radioCIVAddr , 4 , 16 ) ) ;
2023-06-08 08:20:50 +01:00
} else {
ui - > rigCIVaddrHexLine - > setText ( " auto " ) ;
ui - > rigCIVaddrHexLine - > setEnabled ( false ) ;
prefs - > radioCIVAddr = 0 ; // auto
}
emit changedRaPref ( ra_radioCIVAddr ) ;
}
void settingswidget : : on_rigCIVaddrHexLine_editingFinished ( )
{
bool okconvert = false ;
2023-05-28 22:11:59 +01:00
2024-08-13 13:19:50 +01:00
quint8 propCIVAddr = ( quint8 ) ui - > rigCIVaddrHexLine - > text ( ) . toUInt ( & okconvert , 16 ) ;
2023-06-08 08:20:50 +01:00
2025-09-07 11:28:41 +01:00
if ( ! okconvert | | propCIVAddr > = 0xe0 | | propCIVAddr = = 0 )
2023-06-08 08:20:50 +01:00
{
ui - > rigCIVaddrHexLine - > setText ( " 0 " ) ;
}
2025-09-07 11:28:41 +01:00
prefs - > radioCIVAddr = propCIVAddr ;
emit changedRaPref ( ra_radioCIVAddr ) ;
2023-06-08 08:20:50 +01:00
}
2023-05-28 22:11:59 +01:00
2023-06-08 08:20:50 +01:00
void settingswidget : : on_useCIVasRigIDChk_clicked ( bool checked )
{
prefs - > CIVisRadioModel = checked ;
emit changedRaPref ( ra_CIVisRadioModel ) ;
}
2023-05-28 22:11:59 +01:00
2023-02-18 23:26:58 -08:00
void settingswidget : : on_autoSSBchk_clicked ( bool checked )
{
prefs - > automaticSidebandSwitching = checked ;
2023-02-19 23:12:36 -08:00
emit changedCtPref ( ct_automaticSidebandSwitching ) ;
2023-02-18 23:26:58 -08:00
}
2023-02-19 18:29:22 -08:00
void settingswidget : : on_useSystemThemeChk_clicked ( bool checked )
{
prefs - > useSystemTheme = checked ;
emit changedIfPrefs ( if_useSystemTheme ) ;
}
2023-02-19 22:11:48 -08:00
void settingswidget : : on_enableUsbChk_clicked ( bool checked )
{
prefs - > enableUSBControllers = checked ;
2023-06-08 08:20:50 +01:00
ui - > usbControllersSetup - > setEnabled ( checked ) ;
ui - > usbControllersReset - > setEnabled ( checked ) ;
2023-02-19 22:11:48 -08:00
ui - > usbResetLbl - > setVisible ( checked ) ;
emit changedCtPref ( ct_enableUSBControllers ) ;
}
2023-06-08 08:20:50 +01:00
void settingswidget : : on_usbControllersSetup_clicked ( )
{
emit changedCtPref ( ct_USBControllersSetup ) ;
}
void settingswidget : : on_usbControllersReset_clicked ( )
2023-02-19 22:11:48 -08:00
{
2023-06-08 08:20:50 +01:00
emit changedCtPref ( ct_USBControllersReset ) ;
2023-02-19 22:11:48 -08:00
}
void settingswidget : : on_autoPollBtn_clicked ( bool checked )
{
if ( checked )
{
prefs - > polling_ms = 0 ;
emit changedRaPref ( ra_polling_ms ) ;
ui - > pollTimeMsSpin - > setEnabled ( false ) ;
}
}
void settingswidget : : on_manualPollBtn_clicked ( bool checked )
{
if ( checked )
{
ui - > pollTimeMsSpin - > setEnabled ( true ) ;
prefs - > polling_ms = ui - > pollTimeMsSpin - > value ( ) ;
emit changedRaPref ( ra_polling_ms ) ;
} else {
// Do we need this...
// prefs.polling_ms = 0;
// emit changedRaPref(ra_polling_ms);
}
}
void settingswidget : : on_pollTimeMsSpin_valueChanged ( int val )
{
prefs - > polling_ms = val ;
emit changedRaPref ( ra_polling_ms ) ;
}
2023-09-22 19:06:09 +01:00
void settingswidget : : on_serialDeviceListCombo_textActivated ( const QString & arg1 )
2023-02-19 22:11:48 -08:00
{
2023-09-22 19:06:09 +01:00
qInfo ( logGui ( ) ) < < " Serial port combo changed " < < arg1 ;
2023-02-19 22:11:48 -08:00
QString manualPort ;
bool ok ;
if ( arg1 = = QString ( " Manual... " ) )
{
manualPort = QInputDialog : : getText ( this , tr ( " Manual port assignment " ) ,
tr ( " Enter serial port assignment: " ) ,
QLineEdit : : Normal ,
tr ( " /dev/device " ) , & ok ) ;
if ( manualPort . isEmpty ( ) | | ! ok )
{
2023-05-27 20:26:53 +01:00
quietlyUpdateCombobox ( ui - > serialDeviceListCombo , 0 ) ;
2023-02-19 22:11:48 -08:00
return ;
} else {
prefs - > serialPortRadio = manualPort ;
qInfo ( logGui ( ) ) < < " Setting preferences to use manually-assigned serial port: " < < manualPort ;
ui - > serialEnableBtn - > setChecked ( true ) ;
emit changedRaPref ( ra_serialPortRadio ) ;
return ;
}
}
if ( arg1 = = QString ( " Auto " ) )
{
prefs - > serialPortRadio = " auto " ;
qInfo ( logGui ( ) ) < < " Setting preferences to automatically find rig serial port. " ;
ui - > serialEnableBtn - > setChecked ( true ) ;
emit changedRaPref ( ra_serialPortRadio ) ;
return ;
}
2025-01-14 13:35:14 +00:00
prefs - > serialPortRadio = ui - > serialDeviceListCombo - > currentData ( ) . toString ( ) ;
2023-02-19 22:11:48 -08:00
qInfo ( logGui ( ) ) < < " Setting preferences to use manually-assigned serial port: " < < arg1 ;
ui - > serialEnableBtn - > setChecked ( true ) ;
emit changedRaPref ( ra_serialPortRadio ) ;
}
void settingswidget : : on_baudRateCombo_activated ( int index )
{
bool ok = false ;
quint32 baud = ui - > baudRateCombo - > currentData ( ) . toUInt ( & ok ) ;
if ( ok )
{
prefs - > serialPortBaud = baud ;
qInfo ( logGui ( ) ) < < " Changed baud rate to " < < baud < < " bps. Press Save Settings to retain. " ;
emit changedRaPref ( ra_serialPortBaud ) ;
}
( void ) index ;
}
void settingswidget : : on_vspCombo_activated ( int index )
{
2025-01-17 00:43:57 +00:00
prefs - > virtualSerialPort = ui - > vspCombo - > itemData ( index ) . toString ( ) ;
2023-02-19 22:11:48 -08:00
emit changedRaPref ( ra_virtualSerialPort ) ;
}
2025-01-17 00:43:57 +00:00
void settingswidget : : on_networkConnectionTypeCombo_currentIndexChanged ( int index )
{
udpPrefs - > connectionType = ui - > networkConnectionTypeCombo - > itemData ( index ) . value < connectionType_t > ( ) ;
2025-01-23 20:04:17 +00:00
/*if (udpPrefs->connectionType == connectionWAN) {
2025-01-20 02:30:14 +00:00
ui - > audioSampleRateCombo - > setCurrentIndex ( 3 ) ;
} else {
ui - > audioSampleRateCombo - > setCurrentIndex ( 2 ) ;
2025-01-23 20:04:17 +00:00
} */
2025-01-20 02:30:14 +00:00
2025-01-17 00:43:57 +00:00
emit changedUdpPref ( u_connectionType ) ;
}
2023-02-19 22:11:48 -08:00
void settingswidget : : on_audioSystemCombo_currentIndexChanged ( int value )
{
2023-05-27 20:26:53 +01:00
quietlyUpdateCombobox ( ui - > audioSystemServerCombo , value ) ;
2023-05-28 22:11:59 +01:00
prefs - > audioSystem = static_cast < audioType > ( value ) ;
audioDev - > setAudioType ( prefs - > audioSystem ) ;
audioDev - > enumerate ( ) ;
2023-02-19 22:11:48 -08:00
emit changedRaPref ( ra_audioSystem ) ;
}
2025-01-11 13:43:40 +00:00
void settingswidget : : on_manufacturerCombo_currentIndexChanged ( int value )
{
Q_UNUSED ( value )
2025-05-19 23:08:55 +01:00
bool changed = false ;
// If we have been called directly (not via the combobox signal), then update things differently.
if ( prefs - > manufacturer ! = ui - > manufacturerCombo - > currentData ( ) . value < manufacturersType_t > ( ) )
{
prefs - > manufacturer = ui - > manufacturerCombo - > currentData ( ) . value < manufacturersType_t > ( ) ;
changed = true ;
}
if ( prefs - > manufacturer = = manufIcom )
{
if ( changed )
{
udpPrefs - > controlLANPort = 50001 ;
udpPrefs - > serialLANPort = 50002 ;
udpPrefs - > audioLANPort = 50003 ;
}
ui - > audioSampleRateCombo - > setEnabled ( true ) ;
ui - > adminLoginChk - > setVisible ( false ) ;
ui - > serverCivPortText - > setVisible ( true ) ;
ui - > serverScopePortText - > setVisible ( false ) ;
ui - > serverCATPortLabel - > setVisible ( true ) ;
ui - > serverScopePortLabel - > setVisible ( false ) ;
2025-06-04 00:02:43 +01:00
ui - > catPortLabel - > setVisible ( false ) ;
ui - > catPortTxt - > setVisible ( false ) ;
ui - > audioPortLabel - > setVisible ( false ) ;
ui - > audioPortTxt - > setVisible ( false ) ;
ui - > scopePortLabel - > setVisible ( false ) ;
ui - > scopePortTxt - > setVisible ( false ) ;
2025-05-19 23:08:55 +01:00
}
else if ( prefs - > manufacturer = = manufKenwood )
2025-01-20 02:30:14 +00:00
{
2025-05-20 23:38:40 +01:00
// These are fixed.
udpPrefs - > controlLANPort = 60000 ;
udpPrefs - > audioLANPort = 60001 ;
2025-05-19 23:08:55 +01:00
2025-01-20 02:30:14 +00:00
// We also need to disable all items that are unsupported by this manufacturer
ui - > audioSampleRateCombo - > setCurrentIndex ( 2 ) ;
ui - > audioRXCodecCombo - > setCurrentIndex ( ui - > audioRXCodecCombo - > findData ( 4 ) ) ;
ui - > audioTXCodecCombo - > setCurrentIndex ( ui - > audioTXCodecCombo - > findData ( 4 ) ) ;
2025-05-19 23:08:55 +01:00
2025-01-20 02:30:14 +00:00
ui - > audioSampleRateCombo - > setEnabled ( false ) ;
2025-01-24 12:37:52 +00:00
ui - > adminLoginChk - > setVisible ( true ) ;
2025-05-19 23:08:55 +01:00
ui - > serverCivPortText - > setVisible ( false ) ;
ui - > serverScopePortText - > setVisible ( false ) ;
ui - > serverCATPortLabel - > setVisible ( false ) ;
ui - > serverScopePortLabel - > setVisible ( false ) ;
2025-06-04 00:02:43 +01:00
ui - > catPortLabel - > setVisible ( false ) ;
ui - > catPortTxt - > setVisible ( false ) ;
ui - > audioPortLabel - > setVisible ( false ) ;
ui - > audioPortTxt - > setVisible ( false ) ;
ui - > scopePortLabel - > setVisible ( false ) ;
ui - > scopePortTxt - > setVisible ( false ) ;
2025-05-19 23:08:55 +01:00
}
else if ( prefs - > manufacturer = = manufYaesu )
{
2025-06-04 00:02:43 +01:00
if ( changed )
{
2025-05-19 23:08:55 +01:00
udpPrefs - > controlLANPort = 50000 ;
udpPrefs - > serialLANPort = 50001 ;
udpPrefs - > audioLANPort = 50002 ;
udpPrefs - > scopeLANPort = 50003 ;
2025-06-04 00:02:43 +01:00
}
ui - > catPortLabel - > setVisible ( true ) ;
ui - > catPortTxt - > setVisible ( true ) ;
ui - > audioPortLabel - > setVisible ( true ) ;
ui - > audioPortTxt - > setVisible ( true ) ;
ui - > scopePortLabel - > setVisible ( true ) ;
ui - > scopePortTxt - > setVisible ( true ) ;
2025-01-24 12:37:52 +00:00
ui - > adminLoginChk - > setVisible ( false ) ;
2025-05-19 23:08:55 +01:00
ui - > serverCivPortText - > setVisible ( true ) ;
ui - > serverScopePortText - > setVisible ( true ) ;
ui - > serverCATPortLabel - > setVisible ( true ) ;
ui - > serverScopePortLabel - > setVisible ( true ) ;
2025-01-20 02:30:14 +00:00
}
2025-06-04 00:02:43 +01:00
2025-01-17 00:43:57 +00:00
ui - > controlPortTxt - > setText ( QString : : number ( udpPrefs - > controlLANPort ) ) ;
2025-06-04 00:06:57 +01:00
ui - > catPortTxt - > setText ( QString : : number ( udpPrefs - > serialLANPort ) ) ;
ui - > audioPortTxt - > setText ( QString : : number ( udpPrefs - > audioLANPort ) ) ;
2025-06-04 00:02:43 +01:00
ui - > scopePortTxt - > setText ( QString : : number ( udpPrefs - > scopeLANPort ) ) ;
2025-01-17 00:43:57 +00:00
2025-01-11 13:43:40 +00:00
emit changedRaPref ( ra_manufacturer ) ;
2025-05-19 23:08:55 +01:00
if ( serverConfig - > enabled & & changed )
{
// Re-cycle server as manufacturer may have changed!
serverConfig - > enabled = false ;
emit changedServerPref ( s_enabled ) ;
serverConfig - > enabled = true ;
emit changedServerPref ( s_enabled ) ;
}
2025-01-11 13:43:40 +00:00
}
2023-02-19 22:11:48 -08:00
void settingswidget : : on_audioSystemServerCombo_currentIndexChanged ( int value )
{
2023-05-27 20:26:53 +01:00
quietlyUpdateCombobox ( ui - > audioSystemCombo , value ) ;
2023-05-28 22:11:59 +01:00
prefs - > audioSystem = static_cast < audioType > ( value ) ;
audioDev - > setAudioType ( prefs - > audioSystem ) ;
audioDev - > enumerate ( ) ;
2023-02-19 22:11:48 -08:00
emit changedRaPref ( ra_audioSystem ) ;
}
2023-02-19 22:34:42 -08:00
void settingswidget : : on_meter2selectionCombo_currentIndexChanged ( int index )
{
2023-05-27 00:26:01 +01:00
prefs - > meter2Type = static_cast < meter_t > ( ui - > meter2selectionCombo - > itemData ( index ) . toInt ( ) ) ;
2023-02-19 22:34:42 -08:00
emit changedIfPref ( if_meter2Type ) ;
2024-02-05 14:03:24 -08:00
enableAllComboBoxItems ( ui - > meter3selectionCombo ) ;
if ( prefs - > meter2Type ! = meterNone ) {
setComboBoxItemEnabled ( ui - > meter3selectionCombo , index , false ) ;
}
2023-02-19 22:34:42 -08:00
}
2023-02-19 23:12:36 -08:00
2024-02-05 13:42:00 -08:00
void settingswidget : : on_meter3selectionCombo_currentIndexChanged ( int index )
{
prefs - > meter3Type = static_cast < meter_t > ( ui - > meter3selectionCombo - > itemData ( index ) . toInt ( ) ) ;
emit changedIfPref ( if_meter3Type ) ;
2024-02-05 14:03:24 -08:00
// Since the meter combo boxes have the same items in each list,
// we can disable an item from the other list with confidence.
enableAllComboBoxItems ( ui - > meter2selectionCombo ) ;
if ( prefs - > meter3Type ! = meterNone ) {
setComboBoxItemEnabled ( ui - > meter2selectionCombo , index , false ) ;
}
}
2024-02-06 11:06:50 -08:00
void settingswidget : : on_revCompMeterBtn_clicked ( bool checked )
{
prefs - > compMeterReverse = checked ;
emit changedIfPref ( if_compMeterReverse ) ;
}
2024-02-05 14:03:24 -08:00
void settingswidget : : muteSingleComboItem ( QComboBox * comboBox , int index ) {
enableAllComboBoxItems ( comboBox ) ;
setComboBoxItemEnabled ( comboBox , index , false ) ;
}
void settingswidget : : enableAllComboBoxItems ( QComboBox * combobox ) {
for ( int i = 0 ; i < combobox - > count ( ) ; i + + ) {
setComboBoxItemEnabled ( combobox , i , true ) ;
}
}
void settingswidget : : setComboBoxItemEnabled ( QComboBox * comboBox , int index , bool enabled )
{
2025-01-09 09:13:57 +00:00
2024-02-05 14:03:24 -08:00
auto * model = qobject_cast < QStandardItemModel * > ( comboBox - > model ( ) ) ;
2025-01-09 09:24:55 +00:00
assert ( model ) ;
2024-02-05 14:03:24 -08:00
if ( ! model ) return ;
auto * item = model - > item ( index ) ;
2025-01-09 09:24:55 +00:00
assert ( item ) ;
2024-02-05 14:03:24 -08:00
if ( ! item ) return ;
item - > setEnabled ( enabled ) ;
2024-02-05 13:42:00 -08:00
}
2023-02-19 23:12:36 -08:00
void settingswidget : : on_tuningFloorZerosChk_clicked ( bool checked )
{
prefs - > niceTS = checked ;
emit changedCtPref ( ct_niceTS ) ;
}
void settingswidget : : on_fullScreenChk_clicked ( bool checked )
{
prefs - > useFullScreen = checked ;
emit changedIfPref ( if_useFullScreen ) ;
}
void settingswidget : : on_wfAntiAliasChk_clicked ( bool checked )
{
prefs - > wfAntiAlias = checked ;
emit changedIfPref ( if_wfAntiAlias ) ;
}
void settingswidget : : on_wfInterpolateChk_clicked ( bool checked )
{
prefs - > wfInterpolate = checked ;
emit changedIfPref ( if_wfInterpolate ) ;
}
void settingswidget : : on_underlayNone_clicked ( bool checked )
{
if ( checked )
{
prefs - > underlayMode = underlayNone ;
ui - > underlayBufferSlider - > setDisabled ( true ) ;
emit changedIfPref ( if_underlayMode ) ;
}
}
void settingswidget : : on_underlayPeakHold_clicked ( bool checked )
{
if ( checked )
{
prefs - > underlayMode = underlayPeakHold ;
ui - > underlayBufferSlider - > setDisabled ( true ) ;
emit changedIfPref ( if_underlayMode ) ;
}
}
void settingswidget : : on_underlayPeakBuffer_clicked ( bool checked )
{
if ( checked )
{
prefs - > underlayMode = underlayPeakBuffer ;
ui - > underlayBufferSlider - > setEnabled ( true ) ;
emit changedIfPref ( if_underlayMode ) ;
}
}
void settingswidget : : on_underlayAverageBuffer_clicked ( bool checked )
{
if ( checked )
{
prefs - > underlayMode = underlayAverageBuffer ;
ui - > underlayBufferSlider - > setEnabled ( true ) ;
emit changedIfPref ( if_underlayMode ) ;
}
}
void settingswidget : : on_underlayBufferSlider_valueChanged ( int value )
{
prefs - > underlayBufferSize = value ;
emit changedIfPref ( if_underlayBufferSize ) ;
}
void settingswidget : : on_pttEnableChk_clicked ( bool checked )
{
prefs - > enablePTT = checked ;
emit changedCtPref ( ct_enablePTT ) ;
}
2024-06-12 17:11:01 +01:00
void settingswidget : : on_regionTxt_textChanged ( QString text )
{
prefs - > region = text ;
emit changedIfPref ( if_region ) ;
}
void settingswidget : : on_showBandsChk_clicked ( bool checked )
{
prefs - > showBands = checked ;
emit changedIfPref ( if_showBands ) ;
}
2023-02-19 23:12:36 -08:00
2023-05-28 22:11:59 +01:00
void settingswidget : : on_rigCreatorChk_clicked ( bool checked )
{
prefs - > rigCreatorEnable = checked ;
emit changedIfPref ( if_rigCreatorEnable ) ;
}
2023-09-19 23:04:48 +01:00
void settingswidget : : on_frequencyUnitsCombo_currentIndexChanged ( int index )
{
prefs - > frequencyUnits = index ;
emit changedIfPref ( if_frequencyUnits ) ;
}
2023-02-19 23:12:36 -08:00
void settingswidget : : on_enableRigctldChk_clicked ( bool checked )
{
prefs - > enableRigCtlD = checked ;
emit changedLanPref ( l_enableRigCtlD ) ;
}
void settingswidget : : on_rigctldPortTxt_editingFinished ( )
{
bool okconvert = false ;
unsigned int port = ui - > rigctldPortTxt - > text ( ) . toUInt ( & okconvert ) ;
if ( okconvert )
{
prefs - > rigCtlPort = port ;
emit changedLanPref ( l_rigCtlPort ) ;
}
}
void settingswidget : : on_tcpServerPortTxt_editingFinished ( )
{
bool okconvert = false ;
unsigned int port = ui - > tcpServerPortTxt - > text ( ) . toUInt ( & okconvert ) ;
if ( okconvert )
{
prefs - > tcpPort = port ;
emit changedLanPref ( l_tcpPort ) ;
}
}
2023-02-20 13:45:33 -08:00
2023-07-06 10:36:11 +01:00
void settingswidget : : on_tciServerPortTxt_editingFinished ( )
{
bool okconvert = false ;
unsigned int port = ui - > tciServerPortTxt - > text ( ) . toUInt ( & okconvert ) ;
if ( okconvert )
{
prefs - > tciPort = port ;
emit changedLanPref ( l_tciPort ) ;
}
}
2024-12-13 23:15:27 +00:00
void settingswidget : : on_waterfallFormatCombo_currentIndexChanged ( int index )
{
prefs - > waterfallFormat = index ;
emit changedLanPref ( l_waterfallFormat ) ;
}
2023-05-28 22:11:59 +01:00
/* Beginning of cluster settings */
2023-02-20 13:45:33 -08:00
2023-06-11 10:33:16 +01:00
void settingswidget : : on_clusterTcpAddBtn_clicked ( )
{
QString text = ui - > clusterServerNameCombo - > lineEdit ( ) - > displayText ( ) ;
int id = ui - > clusterServerNameCombo - > findText ( text ) ;
2023-02-20 13:45:33 -08:00
2023-06-11 10:33:16 +01:00
if ( id = = - 1 )
2023-02-20 13:45:33 -08:00
{
2023-06-11 10:33:16 +01:00
ui - > clusterServerNameCombo - > addItem ( text ) ;
2023-02-20 13:45:33 -08:00
clusterSettings c ;
c . server = text ;
2023-06-11 10:33:16 +01:00
c . userName = prefs - > clusterTcpUserName ;
c . password = prefs - > clusterTcpPassword ;
c . port = prefs - > clusterTcpPort ;
c . timeout = prefs - > clusterTimeout ;
c . isdefault = true ;
prefs - > clusters . append ( c ) ;
} else {
prefs - > clusters [ id ] . userName = prefs - > clusterTcpUserName ;
prefs - > clusters [ id ] . password = prefs - > clusterTcpPassword ;
prefs - > clusters [ id ] . port = prefs - > clusterTcpPort ;
prefs - > clusters [ id ] . timeout = prefs - > clusterTimeout ;
2023-02-20 13:45:33 -08:00
}
2023-06-11 10:33:16 +01:00
}
2023-02-20 13:45:33 -08:00
2023-06-11 10:33:16 +01:00
void settingswidget : : on_clusterTcpDelBtn_clicked ( )
{
int index = ui - > clusterServerNameCombo - > currentIndex ( ) ;
if ( index < 0 )
return ;
QString text = ui - > clusterServerNameCombo - > currentText ( ) ;
qInfo ( logGui ) < < " Deleting Cluster server " < < text ;
prefs - > clusters . removeAt ( index ) ;
ui - > clusterServerNameCombo - > removeItem ( index ) ;
ui - > clusterServerNameCombo - > setCurrentIndex ( 0 ) ;
}
void settingswidget : : on_clusterServerNameCombo_currentIndexChanged ( int index )
{
if ( index < 0 | | index > = prefs - > clusters . size ( ) )
return ;
quietlyUpdateLineEdit ( ui - > clusterTcpPortLineEdit , QString : : number ( prefs - > clusters [ index ] . port ) ) ;
quietlyUpdateLineEdit ( ui - > clusterUsernameLineEdit , prefs - > clusters [ index ] . userName ) ;
quietlyUpdateLineEdit ( ui - > clusterPasswordLineEdit , prefs - > clusters [ index ] . password ) ;
quietlyUpdateLineEdit ( ui - > clusterTimeoutLineEdit , QString : : number ( prefs - > clusters [ index ] . timeout ) ) ;
for ( int i = 0 ; i < prefs - > clusters . size ( ) ; i + + ) {
2023-02-20 13:45:33 -08:00
if ( i = = index )
2023-06-11 10:33:16 +01:00
prefs - > clusters [ i ] . isdefault = true ;
2023-02-20 13:45:33 -08:00
else
2023-06-11 10:33:16 +01:00
prefs - > clusters [ i ] . isdefault = false ;
2023-02-20 13:45:33 -08:00
}
// For reference, here is what the code on the other side is basically doing:
// emit setClusterServerName(clusters[index].server);
// emit setClusterTcpPort(clusters[index].port);
// emit setClusterUserName(clusters[index].userName);
// emit setClusterPassword(clusters[index].password);
// emit setClusterTimeout(clusters[index].timeout);
// We are using the not-arrayed data in preferences
// to communicate the current cluster information:
2023-06-11 10:33:16 +01:00
prefs - > clusterTcpServerName = prefs - > clusters [ index ] . server ;
prefs - > clusterTcpPort = prefs - > clusters [ index ] . port ;
prefs - > clusterTcpUserName = prefs - > clusters [ index ] . userName ;
prefs - > clusterTcpPassword = prefs - > clusters [ index ] . password ;
prefs - > clusterTimeout = prefs - > clusters [ index ] . timeout ;
/*emit changedClusterPrefs(cl_clusterTcpServerName |
2023-02-20 13:45:33 -08:00
cl_clusterTcpPort |
cl_clusterTcpUserName |
cl_clusterTcpPassword |
cl_clusterTimeout |
2023-06-11 10:33:16 +01:00
cl_clusterTcpEnable ) ; */
2023-02-20 13:45:33 -08:00
}
2023-06-11 10:33:16 +01:00
void settingswidget : : on_clusterUdpGroup_clicked ( bool checked )
2023-02-20 13:45:33 -08:00
{
prefs - > clusterUdpEnable = checked ;
}
2023-06-11 10:33:16 +01:00
void settingswidget : : on_clusterTcpGroup_clicked ( bool checked )
2023-02-20 13:45:33 -08:00
{
prefs - > clusterTcpEnable = checked ;
}
void settingswidget : : on_clusterServerNameCombo_currentTextChanged ( const QString & text )
{
2023-07-17 11:09:14 +01:00
Q_UNUSED ( text )
2023-06-08 21:58:22 +01:00
ui - > clusterTcpAddBtn - > setEnabled ( true ) ;
2023-02-20 13:45:33 -08:00
}
void settingswidget : : on_clusterTcpPortLineEdit_editingFinished ( )
{
2023-06-11 10:33:16 +01:00
prefs - > clusterTcpPort = ui - > clusterTcpPortLineEdit - > displayText ( ) . toInt ( ) ;
2023-02-20 13:45:33 -08:00
}
void settingswidget : : on_clusterUsernameLineEdit_editingFinished ( )
{
2023-06-11 10:33:16 +01:00
prefs - > clusterTcpUserName = ui - > clusterUsernameLineEdit - > text ( ) ;
2023-02-20 13:45:33 -08:00
}
void settingswidget : : on_clusterPasswordLineEdit_editingFinished ( )
{
2023-06-11 10:33:16 +01:00
prefs - > clusterTcpPassword = ui - > clusterPasswordLineEdit - > text ( ) ;
2023-02-20 13:45:33 -08:00
}
void settingswidget : : on_clusterTimeoutLineEdit_editingFinished ( )
{
2023-06-11 10:33:16 +01:00
prefs - > clusterTimeout = ui - > clusterTimeoutLineEdit - > displayText ( ) . toInt ( ) ;
2023-02-20 13:45:33 -08:00
}
void settingswidget : : on_clusterUdpPortLineEdit_editingFinished ( )
{
bool ok = false ;
int p = ui - > clusterUdpPortLineEdit - > text ( ) . toInt ( & ok ) ;
if ( ok )
{
prefs - > clusterUdpPort = p ;
emit changedClusterPref ( cl_clusterUdpPort ) ;
}
}
2023-02-20 20:45:55 -08:00
void settingswidget : : on_clusterSkimmerSpotsEnable_clicked ( bool checked )
{
prefs - > clusterSkimmerSpotsEnable = checked ;
emit changedClusterPref ( cl_clusterSkimmerSpotsEnable ) ;
}
2023-06-11 10:33:16 +01:00
void settingswidget : : on_clusterTcpConnectBtn_clicked ( )
{
emit changedClusterPref ( cl_clusterTcpConnect ) ;
}
void settingswidget : : on_clusterTcpDisconnectBtn_clicked ( )
{
emit changedClusterPref ( cl_clusterTcpDisconnect ) ;
}
2023-05-28 22:11:59 +01:00
/* End of cluster settings */
/* Beginning of UDP connection settings */
2025-01-24 12:37:52 +00:00
void settingswidget : : on_adminLoginChk_clicked ( bool checked )
{
udpPrefs - > adminLogin = checked ;
emit changedUdpPref ( u_adminLogin ) ;
}
2023-02-20 20:45:55 -08:00
void settingswidget : : on_ipAddressTxt_textChanged ( const QString & arg1 )
{
udpPrefs - > ipAddress = arg1 ;
emit changedUdpPref ( u_ipAddress ) ;
}
void settingswidget : : on_usernameTxt_textChanged ( const QString & arg1 )
{
udpPrefs - > username = arg1 ;
emit changedUdpPref ( u_username ) ;
}
void settingswidget : : on_controlPortTxt_textChanged ( const QString & arg1 )
{
bool ok = false ;
int port = arg1 . toUInt ( & ok ) ;
if ( ok )
{
udpPrefs - > controlLANPort = port ;
emit changedUdpPref ( u_controlLANPort ) ;
}
}
2025-06-04 00:29:12 +01:00
void settingswidget : : on_catPortTxt_textChanged ( const QString & arg1 )
{
bool ok = false ;
int port = arg1 . toUInt ( & ok ) ;
if ( ok )
{
udpPrefs - > serialLANPort = port ;
emit changedUdpPref ( u_serialLANPort ) ;
}
}
void settingswidget : : on_audioPortTxt_textChanged ( const QString & arg1 )
{
bool ok = false ;
int port = arg1 . toUInt ( & ok ) ;
if ( ok )
{
udpPrefs - > audioLANPort = port ;
emit changedUdpPref ( u_audioLANPort ) ;
}
}
void settingswidget : : on_scopePortTxt_textChanged ( const QString & arg1 )
{
bool ok = false ;
int port = arg1 . toUInt ( & ok ) ;
if ( ok )
{
udpPrefs - > scopeLANPort = port ;
emit changedUdpPref ( u_scopeLANPort ) ;
}
}
2023-02-20 20:45:55 -08:00
void settingswidget : : on_passwordTxt_textChanged ( const QString & arg1 )
{
udpPrefs - > password = arg1 ;
emit changedUdpPref ( u_password ) ;
}
void settingswidget : : on_audioDuplexCombo_currentIndexChanged ( int index )
{
udpPrefs - > halfDuplex = ( bool ) index ;
emit changedUdpPref ( u_halfDuplex ) ;
}
2023-02-21 22:54:15 -08:00
2023-05-28 22:11:59 +01:00
void settingswidget : : on_audioSampleRateCombo_currentIndexChanged ( int value )
{
prefs - > rxSetup . sampleRate = ui - > audioSampleRateCombo - > itemText ( value ) . toInt ( ) ;
prefs - > txSetup . sampleRate = ui - > audioSampleRateCombo - > itemText ( value ) . toInt ( ) ;
emit changedUdpPref ( u_sampleRate ) ;
}
void settingswidget : : on_audioRXCodecCombo_currentIndexChanged ( int value )
{
prefs - > rxSetup . codec = ui - > audioRXCodecCombo - > itemData ( value ) . toInt ( ) ;
emit changedUdpPref ( u_rxCodec ) ;
}
void settingswidget : : on_audioTXCodecCombo_currentIndexChanged ( int value )
{
prefs - > txSetup . codec = ui - > audioTXCodecCombo - > itemData ( value ) . toInt ( ) ;
emit changedUdpPref ( u_txCodec ) ;
}
void settingswidget : : on_rxLatencySlider_valueChanged ( int value )
{
prefs - > rxSetup . latency = value ;
ui - > rxLatencyValue - > setText ( QString : : number ( value ) ) ;
emit changedUdpPref ( u_rxLatency ) ;
}
void settingswidget : : on_txLatencySlider_valueChanged ( int value )
{
//txSetup.latency = value;
prefs - > txSetup . latency = value ;
ui - > txLatencyValue - > setText ( QString : : number ( value ) ) ;
emit changedUdpPref ( u_txLatency ) ;
}
2023-02-21 22:54:15 -08:00
void settingswidget : : on_audioOutputCombo_currentIndexChanged ( int index )
{
2023-05-28 22:11:59 +01:00
if ( index > = 0 ) {
if ( prefs - > audioSystem = = qtAudio ) {
prefs - > rxSetup . port = audioDev - > getOutputDeviceInfo ( index ) ;
}
else {
prefs - > rxSetup . portInt = audioDev - > getOutputDeviceInt ( index ) ;
}
prefs - > rxSetup . name = audioDev - > getOutputName ( index ) ;
}
qDebug ( logGui ( ) ) < < " Changed audio output to: " < < prefs - > rxSetup . name ;
emit changedUdpPref ( u_audioOutput ) ;
2023-02-21 22:54:15 -08:00
}
void settingswidget : : on_audioInputCombo_currentIndexChanged ( int index )
{
2023-05-28 22:11:59 +01:00
if ( index > = 0 ) {
if ( prefs - > audioSystem = = qtAudio ) {
prefs - > txSetup . port = audioDev - > getInputDeviceInfo ( index ) ;
}
else {
prefs - > txSetup . portInt = audioDev - > getInputDeviceInt ( index ) ;
}
prefs - > txSetup . name = audioDev - > getInputName ( index ) ;
}
qDebug ( logGui ( ) ) < < " Changed audio output to: " < < prefs - > rxSetup . name ;
emit changedUdpPref ( u_audioInput ) ;
2023-02-21 22:54:15 -08:00
}
2023-05-28 22:11:59 +01:00
/* End of UDP connection settings */
/* Beginning of radio specific settings */
2023-05-27 20:26:53 +01:00
void settingswidget : : on_modInputCombo_activated ( int index )
{
2024-08-13 08:38:55 +01:00
prefs - > inputSource [ 0 ] = ui - > modInputCombo - > itemData ( index ) . value < rigInput > ( ) ;
2023-09-30 11:08:20 +01:00
emit changedRsPref ( rs_dataOffMod ) ;
2023-05-27 20:26:53 +01:00
}
void settingswidget : : on_modInputData1Combo_activated ( int index )
{
2024-08-13 08:38:55 +01:00
prefs - > inputSource [ 1 ] = ui - > modInputData1Combo - > itemData ( index ) . value < rigInput > ( ) ;
2023-09-30 11:08:20 +01:00
emit changedRsPref ( rs_data1Mod ) ;
2023-05-27 20:26:53 +01:00
}
void settingswidget : : on_modInputData2Combo_activated ( int index )
{
2024-08-13 08:38:55 +01:00
prefs - > inputSource [ 2 ] = ui - > modInputData2Combo - > itemData ( index ) . value < rigInput > ( ) ;
2023-09-30 11:08:20 +01:00
emit changedRsPref ( rs_data2Mod ) ;
2023-05-27 20:26:53 +01:00
}
void settingswidget : : on_modInputData3Combo_activated ( int index )
{
2024-08-13 08:38:55 +01:00
prefs - > inputSource [ 3 ] = ui - > modInputData3Combo - > itemData ( index ) . value < rigInput > ( ) ;
2023-09-30 11:08:20 +01:00
emit changedRsPref ( rs_data3Mod ) ;
2023-05-27 20:26:53 +01:00
}
2023-05-28 22:11:59 +01:00
2024-07-23 09:18:27 +01:00
void settingswidget : : on_decimalSeparatorsCombo_currentIndexChanged ( int index )
{
2024-08-13 08:38:55 +01:00
prefs - > decimalSeparator = ui - > decimalSeparatorsCombo - > itemData ( index ) . toChar ( ) ;
2024-07-23 09:18:27 +01:00
emit changedIfPref ( if_separators ) ;
}
void settingswidget : : on_groupSeparatorsCombo_currentIndexChanged ( int index )
{
2024-08-13 08:38:55 +01:00
prefs - > groupSeparator = ui - > groupSeparatorsCombo - > itemData ( index ) . toChar ( ) ;
2024-07-23 09:18:27 +01:00
emit changedIfPref ( if_separators ) ;
}
2025-01-18 12:29:34 +00:00
void settingswidget : : on_forceVfoModeChk_clicked ( bool checked )
{
prefs - > forceVfoMode = checked ;
emit changedIfPref ( if_forceVfoMode ) ;
}
2025-05-06 18:29:08 +01:00
void settingswidget : : on_autoPowerOnChk_clicked ( bool checked )
{
prefs - > autoPowerOn = checked ;
emit changedIfPref ( if_autoPowerOn ) ;
}
2023-05-28 22:11:59 +01:00
/* End of radio specific settings */
/* Color UI helper functions */
void settingswidget : : setColorElement ( QColor color ,
QLedLabel * led ,
QLabel * label ,
QLineEdit * lineText )
{
2026-01-02 18:59:51 +00:00
if ( led ! = nullptr )
2023-05-28 22:11:59 +01:00
{
led - > setColor ( color , true ) ;
}
2026-01-02 18:59:51 +00:00
if ( label ! = nullptr )
2023-05-28 22:11:59 +01:00
{
label - > setText ( color . name ( QColor : : HexArgb ) ) ;
}
2026-01-02 18:59:51 +00:00
if ( lineText ! = nullptr )
2023-05-28 22:11:59 +01:00
{
lineText - > setText ( color . name ( QColor : : HexArgb ) ) ;
}
}
void settingswidget : : setColorElement ( QColor color , QLedLabel * led , QLabel * label )
{
2026-01-02 18:59:51 +00:00
setColorElement ( color , led , label , nullptr ) ;
2023-05-28 22:11:59 +01:00
}
void settingswidget : : setColorElement ( QColor color , QLedLabel * led , QLineEdit * lineText )
{
2026-01-02 18:59:51 +00:00
setColorElement ( color , led , nullptr , lineText ) ;
2023-05-28 22:11:59 +01:00
}
QColor settingswidget : : getColorFromPicker ( QColor initialColor )
{
QColorDialog : : ColorDialogOptions options ;
options . setFlag ( QColorDialog : : ShowAlphaChannel , true ) ;
options . setFlag ( QColorDialog : : DontUseNativeDialog , true ) ;
QColor selColor = QColorDialog : : getColor ( initialColor , this , " Select Color " , options ) ;
int alphaVal = 0 ;
bool ok = false ;
if ( selColor . isValid ( ) )
{
if ( selColor . alpha ( ) = = 0 )
{
alphaVal = QInputDialog : : getInt ( this , tr ( " Specify Opacity " ) ,
tr ( " You specified an opacity value of 0. \n Do you want to change it? (0=transparent, 255=opaque) " ) , 0 , 0 , 255 , 1 ,
& ok ) ;
if ( ! ok )
{
return selColor ;
}
else {
selColor . setAlpha ( alphaVal ) ;
return selColor ;
}
}
return selColor ;
}
else
return initialColor ;
}
void settingswidget : : getSetColor ( QLedLabel * led , QLabel * label )
{
QColor selColor = getColorFromPicker ( led - > getColor ( ) ) ;
setColorElement ( selColor , led , label ) ;
}
void settingswidget : : getSetColor ( QLedLabel * led , QLineEdit * line )
{
QColor selColor = getColorFromPicker ( led - > getColor ( ) ) ;
setColorElement ( selColor , led , line ) ;
}
QString settingswidget : : setColorFromString ( QString colorstr , QLedLabel * led )
{
2026-01-02 18:59:51 +00:00
if ( led = = nullptr )
2023-05-28 22:11:59 +01:00
return " ERROR " ;
if ( ! colorstr . startsWith ( " # " ) )
{
colorstr . prepend ( " # " ) ;
}
if ( colorstr . length ( ) ! = 9 )
{
// TODO: Tell user about AA RR GG BB
return led - > getColor ( ) . name ( QColor : : HexArgb ) ;
}
led - > setColor ( colorstr , true ) ;
return led - > getColor ( ) . name ( QColor : : HexArgb ) ;
}
void settingswidget : : setColorButtonOperations ( QColor * colorStore ,
QLineEdit * e , QLedLabel * d )
{
// Call this function with a pointer into the colorPreset color you
// wish to edit.
2026-01-02 18:59:51 +00:00
if ( colorStore = = nullptr )
2023-05-28 22:11:59 +01:00
{
qInfo ( logSystem ( ) ) < < " ERROR, invalid pointer to color received. " ;
return ;
}
getSetColor ( d , e ) ;
QColor t = d - > getColor ( ) ;
2024-06-23 11:59:41 +01:00
# if QT_VERSION >= QT_VERSION_CHECK(6, 4, 0)
2024-10-17 22:46:12 +01:00
* ( colorStore ) = colorStore - > fromString ( t . name ( QColor : : HexArgb ) ) ;
2024-06-23 11:59:41 +01:00
# else
2024-03-30 20:49:52 +00:00
colorStore - > setNamedColor ( t . name ( QColor : : HexArgb ) ) ;
2024-06-23 11:59:41 +01:00
# endif
2023-05-28 22:11:59 +01:00
//useCurrentColorPreset();
}
void settingswidget : : setColorLineEditOperations ( QColor * colorStore ,
QLineEdit * e , QLedLabel * d )
{
// Call this function with a pointer into the colorPreset color you
// wish to edit.
2026-01-02 18:59:51 +00:00
if ( colorStore = = nullptr )
2023-05-28 22:11:59 +01:00
{
qInfo ( logSystem ( ) ) < < " ERROR, invalid pointer to color received. " ;
return ;
}
QString colorStrValidated = setColorFromString ( e - > text ( ) , d ) ;
e - > setText ( colorStrValidated ) ;
2024-06-23 11:59:41 +01:00
# if QT_VERSION >= QT_VERSION_CHECK(6, 4, 0)
2024-10-17 22:46:12 +01:00
* ( colorStore ) = colorStore - > fromString ( colorStrValidated ) ;
2024-06-23 11:59:41 +01:00
# else
2024-03-30 20:49:52 +00:00
colorStore - > setNamedColor ( colorStrValidated ) ;
2024-06-23 11:59:41 +01:00
# endif
2023-05-28 22:11:59 +01:00
//useCurrentColorPreset();
}
void settingswidget : : setEditAndLedFromColor ( QColor c , QLineEdit * e , QLedLabel * d )
{
bool blockSignals = true ;
2026-01-02 18:59:51 +00:00
if ( e ! = nullptr )
2023-05-28 22:11:59 +01:00
{
e - > blockSignals ( blockSignals ) ;
e - > setText ( c . name ( QColor : : HexArgb ) ) ;
e - > blockSignals ( false ) ;
}
2026-01-02 18:59:51 +00:00
if ( d ! = nullptr )
2023-05-28 22:11:59 +01:00
{
d - > setColor ( c ) ;
}
}
void settingswidget : : loadColorPresetToUIandPlots ( int presetNumber )
{
if ( presetNumber > = numColorPresetsTotal )
{
qDebug ( logSystem ( ) ) < < " WARNING: asked for preset number [ " < < presetNumber < < " ], which is out of range. " ;
return ;
}
colorPrefsType p = colorPreset [ presetNumber ] ;
//qInfo(logSystem()) << "color preset number [" << presetNumber << "] requested for UI load, which has internal index of [" << p.presetNum << "]";
setEditAndLedFromColor ( p . gridColor , ui - > colorEditGrid , ui - > colorSwatchGrid ) ;
setEditAndLedFromColor ( p . axisColor , ui - > colorEditAxis , ui - > colorSwatchAxis ) ;
setEditAndLedFromColor ( p . textColor , ui - > colorEditText , ui - > colorSwatchText ) ;
setEditAndLedFromColor ( p . spectrumLine , ui - > colorEditSpecLine , ui - > colorSwatchSpecLine ) ;
setEditAndLedFromColor ( p . spectrumFill , ui - > colorEditSpecFill , ui - > colorSwatchSpecFill ) ;
2024-04-14 21:56:34 -07:00
quietlyUpdateCheckbox ( ui - > useSpectrumFillGradientChk , p . useSpectrumFillGradient ) ;
setEditAndLedFromColor ( p . spectrumFillTop , ui - > colorEditSpecFillTop , ui - > colorSwatchSpecFillTop ) ;
setEditAndLedFromColor ( p . spectrumFillBot , ui - > colorEditSpecFillBot , ui - > colorSwatchSpecFillBot ) ;
2023-05-28 22:11:59 +01:00
setEditAndLedFromColor ( p . underlayLine , ui - > colorEditUnderlayLine , ui - > colorSwatchUnderlayLine ) ;
setEditAndLedFromColor ( p . underlayFill , ui - > colorEditUnderlayFill , ui - > colorSwatchUnderlayFill ) ;
2024-04-14 21:56:34 -07:00
setEditAndLedFromColor ( p . underlayFillTop , ui - > colorEditUnderlayFillTop , ui - > colorSwatchUnderlayFillTop ) ;
setEditAndLedFromColor ( p . underlayFillBot , ui - > colorEditUnderlayFillBot , ui - > colorSwatchUnderlayFillBot ) ;
quietlyUpdateCheckbox ( ui - > useUnderlayFillGradientChk , p . useUnderlayFillGradient ) ;
2023-05-28 22:11:59 +01:00
setEditAndLedFromColor ( p . plotBackground , ui - > colorEditPlotBackground , ui - > colorSwatchPlotBackground ) ;
2024-04-14 21:56:34 -07:00
2023-05-28 22:11:59 +01:00
setEditAndLedFromColor ( p . tuningLine , ui - > colorEditTuningLine , ui - > colorSwatchTuningLine ) ;
setEditAndLedFromColor ( p . passband , ui - > colorEditPassband , ui - > colorSwatchPassband ) ;
setEditAndLedFromColor ( p . pbt , ui - > colorEditPBT , ui - > colorSwatchPBT ) ;
setEditAndLedFromColor ( p . meterLevel , ui - > colorEditMeterLevel , ui - > colorSwatchMeterLevel ) ;
setEditAndLedFromColor ( p . meterAverage , ui - > colorEditMeterAvg , ui - > colorSwatchMeterAverage ) ;
setEditAndLedFromColor ( p . meterPeakLevel , ui - > colorEditMeterPeakLevel , ui - > colorSwatchMeterPeakLevel ) ;
setEditAndLedFromColor ( p . meterPeakScale , ui - > colorEditMeterPeakScale , ui - > colorSwatchMeterPeakScale ) ;
setEditAndLedFromColor ( p . meterLowerLine , ui - > colorEditMeterScale , ui - > colorSwatchMeterScale ) ;
setEditAndLedFromColor ( p . meterLowText , ui - > colorEditMeterText , ui - > colorSwatchMeterText ) ;
setEditAndLedFromColor ( p . wfBackground , ui - > colorEditWfBackground , ui - > colorSwatchWfBackground ) ;
setEditAndLedFromColor ( p . wfGrid , ui - > colorEditWfGrid , ui - > colorSwatchWfGrid ) ;
setEditAndLedFromColor ( p . wfAxis , ui - > colorEditWfAxis , ui - > colorSwatchWfAxis ) ;
setEditAndLedFromColor ( p . wfText , ui - > colorEditWfText , ui - > colorSwatchWfText ) ;
setEditAndLedFromColor ( p . clusterSpots , ui - > colorEditClusterSpots , ui - > colorSwatchClusterSpots ) ;
2024-12-30 19:22:26 +00:00
setEditAndLedFromColor ( p . buttonOff , ui - > colorEditButtonOff , ui - > colorSwatchButtonOff ) ;
setEditAndLedFromColor ( p . buttonOn , ui - > colorEditButtonOn , ui - > colorSwatchButtonOn ) ;
2023-05-28 22:11:59 +01:00
//useColorPreset(&p);
prefs - > currentColorPresetNumber = presetNumber ;
emit changedIfPref ( if_currentColorPresetNumber ) ;
}
void settingswidget : : on_colorRenamePresetBtn_clicked ( )
{
int p = ui - > colorPresetCombo - > currentIndex ( ) ;
QString newName ;
QMessageBox msgBox ;
bool ok = false ;
newName = QInputDialog : : getText ( this , tr ( " Rename Preset " ) ,
tr ( " Preset Name (10 characters max): " ) , QLineEdit : : Normal ,
ui - > colorPresetCombo - > currentText ( ) , & ok ) ;
if ( ! ok )
return ;
if ( ok & & ( newName . length ( ) < 11 ) & & ! newName . isEmpty ( ) )
{
colorPreset [ p ] . presetName - > clear ( ) ;
colorPreset [ p ] . presetName - > append ( newName ) ;
ui - > colorPresetCombo - > setItemText ( p , * ( colorPreset [ p ] . presetName ) ) ;
} else {
if ( newName . isEmpty ( ) | | ( newName . length ( ) > 10 ) )
{
msgBox . setText ( " Error, name must be at least one character and not exceed 10 characters. " ) ;
msgBox . exec ( ) ;
}
}
}
void settingswidget : : on_colorPresetCombo_currentIndexChanged ( int index )
{
prefs - > currentColorPresetNumber = index ;
loadColorPresetToUIandPlots ( index ) ;
}
void settingswidget : : on_colorRevertPresetBtn_clicked ( )
{
int pn = ui - > colorPresetCombo - > currentIndex ( ) ;
//setDefaultColors(pn);
loadColorPresetToUIandPlots ( pn ) ;
}
// ---------- end color helper functions ---------- //
// ---------- Color UI slots ----------//
2023-06-08 08:20:50 +01:00
// Removed save preset button.
2023-05-28 22:11:59 +01:00
// Grid:
void settingswidget : : on_colorSetBtnGrid_clicked ( )
{
int pos = ui - > colorPresetCombo - > currentIndex ( ) ;
QColor * c = & ( colorPreset [ pos ] . gridColor ) ;
setColorButtonOperations ( c , ui - > colorEditGrid , ui - > colorSwatchGrid ) ;
emit changedColPref ( col_grid ) ;
}
void settingswidget : : on_colorEditGrid_editingFinished ( )
{
int pos = ui - > colorPresetCombo - > currentIndex ( ) ;
QColor * c = & ( colorPreset [ pos ] . gridColor ) ;
setColorLineEditOperations ( c , ui - > colorEditGrid , ui - > colorSwatchGrid ) ;
emit changedColPref ( col_grid ) ;
}
// Axis:
void settingswidget : : on_colorSetBtnAxis_clicked ( )
{
int pos = ui - > colorPresetCombo - > currentIndex ( ) ;
QColor * c = & ( colorPreset [ pos ] . axisColor ) ;
setColorButtonOperations ( c , ui - > colorEditAxis , ui - > colorSwatchAxis ) ;
emit changedColPref ( col_axis ) ;
}
void settingswidget : : on_colorEditAxis_editingFinished ( )
{
int pos = ui - > colorPresetCombo - > currentIndex ( ) ;
QColor * c = & ( colorPreset [ pos ] . axisColor ) ;
setColorLineEditOperations ( c , ui - > colorEditAxis , ui - > colorSwatchAxis ) ;
emit changedColPref ( col_axis ) ;
}
// Text:
void settingswidget : : on_colorSetBtnText_clicked ( )
{
int pos = ui - > colorPresetCombo - > currentIndex ( ) ;
QColor * c = & ( colorPreset [ pos ] . textColor ) ;
setColorButtonOperations ( c , ui - > colorEditText , ui - > colorSwatchText ) ;
emit changedColPref ( col_text ) ;
}
void settingswidget : : on_colorEditText_editingFinished ( )
{
int pos = ui - > colorPresetCombo - > currentIndex ( ) ;
QColor * c = & ( colorPreset [ pos ] . textColor ) ;
setColorLineEditOperations ( c , ui - > colorEditText , ui - > colorSwatchText ) ;
emit changedColPref ( col_text ) ;
}
// SpecLine:
void settingswidget : : on_colorEditSpecLine_editingFinished ( )
{
int pos = ui - > colorPresetCombo - > currentIndex ( ) ;
QColor * c = & ( colorPreset [ pos ] . spectrumLine ) ;
setColorLineEditOperations ( c , ui - > colorEditSpecLine , ui - > colorSwatchSpecLine ) ;
emit changedColPref ( col_spectrumLine ) ;
}
void settingswidget : : on_colorSetBtnSpecLine_clicked ( )
{
int pos = ui - > colorPresetCombo - > currentIndex ( ) ;
QColor * c = & ( colorPreset [ pos ] . spectrumLine ) ;
setColorButtonOperations ( c , ui - > colorEditSpecLine , ui - > colorSwatchSpecLine ) ;
emit changedColPref ( col_spectrumLine ) ;
}
// SpecFill:
void settingswidget : : on_colorSetBtnSpecFill_clicked ( )
{
int pos = ui - > colorPresetCombo - > currentIndex ( ) ;
QColor * c = & ( colorPreset [ pos ] . spectrumFill ) ;
setColorButtonOperations ( c , ui - > colorEditSpecFill , ui - > colorSwatchSpecFill ) ;
emit changedColPref ( col_spectrumFill ) ;
}
void settingswidget : : on_colorEditSpecFill_editingFinished ( )
{
int pos = ui - > colorPresetCombo - > currentIndex ( ) ;
QColor * c = & ( colorPreset [ pos ] . spectrumFill ) ;
setColorLineEditOperations ( c , ui - > colorEditSpecFill , ui - > colorSwatchSpecFill ) ;
emit changedColPref ( col_spectrumFill ) ;
}
2024-04-14 21:56:34 -07:00
void settingswidget : : on_useSpectrumFillGradientChk_clicked ( bool checked )
{
int pos = ui - > colorPresetCombo - > currentIndex ( ) ;
colorPreset [ pos ] . useSpectrumFillGradient = checked ;
emit changedColPref ( col_useSpectrumFillGradient ) ;
}
// SpecFill Top:
void settingswidget : : on_colorSetBtnSpectFillTop_clicked ( )
{
int pos = ui - > colorPresetCombo - > currentIndex ( ) ;
QColor * c = & ( colorPreset [ pos ] . spectrumFillTop ) ;
setColorButtonOperations ( c , ui - > colorEditSpecFillTop , ui - > colorSwatchSpecFillTop ) ;
emit changedColPref ( col_spectrumFillTop ) ;
}
void settingswidget : : on_colorEditSpecFillTop_editingFinished ( )
{
int pos = ui - > colorPresetCombo - > currentIndex ( ) ;
QColor * c = & ( colorPreset [ pos ] . spectrumFillTop ) ;
setColorLineEditOperations ( c , ui - > colorEditSpecFillTop , ui - > colorSwatchSpecFillTop ) ;
emit changedColPref ( col_spectrumFillTop ) ;
}
// SpecFill Bot:
void settingswidget : : on_colorSetBtnSpectFillBot_clicked ( )
{
int pos = ui - > colorPresetCombo - > currentIndex ( ) ;
QColor * c = & ( colorPreset [ pos ] . spectrumFillBot ) ;
setColorButtonOperations ( c , ui - > colorEditSpecFillBot , ui - > colorSwatchSpecFillBot ) ;
emit changedColPref ( col_spectrumFillBot ) ;
}
void settingswidget : : on_colorEditSpecFillBot_editingFinished ( )
{
int pos = ui - > colorPresetCombo - > currentIndex ( ) ;
QColor * c = & ( colorPreset [ pos ] . spectrumFillBot ) ;
setColorLineEditOperations ( c , ui - > colorEditSpecFillBot , ui - > colorSwatchSpecFillBot ) ;
emit changedColPref ( col_spectrumFillBot ) ;
}
2023-05-28 22:11:59 +01:00
// PlotBackground:
void settingswidget : : on_colorEditPlotBackground_editingFinished ( )
{
int pos = ui - > colorPresetCombo - > currentIndex ( ) ;
QColor * c = & ( colorPreset [ pos ] . plotBackground ) ;
setColorLineEditOperations ( c , ui - > colorEditPlotBackground , ui - > colorSwatchPlotBackground ) ;
emit changedColPref ( col_plotBackground ) ;
}
void settingswidget : : on_colorSetBtnPlotBackground_clicked ( )
{
int pos = ui - > colorPresetCombo - > currentIndex ( ) ;
QColor * c = & ( colorPreset [ pos ] . plotBackground ) ;
setColorButtonOperations ( c , ui - > colorEditPlotBackground , ui - > colorSwatchPlotBackground ) ;
emit changedColPref ( col_plotBackground ) ;
}
// Underlay Line:
void settingswidget : : on_colorSetBtnUnderlayLine_clicked ( )
{
int pos = ui - > colorPresetCombo - > currentIndex ( ) ;
QColor * c = & ( colorPreset [ pos ] . underlayLine ) ;
setColorButtonOperations ( c , ui - > colorEditUnderlayLine , ui - > colorSwatchUnderlayLine ) ;
emit changedColPref ( col_underlayLine ) ;
}
void settingswidget : : on_colorEditUnderlayLine_editingFinished ( )
{
int pos = ui - > colorPresetCombo - > currentIndex ( ) ;
QColor * c = & ( colorPreset [ pos ] . underlayLine ) ;
setColorLineEditOperations ( c , ui - > colorEditUnderlayLine , ui - > colorSwatchUnderlayLine ) ;
emit changedColPref ( col_underlayLine ) ;
}
// Underlay Fill:
void settingswidget : : on_colorSetBtnUnderlayFill_clicked ( )
{
int pos = ui - > colorPresetCombo - > currentIndex ( ) ;
QColor * c = & ( colorPreset [ pos ] . underlayFill ) ;
setColorButtonOperations ( c , ui - > colorEditUnderlayFill , ui - > colorSwatchUnderlayFill ) ;
emit changedColPref ( col_underlayFill ) ;
}
void settingswidget : : on_colorEditUnderlayFill_editingFinished ( )
{
int pos = ui - > colorPresetCombo - > currentIndex ( ) ;
QColor * c = & ( colorPreset [ pos ] . underlayFill ) ;
setColorLineEditOperations ( c , ui - > colorEditUnderlayFill , ui - > colorSwatchUnderlayFill ) ;
emit changedColPref ( col_underlayFill ) ;
}
2024-04-14 21:56:34 -07:00
void settingswidget : : on_useUnderlayFillGradientChk_clicked ( bool checked )
{
int pos = ui - > colorPresetCombo - > currentIndex ( ) ;
colorPreset [ pos ] . useUnderlayFillGradient = checked ;
emit changedColPref ( col_useUnderlayFillGradient ) ;
}
// Underlay Fill Top:
void settingswidget : : on_colorSetBtnUnderlayFillTop_clicked ( )
{
int pos = ui - > colorPresetCombo - > currentIndex ( ) ;
QColor * c = & ( colorPreset [ pos ] . underlayFillTop ) ;
setColorButtonOperations ( c , ui - > colorEditUnderlayFillTop , ui - > colorSwatchUnderlayFillTop ) ;
emit changedColPref ( col_underlayFillTop ) ;
}
void settingswidget : : on_colorEditUnderlayFillTop_editingFinished ( )
{
int pos = ui - > colorPresetCombo - > currentIndex ( ) ;
QColor * c = & ( colorPreset [ pos ] . underlayFillTop ) ;
setColorLineEditOperations ( c , ui - > colorEditUnderlayFillTop , ui - > colorSwatchUnderlayFillTop ) ;
emit changedColPref ( col_underlayFillTop ) ;
}
// Underlay Fill Bot:
void settingswidget : : on_colorSetBtnUnderlayFillBot_clicked ( )
{
int pos = ui - > colorPresetCombo - > currentIndex ( ) ;
QColor * c = & ( colorPreset [ pos ] . underlayFillBot ) ;
setColorButtonOperations ( c , ui - > colorEditUnderlayFillBot , ui - > colorSwatchUnderlayFillBot ) ;
emit changedColPref ( col_underlayFillBot ) ;
}
void settingswidget : : on_colorEditUnderlayFillBot_editingFinished ( )
{
int pos = ui - > colorPresetCombo - > currentIndex ( ) ;
QColor * c = & ( colorPreset [ pos ] . underlayFillBot ) ;
setColorLineEditOperations ( c , ui - > colorEditUnderlayFillBot , ui - > colorSwatchUnderlayFillBot ) ;
emit changedColPref ( col_underlayFillBot ) ;
}
2023-05-28 22:11:59 +01:00
// WF Background:
void settingswidget : : on_colorSetBtnwfBackground_clicked ( )
{
int pos = ui - > colorPresetCombo - > currentIndex ( ) ;
QColor * c = & ( colorPreset [ pos ] . wfBackground ) ;
setColorButtonOperations ( c , ui - > colorEditWfBackground , ui - > colorSwatchWfBackground ) ;
emit changedColPref ( col_waterfallBack ) ;
}
void settingswidget : : on_colorEditWfBackground_editingFinished ( )
{
int pos = ui - > colorPresetCombo - > currentIndex ( ) ;
QColor * c = & ( colorPreset [ pos ] . wfBackground ) ;
setColorLineEditOperations ( c , ui - > colorEditWfBackground , ui - > colorSwatchWfBackground ) ;
emit changedColPref ( col_waterfallBack ) ;
}
// WF Grid:
void settingswidget : : on_colorSetBtnWfGrid_clicked ( )
{
int pos = ui - > colorPresetCombo - > currentIndex ( ) ;
QColor * c = & ( colorPreset [ pos ] . wfGrid ) ;
setColorButtonOperations ( c , ui - > colorEditWfGrid , ui - > colorSwatchWfGrid ) ;
emit changedColPref ( col_waterfallGrid ) ;
}
void settingswidget : : on_colorEditWfGrid_editingFinished ( )
{
int pos = ui - > colorPresetCombo - > currentIndex ( ) ;
QColor * c = & ( colorPreset [ pos ] . wfGrid ) ;
setColorLineEditOperations ( c , ui - > colorEditWfGrid , ui - > colorSwatchWfGrid ) ;
emit changedColPref ( col_waterfallGrid ) ;
}
// WF Axis:
void settingswidget : : on_colorSetBtnWfAxis_clicked ( )
{
int pos = ui - > colorPresetCombo - > currentIndex ( ) ;
QColor * c = & ( colorPreset [ pos ] . wfAxis ) ;
setColorButtonOperations ( c , ui - > colorEditWfAxis , ui - > colorSwatchWfAxis ) ;
emit changedColPref ( col_waterfallAxis ) ;
}
void settingswidget : : on_colorEditWfAxis_editingFinished ( )
{
int pos = ui - > colorPresetCombo - > currentIndex ( ) ;
QColor * c = & ( colorPreset [ pos ] . wfAxis ) ;
setColorLineEditOperations ( c , ui - > colorEditWfAxis , ui - > colorSwatchWfAxis ) ;
emit changedColPref ( col_waterfallAxis ) ;
}
// WF Text:
void settingswidget : : on_colorSetBtnWfText_clicked ( )
{
int pos = ui - > colorPresetCombo - > currentIndex ( ) ;
QColor * c = & ( colorPreset [ pos ] . wfText ) ;
setColorButtonOperations ( c , ui - > colorEditWfText , ui - > colorSwatchWfText ) ;
emit changedColPref ( col_waterfallText ) ;
}
void settingswidget : : on_colorEditWfText_editingFinished ( )
{
int pos = ui - > colorPresetCombo - > currentIndex ( ) ;
QColor * c = & ( colorPreset [ pos ] . wfText ) ;
setColorLineEditOperations ( c , ui - > colorEditWfText , ui - > colorSwatchWfText ) ;
emit changedColPref ( col_waterfallText ) ;
}
// Tuning Line:
void settingswidget : : on_colorSetBtnTuningLine_clicked ( )
{
int pos = ui - > colorPresetCombo - > currentIndex ( ) ;
QColor * c = & ( colorPreset [ pos ] . tuningLine ) ;
setColorButtonOperations ( c , ui - > colorEditTuningLine , ui - > colorSwatchTuningLine ) ;
emit changedColPref ( col_tuningLine ) ;
}
void settingswidget : : on_colorEditTuningLine_editingFinished ( )
{
int pos = ui - > colorPresetCombo - > currentIndex ( ) ;
QColor * c = & ( colorPreset [ pos ] . tuningLine ) ;
setColorLineEditOperations ( c , ui - > colorEditTuningLine , ui - > colorSwatchTuningLine ) ;
emit changedColPref ( col_tuningLine ) ;
}
// Passband:
void settingswidget : : on_colorSetBtnPassband_clicked ( )
{
int pos = ui - > colorPresetCombo - > currentIndex ( ) ;
QColor * c = & ( colorPreset [ pos ] . passband ) ;
setColorButtonOperations ( c , ui - > colorEditPassband , ui - > colorSwatchPassband ) ;
emit changedColPref ( col_passband ) ;
}
void settingswidget : : on_colorEditPassband_editingFinished ( )
{
int pos = ui - > colorPresetCombo - > currentIndex ( ) ;
QColor * c = & ( colorPreset [ pos ] . passband ) ;
setColorLineEditOperations ( c , ui - > colorEditPassband , ui - > colorSwatchPassband ) ;
emit changedColPref ( col_passband ) ;
}
void settingswidget : : on_colorSetBtnPBT_clicked ( )
{
int pos = ui - > colorPresetCombo - > currentIndex ( ) ;
QColor * c = & ( colorPreset [ pos ] . pbt ) ;
setColorButtonOperations ( c , ui - > colorEditPBT , ui - > colorSwatchPBT ) ;
emit changedColPref ( col_pbtIndicator ) ;
}
void settingswidget : : on_colorEditPBT_editingFinished ( )
{
int pos = ui - > colorPresetCombo - > currentIndex ( ) ;
QColor * c = & ( colorPreset [ pos ] . pbt ) ;
setColorLineEditOperations ( c , ui - > colorEditPBT , ui - > colorSwatchPBT ) ;
emit changedColPref ( col_pbtIndicator ) ;
}
// Meter Level:
void settingswidget : : on_colorSetBtnMeterLevel_clicked ( )
{
int pos = ui - > colorPresetCombo - > currentIndex ( ) ;
QColor * c = & ( colorPreset [ pos ] . meterLevel ) ;
setColorButtonOperations ( c , ui - > colorEditMeterLevel , ui - > colorSwatchMeterLevel ) ;
emit changedColPref ( col_meterLevel ) ;
}
void settingswidget : : on_colorEditMeterLevel_editingFinished ( )
{
int pos = ui - > colorPresetCombo - > currentIndex ( ) ;
QColor * c = & ( colorPreset [ pos ] . meterLevel ) ;
setColorLineEditOperations ( c , ui - > colorEditMeterLevel , ui - > colorSwatchMeterLevel ) ;
emit changedColPref ( col_meterLevel ) ;
}
// Meter Average:
void settingswidget : : on_colorSetBtnMeterAvg_clicked ( )
{
int pos = ui - > colorPresetCombo - > currentIndex ( ) ;
QColor * c = & ( colorPreset [ pos ] . meterAverage ) ;
setColorButtonOperations ( c , ui - > colorEditMeterAvg , ui - > colorSwatchMeterAverage ) ;
emit changedColPref ( col_meterAverage ) ;
}
void settingswidget : : on_colorEditMeterAvg_editingFinished ( )
{
int pos = ui - > colorPresetCombo - > currentIndex ( ) ;
QColor * c = & ( colorPreset [ pos ] . meterAverage ) ;
setColorLineEditOperations ( c , ui - > colorEditMeterAvg , ui - > colorSwatchMeterAverage ) ;
emit changedColPref ( col_meterAverage ) ;
}
// Meter Peak Level:
void settingswidget : : on_colorSetBtnMeterPeakLevel_clicked ( )
{
int pos = ui - > colorPresetCombo - > currentIndex ( ) ;
QColor * c = & ( colorPreset [ pos ] . meterPeakLevel ) ;
setColorButtonOperations ( c , ui - > colorEditMeterPeakLevel , ui - > colorSwatchMeterPeakLevel ) ;
emit changedColPref ( col_meterPeakLevel ) ;
}
void settingswidget : : on_colorEditMeterPeakLevel_editingFinished ( )
{
int pos = ui - > colorPresetCombo - > currentIndex ( ) ;
QColor * c = & ( colorPreset [ pos ] . meterPeakLevel ) ;
setColorLineEditOperations ( c , ui - > colorEditMeterPeakLevel , ui - > colorSwatchMeterPeakLevel ) ;
emit changedColPref ( col_meterPeakLevel ) ;
}
// Meter Peak Scale:
void settingswidget : : on_colorSetBtnMeterPeakScale_clicked ( )
{
int pos = ui - > colorPresetCombo - > currentIndex ( ) ;
QColor * c = & ( colorPreset [ pos ] . meterPeakScale ) ;
setColorButtonOperations ( c , ui - > colorEditMeterPeakScale , ui - > colorSwatchMeterPeakScale ) ;
emit changedColPref ( col_meterHighScale ) ;
}
void settingswidget : : on_colorEditMeterPeakScale_editingFinished ( )
{
int pos = ui - > colorPresetCombo - > currentIndex ( ) ;
QColor * c = & ( colorPreset [ pos ] . meterPeakScale ) ;
setColorLineEditOperations ( c , ui - > colorEditMeterPeakScale , ui - > colorSwatchMeterPeakScale ) ;
emit changedColPref ( col_meterHighScale ) ;
}
// Meter Scale (line):
void settingswidget : : on_colorSetBtnMeterScale_clicked ( )
{
int pos = ui - > colorPresetCombo - > currentIndex ( ) ;
QColor * c = & ( colorPreset [ pos ] . meterLowerLine ) ;
setColorButtonOperations ( c , ui - > colorEditMeterScale , ui - > colorSwatchMeterScale ) ;
emit changedColPref ( col_meterScale ) ;
}
void settingswidget : : on_colorEditMeterScale_editingFinished ( )
{
int pos = ui - > colorPresetCombo - > currentIndex ( ) ;
QColor * c = & ( colorPreset [ pos ] . meterLowerLine ) ;
setColorLineEditOperations ( c , ui - > colorEditMeterScale , ui - > colorSwatchMeterScale ) ;
emit changedColPref ( col_meterScale ) ;
}
// Meter Text:
void settingswidget : : on_colorSetBtnMeterText_clicked ( )
{
int pos = ui - > colorPresetCombo - > currentIndex ( ) ;
QColor * c = & ( colorPreset [ pos ] . meterLowText ) ;
setColorButtonOperations ( c , ui - > colorEditMeterText , ui - > colorSwatchMeterText ) ;
emit changedColPref ( col_meterText ) ;
}
void settingswidget : : on_colorEditMeterText_editingFinished ( )
{
int pos = ui - > colorPresetCombo - > currentIndex ( ) ;
QColor * c = & ( colorPreset [ pos ] . meterLowText ) ;
setColorLineEditOperations ( c , ui - > colorEditMeterText , ui - > colorSwatchMeterText ) ;
emit changedColPref ( col_meterText ) ;
}
// Cluster Spots:
void settingswidget : : on_colorSetBtnClusterSpots_clicked ( )
{
int pos = ui - > colorPresetCombo - > currentIndex ( ) ;
QColor * c = & ( colorPreset [ pos ] . clusterSpots ) ;
setColorButtonOperations ( c , ui - > colorEditClusterSpots , ui - > colorSwatchClusterSpots ) ;
emit changedColPref ( col_clusterSpots ) ;
}
void settingswidget : : on_colorEditClusterSpots_editingFinished ( )
{
int pos = ui - > colorPresetCombo - > currentIndex ( ) ;
QColor * c = & ( colorPreset [ pos ] . clusterSpots ) ;
setColorLineEditOperations ( c , ui - > colorEditClusterSpots , ui - > colorSwatchClusterSpots ) ;
emit changedColPref ( col_clusterSpots ) ;
}
2024-12-30 19:22:26 +00:00
// Buttons:
void settingswidget : : on_colorSetBtnButtonOff_clicked ( )
{
int pos = ui - > colorPresetCombo - > currentIndex ( ) ;
QColor * c = & ( colorPreset [ pos ] . buttonOff ) ;
setColorButtonOperations ( c , ui - > colorEditButtonOff , ui - > colorSwatchButtonOff ) ;
emit changedColPref ( col_buttonOff ) ;
}
void settingswidget : : on_colorEditButtonOff_editingFinished ( )
{
int pos = ui - > colorPresetCombo - > currentIndex ( ) ;
QColor * c = & ( colorPreset [ pos ] . buttonOff ) ;
setColorLineEditOperations ( c , ui - > colorEditButtonOff , ui - > colorSwatchButtonOff ) ;
emit changedColPref ( col_buttonOff ) ;
}
void settingswidget : : on_colorSetBtnButtonOn_clicked ( )
{
int pos = ui - > colorPresetCombo - > currentIndex ( ) ;
QColor * c = & ( colorPreset [ pos ] . buttonOn ) ;
setColorButtonOperations ( c , ui - > colorEditButtonOn , ui - > colorSwatchButtonOn ) ;
emit changedColPref ( col_buttonOn ) ;
}
void settingswidget : : on_colorEditButtonOn_editingFinished ( )
{
int pos = ui - > colorPresetCombo - > currentIndex ( ) ;
QColor * c = & ( colorPreset [ pos ] . buttonOn ) ;
setColorLineEditOperations ( c , ui - > colorEditButtonOn , ui - > colorSwatchButtonOn ) ;
emit changedColPref ( col_buttonOn ) ;
}
2023-05-28 22:11:59 +01:00
// ---------- End color UI slots ----------//
2023-06-08 08:20:50 +01:00
void settingswidget : : on_useUTCChk_clicked ( bool checked )
{
prefs - > useUTC = checked ;
}
2025-01-11 12:32:31 +00:00
void settingswidget : : on_setRadioTimeChk_clicked ( bool checked )
{
prefs - > setRadioTime = checked ;
}
2023-06-08 08:20:50 +01:00
void settingswidget : : on_setClockBtn_clicked ( )
{
emit changedRsPref ( rs_setClock ) ;
}
void settingswidget : : on_pttOnBtn_clicked ( )
{
emit changedRsPref ( rs_pttOn ) ;
}
void settingswidget : : on_pttOffBtn_clicked ( )
{
emit changedRsPref ( rs_pttOff ) ;
}
void settingswidget : : on_adjRefBtn_clicked ( )
{
emit changedRsPref ( rs_adjRef ) ;
}
void settingswidget : : on_satOpsBtn_clicked ( )
{
emit changedRsPref ( rs_satOps ) ;
}
/* Beginning of UDP Server settings */
void settingswidget : : on_serverRXAudioInputCombo_currentIndexChanged ( int index )
{
2024-05-20 14:35:36 +01:00
if ( index > = 0 ) {
if ( prefs - > audioSystem = = qtAudio ) {
serverConfig - > rigs . first ( ) - > rxAudioSetup . port = audioDev - > getInputDeviceInfo ( index ) ;
}
else {
serverConfig - > rigs . first ( ) - > rxAudioSetup . portInt = audioDev - > getInputDeviceInt ( index ) ;
}
serverConfig - > rigs . first ( ) - > rxAudioSetup . name = audioDev - > getInputName ( index ) ;
}
qDebug ( logGui ( ) ) < < " Changed server audio input to: " < < serverConfig - > rigs . first ( ) - > rxAudioSetup . name ;
emit changedServerPref ( s_audioInput ) ;
2023-06-08 08:20:50 +01:00
}
void settingswidget : : on_serverTXAudioOutputCombo_currentIndexChanged ( int index )
{
2024-05-20 14:35:36 +01:00
if ( index > = 0 ) {
if ( prefs - > audioSystem = = qtAudio ) {
serverConfig - > rigs . first ( ) - > txAudioSetup . port = audioDev - > getOutputDeviceInfo ( index ) ;
}
else {
serverConfig - > rigs . first ( ) - > txAudioSetup . portInt = audioDev - > getOutputDeviceInt ( index ) ;
}
serverConfig - > rigs . first ( ) - > txAudioSetup . name = audioDev - > getOutputName ( index ) ;
}
qDebug ( logGui ( ) ) < < " Changed server audio output to: " < < serverConfig - > rigs . first ( ) - > txAudioSetup . name ;
emit changedServerPref ( s_audioOutput ) ;
2023-06-08 08:20:50 +01:00
}
void settingswidget : : on_serverEnableCheckbox_clicked ( bool checked )
{
serverConfig - > enabled = checked ;
2023-06-08 21:58:22 +01:00
emit changedServerPref ( s_enabled ) ;
2023-06-08 08:20:50 +01:00
}
2025-01-05 15:39:20 +00:00
void settingswidget : : on_serverDisableUIChk_clicked ( bool checked )
{
serverConfig - > disableUI = checked ;
emit changedServerPref ( s_disableui ) ;
}
2023-06-08 21:58:22 +01:00
void settingswidget : : on_serverControlPortText_textChanged ( QString text )
2023-06-08 08:20:50 +01:00
{
if ( ! haveServerConfig )
{
qCritical ( logGui ( ) ) < < " Cannot modify users without valid serverConfig. " ;
return ;
}
serverConfig - > controlPort = text . toInt ( ) ;
2023-06-08 21:58:22 +01:00
emit changedServerPref ( s_controlPort ) ;
2023-06-08 08:20:50 +01:00
}
void settingswidget : : on_serverCivPortText_textChanged ( QString text )
{
2023-06-08 21:58:22 +01:00
if ( ! haveServerConfig )
{
qCritical ( logGui ( ) ) < < " Cannot modify users without valid serverConfig. " ;
return ;
}
2023-06-08 08:20:50 +01:00
serverConfig - > civPort = text . toInt ( ) ;
2023-06-08 21:58:22 +01:00
emit changedServerPref ( s_civPort ) ;
2023-06-08 08:20:50 +01:00
}
void settingswidget : : on_serverAudioPortText_textChanged ( QString text )
{
2023-06-08 21:58:22 +01:00
if ( ! haveServerConfig )
{
qCritical ( logGui ( ) ) < < " Cannot modify users without valid serverConfig. " ;
return ;
}
2023-06-08 08:20:50 +01:00
serverConfig - > audioPort = text . toInt ( ) ;
2023-06-08 21:58:22 +01:00
emit changedServerPref ( s_audioPort ) ;
2023-06-08 08:20:50 +01:00
}
2023-06-08 21:58:22 +01:00
void settingswidget : : onServerUserFieldChanged ( )
{
if ( ! haveServerConfig ) {
qCritical ( logGui ( ) ) < < " Do not have serverConfig, cannot edit users. " ;
return ;
}
int row = sender ( ) - > property ( " row " ) . toInt ( ) ;
int col = sender ( ) - > property ( " col " ) . toInt ( ) ;
qDebug ( ) < < " Server User field col " < < col < < " row " < < row < < " changed " ;
// This is a new user line so add to serverUsersTable
if ( serverConfig - > users . length ( ) < = row )
{
qInfo ( ) < < " Something bad has happened, serverConfig.users is shorter than table! " ;
}
else
{
if ( col = = 0 )
{
QLineEdit * username = ( QLineEdit * ) ui - > serverUsersTable - > cellWidget ( row , 0 ) ;
if ( username - > text ( ) ! = serverConfig - > users [ row ] . username ) {
serverConfig - > users [ row ] . username = username - > text ( ) ;
}
}
else if ( col = = 1 )
{
QLineEdit * password = ( QLineEdit * ) ui - > serverUsersTable - > cellWidget ( row , 1 ) ;
QByteArray pass ;
passcode ( password - > text ( ) , pass ) ;
if ( QString ( pass ) ! = serverConfig - > users [ row ] . password ) {
serverConfig - > users [ row ] . password = pass ;
}
}
else if ( col = = 2 )
{
QComboBox * comboBox = ( QComboBox * ) ui - > serverUsersTable - > cellWidget ( row , 2 ) ;
serverConfig - > users [ row ] . userType = comboBox - > currentIndex ( ) ;
}
2025-02-03 20:20:40 +00:00
emit changedServerPref ( s_users ) ;
2023-06-08 21:58:22 +01:00
}
}
2023-06-08 08:20:50 +01:00
/* End of UDP Server settings */
2023-05-28 22:11:59 +01:00
2023-07-17 11:09:14 +01:00
// This is a slot that receives a signal from wfmain when we are connecting/disconnected
void settingswidget : : connectionStatus ( bool conn )
{
2024-04-14 15:59:16 -07:00
connectedStatus = conn ;
2023-09-24 21:00:21 +01:00
ui - > groupConnection - > setEnabled ( ! conn ) ;
ui - > audioInputCombo - > setEnabled ( ! conn ) ;
ui - > audioOutputCombo - > setEnabled ( ! conn ) ;
ui - > audioDuplexCombo - > setEnabled ( ! conn ) ;
ui - > audioRXCodecCombo - > setEnabled ( ! conn ) ;
ui - > audioTXCodecCombo - > setEnabled ( ! conn ) ;
2023-07-17 11:09:14 +01:00
ui - > audioSystemCombo - > setEnabled ( ! conn ) ;
2025-01-20 02:30:14 +00:00
ui - > audioSampleRateCombo - > setEnabled ( prefs - > manufacturer = = manufKenwood ? false : ! conn ) ;
2025-01-17 00:43:57 +00:00
ui - > networkConnectionTypeCombo - > setEnabled ( ! conn ) ;
2023-09-24 21:00:21 +01:00
ui - > txLatencySlider - > setEnabled ( ! conn ) ;
ui - > usernameTxt - > setEnabled ( ! conn ) ;
ui - > passwordTxt - > setEnabled ( ! conn ) ;
ui - > controlPortTxt - > setEnabled ( ! conn ) ;
2025-06-04 00:29:12 +01:00
ui - > catPortTxt - > setEnabled ( ! conn ) ;
ui - > audioPortTxt - > setEnabled ( ! conn ) ;
ui - > scopePortTxt - > setEnabled ( ! conn ) ;
2023-09-24 21:00:21 +01:00
ui - > ipAddressTxt - > setEnabled ( ! conn ) ;
ui - > serialDeviceListCombo - > setEnabled ( ! conn ) ;
ui - > baudRateCombo - > setEnabled ( ! conn ) ;
2024-12-30 14:19:52 +00:00
ui - > pttTypeLabel - > setEnabled ( ! conn ) ;
ui - > pttTypeCombo - > setEnabled ( ! conn ) ;
2023-09-24 21:00:21 +01:00
2025-01-09 00:35:26 +00:00
ui - > serverEnableCheckbox - > setEnabled ( ! conn ) ;
ui - > serverDisableUIChk - > setEnabled ( ! conn ) ;
2023-09-24 21:00:21 +01:00
ui - > serverRXAudioInputCombo - > setEnabled ( ! conn ) ;
ui - > serverTXAudioOutputCombo - > setEnabled ( ! conn ) ;
2023-07-17 11:09:14 +01:00
ui - > audioSystemServerCombo - > setEnabled ( ! conn ) ;
2025-01-06 12:51:56 +00:00
ui - > serverControlPortText - > setEnabled ( ! conn ) ;
ui - > serverAudioPortText - > setEnabled ( ! conn ) ;
ui - > serverCivPortText - > setEnabled ( ! conn ) ;
2025-06-04 00:33:48 +01:00
ui - > serverScopePortText - > setEnabled ( ! conn ) ;
2025-01-06 12:51:56 +00:00
ui - > serverUsersTable - > setEnabled ( ! conn ) ;
ui - > serverDisconnectLabel - > setVisible ( conn ) ;
ui - > radioDisconnectLabel - > setVisible ( conn ) ;
2024-02-06 22:45:16 -08:00
if ( conn ) {
ui - > connectBtn - > setText ( " Disconnect from radio " ) ;
} else {
ui - > connectBtn - > setText ( " Connect to radio " ) ;
}
2023-07-17 11:09:14 +01:00
}
2024-02-05 13:42:00 -08:00
2024-02-06 22:45:16 -08:00
void settingswidget : : on_connectBtn_clicked ( )
{
emit connectButtonPressed ( ) ;
}
2024-04-13 20:04:35 -07:00
void settingswidget : : on_saveSettingsBtn_clicked ( )
{
emit saveSettingsButtonPressed ( ) ;
}
void settingswidget : : on_revertSettingsBtn_clicked ( )
{
emit revertSettingsButtonPressed ( ) ;
}