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