mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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>
This commit is contained in:
parent
4b22b74091
commit
93a15d471c
3 changed files with 27 additions and 21 deletions
|
@ -93,6 +93,7 @@ void DiveLogExportDialog::exportHtmlInit(const QString &filename)
|
||||||
|
|
||||||
exportHTMLsettings(json_settings);
|
exportHTMLsettings(json_settings);
|
||||||
exportHTMLstatistics(stat_file);
|
exportHTMLstatistics(stat_file);
|
||||||
|
|
||||||
export_HTML(json_dive_data.toUtf8().data(), photos_directory.toUtf8().data(), ui->exportSelectedDives->isChecked(), ui->exportListOnly->isChecked());
|
export_HTML(json_dive_data.toUtf8().data(), photos_directory.toUtf8().data(), ui->exportSelectedDives->isChecked(), ui->exportListOnly->isChecked());
|
||||||
|
|
||||||
QString searchPath = getSubsurfaceDataPath("theme");
|
QString searchPath = getSubsurfaceDataPath("theme");
|
||||||
|
@ -140,25 +141,27 @@ void DiveLogExportDialog::exportHTMLstatistics(const QString &filename)
|
||||||
QTextStream out(&file);
|
QTextStream out(&file);
|
||||||
int i = 0;
|
int i = 0;
|
||||||
out << "divestat=[";
|
out << "divestat=[";
|
||||||
while (stats_yearly != NULL && stats_yearly[i].period) {
|
if (ui->exportStatistics->isChecked()) {
|
||||||
out << "{";
|
while (stats_yearly != NULL && stats_yearly[i].period) {
|
||||||
out << "\"YEAR\":\"" << stats_yearly[i].period << "\",";
|
out << "{";
|
||||||
out << "\"DIVES\":\"" << stats_yearly[i].selection_size << "\",";
|
out << "\"YEAR\":\"" << stats_yearly[i].period << "\",";
|
||||||
out << "\"TOTAL_TIME\":\"" << get_time_string(stats_yearly[i].total_time.seconds, 0) << "\",";
|
out << "\"DIVES\":\"" << stats_yearly[i].selection_size << "\",";
|
||||||
out << "\"AVERAGE_TIME\":\"" << get_minutes(stats_yearly[i].total_time.seconds / stats_yearly[i].selection_size) << "\",";
|
out << "\"TOTAL_TIME\":\"" << get_time_string(stats_yearly[i].total_time.seconds, 0) << "\",";
|
||||||
out << "\"SHORTEST_TIME\":\"" << get_minutes(stats_yearly[i].shortest_time.seconds) << "\",";
|
out << "\"AVERAGE_TIME\":\"" << get_minutes(stats_yearly[i].total_time.seconds / stats_yearly[i].selection_size) << "\",";
|
||||||
out << "\"LONGEST_TIME\":\"" << get_minutes(stats_yearly[i].longest_time.seconds) << "\",";
|
out << "\"SHORTEST_TIME\":\"" << get_minutes(stats_yearly[i].shortest_time.seconds) << "\",";
|
||||||
out << "\"AVG_DEPTH\":\"" << get_depth_string(stats_yearly[i].avg_depth) << "\",";
|
out << "\"LONGEST_TIME\":\"" << get_minutes(stats_yearly[i].longest_time.seconds) << "\",";
|
||||||
out << "\"MIN_DEPTH\":\"" << get_depth_string(stats_yearly[i].min_depth) << "\",";
|
out << "\"AVG_DEPTH\":\"" << get_depth_string(stats_yearly[i].avg_depth) << "\",";
|
||||||
out << "\"MAX_DEPTH\":\"" << get_depth_string(stats_yearly[i].max_depth) << "\",";
|
out << "\"MIN_DEPTH\":\"" << get_depth_string(stats_yearly[i].min_depth) << "\",";
|
||||||
out << "\"AVG_SAC\":\"" << get_volume_string(stats_yearly[i].avg_sac) << "\",";
|
out << "\"MAX_DEPTH\":\"" << get_depth_string(stats_yearly[i].max_depth) << "\",";
|
||||||
out << "\"MIN_SAC\":\"" << get_volume_string(stats_yearly[i].min_sac) << "\",";
|
out << "\"AVG_SAC\":\"" << get_volume_string(stats_yearly[i].avg_sac) << "\",";
|
||||||
out << "\"MAX_SAC\":\"" << get_volume_string(stats_yearly[i].max_sac) << "\",";
|
out << "\"MIN_SAC\":\"" << get_volume_string(stats_yearly[i].min_sac) << "\",";
|
||||||
out << "\"AVG_TEMP\":\"" << QString::number(stats_yearly[i].combined_temp / stats_yearly[i].combined_count, 'f', 1) << "\",";
|
out << "\"MAX_SAC\":\"" << get_volume_string(stats_yearly[i].max_sac) << "\",";
|
||||||
out << "\"MIN_TEMP\":\"" << get_temp_units(stats_yearly[i].min_temp, NULL) << "\",";
|
out << "\"AVG_TEMP\":\"" << QString::number(stats_yearly[i].combined_temp / stats_yearly[i].combined_count, 'f', 1) << "\",";
|
||||||
out << "\"MAX_TEMP\":\"" << get_temp_units(stats_yearly[i].max_temp, NULL) << "\",";
|
out << "\"MIN_TEMP\":\"" << get_temp_units(stats_yearly[i].min_temp, NULL) << "\",";
|
||||||
out << "},";
|
out << "\"MAX_TEMP\":\"" << get_temp_units(stats_yearly[i].max_temp, NULL) << "\",";
|
||||||
i++;
|
out << "},";
|
||||||
|
i++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
out << "]";
|
out << "]";
|
||||||
file.close();
|
file.close();
|
||||||
|
|
|
@ -216,9 +216,9 @@
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0">
|
<item row="1" column="0">
|
||||||
<widget class="QCheckBox" name="checkBox_2">
|
<widget class="QCheckBox" name="exportStatistics">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Minimum Javascript</string>
|
<string>Export Yearly Statistics</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|
|
@ -121,6 +121,9 @@ window.onload=function(){
|
||||||
showAllDives();
|
showAllDives();
|
||||||
document.getElementById("divePanel").style.display='none';
|
document.getElementById("divePanel").style.display='none';
|
||||||
document.getElementById("diveStat").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.body.style.visibility='visible';
|
||||||
|
|
||||||
document.onkeydown = switchDives;
|
document.onkeydown = switchDives;
|
||||||
|
|
Loading…
Add table
Reference in a new issue