Commit 53751dfe authored by dogmaphobic's avatar dogmaphobic

Adding some TODO items

Fixing braces
Changing data plot save files to csv only
Fixing LinechartWidget::startLogging() as it no longer needs to worry about a proper file name being set.
parent 18c2e01a
......@@ -157,6 +157,7 @@ void QGCDataPlot2D::savePlot()
} else if (fileName.endsWith(".svg")) {
exportSVG(fileName);
}
// TODO Tell the user the name (type) was invalid (neither pdf nor svg) and nothing is being done.
}
......@@ -272,7 +273,7 @@ void QGCDataPlot2D::selectFile()
}
else
{
fileName = QGCFileDialog::getOpenFileName(this, tr("Load Log File"), QString(), "Log files (*.csv *.txt *.log)");
fileName = QGCFileDialog::getOpenFileName(this, tr("Load Log File"), QString(), "Log files (*.csv);;All Files (*)");
}
// Check if the user hit cancel, which results in an empty string.
......@@ -698,11 +699,13 @@ void QGCDataPlot2D::saveCsvLog()
{
QString fileName = QGCFileDialog::getSaveFileName(
this, "Save CSV Log File", QStandardPaths::writableLocation(QStandardPaths::DesktopLocation),
"CSV file (*.csv);;Text file (*.txt)",
"csv");
"CSV file (*.csv)",
"csv",
true);
if (fileName.isEmpty())
if (fileName.isEmpty()) {
return; //User cancelled
}
bool success = logFile->copy(fileName);
......
......@@ -431,49 +431,29 @@ void LinechartWidget::refresh()
setUpdatesEnabled(true);
}
QString LinechartWidget::getLogSaveFilename()
{
QString fileName = QGCFileDialog::getSaveFileName(this,
tr("Save Log File"),
QStandardPaths::writableLocation(QStandardPaths::DesktopLocation),
tr("Log file (*.log)"),
"log",
true);
return fileName;
}
void LinechartWidget::startLogging()
{
// Store reference to file
bool abort = false;
// Check if any curve is enabled
if (!activePlot->anyCurveVisible()) {
QGCMessageBox::critical(tr("No curves selected for logging."), tr("Please check all curves you want to log. Currently no data would be logged, aborting the logging."));
QGCMessageBox::critical(
tr("No curves selected for logging."),
tr("Please check all curves you want to log. Currently no data would be logged. Aborting the logging."));
return;
}
// Let user select the log file name
// QDate date(QDate::currentDate());
// QString("./pixhawk-log-" + date.toString("yyyy-MM-dd") + "-" + QString::number(logindex) + ".log")
QString fileName = getLogSaveFilename();
while (!(fileName.endsWith(".log")) && !abort && fileName != "") {
QMessageBox::StandardButton button = QGCMessageBox::critical(tr("Unsuitable file extension for logfile"),
tr("Please choose .log as file extension. Click OK to change the file extension, cancel to not start logging."),
QMessageBox::Ok | QMessageBox::Cancel,
QMessageBox::Ok);
if (button != QMessageBox::Ok) {
abort = true;
break;
}
fileName = getLogSaveFilename();
}
QString fileName = QGCFileDialog::getSaveFileName(this,
tr("Save Log File"),
QStandardPaths::writableLocation(QStandardPaths::DesktopLocation),
tr("Log file (*.log)"),
"log", // Default type
true); // Enforce default type
qDebug() << "SAVE FILE " << fileName;
// Check if the user did not abort the file save dialog
if (!abort && fileName != "") {
if (!fileName.isEmpty()) {
logFile = new QFile(fileName);
if (logFile->open(QIODevice::Truncate | QIODevice::WriteOnly | QIODevice::Text)) {
logging = true;
......@@ -498,10 +478,11 @@ void LinechartWidget::stopLogging()
compressor = new LogCompressor(logFile->fileName(), logFile->fileName());
connect(compressor, SIGNAL(finishedFile(QString)), this, SIGNAL(logfileWritten(QString)));
QMessageBox::StandardButton button = QGCMessageBox::question(tr("Starting Log Compression"),
tr("Should empty fields (e.g. due to packet drops) be filled with the previous value of the same variable (zero order hold)?"),
QMessageBox::Yes | QMessageBox::No,
QMessageBox::No);
QMessageBox::StandardButton button = QGCMessageBox::question(
tr("Starting Log Compression"),
tr("Should empty fields (e.g. due to packet drops) be filled with the previous value of the same variable (zero order hold)?"),
QMessageBox::Yes | QMessageBox::No,
QMessageBox::No);
bool fill;
if (button == QMessageBox::Yes)
{
......
......@@ -123,7 +123,6 @@ protected:
QToolButton* createButton(QWidget* parent);
void createCurveItem(QString curve);
void createLayout();
QString getLogSaveFilename();
/** @brief Get the name for a curve key */
QString getCurveName(const QString& key, bool shortEnabled);
......
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