Patch attached that fixes the error Davide has mentioned in the worldmap
export with Italian language.

Also two un-applied HTML patches.

-- 
regards,
Gehad
From 6024907b01adc6aac2473d4eabdb91a4111e3939 Mon Sep 17 00:00:00 2001
From: Gehad elrobey <[email protected]>
Date: Fri, 6 Feb 2015 21:30:58 +0200
Subject: [PATCH 2/3] HTML: Fix Null values in yearly statistics export.

Null values should be handeled nicely instead of showing NULL or Nan.

Signed-off-by: Gehad elrobey <[email protected]>
---
 qt-ui/divelogexportdialog.cpp | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/qt-ui/divelogexportdialog.cpp b/qt-ui/divelogexportdialog.cpp
index b672601..43c4155 100644
--- a/qt-ui/divelogexportdialog.cpp
+++ b/qt-ui/divelogexportdialog.cpp
@@ -201,9 +201,12 @@ void DiveLogExportDialog::exportHTMLstatistics(const QString &filename)
 			out << "\"AVG_SAC\":\"" << get_volume_string(stats_yearly[i].avg_sac) << "\",";
 			out << "\"MIN_SAC\":\"" << get_volume_string(stats_yearly[i].min_sac) << "\",";
 			out << "\"MAX_SAC\":\"" << get_volume_string(stats_yearly[i].max_sac) << "\",";
-			out << "\"AVG_TEMP\":\"" << QString::number(stats_yearly[i].combined_temp / stats_yearly[i].combined_count, 'f', 1) << "\",";
-			out << "\"MIN_TEMP\":\"" << get_temp_units(stats_yearly[i].min_temp, NULL) << "\",";
-			out << "\"MAX_TEMP\":\"" << get_temp_units(stats_yearly[i].max_temp, NULL) << "\",";
+			if ( stats_yearly[i].combined_count )
+				out << "\"AVG_TEMP\":\"" << QString::number(stats_yearly[i].combined_temp / stats_yearly[i].combined_count, 'f', 1) << "\",";
+			else
+				out << "\"AVG_TEMP\":\"0.0\",";
+			out << "\"MIN_TEMP\":\"" << ( stats_yearly[i].min_temp == 0 ? 0 : get_temp_units(stats_yearly[i].min_temp, NULL)) << "\",";
+			out << "\"MAX_TEMP\":\"" << ( stats_yearly[i].max_temp == 0 ? 0 : get_temp_units(stats_yearly[i].max_temp, NULL)) << "\",";
 			out << "},";
 			total_stats.selection_size += stats_yearly[i].selection_size;
 			total_stats.total_time.seconds += stats_yearly[i].total_time.seconds;
-- 
1.9.1

From 2cd4c5cbd6440b4518b2db9d39f3f5bf8c245553 Mon Sep 17 00:00:00 2001
From: Gehad elrobey <[email protected]>
Date: Fri, 6 Feb 2015 11:06:43 +0200
Subject: [PATCH 1/3] HTML: Fix exporting themes in multilingual environment

Don't compare to static english string, must translate first.

Signed-off-by: Gehad elrobey <[email protected]>
---
 qt-ui/divelogexportdialog.cpp | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/qt-ui/divelogexportdialog.cpp b/qt-ui/divelogexportdialog.cpp
index aff0265..b672601 100644
--- a/qt-ui/divelogexportdialog.cpp
+++ b/qt-ui/divelogexportdialog.cpp
@@ -129,8 +129,7 @@ void DiveLogExportDialog::exportHtmlInit(const QString &filename)
 	copy_and_overwrite(searchPath + "jqplot.canvasTextRenderer.min.js", exportFiles + "jqplot.canvasTextRenderer.min.js");
 	copy_and_overwrite(searchPath + "jquery.min.js", exportFiles + "jquery.min.js");
 	copy_and_overwrite(searchPath + "jquery.jqplot.css", exportFiles + "jquery.jqplot.css");
-	copy_and_overwrite(searchPath + (ui->themeSelection->currentText() == "Light" ? "light.css" : "sand.css"),
-			   exportFiles + "theme.css");
+	copy_and_overwrite(searchPath + (ui->themeSelection->currentText() == tr("Light") ? "light.css" : "sand.css"), exportFiles + "theme.css");
 }
 
 void DiveLogExportDialog::exportHTMLsettings(const QString &filename)
-- 
1.9.1

From 12510c644e2e6096da4333908f16a051572243ff Mon Sep 17 00:00:00 2001
From: Gehad elrobey <[email protected]>
Date: Thu, 12 Feb 2015 20:46:14 +0200
Subject: [PATCH 3/3] Fix error on HTML worldmap exports.

As HTML worldmap export produces wrong HTML in languages that contains
apostrophe in air/water temperature fields like italian. Translated
strings need to be HTML quoted.

Signed-off-by: Gehad elrobey <[email protected]>
---
 worldmap-save.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/worldmap-save.c b/worldmap-save.c
index a7e9d82..c28a52d 100644
--- a/worldmap-save.c
+++ b/worldmap-save.c
@@ -43,10 +43,12 @@ void writeMarkers(struct membuffer *b, const bool selected_only)
 		snprintf(pre, sizeof(pre), "<p>%s ", translate("gettextFromC", "Max. depth:"));
 		snprintf(post, sizeof(post), " %s</p>", translate("gettextFromC", "m"));
 		put_depth(b, dive->maxdepth, pre, post);
-		snprintf(pre, sizeof(pre), "<p>%s ", translate("gettextFromC", "Air temp.:"));
-		put_HTML_airtemp(b, dive, pre, "</p>");
-		snprintf(pre, sizeof(pre), "<p>%s ", translate("gettextFromC", "Water temp.:"));
-		put_HTML_watertemp(b, dive, pre, "</p>");
+		put_string(b, "<p> ");
+		put_HTML_quoted(b, translate("gettextFromC", "Air temp.:"));
+		put_HTML_airtemp(b, dive, " ", "</p>");
+		put_string(b, "<p> ");
+		put_HTML_quoted(b, translate("gettextFromC", "Water temp.:"));
+		put_HTML_watertemp(b, dive, " ", "</p>");
 		snprintf(pre, sizeof(pre), "<p>%s <b>", translate("gettextFromC", "Location:"));
 		put_string(b, pre);
 		put_HTML_quoted(b, dive->location);
-- 
1.9.1

_______________________________________________
subsurface mailing list
[email protected]
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface

Reply via email to