diff options
author | Miika Turkia <miika.turkia@gmail.com> | 2013-10-19 20:35:36 +0300 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2013-10-20 15:26:02 +0200 |
commit | 3e485113185bf230ee408e921de958dfa804fc0e (patch) | |
tree | 4c388c92cb54e3b918844fdb154964f9efb3eb13 /qt-ui/divelistview.cpp | |
parent | bdedf46e4c53e6b8e8134c4ab465b32ae1043e2e (diff) | |
download | subsurface-3e485113185bf230ee408e921de958dfa804fc0e.tar.gz |
Export dives in UDDF format
Implement exporting in UDDF format as was done in Gtk version. File menu
exports all the dives, right click on selection exports the selected
ones.
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/divelistview.cpp')
-rw-r--r-- | qt-ui/divelistview.cpp | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/qt-ui/divelistview.cpp b/qt-ui/divelistview.cpp index 19fc51a5d..e64ad217b 100644 --- a/qt-ui/divelistview.cpp +++ b/qt-ui/divelistview.cpp @@ -411,8 +411,10 @@ void DiveListView::contextMenuEvent(QContextMenuEvent *event) popup.addAction(tr("delete dive"), this, SLOT(deleteDive())); if (amount_selected > 1 && consecutive_selected()) popup.addAction(tr("merge selected dives"), this, SLOT(mergeDives())); - if (amount_selected >= 1) + if (amount_selected >= 1) { popup.addAction(tr("save As"), this, SLOT(saveSelectedDivesAs())); + popup.addAction(tr("export As UDDF"), this, SLOT(exportSelectedDivesAsUDDF())); + } // "collapse all" really closes all trips, // "collapse" keeps the trip with the selected dive open QAction * actionTaken = popup.exec(event->globalPos()); @@ -450,3 +452,14 @@ void DiveListView::saveSelectedDivesAs() QByteArray bt = fileName.toLocal8Bit(); save_dives_logic(bt.data(), TRUE); } + +void DiveListView::exportSelectedDivesAsUDDF() +{ + QString filename; + QFileInfo fi(system_default_filename()); + + filename = QFileDialog::getSaveFileName(this, tr("Save File as"), fi.absolutePath(), + tr("UDDF files (*.uddf *.UDDF)")); + if (!filename.isNull() && !filename.isEmpty()) + export_dives_uddf((const char *)filename.toStdString().c_str(), true); +} |