From 3058dcb15244130a9ba07b446359235fdab8be55 Mon Sep 17 00:00:00 2001 From: Jordan Sherer Date: Fri, 27 Sep 2019 20:34:41 -0400 Subject: [PATCH] Enable building just data message frames --- TransmitTextEdit.cpp | 4 ++-- mainwindow.cpp | 12 +++++++++++- varicode.cpp | 12 +++++++++++- varicode.h | 3 +++ 4 files changed, 27 insertions(+), 4 deletions(-) diff --git a/TransmitTextEdit.cpp b/TransmitTextEdit.cpp index 38ebd00..5a4c316 100644 --- a/TransmitTextEdit.cpp +++ b/TransmitTextEdit.cpp @@ -360,9 +360,9 @@ bool TransmitTextEdit::eventFilter(QObject */*o*/, QEvent *e){ return false; } - // -1. don't filter the escape key + // -1. don't filter the escape key, return key, or enter key here QKeyEvent *k = static_cast(e); - if(k->key() == Qt::Key_Escape){ + if(k->key() == Qt::Key_Escape || k->key() == Qt::Key_Return || k->key() == Qt::Key_Enter){ return false; } diff --git a/mainwindow.cpp b/mainwindow.cpp index 4099500..54615d0 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -6175,6 +6175,7 @@ QString MainWindow::createMessageTransmitQueue(QString const& text, bool reset){ m_txFrameQueue.append(frames); m_txFrameCount += frames.length(); +#if 0 int freq = currentFreqOffset(); qDebug() << "creating message for freq" << freq; @@ -6195,6 +6196,9 @@ QString MainWindow::createMessageTransmitQueue(QString const& text, bool reset){ m_lastTxMessage += text; return joined; +#else + return Varicode::rstrip(lines.join("")); +#endif } void MainWindow::restoreMessage(){ @@ -6329,12 +6333,16 @@ QList> MainWindow::buildMessageFrames(const QString &text){ bool forceIdentify = !m_config.avoid_forced_identify(); + // TODO: might want to be more explicit? + bool forceData = !m_totalTxMessage.isEmpty(); + auto frames = Varicode::buildMessageFrames( mycall, mygrid, selectedCall, text, forceIdentify, + forceData, m_nSubMode); #if 0 @@ -6355,7 +6363,7 @@ bool MainWindow::prepareNextMessageFrame() // typeahead static QString lastText; auto text = ui->extFreeTextMsgEdit->toPlainText(); - if(lastText == "" || lastText != text){ + if(!text.isEmpty() && (lastText == "" || lastText != text)){ #if 1 auto sent = ui->extFreeTextMsgEdit->sentText(); auto unsent = ui->extFreeTextMsgEdit->unsentText(); @@ -9579,6 +9587,7 @@ void MainWindow::refreshTextDisplay(){ QString mycall = m_config.my_callsign(); QString mygrid = m_config.my_grid().left(4); bool forceIdentify = !m_config.avoid_forced_identify(); + bool forceData = false; BuildMessageFramesThread *t = new BuildMessageFramesThread( mycall, @@ -9586,6 +9595,7 @@ void MainWindow::refreshTextDisplay(){ selectedCall, text, forceIdentify, + forceData, m_nSubMode ); diff --git a/varicode.cpp b/varicode.cpp index bcec224..e898385 100644 --- a/varicode.cpp +++ b/varicode.cpp @@ -1828,6 +1828,7 @@ QList> Varicode::buildMessageFrames(QString const& mycall, QString const& selectedCall, QString const& text, bool forceIdentify, + bool forceData, int submode){ #define ALLOW_SEND_COMPOUND 1 #define ALLOW_SEND_COMPOUND_DIRECTED 1 @@ -1849,6 +1850,12 @@ QList> Varicode::buildMessageFrames(QString const& mycall, // do the same for when we have sent data... bool hasData = false; + // or if we're forcing data to be sent... + if(forceData){ + forceIdentify = false; + hasData = true; + } + #if AUTO_REMOVE_MYCALL // remove our callsign from the start of the line... if(line.startsWith(mycall + ":") || line.startsWith(mycall + " ")){ @@ -1866,7 +1873,7 @@ QList> Varicode::buildMessageFrames(QString const& mycall, // see if we need to prepend the directed call to the line... // if we have a selected call and the text doesn't start with that call... // and if this isn't a raw message (starting with "`")... then... - if(!selectedCall.isEmpty() && !line.startsWith(selectedCall) && !line.startsWith("`")){ + if(!selectedCall.isEmpty() && !line.startsWith(selectedCall) && !line.startsWith("`") && !forceData){ bool lineStartsWithBaseCall = ( line.startsWith("@ALLCALL") || Varicode::startsWithCQ(line) || @@ -2074,6 +2081,7 @@ BuildMessageFramesThread::BuildMessageFramesThread(const QString &mycall, const QString &selectedCall, const QString &text, bool forceIdentify, + bool forceData, int submode, QObject *parent): QThread(parent), @@ -2082,6 +2090,7 @@ BuildMessageFramesThread::BuildMessageFramesThread(const QString &mycall, m_selectedCall{selectedCall}, m_text{text}, m_forceIdentify{forceIdentify}, + m_forceData{forceData}, m_submode{submode} { } @@ -2093,6 +2102,7 @@ void BuildMessageFramesThread::run(){ m_selectedCall, m_text, m_forceIdentify, + m_forceData, m_submode ); diff --git a/varicode.h b/varicode.h index 40dd5b0..2d61307 100644 --- a/varicode.h +++ b/varicode.h @@ -173,6 +173,7 @@ public: QString const& selectedCall, QString const& text, bool forceIdentify, + bool forceData, int submode); }; @@ -186,6 +187,7 @@ public: QString const& selectedCall, QString const& text, bool forceIdentify, + bool forceData, int submode, QObject *parent=nullptr); void run() override; @@ -198,6 +200,7 @@ private: QString m_selectedCall; QString m_text; bool m_forceIdentify; + bool m_forceData; int m_submode; };