Changed serial and LAN enable controls to "radio buttons" so that they

are exclusive selections.
merge-requests/2/head
Elliott Liggett 2021-03-02 21:55:33 -08:00
rodzic 260b48f07f
commit 60756480ce
3 zmienionych plików z 39 dodań i 20 usunięć

Wyświetl plik

@ -571,9 +571,10 @@ void wfmain::openRig()
if (prefs.enableLAN)
{
ui->lanEnableBtn->setChecked(true);
emit sendCommSetup(prefs.radioCIVAddr, udpPrefs);
} else {
ui->serialEnableBtn->setChecked(true);
if( (prefs.serialPortRadio == QString("auto")) && (serialPortCL.isEmpty()))
{
// Find the ICOM
@ -769,37 +770,37 @@ void wfmain::loadSettings()
settings.beginGroup("LAN");
prefs.enableLAN = settings.value("EnableLAN", defPrefs.enableLAN).toBool();
ui->lanEnableChk->setChecked(prefs.enableLAN);
ui->lanEnableBtn->setChecked(prefs.enableLAN);
udpPrefs.ipAddress = settings.value("IPAddress", udpDefPrefs.ipAddress).toString();
ui->ipAddressTxt->setEnabled(ui->lanEnableChk->isChecked());
ui->ipAddressTxt->setEnabled(ui->lanEnableBtn->isChecked());
ui->ipAddressTxt->setText(udpPrefs.ipAddress);
udpPrefs.controlLANPort = settings.value("ControlLANPort", udpDefPrefs.controlLANPort).toInt();
ui->controlPortTxt->setEnabled(ui->lanEnableChk->isChecked());
ui->controlPortTxt->setEnabled(ui->lanEnableBtn->isChecked());
ui->controlPortTxt->setText(QString("%1").arg(udpPrefs.controlLANPort));
udpPrefs.username = settings.value("Username", udpDefPrefs.username).toString();
ui->usernameTxt->setEnabled(ui->lanEnableChk->isChecked());
ui->usernameTxt->setEnabled(ui->lanEnableBtn->isChecked());
ui->usernameTxt->setText(QString("%1").arg(udpPrefs.username));
udpPrefs.password = settings.value("Password", udpDefPrefs.password).toString();
ui->passwordTxt->setEnabled(ui->lanEnableChk->isChecked());
ui->passwordTxt->setEnabled(ui->lanEnableBtn->isChecked());
ui->passwordTxt->setText(QString("%1").arg(udpPrefs.password));
udpPrefs.audioRXLatency = settings.value("AudioRXLatency", udpDefPrefs.audioRXLatency).toInt();
ui->rxLatencySlider->setEnabled(ui->lanEnableChk->isChecked());
ui->rxLatencySlider->setEnabled(ui->lanEnableBtn->isChecked());
ui->rxLatencySlider->setValue(udpPrefs.audioRXLatency);
ui->rxLatencySlider->setTracking(false); // Stop it sending value on every change.
udpPrefs.audioTXLatency = settings.value("AudioTXLatency", udpDefPrefs.audioTXLatency).toInt();
ui->txLatencySlider->setEnabled(ui->lanEnableChk->isChecked());
ui->txLatencySlider->setEnabled(ui->lanEnableBtn->isChecked());
ui->txLatencySlider->setValue(udpPrefs.audioTXLatency);
ui->txLatencySlider->setTracking(false); // Stop it sending value on every change.
udpPrefs.audioRXSampleRate = settings.value("AudioRXSampleRate", udpDefPrefs.audioRXSampleRate).toInt();
udpPrefs.audioTXSampleRate = settings.value("AudioTXSampleRate",udpDefPrefs.audioTXSampleRate).toInt();
ui->audioSampleRateCombo->setEnabled(ui->lanEnableChk->isChecked());
ui->audioSampleRateCombo->setEnabled(ui->lanEnableBtn->isChecked());
int audioSampleRateIndex = ui->audioSampleRateCombo->findText(QString::number(udpDefPrefs.audioRXSampleRate));
if (audioSampleRateIndex != -1) {
ui->audioOutputCombo->setCurrentIndex(audioSampleRateIndex);
@ -814,7 +815,7 @@ void wfmain::loadSettings()
ui->audioRXCodecCombo->addItem("PCM 2ch 8bit", 8);
udpPrefs.audioRXCodec = settings.value("AudioRXCodec", udpDefPrefs.audioRXCodec).toInt();
ui->audioRXCodecCombo->setEnabled(ui->lanEnableChk->isChecked());
ui->audioRXCodecCombo->setEnabled(ui->lanEnableBtn->isChecked());
for (int f = 0; f < ui->audioRXCodecCombo->count(); f++)
if (ui->audioRXCodecCombo->itemData(f).toInt() == udpPrefs.audioRXCodec)
ui->audioRXCodecCombo->setCurrentIndex(f);
@ -824,19 +825,19 @@ void wfmain::loadSettings()
ui->audioTXCodecCombo->addItem("uLaw 1ch 8bit", 1);
udpPrefs.audioTXCodec = settings.value("AudioTXCodec", udpDefPrefs.audioTXCodec).toInt();
ui->audioTXCodecCombo->setEnabled(ui->lanEnableChk->isChecked());
ui->audioTXCodecCombo->setEnabled(ui->lanEnableBtn->isChecked());
for (int f = 0; f < ui->audioTXCodecCombo->count(); f++)
if (ui->audioTXCodecCombo->itemData(f).toInt() == udpPrefs.audioTXCodec)
ui->audioTXCodecCombo->setCurrentIndex(f);
udpPrefs.audioOutput = settings.value("AudioOutput", udpDefPrefs.audioOutput).toString();
ui->audioOutputCombo->setEnabled(ui->lanEnableChk->isChecked());
ui->audioOutputCombo->setEnabled(ui->lanEnableBtn->isChecked());
int audioOutputIndex = ui->audioOutputCombo->findText(udpPrefs.audioOutput);
if (audioOutputIndex != -1)
ui->audioOutputCombo->setCurrentIndex(audioOutputIndex);
udpPrefs.audioInput = settings.value("AudioInput", udpDefPrefs.audioInput).toString();
ui->audioInputCombo->setEnabled(ui->lanEnableChk->isChecked());
ui->audioInputCombo->setEnabled(ui->lanEnableBtn->isChecked());
int audioInputIndex = ui->audioInputCombo->findText(udpPrefs.audioInput);
if (audioInputIndex != - 1)
ui->audioOutputCombo->setCurrentIndex(audioInputIndex);
@ -2853,7 +2854,18 @@ void wfmain::on_pttEnableChk_clicked(bool checked)
prefs.enablePTT = checked;
}
void wfmain::on_lanEnableChk_clicked(bool checked)
void wfmain::on_serialEnableBtn_clicked(bool checked)
{
prefs.enableLAN = !checked;
ui->serialDeviceListCombo->setEnabled(checked);
ui->ipAddressTxt->setEnabled(!checked);
ui->controlPortTxt->setEnabled(!checked);
ui->usernameTxt->setEnabled(!checked);
ui->passwordTxt->setEnabled(!checked);
}
void wfmain::on_lanEnableBtn_clicked(bool checked)
{
prefs.enableLAN = checked;
ui->ipAddressTxt->setEnabled(checked);
@ -3436,5 +3448,3 @@ void wfmain::on_debugBtn_clicked()
emit getScopeMode();
}

Wyświetl plik

@ -305,7 +305,7 @@ private slots:
void on_pttEnableChk_clicked(bool checked);
void on_lanEnableChk_clicked(bool checked);
void on_lanEnableBtn_clicked(bool checked);
void on_ipAddressTxt_textChanged(QString text);
@ -373,6 +373,8 @@ private slots:
void on_spectrumModeCombo_currentIndexChanged(int index);
void on_serialEnableBtn_clicked(bool checked);
private:
Ui::wfmain *ui;
QSettings settings;

Wyświetl plik

@ -1626,10 +1626,13 @@
<number>0</number>
</property>
<item>
<widget class="QCheckBox" name="checkBox">
<widget class="QRadioButton" name="serialEnableBtn">
<property name="text">
<string>Enable USB (serial)</string>
</property>
<attribute name="buttonGroup">
<string notr="true">radioConnectionSerialNetworkGrp</string>
</attribute>
</widget>
</item>
<item>
@ -1660,10 +1663,13 @@
<item>
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<widget class="QCheckBox" name="lanEnableChk">
<widget class="QRadioButton" name="lanEnableBtn">
<property name="text">
<string>Enable LAN</string>
</property>
<attribute name="buttonGroup">
<string notr="true">radioConnectionSerialNetworkGrp</string>
</attribute>
</widget>
</item>
<item>
@ -1972,7 +1978,7 @@
<x>0</x>
<y>0</y>
<width>810</width>
<height>21</height>
<height>22</height>
</rect>
</property>
</widget>
@ -1995,5 +2001,6 @@
<connections/>
<buttongroups>
<buttongroup name="duplexBtnGrp"/>
<buttongroup name="radioConnectionSerialNetworkGrp"/>
</buttongroups>
</ui>