Enable building just data message frames

This commit is contained in:
Jordan Sherer 2019-09-27 20:34:41 -04:00
parent 094d820882
commit 3058dcb152
4 changed files with 27 additions and 4 deletions

View File

@ -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<QKeyEvent *>(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;
}

View File

@ -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<QPair<QString, int>> 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
);

View File

@ -1828,6 +1828,7 @@ QList<QPair<QString, int>> 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<QPair<QString, int>> 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<QPair<QString, int>> 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
);

View File

@ -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;
};