Scanframe Modular Application 0.1.0
Loading...
Searching...
No Matches
ApplicationSettings.h
Go to the documentation of this file.
1#pragma once
2#include "qt_utils.h"
3#include <QFileInfo>
4#include <QFileSystemWatcher>
5#include <QSettings>
6#include <QTreeView>
7
8namespace sf
9{
10
17class _MISC_CLASS ApplicationSettings final : public QObject
18{
19 Q_OBJECT
20
21 public:
25 explicit ApplicationSettings(QObject* parent = nullptr);
26
31
37 void setFilepath(const QString& filepath, bool watch = false);
38
42 QSettings getSettings() const;
43
47 [[nodiscard]] const QFileInfo& fileInfo() const;
48
54 void restoreWindowRect(const QString& win_name, QWidget* window) const;
55
61 void saveWindowRect(const QString& win_name, QWidget* window) const;
62
68 void restoreTreeViewColumns(const QString& name, const QTreeView* tv) const;
69
75 void saveTreeViewColumns(const QString& name, const QTreeView* tv) const;
76
82
83 private Q_SLOTS:
87 void onFileChance(const QString& file);
88
89 private:
90 struct Private;
91 Private* _p;
92};
93
94}// namespace sf
Keeps the application up-to-date with changes in the settings file.
Definition ApplicationSettings.h:18
void restoreTreeViewColumns(const QString &name, const QTreeView *tv) const
Restores column widths of a QTreeView,.
void saveTreeViewColumns(const QString &name, const QTreeView *tv) const
Saves column widths of a QTreeView,.
QSettings getSettings() const
Gets a QSettings instance using the set file path.
void restoreWindowRect(const QString &win_name, QWidget *window) const
Sets the window position and size from the settings file onto the passed widget.
~ApplicationSettings() override
Destructor.
void setFilepath(const QString &filepath, bool watch=false)
Sets the fileInfo using the filepath.
static ApplicationSettings & global()
Gets the application settings reference to the global app settings when created.
const QFileInfo & fileInfo() const
Gets the fileInfo.
ApplicationSettings(QObject *parent=nullptr)
Constructor.
void saveWindowRect(const QString &win_name, QWidget *window) const
Sets the window position and size from the settings file onto the passed widget.
#define _MISC_CLASS
Definition misc/global.h:40
Definition Application.h:10