From 5f4a66e916f1906d9d77fbc3c31e5bb42ab1846c Mon Sep 17 00:00:00 2001 From: Jordan Sherer Date: Tue, 14 Aug 2018 12:09:14 -0400 Subject: [PATCH] Added warning message about empty callsign before transmitting --- mainwindow.cpp | 15 ++++++++++++++- mainwindow.h | 1 + 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/mainwindow.cpp b/mainwindow.cpp index 462ed83..6218b2c 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -5776,7 +5776,20 @@ void MainWindow::resetMessageUI(){ } } +bool MainWindow::ensureCallsignSet(){ + if(m_config.my_callsign().trimmed().isEmpty()){ + MessageBox::warning_message(this, tr ("Please enter your callsign in the settings.")); + return false; + } + + return true; +} + void MainWindow::createMessage(QString const& text){ + if(!ensureCallsignSet()){ + on_stopTxButton_clicked(); + return; + } resetMessageTransmitQueue(); createMessageTransmitQueue(text); } @@ -6309,7 +6322,7 @@ QString MainWindow::calculateDistance(QString const& value) // this function is called by auto_tx_mode, which is called by autoButton.clicked void MainWindow::on_startTxButton_toggled(bool checked) { - if(checked){ + if(checked){ createMessage(ui->extFreeTextMsgEdit->toPlainText()); startTx(); } else { diff --git a/mainwindow.h b/mainwindow.h index fb2fa67..3c074a0 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -140,6 +140,7 @@ public slots: void resetMessage(); void resetMessageUI(); void restoreMessage(); + bool ensureCallsignSet(); void createMessage(QString const& text); void createMessageTransmitQueue(QString const& text); void resetMessageTransmitQueue();