From 27927f74a1b11ed76580059443e9d4f963df0513 Mon Sep 17 00:00:00 2001 From: Doug Junkins Date: Sat, 6 Apr 2019 12:05:18 -0700 Subject: Add export option to export dive sites. Selecting "Selected dives" exports the dive sites for the selected dives. Selecting "All dives" exports all dive sites. XML format is the subsection of the divelog XML that describes the sites headed with a section like: Signed-off-by: Doug Junkins --- desktop-widgets/divelogexportdialog.cpp | 11 ++ desktop-widgets/divelogexportdialog.ui | 284 +++++++++++++++++--------------- 2 files changed, 158 insertions(+), 137 deletions(-) (limited to 'desktop-widgets') diff --git a/desktop-widgets/divelogexportdialog.cpp b/desktop-widgets/divelogexportdialog.cpp index 87f2e5597..4fef543a0 100644 --- a/desktop-widgets/divelogexportdialog.cpp +++ b/desktop-widgets/divelogexportdialog.cpp @@ -91,6 +91,8 @@ void DiveLogExportDialog::showExplanation() ui->description->setText(tr("HTML export of the dive locations, visualized on a world map.")); } else if (ui->exportSubsurfaceXML->isChecked()) { ui->description->setText(tr("Subsurface native XML format.")); + } else if (ui->exportSubsurfaceSitesXML->isChecked()) { + ui->description->setText(tr("Subsurface dive sites native XML format.")); } else if (ui->exportImageDepths->isChecked()) { ui->description->setText(tr("Write depths of images to file.")); } else if (ui->exportTeX->isChecked()) { @@ -166,6 +168,15 @@ void DiveLogExportDialog::on_buttonBox_accepted() QByteArray bt = QFile::encodeName(filename); save_dives_logic(bt.data(), ui->exportSelected->isChecked(), ui->anonymize->isChecked()); } + } else if (ui->exportSubsurfaceSitesXML->isChecked()) { + filename = QFileDialog::getSaveFileName(this, tr("Export Subsurface dive sites XML"), lastDir, + tr("Subsurface files") + " (*.xml)"); + if (!filename.isNull() && !filename.isEmpty()) { + if (!filename.contains('.')) + filename.append(".xml"); + QByteArray bt = QFile::encodeName(filename); + save_dive_sites_logic(bt.data(), ui->exportSelected->isChecked(), ui->anonymize->isChecked()); + } } else if (ui->exportImageDepths->isChecked()) { filename = QFileDialog::getSaveFileName(this, tr("Save image depths"), lastDir); if (!filename.isNull() && !filename.isEmpty()) diff --git a/desktop-widgets/divelogexportdialog.ui b/desktop-widgets/divelogexportdialog.ui index 07b06378b..3b15f348e 100644 --- a/desktop-widgets/divelogexportdialog.ui +++ b/desktop-widgets/divelogexportdialog.ui @@ -56,34 +56,6 @@ 0 - - - - - 0 - 0 - - - - - 0 - 50 - - - - - 16777215 - 50 - - - - - - - true - - - @@ -97,6 +69,117 @@ + + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + 0 + 0 + + + + + 0 + 100 + + + + + 16777215 + 16777215 + + + + Selection + + + + + + true + + + Selected dives + + + true + + + + + + + All dives + + + + + + + + + + true + + + Options + + + + false + + + + 10 + 30 + 102 + 27 + + + + + Metric + + + + + Imperial + + + + + + + 10 + 70 + 111 + 20 + + + + Anonymize + + + + + + + @@ -122,6 +205,16 @@ + + + + Subsurface dive sites XML + + + exportGroup + + + @@ -244,115 +337,32 @@ - - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - 0 - 0 - - - - - 0 - 100 - - - - - 16777215 - 16777215 - - - - Selection - - - - - - true - - - Selected dives - - - true - - - - - - - All dives - - - - - - - - - - true - - - Options - - - - false - - - - 10 - 30 - 102 - 27 - - - - - Metric - - - - - Imperial - - - - - - - 10 - 70 - 111 - 20 - - - - Anonymize - - - - - + + + + + 0 + 0 + + + + + 0 + 50 + + + + + 16777215 + 50 + + + + + + + true + -- cgit v1.2.3-70-g09d2