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
45 QSettings* getNewSettings(QObject* parent = nullptr) const;
46
50 QSettings getSettings(QObject* parent = nullptr) const;
51
55 [[nodiscard]] const QFileInfo& fileInfo() const;
56
63 void storeWindowRect(QAnyStringView win_name, QWidget* window, bool read) const;
64
68 const QIcon& getIcon() const;
69
75
76 private Q_SLOTS:
80 void onFileChance(const QString& file);
81
82 private:
83 struct Private;
84 Private* _p;
85};
86
87}// namespace sf
Keeps the application up-to-date with changes in the settings file.
Definition ApplicationSettings.h:18
QSettings getSettings(QObject *parent=nullptr) const
Gets a QSettings instance using the set file path.
const QIcon & getIcon() const
Gets the application icon.
~ApplicationSettings() override
Destructor.
void setFilepath(const QString &filepath, bool watch=false)
Sets the fileInfo using the filepath.
QSettings * getNewSettings(QObject *parent=nullptr) const
Gets a new QSettings instance using the set file path. The when no parent is given the object should ...
static ApplicationSettings & global()
Gets the application settings reference to the global app settings when created.
const QFileInfo & fileInfo() const
Gets the fileInfo on the set file path.
ApplicationSettings(QObject *parent=nullptr)
Qt Constructor.
void storeWindowRect(QAnyStringView win_name, QWidget *window, bool read) const
Stores or restores 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