From 4e8079f5271117a37b78b48a563d7396c2425f34 Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Sat, 9 Jun 2018 16:24:39 +0200 Subject: Cleanup: make lastUsedDir() functions static and non-slot, respectively The lastUsedDir() functions of MainWindow and Smrtk2ssrfcWindow don't use any member-objects and are only used in their respective translation units. Therefore, remove them from the class and made of static linkage. The lastUsedImageDir() function was declared as a slog, which makes no sense. Make it a normal static function (though one might argue why it is assiociated with the DiveListView class in the first place). Signed-off-by: Berthold Stoeger --- desktop-widgets/mainwindow.cpp | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'desktop-widgets/mainwindow.cpp') diff --git a/desktop-widgets/mainwindow.cpp b/desktop-widgets/mainwindow.cpp index 087ccc228..3d984ab15 100644 --- a/desktop-widgets/mainwindow.cpp +++ b/desktop-widgets/mainwindow.cpp @@ -544,6 +544,18 @@ void MainWindow::on_actionNew_triggered() on_actionClose_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(); + return lastDir; +} + void MainWindow::on_actionOpen_triggered() { if (!okToClose(tr("Please save or cancel the current dive edit before opening a new file."))) @@ -784,18 +796,6 @@ void MainWindow::on_actionClose_triggered() } } -QString MainWindow::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(); - return lastDir; -} - void MainWindow::updateLastUsedDir(const QString &dir) { QSettings s; -- cgit v1.2.3-70-g09d2