modernize: Pass arguments by value and move in constructors
[quassel.git] / src / common / networkconfig.cpp
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 #include "networkconfig.h"
22
23 NetworkConfig::NetworkConfig(const QString &objectName, QObject *parent)
24     : SyncableObject(objectName, parent),
25     _pingTimeoutEnabled(true),
26     _pingInterval(30),
27     _maxPingCount(6),
28     _autoWhoEnabled(true),
29     _autoWhoInterval(90),
30     _autoWhoNickLimit(200),
31     _autoWhoDelay(5),
32     _standardCtcp(false)
33 {
34 }
35
36
37 void NetworkConfig::setPingTimeoutEnabled(bool enabled)
38 {
39     if (_pingTimeoutEnabled == enabled)
40         return;
41
42     _pingTimeoutEnabled = enabled;
43     SYNC(ARG(enabled))
44     emit pingTimeoutEnabledSet(enabled);
45 }
46
47
48 void NetworkConfig::setPingInterval(int interval)
49 {
50     if (_pingInterval == interval)
51         return;
52
53     _pingInterval = interval;
54     SYNC(ARG(interval))
55     emit pingIntervalSet(interval);
56 }
57
58
59 void NetworkConfig::setMaxPingCount(int count)
60 {
61     if (_maxPingCount == count)
62         return;
63
64     _maxPingCount = count;
65     SYNC(ARG(count))
66 }
67
68
69 void NetworkConfig::setAutoWhoEnabled(bool enabled)
70 {
71     if (_autoWhoEnabled == enabled)
72         return;
73
74     _autoWhoEnabled = enabled;
75     SYNC(ARG(enabled))
76     emit autoWhoEnabledSet(enabled);
77 }
78
79
80 void NetworkConfig::setAutoWhoInterval(int interval)
81 {
82     if (_autoWhoInterval == interval)
83         return;
84
85     _autoWhoInterval = interval;
86     SYNC(ARG(interval))
87     emit autoWhoIntervalSet(interval);
88 }
89
90
91 void NetworkConfig::setAutoWhoNickLimit(int nickLimit)
92 {
93     if (_autoWhoNickLimit == nickLimit)
94         return;
95
96     _autoWhoNickLimit = nickLimit;
97     SYNC(ARG(nickLimit))
98 }
99
100
101 void NetworkConfig::setAutoWhoDelay(int delay)
102 {
103     if (_autoWhoDelay == delay)
104         return;
105
106     _autoWhoDelay = delay;
107     SYNC(ARG(delay))
108     emit autoWhoDelaySet(delay);
109 }
110
111
112 void NetworkConfig::setStandardCtcp(bool enabled)
113 {
114     if (_standardCtcp == enabled)
115         return;
116
117     _standardCtcp = enabled;
118     SYNC(ARG(enabled))
119     emit standardCtcpSet(enabled);
120 }