summaryrefslogtreecommitdiffstats
path: root/desktop-widgets
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2018-06-09 16:24:39 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2018-06-09 17:11:29 +0200
commit4e8079f5271117a37b78b48a563d7396c2425f34 (patch)
tree74a2a81aee89bede3e5c75c868acc8da759cd60f /desktop-widgets
parent64c0881e9f529d5220e8ac27ad0a78018773449c (diff)
downloadsubsurface-4e8079f5271117a37b78b48a563d7396c2425f34.tar.gz
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 <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'desktop-widgets')
-rw-r--r--desktop-widgets/divelistview.h2
-rw-r--r--desktop-widgets/mainwindow.cpp24
-rw-r--r--desktop-widgets/mainwindow.h1
3 files changed, 13 insertions, 14 deletions
diff --git a/desktop-widgets/divelistview.h b/desktop-widgets/divelistview.h
index 7d3b78cc1..47b9b5aeb 100644
--- a/desktop-widgets/divelistview.h
+++ b/desktop-widgets/divelistview.h
@@ -35,6 +35,7 @@ public:
void restoreSelection();
void contextMenuEvent(QContextMenuEvent *event);
QList<dive_trip_t *> selectedTrips();
+ static QString lastUsedImageDir();
public
slots:
void toggleColumnVisibilityByIndex();
@@ -56,7 +57,6 @@ slots:
void shiftTimes();
void loadImages();
void loadWebImages();
- static QString lastUsedImageDir();
signals:
void currentDiveChanged(int divenr);
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;
diff --git a/desktop-widgets/mainwindow.h b/desktop-widgets/mainwindow.h
index 00ddd86b7..6c2b7c1f4 100644
--- a/desktop-widgets/mainwindow.h
+++ b/desktop-widgets/mainwindow.h
@@ -213,7 +213,6 @@ private:
void beginChangeState(CurrentState s);
void saveSplitterSizes();
void toggleCollapsible(bool toggle);
- QString lastUsedDir();
void updateLastUsedDir(const QString &s);
void registerApplicationState(const QByteArray& state, QWidget *topLeft, QWidget *topRight, QWidget *bottomLeft, QWidget *bottomRight);
void enterState(CurrentState);