Move EventStringifier from common/ to core/ for now
[quassel.git] / src / common / bufferviewconfig.h
1 /***************************************************************************
2  *   Copyright (C) 2005-09 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  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
19  ***************************************************************************/
20
21 #ifndef BUFFERVIEWCONFIG_H
22 #define BUFFERVIEWCONFIG_H
23
24 #include "syncableobject.h"
25
26 #include "types.h"
27
28 class BufferViewConfig : public SyncableObject {
29   SYNCABLE_OBJECT
30   Q_OBJECT
31
32   Q_PROPERTY(QString bufferViewName READ bufferViewName WRITE setBufferViewName)
33   Q_PROPERTY(NetworkId networkId READ networkId WRITE setNetworkId)
34   Q_PROPERTY(bool addNewBuffersAutomatically READ addNewBuffersAutomatically WRITE setAddNewBuffersAutomatically)
35   Q_PROPERTY(bool sortAlphabetically READ sortAlphabetically WRITE setSortAlphabetically)
36   Q_PROPERTY(bool hideInactiveBuffers READ hideInactiveBuffers WRITE setHideInactiveBuffers)
37   Q_PROPERTY(bool disableDecoration READ disableDecoration WRITE setDisableDecoration)
38   Q_PROPERTY(int allowedBufferTypes READ allowedBufferTypes WRITE setAllowedBufferTypes)
39   Q_PROPERTY(int minimumActivity READ minimumActivity WRITE setMinimumActivity)
40
41 public:
42   BufferViewConfig(int bufferViewId, QObject *parent = 0);
43   BufferViewConfig(int bufferViewId, const QVariantMap &properties, QObject *parent = 0);
44
45   inline virtual const QMetaObject *syncMetaObject() const { return &staticMetaObject; }
46
47 public slots:
48   inline int bufferViewId() const { return _bufferViewId; }
49
50   inline const QString &bufferViewName() const { return _bufferViewName; }
51   void setBufferViewName(const QString &bufferViewName);
52
53   inline const NetworkId &networkId() const { return _networkId; }
54   void setNetworkId(const NetworkId &networkId);
55
56   inline bool addNewBuffersAutomatically() const { return _addNewBuffersAutomatically; }
57   void setAddNewBuffersAutomatically(bool addNewBuffersAutomatically);
58
59   inline bool sortAlphabetically() const { return _sortAlphabetically; }
60   void setSortAlphabetically(bool sortAlphabetically);
61
62   inline bool disableDecoration() const { return _disableDecoration; }
63   void setDisableDecoration(bool disableDecoration);
64
65   inline int allowedBufferTypes() const { return _allowedBufferTypes; }
66   void setAllowedBufferTypes(int bufferTypes);
67
68   inline int minimumActivity() const { return _minimumActivity; }
69   void setMinimumActivity(int activity);
70
71   inline bool hideInactiveBuffers() const { return _hideInactiveBuffers; }
72   void setHideInactiveBuffers(bool hideInactiveBuffers);
73
74   virtual inline void requestSetBufferViewName(const QString &bufferViewName) { REQUEST(ARG(bufferViewName)) }
75
76   const QList<BufferId> &bufferList() const { return _buffers; }
77   const QSet<BufferId> &removedBuffers() const { return _removedBuffers; }
78   const QSet<BufferId> &temporarilyRemovedBuffers() const { return _temporarilyRemovedBuffers; }
79
80   QVariantList initBufferList() const;
81   void initSetBufferList(const QVariantList &buffers);
82   void initSetBufferList(const QList<BufferId> &buffers);
83
84   QVariantList initRemovedBuffers() const;
85   void initSetRemovedBuffers(const QVariantList &buffers);
86
87   QVariantList initTemporarilyRemovedBuffers() const;
88   void initSetTemporarilyRemovedBuffers(const QVariantList &buffers);
89
90   void addBuffer(const BufferId &bufferId, int pos);
91   virtual inline void requestAddBuffer(const BufferId &bufferId, int pos) { REQUEST(ARG(bufferId), ARG(pos)) }
92   void moveBuffer(const BufferId &bufferId, int pos);
93   virtual inline void requestMoveBuffer(const BufferId &bufferId, int pos) { REQUEST(ARG(bufferId), ARG(pos)) }
94   void removeBuffer(const BufferId &bufferId);
95   virtual inline void requestRemoveBuffer(const BufferId &bufferId) { REQUEST(ARG(bufferId)) }
96   void removeBufferPermanently(const BufferId &bufferId);
97   virtual inline void requestRemoveBufferPermanently(const BufferId &bufferId) { REQUEST(ARG(bufferId)) }
98
99
100 signals:
101   void bufferViewNameSet(const QString &bufferViewName); // invalidate
102   void configChanged();
103   void networkIdSet(const NetworkId &networkId);
104 //   void addNewBuffersAutomaticallySet(bool addNewBuffersAutomatically); // invalidate
105 //   void sortAlphabeticallySet(bool sortAlphabetically); // invalidate
106 //   //  void disableDecorationSet(bool disableDecoration); // invalidate
107 //   void allowedBufferTypesSet(int allowedBufferTypes); // invalidate
108 //   void minimumActivitySet(int activity); // invalidate
109 //   void hideInactiveBuffersSet(bool hideInactiveBuffers); // invalidate
110   void bufferListSet(); // invalidate
111
112   void bufferAdded(const BufferId &bufferId, int pos);
113 //   void addBufferRequested(const BufferId &bufferId, int pos);
114   void bufferMoved(const BufferId &bufferId, int pos);
115 //   void moveBufferRequested(const BufferId &bufferId, int pos);
116   void bufferRemoved(const BufferId &bufferId);
117   void bufferPermanentlyRemoved(const BufferId &bufferId);
118 //   void removeBufferRequested(const BufferId &bufferId);
119 //   void removeBufferPermanentlyRequested(const BufferId &bufferId);
120
121 //   void setBufferViewNameRequested(const QString &bufferViewName);
122
123 private:
124   int _bufferViewId;
125   QString _bufferViewName;
126   NetworkId _networkId;
127   bool _addNewBuffersAutomatically;
128   bool _sortAlphabetically;
129   bool _hideInactiveBuffers;
130   bool _disableDecoration;
131   int _allowedBufferTypes;
132   int _minimumActivity;
133   QList<BufferId> _buffers;
134   QSet<BufferId> _removedBuffers;
135   QSet<BufferId> _temporarilyRemovedBuffers;
136 };
137
138 #endif // BUFFERVIEWCONFIG_H