From 19e22e1bb76d942ae17a5515c5d635a7d63f70e9 Mon Sep 17 00:00:00 2001 From: Gehad elrobey Date: Wed, 21 May 2014 15:23:05 +0300 Subject: Add ability to export only selected dives in worldmap exporter This patch adds the ability to export selected dives only in the worldmap exporter. After Miika added the export dialog in commit 7dc642860def ("Implementing export dialog") and exporting only selected dives became a choice while exporting. Signed-off-by: Gehad elrobey Signed-off-by: Dirk Hohndel --- qt-ui/divelogexportdialog.cpp | 8 +------- worldmap-save.c | 20 +++++++++++--------- worldmap-save.h | 2 +- 3 files changed, 13 insertions(+), 17 deletions(-) diff --git a/qt-ui/divelogexportdialog.cpp b/qt-ui/divelogexportdialog.cpp index 3ac9638ad..73f90678f 100644 --- a/qt-ui/divelogexportdialog.cpp +++ b/qt-ui/divelogexportdialog.cpp @@ -40,13 +40,7 @@ void DiveLogExportDialog::on_buttonBox_accepted() filename = QFileDialog::getSaveFileName(this, tr("Export World Map"), fi.absolutePath(), tr("HTML files (*.html)")); if (!filename.isNull() && !filename.isEmpty()) - export_worldmap_HTML(filename.toUtf8().data()); - return; - } else if (ui->exportWorldMap->isChecked()) { - filename = QFileDialog::getSaveFileName(this, tr("Export World Map"), fi.absolutePath(), - tr("HTML files (*.html)")); - if (!filename.isNull() && !filename.isEmpty()) - export_worldmap_HTML(filename.toUtf8().data()); + export_worldmap_HTML(filename.toUtf8().data(), ui->exportSelected->isChecked()); return; } diff --git a/worldmap-save.c b/worldmap-save.c index e867846f5..21a0810b1 100644 --- a/worldmap-save.c +++ b/worldmap-save.c @@ -83,14 +83,16 @@ void put_HTML_notes(struct membuffer *b, struct dive *dive) } } -void writeMarkers(struct membuffer *b) +void writeMarkers(struct membuffer *b, const bool selected_only) { int i, dive_no = 0; struct dive *dive; for_each_dive(i, dive) { - /*export selected dives only ?*/ - + if (selected_only) { + if (!dive->selected) + continue; + } if (dive->latitude.udeg == 0 && dive->longitude.udeg == 0) continue; @@ -120,7 +122,7 @@ void insert_css(struct membuffer *b) put_format(b, "\n", css); } -void insert_javascript(struct membuffer *b) +void insert_javascript(struct membuffer *b, const bool selected_only) { put_string(b, "