MauiMan

settingsstore.h
1#pragma once
2#include <QObject>
3#include <QString>
4#include <QVariant>
5#include "mauiman_export.h"
6
7class QSettings;
8
9namespace MauiMan
10{
11
12/**
13 * @brief The SettingsStore class
14 * Allows to store and read settings for MauiMan from the local conf file.
15 */
16class MAUIMAN_EXPORT SettingsStore : public QObject
17{
19public:
20
21 /**
22 * @brief SettingsStore
23 * @param parent
24 */
25 explicit SettingsStore(QObject *parent = nullptr);
27
28 /**
29 * @brief Load the value of a conf entry, with a possible default value
30 * @param key the key name of the value
31 * @param defaultValue the default fallback value in case the value with the given key does not exists
32 * @return
33 */
34 QVariant load(const QString &key, const QVariant &defaultValue);
35
36 /**
37 * @brief Save a conf value entry to the local file
38 * @param key the key name of the value
39 * @param value the entry value
40 */
41 void save(const QString &key, const QVariant &value);
42
43 /**
44 * @brief Set up the module section to write to
45 * @param module the module name
46 */
47 void beginModule(const QString &module);
48
49 /**
50 * @brief Finish writing or reading from a module section.
51 */
52 void endModule();
53
54private:
55 QSettings *m_settings;
56};
57}
58
void save(const QString &key, const QVariant &value)
Save a conf value entry to the local file.
void beginModule(const QString &module)
Set up the module section to write to.
SettingsStore(QObject *parent=nullptr)
SettingsStore.
QVariant load(const QString &key, const QVariant &defaultValue)
Load the value of a conf entry, with a possible default value.
void endModule()
Finish writing or reading from a module section.
The MauiMan name-space contains all of the available modules for configuring the Maui Applications an...
QObject(QObject *parent)
Q_OBJECTQ_OBJECT
QObject * parent() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2025 The KDE developers.
Generated on Fri Feb 21 2025 11:46:15 by doxygen 1.13.2 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.