mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-30 22:20:21 +00:00
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>
This commit is contained in:
parent
64c0881e9f
commit
4e8079f527
5 changed files with 14 additions and 16 deletions
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -35,7 +35,7 @@ Smrtk2ssrfcWindow::~Smrtk2ssrfcWindow()
|
|||
delete ui;
|
||||
}
|
||||
|
||||
QString Smrtk2ssrfcWindow::lastUsedDir()
|
||||
static QString lastUsedDir()
|
||||
{
|
||||
QSettings settings;
|
||||
QString lastDir = QDir::homePath();
|
||||
|
|
|
@ -22,7 +22,6 @@ public:
|
|||
|
||||
private:
|
||||
Ui::Smrtk2ssrfcWindow *ui;
|
||||
QString lastUsedDir();
|
||||
QString filter();
|
||||
void updateLastUsedDir(const QString &s);
|
||||
void closeCurrentFile();
|
||||
|
|
Loading…
Reference in a new issue