QuasarAppLib
1.0.530.c9fba11
Toggle main menu visibility
settings.h
Go to the documentation of this file.
1
/*
2
* Copyright (C) 2021-2026 QuasarApp.
3
* Distributed under the lgplv3 software license, see the accompanying
4
* Everyone is permitted to copy and distribute verbatim copies
5
* of this license document, but changing it is not allowed.
6
*/
7
8
9
#ifndef SETTINGS_H
10
#define SETTINGS_H
11
12
#include "
quasarapp_global.h
"
13
#include "
isettings.h
"
14
#include <QSet>
15
#include <QSettings>
16
17
namespace
QuasarAppUtils
{
18
42
class
QUASARAPPSHARED_EXPORT
Settings
:
public
ISettings
43
{
44
Q_OBJECT
45
public
:
50
Settings
(QSettings::Format format = QSettings::IniFormat);
51
52
// ISettings interface
59
const
QSet<QString> &
boolOptions
()
const
;
60
67
void
setBoolOptions
(
const
QSet<QString> &newBoolOptions);
68
74
static
bool
initService
();
75
82
static
ISettings
*
autoInstance
();
83
84
85
protected
:
86
91
void
syncImplementation
()
override
;
98
QVariant
getValueImplementation
(
const
QString &key,
const
QVariant &def)
override
;
104
void
setValueImplementation
(
const
QString key,
const
QVariant &value)
override
;
109
bool
ignoreToRest
(
const
QString &)
const override
;
115
QHash<QString, QVariant>
defaultSettings
()
override
;
116
127
virtual
bool
isBool
(
const
QString& key)
const
;
133
void
setGroup
(
const
QString&);
134
135
private
:
137
QSettings *_settings =
nullptr
;
138
140
QSet<QString> _boolOptions;
141
};
142
143
}
144
145
#endif
// SETTINGS_H
QuasarAppUtils::ISettings::ISettings
ISettings(SettingsSaveMode mode=SettingsSaveMode::Auto)
Definition
isettings.cpp:15
QuasarAppUtils::Settings::ignoreToRest
bool ignoreToRest(const QString &) const override
ignoreToRest This method checks if the key is a boolean option.
Definition
settings.cpp:46
QuasarAppUtils::Settings::boolOptions
const QSet< QString > & boolOptions() const
boolOptions returns current map with keys that has a bool type.
Definition
settings.cpp:58
QuasarAppUtils::Settings::Settings
Settings(QSettings::Format format=QSettings::IniFormat)
Settings This is the main constructor of the Settings object.
Definition
settings.cpp:16
QuasarAppUtils::Settings::initService
static bool initService()
initService This method initialize default object of the QuasarAppUtils::Settings type.
Definition
settings.cpp:68
QuasarAppUtils::Settings::getValueImplementation
QVariant getValueImplementation(const QString &key, const QVariant &def) override
getValueImplementation This method returns the value of the key setting from the QSettings backend.
Definition
settings.cpp:34
QuasarAppUtils::Settings::isBool
virtual bool isBool(const QString &key) const
isBool This method should be return true if the key's type is bool. This is needed because QVariant w...
Definition
settings.cpp:54
QuasarAppUtils::Settings::defaultSettings
QHash< QString, QVariant > defaultSettings() override
defaultSettings This method returns the default map of the settings and their values....
Definition
settings.cpp:50
QuasarAppUtils::Settings::setBoolOptions
void setBoolOptions(const QSet< QString > &newBoolOptions)
setBoolOptions This method sets new map of the boolean options.
Definition
settings.cpp:63
QuasarAppUtils::Settings::autoInstance
static ISettings * autoInstance()
autoInstance This method returns the default object of the QuasarAppUtils::Settings type and if it wa...
Definition
settings.cpp:72
QuasarAppUtils::Settings::setGroup
void setGroup(const QString &)
setGroup This method sets a new settings group in the QSettings backend. All values that will be read...
QuasarAppUtils::Settings::setValueImplementation
void setValueImplementation(const QString key, const QVariant &value) override
setValueImplementation This method sets a new value for the key setting in the QSettings backend.
Definition
settings.cpp:42
QuasarAppUtils::Settings::syncImplementation
void syncImplementation() override
syncImplementation This method saves all settings data to the hard disk. This is the QSettings based ...
Definition
settings.cpp:30
isettings.h
QuasarAppUtils
The QuasarAppUtils namespace contains the base functions for all applications of the QuasarApp group....
Definition
crc32constexper.h:16
quasarapp_global.h
QUASARAPPSHARED_EXPORT
#define QUASARAPPSHARED_EXPORT
Definition
quasarapp_global.h:11
settings.h
Generated by
1.18.0