1 /***************************************************************************
2 * Copyright (C) 2005-2014 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 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
19 ***************************************************************************/
21 #ifndef CLIENTSETTINGS_H
22 #define CLIENTSETTINGS_H
31 class ClientSettings : public Settings
34 virtual ~ClientSettings();
37 ClientSettings(QString group = "General");
41 // ========================================
42 // CoreAccountSettings
43 // ========================================
45 // Deriving from CoreAccountSettings:
46 // MySettings() : CoreAccountSettings("MyGroup") {};
47 // Then use accountValue() / setAccountValue() to retrieve/store data associated to the currently
48 // connected account. This is stored in CoreAccounts/$ACCID/MyGroup/$KEY) then.
50 // Note that you'll get invalid data (and setting is ignored) if you are not connected to a core!
52 class CoreAccountSettings : public ClientSettings
55 // stores account-specific data in CoreAccounts/$ACCID/$SUBGROUP/$KEY)
56 CoreAccountSettings(const QString &subgroup = "General");
58 virtual void notify(const QString &key, QObject *receiver, const char *slot);
60 QList<AccountId> knownAccounts();
61 AccountId lastAccount();
62 void setLastAccount(AccountId);
63 AccountId autoConnectAccount();
64 void setAutoConnectAccount(AccountId);
65 bool autoConnectOnStartup();
66 void setAutoConnectOnStartup(bool);
67 bool autoConnectToFixedAccount();
68 void setAutoConnectToFixedAccount(bool);
72 void storeAccountData(AccountId id, const QVariantMap &data);
73 QVariantMap retrieveAccountData(AccountId);
74 void removeAccount(AccountId);
76 void setJumpKeyMap(const QHash<int, BufferId> &keyMap);
77 QHash<int, BufferId> jumpKeyMap();
79 void setBufferViewOverlay(const QSet<int> &viewIds);
80 QSet<int> bufferViewOverlay();
82 void setAccountValue(const QString &key, const QVariant &data);
83 QVariant accountValue(const QString &key, const QVariant &def = QVariant());
90 // ========================================
91 // NotificationSettings
92 // ========================================
93 class NotificationSettings : public ClientSettings
96 enum HighlightNickType {
102 NotificationSettings();
104 inline void setValue(const QString &key, const QVariant &data) { setLocalValue(key, data); }
105 inline QVariant value(const QString &key, const QVariant &def = QVariant()) { return localValue(key, def); }
106 inline void remove(const QString &key) { removeLocalKey(key); }
108 void setHighlightList(const QVariantList &highlightList);
109 QVariantList highlightList();
111 void setHighlightNick(HighlightNickType);
112 HighlightNickType highlightNick();
114 void setNicksCaseSensitive(bool);
115 bool nicksCaseSensitive();
119 // ========================================
120 // CoreConnectionSettings
121 // ========================================
123 class CoreConnectionSettings : public ClientSettings
126 enum NetworkDetectionMode {
132 CoreConnectionSettings();
134 void setNetworkDetectionMode(NetworkDetectionMode mode);
135 NetworkDetectionMode networkDetectionMode();
137 void setAutoReconnect(bool autoReconnect);
138 bool autoReconnect();
140 void setPingTimeoutInterval(int interval);
141 int pingTimeoutInterval();
143 void setReconnectInterval(int interval);
144 int reconnectInterval();
148 // ========================================
149 // TabCompletionSettings
150 // ========================================
152 class TabCompletionSettings : public ClientSettings
160 TabCompletionSettings();
162 void setCompletionSuffix(const QString &);
163 QString completionSuffix();
165 void setAddSpaceMidSentence(bool);
166 bool addSpaceMidSentence();
168 void setSortMode(SortMode);
171 void setCaseSensitivity(Qt::CaseSensitivity);
172 Qt::CaseSensitivity caseSensitivity();
174 void setUseLastSpokenTo(bool);
175 bool useLastSpokenTo();
179 // ========================================
181 // ========================================
182 class ItemViewSettings : public ClientSettings
185 ItemViewSettings(const QString &group = "ItemViews");
187 bool displayTopicInTooltip();
188 bool mouseWheelChangesBuffer();