mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-28 05:00:20 +00:00
CSV import: include visibility and rating in import
Add support for visibility and rating to CSV import dialog. Fixes #1212 Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
This commit is contained in:
parent
c53442e37e
commit
12e4b6d62c
2 changed files with 30 additions and 2 deletions
|
@ -49,7 +49,7 @@ ColumnNameProvider::ColumnNameProvider(QObject *parent) : QAbstractListModel(par
|
|||
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") <<
|
||||
tr("Sample sensor1 pO₂") << tr("Sample sensor2 pO₂") << tr("Sample sensor3 pO₂") <<
|
||||
tr("Sample setpoint");
|
||||
tr("Sample setpoint") << tr("Visibility") << tr("Rating");
|
||||
}
|
||||
|
||||
bool ColumnNameProvider::insertRows(int row, int count, const QModelIndex &parent)
|
||||
|
@ -784,6 +784,10 @@ int DiveLogImportDialog::setup_csv_params(QStringList r, char **params, int pnr)
|
|||
params[pnr++] = intdup(r.indexOf(tr("Sample pressure")));
|
||||
params[pnr++] = strdup("setpointField");
|
||||
params[pnr++] = intdup(r.indexOf(tr("Sample setpoint")));
|
||||
params[pnr++] = strdup("visibilityField");
|
||||
params[pnr++] = intdup(r.indexOf(tr("Visibility")));
|
||||
params[pnr++] = strdup("ratingField");
|
||||
params[pnr++] = intdup(r.indexOf(tr("Rating")));
|
||||
params[pnr++] = strdup("separatorIndex");
|
||||
params[pnr++] = intdup(ui->CSVSeparator->currentIndex());
|
||||
params[pnr++] = strdup("units");
|
||||
|
@ -875,7 +879,7 @@ void DiveLogImportDialog::on_buttonBox_accepted()
|
|||
} else {
|
||||
for (int i = 0; i < fileNames.size(); ++i) {
|
||||
if (r.indexOf(tr("Sample time")) < 0) {
|
||||
char *params[55];
|
||||
char *params[59];
|
||||
int pnr = 0;
|
||||
params[pnr++] = strdup("numberField");
|
||||
params[pnr++] = intdup(r.indexOf(tr("Dive #")));
|
||||
|
@ -927,6 +931,10 @@ void DiveLogImportDialog::on_buttonBox_accepted()
|
|||
params[pnr++] = intdup(r.indexOf(tr("Air temp.")));
|
||||
params[pnr++] = strdup("watertempField");
|
||||
params[pnr++] = intdup(r.indexOf(tr("Water temp.")));
|
||||
params[pnr++] = strdup("visibilityField");
|
||||
params[pnr++] = intdup(r.indexOf(tr("Visibility")));
|
||||
params[pnr++] = strdup("ratingField");
|
||||
params[pnr++] = intdup(r.indexOf(tr("Rating")));
|
||||
params[pnr++] = NULL;
|
||||
|
||||
parse_manual_file(qPrintable(fileNames[i]), params, pnr - 1);
|
||||
|
|
|
@ -26,6 +26,8 @@
|
|||
<xsl:param name="cylindersizeField" select="cylindersizeField"/>
|
||||
<xsl:param name="startpressureField" select="startpressureField"/>
|
||||
<xsl:param name="endpressureField" select="endpressureField"/>
|
||||
<xsl:param name="visibilityField" select="visibilityField"/>
|
||||
<xsl:param name="ratingField" select="ratingField"/>
|
||||
<xsl:param name="o2Field" select="o2Field"/>
|
||||
<xsl:param name="heField" select="heField"/>
|
||||
<xsl:output method="xml" encoding="utf-8" indent="yes"/>
|
||||
|
@ -205,6 +207,24 @@
|
|||
</xsl:attribute>
|
||||
</xsl:if>
|
||||
|
||||
<xsl:if test="$visibilityField >= 0">
|
||||
<xsl:attribute name="visibility">
|
||||
<xsl:call-template name="getFieldByIndex">
|
||||
<xsl:with-param name="index" select="$visibilityField"/>
|
||||
<xsl:with-param name="line" select="$line"/>
|
||||
</xsl:call-template>
|
||||
</xsl:attribute>
|
||||
</xsl:if>
|
||||
|
||||
<xsl:if test="$ratingField >= 0">
|
||||
<xsl:attribute name="rating">
|
||||
<xsl:call-template name="getFieldByIndex">
|
||||
<xsl:with-param name="index" select="$ratingField"/>
|
||||
<xsl:with-param name="line" select="$line"/>
|
||||
</xsl:call-template>
|
||||
</xsl:attribute>
|
||||
</xsl:if>
|
||||
|
||||
<divecomputer deviceid="ffffffff" model="csv" />
|
||||
|
||||
<xsl:if test="$locationField >= 0 or $gpsField >= 0">
|
||||
|
|
Loading…
Reference in a new issue