summaryrefslogtreecommitdiffstats
path: root/qt-ui/divelogimportdialog.cpp
diff options
context:
space:
mode:
authorGravatar Miika Turkia <miika.turkia@gmail.com>2015-07-27 16:13:29 +0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-07-27 06:34:18 -0700
commit3ef5dbaacb6be129f3d4e7b72fcf86b95e5c8fa4 (patch)
tree6dacce702442cd9fceba1413f336eeb244d26e82 /qt-ui/divelogimportdialog.cpp
parent02488ba9df26eec8e5ec4dbd352880bf6b16c416 (diff)
downloadsubsurface-3ef5dbaacb6be129f3d4e7b72fcf86b95e5c8fa4.tar.gz
Add hw info to Seabear import
Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/divelogimportdialog.cpp')
-rw-r--r--qt-ui/divelogimportdialog.cpp19
1 files changed, 16 insertions, 3 deletions
diff --git a/qt-ui/divelogimportdialog.cpp b/qt-ui/divelogimportdialog.cpp
index d799bf17f..24cb805bb 100644
--- a/qt-ui/divelogimportdialog.cpp
+++ b/qt-ui/divelogimportdialog.cpp
@@ -330,6 +330,7 @@ DiveLogImportDialog::DiveLogImportDialog(QStringList fn, QWidget *parent) : QDia
fileNames = fn;
column = 0;
delta = "0";
+ hw = "";
/* Add indexes of XSLTs requiring special handling to the list */
specialCSV << 3;
@@ -392,8 +393,19 @@ void DiveLogImportDialog::loadFileContents(int value, whatChanged triggeredBy)
/*
* Parse header - currently only interested in sample
- * interval, or if we have old format (if interval value
- * is missing from the header).
+ * interval and hardware version. If we have old format
+ * the interval value is missing from the header.
+ */
+
+ while ((firstLine = f.readLine()).length() > 3 && !f.atEnd()) {
+ if (firstLine.contains("//Hardware Version: ")) {
+ hw = firstLine.replace(QString::fromLatin1("//Hardware Version: "), QString::fromLatin1("\"Seabear ")).trimmed().append("\"");
+ break;
+ }
+ }
+
+ /*
+ * Note that we scan over the "Log interval" on purpose
*/
while ((firstLine = f.readLine()).length() > 3 && !f.atEnd()) {
@@ -624,7 +636,8 @@ void DiveLogImportDialog::on_buttonBox_accepted()
ui->CSVSeparator->currentIndex(),
"csv",
ui->CSVUnits->currentIndex(),
- delta.toUtf8().data()
+ delta.toUtf8().data(),
+ hw.toUtf8().data()
) < 0) {
return;
}