Extracted function to write messages to log file
This commit is contained in:
parent
383f5d0943
commit
beec31c9b8
@ -9365,6 +9365,8 @@ void MainWindow::processCommandActivity() {
|
|||||||
QSound::play(wav);
|
QSound::play(wav);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
writeDirectedCommandToFile(d);
|
||||||
}
|
}
|
||||||
|
|
||||||
// and mark the offset as a directed offset so future free text is displayed
|
// and mark the offset as a directed offset so future free text is displayed
|
||||||
@ -9500,21 +9502,6 @@ void MainWindow::processCommandActivity() {
|
|||||||
|
|
||||||
// PROCESS BUFFERED MESSAGE
|
// PROCESS BUFFERED MESSAGE
|
||||||
else if (d.cmd == "#" && !isAllCall) {
|
else if (d.cmd == "#" && !isAllCall) {
|
||||||
// open file /save/messages/[callsign].txt and append a message log entry...
|
|
||||||
QFile f(QDir::toNativeSeparators(m_config.writeable_data_dir ().absolutePath()) + QString("/save/messages/%1.txt").arg(Radio::base_callsign(d.from)));
|
|
||||||
if (f.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Append)) {
|
|
||||||
QTextStream out(&f);
|
|
||||||
auto df = dialFrequency();
|
|
||||||
auto text = QString("%1\t%2MHz\t%3Hz\t%4dB\t%5");
|
|
||||||
text = text.arg(d.utcTimestamp.toString("yyyy-MM-dd hh:mm:ss"));
|
|
||||||
text = text.arg(Radio::frequency_MHz_string(df));
|
|
||||||
text = text.arg(d.freq);
|
|
||||||
text = text.arg(Varicode::formatSNR(d.snr));
|
|
||||||
text = text.arg(d.text);
|
|
||||||
out << text << endl;
|
|
||||||
f.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
reply = QString("%1 ACK").arg(d.from);
|
reply = QString("%1 ACK").arg(d.from);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -9642,6 +9629,23 @@ void MainWindow::processCommandActivity() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::writeDirectedCommandToFile(CommandDetail d){
|
||||||
|
// open file /save/messages/[callsign].txt and append a message log entry...
|
||||||
|
QFile f(QDir::toNativeSeparators(m_config.writeable_data_dir ().absolutePath()) + QString("/save/messages/%1.txt").arg(Radio::base_callsign(d.from)));
|
||||||
|
if (f.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Append)) {
|
||||||
|
QTextStream out(&f);
|
||||||
|
auto df = dialFrequency();
|
||||||
|
auto text = QString("%1\t%2MHz\t%3Hz\t%4dB\t%5");
|
||||||
|
text = text.arg(d.utcTimestamp.toString("yyyy-MM-dd hh:mm:ss"));
|
||||||
|
text = text.arg(Radio::frequency_MHz_string(df));
|
||||||
|
text = text.arg(d.freq);
|
||||||
|
text = text.arg(Varicode::formatSNR(d.snr));
|
||||||
|
text = text.arg(d.text.isEmpty() ? QString("%1 %2").arg(d.cmd).arg(d.extra).trimmed() : d.text);
|
||||||
|
out << text << endl;
|
||||||
|
f.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void MainWindow::processAlertReplyForCommand(CommandDetail d, QString from, QString cmd){
|
void MainWindow::processAlertReplyForCommand(CommandDetail d, QString from, QString cmd){
|
||||||
QMessageBox * msgBox = new QMessageBox(this);
|
QMessageBox * msgBox = new QMessageBox(this);
|
||||||
msgBox->setIcon(QMessageBox::Information);
|
msgBox->setIcon(QMessageBox::Information);
|
||||||
|
@ -898,6 +898,7 @@ private:
|
|||||||
void processCompoundActivity();
|
void processCompoundActivity();
|
||||||
void processBufferedActivity();
|
void processBufferedActivity();
|
||||||
void processCommandActivity();
|
void processCommandActivity();
|
||||||
|
void writeDirectedCommandToFile(CommandDetail d);
|
||||||
void processAlertReplyForCommand(CommandDetail d, QString from, QString cmd);
|
void processAlertReplyForCommand(CommandDetail d, QString from, QString cmd);
|
||||||
void processSpots();
|
void processSpots();
|
||||||
void processTxQueue();
|
void processTxQueue();
|
||||||
|
Loading…
Reference in New Issue
Block a user