1 /***************************************************************************
2 * Copyright (C) 2005-08 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 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19 ***************************************************************************/
21 #ifndef BUFFERVIEWCONFIG_H
22 #define BUFFERVIEWCONFIG_H
24 #include "syncableobject.h"
28 class BufferViewConfig : public SyncableObject {
30 Q_PROPERTY(QString bufferViewName READ bufferViewName WRITE setBufferViewName)
31 Q_PROPERTY(NetworkId networkId READ networkId WRITE setNetworkId)
32 Q_PROPERTY(bool addNewBuffersAutomatically READ addNewBuffersAutomatically WRITE setAddNewBuffersAutomatically)
33 Q_PROPERTY(bool sortAlphabetically READ sortAlphabetically WRITE setSortAlphabetically)
34 Q_PROPERTY(bool hideInactiveBuffers READ hideInactiveBuffers WRITE setHideInactiveBuffers)
35 Q_PROPERTY(bool disableDecoration READ disableDecoration WRITE setDisableDecoration)
36 Q_PROPERTY(int allowedBufferTypes READ allowedBufferTypes WRITE setAllowedBufferTypes)
37 Q_PROPERTY(int minimumActivity READ minimumActivity WRITE setMinimumActivity)
40 BufferViewConfig(int bufferViewId, QObject *parent = 0);
41 BufferViewConfig(int bufferViewId, const QVariantMap &properties, QObject *parent = 0);
45 inline int bufferViewId() const { return _bufferViewId; }
47 inline const QString &bufferViewName() const { return _bufferViewName; }
48 void setBufferViewName(const QString &bufferViewName);
50 inline const NetworkId &networkId() const { return _networkId; }
51 void setNetworkId(const NetworkId &networkId);
53 inline bool addNewBuffersAutomatically() const { return _addNewBuffersAutomatically; }
54 void setAddNewBuffersAutomatically(bool addNewBuffersAutomatically);
56 inline bool sortAlphabetically() const { return _sortAlphabetically; }
57 void setSortAlphabetically(bool sortAlphabetically);
59 inline bool disableDecoration() const { return _disableDecoration; }
60 void setDisableDecoration(bool disableDecoration);
62 inline int allowedBufferTypes() const { return _allowedBufferTypes; }
63 void setAllowedBufferTypes(int bufferTypes);
65 inline int minimumActivity() const { return _minimumActivity; }
66 void setMinimumActivity(int activity);
68 inline bool hideInactiveBuffers() const { return _hideInactiveBuffers; }
69 void setHideInactiveBuffers(bool hideInactiveBuffers);
71 virtual inline void requestSetBufferViewName(const QString &bufferViewName) { emit setBufferViewNameRequested(bufferViewName); }
73 const QList<BufferId> &bufferList() const { return _buffers; }
74 const QSet<BufferId> &removedBuffers() const { return _removedBuffers; }
75 const QSet<BufferId> &temporarilyRemovedBuffers() const { return _temporarilyRemovedBuffers; }
77 QVariantList initBufferList() const;
78 void initSetBufferList(const QVariantList &buffers);
79 void initSetBufferList(const QList<BufferId> &buffers);
81 QVariantList initRemovedBuffers() const;
82 void initSetRemovedBuffers(const QVariantList &buffers);
84 QVariantList initTemporarilyRemovedBuffers() const;
85 void initSetTemporarilyRemovedBuffers(const QVariantList &buffers);
87 void addBuffer(const BufferId &bufferId, int pos);
88 virtual inline void requestAddBuffer(const BufferId &bufferId, int pos) { emit addBufferRequested(bufferId, pos); }
89 void moveBuffer(const BufferId &bufferId, int pos);
90 virtual inline void requestMoveBuffer(const BufferId &bufferId, int pos) { emit moveBufferRequested(bufferId, pos); }
91 void removeBuffer(const BufferId &bufferId);
92 virtual inline void requestRemoveBuffer(const BufferId &bufferId) { emit removeBufferRequested(bufferId); }
93 void removeBufferPermanently(const BufferId &bufferId);
94 virtual inline void requestRemoveBufferPermanently(const BufferId &bufferId) { emit removeBufferPermanentlyRequested(bufferId); }
98 void bufferViewNameSet(const QString &bufferViewName);
99 void networkIdSet(const NetworkId &networkId);
100 void addNewBuffersAutomaticallySet(bool addNewBuffersAutomatically);
101 void sortAlphabeticallySet(bool sortAlphabetically);
102 void disableDecorationSet(bool disableDecoration);
103 void allowedBufferTypesSet(int allowedBufferTypes);
104 void minimumActivitySet(int activity);
105 void hideInactiveBuffersSet(bool hideInactiveBuffers);
106 void bufferListSet();
108 void bufferAdded(const BufferId &bufferId, int pos);
109 void addBufferRequested(const BufferId &bufferId, int pos);
110 void bufferMoved(const BufferId &bufferId, int pos);
111 void moveBufferRequested(const BufferId &bufferId, int pos);
112 void bufferRemoved(const BufferId &bufferId);
113 void bufferPermanentlyRemoved(const BufferId &bufferId);
114 void removeBufferRequested(const BufferId &bufferId);
115 void removeBufferPermanentlyRequested(const BufferId &bufferId);
117 void setBufferViewNameRequested(const QString &bufferViewName);
121 QString _bufferViewName;
122 NetworkId _networkId;
123 bool _addNewBuffersAutomatically;
124 bool _sortAlphabetically;
125 bool _hideInactiveBuffers;
126 bool _disableDecoration;
127 int _allowedBufferTypes;
128 int _minimumActivity;
129 QList<BufferId> _buffers;
130 QSet<BufferId> _removedBuffers;
131 QSet<BufferId> _temporarilyRemovedBuffers;
134 #endif // BUFFERVIEWCONFIG_H