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>
This commit is contained in:
Miika Turkia 2014-04-26 10:55:41 +03:00 committed by Dirk Hohndel
parent 2b559225d6
commit f6be4ccf22
7 changed files with 47 additions and 28 deletions

View file

@ -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");
}

View file

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

View file

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

View file

@ -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>&amp;Check for Updates</string>
</property>
</action>
<action name="actionExport_CSV">
<property name="text">
<string>Export CSV</string>
</property>
</action>
</widget>
<customwidgets>
<customwidget>