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:
Gehad elrobey 2014-08-04 14:02:16 +03:00 committed by Dirk Hohndel
parent 4b22b74091
commit 93a15d471c
3 changed files with 27 additions and 21 deletions

View file

@ -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,6 +141,7 @@ void DiveLogExportDialog::exportHTMLstatistics(const QString &filename)
QTextStream out(&file);
int i = 0;
out << "divestat=[";
if (ui->exportStatistics->isChecked()) {
while (stats_yearly != NULL && stats_yearly[i].period) {
out << "{";
out << "\"YEAR\":\"" << stats_yearly[i].period << "\",";
@ -160,6 +162,7 @@ void DiveLogExportDialog::exportHTMLstatistics(const QString &filename)
out << "},";
i++;
}
}
out << "]";
file.close();
}

View file

@ -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>

View file

@ -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;