smtk_import: remove QSettings

Update smtk_import to use qPrefDisplay (amended variable)

Signed-off-by: Jan Iversen <jani@apache.org>
This commit is contained in:
jan Iversen 2018-08-18 20:07:35 +02:00 committed by Dirk Hohndel
parent 31eb48c3c2
commit 3436734bb9

View file

@ -4,9 +4,9 @@
#include "qt-models/filtermodels.h" #include "qt-models/filtermodels.h"
#include "core/dive.h" #include "core/dive.h"
#include "core/divelist.h" #include "core/divelist.h"
#include "core/settings/qPrefDisplay.h"
#include <QFileDialog> #include <QFileDialog>
#include <QFileInfo> #include <QFileInfo>
#include <QSettings>
#include <QDebug> #include <QDebug>
QStringList inputFiles; QStringList inputFiles;
@ -37,21 +37,16 @@ Smrtk2ssrfcWindow::~Smrtk2ssrfcWindow()
static QString lastUsedDir() static QString lastUsedDir()
{ {
QSettings settings;
QString lastDir = QDir::homePath(); QString lastDir = QDir::homePath();
settings.beginGroup("FileDialog"); if (QDir(qPrefDisplay::lastDir()).exists())
if (settings.contains("LastDir")) lastDir = qPrefDisplay::lastDir();
if (QDir(settings.value("LastDir").toString()).exists())
lastDir = settings.value("LastDir").toString();
return lastDir; return lastDir;
} }
void Smrtk2ssrfcWindow::updateLastUsedDir(const QString &dir) void Smrtk2ssrfcWindow::updateLastUsedDir(const QString &dir)
{ {
QSettings s; qPrefDisplay::set_lastDir(dir);
s.beginGroup("FileDialog");
s.setValue("LastDir", dir);
} }
void Smrtk2ssrfcWindow::on_inputFilesButton_clicked() void Smrtk2ssrfcWindow::on_inputFilesButton_clicked()