mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-31 21:13:23 +00:00
Add hw info to Seabear import
Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
02488ba9df
commit
3ef5dbaacb
4 changed files with 24 additions and 6 deletions
2
dive.h
2
dive.h
|
@ -668,7 +668,7 @@ extern int parse_dlf_buffer(unsigned char *buffer, size_t size);
|
|||
|
||||
extern int parse_file(const char *filename);
|
||||
extern int parse_csv_file(const char *filename, int timef, int depthf, int tempf, int po2f, int o2Sensor1f, int o2Sensor2f, int o2Sensor3f, int cnsf, int ndlf, int ttsf, int stopdepthf, int pressuref, int setpointf, int sepidx, const char *csvtemplate, int unitidx);
|
||||
extern int parse_seabear_csv_file(const char *filename, int timef, int depthf, int tempf, int po2f, int o2Sensor1f, int o2Sensor2f, int o2Sensor3f, int cnsf, int ndlf, int ttsf, int stopdepthf, int pressuref, int sepidx, const char *csvtemplate, int unitidx, const char *delta);
|
||||
extern int parse_seabear_csv_file(const char *filename, int timef, int depthf, int tempf, int po2f, int o2Sensor1f, int o2Sensor2f, int o2Sensor3f, int cnsf, int ndlf, int ttsf, int stopdepthf, int pressuref, int sepidx, const char *csvtemplate, int unitidx, const char *delta, const char *hw);
|
||||
extern int parse_txt_file(const char *filename, const char *csv);
|
||||
extern int parse_manual_file(const char *filename, int separator_index, int units, int dateformat, int durationformat, int number, int date, int time, int duration, int location, int gps, int maxdepth, int meandepth, int divemaster, int buddy, int suit, int notes, int weight, int tags, int cylsizef, int startpresf, int endpresf, int o2f, int hef, int airtempf, int watertempf);
|
||||
|
||||
|
|
8
file.c
8
file.c
|
@ -950,8 +950,8 @@ int parse_csv_file(const char *filename, int timef, int depthf, int tempf, int p
|
|||
return ret;
|
||||
}
|
||||
|
||||
#define SBPARAMS 38
|
||||
int parse_seabear_csv_file(const char *filename, int timef, int depthf, int tempf, int po2f, int o2sensor1f, int o2sensor2f, int o2sensor3f, int cnsf, int ndlf, int ttsf, int stopdepthf, int pressuref, int sepidx, const char *csvtemplate, int unitidx, const char *delta)
|
||||
#define SBPARAMS 40
|
||||
int parse_seabear_csv_file(const char *filename, int timef, int depthf, int tempf, int po2f, int o2sensor1f, int o2sensor2f, int o2sensor3f, int cnsf, int ndlf, int ttsf, int stopdepthf, int pressuref, int sepidx, const char *csvtemplate, int unitidx, const char *delta, const char *hw)
|
||||
{
|
||||
int ret, i, pnr;
|
||||
struct memblock mem;
|
||||
|
@ -1043,6 +1043,10 @@ int parse_seabear_csv_file(const char *filename, int timef, int depthf, int temp
|
|||
snprintf(deltabuf, MAXCOLDIGITS, "%s", delta);
|
||||
params[pnr++] = "delta";
|
||||
params[pnr++] = strdup(deltabuf);
|
||||
if (strlen(hw)) {
|
||||
params[pnr++] = "hw";
|
||||
params[pnr++] = strdup(hw);
|
||||
}
|
||||
params[pnr++] = NULL;
|
||||
|
||||
/* Move the CSV data to the start of mem buffer */
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -95,6 +95,7 @@ private:
|
|||
int column;
|
||||
ColumnNameResult *resultModel;
|
||||
QString delta;
|
||||
QString hw;
|
||||
|
||||
struct CSVAppConfig {
|
||||
QString name;
|
||||
|
|
Loading…
Add table
Reference in a new issue