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 | |
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')
-rw-r--r-- | qt-ui/divelistview.cpp | 15 | ||||
-rw-r--r-- | qt-ui/divelistview.h | 1 | ||||
-rw-r--r-- | qt-ui/mainwindow.cpp | 8 |
3 files changed, 22 insertions, 2 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); +} diff --git a/qt-ui/divelistview.h b/qt-ui/divelistview.h index 9e0713b49..c1222abdf 100644 --- a/qt-ui/divelistview.h +++ b/qt-ui/divelistview.h @@ -41,6 +41,7 @@ public slots: void mergeTripBelow(); void mergeDives(); void saveSelectedDivesAs(); + void exportSelectedDivesAsUDDF(); signals: void currentDiveChanged(int divenr); diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp index 72dc1a00e..69cf363c3 100644 --- a/qt-ui/mainwindow.cpp +++ b/qt-ui/mainwindow.cpp @@ -189,7 +189,13 @@ void MainWindow::on_actionImport_triggered() void MainWindow::on_actionExportUDDF_triggered() { - qDebug("actionExportUDDF"); + 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(), false); } void MainWindow::on_actionPrint_triggered() |