Commit 713474b0 authored by lm's avatar lm

Fixed logging, added initialization for custom action widget

parent 8da2820d
......@@ -63,7 +63,7 @@ void LogCompressor::run()
if (!file.exists() || !file.open(QIODevice::ReadOnly | QIODevice::Text))
{
qDebug() << "LOG COMPRESSOR: INPUT FILE DOES NOT EXIST";
//qDebug() << "LOG COMPRESSOR: INPUT FILE DOES NOT EXIST";
emit logProcessingStatusChanged(tr("Log Compressor: Cannot start/compress log file, since input file %1 is not readable").arg(QFileInfo(fileName).absoluteFilePath()));
return;
}
......@@ -71,7 +71,7 @@ void LogCompressor::run()
// Check if file is writeable
if (outFileName == ""/* || !QFileInfo(outfile).isWritable()*/)
{
qDebug() << "LOG COMPRESSOR: OUTPUT FILE DOES NOT EXIST" << outFileName;
//qDebug() << "LOG COMPRESSOR: OUTPUT FILE DOES NOT EXIST" << outFileName;
emit logProcessingStatusChanged(tr("Log Compressor: Cannot start/compress log file, since output file %1 is not writable").arg(QFileInfo(outFileName).absoluteFilePath()));
return;
}
......@@ -233,14 +233,16 @@ void LogCompressor::run()
// Add header, write out file
file.close();
if (outFileName == "")
if (outFileName == logFileName)
{
QFile::remove(file.fileName());
outfile.setFileName(file.fileName());
}
if (!outfile.open(QIODevice::WriteOnly | QIODevice::Text))
return;
outfile.write(QString(QString("unix_timestamp") + separator + header.replace(" ", "_") + QString("\n")).toLatin1());
emit logProcessingStatusChanged(tr("Log Compressor: Writing output to file %1").arg(QFileInfo(outFileName).absoluteFilePath()));
//QString fileHeader = QString("unix_timestamp") + header.replace(" ", "_") + QString("\n");
// File output
......
......@@ -50,6 +50,8 @@ QGCActionButton::QGCActionButton(QWidget *parent) :
connect(UASManager::instance(), SIGNAL(activeUASSet(UASInterface*)),
this, SLOT(setActiveUAS(UASInterface*)));
// Set first UAS if it exists
this->setActiveUAS(UASManager::instance()->getActiveUAS());
connect(ui->actionButton, SIGNAL(clicked()), this, SLOT(sendAction()));
connect(ui->editFinishButton, SIGNAL(clicked()), this, SLOT(endEditMode()));
......@@ -90,6 +92,8 @@ void QGCActionButton::startEditMode()
ui->editActionComboBox->show();
ui->editActionsRefreshButton->show();
ui->editFinishButton->show();
ui->editNameLabel->show();
ui->editButtonName->show();
isInEditMode = true;
}
......@@ -98,6 +102,12 @@ void QGCActionButton::endEditMode()
ui->editActionComboBox->hide();
ui->editActionsRefreshButton->hide();
ui->editFinishButton->hide();
ui->editNameLabel->hide();
ui->editButtonName->hide();
// Write to settings
isInEditMode = false;
}
......
......@@ -398,7 +398,7 @@ void LinechartWidget::stopLogging()
logFile->flush();
logFile->close();
// Postprocess log file
compressor = new LogCompressor(logFile->fileName());
compressor = new LogCompressor(logFile->fileName(), logFile->fileName());
connect(compressor, SIGNAL(finishedFile(QString)), this, SIGNAL(logfileWritten(QString)));
connect(compressor, SIGNAL(logProcessingStatusChanged(QString)), MainWindow::instance(), SLOT(showStatusMessage(QString)));
MainWindow::instance()->showInfoMessage("Logging ended", "QGroundControl is now compressing the logfile in a consistent CVS file. This may take a while, you can continue to use QGroundControl. Status updates appear at the bottom of the window.");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment