Add and implement menu item "File | Copy main text window to WSJT-X.txt".

This commit is contained in:
Joe Taylor
2022-08-31 14:27:03 -04:00
parent aea5184a6d
commit 036c612d41
3 changed files with 33 additions and 1 deletions
+25
View File
@@ -10000,3 +10000,28 @@ void MainWindow::on_jt65Button_clicked()
}
on_actionJT65_triggered();
}
void MainWindow::on_actionCopy_to_WSJTX_txt_triggered()
{
qDebug() << ui->decodedTextBrowser->toPlainText();
static QFile f {QDir {QStandardPaths::writableLocation (QStandardPaths::DataLocation)}.absoluteFilePath ("WSJT-X.txt")};
if(!f.open(QIODevice::Text | QIODevice::WriteOnly)) {
MessageBox::warning_message (this, tr ("WSJT-X.txt file error"),
tr ("Cannot open \"%1\" for writing").arg (f.fileName ()),
tr ("Error: %1").arg (f.errorString ()));
} else {
QString t=ui->decodedTextBrowser->toPlainText();
QTextStream out(&f);
out << t <<
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
endl
#else
Qt::endl
#endif
;
f.close();
}
}