diff options
author | Miika Turkia <miika.turkia@gmail.com> | 2014-04-26 10:55:41 +0300 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2014-04-26 17:20:32 -0700 |
commit | f6be4ccf226da8a8f5326ac742d2cebd83d599e9 (patch) | |
tree | a6a89c6cc77ab6735704cbe32432922f3830372a /qt-ui | |
parent | 2b559225d6ea480e1a5023900b8498b37fadf861 (diff) | |
download | subsurface-f6be4ccf226da8a8f5326ac742d2cebd83d599e9.tar.gz |
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 <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui')
-rw-r--r-- | qt-ui/divelistview.cpp | 2 | ||||
-rw-r--r-- | qt-ui/mainwindow.cpp | 12 | ||||
-rw-r--r-- | qt-ui/mainwindow.h | 1 | ||||
-rw-r--r-- | qt-ui/mainwindow.ui | 42 |
4 files changed, 37 insertions, 20 deletions
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 @@ </property> </widget> </item> - <item row="7" column="0"> - <widget class="QToolButton" name="profHR"> - <property name="toolTip"> - <string>Show/hide heart rate</string> - </property> - <property name="text"> - <string>...</string> - </property> + <item row="7" column="0"> + <widget class="QToolButton" name="profHR"> + <property name="toolTip"> + <string>Show/hide heart rate</string> + </property> + <property name="text"> + <string>...</string> + </property> <property name="icon"> <iconset resource="../subsurface.qrc"> <normaloff>:/icon_HR</normaloff>:/icon_HR</iconset> @@ -312,14 +312,14 @@ <height>24</height> </size> </property> - <property name="checkable"> - <bool>true</bool> - </property> - <property name="autoRaise"> - <bool>true</bool> - </property> - </widget> - </item> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="autoRaise"> + <bool>true</bool> + </property> + </widget> + </item> <item row="8" column="0"> <widget class="QToolButton" name="profMod"> <property name="toolTip"> @@ -475,7 +475,7 @@ <bool>true</bool> </property> </widget> - </item> + </item> <item row="0" column="1" rowspan="15"> <widget class="ProfileWidget2" name="newProfile"/> </item> @@ -577,6 +577,7 @@ <addaction name="separator"/> <addaction name="actionClose"/> <addaction name="actionExportUDDF"/> + <addaction name="actionExport_CSV"/> <addaction name="actionExportHTMLworldmap"/> <addaction name="actionPrint"/> <addaction name="actionPreferences"/> @@ -709,7 +710,7 @@ <string>Ctrl+U</string> </property> </action> - <action name="actionExportHTMLworldmap"> + <action name="actionExportHTMLworldmap"> <property name="text"> <string>Export HTML World Map</string> </property> @@ -945,6 +946,11 @@ <string>&Check for Updates</string> </property> </action> + <action name="actionExport_CSV"> + <property name="text"> + <string>Export CSV</string> + </property> + </action> </widget> <customwidgets> <customwidget> |