Make ping timeouts and auto-WHO configurable
[quassel.git] / src / common / networkconfig.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 NETWORKCONFIG_H_
22 #define NETWORKCONFIG_H_
23
24 #include "syncableobject.h"
25
26 class NetworkConfig : public SyncableObject {
27   Q_OBJECT
28   Q_PROPERTY(bool pingTimeoutEnabled READ pingTimeoutEnabled WRITE setPingTimeoutEnabled)
29   Q_PROPERTY(int pingInterval READ pingInterval WRITE setPingInterval)
30   Q_PROPERTY(int maxPingCount READ maxPingCount WRITE setMaxPingCount)
31   Q_PROPERTY(bool autoWhoEnabled READ autoWhoEnabled WRITE setAutoWhoEnabled)
32   Q_PROPERTY(int autoWhoInterval READ autoWhoInterval WRITE setAutoWhoInterval)
33   Q_PROPERTY(int autoWhoNickLimit READ autoWhoNickLimit WRITE setAutoWhoNickLimit)
34   Q_PROPERTY(int autoWhoDelay READ autoWhoDelay WRITE setAutoWhoDelay)
35
36 public:
37   NetworkConfig(const QString &objectName = "GlobalNetworkConfig", QObject *parent = 0);
38
39   inline virtual const QMetaObject *syncMetaObject() const { return &staticMetaObject; }
40
41 public slots:
42   inline bool pingTimeoutEnabled() const { return _pingTimeoutEnabled; }
43   void setPingTimeoutEnabled(bool);
44   virtual inline void requestSetPingTimeoutEnabled(bool b) { emit setPingTimeoutEnabledRequested(b); }
45
46   inline int pingInterval() const { return _pingInterval; }
47   void setPingInterval(int);
48   virtual inline void requestSetPingInterval(int i) { emit setPingIntervalRequested(i); }
49
50   inline int maxPingCount() const { return _maxPingCount; }
51   void setMaxPingCount(int);
52   virtual inline void requestSetMaxPingCount(int i) { emit setMaxPingCountRequested(i); }
53
54   inline bool autoWhoEnabled() const { return _autoWhoEnabled; }
55   void setAutoWhoEnabled(bool);
56   virtual inline void requestSetAutoWhoEnabled(bool b) { emit setAutoWhoEnabledRequested(b); }
57
58   inline int autoWhoInterval() const { return _autoWhoInterval; }
59   void setAutoWhoInterval(int);
60   virtual inline void requestSetAutoWhoInterval(int i) { emit setAutoWhoIntervalRequested(i); }
61
62   inline int autoWhoNickLimit() const { return _autoWhoNickLimit; }
63   void setAutoWhoNickLimit(int);
64   virtual inline void requestSetAutoWhoNickLimit(int i) { emit setAutoWhoNickLimitRequested(i); }
65
66   inline int autoWhoDelay() const { return _autoWhoDelay; }
67   void setAutoWhoDelay(int);
68   virtual inline void requestSetAutoWhoDelay(int i) { emit setAutoWhoDelayRequested(i); }
69
70 signals:
71   void pingTimeoutEnabledSet(bool);
72   void pingIntervalSet(int);
73   void maxPingCountSet(int);
74   void autoWhoEnabledSet(bool);
75   void autoWhoIntervalSet(int);
76   void autoWhoNickLimitSet(int);
77   void autoWhoDelaySet(int);
78
79   void setPingTimeoutEnabledRequested(bool);
80   void setPingIntervalRequested(int);
81   void setMaxPingCountRequested(int);
82   void setAutoWhoEnabledRequested(bool);
83   void setAutoWhoIntervalRequested(int);
84   void setAutoWhoNickLimitRequested(int);
85   void setAutoWhoDelayRequested(int);
86
87 private:
88   bool _pingTimeoutEnabled;
89   int _pingInterval;
90   int _maxPingCount;
91
92   bool _autoWhoEnabled;
93   int _autoWhoInterval;
94   int _autoWhoNickLimit;
95   int _autoWhoDelay;
96 };
97
98 #endif