From 1e04aec7fd46afc2c922f6d019e0344f0e1f4fa1 Mon Sep 17 00:00:00 2001 From: Miika Turkia Date: Fri, 26 Dec 2014 16:11:38 +0200 Subject: [PATCH] Preconfigured import of Subsurface CSV log file Signed-off-by: Miika Turkia Signed-off-by: Dirk Hohndel --- parse-xml.c | 1 + qt-ui/divelogimportdialog.cpp | 4 + qt-ui/divelogimportdialog.h | 2 +- subsurface.qrc | 1 + xslt/subsurfacecsv.xslt | 360 ++++++++++++++++++++++++++++++++++ 5 files changed, 367 insertions(+), 1 deletion(-) create mode 100644 xslt/subsurfacecsv.xslt diff --git a/parse-xml.c b/parse-xml.c index 42f5fe123..ac7820971 100644 --- a/parse-xml.c +++ b/parse-xml.c @@ -2558,6 +2558,7 @@ static struct xslt_files { { "Divinglog", "DivingLog.xslt", NULL }, { "csv", "csv2xml.xslt", NULL }, { "sensuscsv", "sensuscsv.xslt", NULL }, + { "SubsurfaceCSV", "subsurfacecsv.xslt", NULL }, { "manualcsv", "manualcsv2xml.xslt", NULL }, { NULL, } }; diff --git a/qt-ui/divelogimportdialog.cpp b/qt-ui/divelogimportdialog.cpp index b91cc6782..5c2a04434 100644 --- a/qt-ui/divelogimportdialog.cpp +++ b/qt-ui/divelogimportdialog.cpp @@ -12,6 +12,7 @@ const DiveLogImportDialog::CSVAppConfig DiveLogImportDialog::CSVApps[CSVAPPS] = { "XP5", 1, 2, 10, -1, -1, -1, -1, -1, -1, "Tab" }, { "SensusCSV", 10, 11, -1, -1, -1, -1, -1, -1, -1, "," }, { "Seabear CSV", 1, 2, 6, -1, -1, 3, 4, 5, 7, ";" }, + { "SubsurfaceCSV", -1, -1, -1, -1, -1, -1, -1, -1, -1, "," }, { NULL, } }; @@ -25,6 +26,7 @@ DiveLogImportDialog::DiveLogImportDialog(QStringList *fn, QWidget *parent) : QDi /* Add indexes of XSLTs requiring special handling to the list */ specialCSV << 3; + specialCSV << 5; for (int i = 0; !CSVApps[i].name.isNull(); ++i) ui->knownImports->addItem(CSVApps[i].name); @@ -160,8 +162,10 @@ void DiveLogImportDialog::on_knownImports_currentIndexChanged(int index) { if (specialCSV.contains(index)) { ui->groupBox_3->setEnabled(false); + ui->CSVUnits->setEnabled(false); } else { ui->groupBox_3->setEnabled(true); + ui->CSVUnits->setEnabled(true); } if (index == 0) return; diff --git a/qt-ui/divelogimportdialog.h b/qt-ui/divelogimportdialog.h index 3faceeceb..36314f7f5 100644 --- a/qt-ui/divelogimportdialog.h +++ b/qt-ui/divelogimportdialog.h @@ -64,7 +64,7 @@ private: QString separator; }; -#define CSVAPPS 6 +#define CSVAPPS 7 static const CSVAppConfig CSVApps[CSVAPPS]; }; diff --git a/subsurface.qrc b/subsurface.qrc index e1103bb92..6faf96f76 100644 --- a/subsurface.qrc +++ b/subsurface.qrc @@ -45,6 +45,7 @@ xslt/xml2manualcsv.xslt xslt/uddf.xslt xslt/sensuscsv.xslt + xslt/subsurfacecsv.xslt xslt/manualcsv2xml.xslt xslt/shearwater.xslt icons/gas.png diff --git a/xslt/subsurfacecsv.xslt b/xslt/subsurfacecsv.xslt new file mode 100644 index 000000000..ec6e871e4 --- /dev/null +++ b/xslt/subsurfacecsv.xslt @@ -0,0 +1,360 @@ + + + + + + + + + + + + + + ; + , + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +