1 /***************************************************************************
2 * Copyright (C) 2005-09 by the Quassel Project *
3 * devel@quassel-irc.org *
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. *
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. *
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 ***************************************************************************/
21 #ifndef CLIENTSETTINGS_H
22 #define CLIENTSETTINGS_H
31 class ClientSettings : public Settings {
33 virtual ~ClientSettings();
36 ClientSettings(QString group = "General");
39 // ========================================
40 // CoreAccountSettings
41 // ========================================
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.
48 // Note that you'll get invalid data (and setting is ignored) if you are not connected to a core!
50 class CoreAccountSettings : public ClientSettings {
52 // stores account-specific data in CoreAccounts/$ACCID/$SUBGROUP/$KEY)
53 CoreAccountSettings(const QString &subgroup = "General");
55 virtual void notify(const QString &key, QObject *receiver, const char *slot);
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);
69 void storeAccountData(AccountId id, const QVariantMap &data);
70 QVariantMap retrieveAccountData(AccountId);
71 void removeAccount(AccountId);
73 void setJumpKeyMap(const QHash<int, BufferId> &keyMap);
74 QHash<int, BufferId> jumpKeyMap();
76 void setBufferViewOverlay(const QSet<int> &viewIds);
77 QSet<int> bufferViewOverlay();
79 void setAccountValue(const QString &key, const QVariant &data);
80 QVariant accountValue(const QString &key, const QVariant &def = QVariant());
86 // ========================================
87 // NotificationSettings
88 // ========================================
89 class NotificationSettings : public ClientSettings {
91 enum HighlightNickType {
97 NotificationSettings();
99 inline void setValue(const QString &key, const QVariant &data) { setLocalValue(key, data); }
100 inline QVariant value(const QString &key, const QVariant &def = QVariant()) { return localValue(key, def); }
101 inline void remove(const QString &key) { removeLocalKey(key); }
103 void setHighlightList(const QVariantList &highlightList);
104 QVariantList highlightList();
106 void setHighlightNick(HighlightNickType);
107 HighlightNickType highlightNick();
109 void setNicksCaseSensitive(bool);
110 bool nicksCaseSensitive();
113 // ========================================
114 // CoreConnectionSettings
115 // ========================================
117 class CoreConnectionSettings : public ClientSettings {
119 enum NetworkDetectionMode {
125 CoreConnectionSettings();
127 void setNetworkDetectionMode(NetworkDetectionMode mode);
128 NetworkDetectionMode networkDetectionMode();
130 void setAutoReconnect(bool autoReconnect);
131 bool autoReconnect();
133 void setPingTimeoutInterval(int interval);
134 int pingTimeoutInterval();
136 void setReconnectInterval(int interval);
137 int reconnectInterval();
140 // ========================================
141 // TabCompletionSettings
142 // ========================================
144 class TabCompletionSettings : public ClientSettings {
151 TabCompletionSettings();
153 void setCompletionSuffix(const QString &);
154 QString completionSuffix();
156 void setAddSpaceMidSentence(bool);
157 bool addSpaceMidSentence();
159 void setSortMode(SortMode);
162 void setCaseSensitivity(Qt::CaseSensitivity);
163 Qt::CaseSensitivity caseSensitivity();
165 void setUseLastSpokenTo(bool);
166 bool useLastSpokenTo();
170 // ========================================
172 // ========================================
173 class ItemViewSettings : public ClientSettings {
175 ItemViewSettings(const QString& group = "ItemViews");
177 bool displayTopicInTooltip();
178 bool mouseWheelChangesBuffer();