diff options
Diffstat (limited to 'desktop-widgets/divelogexportdialog.cpp')
| -rw-r--r-- | desktop-widgets/divelogexportdialog.cpp | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/desktop-widgets/divelogexportdialog.cpp b/desktop-widgets/divelogexportdialog.cpp index bf01b0e9f..2dbbe3817 100644 --- a/desktop-widgets/divelogexportdialog.cpp +++ b/desktop-widgets/divelogexportdialog.cpp @@ -12,6 +12,7 @@ #include "desktop-widgets/subsurfacewebservices.h" #include "core/worldmap-save.h" #include "core/save-html.h" +#include "core/settings/qPrefDisplay.h" #include "desktop-widgets/mainwindow.h" #include "profile-widget/profilewidget2.h" #include "core/dive.h" // Allows access to helper functions in TeX export. @@ -121,15 +122,10 @@ void DiveLogExportDialog::on_buttonBox_accepted() { QString filename; QString stylesheet; - QSettings settings; QString lastDir = QDir::homePath(); - settings.beginGroup("FileDialog"); - if (settings.contains("LastDir")) { - if (QDir(settings.value("LastDir").toString()).exists()) - lastDir = settings.value("LastDir").toString(); - } - settings.endGroup(); + if (QDir(qPrefDisplay::lastDir()).exists()) + lastDir = qPrefDisplay::lastDir(); switch (ui->tabWidget->currentIndex()) { case 0: @@ -184,9 +180,7 @@ void DiveLogExportDialog::on_buttonBox_accepted() if (!filename.isNull() && !filename.isEmpty()) { // remember the last export path QFileInfo fileInfo(filename); - settings.beginGroup("FileDialog"); - settings.setValue("LastDir", fileInfo.dir().path()); - settings.endGroup(); + qPrefDisplay::set_lastDir(fileInfo.dir().path()); // the non XSLT exports are called directly above, the XSLT based ons are called here if (!stylesheet.isEmpty()) { future = QtConcurrent::run(export_dives_xslt, filename.toUtf8(), ui->exportSelected->isChecked(), ui->CSVUnits_2->currentIndex(), stylesheet.toUtf8()); @@ -351,10 +345,10 @@ void DiveLogExportDialog::export_TeX(const char *filename, const bool selected_o if (is_cylinder_used(dive, i) || (prefs.display_unused_tanks && dive->cylinder[i].type.description)){ put_format(&buf, "\\def\\cyl%cdescription{%s}\n", 'a' + i, dive->cylinder[i].type.description); - put_format(&buf, "\\def\\cyl%cgasname{%s}\n", 'a' + i, gasname(&dive->cylinder[i].gasmix)); - put_format(&buf, "\\def\\cyl%cmixO2{%.1f\\%%}\n", 'a' + i, get_o2(&dive->cylinder[i].gasmix)/10.0); - put_format(&buf, "\\def\\cyl%cmixHe{%.1f\\%%}\n", 'a' + i, get_he(&dive->cylinder[i].gasmix)/10.0); - put_format(&buf, "\\def\\cyl%cmixN2{%.1f\\%%}\n", 'a' + i, (100.0 - (get_o2(&dive->cylinder[i].gasmix)/10.0) - (get_he(&dive->cylinder[i].gasmix)/10.0))); + put_format(&buf, "\\def\\cyl%cgasname{%s}\n", 'a' + i, gasname(dive->cylinder[i].gasmix)); + put_format(&buf, "\\def\\cyl%cmixO2{%.1f\\%%}\n", 'a' + i, get_o2(dive->cylinder[i].gasmix)/10.0); + put_format(&buf, "\\def\\cyl%cmixHe{%.1f\\%%}\n", 'a' + i, get_he(dive->cylinder[i].gasmix)/10.0); + put_format(&buf, "\\def\\cyl%cmixN2{%.1f\\%%}\n", 'a' + i, (100.0 - (get_o2(dive->cylinder[i].gasmix)/10.0) - (get_he(dive->cylinder[i].gasmix)/10.0))); delta_p.mbar += dive->cylinder[i].start.mbar - dive->cylinder[i].end.mbar; put_format(&buf, "\\def\\cyl%cstartpress{%.1f\\pressureunit}\n", 'a' + i, get_pressure_units(dive->cylinder[i].start.mbar, &unit)/1.0); put_format(&buf, "\\def\\cyl%cendpress{%.1f\\pressureunit}\n", 'a' + i, get_pressure_units(dive->cylinder[i].end.mbar, &unit)/1.0); |