1 | /*************************************************************************** |
2 | * Copyright (C) 2005-2014 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 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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 | { |
33 | public: |
34 | virtual ~ClientSettings(); |
35 | |
36 | protected: |
37 | ClientSettings(QString group = "General" ); |
38 | }; |
39 | |
40 | |
41 | // ======================================== |
42 | // CoreAccountSettings |
43 | // ======================================== |
44 | |
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. |
49 | // |
50 | // Note that you'll get invalid data (and setting is ignored) if you are not connected to a core! |
51 | |
52 | class CoreAccountSettings : public ClientSettings |
53 | { |
54 | public: |
55 | // stores account-specific data in CoreAccounts/$ACCID/$SUBGROUP/$KEY) |
56 | CoreAccountSettings(const QString &subgroup = "General" ); |
57 | |
58 | virtual void notify(const QString &key, QObject *receiver, const char *slot); |
59 | |
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); |
69 | |
70 | void clearAccounts(); |
71 | |
72 | void storeAccountData(AccountId id, const QVariantMap &data); |
73 | QVariantMap retrieveAccountData(AccountId); |
74 | void removeAccount(AccountId); |
75 | |
76 | void setJumpKeyMap(const QHash<int, BufferId> &keyMap); |
77 | QHash<int, BufferId> jumpKeyMap(); |
78 | |
79 | void setBufferViewOverlay(const QSet<int> &viewIds); |
80 | QSet<int> bufferViewOverlay(); |
81 | |
82 | void setAccountValue(const QString &key, const QVariant &data); |
83 | QVariant accountValue(const QString &key, const QVariant &def = QVariant()); |
84 | |
85 | private: |
86 | QString _subgroup; |
87 | }; |
88 | |
89 | |
90 | // ======================================== |
91 | // NotificationSettings |
92 | // ======================================== |
93 | class NotificationSettings : public ClientSettings |
94 | { |
95 | public: |
96 | enum HighlightNickType { |
97 | NoNick = 0x00, |
98 | CurrentNick = 0x01, |
99 | AllNicks = 0x02 |
100 | }; |
101 | |
102 | NotificationSettings(); |
103 | |
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); } |
107 | |
108 | void setHighlightList(const QVariantList &highlightList); |
109 | QVariantList highlightList(); |
110 | |
111 | void setHighlightNick(HighlightNickType); |
112 | HighlightNickType highlightNick(); |
113 | |
114 | void setNicksCaseSensitive(bool); |
115 | bool nicksCaseSensitive(); |
116 | }; |
117 | |
118 | |
119 | // ======================================== |
120 | // CoreConnectionSettings |
121 | // ======================================== |
122 | |
123 | class CoreConnectionSettings : public ClientSettings |
124 | { |
125 | public: |
126 | enum NetworkDetectionMode { |
127 | UseSolid, |
128 | UsePingTimeout, |
129 | NoActiveDetection |
130 | }; |
131 | |
132 | CoreConnectionSettings(); |
133 | |
134 | void setNetworkDetectionMode(NetworkDetectionMode mode); |
135 | NetworkDetectionMode networkDetectionMode(); |
136 | |
137 | void setAutoReconnect(bool autoReconnect); |
138 | bool autoReconnect(); |
139 | |
140 | void setPingTimeoutInterval(int interval); |
141 | int pingTimeoutInterval(); |
142 | |
143 | void setReconnectInterval(int interval); |
144 | int reconnectInterval(); |
145 | }; |
146 | |
147 | |
148 | // ======================================== |
149 | // TabCompletionSettings |
150 | // ======================================== |
151 | |
152 | class TabCompletionSettings : public ClientSettings |
153 | { |
154 | public: |
155 | enum SortMode { |
156 | Alphabetical, |
157 | LastActivity |
158 | }; |
159 | |
160 | TabCompletionSettings(); |
161 | |
162 | void setCompletionSuffix(const QString &); |
163 | QString completionSuffix(); |
164 | |
165 | void setAddSpaceMidSentence(bool); |
166 | bool addSpaceMidSentence(); |
167 | |
168 | void setSortMode(SortMode); |
169 | SortMode sortMode(); |
170 | |
171 | void setCaseSensitivity(Qt::CaseSensitivity); |
172 | Qt::CaseSensitivity caseSensitivity(); |
173 | |
174 | void setUseLastSpokenTo(bool); |
175 | bool useLastSpokenTo(); |
176 | }; |
177 | |
178 | |
179 | // ======================================== |
180 | // ItemViewSettings |
181 | // ======================================== |
182 | class ItemViewSettings : public ClientSettings |
183 | { |
184 | public: |
185 | ItemViewSettings(const QString &group = "ItemViews" ); |
186 | |
187 | bool displayTopicInTooltip(); |
188 | bool mouseWheelChangesBuffer(); |
189 | }; |
190 | |
191 | |
192 | #endif |
193 | |