Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions ui/SettingsDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,12 @@ SettingsDialog::SettingsDialog(MainWindow *parent) :
ui->cwKeyModeSelect->addItem(tr("Ultimate"), CWKey::ULTIMATE);
ui->cwKeyModeSelect->setCurrentIndex(ui->cwKeyModeSelect->findData(CWKey::IAMBIC_B));

connect(ui->wsjtPortSpin, QOverload<int>::of(&QSpinBox::valueChanged),
this, &SettingsDialog::validateWsjtForwardPorts);

connect(ui->wsjtForwardEdit, &QLineEdit::textChanged,
this, &SettingsDialog::validateWsjtForwardPorts);

/* disable WSJTX Multicast by default */
joinMulticastChanged(false);

Expand All @@ -301,6 +307,46 @@ SettingsDialog::SettingsDialog(MainWindow *parent) :
readSettings();
}

void SettingsDialog::validateWsjtForwardPorts()
{
FCT_IDENTIFICATION;

int portToCheck = ui->wsjtPortSpin->value();
QString forwardList = ui->wsjtForwardEdit->text().trimmed();

QStringList entries = forwardList.split(' ', Qt::SkipEmptyParts);

bool portFound = false;

for (QStringList::const_iterator it = entries.constBegin(); it != entries.constEnd(); ++it) {
QString entry = *it;
QStringList parts = entry.split(':');
if (parts.size() == 2) {
bool ok = false;
int port = parts[1].toInt(&ok);
if (ok && port == portToCheck) {
portFound = true;
break;
}
}
}

if (portFound) {
ui->wsjtPortLabel->setToolTip(tr("WSJT Port is duplicated which could cause a loop."));
ui->wsjtForwardEdit->setToolTip(tr("WSJT Port is duplicated which could cause a loop."));
QMessageBox::warning(nullptr, QMessageBox::tr("QLog Warning"),
QMessageBox::tr("WSJT Port is duplicated which could cause a loop."));
ui->wsjtPortLabel->setStyleSheet("color: black; border-radius: 5px; background: yellow;");
ui->wsjtForwardLabel->setStyleSheet("color: black; border-radius: 5px; background: yellow;");

} else {
ui->wsjtPortLabel->setToolTip("");
ui->wsjtForwardEdit->setToolTip("");
ui->wsjtPortLabel->setStyleSheet("");
ui->wsjtForwardLabel->setStyleSheet("");
}
}

void SettingsDialog::save() {
FCT_IDENTIFICATION;

Expand Down
1 change: 1 addition & 0 deletions ui/SettingsDialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ public slots:
void generateMembershipCheckboxes();
void generateQRZAPICallsignTable();
void saveQRZAPICallsignTable();
void validateWsjtForwardPorts();

QSqlTableModel* modeTableModel;
QSqlTableModel* bandTableModel;
Expand Down
Loading