X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fclient%2Fclientsettings.h;h=da1fc880c5639c978111c65d37bdb6e47e9e4a32;hp=b14cb45196c2e3c526249d398e5dc94bf1de31a4;hb=535f934ed8d2d991a83ad10f34669dbc909f1c84;hpb=44b22c4419f478a20f6324f9f3a700a2dec56302 diff --git a/src/client/clientsettings.h b/src/client/clientsettings.h index b14cb451..da1fc880 100644 --- a/src/client/clientsettings.h +++ b/src/client/clientsettings.h @@ -1,11 +1,11 @@ /*************************************************************************** - * Copyright (C) 2005-07 by The Quassel IRC Development 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 * @@ -22,9 +22,9 @@ #define _CLIENTSETTINGS_H_ #include "settings.h" +#include "types.h" class ClientSettings : public Settings { - Q_OBJECT public: virtual ~ClientSettings(); @@ -32,30 +32,58 @@ class ClientSettings : public Settings { protected: ClientSettings(QString group = "General"); - //virtual QStringList allSessionKeys() = 0; - virtual QStringList sessionKeys(); +}; + +// Deriving from CoreAccountSettings: +// MySettings() : CoreAccountSettings("MyGroup") {}; +// Then use accountValue() / setAccountValue() to retrieve/store data associated to the currently +// connected account. This is stored in CoreAccounts/$ACCID/MyGroup/$KEY) then. +// +// Note that you'll get invalid data (and setting is ignored) if you are not connected to a core! + +class CoreAccountSettings : public ClientSettings { + + public: + // stores account-specific data in CoreAccounts/$ACCID/$SUBGROUP/$KEY) + CoreAccountSettings(const QString &subgroup = "General"); + + QList knownAccounts(); + AccountId lastAccount(); + void setLastAccount(AccountId); + AccountId autoConnectAccount(); + void setAutoConnectAccount(AccountId); - virtual void setSessionValue(const QString &key, const QVariant &data); - virtual QVariant sessionValue(const QString &key, const QVariant &def = QVariant()); + void storeAccountData(AccountId id, const QVariantMap &data); + QVariantMap retrieveAccountData(AccountId); + void removeAccount(AccountId); + void setJumpKeyMap(const QHash &keyMap); + QHash jumpKeyMap(); + + protected: + void setAccountValue(const QString &key, const QVariant &data); + QVariant accountValue(const QString &key, const QVariant &def = QVariant()); + + private: + QString _subgroup; }; -class AccountSettings : public ClientSettings { - Q_OBJECT +class NotificationSettings : public ClientSettings { public: - AccountSettings(); + enum HighlightNickType { + NoNick = 0x00, + CurrentNick= 0x01, + AllNicks = 0x02 + }; - QStringList knownAccounts(); - QString lastAccount(); - void setLastAccount(const QString &account); - QString autoConnectAccount(); - void setAutoConnectAccount(const QString &account); + NotificationSettings(); - void setValue(const QString &account, const QString &key, const QVariant &data); - QVariant value(const QString &account, const QString &key, const QVariant &def = QVariant()); - void removeAccount(const QString &account); + void setHighlightList(const QVariantList &highlightList); + QVariantList highlightList(); -}; + void setHighlightNick(HighlightNickType); + HighlightNickType highlightNick(); +}; #endif