Introducing fast backlog replay! Thanks sph_ for the help!
[quassel.git] / src / client / clientsettings.h
1 /***************************************************************************
2  *   Copyright (C) 2005-08 by the Quassel Project                          *
3  *   devel@quassel-irc.org                                                 *
4  *                                                                         *
5  *   This program is free software; you can redistribute it and/or modify  *
6  *   it under the terms of the GNU General Public License as published by  *
7  *   the Free Software Foundation; either version 2 of the License, or     *
8  *   (at your option) version 3.                                           *
9  *                                                                         *
10  *   This program is distributed in the hope that it will be useful,       *
11  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
12  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
13  *   GNU General Public License for more details.                          *
14  *                                                                         *
15  *   You should have received a copy of the GNU General Public License     *
16  *   along with this program; if not, write to the                         *
17  *   Free Software Foundation, Inc.,                                       *
18  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
19  ***************************************************************************/
20
21 #ifndef _CLIENTSETTINGS_H_
22 #define _CLIENTSETTINGS_H_
23
24 #include "settings.h"
25 #include "types.h"
26
27 class ClientSettings : public Settings {
28
29   public:
30     virtual ~ClientSettings();
31
32   protected:
33     ClientSettings(QString group = "General");
34
35 };
36
37 // Deriving from CoreAccountSettings:
38 // MySettings() : CoreAccountSettings("MyGroup") {};
39 // Then use accountValue() / setAccountValue() to retrieve/store data associated to the currently
40 // connected account. This is stored in CoreAccounts/$ACCID/MyGroup/$KEY) then.
41 //
42 // Note that you'll get invalid data (and setting is ignored) if you are not connected to a core!
43
44 class CoreAccountSettings : public ClientSettings {
45
46   public:
47     // stores account-specific data in CoreAccounts/$ACCID/$SUBGROUP/$KEY)
48     CoreAccountSettings(const QString &subgroup = "General");
49
50     QList<AccountId> knownAccounts();
51     AccountId lastAccount();
52     void setLastAccount(AccountId);
53     AccountId autoConnectAccount();
54     void setAutoConnectAccount(AccountId);
55
56     void storeAccountData(AccountId id, const QVariantMap &data);
57     QVariantMap retrieveAccountData(AccountId);
58     void removeAccount(AccountId);
59
60     void setJumpKeyMap(const QHash<int, BufferId> &keyMap);
61     QHash<int, BufferId> jumpKeyMap();
62
63   protected:
64     void setAccountValue(const QString &key, const QVariant &data);
65     QVariant accountValue(const QString &key, const QVariant &def = QVariant());
66
67   private:
68     QString _subgroup;
69 };
70
71 class NotificationSettings : public ClientSettings {
72
73   public:
74     enum HighlightNickType {
75       NoNick = 0x00,
76       CurrentNick= 0x01,
77       AllNicks = 0x02
78     };
79
80     NotificationSettings();
81
82     void setHighlightList(const QVariantList &highlightList);
83     QVariantList highlightList();
84
85     void setHighlightNick(HighlightNickType);
86     HighlightNickType highlightNick();
87
88 };
89 #endif