mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-03-23 04:44:53 -04:00
DSD demod: status text log dialog save to file
This commit is contained in:
parent
8d64ca2068
commit
21aaeaedda
@ -20,6 +20,9 @@
|
||||
|
||||
#include <QDateTime>
|
||||
#include <QScrollBar>
|
||||
#include <QFileDialog>
|
||||
#include <QMessageBox>
|
||||
#include <QTextStream>
|
||||
|
||||
DSDStatusTextDialog::DSDStatusTextDialog(QWidget* parent) :
|
||||
QDialog(parent),
|
||||
@ -53,3 +56,32 @@ void DSDStatusTextDialog::on_clear_clicked()
|
||||
{
|
||||
ui->logEdit->clear();
|
||||
}
|
||||
|
||||
void DSDStatusTextDialog::on_saveLog_clicked()
|
||||
{
|
||||
QString fileName = QFileDialog::getSaveFileName(this,
|
||||
tr("Open log file"), ".", tr("Log files (*.log)"));
|
||||
|
||||
if (fileName != "")
|
||||
{
|
||||
QFileInfo fileInfo(fileName);
|
||||
|
||||
if (fileInfo.suffix() != "log") {
|
||||
fileName += ".log";
|
||||
}
|
||||
|
||||
QFile exportFile(fileName);
|
||||
|
||||
if (exportFile.open(QIODevice::WriteOnly | QIODevice::Text))
|
||||
{
|
||||
QTextStream outstream(&exportFile);
|
||||
outstream << ui->logEdit->toPlainText();
|
||||
exportFile.close();
|
||||
}
|
||||
else
|
||||
{
|
||||
QMessageBox::information(this, tr("Message"), tr("Cannot open file for writing"));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -39,6 +39,7 @@ private:
|
||||
|
||||
private slots:
|
||||
void on_clear_clicked();
|
||||
void on_saveLog_clicked();
|
||||
};
|
||||
|
||||
|
||||
|
@ -64,7 +64,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton">
|
||||
<widget class="QPushButton" name="saveLog">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
|
Loading…
Reference in New Issue
Block a user