1 /***************************************************************************
2 * Copyright (C) 2005-2015 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 {
128 UseQNetworkConfigurationManager,
133 CoreConnectionSettings();
135 void setNetworkDetectionMode(NetworkDetectionMode mode);
136 NetworkDetectionMode networkDetectionMode();
138 void setAutoReconnect(bool autoReconnect);
139 bool autoReconnect();
141 void setPingTimeoutInterval(int interval);
142 int pingTimeoutInterval();
144 void setReconnectInterval(int interval);
145 int reconnectInterval();
149 // ========================================
150 // TabCompletionSettings
151 // ========================================
153 class TabCompletionSettings : public ClientSettings
161 TabCompletionSettings();
163 void setCompletionSuffix(const QString &);
164 QString completionSuffix();
166 void setAddSpaceMidSentence(bool);
167 bool addSpaceMidSentence();
169 void setSortMode(SortMode);
172 void setCaseSensitivity(Qt::CaseSensitivity);
173 Qt::CaseSensitivity caseSensitivity();
175 void setUseLastSpokenTo(bool);
176 bool useLastSpokenTo();
180 // ========================================
182 // ========================================
183 class ItemViewSettings : public ClientSettings
186 ItemViewSettings(const QString &group = "ItemViews");
188 bool displayTopicInTooltip();
189 bool mouseWheelChangesBuffer();