Checking in WiP on the MessageModel. More cleanly separated code and compiling of...
[quassel.git] / src / common / bufferviewconfig.h
1 /***************************************************************************
2  *   Copyright (C) 2005-08 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   Q_OBJECT
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(int allowedBufferTypes READ allowedBufferTypes WRITE setAllowedBufferTypes)
36   Q_PROPERTY(int minimumActivity READ minimumActivity WRITE setMinimumActivity)
37
38 public:
39   BufferViewConfig(int bufferViewId, QObject *parent = 0);
40   BufferViewConfig(int bufferViewId, const QVariantMap &properties, QObject *parent = 0);
41
42
43 public slots:
44   inline int bufferViewId() const { return _bufferViewId; }
45
46   inline const QString &bufferViewName() const { return _bufferViewName; }
47   void setBufferViewName(const QString &bufferViewName);
48
49   inline const NetworkId &networkId() const { return _networkId; }
50   void setNetworkId(const NetworkId &networkId);
51
52   inline bool addNewBuffersAutomatically() const { return _addNewBuffersAutomatically; }
53   void setAddNewBuffersAutomatically(bool addNewBuffersAutomatically);
54
55   inline bool sortAlphabetically() const { return _sortAlphabetically; }
56   void setSortAlphabetically(bool sortAlphabetically);
57
58   inline int allowedBufferTypes() const { return _allowedBufferTypes; }
59   void setAllowedBufferTypes(int bufferTypes);
60
61   inline int minimumActivity() const { return _minimumActivity; }
62   void setMinimumActivity(int activity);
63
64   inline bool hideInactiveBuffers() const { return _hideInactiveBuffers; }
65   void setHideInactiveBuffers(bool hideInactiveBuffers);
66   
67   virtual inline void requestSetBufferViewName(const QString &bufferViewName) { emit setBufferViewNameRequested(bufferViewName); }
68
69   const QList<BufferId> &bufferList() const { return _buffers; }
70   QVariantList initBufferList() const;
71   void initSetBufferList(const QVariantList &buffers);
72   void initSetBufferList(const QList<BufferId> &buffers);
73
74   void addBuffer(const BufferId &bufferId, int pos);
75   virtual inline void requestAddBuffer(const BufferId &bufferId, int pos) { emit addBufferRequested(bufferId, pos); }
76   void moveBuffer(const BufferId &bufferId, int pos);
77   virtual inline void requestMoveBuffer(const BufferId &bufferId, int pos) { emit moveBufferRequested(bufferId, pos); }
78   void removeBuffer(const BufferId &bufferId);
79   virtual inline void requestRemoveBuffer(const BufferId &bufferId) { emit removeBufferRequested(bufferId); }
80   
81 signals:
82   void bufferViewNameSet(const QString &bufferViewName);
83   void networkIdSet(const NetworkId &networkId);
84   void addNewBuffersAutomaticallySet(bool addNewBuffersAutomatically);
85   void sortAlphabeticallySet(bool sortAlphabetically);  
86   void allowedBufferTypesSet(int allowedBufferTypes);
87   void minimumActivitySet(int activity);
88   void hideInactiveBuffersSet(bool hideInactiveBuffers);
89   void bufferListSet();
90
91   void bufferAdded(const BufferId &bufferId, int pos);
92   void addBufferRequested(const BufferId &bufferId, int pos);
93   void bufferMoved(const BufferId &bufferId, int pos);
94   void moveBufferRequested(const BufferId &bufferId, int pos);
95   void bufferRemoved(const BufferId &bufferId);
96   void removeBufferRequested(const BufferId &bufferId);
97   
98   void setBufferViewNameRequested(const QString &bufferViewName);
99
100 private:
101   int _bufferViewId;
102   QString _bufferViewName;
103   NetworkId _networkId;
104   bool _addNewBuffersAutomatically;
105   bool _sortAlphabetically;
106   bool _hideInactiveBuffers;
107   int _allowedBufferTypes;
108   int _minimumActivity;
109   QList<BufferId> _buffers;
110 };
111
112 #endif // BUFFERVIEWCONFIG_H