common: Simplify SyncableObject macros and usage
[quassel.git] / src / common / networkconfig.h
1 /***************************************************************************
2  *   Copyright (C) 2005-2018 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  *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.         *
19  ***************************************************************************/
20
21 #pragma once
22
23 #include "syncableobject.h"
24
25 class NetworkConfig : public SyncableObject
26 {
27     Q_OBJECT
28     SYNCABLE_OBJECT
29
30     Q_PROPERTY(bool pingTimeoutEnabled READ pingTimeoutEnabled WRITE setPingTimeoutEnabled)
31     Q_PROPERTY(int pingInterval READ pingInterval WRITE setPingInterval)
32     Q_PROPERTY(int maxPingCount READ maxPingCount WRITE setMaxPingCount)
33     Q_PROPERTY(bool autoWhoEnabled READ autoWhoEnabled WRITE setAutoWhoEnabled)
34     Q_PROPERTY(int autoWhoInterval READ autoWhoInterval WRITE setAutoWhoInterval)
35     Q_PROPERTY(int autoWhoNickLimit READ autoWhoNickLimit WRITE setAutoWhoNickLimit)
36     Q_PROPERTY(int autoWhoDelay READ autoWhoDelay WRITE setAutoWhoDelay)
37     Q_PROPERTY(bool standardCtcp READ standardCtcp WRITE setStandardCtcp)
38
39 public :
40     NetworkConfig(const QString &objectName = "GlobalNetworkConfig", QObject *parent = 0);
41
42 public slots:
43     inline bool pingTimeoutEnabled() const { return _pingTimeoutEnabled; }
44     void setPingTimeoutEnabled(bool);
45     virtual inline void requestSetPingTimeoutEnabled(bool b) { REQUEST(ARG(b)) }
46
47     inline int pingInterval() const { return _pingInterval; }
48     void setPingInterval(int);
49     virtual inline void requestSetPingInterval(int i) { REQUEST(ARG(i)) }
50
51     inline int maxPingCount() const { return _maxPingCount; }
52     void setMaxPingCount(int);
53     virtual inline void requestSetMaxPingCount(int i) { REQUEST(ARG(i)) }
54
55     inline bool autoWhoEnabled() const { return _autoWhoEnabled; }
56     void setAutoWhoEnabled(bool);
57     virtual inline void requestSetAutoWhoEnabled(bool b) { REQUEST(ARG(b)) }
58
59     inline int autoWhoInterval() const { return _autoWhoInterval; }
60     void setAutoWhoInterval(int);
61     virtual inline void requestSetAutoWhoInterval(int i) { REQUEST(ARG(i)) }
62
63     inline int autoWhoNickLimit() const { return _autoWhoNickLimit; }
64     void setAutoWhoNickLimit(int);
65     virtual inline void requestSetAutoWhoNickLimit(int i) { REQUEST(ARG(i)) }
66
67     inline int autoWhoDelay() const { return _autoWhoDelay; }
68     void setAutoWhoDelay(int);
69     virtual inline void requestSetAutoWhoDelay(int i) { REQUEST(ARG(i)) }
70
71     inline bool standardCtcp() const { return _standardCtcp; }
72     void setStandardCtcp(bool);
73     virtual inline void requestSetStandardCtcp(bool b) { REQUEST(ARG(b)) }
74
75 signals:
76     void pingTimeoutEnabledSet(bool);
77     void pingIntervalSet(int);
78 //   void maxPingCountSet(int);
79     void autoWhoEnabledSet(bool);
80     void autoWhoIntervalSet(int);
81 //   void autoWhoNickLimitSet(int);
82     void autoWhoDelaySet(int);
83     void standardCtcpSet(bool);
84
85 //   void setPingTimeoutEnabledRequested(bool);
86 //   void setPingIntervalRequested(int);
87 //   void setMaxPingCountRequested(int);
88 //   void setAutoWhoEnabledRequested(bool);
89 //   void setAutoWhoIntervalRequested(int);
90 //   void setAutoWhoNickLimitRequested(int);
91 //   void setAutoWhoDelayRequested(int);
92
93 private:
94     bool _pingTimeoutEnabled;
95     int _pingInterval;
96     int _maxPingCount;
97
98     bool _autoWhoEnabled;
99     int _autoWhoInterval;
100     int _autoWhoNickLimit;
101     int _autoWhoDelay;
102
103     bool _standardCtcp;
104 };