mirror of
				https://github.com/subsurface/subsurface.git
				synced 2025-02-19 22:16:15 +00:00 
			
		
		
		
	CSV import: import time field if available
Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
		
							parent
							
								
									a83c674139
								
							
						
					
					
						commit
						7ec83ef02a
					
				
					 2 changed files with 16 additions and 3 deletions
				
			
		|  | @ -722,6 +722,8 @@ int DiveLogImportDialog::setup_csv_params(QStringList r, char **params, int pnr) | ||||||
| 	params[pnr++] = intdup(r.indexOf(tr("Date"))); | 	params[pnr++] = intdup(r.indexOf(tr("Date"))); | ||||||
| 	params[pnr++] = strdup("datefmt"); | 	params[pnr++] = strdup("datefmt"); | ||||||
| 	params[pnr++] = intdup(ui->DateFormat->currentIndex()); | 	params[pnr++] = intdup(ui->DateFormat->currentIndex()); | ||||||
|  | 	params[pnr++] = strdup("starttimeField"); | ||||||
|  | 	params[pnr++] = intdup(r.indexOf(tr("Time"))); | ||||||
| 	params[pnr++] = strdup("timeField"); | 	params[pnr++] = strdup("timeField"); | ||||||
| 	params[pnr++] = intdup(r.indexOf(tr("Sample time"))); | 	params[pnr++] = intdup(r.indexOf(tr("Sample time"))); | ||||||
| 	params[pnr++] = strdup("depthField"); | 	params[pnr++] = strdup("depthField"); | ||||||
|  | @ -823,7 +825,7 @@ void DiveLogImportDialog::on_buttonBox_accepted() | ||||||
| 					sample->tts.seconds *= 60; | 					sample->tts.seconds *= 60; | ||||||
| 				} | 				} | ||||||
| 			} else { | 			} else { | ||||||
| 				char *params[43]; | 				char *params[45]; | ||||||
| 				int pnr = 0; | 				int pnr = 0; | ||||||
| 
 | 
 | ||||||
| 				pnr = setup_csv_params(r, params, pnr); | 				pnr = setup_csv_params(r, params, pnr); | ||||||
|  | @ -890,7 +892,7 @@ void DiveLogImportDialog::on_buttonBox_accepted() | ||||||
| 
 | 
 | ||||||
| 				parse_manual_file(fileNames[i].toUtf8().data(), params, pnr - 1); | 				parse_manual_file(fileNames[i].toUtf8().data(), params, pnr - 1); | ||||||
| 			} else { | 			} else { | ||||||
| 				char *params[43]; | 				char *params[45]; | ||||||
| 				int pnr = 0; | 				int pnr = 0; | ||||||
| 
 | 
 | ||||||
| 				pnr = setup_csv_params(r, params, pnr); | 				pnr = setup_csv_params(r, params, pnr); | ||||||
|  |  | ||||||
|  | @ -4,6 +4,7 @@ | ||||||
|   <xsl:strip-space elements="*"/> |   <xsl:strip-space elements="*"/> | ||||||
|   <xsl:param name="dateField" select="dateField"/> |   <xsl:param name="dateField" select="dateField"/> | ||||||
|   <xsl:param name="datefmt" select="datefmt"/> |   <xsl:param name="datefmt" select="datefmt"/> | ||||||
|  |   <xsl:param name="starttimeField" select="starttimeField"/> | ||||||
|   <xsl:param name="timeField" select="timeField"/> |   <xsl:param name="timeField" select="timeField"/> | ||||||
|   <xsl:param name="depthField" select="depthField"/> |   <xsl:param name="depthField" select="depthField"/> | ||||||
|   <xsl:param name="tempField" select="tempField"/> |   <xsl:param name="tempField" select="tempField"/> | ||||||
|  | @ -87,7 +88,17 @@ | ||||||
|             </xsl:choose> |             </xsl:choose> | ||||||
|           </xsl:attribute> |           </xsl:attribute> | ||||||
|           <xsl:attribute name="time"> |           <xsl:attribute name="time"> | ||||||
|             <xsl:value-of select="concat(substring($time, 2, 2), ':', substring($time, 4, 2))"/> |             <xsl:choose> | ||||||
|  |               <xsl:when test="$starttimeField >= 0"> | ||||||
|  |                 <xsl:call-template name="getFieldByIndex"> | ||||||
|  |                   <xsl:with-param name="index" select="$starttimeField"/> | ||||||
|  |                   <xsl:with-param name="line" select="substring-after(substring-after(., $lf), $lf)"/> | ||||||
|  |                 </xsl:call-template> | ||||||
|  |               </xsl:when> | ||||||
|  |               <xsl:otherwise> | ||||||
|  |                 <xsl:value-of select="concat(substring($time, 2, 2), ':', substring($time, 4, 2))"/> | ||||||
|  |               </xsl:otherwise> | ||||||
|  |             </xsl:choose> | ||||||
|           </xsl:attribute> |           </xsl:attribute> | ||||||
| 
 | 
 | ||||||
|           <!-- If the dive is CCR, create oxygen and diluent cylinders --> |           <!-- If the dive is CCR, create oxygen and diluent cylinders --> | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue