Marble

Settings.cpp
1// SPDX-License-Identifier: LGPL-2.1-or-later
2//
3// SPDX-FileCopyrightText: 2011 Dennis Nienhüser <nienhueser@kde.org>
4//
5
6#include "Settings.h"
7#include "MarbleDebug.h"
8
9#include <QApplication>
10#include <QSettings>
11
12Settings::Settings()
13 : m_organizationName(QApplication::organizationName())
14 , m_applicationName(QApplication::applicationName())
15{
16 // nothing to do
17}
18
19QString Settings::organizationName() const
20{
21 return m_organizationName;
22}
23
24void Settings::setOrganizationName(const QString &organization)
25{
26 m_organizationName = organization;
27}
28
29QString Settings::applicationName() const
30{
31 return m_applicationName;
32}
33
34void Settings::setApplicationName(const QString &application)
35{
36 m_applicationName = application;
37}
38
39bool Settings::debugOutputEnabled() const
40{
41 return Marble::MarbleDebug::isEnabled();
42}
43
44QVariant Settings::value(const QString &group, const QString &key, const QVariant &value) const
45{
46 QSettings settings(m_organizationName, m_applicationName);
47 settings.beginGroup(group);
48 return settings.value(key, value);
49}
50
51void Settings::setValue(const QString &group, const QString &key, const QVariant &value)
52{
53 QSettings settings(m_organizationName, m_applicationName);
54 settings.beginGroup(group);
55 settings.setValue(key, value);
56 settings.endGroup();
57}
58
59void Settings::remove(const QString &group, const QString &value)
60{
61 QSettings settings(m_organizationName, m_applicationName);
62 settings.beginGroup(group);
63 settings.remove(value);
64 settings.endGroup();
65}
66
67void Settings::setDebugOutputEnabled(bool debugOutputEnabled)
68{
69 if (Marble::MarbleDebug::isEnabled() == debugOutputEnabled) {
70 return;
71 }
72
73 Marble::MarbleDebug::setEnabled(debugOutputEnabled);
74 Q_EMIT debugOutputEnabledChanged(Marble::MarbleDebug::isEnabled());
75}
76
77#include "moc_Settings.cpp"
Q_EMITQ_EMIT
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:15:45 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.