mirror of
				https://github.com/subsurface/subsurface.git
				synced 2025-02-19 22:16:15 +00:00 
			
		
		
		
	Simplify: remove m_notes variable
I didn't understood the logic of the define & replace, so maybe we want a few comments there. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
		
							parent
							
								
									6f95242ff1
								
							
						
					
					
						commit
						e2bc3b0e24
					
				
					 2 changed files with 16 additions and 22 deletions
				
			
		|  | @ -40,26 +40,6 @@ DiveObjectHelper::DiveObjectHelper(struct dive *d) : | ||||||
| 	if (ds) | 	if (ds) | ||||||
| 		m_gps = QString("%1,%2").arg(ds->latitude.udeg / 1000000.0).arg(ds->longitude.udeg / 1000000.0); | 		m_gps = QString("%1,%2").arg(ds->latitude.udeg / 1000000.0).arg(ds->longitude.udeg / 1000000.0); | ||||||
| 
 | 
 | ||||||
| 	m_notes = QString::fromUtf8(d->notes); |  | ||||||
| 	if (m_notes.isEmpty()) |  | ||||||
| 		m_notes = EMPTY_DIVE_STRING; |  | ||||||
| 	if (same_string(d->dc.model, "planned dive")) { |  | ||||||
| 		QTextDocument notes; |  | ||||||
| 		QString notesFormatted = m_notes; |  | ||||||
| #define _NOTES_BR "\n" |  | ||||||
| 		notesFormatted = notesFormatted.replace("<thead>", "<thead>" _NOTES_BR); |  | ||||||
| 		notesFormatted = notesFormatted.replace("<br>", "<br>" _NOTES_BR); |  | ||||||
| 		notesFormatted = notesFormatted.replace("<tr>", "<tr>" _NOTES_BR); |  | ||||||
| 		notesFormatted = notesFormatted.replace("</tr>", "</tr>" _NOTES_BR); |  | ||||||
| 		notes.setHtml(notesFormatted); |  | ||||||
| 		m_notes = notes.toPlainText(); |  | ||||||
| 		m_notes.replace(_NOTES_BR, "<br>"); |  | ||||||
| #undef _NOTES_BR |  | ||||||
| 	} else { |  | ||||||
| 		m_notes.replace("\n", "<br>"); |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
| 	char buffer[256]; | 	char buffer[256]; | ||||||
| 	taglist_get_tagstring(d->tag_list, buffer, 256); | 	taglist_get_tagstring(d->tag_list, buffer, 256); | ||||||
| 	m_tags = QString(buffer); | 	m_tags = QString(buffer); | ||||||
|  | @ -179,7 +159,22 @@ QString DiveObjectHelper::waterTemp() const | ||||||
| 
 | 
 | ||||||
| QString DiveObjectHelper::notes() const | QString DiveObjectHelper::notes() const | ||||||
| { | { | ||||||
| 	return m_notes; | 	QString tmp = m_dive->notes ? QString::fromUtf8(m_dive->notes) : EMPTY_DIVE_STRING; | ||||||
|  | 	if (same_string(m_dive->dc.model, "planned dive")) { | ||||||
|  | 		QTextDocument notes; | ||||||
|  | 	#define _NOTES_BR "\n" | ||||||
|  | 		tmp.replace("<thead>", "<thead>" _NOTES_BR) | ||||||
|  | 			.replace("<br>", "<br>" _NOTES_BR) | ||||||
|  | 			.replace("<tr>", "<tr>" _NOTES_BR) | ||||||
|  | 			.replace("</tr>", "</tr>" _NOTES_BR); | ||||||
|  | 		notes.setHtml(tmp); | ||||||
|  | 		tmp = notes.toPlainText(); | ||||||
|  | 		tmp.replace(_NOTES_BR, "<br>"); | ||||||
|  | 	#undef _NOTES_BR | ||||||
|  | 	} else { | ||||||
|  | 		tmp.replace("\n", "<br>"); | ||||||
|  | 	} | ||||||
|  | 	return tmp; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| QString DiveObjectHelper::tags() const | QString DiveObjectHelper::tags() const | ||||||
|  |  | ||||||
|  | @ -65,7 +65,6 @@ private: | ||||||
| 	QString m_date; | 	QString m_date; | ||||||
| 	QString m_time; | 	QString m_time; | ||||||
| 	QString m_gps; | 	QString m_gps; | ||||||
| 	QString m_notes; |  | ||||||
| 	QString m_tags; | 	QString m_tags; | ||||||
| 	QString m_gas; | 	QString m_gas; | ||||||
| 	QString m_sac; | 	QString m_sac; | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue