From 74f5842f0c324fdd2d0217e90c11da6c70319f6e Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Sun, 21 Dec 2014 17:53:18 -0800 Subject: [PATCH] Add second CSV export with dive details This is intended to export all the details that someone might copy from a paper logbook. We need a matching import template to make this simple. This hasn't been well tested, I'm sure it will break when elements and attributes are missing. Signed-off-by: Dirk Hohndel --- qt-ui/divelogexportdialog.cpp | 4 ++ qt-ui/divelogexportdialog.ui | 16 ++++- save-xml.c | 3 + subsurface.qrc | 1 + xslt/xml2manualcsv.xslt | 114 ++++++++++++++++++++++++++++++++++ 5 files changed, 135 insertions(+), 3 deletions(-) create mode 100644 xslt/xml2manualcsv.xslt diff --git a/qt-ui/divelogexportdialog.cpp b/qt-ui/divelogexportdialog.cpp index 965af494f..a237c9941 100644 --- a/qt-ui/divelogexportdialog.cpp +++ b/qt-ui/divelogexportdialog.cpp @@ -272,6 +272,10 @@ void DiveLogExportDialog::on_buttonBox_accepted() stylesheet = "xml2csv.xslt"; filename = QFileDialog::getSaveFileName(this, tr("Export CSV file as"), lastDir, tr("CSV files (*.csv *.CSV)")); + } else if (ui->exportCSVDetails->isChecked()) { + stylesheet = "xml2manualcsv.xslt"; + filename = QFileDialog::getSaveFileName(this, tr("Export CSV file as"), lastDir, + tr("CSV files (*.csv *.CSV)")); } else if (ui->exportDivelogs->isChecked()) { DivelogsDeWebServices::instance()->prepareDivesForUpload(ui->exportSelected->isChecked()); } else if (ui->exportDiveshare->isChecked()) { diff --git a/qt-ui/divelogexportdialog.ui b/qt-ui/divelogexportdialog.ui index aaa485eb3..62e984294 100644 --- a/qt-ui/divelogexportdialog.ui +++ b/qt-ui/divelogexportdialog.ui @@ -7,7 +7,7 @@ 0 0 507 - 413 + 423 @@ -166,7 +166,17 @@ - CSV + CSV samples + + + exportGroup + + + + + + + CSV dive details exportGroup @@ -440,7 +450,7 @@ - + diff --git a/save-xml.c b/save-xml.c index e4871fbb1..9172032ee 100644 --- a/save-xml.c +++ b/save-xml.c @@ -647,6 +647,9 @@ int export_dives_xslt(const char *filename, const bool selected, const char *exp xmlDoc *transformed; int res = 0; + if (verbose) + fprintf(stderr, "export_dives_xslt with stylesheet %s\n", export_xslt); + if (!filename) return report_error("No filename for export"); diff --git a/subsurface.qrc b/subsurface.qrc index 76875a716..e1103bb92 100644 --- a/subsurface.qrc +++ b/subsurface.qrc @@ -42,6 +42,7 @@ xslt/udcf.xslt xslt/uddf-export.xslt xslt/xml2csv.xslt + xslt/xml2manualcsv.xslt xslt/uddf.xslt xslt/sensuscsv.xslt xslt/manualcsv2xml.xslt diff --git a/xslt/xml2manualcsv.xslt b/xslt/xml2manualcsv.xslt new file mode 100644 index 000000000..fa3868cf8 --- /dev/null +++ b/xslt/xml2manualcsv.xslt @@ -0,0 +1,114 @@ + + + + + + , + + + + + + + + + + " + + " + + " + + " + + " + + " + + " + + " + + + + + + + + + " + + " + + " + + " + + + + + + + " + + " + + " + + " + + + + " + + " + + " + + " + + + + " + + " + + " + + " + + + + " + + " + + " + + " + + + + " + + " + + + + " + + " + + + + " + + " + + + + " + + " + +