summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Gehad elrobey <gehadelrobey@gmail.com>2014-08-04 14:02:16 +0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-08-11 08:20:55 -0700
commit93a15d471c81efe57d32208c20129c5ac17e3b4a (patch)
tree11aba8e41c9753213c2794f393219806d9069434
parent4b22b740919b33228550ec2a9a24cfad5d90dcfc (diff)
downloadsubsurface-93a15d471c81efe57d32208c20129c5ac17e3b4a.tar.gz
HTML: Make export statistics optional.
Make exporting statistics to the HTML page optional. Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com> Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--qt-ui/divelogexportdialog.cpp41
-rw-r--r--qt-ui/divelogexportdialog.ui4
-rw-r--r--theme/dive_export.html3
3 files changed, 27 insertions, 21 deletions
diff --git a/qt-ui/divelogexportdialog.cpp b/qt-ui/divelogexportdialog.cpp
index 03bdaf9cb..0b6ab732e 100644
--- a/qt-ui/divelogexportdialog.cpp
+++ b/qt-ui/divelogexportdialog.cpp
@@ -93,6 +93,7 @@ void DiveLogExportDialog::exportHtmlInit(const QString &filename)
exportHTMLsettings(json_settings);
exportHTMLstatistics(stat_file);
+
export_HTML(json_dive_data.toUtf8().data(), photos_directory.toUtf8().data(), ui->exportSelectedDives->isChecked(), ui->exportListOnly->isChecked());
QString searchPath = getSubsurfaceDataPath("theme");
@@ -140,25 +141,27 @@ void DiveLogExportDialog::exportHTMLstatistics(const QString &filename)
QTextStream out(&file);
int i = 0;
out << "divestat=[";
- while (stats_yearly != NULL && stats_yearly[i].period) {
- out << "{";
- out << "\"YEAR\":\"" << stats_yearly[i].period << "\",";
- out << "\"DIVES\":\"" << stats_yearly[i].selection_size << "\",";
- out << "\"TOTAL_TIME\":\"" << get_time_string(stats_yearly[i].total_time.seconds, 0) << "\",";
- out << "\"AVERAGE_TIME\":\"" << get_minutes(stats_yearly[i].total_time.seconds / stats_yearly[i].selection_size) << "\",";
- out << "\"SHORTEST_TIME\":\"" << get_minutes(stats_yearly[i].shortest_time.seconds) << "\",";
- out << "\"LONGEST_TIME\":\"" << get_minutes(stats_yearly[i].longest_time.seconds) << "\",";
- out << "\"AVG_DEPTH\":\"" << get_depth_string(stats_yearly[i].avg_depth) << "\",";
- out << "\"MIN_DEPTH\":\"" << get_depth_string(stats_yearly[i].min_depth) << "\",";
- out << "\"MAX_DEPTH\":\"" << get_depth_string(stats_yearly[i].max_depth) << "\",";
- 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) << "\",";
- out << "},";
- i++;
+ if (ui->exportStatistics->isChecked()) {
+ while (stats_yearly != NULL && stats_yearly[i].period) {
+ out << "{";
+ out << "\"YEAR\":\"" << stats_yearly[i].period << "\",";
+ out << "\"DIVES\":\"" << stats_yearly[i].selection_size << "\",";
+ out << "\"TOTAL_TIME\":\"" << get_time_string(stats_yearly[i].total_time.seconds, 0) << "\",";
+ out << "\"AVERAGE_TIME\":\"" << get_minutes(stats_yearly[i].total_time.seconds / stats_yearly[i].selection_size) << "\",";
+ out << "\"SHORTEST_TIME\":\"" << get_minutes(stats_yearly[i].shortest_time.seconds) << "\",";
+ out << "\"LONGEST_TIME\":\"" << get_minutes(stats_yearly[i].longest_time.seconds) << "\",";
+ out << "\"AVG_DEPTH\":\"" << get_depth_string(stats_yearly[i].avg_depth) << "\",";
+ out << "\"MIN_DEPTH\":\"" << get_depth_string(stats_yearly[i].min_depth) << "\",";
+ out << "\"MAX_DEPTH\":\"" << get_depth_string(stats_yearly[i].max_depth) << "\",";
+ 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) << "\",";
+ out << "},";
+ i++;
+ }
}
out << "]";
file.close();
diff --git a/qt-ui/divelogexportdialog.ui b/qt-ui/divelogexportdialog.ui
index aeed08895..0e8ef4a42 100644
--- a/qt-ui/divelogexportdialog.ui
+++ b/qt-ui/divelogexportdialog.ui
@@ -216,9 +216,9 @@
</widget>
</item>
<item row="1" column="0">
- <widget class="QCheckBox" name="checkBox_2">
+ <widget class="QCheckBox" name="exportStatistics">
<property name="text">
- <string>Minimum Javascript</string>
+ <string>Export Yearly Statistics</string>
</property>
</widget>
</item>
diff --git a/theme/dive_export.html b/theme/dive_export.html
index 91b0ef749..065a8a4f1 100644
--- a/theme/dive_export.html
+++ b/theme/dive_export.html
@@ -121,6 +121,9 @@ window.onload=function(){
showAllDives();
document.getElementById("divePanel").style.display='none';
document.getElementById("diveStat").style.display='none';
+ if (divestat.length <= 0)
+ document.getElementById("stats_button").style.display='none';
+
document.body.style.visibility='visible';
document.onkeydown = switchDives;