20 #include "ui_dsdstatustextdialog.h" 24 #include <QFileDialog> 25 #include <QMessageBox> 26 #include <QTextStream> 44 QDateTime dt = QDateTime::currentDateTime();
45 QString dateStr = dt.toString(
"HH:mm:ss");
46 QTextCursor cursor =
ui->logEdit->textCursor();
47 cursor.movePosition(QTextCursor::End, QTextCursor::MoveAnchor);
48 cursor.insertText(tr(
"%1 %2\n").
arg(dateStr).
arg(line));
49 if (
ui->pinToLastLine->isChecked()) {
50 ui->logEdit->verticalScrollBar()->setValue(
ui->logEdit->verticalScrollBar()->maximum());
63 QString fileName = QFileDialog::getSaveFileName(
this,
64 tr(
"Open log file"),
".", tr(
"Log files (*.log)"), 0, QFileDialog::DontUseNativeDialog);
68 QFileInfo fileInfo(fileName);
70 if (fileInfo.suffix() !=
"log") {
74 QFile exportFile(fileName);
76 if (exportFile.open(QIODevice::WriteOnly | QIODevice::Text))
78 QTextStream outstream(&exportFile);
79 outstream <<
ui->logEdit->toPlainText();
84 QMessageBox::information(
this, tr(
"Message"), tr(
"Cannot open file for writing"));
Ui::DSDStatusTextDialog * ui
Fixed< IntType, IntBits > arg(const std::complex< Fixed< IntType, IntBits > > &val)
void on_saveLog_clicked()
DSDStatusTextDialog(QWidget *parent=0)
void addLine(const QString &line)