[Companion] Remember last used log folder in Telemetry Simulator (fixes #5583).
This commit is contained in:
@@ -18,12 +18,14 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
#include "telemetrysimu.h"
|
#include "telemetrysimu.h"
|
||||||
#include "ui_telemetrysimu.h"
|
#include "ui_telemetrysimu.h"
|
||||||
|
#include "appdata.h"
|
||||||
#include "simulatorinterface.h"
|
#include "simulatorinterface.h"
|
||||||
#include "radio/src/telemetry/frsky.h"
|
#include "radio/src/telemetry/frsky.h"
|
||||||
|
|
||||||
#include <QRegularExpression>
|
#include <QRegularExpression>
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
TelemetrySimulator::TelemetrySimulator(QWidget * parent, SimulatorInterface * simulator):
|
TelemetrySimulator::TelemetrySimulator(QWidget * parent, SimulatorInterface * simulator):
|
||||||
QWidget(parent),
|
QWidget(parent),
|
||||||
@@ -744,6 +746,12 @@ bool TelemetrySimulator::LogPlaybackController::isReady()
|
|||||||
|
|
||||||
void TelemetrySimulator::LogPlaybackController::loadLogFile()
|
void TelemetrySimulator::LogPlaybackController::loadLogFile()
|
||||||
{
|
{
|
||||||
|
QString logFileNameAndPath = QFileDialog::getOpenFileName(NULL, tr("Log File"), g.logDir(), tr("LOG Files (*.csv)"));
|
||||||
|
if (logFileNameAndPath.isEmpty())
|
||||||
|
return;
|
||||||
|
|
||||||
|
g.logDir(logFileNameAndPath);
|
||||||
|
|
||||||
// reset the playback ui
|
// reset the playback ui
|
||||||
ui->play->setEnabled(false);
|
ui->play->setEnabled(false);
|
||||||
ui->rewind->setEnabled(false);
|
ui->rewind->setEnabled(false);
|
||||||
@@ -757,8 +765,6 @@ void TelemetrySimulator::LogPlaybackController::loadLogFile()
|
|||||||
// clear existing data
|
// clear existing data
|
||||||
csvRecords.clear();
|
csvRecords.clear();
|
||||||
|
|
||||||
QString logFileNameAndPath = QFileDialog::getOpenFileName(NULL, tr("Log File"), ".", tr("LOG Files (*.csv)"));
|
|
||||||
QFileInfo fileInfo(logFileNameAndPath);
|
|
||||||
QFile file(logFileNameAndPath);
|
QFile file(logFileNameAndPath);
|
||||||
if (!file.open(QIODevice::ReadOnly)) {
|
if (!file.open(QIODevice::ReadOnly)) {
|
||||||
ui->logFileLabel->setText(tr("ERROR - invalid file"));
|
ui->logFileLabel->setText(tr("ERROR - invalid file"));
|
||||||
@@ -768,6 +774,7 @@ void TelemetrySimulator::LogPlaybackController::loadLogFile()
|
|||||||
QByteArray line = file.readLine();
|
QByteArray line = file.readLine();
|
||||||
csvRecords.append(line.simplified());
|
csvRecords.append(line.simplified());
|
||||||
}
|
}
|
||||||
|
file.close();
|
||||||
if (csvRecords.count() > 1) {
|
if (csvRecords.count() > 1) {
|
||||||
columnNames.clear();
|
columnNames.clear();
|
||||||
QStringList keys = csvRecords[0].split(',');
|
QStringList keys = csvRecords[0].split(',');
|
||||||
|
|||||||
Reference in New Issue
Block a user