From 713474b0f9bb5ffce20fb2950dc43dfa5e83512b Mon Sep 17 00:00:00 2001 From: lm Date: Wed, 5 Jan 2011 17:15:58 +0100 Subject: [PATCH] Fixed logging, added initialization for custom action widget --- src/LogCompressor.cc | 8 +++++--- src/ui/designer/QGCActionButton.cc | 10 ++++++++++ src/ui/linechart/LinechartWidget.cc | 2 +- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/LogCompressor.cc b/src/LogCompressor.cc index 108535429..0d4ebdb9f 100644 --- a/src/LogCompressor.cc +++ b/src/LogCompressor.cc @@ -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 diff --git a/src/ui/designer/QGCActionButton.cc b/src/ui/designer/QGCActionButton.cc index 3bb9671de..1b38f3a94 100644 --- a/src/ui/designer/QGCActionButton.cc +++ b/src/ui/designer/QGCActionButton.cc @@ -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; } diff --git a/src/ui/linechart/LinechartWidget.cc b/src/ui/linechart/LinechartWidget.cc index 395fe36ac..14c42cec5 100644 --- a/src/ui/linechart/LinechartWidget.cc +++ b/src/ui/linechart/LinechartWidget.cc @@ -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."); -- 2.22.0