summaryrefslogtreecommitdiffstats
path: root/desktop-widgets
diff options
context:
space:
mode:
authorGravatar jan Iversen <jani@apache.org>2018-08-18 20:00:55 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2018-08-25 11:49:47 -0700
commitc85f5c560cfd392049d64a2346073d1151098925 (patch)
tree78921db2397d9aa97021a1a93dd6b3eb5679179a /desktop-widgets
parent3436734bb9e12a4effa5cfe973a0e6d432cc78c9 (diff)
downloadsubsurface-c85f5c560cfd392049d64a2346073d1151098925.tar.gz
desktop-widget: remove QSettings
Update desktop-widget to use qPrefDisplay (amended variable) Signed-off-by: Jan Iversen <jani@apache.org>
Diffstat (limited to 'desktop-widgets')
-rw-r--r--desktop-widgets/divelogexportdialog.cpp14
-rw-r--r--desktop-widgets/mainwindow.cpp11
2 files changed, 7 insertions, 18 deletions
diff --git a/desktop-widgets/divelogexportdialog.cpp b/desktop-widgets/divelogexportdialog.cpp
index 93341dd20..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());
diff --git a/desktop-widgets/mainwindow.cpp b/desktop-widgets/mainwindow.cpp
index 62cbe7b28..ea5f31556 100644
--- a/desktop-widgets/mainwindow.cpp
+++ b/desktop-widgets/mainwindow.cpp
@@ -549,13 +549,10 @@ void MainWindow::on_actionNew_triggered()
static QString lastUsedDir()
{
- 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();
+ if (QDir(qPrefDisplay::lastDir()).exists())
+ lastDir = qPrefDisplay::lastDir();
return lastDir;
}
@@ -773,9 +770,7 @@ void MainWindow::on_actionClose_triggered()
void MainWindow::updateLastUsedDir(const QString &dir)
{
- QSettings s;
- s.beginGroup("FileDialog");
- s.setValue("LastDir", dir);
+ qPrefDisplay::set_lastDir(dir);
}
void MainWindow::on_actionPrint_triggered()