From 158443f71d48215eea8b47b836b61afd77654b78 Mon Sep 17 00:00:00 2001 From: Manuel Nickschas Date: Thu, 6 Sep 2018 22:43:39 +0200 Subject: [PATCH] modernize: Prefer default member init over ctor init Where appropriate, initialize class members in the header rather than in the constructor. --- src/client/bufferviewoverlay.cpp | 6 +-- src/client/bufferviewoverlay.h | 8 +-- src/client/client.cpp | 11 +--- src/client/client.h | 52 +++++++++---------- src/client/clientbacklogmanager.cpp | 4 +- src/client/clientbacklogmanager.h | 4 +- src/client/clientidentity.cpp | 15 ++---- src/client/clientidentity.h | 4 +- src/client/clientsettings.cpp | 3 +- src/client/coreconnection.cpp | 9 +--- src/client/coreconnection.h | 10 ++-- src/client/selectionmodelsynchronizer.cpp | 4 +- src/client/selectionmodelsynchronizer.h | 4 +- src/common/authhandler.cpp | 4 +- src/common/authhandler.h | 4 +- src/common/basichandler.cpp | 4 -- src/common/basichandler.h | 4 +- src/common/bufferinfo.cpp | 2 - src/common/bufferinfo.h | 4 +- src/common/event.cpp | 2 - src/common/event.h | 2 +- src/common/network.h | 19 ++++--- src/common/networkconfig.cpp | 10 +--- src/common/networkconfig.h | 16 +++--- src/common/signalproxy.cpp | 6 +-- src/common/signalproxy.h | 8 +-- src/common/syncableobject.cpp | 8 +-- src/common/syncableobject.h | 4 +- src/core/abstractsqlstorage.cpp | 7 +-- src/core/abstractsqlstorage.h | 10 ++-- src/core/ctcpparser.h | 4 +- src/core/oidentdconfiggenerator.cpp | 3 +- src/core/oidentdconfiggenerator.h | 2 +- src/core/postgresqlstorage.cpp | 3 +- src/core/postgresqlstorage.h | 2 +- src/core/sqlitestorage.cpp | 3 +- src/core/sqlitestorage.h | 2 +- src/core/sslserver.cpp | 3 +- src/core/sslserver.h | 2 +- src/qtui/channellistdlg.cpp | 5 +- src/qtui/channellistdlg.h | 6 +-- src/qtui/chatscene.h | 8 +-- src/qtui/chatviewsearchcontroller.cpp | 8 +-- src/qtui/chatviewsearchcontroller.h | 12 ++--- src/qtui/dockmanagernotificationbackend.cpp | 2 +- src/qtui/dockmanagernotificationbackend.h | 6 +-- src/qtui/inputwidget.h | 4 +- src/qtui/ircconnectionwizard.cpp | 8 +-- src/qtui/ircconnectionwizard.h | 8 +-- src/qtui/mainwin.cpp | 6 +-- src/qtui/mainwin.h | 8 +-- src/qtui/settingsdlg.cpp | 3 +- src/qtui/settingsdlg.h | 2 +- src/qtui/settingspages/aliasesmodel.cpp | 4 +- src/qtui/settingspages/aliasesmodel.h | 4 +- .../settingspages/bufferviewsettingspage.cpp | 5 +- .../settingspages/bufferviewsettingspage.h | 6 +-- .../settingspages/coreaccountsettingspage.cpp | 3 +- .../settingspages/coreaccountsettingspage.h | 2 +- .../settingspages/identitiessettingspage.cpp | 3 +- .../settingspages/identitiessettingspage.h | 2 +- src/qtui/settingspages/ignorelistmodel.cpp | 4 +- src/qtui/settingspages/ignorelistmodel.h | 4 +- src/qtui/settingspages/keysequencewidget.cpp | 5 +- src/qtui/settingspages/keysequencewidget.h | 6 +-- .../settingspages/networkssettingspage.cpp | 3 -- src/qtui/settingspages/networkssettingspage.h | 2 +- .../notificationssettingspage.cpp | 3 +- .../settingspages/notificationssettingspage.h | 2 +- src/qtui/systraynotificationbackend.cpp | 3 +- src/qtui/systraynotificationbackend.h | 2 +- src/uisupport/flatproxymodel.cpp | 7 +-- src/uisupport/flatproxymodel.h | 6 +-- src/uisupport/multilineedit.cpp | 12 +---- src/uisupport/multilineedit.h | 20 +++---- src/uisupport/networkmodelcontroller.cpp | 4 +- src/uisupport/networkmodelcontroller.h | 4 +- src/uisupport/styledlabel.cpp | 5 +- src/uisupport/styledlabel.h | 6 +-- 79 files changed, 185 insertions(+), 300 deletions(-) diff --git a/src/client/bufferviewoverlay.cpp b/src/client/bufferviewoverlay.cpp index d63a26d6..20d33f85 100644 --- a/src/client/bufferviewoverlay.cpp +++ b/src/client/bufferviewoverlay.cpp @@ -31,11 +31,7 @@ const int BufferViewOverlay::_updateEventId = QEvent::registerEventType(); BufferViewOverlay::BufferViewOverlay(QObject *parent) - : QObject(parent), - _aboutToUpdate(false), - _uninitializedViewCount(0), - _allowedBufferTypes(0), - _minimumActivity(0) + : QObject(parent) { } diff --git a/src/client/bufferviewoverlay.h b/src/client/bufferviewoverlay.h index a476434a..4f3ab464 100644 --- a/src/client/bufferviewoverlay.h +++ b/src/client/bufferviewoverlay.h @@ -75,14 +75,14 @@ private: void updateHelper(); QSet filterBuffersByConfig(const QList &buffers, const BufferViewConfig *config); - bool _aboutToUpdate; + bool _aboutToUpdate{false}; QSet _bufferViewIds; - int _uninitializedViewCount; + int _uninitializedViewCount{0}; QSet _networkIds; - int _allowedBufferTypes; - int _minimumActivity; + int _allowedBufferTypes{0}; + int _minimumActivity{0}; QSet _buffers; QSet _removedBuffers; diff --git a/src/client/client.cpp b/src/client/client.cpp index 84e03c77..3c455aed 100644 --- a/src/client/client.cpp +++ b/src/client/client.cpp @@ -61,25 +61,16 @@ Client::Client(std::unique_ptr ui, QObject *parent) _mainUi(std::move(ui)), _networkModel(new NetworkModel(this)), _bufferModel(new BufferModel(_networkModel)), - _bufferSyncer(nullptr), - _aliasManager(nullptr), _backlogManager(new ClientBacklogManager(this)), - _bufferViewManager(nullptr), _bufferViewOverlay(new BufferViewOverlay(this)), _coreInfo(new CoreInfo(this)), - _dccConfig(nullptr), _ircListHelper(new ClientIrcListHelper(this)), _inputHandler(new ClientUserInputHandler(this)), - _networkConfig(nullptr), - _ignoreListManager(nullptr), - _highlightRuleManager(nullptr), - _transferManager(nullptr), _transferModel(new TransferModel(this)), _messageModel(_mainUi->createMessageModel(this)), _messageProcessor(_mainUi->createMessageProcessor(this)), _coreAccountModel(new CoreAccountModel(this)), - _coreConnection(new CoreConnection(this)), - _connected(false) + _coreConnection(new CoreConnection(this)) { #ifdef EMBED_DATA Q_INIT_RESOURCE(data); diff --git a/src/client/client.h b/src/client/client.h index 7642c3e6..dd76191f 100644 --- a/src/client/client.h +++ b/src/client/client.h @@ -311,37 +311,37 @@ private: static void addNetwork(Network *); - SignalProxy *_signalProxy; + SignalProxy *_signalProxy{nullptr}; std::unique_ptr _mainUi; - NetworkModel *_networkModel; - BufferModel *_bufferModel; - BufferSyncer *_bufferSyncer; - ClientAliasManager *_aliasManager; - ClientBacklogManager *_backlogManager; - ClientBufferViewManager *_bufferViewManager; - BufferViewOverlay *_bufferViewOverlay; - CoreInfo *_coreInfo; - DccConfig *_dccConfig; - ClientIrcListHelper *_ircListHelper; - ClientUserInputHandler *_inputHandler; - NetworkConfig *_networkConfig; - ClientIgnoreListManager *_ignoreListManager; - HighlightRuleManager *_highlightRuleManager; - ClientTransferManager *_transferManager; - TransferModel *_transferModel; - - MessageModel *_messageModel; - AbstractMessageProcessor *_messageProcessor; - - CoreAccountModel *_coreAccountModel; - CoreConnection *_coreConnection; - - ClientMode clientMode; + NetworkModel *_networkModel{nullptr}; + BufferModel *_bufferModel{nullptr}; + BufferSyncer *_bufferSyncer{nullptr}; + ClientAliasManager *_aliasManager{nullptr}; + ClientBacklogManager *_backlogManager{nullptr}; + ClientBufferViewManager *_bufferViewManager{nullptr}; + BufferViewOverlay *_bufferViewOverlay{nullptr}; + CoreInfo *_coreInfo{nullptr}; + DccConfig *_dccConfig{nullptr}; + ClientIrcListHelper *_ircListHelper{nullptr}; + ClientUserInputHandler *_inputHandler{nullptr}; + NetworkConfig *_networkConfig{nullptr}; + ClientIgnoreListManager *_ignoreListManager{nullptr}; + HighlightRuleManager *_highlightRuleManager{nullptr}; + ClientTransferManager *_transferManager{nullptr}; + TransferModel *_transferModel{nullptr}; + + MessageModel *_messageModel{nullptr}; + AbstractMessageProcessor *_messageProcessor{nullptr}; + + CoreAccountModel *_coreAccountModel{nullptr}; + CoreConnection *_coreConnection{nullptr}; + + ClientMode clientMode{}; QHash _networks; QHash _identities; - bool _connected; + bool _connected{false}; QList > _userInputBuffer; diff --git a/src/client/clientbacklogmanager.cpp b/src/client/clientbacklogmanager.cpp index afb9faa6..03f851b7 100644 --- a/src/client/clientbacklogmanager.cpp +++ b/src/client/clientbacklogmanager.cpp @@ -30,9 +30,7 @@ #include ClientBacklogManager::ClientBacklogManager(QObject *parent) - : BacklogManager(parent), - _requester(nullptr), - _initBacklogRequested(false) + : BacklogManager(parent) { } diff --git a/src/client/clientbacklogmanager.h b/src/client/clientbacklogmanager.h index 1f710272..aa58a4df 100644 --- a/src/client/clientbacklogmanager.h +++ b/src/client/clientbacklogmanager.h @@ -62,8 +62,8 @@ private: void dispatchMessages(const MessageList &messages, bool sort = false); - BacklogRequester *_requester; - bool _initBacklogRequested; + BacklogRequester *_requester{nullptr}; + bool _initBacklogRequested{false}; QSet _buffersRequested; }; diff --git a/src/client/clientidentity.cpp b/src/client/clientidentity.cpp index 16e1c424..dc6ebe59 100644 --- a/src/client/clientidentity.cpp +++ b/src/client/clientidentity.cpp @@ -25,20 +25,12 @@ CertIdentity::CertIdentity(IdentityId id, QObject *parent) : Identity(id, parent) -#ifdef HAVE_SSL - , _certManager(nullptr), - _isDirty(false) -#endif { } CertIdentity::CertIdentity(const Identity &other, QObject *parent) : Identity(other, parent) -#ifdef HAVE_SSL - , _certManager(nullptr), - _isDirty(false) -#endif { } @@ -46,10 +38,9 @@ CertIdentity::CertIdentity(const Identity &other, QObject *parent) CertIdentity::CertIdentity(const CertIdentity &other, QObject *parent) : Identity(other, parent) #ifdef HAVE_SSL - , _certManager(nullptr), - _isDirty(other._isDirty), - _sslKey(other._sslKey), - _sslCert(other._sslCert) + , _isDirty(other._isDirty) + , _sslKey(other._sslKey) + , _sslCert(other._sslCert) #endif { } diff --git a/src/client/clientidentity.h b/src/client/clientidentity.h index 4aa81c83..fb35acae 100644 --- a/src/client/clientidentity.h +++ b/src/client/clientidentity.h @@ -59,8 +59,8 @@ private slots: void markClean(); private: - ClientCertManager *_certManager; - bool _isDirty; + ClientCertManager *_certManager{nullptr}; + bool _isDirty{false}; QSslKey _sslKey; QSslCertificate _sslCert; #endif //HAVE_SSL diff --git a/src/client/clientsettings.cpp b/src/client/clientsettings.cpp index 171d7fe4..cf0cb8d7 100644 --- a/src/client/clientsettings.cpp +++ b/src/client/clientsettings.cpp @@ -18,6 +18,8 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ +#include + #include #include "clientsettings.h" @@ -25,7 +27,6 @@ #include #ifdef HAVE_SSL #include -#include #endif #include "client.h" diff --git a/src/client/coreconnection.cpp b/src/client/coreconnection.cpp index 90e02890..d333b532 100644 --- a/src/client/coreconnection.cpp +++ b/src/client/coreconnection.cpp @@ -36,14 +36,7 @@ CoreConnection::CoreConnection(QObject *parent) : QObject(parent), - _authHandler(nullptr), - _state(Disconnected), - _wantReconnect(false), - _wasReconnect(false), - _progressMinimum(0), - _progressMaximum(-1), - _progressValue(-1), - _resetting(false) + _authHandler(nullptr) { qRegisterMetaType("CoreConnection::ConnectionState"); } diff --git a/src/client/coreconnection.h b/src/client/coreconnection.h index 56a5a29e..79020220 100644 --- a/src/client/coreconnection.h +++ b/src/client/coreconnection.h @@ -152,18 +152,18 @@ private slots: private: QPointer _authHandler; QPointer _peer; - ConnectionState _state; + ConnectionState _state{Disconnected}; QTimer _reconnectTimer; - bool _wantReconnect; - bool _wasReconnect; + bool _wantReconnect{false}; + bool _wasReconnect{false}; QSet _netsToSync; int _numNetsToSync; - int _progressMinimum, _progressMaximum, _progressValue; + int _progressMinimum{0}, _progressMaximum{-1}, _progressValue{-1}; QString _progressText; - bool _resetting; + bool _resetting{false}; CoreAccount _account; CoreAccountModel *accountModel() const; diff --git a/src/client/selectionmodelsynchronizer.cpp b/src/client/selectionmodelsynchronizer.cpp index 6329572d..717ef4e0 100644 --- a/src/client/selectionmodelsynchronizer.cpp +++ b/src/client/selectionmodelsynchronizer.cpp @@ -28,9 +28,7 @@ SelectionModelSynchronizer::SelectionModelSynchronizer(QAbstractItemModel *parent) : QObject(parent), _model(parent), - _selectionModel(parent), - _changeCurrentEnabled(true), - _changeSelectionEnabled(true) + _selectionModel(parent) { connect(&_selectionModel, SIGNAL(currentChanged(const QModelIndex &, const QModelIndex &)), this, SLOT(currentChanged(const QModelIndex &, const QModelIndex &))); diff --git a/src/client/selectionmodelsynchronizer.h b/src/client/selectionmodelsynchronizer.h index cad7edfa..b830d31a 100644 --- a/src/client/selectionmodelsynchronizer.h +++ b/src/client/selectionmodelsynchronizer.h @@ -57,8 +57,8 @@ private slots: private: QAbstractItemModel *_model; QItemSelectionModel _selectionModel; - bool _changeCurrentEnabled; - bool _changeSelectionEnabled; + bool _changeCurrentEnabled{true}; + bool _changeSelectionEnabled{true}; bool checkBaseModel(QItemSelectionModel *model); QModelIndex mapFromSource(const QModelIndex &sourceIndex, const QItemSelectionModel *selectionModel); diff --git a/src/common/authhandler.cpp b/src/common/authhandler.cpp index b87400b8..67947301 100644 --- a/src/common/authhandler.cpp +++ b/src/common/authhandler.cpp @@ -23,9 +23,7 @@ #include "authhandler.h" AuthHandler::AuthHandler(QObject *parent) - : QObject(parent), - _socket(nullptr), - _disconnectedSent(false) + : QObject(parent) { } diff --git a/src/common/authhandler.h b/src/common/authhandler.h index d5c54716..0d30e662 100644 --- a/src/common/authhandler.h +++ b/src/common/authhandler.h @@ -71,6 +71,6 @@ protected slots: private: void invalidMessage(); - QTcpSocket *_socket; // FIXME: should be a QSharedPointer? -> premature disconnect before the peer has taken over - bool _disconnectedSent; + QTcpSocket *_socket{nullptr}; // FIXME: should be a QSharedPointer? -> premature disconnect before the peer has taken over + bool _disconnectedSent{false}; }; diff --git a/src/common/basichandler.cpp b/src/common/basichandler.cpp index 5c3140fd..906e82e4 100644 --- a/src/common/basichandler.cpp +++ b/src/common/basichandler.cpp @@ -26,8 +26,6 @@ BasicHandler::BasicHandler(QObject *parent) : QObject(parent), - _defaultHandler(-1), - _initDone(false), _methodPrefix("handle") { } @@ -35,8 +33,6 @@ BasicHandler::BasicHandler(QObject *parent) BasicHandler::BasicHandler(QString methodPrefix, QObject *parent) : QObject(parent), - _defaultHandler(-1), - _initDone(false), _methodPrefix(std::move(methodPrefix)) { } diff --git a/src/common/basichandler.h b/src/common/basichandler.h index 8b633742..d2a3ef2b 100644 --- a/src/common/basichandler.h +++ b/src/common/basichandler.h @@ -48,7 +48,7 @@ protected: private: const QHash &handlerHash(); QHash _handlerHash; - int _defaultHandler; - bool _initDone; + int _defaultHandler{-1}; + bool _initDone{false}; QString _methodPrefix; }; diff --git a/src/common/bufferinfo.cpp b/src/common/bufferinfo.cpp index 8ac1f4b0..2eaa2ed4 100644 --- a/src/common/bufferinfo.cpp +++ b/src/common/bufferinfo.cpp @@ -31,8 +31,6 @@ BufferInfo::BufferInfo() : _bufferId(0), _netid(0), - _type(InvalidBuffer), - _groupId(0), _bufferName(QString()) { } diff --git a/src/common/bufferinfo.h b/src/common/bufferinfo.h index 6e77e636..e20ce9b3 100644 --- a/src/common/bufferinfo.h +++ b/src/common/bufferinfo.h @@ -67,8 +67,8 @@ public: private: BufferId _bufferId; NetworkId _netid; - Type _type; - uint _groupId; + Type _type{InvalidBuffer}; + uint _groupId{0}; QString _bufferName; friend uint qHash(const BufferInfo &); diff --git a/src/common/event.cpp b/src/common/event.cpp index 4d9a6def..4bb0221d 100644 --- a/src/common/event.cpp +++ b/src/common/event.cpp @@ -27,14 +27,12 @@ Event::Event(EventManager::EventType type) : _type(type) - , _valid(true) { } Event::Event(EventManager::EventType type, QVariantMap &map) : _type(type) - , _valid(true) { if (!map.contains("flags") || !map.contains("timestamp")) { qWarning() << "Received invalid serialized event:" << map; diff --git a/src/common/event.h b/src/common/event.h index 10bfdab2..02caa832 100644 --- a/src/common/event.h +++ b/src/common/event.h @@ -72,7 +72,7 @@ private: EventManager::EventType _type; EventManager::EventFlags _flags; QDateTime _timestamp; - bool _valid; + bool _valid{true}; friend COMMON_EXPORT QDebug operator<<(QDebug dbg, Event *e); }; diff --git a/src/common/network.h b/src/common/network.h index 9e50e4ab..12754363 100644 --- a/src/common/network.h +++ b/src/common/network.h @@ -117,28 +117,27 @@ public : struct Server { QString host; - uint port; + uint port{6667}; QString password; - bool useSsl; - bool sslVerify; /// If true, validate SSL certificates - int sslVersion; + bool useSsl{false}; + bool sslVerify{true}; /// If true, validate SSL certificates + int sslVersion{0}; - bool useProxy; - int proxyType; + bool useProxy{false}; + int proxyType{QNetworkProxy::Socks5Proxy}; QString proxyHost; - uint proxyPort; + uint proxyPort{8080}; QString proxyUser; QString proxyPass; // sslVerify only applies when useSsl is true. sslVerify should be enabled by default, // so enabling useSsl offers a more secure default. - Server() : port(6667), useSsl(false), sslVerify(true), sslVersion(0), useProxy(false), - proxyType(QNetworkProxy::Socks5Proxy), proxyHost("localhost"), proxyPort(8080) {} + Server() : proxyHost("localhost") {} Server(QString host, uint port, QString password, bool useSsl, bool sslVerify) : host(std::move(host)), port(port), password(std::move(password)), useSsl(useSsl), sslVerify(sslVerify), - sslVersion(0), useProxy(false), proxyType(QNetworkProxy::Socks5Proxy), + proxyType(QNetworkProxy::Socks5Proxy), proxyHost("localhost"), proxyPort(8080) {} bool operator==(const Server &other) const; diff --git a/src/common/networkconfig.cpp b/src/common/networkconfig.cpp index b8170cb5..1c0eb379 100644 --- a/src/common/networkconfig.cpp +++ b/src/common/networkconfig.cpp @@ -21,15 +21,7 @@ #include "networkconfig.h" NetworkConfig::NetworkConfig(const QString &objectName, QObject *parent) - : SyncableObject(objectName, parent), - _pingTimeoutEnabled(true), - _pingInterval(30), - _maxPingCount(6), - _autoWhoEnabled(true), - _autoWhoInterval(90), - _autoWhoNickLimit(200), - _autoWhoDelay(5), - _standardCtcp(false) + : SyncableObject(objectName, parent) { } diff --git a/src/common/networkconfig.h b/src/common/networkconfig.h index 83574f97..d1d10b96 100644 --- a/src/common/networkconfig.h +++ b/src/common/networkconfig.h @@ -93,14 +93,14 @@ signals: // void setAutoWhoDelayRequested(int); private: - bool _pingTimeoutEnabled; - int _pingInterval; - int _maxPingCount; + bool _pingTimeoutEnabled{true}; + int _pingInterval{30}; + int _maxPingCount{6}; - bool _autoWhoEnabled; - int _autoWhoInterval; - int _autoWhoNickLimit; - int _autoWhoDelay; + bool _autoWhoEnabled{true}; + int _autoWhoInterval{90}; + int _autoWhoNickLimit{200}; + int _autoWhoDelay{5}; - bool _standardCtcp; + bool _standardCtcp{false}; }; diff --git a/src/common/signalproxy.cpp b/src/common/signalproxy.cpp index 7bd87513..0cc79944 100644 --- a/src/common/signalproxy.cpp +++ b/src/common/signalproxy.cpp @@ -68,11 +68,11 @@ public: private: struct Signal { - QObject *sender; - int signalId; + QObject *sender{nullptr}; + int signalId{-1}; QByteArray signature; Signal(QObject *sender, int sigId, QByteArray signature) : sender(sender), signalId(sigId), signature(std::move(signature)) {} - Signal() : sender(nullptr), signalId(-1) {} + Signal() {} }; SignalProxy *_proxy; diff --git a/src/common/signalproxy.h b/src/common/signalproxy.h index e6f594d8..a9486171 100644 --- a/src/common/signalproxy.h +++ b/src/common/signalproxy.h @@ -232,7 +232,7 @@ class SignalProxy::ExtendedMetaObject { public: MethodDescriptor(const QMetaMethod &method); - MethodDescriptor() : _returnType(-1), _minArgCount(-1), _receiverMode(SignalProxy::Client) {} + MethodDescriptor() {} inline const QByteArray &methodName() const { return _methodName; } inline const QList &argTypes() const { return _argTypes; } @@ -243,9 +243,9 @@ class SignalProxy::ExtendedMetaObject private: QByteArray _methodName; QList _argTypes; - int _returnType; - int _minArgCount; - SignalProxy::ProxyMode _receiverMode; // Only acceptable as a Sync Call if the receiving SignalProxy is in this mode. + int _returnType{-1}; + int _minArgCount{-1}; + SignalProxy::ProxyMode _receiverMode{SignalProxy::Client}; // Only acceptable as a Sync Call if the receiving SignalProxy is in this mode. }; diff --git a/src/common/syncableobject.cpp b/src/common/syncableobject.cpp index 2c42ea40..f43a155c 100644 --- a/src/common/syncableobject.cpp +++ b/src/common/syncableobject.cpp @@ -28,17 +28,13 @@ #include "util.h" SyncableObject::SyncableObject(QObject *parent) - : QObject(parent), - _initialized(false), - _allowClientUpdates(false) + : QObject(parent) { } SyncableObject::SyncableObject(const QString &objectName, QObject *parent) - : QObject(parent), - _initialized(false), - _allowClientUpdates(false) + : QObject(parent) { setObjectName(objectName); } diff --git a/src/common/syncableobject.h b/src/common/syncableobject.h index 7b080432..9031f136 100644 --- a/src/common/syncableobject.h +++ b/src/common/syncableobject.h @@ -109,8 +109,8 @@ private: bool setInitValue(const QString &property, const QVariant &value); - bool _initialized; - bool _allowClientUpdates; + bool _initialized{false}; + bool _allowClientUpdates{false}; QList _signalProxies; diff --git a/src/core/abstractsqlstorage.cpp b/src/core/abstractsqlstorage.cpp index 7f5d115f..10c0f50d 100644 --- a/src/core/abstractsqlstorage.cpp +++ b/src/core/abstractsqlstorage.cpp @@ -31,8 +31,7 @@ int AbstractSqlStorage::_nextConnectionId = 0; AbstractSqlStorage::AbstractSqlStorage(QObject *parent) - : Storage(parent), - _schemaVersion(0) + : Storage(parent) { } @@ -402,7 +401,6 @@ AbstractSqlStorage::Connection::~Connection() // AbstractSqlMigrator // ======================================== AbstractSqlMigrator::AbstractSqlMigrator() - : _query(nullptr) { } @@ -489,8 +487,7 @@ void AbstractSqlMigrator::dumpStatus() // AbstractSqlMigrationReader // ======================================== AbstractSqlMigrationReader::AbstractSqlMigrationReader() - : AbstractSqlMigrator(), - _writer(nullptr) + : AbstractSqlMigrator() { } diff --git a/src/core/abstractsqlstorage.h b/src/core/abstractsqlstorage.h index d4670e7a..2224d5c9 100644 --- a/src/core/abstractsqlstorage.h +++ b/src/core/abstractsqlstorage.h @@ -112,7 +112,7 @@ private: void addConnectionToPool(); void dbConnect(QSqlDatabase &db); - int _schemaVersion; + int _schemaVersion{0}; bool _debug; static int _nextConnectionId; @@ -167,11 +167,11 @@ public: }; struct SenderMO { - qint64 senderId; + qint64 senderId{0}; QString sender; QString realname; QString avatarurl; - SenderMO() : senderId(0) {} + SenderMO() {} }; struct IdentityMO { @@ -332,7 +332,7 @@ protected: virtual bool commit() = 0; private: - QSqlQuery *_query; + QSqlQuery *_query{nullptr}; }; @@ -360,7 +360,7 @@ private: template bool transferMo(MigrationObject moType, T &mo); - AbstractSqlMigrationWriter *_writer; + AbstractSqlMigrationWriter *_writer{nullptr}; }; diff --git a/src/core/ctcpparser.h b/src/core/ctcpparser.h index 9630f6cd..7fd2a837 100644 --- a/src/core/ctcpparser.h +++ b/src/core/ctcpparser.h @@ -85,11 +85,11 @@ private: CoreSession *_coreSession; struct CtcpReply { - CoreNetwork *network; + CoreNetwork *network{nullptr}; QString bufferName; QList replies; - CtcpReply() : network(nullptr) {} + CtcpReply() {} CtcpReply(CoreNetwork *net, QString buf) : network(net), bufferName(std::move(buf)) {} }; diff --git a/src/core/oidentdconfiggenerator.cpp b/src/core/oidentdconfiggenerator.cpp index ecb69b49..08b7636c 100644 --- a/src/core/oidentdconfiggenerator.cpp +++ b/src/core/oidentdconfiggenerator.cpp @@ -29,8 +29,7 @@ #include "oidentdconfiggenerator.h" OidentdConfigGenerator::OidentdConfigGenerator(QObject *parent) : - QObject(parent), - _initialized(false) + QObject(parent) { if (!_initialized) init(); diff --git a/src/core/oidentdconfiggenerator.h b/src/core/oidentdconfiggenerator.h index fc022fef..ee3e53c3 100644 --- a/src/core/oidentdconfiggenerator.h +++ b/src/core/oidentdconfiggenerator.h @@ -72,7 +72,7 @@ private: bool parseConfig(bool readQuasselStanzas = false); bool lineByUs(const QByteArray &line); - bool _initialized; + bool _initialized{false}; bool _strict; QDateTime _lastSync; QFile *_configFile; diff --git a/src/core/postgresqlstorage.cpp b/src/core/postgresqlstorage.cpp index 5e6517cd..6b2642bd 100644 --- a/src/core/postgresqlstorage.cpp +++ b/src/core/postgresqlstorage.cpp @@ -27,8 +27,7 @@ #include "quassel.h" PostgreSqlStorage::PostgreSqlStorage(QObject *parent) - : AbstractSqlStorage(parent), - _port(-1) + : AbstractSqlStorage(parent) { } diff --git a/src/core/postgresqlstorage.h b/src/core/postgresqlstorage.h index 3643ecc3..599bb548 100644 --- a/src/core/postgresqlstorage.h +++ b/src/core/postgresqlstorage.h @@ -155,7 +155,7 @@ private: QSqlQuery prepareAndExecuteQuery(const QString &queryname, QSqlDatabase &db) { return prepareAndExecuteQuery(queryname, QString(), db); } QString _hostName; - int _port; + int _port{-1}; QString _databaseName; QString _userName; QString _password; diff --git a/src/core/sqlitestorage.cpp b/src/core/sqlitestorage.cpp index bf6f3f7b..b5551733 100644 --- a/src/core/sqlitestorage.cpp +++ b/src/core/sqlitestorage.cpp @@ -2209,8 +2209,7 @@ bool SqliteStorage::safeExec(QSqlQuery &query, int retryCount) // SqliteMigration // ======================================== SqliteMigrationReader::SqliteMigrationReader() - : SqliteStorage(), - _maxId(0) + : SqliteStorage() { } diff --git a/src/core/sqlitestorage.h b/src/core/sqlitestorage.h index ab4c826d..c88a3c6d 100644 --- a/src/core/sqlitestorage.h +++ b/src/core/sqlitestorage.h @@ -183,7 +183,7 @@ protected: private: void setMaxId(MigrationObject mo); - qint64 _maxId; + qint64 _maxId{0}; }; diff --git a/src/core/sslserver.cpp b/src/core/sslserver.cpp index 83d7e603..1d5a103d 100644 --- a/src/core/sslserver.cpp +++ b/src/core/sslserver.cpp @@ -32,8 +32,7 @@ #ifdef HAVE_SSL SslServer::SslServer(QObject *parent) - : QTcpServer(parent), - _isCertValid(false) + : QTcpServer(parent) { // Keep track if the SSL warning has been mentioned at least once before static bool sslWarningShown = false; diff --git a/src/core/sslserver.h b/src/core/sslserver.h index 2e18aa1c..6ca1b915 100644 --- a/src/core/sslserver.h +++ b/src/core/sslserver.h @@ -73,7 +73,7 @@ private: QSslCertificate _cert; QSslKey _key; QList _ca; - bool _isCertValid; + bool _isCertValid{false}; // Used when reloading certificates later QString _sslCertPath; /// Path to the certificate file diff --git a/src/qtui/channellistdlg.cpp b/src/qtui/channellistdlg.cpp index 204590ed..de872a74 100644 --- a/src/qtui/channellistdlg.cpp +++ b/src/qtui/channellistdlg.cpp @@ -30,11 +30,8 @@ ChannelListDlg::ChannelListDlg(QWidget *parent) : QDialog(parent), - _listFinished(true), _ircListModel(this), - _sortFilter(this), - _simpleModeSpacer(nullptr), - _advancedMode(false) + _sortFilter(this) { _sortFilter.setSourceModel(&_ircListModel); _sortFilter.setFilterCaseSensitivity(Qt::CaseInsensitive); diff --git a/src/qtui/channellistdlg.h b/src/qtui/channellistdlg.h index 5136ef3a..cfa45a3d 100644 --- a/src/qtui/channellistdlg.h +++ b/src/qtui/channellistdlg.h @@ -78,12 +78,12 @@ private: Ui::ChannelListDlg ui; - bool _listFinished; + bool _listFinished{true}; NetworkId _netId; IrcListModel _ircListModel; QSortFilterProxyModel _sortFilter; - QSpacerItem *_simpleModeSpacer; - bool _advancedMode; + QSpacerItem *_simpleModeSpacer{nullptr}; + bool _advancedMode{false}; }; diff --git a/src/qtui/chatscene.h b/src/qtui/chatscene.h index ed27be77..29e3d9e5 100644 --- a/src/qtui/chatscene.h +++ b/src/qtui/chatscene.h @@ -286,13 +286,13 @@ private: ShowPreview, HidePreview }; - ChatItem *parentItem; - QGraphicsItem *previewItem; + ChatItem *parentItem{nullptr}; + QGraphicsItem *previewItem{nullptr}; QUrl url; QRectF urlRect; - PreviewState previewState; + PreviewState previewState{NoPreview}; QTimer timer; - WebPreview() : parentItem(nullptr), previewItem(nullptr), previewState(NoPreview) {} + WebPreview() {} }; WebPreview webPreview; #endif // HAVE_WEBKIT || HAVE_WEBENGINE diff --git a/src/qtui/chatviewsearchcontroller.cpp b/src/qtui/chatviewsearchcontroller.cpp index bb6dc367..930aea52 100644 --- a/src/qtui/chatviewsearchcontroller.cpp +++ b/src/qtui/chatviewsearchcontroller.cpp @@ -30,13 +30,7 @@ #include "messagemodel.h" ChatViewSearchController::ChatViewSearchController(QObject *parent) - : QObject(parent), - _scene(nullptr), - _currentHighlight(0), - _caseSensitive(false), - _searchSenders(false), - _searchMsgs(true), - _searchOnlyRegularMsgs(true) + : QObject(parent) { } diff --git a/src/qtui/chatviewsearchcontroller.h b/src/qtui/chatviewsearchcontroller.h index ce2c49f2..8e9c8d67 100644 --- a/src/qtui/chatviewsearchcontroller.h +++ b/src/qtui/chatviewsearchcontroller.h @@ -67,14 +67,14 @@ signals: private: QString _searchString; - ChatScene *_scene; + ChatScene *_scene{nullptr}; QList _highlightItems; - int _currentHighlight; + int _currentHighlight{0}; - bool _caseSensitive; - bool _searchSenders; - bool _searchMsgs; - bool _searchOnlyRegularMsgs; + bool _caseSensitive{false}; + bool _searchSenders{false}; + bool _searchMsgs{true}; + bool _searchOnlyRegularMsgs{true}; inline Qt::CaseSensitivity caseSensitive() const { return _caseSensitive ? Qt::CaseSensitive : Qt::CaseInsensitive; } diff --git a/src/qtui/dockmanagernotificationbackend.cpp b/src/qtui/dockmanagernotificationbackend.cpp index bbeeff41..510abd28 100644 --- a/src/qtui/dockmanagernotificationbackend.cpp +++ b/src/qtui/dockmanagernotificationbackend.cpp @@ -30,7 +30,7 @@ #include "clientbacklogmanager.h" DockManagerNotificationBackend::DockManagerNotificationBackend(QObject *parent) - : AbstractNotificationBackend(parent), _bus(QDBusConnection::sessionBus()), _dock(nullptr), _item(nullptr), _count(0) + : AbstractNotificationBackend(parent), _bus(QDBusConnection::sessionBus()) { NotificationSettings notificationSettings; _enabled = notificationSettings.value("DockManager/Enabled", false).toBool(); diff --git a/src/qtui/dockmanagernotificationbackend.h b/src/qtui/dockmanagernotificationbackend.h index e3a2ca0a..a32e4c69 100644 --- a/src/qtui/dockmanagernotificationbackend.h +++ b/src/qtui/dockmanagernotificationbackend.h @@ -52,9 +52,9 @@ private: bool _enabled; bool _available; QDBusConnection _bus; - QDBusInterface *_dock; - QDBusInterface *_item; - int _count; + QDBusInterface *_dock{nullptr}; + QDBusInterface *_item{nullptr}; + int _count{0}; }; diff --git a/src/qtui/inputwidget.h b/src/qtui/inputwidget.h index fb687531..7ac1d4b7 100644 --- a/src/qtui/inputwidget.h +++ b/src/qtui/inputwidget.h @@ -183,9 +183,9 @@ private: struct HistoryState { QStringList history; QHash tempHistory; - qint32 idx; + qint32 idx{0}; QString inputLine; - inline HistoryState() : idx(0) {}; + inline HistoryState() {}; }; QMap historyMap; diff --git a/src/qtui/ircconnectionwizard.cpp b/src/qtui/ircconnectionwizard.cpp index d7e86587..756caf8b 100644 --- a/src/qtui/ircconnectionwizard.cpp +++ b/src/qtui/ircconnectionwizard.cpp @@ -28,10 +28,7 @@ #include IrcConnectionWizard::IrcConnectionWizard(QWidget *parent, Qt::WindowFlags flags) - : QWizard(parent, flags), - _introductionPage(nullptr), - _identityPage(nullptr), - _networkPage(nullptr) + : QWizard(parent, flags) { _introductionPage = createIntroductionPage(this); _identityPage = new IdentityPage(this); @@ -110,8 +107,7 @@ void IrcConnectionWizard::networkReady(NetworkId id) // Identity Page IdentityPage::IdentityPage(QWidget *parent) : QWizardPage(parent), - _identityEditWidget(new IdentityEditWidget(this)), - _identity(nullptr) + _identityEditWidget(new IdentityEditWidget(this)) { setTitle(tr("Setup Identity")); diff --git a/src/qtui/ircconnectionwizard.h b/src/qtui/ircconnectionwizard.h index 65509eb9..3347f212 100644 --- a/src/qtui/ircconnectionwizard.h +++ b/src/qtui/ircconnectionwizard.h @@ -40,9 +40,9 @@ private slots: void networkReady(NetworkId id); private: - QWizardPage *_introductionPage; - QWizardPage *_identityPage; - QWizardPage *_networkPage; + QWizardPage *_introductionPage{nullptr}; + QWizardPage *_identityPage{nullptr}; + QWizardPage *_networkPage{nullptr}; }; @@ -66,7 +66,7 @@ public: private: IdentityEditWidget *_identityEditWidget; - CertIdentity *_identity; + CertIdentity *_identity{nullptr}; }; diff --git a/src/qtui/mainwin.cpp b/src/qtui/mainwin.cpp index fc0e0617..e0ef6b96 100644 --- a/src/qtui/mainwin.cpp +++ b/src/qtui/mainwin.cpp @@ -161,11 +161,7 @@ MainWin::MainWin(QWidget *parent) #endif _msgProcessorStatusWidget(new MsgProcessorStatusWidget(this)), _coreConnectionStatusWidget(new CoreConnectionStatusWidget(Client::coreConnection(), this)), - _titleSetter(this), - _awayLog(nullptr), - _layoutLoaded(false), - _activeBufferViewIndex(-1), - _aboutToQuit(false) + _titleSetter(this) { setAttribute(Qt::WA_DeleteOnClose, false); // we delete the mainwin manually diff --git a/src/qtui/mainwin.h b/src/qtui/mainwin.h index 94a2d4b4..bb2972db 100644 --- a/src/qtui/mainwin.h +++ b/src/qtui/mainwin.h @@ -271,20 +271,20 @@ private: QMenu *_toolbarMenu; QToolBar *_mainToolBar, *_chatViewToolBar, *_nickToolBar; - QWidget *_awayLog; + QWidget *_awayLog{nullptr}; QMessageBox* _migrationWarning{nullptr}; - bool _layoutLoaded; + bool _layoutLoaded{false}; QSize _normalSize; //!< Size of the non-maximized window QPoint _normalPos; //!< Position of the non-maximized window BufferHotListFilter *_bufferHotList; QHash _jumpKeyMap; - int _activeBufferViewIndex; + int _activeBufferViewIndex{-1}; - bool _aboutToQuit; //closeEvent can occur multiple times on OSX + bool _aboutToQuit{false}; //closeEvent can occur multiple times on OSX friend class QtUi; }; diff --git a/src/qtui/settingsdlg.cpp b/src/qtui/settingsdlg.cpp index 13100afb..71db2025 100644 --- a/src/qtui/settingsdlg.cpp +++ b/src/qtui/settingsdlg.cpp @@ -27,8 +27,7 @@ #include "icon.h" SettingsDlg::SettingsDlg(QWidget *parent) - : QDialog(parent), - _currentPage(nullptr) + : QDialog(parent) { ui.setupUi(this); setModal(true); diff --git a/src/qtui/settingsdlg.h b/src/qtui/settingsdlg.h index 483855b8..210b9239 100644 --- a/src/qtui/settingsdlg.h +++ b/src/qtui/settingsdlg.h @@ -55,7 +55,7 @@ private slots: private: Ui::SettingsDlg ui; - SettingsPage *_currentPage; + SettingsPage *_currentPage{nullptr}; QHash pageIsLoaded; enum { diff --git a/src/qtui/settingspages/aliasesmodel.cpp b/src/qtui/settingspages/aliasesmodel.cpp index 569f56c6..39f2877f 100644 --- a/src/qtui/settingspages/aliasesmodel.cpp +++ b/src/qtui/settingspages/aliasesmodel.cpp @@ -27,9 +27,7 @@ #include "signalproxy.h" AliasesModel::AliasesModel(QObject *parent) - : QAbstractItemModel(parent), - _configChanged(false), - _modelReady(false) + : QAbstractItemModel(parent) { // we need this signal for future connects to reset the data; connect(Client::instance(), SIGNAL(connected()), this, SLOT(clientConnected())); diff --git a/src/qtui/settingspages/aliasesmodel.h b/src/qtui/settingspages/aliasesmodel.h index c46ff13b..94cf10eb 100644 --- a/src/qtui/settingspages/aliasesmodel.h +++ b/src/qtui/settingspages/aliasesmodel.h @@ -63,8 +63,8 @@ signals: private: ClientAliasManager _clonedAliasManager; - bool _configChanged; - bool _modelReady; + bool _configChanged{false}; + bool _modelReady{false}; const AliasManager &aliasManager() const; AliasManager &aliasManager(); diff --git a/src/qtui/settingspages/bufferviewsettingspage.cpp b/src/qtui/settingspages/bufferviewsettingspage.cpp index 3a4da10c..4a778073 100644 --- a/src/qtui/settingspages/bufferviewsettingspage.cpp +++ b/src/qtui/settingspages/bufferviewsettingspage.cpp @@ -34,10 +34,7 @@ #include "util.h" BufferViewSettingsPage::BufferViewSettingsPage(QWidget *parent) - : SettingsPage(tr("Interface"), tr("Custom Chat Lists"), parent), - _ignoreWidgetChanges(false), - _useBufferViewHint(false), - _bufferViewHint(0) + : SettingsPage(tr("Interface"), tr("Custom Chat Lists"), parent) { ui.setupUi(this); //Hide the hide inactive networks feature on older cores (which won't save the setting) diff --git a/src/qtui/settingspages/bufferviewsettingspage.h b/src/qtui/settingspages/bufferviewsettingspage.h index dbe47d1a..f4985d9b 100644 --- a/src/qtui/settingspages/bufferviewsettingspage.h +++ b/src/qtui/settingspages/bufferviewsettingspage.h @@ -61,9 +61,9 @@ private slots: private: Ui::BufferViewSettingsPage ui; - bool _ignoreWidgetChanges; - bool _useBufferViewHint; - int _bufferViewHint; + bool _ignoreWidgetChanges{false}; + bool _useBufferViewHint{false}; + int _bufferViewHint{0}; // list of bufferviews to create QList _newBufferViews; diff --git a/src/qtui/settingspages/coreaccountsettingspage.cpp b/src/qtui/settingspages/coreaccountsettingspage.cpp index dfb74561..3a6f1cd6 100644 --- a/src/qtui/settingspages/coreaccountsettingspage.cpp +++ b/src/qtui/settingspages/coreaccountsettingspage.cpp @@ -28,8 +28,7 @@ CoreAccountSettingsPage::CoreAccountSettingsPage(QWidget *parent) : SettingsPage(tr("Remote Cores"), QString(), parent), _lastAccountId(0), - _lastAutoConnectId(0), - _standalone(false) + _lastAutoConnectId(0) { ui.setupUi(this); initAutoWidgets(); diff --git a/src/qtui/settingspages/coreaccountsettingspage.h b/src/qtui/settingspages/coreaccountsettingspage.h index ed47e47e..ebfed62c 100644 --- a/src/qtui/settingspages/coreaccountsettingspage.h +++ b/src/qtui/settingspages/coreaccountsettingspage.h @@ -77,7 +77,7 @@ private: inline FilteredCoreAccountModel *filteredModel() const { return _filteredModel; } AccountId _lastAccountId, _lastAutoConnectId; - bool _standalone; + bool _standalone{false}; void editAccount(const QModelIndex &); diff --git a/src/qtui/settingspages/identitiessettingspage.cpp b/src/qtui/settingspages/identitiessettingspage.cpp index 15e584ad..1e9244da 100644 --- a/src/qtui/settingspages/identitiessettingspage.cpp +++ b/src/qtui/settingspages/identitiessettingspage.cpp @@ -29,8 +29,7 @@ #include "signalproxy.h" IdentitiesSettingsPage::IdentitiesSettingsPage(QWidget *parent) - : SettingsPage(tr("IRC"), tr("Identities"), parent), - _editSsl(false) + : SettingsPage(tr("IRC"), tr("Identities"), parent) { ui.setupUi(this); ui.renameIdentity->setIcon(icon::get("edit-rename")); diff --git a/src/qtui/settingspages/identitiessettingspage.h b/src/qtui/settingspages/identitiessettingspage.h index 3674c345..4fc9c44d 100644 --- a/src/qtui/settingspages/identitiessettingspage.h +++ b/src/qtui/settingspages/identitiessettingspage.h @@ -73,7 +73,7 @@ private: QList changedIdentities; // for setting the widget changed state QList deletedIdentities; - bool _editSsl; + bool _editSsl{false}; void insertIdentity(CertIdentity *identity); void removeIdentity(Identity *identity); diff --git a/src/qtui/settingspages/ignorelistmodel.cpp b/src/qtui/settingspages/ignorelistmodel.cpp index 0af0364d..d95db34f 100644 --- a/src/qtui/settingspages/ignorelistmodel.cpp +++ b/src/qtui/settingspages/ignorelistmodel.cpp @@ -28,9 +28,7 @@ #include "signalproxy.h" IgnoreListModel::IgnoreListModel(QObject *parent) - : QAbstractItemModel(parent), - _configChanged(false), - _modelReady(false) + : QAbstractItemModel(parent) { // we need this signal for future connects to reset the data; connect(Client::instance(), SIGNAL(connected()), this, SLOT(clientConnected())); diff --git a/src/qtui/settingspages/ignorelistmodel.h b/src/qtui/settingspages/ignorelistmodel.h index 4a9f9c60..fb83fd21 100644 --- a/src/qtui/settingspages/ignorelistmodel.h +++ b/src/qtui/settingspages/ignorelistmodel.h @@ -67,8 +67,8 @@ signals: private: ClientIgnoreListManager _clonedIgnoreListManager; - bool _configChanged; - bool _modelReady; + bool _configChanged{false}; + bool _modelReady{false}; const IgnoreListManager &ignoreListManager() const; IgnoreListManager &ignoreListManager(); diff --git a/src/qtui/settingspages/keysequencewidget.cpp b/src/qtui/settingspages/keysequencewidget.cpp index 9e742c27..4f4afb26 100644 --- a/src/qtui/settingspages/keysequencewidget.cpp +++ b/src/qtui/settingspages/keysequencewidget.cpp @@ -162,10 +162,7 @@ void KeySequenceButton::keyReleaseEvent(QKeyEvent *e) /******************************************************************************/ KeySequenceWidget::KeySequenceWidget(QWidget *parent) - : QWidget(parent), - _shortcutsModel(nullptr), - _isRecording(false), - _modifierKeys(0) + : QWidget(parent) { QHBoxLayout *layout = new QHBoxLayout(this); layout->setMargin(0); diff --git a/src/qtui/settingspages/keysequencewidget.h b/src/qtui/settingspages/keysequencewidget.h index e8cddfdb..c1aafd4f 100644 --- a/src/qtui/settingspages/keysequencewidget.h +++ b/src/qtui/settingspages/keysequencewidget.h @@ -76,10 +76,10 @@ private: bool isShiftAsModifierAllowed(int keyQt) const; bool isKeySequenceAvailable(const QKeySequence &seq); - ShortcutsModel *_shortcutsModel; - bool _isRecording; + ShortcutsModel *_shortcutsModel{nullptr}; + bool _isRecording{false}; QKeySequence _keySequence, _oldKeySequence; - uint _modifierKeys; + uint _modifierKeys{0}; QModelIndex _conflictingIndex; KeySequenceButton *_keyButton; diff --git a/src/qtui/settingspages/networkssettingspage.cpp b/src/qtui/settingspages/networkssettingspage.cpp index afc4698e..bd77b353 100644 --- a/src/qtui/settingspages/networkssettingspage.cpp +++ b/src/qtui/settingspages/networkssettingspage.cpp @@ -40,9 +40,6 @@ NetworksSettingsPage::NetworksSettingsPage(QWidget *parent) : SettingsPage(tr("IRC"), tr("Networks"), parent) -#ifdef HAVE_SSL - , _cid(nullptr) -#endif { ui.setupUi(this); diff --git a/src/qtui/settingspages/networkssettingspage.h b/src/qtui/settingspages/networkssettingspage.h index 461c3e0d..965540e0 100644 --- a/src/qtui/settingspages/networkssettingspage.h +++ b/src/qtui/settingspages/networkssettingspage.h @@ -134,7 +134,7 @@ private: QHash networkInfos; bool _ignoreWidgetChanges; #ifdef HAVE_SSL - CertIdentity *_cid; + CertIdentity *_cid{nullptr}; #endif QIcon connectedIcon, connectingIcon, disconnectedIcon; diff --git a/src/qtui/settingspages/notificationssettingspage.cpp b/src/qtui/settingspages/notificationssettingspage.cpp index bd184d7c..2c164bc1 100644 --- a/src/qtui/settingspages/notificationssettingspage.cpp +++ b/src/qtui/settingspages/notificationssettingspage.cpp @@ -25,8 +25,7 @@ #include "qtui.h" NotificationsSettingsPage::NotificationsSettingsPage(QWidget *parent) - : SettingsPage(tr("Interface"), tr("Notifications"), parent), - _hasDefaults(false) + : SettingsPage(tr("Interface"), tr("Notifications"), parent) { QVBoxLayout *layout = new QVBoxLayout(this); foreach(AbstractNotificationBackend *backend, QtUi::notificationBackends()) { diff --git a/src/qtui/settingspages/notificationssettingspage.h b/src/qtui/settingspages/notificationssettingspage.h index 3b7fc441..9e498406 100644 --- a/src/qtui/settingspages/notificationssettingspage.h +++ b/src/qtui/settingspages/notificationssettingspage.h @@ -48,5 +48,5 @@ private slots: private: QList _configWidgets; - bool _hasDefaults; + bool _hasDefaults{false}; }; diff --git a/src/qtui/systraynotificationbackend.cpp b/src/qtui/systraynotificationbackend.cpp index deb49274..17778b78 100644 --- a/src/qtui/systraynotificationbackend.cpp +++ b/src/qtui/systraynotificationbackend.cpp @@ -34,8 +34,7 @@ #include "systemtray.h" SystrayNotificationBackend::SystrayNotificationBackend(QObject *parent) - : AbstractNotificationBackend(parent), - _blockActivation(false) + : AbstractNotificationBackend(parent) { NotificationSettings notificationSettings; notificationSettings.initAndNotify("Systray/ShowBubble", this, SLOT(showBubbleChanged(QVariant)), true); diff --git a/src/qtui/systraynotificationbackend.h b/src/qtui/systraynotificationbackend.h index 82425c3b..d8af7e39 100644 --- a/src/qtui/systraynotificationbackend.h +++ b/src/qtui/systraynotificationbackend.h @@ -52,7 +52,7 @@ private: bool _showBubble; QList _notifications; - bool _blockActivation; + bool _blockActivation{false}; }; diff --git a/src/uisupport/flatproxymodel.cpp b/src/uisupport/flatproxymodel.cpp index aef7b1b4..8088c130 100644 --- a/src/uisupport/flatproxymodel.cpp +++ b/src/uisupport/flatproxymodel.cpp @@ -24,8 +24,7 @@ #include FlatProxyModel::FlatProxyModel(QObject *parent) - : QAbstractProxyModel(parent), - _rootSourceItem(nullptr) + : QAbstractProxyModel(parent) { } @@ -683,9 +682,7 @@ void FlatProxyModel::checkChildCount(const QModelIndex &index, const SourceItem // SourceItem // ======================================== FlatProxyModel::SourceItem::SourceItem(int row, SourceItem *parent) - : _parent(parent), - _pos(-1), - _next(nullptr) + : _parent(parent) { if (parent) { parent->_childs.insert(row, this); diff --git a/src/uisupport/flatproxymodel.h b/src/uisupport/flatproxymodel.h index 17eb6805..84fb7797 100644 --- a/src/uisupport/flatproxymodel.h +++ b/src/uisupport/flatproxymodel.h @@ -73,7 +73,7 @@ private: QList _childCount; class SourceItem; - SourceItem *_rootSourceItem; + SourceItem *_rootSourceItem{nullptr}; void insertSubTree(const QModelIndex &source_idx, bool emitInsert = true); SourceItem *insertSubTreeHelper(SourceItem *parentItem, SourceItem *lastItem_, const QModelIndex &source_idx); @@ -117,8 +117,8 @@ private: SourceItem *_parent; QList _childs; - int _pos; - SourceItem *_next; + int _pos{-1}; + SourceItem *_next{nullptr}; friend class FlatProxyModel; }; diff --git a/src/uisupport/multilineedit.cpp b/src/uisupport/multilineedit.cpp index 2c9d5947..876f0b9e 100644 --- a/src/uisupport/multilineedit.cpp +++ b/src/uisupport/multilineedit.cpp @@ -31,17 +31,7 @@ const int leftMargin = 3; MultiLineEdit::MultiLineEdit(QWidget *parent) - : MultiLineEditParent(parent), - _idx(0), - _mode(SingleLine), - _singleLine(true), - _minHeight(1), - _maxHeight(5), - _scrollBarsEnabled(true), - _pasteProtectionEnabled(true), - _emacsMode(false), - _completionSpace(0), - _lastDocumentHeight(-1) + : MultiLineEditParent(parent) { document()->setDocumentMargin(0); diff --git a/src/uisupport/multilineedit.h b/src/uisupport/multilineedit.h index 61fafa6e..a8d2d130 100644 --- a/src/uisupport/multilineedit.h +++ b/src/uisupport/multilineedit.h @@ -128,18 +128,18 @@ private: private: QStringList _history; QHash _tempHistory; - qint32 _idx; - Mode _mode; - bool _singleLine; - int _minHeight; - int _maxHeight; - bool _scrollBarsEnabled; - bool _pasteProtectionEnabled; - bool _emacsMode; - int _completionSpace; + qint32 _idx{0}; + Mode _mode{SingleLine}; + bool _singleLine{true}; + int _minHeight{1}; + int _maxHeight{5}; + bool _scrollBarsEnabled{true}; + bool _pasteProtectionEnabled{true}; + bool _emacsMode{false}; + int _completionSpace{0}; QSize _sizeHint; - qreal _lastDocumentHeight; + qreal _lastDocumentHeight{-1}; QMap _mircColorMap; diff --git a/src/uisupport/networkmodelcontroller.cpp b/src/uisupport/networkmodelcontroller.cpp index 69797bc2..d7dc64ee 100644 --- a/src/uisupport/networkmodelcontroller.cpp +++ b/src/uisupport/networkmodelcontroller.cpp @@ -41,9 +41,7 @@ NetworkModelController::NetworkModelController(QObject *parent) : QObject(parent), - _actionCollection(new ActionCollection(this)), - _messageFilter(nullptr), - _receiver(nullptr) + _actionCollection(new ActionCollection(this)) { connect(_actionCollection, SIGNAL(actionTriggered(QAction *)), SLOT(actionTriggered(QAction *))); } diff --git a/src/uisupport/networkmodelcontroller.h b/src/uisupport/networkmodelcontroller.h index e224b75f..05117801 100644 --- a/src/uisupport/networkmodelcontroller.h +++ b/src/uisupport/networkmodelcontroller.h @@ -185,9 +185,9 @@ private: QHash _actionByType; QList _indexList; - MessageFilter *_messageFilter; + MessageFilter *_messageFilter{nullptr}; QString _contextItem; ///< Channel name or nick to provide context menu for - QObject *_receiver; + QObject *_receiver{nullptr}; const char *_method; }; diff --git a/src/uisupport/styledlabel.cpp b/src/uisupport/styledlabel.cpp index 6e2361b0..1d590f21 100644 --- a/src/uisupport/styledlabel.cpp +++ b/src/uisupport/styledlabel.cpp @@ -28,10 +28,7 @@ StyledLabel::StyledLabel(QWidget *parent) : QFrame(parent), - _wrapMode(QTextOption::NoWrap), - _alignment(Qt::AlignVCenter|Qt::AlignLeft), - _toolTipEnabled(true), - _resizeMode(NoResize) + _alignment(Qt::AlignVCenter|Qt::AlignLeft) { setMouseTracking(true); diff --git a/src/uisupport/styledlabel.h b/src/uisupport/styledlabel.h index 1a746085..9df5da40 100644 --- a/src/uisupport/styledlabel.h +++ b/src/uisupport/styledlabel.h @@ -73,12 +73,12 @@ protected: private: QSize _sizeHint; - QTextOption::WrapMode _wrapMode; + QTextOption::WrapMode _wrapMode{QTextOption::NoWrap}; Qt::Alignment _alignment; QTextLayout _layout; ClickableList _clickables; - bool _toolTipEnabled; - ResizeMode _resizeMode; + bool _toolTipEnabled{true}; + ResizeMode _resizeMode{NoResize}; QList _layoutList; QVector _extraLayoutList; -- 2.20.1