X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fcommon%2Fbufferviewconfig.h;h=a345cb52db852c7116bd1019d3faed216d90a401;hp=d728df5601192c50798b85637374866cf071aa36;hb=9188f1a4880dc7f4c26612a265c1d874f6df5a8c;hpb=4e0445e459c690cfa6013c5ad574e94f9214827b diff --git a/src/common/bufferviewconfig.h b/src/common/bufferviewconfig.h index d728df56..a345cb52 100644 --- a/src/common/bufferviewconfig.h +++ b/src/common/bufferviewconfig.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-08 by the Quassel Project * + * Copyright (C) 2005-2018 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -15,57 +15,116 @@ * 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 BUFFERVIEWCONFIG_H -#define BUFFERVIEWCONFIG_H +#pragma once -#include "syncableobject.h" +#include "common-export.h" +#include "bufferinfo.h" +#include "syncableobject.h" #include "types.h" -class BufferViewConfig : public SyncableObject { - Q_OBJECT - Q_PROPERTY(QString bufferViewName READ bufferViewName WRITE setBufferViewName) - Q_PROPERTY(NetworkId networkId READ networkId WRITE setNetworkId) - Q_PROPERTY(bool addNewBuffersAutomatically READ addNewBuffersAutomatically WRITE setAddNewBuffersAutomatically) - Q_PROPERTY(bool sortAlphabetically READ sortAlphabetically WRITE setSortAlphabetically) +class COMMON_EXPORT BufferViewConfig : public SyncableObject +{ + Q_OBJECT + SYNCABLE_OBJECT + + Q_PROPERTY(QString bufferViewName READ bufferViewName WRITE setBufferViewName) + Q_PROPERTY(NetworkId networkId READ networkId WRITE setNetworkId) + Q_PROPERTY(bool addNewBuffersAutomatically READ addNewBuffersAutomatically WRITE setAddNewBuffersAutomatically) + Q_PROPERTY(bool sortAlphabetically READ sortAlphabetically WRITE setSortAlphabetically) + Q_PROPERTY(bool hideInactiveBuffers READ hideInactiveBuffers WRITE setHideInactiveBuffers) + Q_PROPERTY(bool hideInactiveNetworks READ hideInactiveNetworks WRITE setHideInactiveNetworks) + Q_PROPERTY(bool disableDecoration READ disableDecoration WRITE setDisableDecoration) + Q_PROPERTY(int allowedBufferTypes READ allowedBufferTypes WRITE setAllowedBufferTypes) + Q_PROPERTY(int minimumActivity READ minimumActivity WRITE setMinimumActivity) + Q_PROPERTY(bool showSearch READ showSearch WRITE setShowSearch) public: - BufferViewConfig(int bufferViewId, QObject *parent = 0); + BufferViewConfig(int bufferViewId, QObject* parent = nullptr); + BufferViewConfig(int bufferViewId, const QVariantMap& properties, QObject* parent = nullptr); + +public: + int bufferViewId() const; + QString bufferViewName() const; + NetworkId networkId() const; + bool addNewBuffersAutomatically() const; + bool sortAlphabetically() const; + bool disableDecoration() const; + int allowedBufferTypes() const; + int minimumActivity() const; + bool hideInactiveBuffers() const; + bool hideInactiveNetworks() const; + bool showSearch() const; + + QList bufferList() const; + QSet removedBuffers() const; + QSet temporarilyRemovedBuffers() const; public slots: - inline int bufferViewId() const { return _bufferViewId; } + QVariantList initBufferList() const; + void initSetBufferList(const QVariantList& buffers); - inline const QString &bufferViewName() const { return _bufferViewName; } - void setBufferViewName(const QString &bufferViewName); + QVariantList initRemovedBuffers() const; + void initSetRemovedBuffers(const QVariantList& buffers); - inline const NetworkId &networkId() const { return _networkId; } - void setNetworkId(const NetworkId &networkId); + QVariantList initTemporarilyRemovedBuffers() const; + void initSetTemporarilyRemovedBuffers(const QVariantList& buffers); - inline bool addNewBuffersAutomatically() const { return _addNewBuffersAutomatically; } - void setAddNewBuffersAutomatically(bool addNewBuffersAutomatically); + void setBufferViewName(const QString& bufferViewName); + void setNetworkId(const NetworkId& networkId); + void setAddNewBuffersAutomatically(bool addNewBuffersAutomatically); + void setSortAlphabetically(bool sortAlphabetically); + void setDisableDecoration(bool disableDecoration); + void setAllowedBufferTypes(int bufferTypes); + void setMinimumActivity(int activity); + void setHideInactiveBuffers(bool hideInactiveBuffers); + void setHideInactiveNetworks(bool hideInactiveNetworks); + void setShowSearch(bool showSearch); - inline bool sortAlphabetically() const { return _sortAlphabetically; } - void setSortAlphabetically(bool sortAlphabetically); + void setBufferList(const QList& buffers); - virtual inline void requestSetBufferViewName(const QString &bufferViewName) { emit setBufferViewNameRequested(bufferViewName); } + void addBuffer(const BufferId& bufferId, int pos); + void moveBuffer(const BufferId& bufferId, int pos); + void removeBuffer(const BufferId& bufferId); + void removeBufferPermanently(const BufferId& bufferId); + + virtual void requestSetBufferViewName(const QString& bufferViewName); + virtual void requestAddBuffer(const BufferId& bufferId, int pos); + virtual void requestMoveBuffer(const BufferId& bufferId, int pos); + virtual void requestRemoveBuffer(const BufferId& bufferId); + virtual void requestRemoveBufferPermanently(const BufferId& bufferId); signals: - void bufferViewNameSet(const QString &bufferViewName); - void networkIdSet(const NetworkId &networkId); - void addNewBuffersAutomaticallySet(bool addNewBuffersAutomatically); - void sortAlphabeticallySet(bool sortAlphabetically); + void configChanged(); + + void bufferViewNameSet(const QString& bufferViewName); + void networkIdSet(const NetworkId& networkId); + void bufferListSet(); - void setBufferViewNameRequested(const QString &bufferViewName); + void bufferAdded(const BufferId& bufferId, int pos); + void bufferMoved(const BufferId& bufferId, int pos); + void bufferRemoved(const BufferId& bufferId); + void bufferPermanentlyRemoved(const BufferId& bufferId); private: - int _bufferViewId; - QString _bufferViewName; - NetworkId _networkId; - bool _addNewBuffersAutomatically; - bool _sortAlphabetically; -}; + int _bufferViewId = 0; ///< ID of the associated BufferView + QString _bufferViewName = {}; ///< Display name of the associated BufferView + NetworkId _networkId = {}; ///< Network ID this buffer belongs to -#endif // BUFFERVIEWCONFIG_H + bool _addNewBuffersAutomatically = true; ///< Automatically add new buffers when created + bool _sortAlphabetically = true; ///< Sort buffers alphabetically + bool _hideInactiveBuffers = false; ///< Hide buffers without activity + bool _hideInactiveNetworks = false; ///< Hide networks without activity + bool _disableDecoration = false; ///< Disable buffer decoration (not fully implemented) + /// Buffer types allowed within this view + int _allowedBufferTypes = (BufferInfo::StatusBuffer | BufferInfo::ChannelBuffer | BufferInfo::QueryBuffer | BufferInfo::GroupBuffer); + int _minimumActivity = 0; ///< Minimum activity for a buffer to show + bool _showSearch = false; ///< Persistently show the buffer search UI + + QList _buffers; + QSet _removedBuffers; + QSet _temporarilyRemovedBuffers; +};