X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fcommon%2Fsettings.h;h=1816a61bb67e4b76c6d15f6e53283c4b7e9f31f1;hp=4ef26640207fa7a5dc6a3dd825d35607bc342355;hb=a1d785ae12b3ec04b43e243f3397bb6f8ecf60d5;hpb=0ac9ce4d7cf768d13993d6aa1d6b791c4149a843 diff --git a/src/common/settings.h b/src/common/settings.h index 4ef26640..1816a61b 100644 --- a/src/common/settings.h +++ b/src/common/settings.h @@ -1,11 +1,11 @@ /*************************************************************************** - * Copyright (C) 2005-07 by The Quassel Team * + * Copyright (C) 2005-08 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * + * (at your option) version 3. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * @@ -23,26 +23,34 @@ #include #include - -class Settings { - - public: - //Settings(); - //~Settings(); - static void init(); - static void setProfile(const QString &string); - static QString profile(); - - static void setGuiValue(const QString &key, const QVariant &value); - static QVariant guiValue (const QString &key, const QVariant &defaultValue = QVariant()); - static void setCoreValue(const QString &user, const QString &key, const QVariant &value); - static QVariant coreValue (const QString &user, const QString& key, const QVariant &defaultValue = QVariant()); - - private: - static QString curProfile; - +#include + +class Settings : private QSettings { +public: + enum Mode { Default, Custom }; + +protected: + Settings(QString group, QString applicationName); + + inline void setGroup(const QString &group_) { group = group_; } + + virtual QStringList allLocalKeys(); + virtual QStringList localChildKeys(const QString &rootkey = QString()); + virtual QStringList localChildGroups(const QString &rootkey = QString()); + + virtual void setLocalValue(const QString &key, const QVariant &data); + virtual const QVariant &localValue(const QString &key, const QVariant &def = QVariant()); + + virtual void removeLocalKey(const QString &key); + + QString group; + +private: + void setCacheValue(const QString &group, const QString &key, const QVariant &data); + const QVariant &cacheValue(const QString &group, const QString &key); + bool isCached(const QString &group, const QString &key); }; -//extern Settings *settings; + #endif