Changeset View
Changeset View
Standalone View
Standalone View
src/lib/marble/declarative/Settings.cpp
1 | // | 1 | // | ||
---|---|---|---|---|---|
2 | // This file is part of the Marble Virtual Globe. | 2 | // This file is part of the Marble Virtual Globe. | ||
3 | // | 3 | // | ||
4 | // This program is free software licensed under the GNU LGPL. You can | 4 | // This program is free software licensed under the GNU LGPL. You can | ||
5 | // find a copy of this license in LICENSE.txt in the top directory of | 5 | // find a copy of this license in LICENSE.txt in the top directory of | ||
6 | // the source code. | 6 | // the source code. | ||
7 | // | 7 | // | ||
8 | // Copyright 2011 Dennis Nienhüser <nienhueser@kde.org> | 8 | // Copyright 2011 Dennis Nienhüser <nienhueser@kde.org> | ||
9 | // | 9 | // | ||
10 | 10 | | |||
11 | #include "config-marble.h" | ||||
11 | #include "Settings.h" | 12 | #include "Settings.h" | ||
12 | #include "MarbleDebug.h" | 13 | #include "MarbleDebug.h" | ||
13 | 14 | | |||
14 | #include <QApplication> | 15 | #include <QApplication> | ||
15 | #include <QSettings> | 16 | #include <QSettings> | ||
16 | 17 | | |||
17 | Settings::Settings() : | 18 | Settings::Settings() : | ||
18 | m_organizationName( QApplication::organizationName() ), | 19 | m_organizationName( QApplication::organizationName() ), | ||
Show All 24 Lines | |||||
43 | 44 | | |||
44 | bool Settings::debugOutputEnabled() const | 45 | bool Settings::debugOutputEnabled() const | ||
45 | { | 46 | { | ||
46 | return Marble::MarbleDebug::isEnabled(); | 47 | return Marble::MarbleDebug::isEnabled(); | ||
47 | } | 48 | } | ||
48 | 49 | | |||
49 | QVariant Settings::value( const QString &group, const QString &key, const QVariant &value ) const | 50 | QVariant Settings::value( const QString &group, const QString &key, const QVariant &value ) const | ||
50 | { | 51 | { | ||
52 | #ifdef APPLE_STANDARD_UNIX_BUILD | ||||
53 | QSettings settings( QSettings::IniFormat, QSettings::UserScope, m_organizationName, m_applicationName ); | ||||
54 | #else | ||||
51 | QSettings settings( m_organizationName, m_applicationName ); | 55 | QSettings settings( m_organizationName, m_applicationName ); | ||
56 | #endif | ||||
52 | settings.beginGroup( group ); | 57 | settings.beginGroup( group ); | ||
53 | return settings.value( key, value ); | 58 | return settings.value( key, value ); | ||
54 | } | 59 | } | ||
55 | 60 | | |||
56 | void Settings::setValue( const QString &group, const QString &key, const QVariant &value ) | 61 | void Settings::setValue( const QString &group, const QString &key, const QVariant &value ) | ||
57 | { | 62 | { | ||
63 | #ifdef APPLE_STANDARD_UNIX_BUILD | ||||
64 | QSettings settings( QSettings::IniFormat, QSettings::UserScope, m_organizationName, m_applicationName ); | ||||
65 | #else | ||||
58 | QSettings settings( m_organizationName, m_applicationName ); | 66 | QSettings settings( m_organizationName, m_applicationName ); | ||
67 | #endif | ||||
59 | settings.beginGroup( group ); | 68 | settings.beginGroup( group ); | ||
60 | settings.setValue( key, value ); | 69 | settings.setValue( key, value ); | ||
61 | settings.endGroup(); | 70 | settings.endGroup(); | ||
62 | } | 71 | } | ||
63 | 72 | | |||
64 | void Settings::remove(const QString &group, const QString &value) | 73 | void Settings::remove(const QString &group, const QString &value) | ||
65 | { | 74 | { | ||
66 | QSettings settings(m_organizationName, m_applicationName); | 75 | QSettings settings(m_organizationName, m_applicationName); | ||
Show All 16 Lines |