diff --git a/src/ui/QGCDataPlot2D.cc b/src/ui/QGCDataPlot2D.cc index 3dfa9012ae18de10e7c4149322112fd7e0b532d0..ac4a024971b69a62a9d900b3e95e3d21f0b87ca0 100644 --- a/src/ui/QGCDataPlot2D.cc +++ b/src/ui/QGCDataPlot2D.cc @@ -100,13 +100,17 @@ void QGCDataPlot2D::loadFile() void QGCDataPlot2D::loadFile(QString file) { + // TODO This "filename" is a private/protected member variable. It should be named in such way + // it indicates so. This same name is used in several places within this file in local scopes. fileName = file; - if (QFileInfo(fileName).isReadable()) { - if (fileName.contains(".raw") || fileName.contains(".imu")) { + QFileInfo fi(fileName); + if (fi.isReadable()) { + if (fi.suffix() == QString("raw") || fi.suffix() == QString("imu")) { loadRawLog(fileName); - } else if (fileName.contains(".txt") || fileName.contains(".csv") || fileName.contains(".csv")) { + } else if (fi.suffix() == QString("txt") || fi.suffix() == QString("csv")) { loadCsvLog(fileName); } + // TODO Else, tell the user it doesn't know what to do with the file... } } @@ -116,7 +120,7 @@ void QGCDataPlot2D::loadFile(QString file) QString QGCDataPlot2D::getSavePlotFilename() { QString fileName = QGCFileDialog::getSaveFileName( - this, "Export Plot File", QStandardPaths::writableLocation(QStandardPaths::DesktopLocation), + this, "Save Plot File", QStandardPaths::writableLocation(QStandardPaths::DesktopLocation), "PDF Documents (*.pdf);;SVG Images (*.svg)", "pdf"); return fileName; @@ -691,7 +695,7 @@ bool QGCDataPlot2D::linearRegression(double *x, double *y, int n, double *a, dou void QGCDataPlot2D::saveCsvLog() { QString fileName = QGCFileDialog::getSaveFileName( - this, "Export CSV File Name", QStandardPaths::writableLocation(QStandardPaths::DesktopLocation), + this, "Save CSV Log File", QStandardPaths::writableLocation(QStandardPaths::DesktopLocation), "CSV file (*.csv);;Text file (*.txt)", "csv"); diff --git a/src/ui/designer/QGCToolWidget.cc b/src/ui/designer/QGCToolWidget.cc index be7bd470609dbaf2e31396cde448be118e9a4049..55c71c104543526ff36bad63a29262e8499dccbf 100644 --- a/src/ui/designer/QGCToolWidget.cc +++ b/src/ui/designer/QGCToolWidget.cc @@ -573,7 +573,7 @@ void QGCToolWidget::exportWidget() { const QString widgetFileExtension(".qgw"); QString fileName = QGCFileDialog::getSaveFileName( - this, tr("Specify Widget File Name"), + this, tr("Save Widget File"), QStandardPaths::writableLocation(QStandardPaths::DesktopLocation), tr("QGroundControl Widget (*%1)").arg(widgetFileExtension), "qgw"); @@ -589,7 +589,7 @@ void QGCToolWidget::exportWidget() void QGCToolWidget::importWidget() { const QString widgetFileExtension(".qgw"); - QString fileName = QGCFileDialog::getOpenFileName(this, tr("Specify File Name"), QStandardPaths::writableLocation(QStandardPaths::DesktopLocation), tr("QGroundControl Widget (*%1)").arg(widgetFileExtension)); + QString fileName = QGCFileDialog::getOpenFileName(this, tr("Load Widget File"), QStandardPaths::writableLocation(QStandardPaths::DesktopLocation), tr("QGroundControl Widget (*%1)").arg(widgetFileExtension)); loadSettings(fileName); } diff --git a/src/ui/linechart/LinechartWidget.cc b/src/ui/linechart/LinechartWidget.cc index 252277a39b36484d32f86bdd8f55b79492aaf90a..69705ed3ccd7c46fe48714af86efcc09b05fc536 100644 --- a/src/ui/linechart/LinechartWidget.cc +++ b/src/ui/linechart/LinechartWidget.cc @@ -434,7 +434,7 @@ void LinechartWidget::refresh() QString LinechartWidget::getLogSaveFilename() { QString fileName = QGCFileDialog::getSaveFileName(this, - tr("Specify Log File Name"), + tr("Save Log File"), QStandardPaths::writableLocation(QStandardPaths::DesktopLocation), tr("Log file (*.log)"), "log");