KnownHostSettings is not needed anymore
[quassel.git] / src / client / clientsettings.h
1 /***************************************************************************
2  *   Copyright (C) 2005-09 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
26 #include "types.h"
27
28 class QHostAddress;
29 class QSslSocket;
30
31 class ClientSettings : public Settings {
32 public:
33   virtual ~ClientSettings();
34
35 protected:
36   ClientSettings(QString group = "General");
37 };
38
39 // ========================================
40 //  CoreAccountSettings
41 // ========================================
42
43 // Deriving from CoreAccountSettings:
44 // MySettings() : CoreAccountSettings("MyGroup") {};
45 // Then use accountValue() / setAccountValue() to retrieve/store data associated to the currently
46 // connected account. This is stored in CoreAccounts/$ACCID/MyGroup/$KEY) then.
47 //
48 // Note that you'll get invalid data (and setting is ignored) if you are not connected to a core!
49
50 class CoreAccountSettings : public ClientSettings {
51 public:
52   // stores account-specific data in CoreAccounts/$ACCID/$SUBGROUP/$KEY)
53   CoreAccountSettings(const QString &subgroup = "General");
54
55   virtual void notify(const QString &key, QObject *receiver, const char *slot);
56
57   QList<AccountId> knownAccounts();
58   AccountId lastAccount();
59   void setLastAccount(AccountId);
60   AccountId autoConnectAccount();
61   void setAutoConnectAccount(AccountId);
62   bool autoConnectOnStartup();
63   void setAutoConnectOnStartup(bool);
64   bool autoConnectToFixedAccount();
65   void setAutoConnectToFixedAccount(bool);
66
67   void clearAccounts();
68
69   void storeAccountData(AccountId id, const QVariantMap &data);
70   QVariantMap retrieveAccountData(AccountId);
71   void removeAccount(AccountId);
72
73   void setJumpKeyMap(const QHash<int, BufferId> &keyMap);
74   QHash<int, BufferId> jumpKeyMap();
75
76   void setAccountValue(const QString &key, const QVariant &data);
77   QVariant accountValue(const QString &key, const QVariant &def = QVariant());
78
79 private:
80   QString _subgroup;
81 };
82
83 // ========================================
84 //  NotificationSettings
85 // ========================================
86 class NotificationSettings : public ClientSettings {
87 public:
88   enum HighlightNickType {
89     NoNick = 0x00,
90     CurrentNick= 0x01,
91     AllNicks = 0x02
92   };
93
94   NotificationSettings();
95
96   inline void setValue(const QString &key, const QVariant &data) { setLocalValue(key, data); }
97   inline QVariant value(const QString &key, const QVariant &def = QVariant()) { return localValue(key, def); }
98   inline void remove(const QString &key) { removeLocalKey(key); }
99
100   void setHighlightList(const QVariantList &highlightList);
101   QVariantList highlightList();
102
103   void setHighlightNick(HighlightNickType);
104   HighlightNickType highlightNick();
105
106   void setNicksCaseSensitive(bool);
107   bool nicksCaseSensitive();
108 };
109
110 // ========================================
111 // TabCompletionSettings
112 // ========================================
113
114 class TabCompletionSettings : public ClientSettings {
115 public:
116   enum SortMode {
117     Alphabetical,
118     LastActivity
119   };
120
121   TabCompletionSettings();
122
123   void setCompletionSuffix(const QString &);
124   QString completionSuffix();
125
126   void setSortMode(SortMode);
127   SortMode sortMode();
128
129   void setCaseSensitivity(Qt::CaseSensitivity);
130   Qt::CaseSensitivity caseSensitivity();
131
132   void setUseLastSpokenTo(bool);
133   bool useLastSpokenTo();
134
135 };
136
137 // ========================================
138 // ItemViewSettings
139 // ========================================
140 class ItemViewSettings : public ClientSettings {
141   public:
142     ItemViewSettings(const QString& group = "ItemViews");
143
144     bool displayTopicInTooltip();
145     bool mouseWheelChangesBuffer();
146 };
147
148 #endif