mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Support for importing Poseidon MK6 logs
This patch adds support for importing the logs from a Poseidon MK6 rebreather. This DC produces logs that contain of a .txt file that has all the meta data and a .csv file that contains the sample readings. The CSV file is different from the others in that it has a line per each sample reading at given time. Thus we have to merge all the lines from one point in time into one sample reading of ours. [Dirk Hohndel: addressed some compiler warnings] Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
bb020ae918
commit
8fcc074b49
5 changed files with 239 additions and 3 deletions
|
@ -1174,6 +1174,23 @@ void MainWindow::importFiles(const QStringList fileNames)
|
|||
refreshDisplay();
|
||||
}
|
||||
|
||||
void MainWindow::importTxtFiles(const QStringList fileNames)
|
||||
{
|
||||
if (fileNames.isEmpty())
|
||||
return;
|
||||
|
||||
QByteArray fileNamePtr, csv;
|
||||
|
||||
for (int i = 0; i < fileNames.size(); ++i) {
|
||||
fileNamePtr = QFile::encodeName(fileNames.at(i));
|
||||
csv = fileNamePtr.data();
|
||||
csv.replace(strlen(csv.data()) - 3, 3, "csv");
|
||||
parse_txt_file(fileNamePtr.data(), csv);
|
||||
}
|
||||
process_dives(true, false);
|
||||
refreshDisplay();
|
||||
}
|
||||
|
||||
void MainWindow::loadFiles(const QStringList fileNames)
|
||||
{
|
||||
if (fileNames.isEmpty())
|
||||
|
@ -1208,14 +1225,15 @@ void MainWindow::on_actionImportDiveLog_triggered()
|
|||
QStringList fileNames = QFileDialog::getOpenFileNames(this, tr("Open dive log file"), lastUsedDir(),
|
||||
tr("Dive log files (*.xml *.uddf *.udcf *.csv *.jlb *.dld *.sde *.db);;"
|
||||
"XML files (*.xml);;UDDF/UDCF files(*.uddf *.udcf);;JDiveLog files(*.jlb);;"
|
||||
"Suunto Files(*.sde *.db);;CSV Files(*.csv);;All Files(*)"));
|
||||
"Suunto Files(*.sde *.db);;CSV Files(*.csv);;MkVI Files(*.txt);;All Files(*)"));
|
||||
|
||||
if (fileNames.isEmpty())
|
||||
return;
|
||||
updateLastUsedDir(QFileInfo(fileNames[0]).dir().path());
|
||||
|
||||
QStringList logFiles = fileNames.filter(QRegExp("^.*\\.(?!csv)", Qt::CaseInsensitive));
|
||||
QStringList logFiles = fileNames.filter(QRegExp("^.*\\.(?!csv|?!txt)", Qt::CaseInsensitive));
|
||||
QStringList csvFiles = fileNames.filter(".csv", Qt::CaseInsensitive);
|
||||
QStringList txtFiles = fileNames.filter(".txt", Qt::CaseInsensitive);
|
||||
if (logFiles.size()) {
|
||||
importFiles(logFiles);
|
||||
}
|
||||
|
@ -1226,6 +1244,10 @@ void MainWindow::on_actionImportDiveLog_triggered()
|
|||
process_dives(true, false);
|
||||
refreshDisplay();
|
||||
}
|
||||
|
||||
if (txtFiles.size()) {
|
||||
importTxtFiles(txtFiles);
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::editCurrentDive()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue