1 /***************************************************************************
2 * Copyright (C) 2005-09 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);
43 inline virtual const QMetaObject *syncMetaObject() const { return &staticMetaObject; }
46 inline int bufferViewId() const { return _bufferViewId; }
48 inline const QString &bufferViewName() const { return _bufferViewName; }
49 void setBufferViewName(const QString &bufferViewName);
51 inline const NetworkId &networkId() const { return _networkId; }
52 void setNetworkId(const NetworkId &networkId);
54 inline bool addNewBuffersAutomatically() const { return _addNewBuffersAutomatically; }
55 void setAddNewBuffersAutomatically(bool addNewBuffersAutomatically);
57 inline bool sortAlphabetically() const { return _sortAlphabetically; }
58 void setSortAlphabetically(bool sortAlphabetically);
60 inline bool disableDecoration() const { return _disableDecoration; }
61 void setDisableDecoration(bool disableDecoration);
63 inline int allowedBufferTypes() const { return _allowedBufferTypes; }
64 void setAllowedBufferTypes(int bufferTypes);
66 inline int minimumActivity() const { return _minimumActivity; }
67 void setMinimumActivity(int activity);
69 inline bool hideInactiveBuffers() const { return _hideInactiveBuffers; }
70 void setHideInactiveBuffers(bool hideInactiveBuffers);
72 virtual inline void requestSetBufferViewName(const QString &bufferViewName) { emit setBufferViewNameRequested(bufferViewName); }
74 const QList<BufferId> &bufferList() const { return _buffers; }
75 const QSet<BufferId> &removedBuffers() const { return _removedBuffers; }
76 const QSet<BufferId> &temporarilyRemovedBuffers() const { return _temporarilyRemovedBuffers; }
78 QVariantList initBufferList() const;
79 void initSetBufferList(const QVariantList &buffers);
80 void initSetBufferList(const QList<BufferId> &buffers);
82 QVariantList initRemovedBuffers() const;
83 void initSetRemovedBuffers(const QVariantList &buffers);
85 QVariantList initTemporarilyRemovedBuffers() const;
86 void initSetTemporarilyRemovedBuffers(const QVariantList &buffers);
88 void addBuffer(const BufferId &bufferId, int pos);
89 virtual inline void requestAddBuffer(const BufferId &bufferId, int pos) { emit addBufferRequested(bufferId, pos); }
90 void moveBuffer(const BufferId &bufferId, int pos);
91 virtual inline void requestMoveBuffer(const BufferId &bufferId, int pos) { emit moveBufferRequested(bufferId, pos); }
92 void removeBuffer(const BufferId &bufferId);
93 virtual inline void requestRemoveBuffer(const BufferId &bufferId) { emit removeBufferRequested(bufferId); }
94 void removeBufferPermanently(const BufferId &bufferId);
95 virtual inline void requestRemoveBufferPermanently(const BufferId &bufferId) { emit removeBufferPermanentlyRequested(bufferId); }
99 void bufferViewNameSet(const QString &bufferViewName);
100 void networkIdSet(const NetworkId &networkId);
101 void addNewBuffersAutomaticallySet(bool addNewBuffersAutomatically);
102 void sortAlphabeticallySet(bool sortAlphabetically);
103 void disableDecorationSet(bool disableDecoration);
104 void allowedBufferTypesSet(int allowedBufferTypes);
105 void minimumActivitySet(int activity);
106 void hideInactiveBuffersSet(bool hideInactiveBuffers);
107 void bufferListSet();
109 void bufferAdded(const BufferId &bufferId, int pos);
110 void addBufferRequested(const BufferId &bufferId, int pos);
111 void bufferMoved(const BufferId &bufferId, int pos);
112 void moveBufferRequested(const BufferId &bufferId, int pos);
113 void bufferRemoved(const BufferId &bufferId);
114 void bufferPermanentlyRemoved(const BufferId &bufferId);
115 void removeBufferRequested(const BufferId &bufferId);
116 void removeBufferPermanentlyRequested(const BufferId &bufferId);
118 void setBufferViewNameRequested(const QString &bufferViewName);
122 QString _bufferViewName;
123 NetworkId _networkId;
124 bool _addNewBuffersAutomatically;
125 bool _sortAlphabetically;
126 bool _hideInactiveBuffers;
127 bool _disableDecoration;
128 int _allowedBufferTypes;
129 int _minimumActivity;
130 QList<BufferId> _buffers;
131 QSet<BufferId> _removedBuffers;
132 QSet<BufferId> _temporarilyRemovedBuffers;
135 #endif // BUFFERVIEWCONFIG_H