X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fclient%2Fclientsettings.h;h=9a9c91a5a4fe9b1757eff47a98bd67686c52e1bc;hp=b14cb45196c2e3c526249d398e5dc94bf1de31a4;hb=HEAD;hpb=44b22c4419f478a20f6324f9f3a700a2dec56302 diff --git a/src/client/clientsettings.h b/src/client/clientsettings.h index b14cb451..9a9c91a5 100644 --- a/src/client/clientsettings.h +++ b/src/client/clientsettings.h @@ -1,11 +1,11 @@ /*************************************************************************** - * Copyright (C) 2005-07 by The Quassel IRC Development Team * + * Copyright (C) 2005-2022 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * + * (at your option) version 3. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * @@ -15,47 +15,171 @@ * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ -#ifndef _CLIENTSETTINGS_H_ -#define _CLIENTSETTINGS_H_ +#pragma once -#include "settings.h" +#include "client-export.h" -class ClientSettings : public Settings { - Q_OBJECT +#include "settings.h" +#include "types.h" - public: - virtual ~ClientSettings(); +class QHostAddress; +class QSslSocket; - protected: +class CLIENT_EXPORT ClientSettings : public Settings +{ +protected: ClientSettings(QString group = "General"); +}; + +// ======================================== +// CoreAccountSettings +// ======================================== + +// Deriving from CoreAccountSettings: +// MySettings() : CoreAccountSettings("MyGroup") {}; +// Then use accountValue() / setAccountValue() to retrieve/store data associated to the currently +// connected account. This is stored in CoreAccounts/$ACCID/MyGroup/$KEY) then. +// +// Note that you'll get invalid data (and setting is ignored) if you are not connected to a core! + +class CLIENT_EXPORT CoreAccountSettings : public ClientSettings +{ +public: + // stores account-specific data in CoreAccounts/$ACCID/$SUBGROUP/$KEY) + CoreAccountSettings(QString subgroup = "General"); + + QList knownAccounts() const; + AccountId lastAccount() const; + void setLastAccount(AccountId); + AccountId autoConnectAccount() const; + void setAutoConnectAccount(AccountId); + bool autoConnectOnStartup() const; + void setAutoConnectOnStartup(bool); + bool autoConnectToFixedAccount() const; + void setAutoConnectToFixedAccount(bool); + + void clearAccounts(); - //virtual QStringList allSessionKeys() = 0; - virtual QStringList sessionKeys(); + void storeAccountData(AccountId id, const QVariantMap& data); + QVariantMap retrieveAccountData(AccountId) const; + void removeAccount(AccountId); - virtual void setSessionValue(const QString &key, const QVariant &data); - virtual QVariant sessionValue(const QString &key, const QVariant &def = QVariant()); + void setJumpKeyMap(const QHash& keyMap); + QHash jumpKeyMap() const; + void setBufferViewOverlay(const QSet& viewIds); + QSet bufferViewOverlay() const; + + void setAccountValue(const QString& key, const QVariant& data); + QVariant accountValue(const QString& key, const QVariant& def = QVariant()) const; + +protected: + QString keyForNotify(const QString& key) const override; + +private: + QString _subgroup; }; -class AccountSettings : public ClientSettings { - Q_OBJECT +// ======================================== +// NotificationSettings +// ======================================== +class CLIENT_EXPORT NotificationSettings : public ClientSettings +{ +public: + enum HighlightNickType + { + NoNick = 0x00, + CurrentNick = 0x01, + AllNicks = 0x02 + }; + + NotificationSettings(); - public: - AccountSettings(); + void setValue(const QString& key, const QVariant& data); + QVariant value(const QString& key, const QVariant& def = {}) const; + void remove(const QString& key); - QStringList knownAccounts(); - QString lastAccount(); - void setLastAccount(const QString &account); - QString autoConnectAccount(); - void setAutoConnectAccount(const QString &account); + void setHighlightList(const QVariantList& highlightList); + QVariantList highlightList() const; - void setValue(const QString &account, const QString &key, const QVariant &data); - QVariant value(const QString &account, const QString &key, const QVariant &def = QVariant()); - void removeAccount(const QString &account); + void setHighlightNick(HighlightNickType); + HighlightNickType highlightNick() const; + void setNicksCaseSensitive(bool); + bool nicksCaseSensitive() const; }; -#endif +// ======================================== +// CoreConnectionSettings +// ======================================== + +class CLIENT_EXPORT CoreConnectionSettings : public ClientSettings +{ +public: + enum NetworkDetectionMode + { + UseQNetworkConfigurationManager = 1, // UseSolid is gone + UsePingTimeout, + NoActiveDetection + }; + + CoreConnectionSettings(); + + void setNetworkDetectionMode(NetworkDetectionMode mode); + NetworkDetectionMode networkDetectionMode() const; + + void setAutoReconnect(bool autoReconnect); + bool autoReconnect() const; + + void setPingTimeoutInterval(int interval); + int pingTimeoutInterval() const; + + void setReconnectInterval(int interval); + int reconnectInterval() const; +}; + +// ======================================== +// TabCompletionSettings +// ======================================== + +class CLIENT_EXPORT TabCompletionSettings : public ClientSettings +{ +public: + enum SortMode + { + Alphabetical, + LastActivity + }; + + TabCompletionSettings(); + + void setCompletionSuffix(const QString&); + QString completionSuffix() const; + + void setAddSpaceMidSentence(bool); + bool addSpaceMidSentence() const; + + void setSortMode(SortMode); + SortMode sortMode() const; + + void setCaseSensitivity(Qt::CaseSensitivity); + Qt::CaseSensitivity caseSensitivity() const; + + void setUseLastSpokenTo(bool); + bool useLastSpokenTo() const; +}; + +// ======================================== +// ItemViewSettings +// ======================================== +class CLIENT_EXPORT ItemViewSettings : public ClientSettings +{ +public: + ItemViewSettings(const QString& group = "ItemViews"); + + bool displayTopicInTooltip() const; + bool mouseWheelChangesBuffer() const; +};