Query and edit settings. More...
#include <bpssettings.h>
Public Types | |
enum | Scope { NoScope = 0x00000000 , LocalUserScope = 0x00000001 , LocalInstallScope = 0x00000002 , LocalSystemScope = 0x00000004 , CentralUserScope = 0x00000010 , CentralSystemScope = 0x00000020 , LocalScopes = LocalUserScope | LocalInstallScope | LocalSystemScope , CentralScopes = CentralUserScope | CentralSystemScope , AllScopes = LocalScopes | CentralScopes } |
Scope under which the settings are located. More... | |
Public Member Functions | |
QStringList | allGroups (Scopes aSearchedScopes=(Scopes) AllScopes) const |
Find all groups within the currently opened path. More... | |
QStringList | allKeys (Scopes aSearchedScopes=(Scopes) AllScopes) const |
Find all keys within the currently opened path. More... | |
BpsSettings (BpsDatastore *aDatastore, Scope aScope=BpsSettings::LocalUserScope, QObject *aParent=nullptr) | |
Constructor for the BpsSettings objects. More... | |
BpsSettings (Scope aScope=BpsSettings::LocalUserScope, QObject *aParent=nullptr) | |
Constructor for the BpsSettings objects. More... | |
void | close () |
Close the latest opened path. | |
void | closeAll () |
Close all currently opened paths. More... | |
QVariant | findValue (const QString &aKey, const QVariant &aDefValue=QVariant(), Scopes aSearchedScopes=(Scopes) AllScopes) const |
Find a value within the currently opened path. More... | |
bool | groupExists (const QString &aGroup) const |
Check if the group exists in the current scope. More... | |
QStringList | groups () const |
Query a list of all existing groups within the currently opened path. More... | |
Scope | groupScope (const QString &aName, Scopes aSearchedScopes=(Scopes) AllScopes) const |
Find the first scope of a group within the currently opened path. More... | |
bool | keyExists (const QString &aKey) const |
Check if the key exists in the current scope. More... | |
QStringList | keys () const |
Query a list of all existing keys in the currently opened group. More... | |
void | open (const QString &aPath) |
Open a new path. More... | |
void | removeGroup (const QString &aName) |
Remove a group from the currently opened path. More... | |
void | removeKey (const QString &aKey) |
Remove a key. More... | |
QString | root () const |
Get the current root. More... | |
Scope | scope () const |
void | setRoot (const QString &aRoot) |
Set a new root. More... | |
void | setScope (Scope aScope) |
Change the current scope. More... | |
void | setValue (const QString &aKey, const QVariant &aValue) |
Set a value within the currently opened path. More... | |
void | setValueMap (const QVariantMap &aMap) |
Removes any previously existing keys from the currently opened path and scope, and adds the values in the given map instead. More... | |
QVariant | value (const QString &aKey, const QVariant &aDefValue=QVariant()) const |
Get a value within the currently opened path. More... | |
QVariantMap | valueMap (Scopes aSearchedScopes=(Scopes) AllScopes) const |
Find all keys and values within the currently opened path. More... | |
![]() | |
bool | blockSignals (bool block) |
const QObjectList & | children () const const |
QMetaObject::Connection | connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const const |
void | deleteLater () |
void | destroyed (QObject *obj) |
bool | disconnect (const char *signal, const QObject *receiver, const char *method) const const |
bool | disconnect (const QObject *receiver, const char *method) const const |
void | dumpObjectInfo () |
void | dumpObjectInfo () const const |
void | dumpObjectTree () |
void | dumpObjectTree () const const |
QList< QByteArray > | dynamicPropertyNames () const const |
virtual bool | event (QEvent *e) |
virtual bool | eventFilter (QObject *watched, QEvent *event) |
T | findChild (const QString &name, Qt::FindChildOptions options) const const |
QList< T > | findChildren (const QRegExp ®Exp, Qt::FindChildOptions options) const const |
QList< T > | findChildren (const QRegularExpression &re, Qt::FindChildOptions options) const const |
QList< T > | findChildren (const QString &name, Qt::FindChildOptions options) const const |
bool | inherits (const char *className) const const |
void | installEventFilter (QObject *filterObj) |
bool | isWidgetType () const const |
bool | isWindowType () const const |
void | killTimer (int id) |
virtual const QMetaObject * | metaObject () const const |
void | moveToThread (QThread *targetThread) |
QString | objectName () const const |
void | objectNameChanged (const QString &objectName) |
QObject * | parent () const const |
QVariant | property (const char *name) const const |
Q_CLASSINFO (Name, Value) | |
Q_DISABLE_COPY (Class) | |
Q_DISABLE_COPY_MOVE (Class) | |
Q_DISABLE_MOVE (Class) | |
Q_EMIT Q_EMIT | |
Q_ENUM (...) | |
Q_ENUM_NS (...) | |
Q_ENUMS (...) | |
Q_FLAG (...) | |
Q_FLAG_NS (...) | |
Q_FLAGS (...) | |
Q_GADGET Q_GADGET | |
Q_INTERFACES (...) | |
Q_INVOKABLE Q_INVOKABLE | |
Q_NAMESPACE Q_NAMESPACE | |
Q_NAMESPACE_EXPORT (EXPORT_MACRO) | |
Q_OBJECT Q_OBJECT | |
Q_PROPERTY (...) | |
Q_REVISION Q_REVISION | |
Q_SET_OBJECT_NAME (Object) | |
Q_SIGNAL Q_SIGNAL | |
Q_SIGNALS Q_SIGNALS | |
Q_SLOT Q_SLOT | |
Q_SLOTS Q_SLOTS | |
T | qFindChild (const QObject *obj, const QString &name) |
QList< T > | qFindChildren (const QObject *obj, const QRegExp ®Exp) |
QList< T > | qFindChildren (const QObject *obj, const QString &name) |
QObject (QObject *parent) | |
T | qobject_cast (const QObject *object) |
T | qobject_cast (QObject *object) |
QT_NO_NARROWING_CONVERSIONS_IN_CONNECT QT_NO_NARROWING_CONVERSIONS_IN_CONNECT | |
void | removeEventFilter (QObject *obj) |
void | setObjectName (const QString &name) |
void | setParent (QObject *parent) |
bool | setProperty (const char *name, const QVariant &value) |
bool | signalsBlocked () const const |
int | startTimer (int interval, Qt::TimerType timerType) |
int | startTimer (std::chrono::milliseconds time, Qt::TimerType timerType) |
QThread * | thread () const const |
Additional Inherited Members | |
![]() | |
QMetaObject::Connection | connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type) |
QMetaObject::Connection | connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type) |
QMetaObject::Connection | connect (const QObject *sender, PointerToMemberFunction signal, const QObject *context, Functor functor, Qt::ConnectionType type) |
QMetaObject::Connection | connect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method, Qt::ConnectionType type) |
QMetaObject::Connection | connect (const QObject *sender, PointerToMemberFunction signal, Functor functor) |
bool | disconnect (const QMetaObject::Connection &connection) |
bool | disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method) |
bool | disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method) |
bool | disconnect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method) |
QString | tr (const char *sourceText, const char *disambiguation, int n) |
QString | trUtf8 (const char *sourceText, const char *disambiguation, int n) |
![]() | |
typedef | QObjectList |
![]() | |
virtual void | childEvent (QChildEvent *event) |
virtual void | connectNotify (const QMetaMethod &signal) |
virtual void | customEvent (QEvent *event) |
virtual void | disconnectNotify (const QMetaMethod &signal) |
bool | isSignalConnected (const QMetaMethod &signal) const const |
int | receivers (const char *signal) const const |
QObject * | sender () const const |
int | senderSignalIndex () const const |
virtual void | timerEvent (QTimerEvent *event) |
![]() | |
objectName | |
Query and edit settings.
enum BpsSettings::Scope |
Scope under which the settings are located.
The term "local machine" refers to the user workstation in fat client environments, however in terminal server environments it is the terminal server (citrix for example).
Enumerator | |
---|---|
NoScope | No valid scope. Used for example as result by groupScope(). |
LocalUserScope | Settings of the current operating system user on the local machine. On windows this is in the registry under HKCU/Software/IBK Software AG/BPS2 |
LocalInstallScope | Settings of the software installation on the locale machine. On windows this is the file bps.conf in the same directory as the executed program. For example when the currently executed program is located in C:\Programs\IBK Software AG\BPS2\bin, the settings are in file C:\Programs\IBK Software AG\BPS2\bin\bps.conf |
LocalSystemScope | Settings valid for all users on the local machine. On windows this is in the registry under HKLM/Software/IBK Software AG/BPS2 |
CentralUserScope | Central settings for the current bps user. The settings are located in the database table t_usersettings. |
CentralSystemScope | Central settings for all bps users. The settings are located in the database table t_settings. |
LocalScopes | All local scopes. Use only for parameters of type Scopes. |
CentralScopes | All central scopes. Use only for parameters of type Scopes. |
AllScopes | All scopes. Use only for parameters of type Scopes. |
BpsSettings::BpsSettings | ( | BpsDatastore * | aDatastore, |
Scope | aScope = BpsSettings::LocalUserScope , |
||
QObject * | aParent = nullptr |
||
) |
Constructor for the BpsSettings objects.
Use this constructor when directly accessing central settings, or the settings chain shall be searched up to CentralSystemScope by findValue().
aDatastore | The opened database connection. |
aScope | The scope to operate on. |
aParent | Pointer to parent object. |
BpsSettings::BpsSettings | ( | Scope | aScope = BpsSettings::LocalUserScope , |
QObject * | aParent = nullptr |
||
) |
Constructor for the BpsSettings objects.
Use this constructor when accessing local setting only.
aScope | The scope to operate on. |
aParent | Pointer to parent object. |
QStringList BpsSettings::allGroups | ( | Scopes | aSearchedScopes = (Scopes) AllScopes | ) | const |
Find all groups within the currently opened path.
Search begins at the current scope and goes up to CentralSystemScope. When using the constructor without datastore, the search stops at LocalSystemScope instead of CentralSystemScope. Group names found at multiple scopes are merged into one entry.
aSearchedScopes | Mask of scopes that shall be included in the search. |
QStringList BpsSettings::allKeys | ( | Scopes | aSearchedScopes = (Scopes) AllScopes | ) | const |
Find all keys within the currently opened path.
Search begins at the current scope and goes up to CentralSystemScope. When using the constructor without datastore, the search stops at LocalSystemScope instead of CentralSystemScope. Key names found at multiple scopes are merged into one entry.
aSearchedScopes | Mask of scopes that shall be included in the search. |
void BpsSettings::closeAll | ( | ) |
Close all currently opened paths.
The current location is set back to the root.
QVariant BpsSettings::findValue | ( | const QString & | aKey, |
const QVariant & | aDefValue = QVariant() , |
||
Scopes | aSearchedScopes = (Scopes) AllScopes |
||
) | const |
Find a value within the currently opened path.
If the value is not found in the current scope, the scope chain is searched up to CentralSystemScope for such a value. When still not found, the default will be returned. When using the constructor without datastore, the search stops at LocalSystemScope instead of CentralSystemScope.
aKey | The key of the value. |
aDefValue | Default value to return in case the key does not exist. |
aSearchedScopes | Mask of scopes that shall be included in the search. |
bool BpsSettings::groupExists | ( | const QString & | aGroup | ) | const |
Check if the group exists in the current scope.
The group name compare is done case-insensitive, so the method is equivalent to groups().contains(aGroup, Qt::CaseInsensitive).
aGroup | The group to check. |
QStringList BpsSettings::groups | ( | ) | const |
Query a list of all existing groups within the currently opened path.
Scope BpsSettings::groupScope | ( | const QString & | aName, |
Scopes | aSearchedScopes = (Scopes) AllScopes |
||
) | const |
Find the first scope of a group within the currently opened path.
Search begins at the current scope and goes up to CentralSystemScope. When using the constructor without datastore, the search stops at LocalSystemScope instead of CentralSystemScope.
aSearchedScopes | Mask of scopes that shall be included in the search. |
aName | The name of the group. Name compare is case-insensitive. |
bool BpsSettings::keyExists | ( | const QString & | aKey | ) | const |
Check if the key exists in the current scope.
The key name compare is done case-insensitive, so the method is equivalent to keys().contains(aKey, Qt::CaseInsensitive).
aKey | The key to check. |
QStringList BpsSettings::keys | ( | ) | const |
Query a list of all existing keys in the currently opened group.
void BpsSettings::open | ( | const QString & | aPath | ) |
Open a new path.
aPath | The path to open, relative to the currently opened path. |
void BpsSettings::removeGroup | ( | const QString & | aName | ) |
Remove a group from the currently opened path.
In case no group of the given name exists, nothing happens.
aName | The name of the group. Name compare is case-insensitive. |
void BpsSettings::removeKey | ( | const QString & | aKey | ) |
Remove a key.
aKey | Name of the key to remove. Key names are case insensitive. |
QString BpsSettings::root | ( | ) | const |
Get the current root.
The root is prepended to all paths. Initially the root is empty.
Scope BpsSettings::scope | ( | ) | const |
void BpsSettings::setRoot | ( | const QString & | aRoot | ) |
Set a new root.
The root is prepended to all paths. Initially the root is empty.
aRoot | The new root to set. |
void BpsSettings::setScope | ( | Scope | aScope | ) |
Change the current scope.
aScope | The new scope to be set. |
Set a value within the currently opened path.
aKey | The key for the value. |
aValue | The value to save under this key. |
void BpsSettings::setValueMap | ( | const QVariantMap & | aMap | ) |
Removes any previously existing keys from the currently opened path and scope, and adds the values in the given map instead.
aMap | The map of key/value pairs to set. |
Get a value within the currently opened path.
aKey | The key of the value. |
aDefValue | Default value to return in case the key does not exist. |
QVariantMap BpsSettings::valueMap | ( | Scopes | aSearchedScopes = (Scopes) AllScopes | ) | const |
Find all keys and values within the currently opened path.
The scope chain is searched up to CentralSystemScope for values. When using the constructor without datastore, the search stops at LocalSystemScope instead of CentralSystemScope. This map contains basically all tha key/value pairs addressed by allKeys().
aSearchedScopes | Mask of scopes that shall be included in the search. |