summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Miika Turkia <miika.turkia@gmail.com>2020-05-04 07:57:54 +0300
committerGravatar Robert C. Helling <helling@atdotde.de>2020-05-04 10:43:40 +0200
commit05177cfc145d264ff99b7a0bf9e395862caf2435 (patch)
treeb915d51f90e188ae71ab2dfef351eea957573828
parente1c3f29b889456977d8cd73596f7395c93268e3c (diff)
downloadsubsurface-05177cfc145d264ff99b7a0bf9e395862caf2435.tar.gz
CSV export: include dive mode field
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
-rw-r--r--desktop-widgets/divelogimportdialog.cpp41
-rw-r--r--xslt/manualcsv2xml.xslt12
2 files changed, 33 insertions, 20 deletions
diff --git a/desktop-widgets/divelogimportdialog.cpp b/desktop-widgets/divelogimportdialog.cpp
index ceae878c6..877c6f7c8 100644
--- a/desktop-widgets/divelogimportdialog.cpp
+++ b/desktop-widgets/divelogimportdialog.cpp
@@ -67,7 +67,7 @@ enum Known {
ColumnNameProvider::ColumnNameProvider(QObject *parent) : QAbstractListModel(parent)
{
- columnNames << tr("Dive #") << tr("Date") << tr("Time") << tr("Duration") << tr("Location") << tr("GPS") << tr("Weight") << tr("Cyl. size") << tr("Start pressure") <<
+ columnNames << tr("Dive #") << tr("Date") << tr("Time") << tr("Duration") << tr("Mode") << tr("Location") << tr("GPS") << tr("Weight") << tr("Cyl. size") << tr("Start pressure") <<
tr("End pressure") << tr("Max. depth") << tr("Avg. depth") << tr("Divemaster") << tr("Buddy") << tr("Suit") << tr("Notes") << tr("Tags") << tr("Air temp.") << tr("Water temp.") <<
tr("O₂") << tr("He") << tr("Sample time") << tr("Sample depth") << tr("Sample temperature") << tr("Sample pO₂") << tr("Sample CNS") << tr("Sample NDL") <<
tr("Sample TTS") << tr("Sample stopdepth") << tr("Sample pressure") <<
@@ -720,23 +720,24 @@ void DiveLogImportDialog::loadFileContents(int value, whatChanged triggeredBy)
headers.replace(3, tr("Duration"));
headers.replace(4, tr("Max. depth"));
headers.replace(5, tr("Avg. depth"));
- headers.replace(6, tr("Air temp."));
- headers.replace(7, tr("Water temp."));
- headers.replace(8, tr("Cyl. size"));
- headers.replace(9, tr("Start pressure"));
- headers.replace(10, tr("End pressure"));
- headers.replace(11, tr("O₂"));
- headers.replace(12, tr("He"));
- headers.replace(13, tr("Location"));
- headers.replace(14, tr("GPS"));
- headers.replace(15, tr("Divemaster"));
- headers.replace(16, tr("Buddy"));
- headers.replace(17, tr("Suit"));
- headers.replace(18, tr("Rating"));
- headers.replace(19, tr("Visibility"));
- headers.replace(20, tr("Notes"));
- headers.replace(21, tr("Weight"));
- headers.replace(22, tr("Tags"));
+ headers.replace(6, tr("Mode"));
+ headers.replace(7, tr("Air temp."));
+ headers.replace(8, tr("Water temp."));
+ headers.replace(9, tr("Cyl. size"));
+ headers.replace(10, tr("Start pressure"));
+ headers.replace(11, tr("End pressure"));
+ headers.replace(12, tr("O₂"));
+ headers.replace(13, tr("He"));
+ headers.replace(14, tr("Location"));
+ headers.replace(15, tr("GPS"));
+ headers.replace(16, tr("Divemaster"));
+ headers.replace(17, tr("Buddy"));
+ headers.replace(18, tr("Suit"));
+ headers.replace(19, tr("Rating"));
+ headers.replace(20, tr("Visibility"));
+ headers.replace(21, tr("Notes"));
+ headers.replace(22, tr("Weight"));
+ headers.replace(23, tr("Tags"));
blockSignals(true);
ui->CSVSeparator->setCurrentText(separator);
@@ -937,7 +938,7 @@ void DiveLogImportDialog::on_buttonBox_accepted()
} else {
for (int i = 0; i < fileNames.size(); ++i) {
if (r.indexOf(tr("Sample time")) < 0) {
- char *params[59];
+ char *params[61];
int pnr = 0;
params[pnr++] = strdup("numberField");
params[pnr++] = intdup(r.indexOf(tr("Dive #")));
@@ -947,6 +948,8 @@ void DiveLogImportDialog::on_buttonBox_accepted()
params[pnr++] = intdup(r.indexOf(tr("Time")));
params[pnr++] = strdup("durationField");
params[pnr++] = intdup(r.indexOf(tr("Duration")));
+ params[pnr++] = strdup("modeField");
+ params[pnr++] = intdup(r.indexOf(tr("Mode")));
params[pnr++] = strdup("locationField");
params[pnr++] = intdup(r.indexOf(tr("Location")));
params[pnr++] = strdup("gpsField");
diff --git a/xslt/manualcsv2xml.xslt b/xslt/manualcsv2xml.xslt
index b899d0655..e0eafc0b6 100644
--- a/xslt/manualcsv2xml.xslt
+++ b/xslt/manualcsv2xml.xslt
@@ -15,6 +15,7 @@
<xsl:param name="gpsField" select="gpsField"/>
<xsl:param name="maxDepthField" select="maxDepthField"/>
<xsl:param name="meanDepthField" select="meanDepthField"/>
+ <xsl:param name="modeField" select="modeField"/>
<xsl:param name="divemasterField" select="divemasterField"/>
<xsl:param name="buddyField" select="buddyField"/>
<xsl:param name="suitField" select="suitField"/>
@@ -225,7 +226,16 @@
</xsl:attribute>
</xsl:if>
- <divecomputer deviceid="ffffffff" model="csv" />
+ <divecomputer deviceid="ffffffff" model="csv">
+ <xsl:if test="$modeField >= 0">
+ <xsl:attribute name="dctype">
+ <xsl:call-template name="getFieldByIndex">
+ <xsl:with-param name="index" select="$modeField"/>
+ <xsl:with-param name="line" select="$line"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ </xsl:if>
+ </divecomputer>
<xsl:if test="$locationField &gt;= 0 or $gpsField &gt;= 0">
<location>