Do not transmit if callsign isnt selected in selcal mode
This commit is contained in:
parent
f1db556598
commit
10f4049e68
@ -1141,6 +1141,10 @@ MainWindow::MainWindow(QDir const& temp_directory, bool multiple,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!ensureCallsignSet(true) || !ensureSelcalCallsignSelected(true)){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
toggleTx(true);
|
toggleTx(true);
|
||||||
});
|
});
|
||||||
ui->extFreeTextMsgEdit->installEventFilter(enterFilter);
|
ui->extFreeTextMsgEdit->installEventFilter(enterFilter);
|
||||||
@ -6057,12 +6061,30 @@ bool MainWindow::ensureCallsignSet(bool alert){
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool MainWindow::ensureSelcalCallsignSelected(bool alert){
|
||||||
|
auto selectedCallsign = callsignSelected(true);
|
||||||
|
bool isAllCall = isAllCallIncluded(selectedCallsign);
|
||||||
|
bool missingCall = selectedCallsign.isEmpty();
|
||||||
|
bool blockTransmit = ui->selcalButton->isChecked() && (isAllCall || missingCall);
|
||||||
|
|
||||||
|
if(blockTransmit && alert){
|
||||||
|
MessageBox::warning_message(this, tr ("Please select or enter a callsign to direct this message while SELCAL is enabled."));
|
||||||
|
}
|
||||||
|
|
||||||
|
return !blockTransmit;
|
||||||
|
}
|
||||||
|
|
||||||
void MainWindow::createMessage(QString const& text){
|
void MainWindow::createMessage(QString const& text){
|
||||||
if(!ensureCallsignSet()){
|
if(!ensureCallsignSet()){
|
||||||
on_stopTxButton_clicked();
|
on_stopTxButton_clicked();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!ensureSelcalCallsignSelected()){
|
||||||
|
on_stopTxButton_clicked();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
resetMessageTransmitQueue();
|
resetMessageTransmitQueue();
|
||||||
createMessageTransmitQueue(text);
|
createMessageTransmitQueue(text);
|
||||||
}
|
}
|
||||||
@ -8738,7 +8760,7 @@ void MainWindow::updateButtonDisplay(){
|
|||||||
update_dynamic_property (ui->startTxButton, "transmitting", m_transmitting);
|
update_dynamic_property (ui->startTxButton, "transmitting", m_transmitting);
|
||||||
|
|
||||||
bool isTransmitting = m_transmitting || m_txFrameCount > 0;
|
bool isTransmitting = m_transmitting || m_txFrameCount > 0;
|
||||||
auto selectedCallsign = callsignSelected();
|
auto selectedCallsign = callsignSelected(true);
|
||||||
bool emptyCallsign = selectedCallsign.isEmpty();
|
bool emptyCallsign = selectedCallsign.isEmpty();
|
||||||
|
|
||||||
ui->cqMacroButton->setDisabled(isTransmitting);
|
ui->cqMacroButton->setDisabled(isTransmitting);
|
||||||
@ -8749,6 +8771,7 @@ void MainWindow::updateButtonDisplay(){
|
|||||||
ui->queryButton->setDisabled(isTransmitting || emptyCallsign);
|
ui->queryButton->setDisabled(isTransmitting || emptyCallsign);
|
||||||
ui->deselectButton->setDisabled(isTransmitting || emptyCallsign);
|
ui->deselectButton->setDisabled(isTransmitting || emptyCallsign);
|
||||||
ui->queryButton->setText(emptyCallsign ? "Directed" : QString("Directed to %1").arg(selectedCallsign));
|
ui->queryButton->setText(emptyCallsign ? "Directed" : QString("Directed to %1").arg(selectedCallsign));
|
||||||
|
ui->startTxButton->setDisabled(ui->selcalButton->isChecked() && emptyCallsign);
|
||||||
|
|
||||||
if(isTransmitting){
|
if(isTransmitting){
|
||||||
int count = m_txFrameCount;
|
int count = m_txFrameCount;
|
||||||
@ -8813,7 +8836,7 @@ void MainWindow::buildMessageFramesAndUpdateCountDisplay(){
|
|||||||
void MainWindow::updateFrameCountDisplay(QString text, int count){
|
void MainWindow::updateFrameCountDisplay(QString text, int count){
|
||||||
if(count > 0){
|
if(count > 0){
|
||||||
ui->startTxButton->setText(QString("Send (%1)").arg(count));
|
ui->startTxButton->setText(QString("Send (%1)").arg(count));
|
||||||
ui->startTxButton->setEnabled(true);
|
ui->startTxButton->setEnabled(ensureSelcalCallsignSelected(false));
|
||||||
|
|
||||||
auto words = text.split(" ", QString::SkipEmptyParts).length();
|
auto words = text.split(" ", QString::SkipEmptyParts).length();
|
||||||
auto wpm = QString::number(words/(count/4.0), 'f', 1);
|
auto wpm = QString::number(words/(count/4.0), 'f', 1);
|
||||||
@ -8828,7 +8851,7 @@ void MainWindow::updateFrameCountDisplay(QString text, int count){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QString MainWindow::callsignSelected(){
|
QString MainWindow::callsignSelected(bool useInputText){
|
||||||
if(!ui->tableWidgetCalls->selectedItems().isEmpty()){
|
if(!ui->tableWidgetCalls->selectedItems().isEmpty()){
|
||||||
auto selectedCalls = ui->tableWidgetCalls->selectedItems();
|
auto selectedCalls = ui->tableWidgetCalls->selectedItems();
|
||||||
if(!selectedCalls.isEmpty()){
|
if(!selectedCalls.isEmpty()){
|
||||||
@ -8861,13 +8884,13 @@ QString MainWindow::callsignSelected(){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if SELECT_CALLSIGN_FOR_INPUT_TEXT
|
if(useInputText){
|
||||||
auto text = ui->extFreeTextMsgEdit->toPlainText().left(11); // Maximum callsign is 6 + / + 4 = 11 characters
|
auto text = ui->extFreeTextMsgEdit->toPlainText().left(11); // Maximum callsign is 6 + / + 4 = 11 characters
|
||||||
auto calls = Varicode::parseCallsigns(text);
|
auto calls = Varicode::parseCallsigns(text);
|
||||||
if(!calls.isEmpty() && text.startsWith(calls.first()) && calls.first() != m_config.my_callsign()){
|
if(!calls.isEmpty() && text.startsWith(calls.first()) && calls.first() != m_config.my_callsign()){
|
||||||
return calls.first();
|
return calls.first();
|
||||||
}
|
}
|
||||||
#endif
|
}
|
||||||
|
|
||||||
return QString();
|
return QString();
|
||||||
}
|
}
|
||||||
|
@ -151,6 +151,7 @@ public slots:
|
|||||||
void restoreMessage();
|
void restoreMessage();
|
||||||
void initializeDummyData();
|
void initializeDummyData();
|
||||||
bool ensureCallsignSet(bool alert=true);
|
bool ensureCallsignSet(bool alert=true);
|
||||||
|
bool ensureSelcalCallsignSelected(bool alert=true);
|
||||||
void createMessage(QString const& text);
|
void createMessage(QString const& text);
|
||||||
void createMessageTransmitQueue(QString const& text);
|
void createMessageTransmitQueue(QString const& text);
|
||||||
void resetMessageTransmitQueue();
|
void resetMessageTransmitQueue();
|
||||||
@ -885,7 +886,7 @@ private:
|
|||||||
void updateFrameCountDisplay(QString text, int count);
|
void updateFrameCountDisplay(QString text, int count);
|
||||||
bool isMyCallIncluded(QString const &text);
|
bool isMyCallIncluded(QString const &text);
|
||||||
bool isAllCallIncluded(QString const &text);
|
bool isAllCallIncluded(QString const &text);
|
||||||
QString callsignSelected();
|
QString callsignSelected(bool useInputText=false);
|
||||||
bool isRecentOffset(int offset);
|
bool isRecentOffset(int offset);
|
||||||
void markOffsetRecent(int offset);
|
void markOffsetRecent(int offset);
|
||||||
bool isDirectedOffset(int offset, bool *pIsAllCall);
|
bool isDirectedOffset(int offset, bool *pIsAllCall);
|
||||||
|
Loading…
Reference in New Issue
Block a user