From 6e0ac042d0baac4ba6fb32833336ea00e066d13a Mon Sep 17 00:00:00 2001 From: Patrick von Reth Date: Thu, 22 Jan 2015 13:31:50 +0100 Subject: [PATCH] fix cinst stuff, not happy --- src/core/plugins/plugins.cpp | 7 ++++++- src/core/plugins/plugins.h | 4 +++- src/core/snore.cpp | 5 +++++ src/core/snore.h | 1 + 4 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/core/plugins/plugins.cpp b/src/core/plugins/plugins.cpp index c4dc247..3601f10 100644 --- a/src/core/plugins/plugins.cpp +++ b/src/core/plugins/plugins.cpp @@ -67,6 +67,11 @@ SnoreCore *SnorePlugin::snore() return m_snore.data(); } +const SnoreCore *SnorePlugin::snore() const +{ + return m_snore.data(); +} + QVariant SnorePlugin::value(const QString &key) const { return snore()->settings()->value(normaliseKey(key)); @@ -86,7 +91,7 @@ void SnorePlugin::setDefaultValue(const QString &key, const QVariant &value, con } } -QString SnorePlugin::normaliseKey(const QString &key) +QString SnorePlugin::normaliseKey(const QString &key) const { return QString("%1/%2").arg(m_name, key); } diff --git a/src/core/plugins/plugins.h b/src/core/plugins/plugins.h index 3e4ef01..f8c7f7a 100644 --- a/src/core/plugins/plugins.h +++ b/src/core/plugins/plugins.h @@ -52,6 +52,8 @@ public: virtual bool deinitialize(); bool isInitialized(); SnoreCore *snore(); + const SnoreCore *snore() const; + const QString &name() const; QVariant value(const QString &key) const; @@ -60,7 +62,7 @@ public: private: SnorePlugin() {} - QString normaliseKey(const QString &key); + QString normaliseKey(const QString &key) const; QString m_name; bool m_initialized; diff --git a/src/core/snore.cpp b/src/core/snore.cpp index 00c6384..cf02904 100644 --- a/src/core/snore.cpp +++ b/src/core/snore.cpp @@ -232,6 +232,11 @@ QSettings *SnoreCore::settings() return d->m_settings; } +const QSettings *SnoreCore::settings() const{ + Q_D(const SnoreCore); + return d->m_settings; +} + const QHash &SnoreCore::settingsDescription() const { Q_D(const SnoreCore); diff --git a/src/core/snore.h b/src/core/snore.h index 372b88c..4fca627 100644 --- a/src/core/snore.h +++ b/src/core/snore.h @@ -167,6 +167,7 @@ public: * @return a pointer to the global settings */ QSettings *settings(); + const QSettings *settings() const; /** * @return a hashmap containing the documentation of the settings keys.