From f6be4ccf226da8a8f5326ac742d2cebd83d599e9 Mon Sep 17 00:00:00 2001 From: Miika Turkia Date: Sat, 26 Apr 2014 10:55:41 +0300 Subject: Add GUI support for exporting in CSV format This patch adds an item to File menu to export all dives in CSV format. Naturally this includes also the code to perform the export. Fixes #434 Signed-off-by: Miika Turkia Signed-off-by: Dirk Hohndel --- qt-ui/divelistview.cpp | 2 +- qt-ui/mainwindow.cpp | 12 +++++++++++- qt-ui/mainwindow.h | 1 + qt-ui/mainwindow.ui | 42 ++++++++++++++++++++++++------------------ 4 files changed, 37 insertions(+), 20 deletions(-) (limited to 'qt-ui') diff --git a/qt-ui/divelistview.cpp b/qt-ui/divelistview.cpp index a3e2e5cf8..cbabdcffe 100644 --- a/qt-ui/divelistview.cpp +++ b/qt-ui/divelistview.cpp @@ -813,7 +813,7 @@ void DiveListView::exportSelectedDivesAsUDDF() filename = QFileDialog::getSaveFileName(this, tr("Export UDDF File as"), fi.absolutePath(), tr("UDDF files (*.uddf *.UDDF)")); if (!filename.isNull() && !filename.isEmpty()) - export_dives_uddf(filename.toUtf8(), true); + export_dives_xslt(filename.toUtf8(), true, "uddf-export.xslt"); } diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp index f93ad2d23..5e8459ecd 100644 --- a/qt-ui/mainwindow.cpp +++ b/qt-ui/mainwindow.cpp @@ -280,7 +280,17 @@ void MainWindow::on_actionExportUDDF_triggered() QString filename = QFileDialog::getSaveFileName(this, tr("Export UDDF File as"), fi.absolutePath(), tr("UDDF files (*.uddf *.UDDF)")); if (!filename.isNull() && !filename.isEmpty()) - export_dives_uddf(filename.toUtf8(), false); + export_dives_xslt(filename.toUtf8(), false, "uddf-export.xslt"); +} + +void MainWindow::on_actionExport_CSV_triggered() +{ + QFileInfo fi(system_default_filename()); + QString filename = QFileDialog::getSaveFileName(this, tr("Export CSV File as"), fi.absolutePath(), + tr("CSV files (*.csv *.CSV)")); + + if (!filename.isNull() && !filename.isEmpty()) + export_dives_xslt(filename.toUtf8(), false, "xml2csv.xslt"); } void MainWindow::on_actionExportHTMLworldmap_triggered() diff --git a/qt-ui/mainwindow.h b/qt-ui/mainwindow.h index 40d32b5e5..60081e957 100644 --- a/qt-ui/mainwindow.h +++ b/qt-ui/mainwindow.h @@ -91,6 +91,7 @@ slots: void on_actionSaveAs_triggered(); void on_actionClose_triggered(); void on_actionExportUDDF_triggered(); + void on_actionExport_CSV_triggered(); void on_actionExportHTMLworldmap_triggered(); void on_actionPrint_triggered(); void on_actionPreferences_triggered(); diff --git a/qt-ui/mainwindow.ui b/qt-ui/mainwindow.ui index a2621de9a..072d321fc 100644 --- a/qt-ui/mainwindow.ui +++ b/qt-ui/mainwindow.ui @@ -294,14 +294,14 @@ - - - - Show/hide heart rate - - - ... - + + + + Show/hide heart rate + + + ... + :/icon_HR:/icon_HR @@ -312,14 +312,14 @@ 24 - - true - - - true - - - + + true + + + true + + + @@ -475,7 +475,7 @@ true - + @@ -577,6 +577,7 @@ + @@ -709,7 +710,7 @@ Ctrl+U - + Export HTML World Map @@ -945,6 +946,11 @@ &Check for Updates + + + Export CSV + + -- cgit v1.2.3-70-g09d2