From fcacaaf16551524c7ebb6114254d005274cc3d63 Mon Sep 17 00:00:00 2001 From: Manuel Nickschas Date: Mon, 10 Sep 2018 18:38:20 +0200 Subject: [PATCH] clazy: Convert many old-style connects into function pointer based Since Qt5, signal/slot connections can be expressed using function pointers rather than the SIGNAL/SLOT macros. This is a) much more efficient, and b) provides a compile-time check for the sender and receiver being compatible. Let clazy auto-fix old-style connects where it can. However, a lot of occurrences remain where we'll need manual intervention for one reason or another. --- src/client/abstractui.h | 2 +- src/client/buffermodel.cpp | 12 +-- src/client/bufferviewoverlay.cpp | 2 +- src/client/client.cpp | 53 ++++++------ src/client/clientauthhandler.cpp | 14 +-- src/client/clientbufferviewconfig.cpp | 2 +- src/client/clientidentity.cpp | 4 +- src/client/clientignorelistmanager.cpp | 2 +- src/client/clientirclisthelper.h | 4 +- src/client/clienttransfer.cpp | 2 +- src/client/clienttransfermanager.cpp | 2 +- src/client/coreconnection.cpp | 50 +++++------ src/client/execwrapper.cpp | 8 +- src/client/messagemodel.cpp | 2 +- src/client/networkmodel.cpp | 86 +++++++++---------- src/client/selectionmodelsynchronizer.cpp | 18 ++-- src/client/transfermodel.cpp | 20 ++--- src/client/treemodel.cpp | 40 ++++----- src/common/authhandler.cpp | 2 +- src/common/compressor.cpp | 6 +- src/common/internalpeer.cpp | 2 +- src/common/logger.cpp | 2 +- src/common/network.cpp | 2 +- src/common/remotepeer.cpp | 12 +-- src/common/signalproxy.cpp | 14 +-- src/core/abstractsqlstorage.cpp | 6 +- src/core/core.cpp | 18 ++-- src/core/corealiasmanager.cpp | 2 +- src/core/coreauthhandler.cpp | 4 +- src/core/corebasichandler.cpp | 4 +- src/core/corebuffersyncer.cpp | 4 +- src/core/coredccconfig.cpp | 2 +- src/core/corehighlightrulemanager.cpp | 2 +- src/core/coreidentity.cpp | 12 +-- src/core/coreignorelistmanager.cpp | 2 +- src/core/corenetwork.cpp | 50 +++++------ src/core/coresession.cpp | 20 ++--- src/core/coresessioneventprocessor.cpp | 18 ++-- src/core/coretransfer.cpp | 6 +- src/core/ctcpparser.cpp | 4 +- src/core/eventstringifier.cpp | 2 +- src/core/identserver.cpp | 8 +- src/core/ircparser.cpp | 2 +- src/core/netsplit.cpp | 6 +- src/core/sessionthread.cpp | 14 +-- src/main/monoapplication.cpp | 8 +- src/qtui/bufferwidget.cpp | 32 +++---- src/qtui/channellistdlg.cpp | 18 ++-- src/qtui/chatlinemodel.cpp | 2 +- src/qtui/chatmonitorview.cpp | 2 +- src/qtui/chatscene.cpp | 28 +++--- src/qtui/chatview.cpp | 14 +-- src/qtui/chatviewsearchbar.cpp | 6 +- src/qtui/chatviewsearchcontroller.cpp | 4 +- src/qtui/coreconfigwizard.cpp | 12 +-- src/qtui/coreconnectdlg.cpp | 6 +- src/qtui/coreconnectionstatuswidget.cpp | 14 +-- src/qtui/coreinfodlg.cpp | 10 +-- src/qtui/debuglogdlg.cpp | 2 +- src/qtui/dockmanagernotificationbackend.cpp | 4 +- src/qtui/inputwidget.cpp | 30 +++---- src/qtui/ircconnectionwizard.cpp | 10 +-- src/qtui/legacysystemtray.cpp | 18 ++-- src/qtui/mainpage.cpp | 4 +- src/qtui/mainwin.cpp | 78 ++++++++--------- src/qtui/markerlineitem.cpp | 2 +- src/qtui/passwordchangedlg.cpp | 10 +-- src/qtui/qtmultimedianotificationbackend.cpp | 4 +- src/qtui/qtui.cpp | 6 +- src/qtui/qtuiapplication.cpp | 2 +- src/qtui/qtuimessageprocessor.cpp | 2 +- src/qtui/settingsdlg.cpp | 6 +- src/qtui/settingspagedlg.cpp | 2 +- src/qtui/settingspages/aliasesmodel.cpp | 6 +- .../settingspages/aliasessettingspage.cpp | 6 +- .../settingspages/appearancesettingspage.cpp | 22 ++--- .../settingspages/bufferviewsettingspage.cpp | 34 ++++---- .../settingspages/chatmonitorsettingspage.cpp | 10 +-- .../settingspages/connectionsettingspage.cpp | 6 +- .../settingspages/coreaccountsettingspage.cpp | 6 +- .../coreconnectionsettingspage.cpp | 6 +- .../corehighlightsettingspage.cpp | 38 ++++---- src/qtui/settingspages/dccsettingspage.cpp | 4 +- .../settingspages/highlightsettingspage.cpp | 20 ++--- .../settingspages/identitiessettingspage.cpp | 20 ++--- src/qtui/settingspages/identityeditwidget.cpp | 30 +++---- src/qtui/settingspages/ignorelistmodel.cpp | 6 +- .../settingspages/ignorelistsettingspage.cpp | 18 ++-- src/qtui/settingspages/keysequencewidget.cpp | 8 +- .../settingspages/networkssettingspage.cpp | 76 ++++++++-------- .../settingspages/shortcutssettingspage.cpp | 8 +- src/qtui/settingspages/sonnetsettingspage.cpp | 2 +- src/qtui/simplenetworkeditor.cpp | 4 +- src/qtui/statusnotifieritem.cpp | 20 ++--- src/qtui/systemtray.cpp | 6 +- src/qtui/systraynotificationbackend.cpp | 2 +- src/qtui/taskbarnotificationbackend.cpp | 4 +- src/qtui/topicwidget.cpp | 4 +- src/uisupport/abstractitemview.cpp | 20 ++--- src/uisupport/actioncollection.cpp | 14 +-- src/uisupport/bufferview.cpp | 24 +++--- src/uisupport/bufferviewfilter.cpp | 8 +- src/uisupport/bufferviewoverlayfilter.cpp | 4 +- src/uisupport/clearablelineedit.cpp | 4 +- src/uisupport/colorbutton.cpp | 2 +- src/uisupport/flatproxymodel.cpp | 50 +++++------ src/uisupport/fontselector.cpp | 2 +- src/uisupport/multilineedit.cpp | 4 +- src/uisupport/networkmodelcontroller.cpp | 8 +- src/uisupport/nickview.cpp | 8 +- src/uisupport/resizingstackedwidget.cpp | 2 +- src/uisupport/toolbaractionprovider.cpp | 4 +- 112 files changed, 703 insertions(+), 702 deletions(-) diff --git a/src/client/abstractui.h b/src/client/abstractui.h index 0a89121c..2c7e933c 100644 --- a/src/client/abstractui.h +++ b/src/client/abstractui.h @@ -43,7 +43,7 @@ public: virtual MessageModel *createMessageModel(QObject *parent) = 0; virtual AbstractMessageProcessor *createMessageProcessor(QObject *parent) = 0; -protected slots: +public slots: virtual void connectedToCore() {} virtual void disconnectedFromCore() {} diff --git a/src/client/buffermodel.cpp b/src/client/buffermodel.cpp index e5011f2e..0d9ec2d9 100644 --- a/src/client/buffermodel.cpp +++ b/src/client/buffermodel.cpp @@ -32,11 +32,11 @@ BufferModel::BufferModel(NetworkModel *parent) { setSourceModel(parent); if (Quassel::isOptionSet("debugbufferswitches")) { - connect(_selectionModelSynchronizer.selectionModel(), SIGNAL(currentChanged(const QModelIndex &, const QModelIndex &)), - this, SLOT(debug_currentChanged(const QModelIndex &, const QModelIndex &))); + connect(_selectionModelSynchronizer.selectionModel(), &QItemSelectionModel::currentChanged, + this, &BufferModel::debug_currentChanged); } - connect(Client::instance(), SIGNAL(networkCreated(NetworkId)), this, SLOT(newNetwork(NetworkId))); - connect(this, SIGNAL(rowsInserted(const QModelIndex &, int, int)), this, SLOT(newBuffers(const QModelIndex &, int, int))); + connect(Client::instance(), &Client::networkCreated, this, &BufferModel::newNetwork); + connect(this, &QAbstractItemModel::rowsInserted, this, &BufferModel::newBuffers); } @@ -57,8 +57,8 @@ void BufferModel::newNetwork(NetworkId id) { const Network *net = Client::network(id); Q_ASSERT(net); - connect(net, SIGNAL(connectionStateSet(Network::ConnectionState)), - this, SLOT(networkConnectionChanged(Network::ConnectionState))); + connect(net, &Network::connectionStateSet, + this, &BufferModel::networkConnectionChanged); } diff --git a/src/client/bufferviewoverlay.cpp b/src/client/bufferviewoverlay.cpp index 8e802fd9..0769435f 100644 --- a/src/client/bufferviewoverlay.cpp +++ b/src/client/bufferviewoverlay.cpp @@ -159,7 +159,7 @@ void BufferViewOverlay::viewInitialized(BufferViewConfig *config) } disconnect(config, SIGNAL(initDone()), this, SLOT(viewInitialized())); - connect(config, SIGNAL(configChanged()), this, SLOT(update())); + connect(config, &BufferViewConfig::configChanged, this, &BufferViewOverlay::update); // check if the view was removed in the meantime... if (_bufferViewIds.contains(config->bufferViewId())) diff --git a/src/client/client.cpp b/src/client/client.cpp index 82e7fd42..f4c50891 100644 --- a/src/client/client.cpp +++ b/src/client/client.cpp @@ -76,16 +76,15 @@ Client::Client(std::unique_ptr ui, QObject *parent) Q_INIT_RESOURCE(data); #endif - //connect(mainUi(), SIGNAL(connectToCore(const QVariantMap &)), this, SLOT(connectToCore(const QVariantMap &))); - connect(mainUi(), SIGNAL(disconnectFromCore()), this, SLOT(disconnectFromCore())); - connect(this, SIGNAL(connected()), mainUi(), SLOT(connectedToCore())); - connect(this, SIGNAL(disconnected()), mainUi(), SLOT(disconnectedFromCore())); + connect(mainUi(), &AbstractUi::disconnectFromCore, this, &Client::disconnectFromCore); + connect(this, &Client::connected, mainUi(), &AbstractUi::connectedToCore); + connect(this, &Client::disconnected, mainUi(), &AbstractUi::disconnectedFromCore); - connect(this, SIGNAL(networkRemoved(NetworkId)), _networkModel, SLOT(networkRemoved(NetworkId))); + connect(this, &Client::networkRemoved, _networkModel, &NetworkModel::networkRemoved); connect(this, SIGNAL(networkRemoved(NetworkId)), _messageProcessor, SLOT(networkRemoved(NetworkId))); - connect(backlogManager(), SIGNAL(messagesReceived(BufferId, int)), _messageModel, SLOT(messagesReceived(BufferId, int))); - connect(coreConnection(), SIGNAL(stateChanged(CoreConnection::ConnectionState)), SLOT(connectionStateChanged(CoreConnection::ConnectionState))); + connect(backlogManager(), &ClientBacklogManager::messagesReceived, _messageModel, &MessageModel::messagesReceived); + connect(coreConnection(), &CoreConnection::stateChanged, this, &Client::connectionStateChanged); SignalProxy *p = signalProxy(); @@ -210,7 +209,7 @@ void Client::addNetwork(Network *net) net->setProxy(signalProxy()); signalProxy()->synchronize(net); networkModel()->attachNetwork(net); - connect(net, SIGNAL(destroyed()), instance(), SLOT(networkDestroyed())); + connect(net, &QObject::destroyed, instance(), &Client::networkDestroyed); instance()->_networks[net->networkId()] = net; emit instance()->networkCreated(net->networkId()); } @@ -348,16 +347,16 @@ void Client::setSyncedToCore() // create buffersyncer Q_ASSERT(!_bufferSyncer); _bufferSyncer = new BufferSyncer(this); - connect(bufferSyncer(), SIGNAL(lastSeenMsgSet(BufferId, MsgId)), _networkModel, SLOT(setLastSeenMsgId(BufferId, MsgId))); - connect(bufferSyncer(), SIGNAL(markerLineSet(BufferId, MsgId)), _networkModel, SLOT(setMarkerLineMsgId(BufferId, MsgId))); - connect(bufferSyncer(), SIGNAL(bufferRemoved(BufferId)), this, SLOT(bufferRemoved(BufferId))); - connect(bufferSyncer(), SIGNAL(bufferRenamed(BufferId, QString)), this, SLOT(bufferRenamed(BufferId, QString))); - connect(bufferSyncer(), SIGNAL(buffersPermanentlyMerged(BufferId, BufferId)), this, SLOT(buffersPermanentlyMerged(BufferId, BufferId))); - connect(bufferSyncer(), SIGNAL(buffersPermanentlyMerged(BufferId, BufferId)), _messageModel, SLOT(buffersPermanentlyMerged(BufferId, BufferId))); - connect(bufferSyncer(), SIGNAL(bufferMarkedAsRead(BufferId)), SIGNAL(bufferMarkedAsRead(BufferId))); - connect(bufferSyncer(), SIGNAL(bufferActivityChanged(BufferId, const Message::Types)), _networkModel, SLOT(bufferActivityChanged(BufferId, const Message::Types))); - connect(bufferSyncer(), SIGNAL(highlightCountChanged(BufferId, int)), _networkModel, SLOT(highlightCountChanged(BufferId, int))); - connect(networkModel(), SIGNAL(requestSetLastSeenMsg(BufferId, MsgId)), bufferSyncer(), SLOT(requestSetLastSeenMsg(BufferId, const MsgId &))); + connect(bufferSyncer(), &BufferSyncer::lastSeenMsgSet, _networkModel, &NetworkModel::setLastSeenMsgId); + connect(bufferSyncer(), &BufferSyncer::markerLineSet, _networkModel, &NetworkModel::setMarkerLineMsgId); + connect(bufferSyncer(), &BufferSyncer::bufferRemoved, this, &Client::bufferRemoved); + connect(bufferSyncer(), &BufferSyncer::bufferRenamed, this, &Client::bufferRenamed); + connect(bufferSyncer(), &BufferSyncer::buffersPermanentlyMerged, this, &Client::buffersPermanentlyMerged); + connect(bufferSyncer(), &BufferSyncer::buffersPermanentlyMerged, _messageModel, &MessageModel::buffersPermanentlyMerged); + connect(bufferSyncer(), &BufferSyncer::bufferMarkedAsRead, this, &Client::bufferMarkedAsRead); + connect(bufferSyncer(), &BufferSyncer::bufferActivityChanged, _networkModel, &NetworkModel::bufferActivityChanged); + connect(bufferSyncer(), &BufferSyncer::highlightCountChanged, _networkModel, &NetworkModel::highlightCountChanged); + connect(networkModel(), &NetworkModel::requestSetLastSeenMsg, bufferSyncer(), &BufferSyncer::requestSetLastSeenMsg); SignalProxy *p = signalProxy(); p->synchronize(bufferSyncer()); @@ -365,12 +364,12 @@ void Client::setSyncedToCore() // create a new BufferViewManager Q_ASSERT(!_bufferViewManager); _bufferViewManager = new ClientBufferViewManager(p, this); - connect(_bufferViewManager, SIGNAL(initDone()), _bufferViewOverlay, SLOT(restore())); + connect(_bufferViewManager, &SyncableObject::initDone, _bufferViewOverlay, &BufferViewOverlay::restore); // create AliasManager Q_ASSERT(!_aliasManager); _aliasManager = new ClientAliasManager(this); - connect(aliasManager(), SIGNAL(initDone()), SLOT(sendBufferedUserInput())); + connect(aliasManager(), &SyncableObject::initDone, this, &Client::sendBufferedUserInput); p->synchronize(aliasManager()); // create NetworkConfig @@ -388,8 +387,8 @@ void Client::setSyncedToCore() _highlightRuleManager = new HighlightRuleManager(this); p->synchronize(highlightRuleManager()); // Listen to network removed events - connect(this, SIGNAL(networkRemoved(NetworkId)), - _highlightRuleManager, SLOT(networkRemoved(NetworkId))); + connect(this, &Client::networkRemoved, + _highlightRuleManager, &HighlightRuleManager::networkRemoved); /* not ready yet // create TransferManager and DccConfig if core supports them @@ -405,7 +404,7 @@ void Client::setSyncedToCore() */ // trigger backlog request once all active bufferviews are initialized - connect(bufferViewOverlay(), SIGNAL(initDone()), this, SLOT(finishConnectionInitialization())); + connect(bufferViewOverlay(), &BufferViewOverlay::initDone, this, &Client::finishConnectionInitialization); _connected = true; emit connected(); @@ -418,12 +417,12 @@ void Client::finishConnectionInitialization() // triggers this slot. But we have to make sure that we know all buffers yet. // so we check the BufferSyncer and in case it wasn't initialized we wait for that instead if (!bufferSyncer()->isInitialized()) { - disconnect(bufferViewOverlay(), SIGNAL(initDone()), this, SLOT(finishConnectionInitialization())); - connect(bufferSyncer(), SIGNAL(initDone()), this, SLOT(finishConnectionInitialization())); + disconnect(bufferViewOverlay(), &BufferViewOverlay::initDone, this, &Client::finishConnectionInitialization); + connect(bufferSyncer(), &SyncableObject::initDone, this, &Client::finishConnectionInitialization); return; } - disconnect(bufferViewOverlay(), SIGNAL(initDone()), this, SLOT(finishConnectionInitialization())); - disconnect(bufferSyncer(), SIGNAL(initDone()), this, SLOT(finishConnectionInitialization())); + disconnect(bufferViewOverlay(), &BufferViewOverlay::initDone, this, &Client::finishConnectionInitialization); + disconnect(bufferSyncer(), &SyncableObject::initDone, this, &Client::finishConnectionInitialization); requestInitialBacklog(); if (isCoreFeatureEnabled(Quassel::Feature::BufferActivitySync)) { diff --git a/src/client/clientauthhandler.cpp b/src/client/clientauthhandler.cpp index acd670d9..68f545ee 100644 --- a/src/client/clientauthhandler.cpp +++ b/src/client/clientauthhandler.cpp @@ -96,9 +96,9 @@ void ClientAuthHandler::connectToCore() #endif setSocket(socket); - connect(socket, SIGNAL(stateChanged(QAbstractSocket::SocketState)), SLOT(onSocketStateChanged(QAbstractSocket::SocketState))); - connect(socket, SIGNAL(readyRead()), SLOT(onReadyRead())); - connect(socket, SIGNAL(connected()), SLOT(onSocketConnected())); + connect(socket, &QAbstractSocket::stateChanged, this, &ClientAuthHandler::onSocketStateChanged); + connect(socket, &QIODevice::readyRead, this, &ClientAuthHandler::onReadyRead); + connect(socket, &QAbstractSocket::connected, this, &ClientAuthHandler::onSocketConnected); emit statusMessage(tr("Connecting to %1...").arg(_account.accountName())); socket->connectToHost(_account.hostName(), _account.port()); @@ -161,7 +161,7 @@ void ClientAuthHandler::onSocketDisconnected() if (_probing && _legacy) { // Remote host has closed the connection while probing _probing = false; - disconnect(socket(), SIGNAL(readyRead()), this, SLOT(onReadyRead())); + disconnect(socket(), &QIODevice::readyRead, this, &ClientAuthHandler::onReadyRead); emit statusMessage(tr("Reconnecting in compatibility mode...")); socket()->connectToHost(_account.hostName(), _account.port()); return; @@ -231,7 +231,7 @@ void ClientAuthHandler::onReadyRead() return; // make sure to not read more data than needed _probing = false; - disconnect(socket(), SIGNAL(readyRead()), this, SLOT(onReadyRead())); + disconnect(socket(), &QIODevice::readyRead, this, &ClientAuthHandler::onReadyRead); quint32 reply; socket()->read((char *)&reply, 4); @@ -279,7 +279,7 @@ void ClientAuthHandler::setPeer(RemotePeer *peer) qDebug().nospace() << "Using " << qPrintable(peer->protocolName()) << "..."; _peer = peer; - connect(_peer, SIGNAL(transferProgress(int,int)), SIGNAL(transferProgress(int,int))); + connect(_peer, &RemotePeer::transferProgress, this, &ClientAuthHandler::transferProgress); // The legacy protocol enables SSL later, after registration if (!_account.useSsl() || _legacy) @@ -433,7 +433,7 @@ void ClientAuthHandler::checkAndEnableSsl(bool coreSupportsSsl) auto *sslSocket = qobject_cast(socket()); Q_ASSERT(sslSocket); - connect(sslSocket, SIGNAL(encrypted()), SLOT(onSslSocketEncrypted())); + connect(sslSocket, &QSslSocket::encrypted, this, &ClientAuthHandler::onSslSocketEncrypted); connect(sslSocket, SIGNAL(sslErrors(QList)), SLOT(onSslErrors())); qDebug() << "Starting encryption..."; sslSocket->flush(); diff --git a/src/client/clientbufferviewconfig.cpp b/src/client/clientbufferviewconfig.cpp index 161ba184..7d5362ef 100644 --- a/src/client/clientbufferviewconfig.cpp +++ b/src/client/clientbufferviewconfig.cpp @@ -24,7 +24,7 @@ ClientBufferViewConfig::ClientBufferViewConfig(int bufferViewId, QObject *parent : BufferViewConfig(bufferViewId, parent), _locked(false) { - connect(this, SIGNAL(initDone()), this, SLOT(ensureDecoration())); + connect(this, &SyncableObject::initDone, this, &ClientBufferViewConfig::ensureDecoration); } diff --git a/src/client/clientidentity.cpp b/src/client/clientidentity.cpp index dc6ebe59..8e561688 100644 --- a/src/client/clientidentity.cpp +++ b/src/client/clientidentity.cpp @@ -55,8 +55,8 @@ void CertIdentity::enableEditSsl(bool enable) _certManager = new ClientCertManager(id(), this); if (isValid()) { // this means we are not a newly created Identity but have a proper Id Client::signalProxy()->synchronize(_certManager); - connect(_certManager, SIGNAL(updated()), this, SLOT(markClean())); - connect(_certManager, SIGNAL(initDone()), this, SLOT(markClean())); + connect(_certManager, &SyncableObject::updated, this, &CertIdentity::markClean); + connect(_certManager, &SyncableObject::initDone, this, &CertIdentity::markClean); } } diff --git a/src/client/clientignorelistmanager.cpp b/src/client/clientignorelistmanager.cpp index 93463af8..a23f8917 100644 --- a/src/client/clientignorelistmanager.cpp +++ b/src/client/clientignorelistmanager.cpp @@ -23,7 +23,7 @@ ClientIgnoreListManager::ClientIgnoreListManager(QObject *parent) : IgnoreListManager(parent) { - connect(this, SIGNAL(updatedRemotely()), SIGNAL(ignoreListChanged())); + connect(this, &SyncableObject::updatedRemotely, this, &ClientIgnoreListManager::ignoreListChanged); } diff --git a/src/client/clientirclisthelper.h b/src/client/clientirclisthelper.h index f852c071..d4dc98d0 100644 --- a/src/client/clientirclisthelper.h +++ b/src/client/clientirclisthelper.h @@ -20,9 +20,11 @@ #pragma once +#include "client-export.h" + #include "irclisthelper.h" -class ClientIrcListHelper : public IrcListHelper +class CLIENT_EXPORT ClientIrcListHelper : public IrcListHelper { Q_OBJECT diff --git a/src/client/clienttransfer.cpp b/src/client/clienttransfer.cpp index 97bbbc70..ca91e5c8 100644 --- a/src/client/clienttransfer.cpp +++ b/src/client/clienttransfer.cpp @@ -26,7 +26,7 @@ ClientTransfer::ClientTransfer(const QUuid &uuid, QObject *parent) : Transfer(uuid, parent), _file(nullptr) { - connect(this, SIGNAL(statusChanged(Transfer::Status)), SLOT(onStatusChanged(Transfer::Status))); + connect(this, &Transfer::statusChanged, this, &ClientTransfer::onStatusChanged); } diff --git a/src/client/clienttransfermanager.cpp b/src/client/clienttransfermanager.cpp index 5cd4d078..751a85aa 100644 --- a/src/client/clienttransfermanager.cpp +++ b/src/client/clienttransfermanager.cpp @@ -39,7 +39,7 @@ void ClientTransferManager::onCoreTransferAdded(const QUuid &uuid) } auto transfer = new ClientTransfer(uuid, this); - connect(transfer, SIGNAL(initDone()), SLOT(onTransferInitDone())); // we only want to add initialized transfers + connect(transfer, &SyncableObject::initDone, this, &ClientTransferManager::onTransferInitDone); // we only want to add initialized transfers Client::signalProxy()->synchronize(transfer); } diff --git a/src/client/coreconnection.cpp b/src/client/coreconnection.cpp index c6f4c9f5..982e439a 100644 --- a/src/client/coreconnection.cpp +++ b/src/client/coreconnection.cpp @@ -45,13 +45,13 @@ CoreConnection::CoreConnection(QObject *parent) void CoreConnection::init() { Client::signalProxy()->setHeartBeatInterval(30); - connect(Client::signalProxy(), SIGNAL(lagUpdated(int)), SIGNAL(lagUpdated(int))); + connect(Client::signalProxy(), &SignalProxy::lagUpdated, this, &CoreConnection::lagUpdated); _reconnectTimer.setSingleShot(true); - connect(&_reconnectTimer, SIGNAL(timeout()), SLOT(reconnectTimeout())); + connect(&_reconnectTimer, &QTimer::timeout, this, &CoreConnection::reconnectTimeout); _qNetworkConfigurationManager = new QNetworkConfigurationManager(this); - connect(_qNetworkConfigurationManager, SIGNAL(onlineStateChanged(bool)), SLOT(onlineStateChanged(bool))); + connect(_qNetworkConfigurationManager.data(), &QNetworkConfigurationManager::onlineStateChanged, this, &CoreConnection::onlineStateChanged); CoreConnectionSettings s; s.initAndNotify("PingTimeoutInterval", this, SLOT(pingTimeoutIntervalChanged(QVariant)), 60); @@ -386,28 +386,28 @@ void CoreConnection::connectToCurrentAccount() _authHandler = new ClientAuthHandler(currentAccount(), this); - connect(_authHandler, SIGNAL(disconnected()), SLOT(coreSocketDisconnected())); - connect(_authHandler, SIGNAL(connectionReady()), SLOT(onConnectionReady())); - connect(_authHandler, SIGNAL(socketError(QAbstractSocket::SocketError,QString)), SLOT(coreSocketError(QAbstractSocket::SocketError,QString))); - connect(_authHandler, SIGNAL(transferProgress(int,int)), SLOT(updateProgress(int,int))); + connect(_authHandler.data(), &AuthHandler::disconnected, this, &CoreConnection::coreSocketDisconnected); + connect(_authHandler.data(), &ClientAuthHandler::connectionReady, this, &CoreConnection::onConnectionReady); + connect(_authHandler.data(), &AuthHandler::socketError, this, &CoreConnection::coreSocketError); + connect(_authHandler.data(), &ClientAuthHandler::transferProgress, this, &CoreConnection::updateProgress); connect(_authHandler, SIGNAL(requestDisconnect(QString,bool)), SLOT(disconnectFromCore(QString,bool))); - connect(_authHandler, SIGNAL(errorMessage(QString)), SIGNAL(connectionError(QString))); - connect(_authHandler, SIGNAL(errorPopup(QString)), SIGNAL(connectionErrorPopup(QString)), Qt::QueuedConnection); - connect(_authHandler, SIGNAL(statusMessage(QString)), SIGNAL(connectionMsg(QString))); - connect(_authHandler, SIGNAL(encrypted(bool)), SIGNAL(encrypted(bool))); - connect(_authHandler, SIGNAL(startCoreSetup(QVariantList, QVariantList)), SIGNAL(startCoreSetup(QVariantList, QVariantList))); - connect(_authHandler, SIGNAL(coreSetupFailed(QString)), SIGNAL(coreSetupFailed(QString))); - connect(_authHandler, SIGNAL(coreSetupSuccessful()), SIGNAL(coreSetupSuccess())); - connect(_authHandler, SIGNAL(userAuthenticationRequired(CoreAccount*,bool*,QString)), SIGNAL(userAuthenticationRequired(CoreAccount*,bool*,QString))); - connect(_authHandler, SIGNAL(handleNoSslInClient(bool*)), SIGNAL(handleNoSslInClient(bool*))); - connect(_authHandler, SIGNAL(handleNoSslInCore(bool*)), SIGNAL(handleNoSslInCore(bool*))); + connect(_authHandler.data(), &ClientAuthHandler::errorMessage, this, &CoreConnection::connectionError); + connect(_authHandler.data(), &ClientAuthHandler::errorPopup, this, &CoreConnection::connectionErrorPopup, Qt::QueuedConnection); + connect(_authHandler.data(), &ClientAuthHandler::statusMessage, this, &CoreConnection::connectionMsg); + connect(_authHandler.data(), &ClientAuthHandler::encrypted, this, &CoreConnection::encrypted); + connect(_authHandler.data(), &ClientAuthHandler::startCoreSetup, this, &CoreConnection::startCoreSetup); + connect(_authHandler.data(), &ClientAuthHandler::coreSetupFailed, this, &CoreConnection::coreSetupFailed); + connect(_authHandler.data(), &ClientAuthHandler::coreSetupSuccessful, this, &CoreConnection::coreSetupSuccess); + connect(_authHandler.data(), &ClientAuthHandler::userAuthenticationRequired, this, &CoreConnection::userAuthenticationRequired); + connect(_authHandler.data(), &ClientAuthHandler::handleNoSslInClient, this, &CoreConnection::handleNoSslInClient); + connect(_authHandler.data(), &ClientAuthHandler::handleNoSslInCore, this, &CoreConnection::handleNoSslInCore); #ifdef HAVE_SSL - connect(_authHandler, SIGNAL(handleSslErrors(const QSslSocket*,bool*,bool*)), SIGNAL(handleSslErrors(const QSslSocket*,bool*,bool*))); + connect(_authHandler.data(), &ClientAuthHandler::handleSslErrors, this, &CoreConnection::handleSslErrors); #endif - connect(_authHandler, SIGNAL(loginSuccessful(CoreAccount)), SLOT(onLoginSuccessful(CoreAccount))); - connect(_authHandler, SIGNAL(handshakeComplete(RemotePeer*,Protocol::SessionState)), SLOT(onHandshakeComplete(RemotePeer*,Protocol::SessionState))); + connect(_authHandler.data(), &ClientAuthHandler::loginSuccessful, this, &CoreConnection::onLoginSuccessful); + connect(_authHandler.data(), &ClientAuthHandler::handshakeComplete, this, &CoreConnection::onHandshakeComplete); setState(Connecting); _authHandler->connectToCore(); @@ -451,9 +451,9 @@ void CoreConnection::onHandshakeComplete(RemotePeer *peer, const Protocol::Sessi _authHandler = nullptr; _peer = peer; - connect(peer, SIGNAL(disconnected()), SLOT(coreSocketDisconnected())); - connect(peer, SIGNAL(statusMessage(QString)), SIGNAL(connectionMsg(QString))); - connect(peer, SIGNAL(socketError(QAbstractSocket::SocketError,QString)), SLOT(coreSocketError(QAbstractSocket::SocketError,QString))); + connect(peer, &Peer::disconnected, this, &CoreConnection::coreSocketDisconnected); + connect(peer, &RemotePeer::statusMessage, this, &CoreConnection::connectionMsg); + connect(peer, &RemotePeer::socketError, this, &CoreConnection::coreSocketError); Client::signalProxy()->addPeer(_peer); // sigproxy takes ownership of the peer! @@ -498,8 +498,8 @@ void CoreConnection::syncToCore(const Protocol::SessionState &sessionState) continue; auto *net = new Network(netid, Client::instance()); _netsToSync.insert(net); - connect(net, SIGNAL(initDone()), SLOT(networkInitDone())); - connect(net, SIGNAL(destroyed()), SLOT(networkInitDone())); + connect(net, &SyncableObject::initDone, this, &CoreConnection::networkInitDone); + connect(net, &QObject::destroyed, this, &CoreConnection::networkInitDone); Client::addNetwork(net); } checkSyncState(); diff --git a/src/client/execwrapper.cpp b/src/client/execwrapper.cpp index 85125830..c44b69ce 100644 --- a/src/client/execwrapper.cpp +++ b/src/client/execwrapper.cpp @@ -29,13 +29,13 @@ ExecWrapper::ExecWrapper(QObject *parent) : QObject(parent) { - connect(&_process, SIGNAL(readyReadStandardOutput()), SLOT(processReadStdout())); - connect(&_process, SIGNAL(readyReadStandardError()), SLOT(processReadStderr())); + connect(&_process, &QProcess::readyReadStandardOutput, this, &ExecWrapper::processReadStdout); + connect(&_process, &QProcess::readyReadStandardError, this, &ExecWrapper::processReadStderr); connect(&_process, SIGNAL(finished(int, QProcess::ExitStatus)), SLOT(processFinished(int, QProcess::ExitStatus))); connect(&_process, SIGNAL(error(QProcess::ProcessError)), SLOT(processError(QProcess::ProcessError))); - connect(this, SIGNAL(output(QString)), SLOT(postStdout(QString))); - connect(this, SIGNAL(error(QString)), SLOT(postStderr(QString))); + connect(this, &ExecWrapper::output, this, &ExecWrapper::postStdout); + connect(this, &ExecWrapper::error, this, &ExecWrapper::postStderr); } diff --git a/src/client/messagemodel.cpp b/src/client/messagemodel.cpp index d817babc..a4b050d2 100644 --- a/src/client/messagemodel.cpp +++ b/src/client/messagemodel.cpp @@ -46,7 +46,7 @@ MessageModel::MessageModel(QObject *parent) _nextDayChange.setTimeSpec(Qt::LocalTime); _dayChangeTimer.setInterval(QDateTime::currentDateTime().secsTo(_nextDayChange) * 1000); _dayChangeTimer.start(); - connect(&_dayChangeTimer, SIGNAL(timeout()), this, SLOT(changeOfDay())); + connect(&_dayChangeTimer, &QTimer::timeout, this, &MessageModel::changeOfDay); } diff --git a/src/client/networkmodel.cpp b/src/client/networkmodel.cpp index 86a07465..dca6ffe5 100644 --- a/src/client/networkmodel.cpp +++ b/src/client/networkmodel.cpp @@ -46,8 +46,8 @@ NetworkItem::NetworkItem(const NetworkId &netid, AbstractTreeItem *parent) // use networkDataChanged() instead. Otherwise you will end up in a infinite loop // as we "sync" the dataChanged() signals of NetworkItem and StatusBufferItem setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable); - connect(this, SIGNAL(networkDataChanged(int)), this, SIGNAL(dataChanged(int))); - connect(this, SIGNAL(beginRemoveChilds(int, int)), this, SLOT(onBeginRemoveChilds(int, int))); + connect(this, &NetworkItem::networkDataChanged, this, &AbstractTreeItem::dataChanged); + connect(this, &AbstractTreeItem::beginRemoveChilds, this, &NetworkItem::onBeginRemoveChilds); } @@ -115,9 +115,9 @@ BufferItem *NetworkItem::bufferItem(const BufferInfo &bufferInfo) case BufferInfo::StatusBuffer: _statusBufferItem = new StatusBufferItem(bufferInfo, this); bufferItem = _statusBufferItem; - disconnect(this, SIGNAL(networkDataChanged(int)), this, SIGNAL(dataChanged(int))); - connect(this, SIGNAL(networkDataChanged(int)), bufferItem, SIGNAL(dataChanged(int))); - connect(bufferItem, SIGNAL(dataChanged(int)), this, SIGNAL(dataChanged(int))); + disconnect(this, &NetworkItem::networkDataChanged, this, &AbstractTreeItem::dataChanged); + connect(this, &NetworkItem::networkDataChanged, bufferItem, &AbstractTreeItem::dataChanged); + connect(bufferItem, &AbstractTreeItem::dataChanged, this, &AbstractTreeItem::dataChanged); break; case BufferInfo::ChannelBuffer: bufferItem = new ChannelBufferItem(bufferInfo, this); @@ -166,18 +166,18 @@ void NetworkItem::attachNetwork(Network *network) _network = network; - connect(network, SIGNAL(networkNameSet(QString)), - this, SLOT(setNetworkName(QString))); - connect(network, SIGNAL(currentServerSet(QString)), - this, SLOT(setCurrentServer(QString))); - connect(network, SIGNAL(ircChannelAdded(IrcChannel *)), - this, SLOT(attachIrcChannel(IrcChannel *))); - connect(network, SIGNAL(ircUserAdded(IrcUser *)), - this, SLOT(attachIrcUser(IrcUser *))); - connect(network, SIGNAL(connectedSet(bool)), - this, SIGNAL(networkDataChanged())); - connect(network, SIGNAL(destroyed()), - this, SLOT(onNetworkDestroyed())); + connect(network, &Network::networkNameSet, + this, &NetworkItem::setNetworkName); + connect(network, &Network::currentServerSet, + this, &NetworkItem::setCurrentServer); + connect(network, &Network::ircChannelAdded, + this, &NetworkItem::attachIrcChannel); + connect(network, &Network::ircUserAdded, + this, &NetworkItem::attachIrcUser); + connect(network, &Network::connectedSet, + this, &NetworkItem::networkDataChanged); + connect(network, &QObject::destroyed, + this, &NetworkItem::onNetworkDestroyed); emit networkDataChanged(); } @@ -698,10 +698,10 @@ void QueryBufferItem::setIrcUser(IrcUser *ircUser) } if (ircUser) { - connect(ircUser, SIGNAL(destroyed(QObject*)), SLOT(removeIrcUser())); - connect(ircUser, SIGNAL(quited()), this, SLOT(removeIrcUser())); - connect(ircUser, SIGNAL(awaySet(bool)), this, SIGNAL(dataChanged())); - connect(ircUser, SIGNAL(encryptedSet(bool)), this, SLOT(setEncrypted(bool))); + connect(ircUser, &QObject::destroyed, this, &QueryBufferItem::removeIrcUser); + connect(ircUser, &IrcUser::quited, this, &QueryBufferItem::removeIrcUser); + connect(ircUser, &IrcUser::awaySet, this, &AbstractTreeItem::dataChanged); + connect(ircUser, &IrcUser::encryptedSet, this, &BufferItem::setEncrypted); } _ircUser = ircUser; @@ -809,24 +809,24 @@ void ChannelBufferItem::attachIrcChannel(IrcChannel *ircChannel) _ircChannel = ircChannel; - connect(ircChannel, SIGNAL(destroyed(QObject*)), - this, SLOT(ircChannelDestroyed())); - connect(ircChannel, SIGNAL(topicSet(QString)), - this, SLOT(setTopic(QString))); - connect(ircChannel, SIGNAL(encryptedSet(bool)), - this, SLOT(setEncrypted(bool))); + connect(ircChannel, &QObject::destroyed, + this, &ChannelBufferItem::ircChannelDestroyed); + connect(ircChannel, &IrcChannel::topicSet, + this, &BufferItem::setTopic); + connect(ircChannel, &IrcChannel::encryptedSet, + this, &BufferItem::setEncrypted); connect(ircChannel, SIGNAL(ircUsersJoined(QList )), this, SLOT(join(QList ))); - connect(ircChannel, SIGNAL(ircUserParted(IrcUser *)), - this, SLOT(part(IrcUser *))); - connect(ircChannel, SIGNAL(parted()), - this, SLOT(ircChannelParted())); - connect(ircChannel, SIGNAL(ircUserModesSet(IrcUser *, QString)), - this, SLOT(userModeChanged(IrcUser *))); - connect(ircChannel, SIGNAL(ircUserModeAdded(IrcUser *, QString)), - this, SLOT(userModeChanged(IrcUser *))); - connect(ircChannel, SIGNAL(ircUserModeRemoved(IrcUser *, QString)), - this, SLOT(userModeChanged(IrcUser *))); + connect(ircChannel, &IrcChannel::ircUserParted, + this, &ChannelBufferItem::part); + connect(ircChannel, &IrcChannel::parted, + this, &ChannelBufferItem::ircChannelParted); + connect(ircChannel, &IrcChannel::ircUserModesSet, + this, &ChannelBufferItem::userModeChanged); + connect(ircChannel, &IrcChannel::ircUserModeAdded, + this, &ChannelBufferItem::userModeChanged); + connect(ircChannel, &IrcChannel::ircUserModeRemoved, + this, &ChannelBufferItem::userModeChanged); if (!ircChannel->ircUsers().isEmpty()) join(ircChannel->ircUsers()); @@ -1113,9 +1113,9 @@ IrcUserItem::IrcUserItem(IrcUser *ircUser, AbstractTreeItem *parent) _ircUser(ircUser) { setObjectName(ircUser->nick()); - connect(ircUser, SIGNAL(quited()), this, SLOT(ircUserQuited())); + connect(ircUser, &IrcUser::quited, this, &IrcUserItem::ircUserQuited); connect(ircUser, SIGNAL(nickSet(QString)), this, SIGNAL(dataChanged())); - connect(ircUser, SIGNAL(awaySet(bool)), this, SIGNAL(dataChanged())); + connect(ircUser, &IrcUser::awaySet, this, &AbstractTreeItem::dataChanged); } @@ -1289,10 +1289,10 @@ QString IrcUserItem::channelModes() const NetworkModel::NetworkModel(QObject *parent) : TreeModel(NetworkModel::defaultHeader(), parent) { - connect(this, SIGNAL(rowsInserted(const QModelIndex &, int, int)), - this, SLOT(checkForNewBuffers(const QModelIndex &, int, int))); - connect(this, SIGNAL(rowsAboutToBeRemoved(const QModelIndex &, int, int)), - this, SLOT(checkForRemovedBuffers(const QModelIndex &, int, int))); + connect(this, &QAbstractItemModel::rowsInserted, + this, &NetworkModel::checkForNewBuffers); + connect(this, &QAbstractItemModel::rowsAboutToBeRemoved, + this, &NetworkModel::checkForRemovedBuffers); BufferSettings defaultSettings; defaultSettings.notify("UserNoticesTarget", this, SLOT(messageRedirectionSettingsChanged())); diff --git a/src/client/selectionmodelsynchronizer.cpp b/src/client/selectionmodelsynchronizer.cpp index d5b8f8bc..fc732d4a 100644 --- a/src/client/selectionmodelsynchronizer.cpp +++ b/src/client/selectionmodelsynchronizer.cpp @@ -30,10 +30,10 @@ SelectionModelSynchronizer::SelectionModelSynchronizer(QAbstractItemModel *paren _model(parent), _selectionModel(parent) { - connect(&_selectionModel, SIGNAL(currentChanged(const QModelIndex &, const QModelIndex &)), - this, SLOT(currentChanged(const QModelIndex &, const QModelIndex &))); - connect(&_selectionModel, SIGNAL(selectionChanged(const QItemSelection &, const QItemSelection &)), - this, SLOT(selectionChanged(const QItemSelection &, const QItemSelection &))); + connect(&_selectionModel, &QItemSelectionModel::currentChanged, + this, &SelectionModelSynchronizer::currentChanged); + connect(&_selectionModel, &QItemSelectionModel::selectionChanged, + this, &SelectionModelSynchronizer::selectionChanged); } @@ -66,12 +66,12 @@ void SelectionModelSynchronizer::synchronizeSelectionModel(QItemSelectionModel * return; } - connect(selectionModel, SIGNAL(currentChanged(QModelIndex, QModelIndex)), - this, SLOT(syncedCurrentChanged(QModelIndex, QModelIndex))); - connect(selectionModel, SIGNAL(selectionChanged(QItemSelection, QItemSelection)), - this, SLOT(syncedSelectionChanged(QItemSelection, QItemSelection))); + connect(selectionModel, &QItemSelectionModel::currentChanged, + this, &SelectionModelSynchronizer::syncedCurrentChanged); + connect(selectionModel, &QItemSelectionModel::selectionChanged, + this, &SelectionModelSynchronizer::syncedSelectionChanged); - connect(selectionModel, SIGNAL(destroyed(QObject *)), this, SLOT(selectionModelDestroyed(QObject *))); + connect(selectionModel, &QObject::destroyed, this, &SelectionModelSynchronizer::selectionModelDestroyed); _selectionModels << selectionModel; } diff --git a/src/client/transfermodel.cpp b/src/client/transfermodel.cpp index affd4871..a75b8c50 100644 --- a/src/client/transfermodel.cpp +++ b/src/client/transfermodel.cpp @@ -114,8 +114,8 @@ void TransferModel::setManager(const TransferManager *manager) _manager = manager; if (_manager) { - connect(manager, SIGNAL(transferAdded(QUuid)), SLOT(onTransferAdded(QUuid))); - connect(manager, SIGNAL(transferRemoved(QUuid)), SLOT(onTransferRemoved(QUuid))); + connect(manager, &TransferManager::transferAdded, this, &TransferModel::onTransferAdded); + connect(manager, &TransferManager::transferRemoved, this, &TransferModel::onTransferRemoved); for (auto &&transferId : _manager->transferIds()) { onTransferAdded(transferId); } @@ -132,14 +132,14 @@ void TransferModel::onTransferAdded(const QUuid &transferId) } // TODO Qt5: use new connection syntax to make things much less complicated - connect(transfer, SIGNAL(statusChanged(Transfer::Status)), SLOT(onTransferDataChanged())); - connect(transfer, SIGNAL(directionChanged(Transfer::Direction)), SLOT(onTransferDataChanged())); - connect(transfer, SIGNAL(addressChanged(QHostAddress)), SLOT(onTransferDataChanged())); - connect(transfer, SIGNAL(portChanged(quint16)), SLOT(onTransferDataChanged())); - connect(transfer, SIGNAL(fileNameChanged(QString)), SLOT(onTransferDataChanged())); - connect(transfer, SIGNAL(fileSizeChanged(quint64)), SLOT(onTransferDataChanged())); - connect(transfer, SIGNAL(transferredChanged(quint64)), SLOT(onTransferDataChanged())); - connect(transfer, SIGNAL(nickChanged(QString)), SLOT(onTransferDataChanged())); + connect(transfer, &Transfer::statusChanged, this, &TransferModel::onTransferDataChanged); + connect(transfer, &Transfer::directionChanged, this, &TransferModel::onTransferDataChanged); + connect(transfer, &Transfer::addressChanged, this, &TransferModel::onTransferDataChanged); + connect(transfer, &Transfer::portChanged, this, &TransferModel::onTransferDataChanged); + connect(transfer, &Transfer::fileNameChanged, this, &TransferModel::onTransferDataChanged); + connect(transfer, &Transfer::fileSizeChanged, this, &TransferModel::onTransferDataChanged); + connect(transfer, &Transfer::transferredChanged, this, &TransferModel::onTransferDataChanged); + connect(transfer, &Transfer::nickChanged, this, &TransferModel::onTransferDataChanged); beginInsertRows({}, rowCount(), rowCount()); _transferIds.append(transferId); diff --git a/src/client/treemodel.cpp b/src/client/treemodel.cpp index 314ec7f5..507a5daf 100644 --- a/src/client/treemodel.cpp +++ b/src/client/treemodel.cpp @@ -323,16 +323,16 @@ TreeModel::TreeModel(const QList &data, QObject *parent) connectItem(rootItem); if (Quassel::isOptionSet("debugmodel")) { - connect(this, SIGNAL(rowsAboutToBeInserted(const QModelIndex &, int, int)), - this, SLOT(debug_rowsAboutToBeInserted(const QModelIndex &, int, int))); - connect(this, SIGNAL(rowsAboutToBeRemoved(const QModelIndex &, int, int)), - this, SLOT(debug_rowsAboutToBeRemoved(const QModelIndex &, int, int))); - connect(this, SIGNAL(rowsInserted(const QModelIndex &, int, int)), - this, SLOT(debug_rowsInserted(const QModelIndex &, int, int))); - connect(this, SIGNAL(rowsRemoved(const QModelIndex &, int, int)), - this, SLOT(debug_rowsRemoved(const QModelIndex &, int, int))); - connect(this, SIGNAL(dataChanged(const QModelIndex &, const QModelIndex &)), - this, SLOT(debug_dataChanged(const QModelIndex &, const QModelIndex &))); + connect(this, &QAbstractItemModel::rowsAboutToBeInserted, + this, &TreeModel::debug_rowsAboutToBeInserted); + connect(this, &QAbstractItemModel::rowsAboutToBeRemoved, + this, &TreeModel::debug_rowsAboutToBeRemoved); + connect(this, &QAbstractItemModel::rowsInserted, + this, &TreeModel::debug_rowsInserted); + connect(this, &QAbstractItemModel::rowsRemoved, + this, &TreeModel::debug_rowsRemoved); + connect(this, &QAbstractItemModel::dataChanged, + this, &TreeModel::debug_dataChanged); } } @@ -497,18 +497,18 @@ void TreeModel::itemDataChanged(int column) void TreeModel::connectItem(AbstractTreeItem *item) { - connect(item, SIGNAL(dataChanged(int)), - this, SLOT(itemDataChanged(int))); + connect(item, &AbstractTreeItem::dataChanged, + this, &TreeModel::itemDataChanged); - connect(item, SIGNAL(beginAppendChilds(int, int)), - this, SLOT(beginAppendChilds(int, int))); - connect(item, SIGNAL(endAppendChilds()), - this, SLOT(endAppendChilds())); + connect(item, &AbstractTreeItem::beginAppendChilds, + this, &TreeModel::beginAppendChilds); + connect(item, &AbstractTreeItem::endAppendChilds, + this, &TreeModel::endAppendChilds); - connect(item, SIGNAL(beginRemoveChilds(int, int)), - this, SLOT(beginRemoveChilds(int, int))); - connect(item, SIGNAL(endRemoveChilds()), - this, SLOT(endRemoveChilds())); + connect(item, &AbstractTreeItem::beginRemoveChilds, + this, &TreeModel::beginRemoveChilds); + connect(item, &AbstractTreeItem::endRemoveChilds, + this, &TreeModel::endRemoveChilds); } diff --git a/src/common/authhandler.cpp b/src/common/authhandler.cpp index 67947301..f1dc2920 100644 --- a/src/common/authhandler.cpp +++ b/src/common/authhandler.cpp @@ -39,7 +39,7 @@ void AuthHandler::setSocket(QTcpSocket *socket) { _socket = socket; connect(socket, SIGNAL(error(QAbstractSocket::SocketError)), SLOT(onSocketError(QAbstractSocket::SocketError))); - connect(socket, SIGNAL(disconnected()), SLOT(onSocketDisconnected())); + connect(socket, &QAbstractSocket::disconnected, this, &AuthHandler::onSocketDisconnected); } diff --git a/src/common/compressor.cpp b/src/common/compressor.cpp index 2b91bebe..bef6dbbe 100644 --- a/src/common/compressor.cpp +++ b/src/common/compressor.cpp @@ -33,7 +33,7 @@ Compressor::Compressor(QTcpSocket *socket, Compressor::CompressionLevel level, Q _inflater(nullptr), _deflater(nullptr) { - connect(socket, SIGNAL(readyRead()), SLOT(readData())); + connect(socket, &QIODevice::readyRead, this, &Compressor::readData); bool ok = true; if (level != NoCompression) @@ -48,7 +48,7 @@ Compressor::Compressor(QTcpSocket *socket, Compressor::CompressionLevel level, Q // It's possible that more data has already arrived during the handshake, so readyRead() wouldn't be triggered. // However, we want to give RemotePeer a chance to connect to our signals, so trigger this asynchronously. if (socket->bytesAvailable()) - QTimer::singleShot(0, this, SLOT(readData())); + QTimer::singleShot(0, this, &Compressor::readData); } @@ -126,7 +126,7 @@ qint64 Compressor::read(char *data, qint64 maxSize) // If there's still data left in the socket buffer, make sure to schedule a read if (_socket->bytesAvailable()) - QTimer::singleShot(0, this, SLOT(readData())); + QTimer::singleShot(0, this, &Compressor::readData); return n; } diff --git a/src/common/internalpeer.cpp b/src/common/internalpeer.cpp index 6ce19bd2..5ac80cb5 100644 --- a/src/common/internalpeer.cpp +++ b/src/common/internalpeer.cpp @@ -130,7 +130,7 @@ void InternalPeer::setPeer(InternalPeer *peer) connect(peer, SIGNAL(dispatchMessage(Protocol::InitRequest)), SLOT(handleMessage(Protocol::InitRequest))); connect(peer, SIGNAL(dispatchMessage(Protocol::InitData)) , SLOT(handleMessage(Protocol::InitData))); - connect(peer, SIGNAL(disconnected()), SLOT(peerDisconnected())); + connect(peer, &Peer::disconnected, this, &InternalPeer::peerDisconnected); _isOpen = true; } diff --git a/src/common/logger.cpp b/src/common/logger.cpp index c767fc65..97afb40d 100644 --- a/src/common/logger.cpp +++ b/src/common/logger.cpp @@ -52,7 +52,7 @@ Logger::Logger(QObject *parent) }(); Q_UNUSED(registered) - connect(this, SIGNAL(messageLogged(Logger::LogEntry)), this, SLOT(onMessageLogged(Logger::LogEntry))); + connect(this, &Logger::messageLogged, this, &Logger::onMessageLogged); qInstallMessageHandler(Logger::messageHandler); } diff --git a/src/common/network.cpp b/src/common/network.cpp index f76cd30e..686c2e05 100644 --- a/src/common/network.cpp +++ b/src/common/network.cpp @@ -317,7 +317,7 @@ IrcUser *Network::newIrcUser(const QString &hostmask, const QVariantMap &initDat else qWarning() << "unable to synchronize new IrcUser" << hostmask << "forgot to call Network::setProxy(SignalProxy *)?"; - connect(ircuser, SIGNAL(nickSet(QString)), this, SLOT(ircUserNickChanged(QString))); + connect(ircuser, &IrcUser::nickSet, this, &Network::ircUserNickChanged); _ircUsers[nick] = ircuser; diff --git a/src/common/remotepeer.cpp b/src/common/remotepeer.cpp index d621632f..942bbd68 100644 --- a/src/common/remotepeer.cpp +++ b/src/common/remotepeer.cpp @@ -46,9 +46,9 @@ RemotePeer::RemotePeer(::AuthHandler *authHandler, QTcpSocket *socket, Compresso _msgSize(0) { socket->setParent(this); - connect(socket, SIGNAL(stateChanged(QAbstractSocket::SocketState)), SLOT(onSocketStateChanged(QAbstractSocket::SocketState))); + connect(socket, &QAbstractSocket::stateChanged, this, &RemotePeer::onSocketStateChanged); connect(socket, SIGNAL(error(QAbstractSocket::SocketError)), SLOT(onSocketError(QAbstractSocket::SocketError))); - connect(socket, SIGNAL(disconnected()), SIGNAL(disconnected())); + connect(socket, &QAbstractSocket::disconnected, this, &Peer::disconnected); #ifdef HAVE_SSL auto *sslSocket = qobject_cast(socket); @@ -56,10 +56,10 @@ RemotePeer::RemotePeer(::AuthHandler *authHandler, QTcpSocket *socket, Compresso connect(sslSocket, SIGNAL(encrypted()), SIGNAL(secureStateChanged())); #endif - connect(_compressor, SIGNAL(readyRead()), SLOT(onReadyRead())); - connect(_compressor, SIGNAL(error(Compressor::Error)), SLOT(onCompressionError(Compressor::Error))); + connect(_compressor, &Compressor::readyRead, this, &RemotePeer::onReadyRead); + connect(_compressor, &Compressor::error, this, &RemotePeer::onCompressionError); - connect(_heartBeatTimer, SIGNAL(timeout()), SLOT(sendHeartBeat())); + connect(_heartBeatTimer, &QTimer::timeout, this, &RemotePeer::sendHeartBeat); } @@ -132,7 +132,7 @@ void RemotePeer::setSignalProxy(::SignalProxy *proxy) return; } _signalProxy = proxy; - connect(proxy, SIGNAL(heartBeatIntervalChanged(int)), SLOT(changeHeartBeatInterval(int))); + connect(proxy, &SignalProxy::heartBeatIntervalChanged, this, &RemotePeer::changeHeartBeatInterval); _heartBeatTimer->setInterval(proxy->heartBeatInterval() * 1000); _heartBeatTimer->start(); } diff --git a/src/common/signalproxy.cpp b/src/common/signalproxy.cpp index 89355383..a629551c 100644 --- a/src/common/signalproxy.cpp +++ b/src/common/signalproxy.cpp @@ -288,11 +288,11 @@ bool SignalProxy::addPeer(Peer *peer) qWarning("SignalProxy: only one peer allowed in client mode!"); return false; } - connect(peer, SIGNAL(lagUpdated(int)), SIGNAL(lagUpdated(int))); + connect(peer, &Peer::lagUpdated, this, &SignalProxy::lagUpdated); } - connect(peer, SIGNAL(disconnected()), SLOT(removePeerBySender())); - connect(peer, SIGNAL(secureStateChanged(bool)), SLOT(updateSecureState())); + connect(peer, &Peer::disconnected, this, &SignalProxy::removePeerBySender); + connect(peer, &Peer::secureStateChanged, this, &SignalProxy::updateSecureState); if (!peer->parent()) peer->setParent(this); @@ -426,8 +426,8 @@ bool SignalProxy::attachSignal(QObject *sender, const char *signal, const QByteA createExtendedMetaObject(meta); _signalRelay->attachSignal(sender, methodId, sigName); - disconnect(sender, SIGNAL(destroyed(QObject *)), this, SLOT(detachObject(QObject *))); - connect(sender, SIGNAL(destroyed(QObject *)), this, SLOT(detachObject(QObject *))); + disconnect(sender, &QObject::destroyed, this, &SignalProxy::detachObject); + connect(sender, &QObject::destroyed, this, &SignalProxy::detachObject); return true; } @@ -446,8 +446,8 @@ bool SignalProxy::attachSlot(const QByteArray &sigName, QObject *recv, const cha QByteArray funcName = QMetaObject::normalizedSignature(sigName.constData()); _attachedSlots.insert(funcName, qMakePair(recv, methodId)); - disconnect(recv, SIGNAL(destroyed(QObject *)), this, SLOT(detachObject(QObject *))); - connect(recv, SIGNAL(destroyed(QObject *)), this, SLOT(detachObject(QObject *))); + disconnect(recv, &QObject::destroyed, this, &SignalProxy::detachObject); + connect(recv, &QObject::destroyed, this, &SignalProxy::detachObject); return true; } diff --git a/src/core/abstractsqlstorage.cpp b/src/core/abstractsqlstorage.cpp index ca1fa996..db2cd9b8 100644 --- a/src/core/abstractsqlstorage.cpp +++ b/src/core/abstractsqlstorage.cpp @@ -77,9 +77,9 @@ void AbstractSqlStorage::addConnectionToPool() Connection *connection = new Connection(QLatin1String(QString("quassel_%1_con_%2").arg(driverName()).arg(connectionId).toLatin1())); connection->moveToThread(currentThread); - connect(this, SIGNAL(destroyed()), connection, SLOT(deleteLater())); - connect(currentThread, SIGNAL(destroyed()), connection, SLOT(deleteLater())); - connect(connection, SIGNAL(destroyed()), this, SLOT(connectionDestroyed())); + connect(this, &QObject::destroyed, connection, &QObject::deleteLater); + connect(currentThread, &QObject::destroyed, connection, &QObject::deleteLater); + connect(connection, &QObject::destroyed, this, &AbstractSqlStorage::connectionDestroyed); _connectionPool[currentThread] = connection; QSqlDatabase db = QSqlDatabase::addDatabase(driverName(), connection->name()); diff --git a/src/core/core.cpp b/src/core/core.cpp index 35b46b61..84ce9796 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp @@ -221,12 +221,12 @@ void Core::init() return false; }); - connect(&_storageSyncTimer, SIGNAL(timeout()), this, SLOT(syncStorage())); + connect(&_storageSyncTimer, &QTimer::timeout, this, &Core::syncStorage); _storageSyncTimer.start(10 * 60 * 1000); // 10 minutes } - connect(&_server, SIGNAL(newConnection()), this, SLOT(incomingConnection())); - connect(&_v6server, SIGNAL(newConnection()), this, SLOT(incomingConnection())); + connect(&_server, &QTcpServer::newConnection, this, &Core::incomingConnection); + connect(&_v6server, &QTcpServer::newConnection, this, &Core::incomingConnection); if (!startListening()) { throw ExitException{EXIT_FAILURE, tr("Cannot open port for listening!")}; @@ -443,7 +443,7 @@ bool Core::initStorage(const QString &backend, const QVariantMap &settings, return false; } - connect(storage.get(), SIGNAL(dbUpgradeInProgress(bool)), this, SIGNAL(dbUpgradeInProgress(bool))); + connect(storage.get(), &Storage::dbUpgradeInProgress, this, &Core::dbUpgradeInProgress); Storage::State storageState = storage->init(settings, environment, loadFromEnvironment); switch (storageState) { @@ -465,8 +465,8 @@ bool Core::initStorage(const QString &backend, const QVariantMap &settings, case Storage::IsReady: // delete all other backends _registeredStorageBackends.clear(); - connect(storage.get(), SIGNAL(bufferInfoUpdated(UserId, const BufferInfo &)), - this, SIGNAL(bufferInfoUpdated(UserId, const BufferInfo &))); + connect(storage.get(), &Storage::bufferInfoUpdated, + this, &Core::bufferInfoUpdated); break; } _storage = std::move(storage); @@ -744,9 +744,9 @@ void Core::incomingConnection() auto *handler = new CoreAuthHandler(socket, this); _connectingClients.insert(handler); - connect(handler, SIGNAL(disconnected()), SLOT(clientDisconnected())); - connect(handler, SIGNAL(socketError(QAbstractSocket::SocketError,QString)), SLOT(socketError(QAbstractSocket::SocketError,QString))); - connect(handler, SIGNAL(handshakeComplete(RemotePeer*,UserId)), SLOT(setupClientSession(RemotePeer*,UserId))); + connect(handler, &AuthHandler::disconnected, this, &Core::clientDisconnected); + connect(handler, &AuthHandler::socketError, this, &Core::socketError); + connect(handler, &CoreAuthHandler::handshakeComplete, this, &Core::setupClientSession); quInfo() << qPrintable(tr("Client connected from")) << qPrintable(socket->peerAddress().toString()); diff --git a/src/core/corealiasmanager.cpp b/src/core/corealiasmanager.cpp index 0a7faa15..07006686 100644 --- a/src/core/corealiasmanager.cpp +++ b/src/core/corealiasmanager.cpp @@ -39,7 +39,7 @@ CoreAliasManager::CoreAliasManager(CoreSession *parent) loadDefaults(); // we store our settings whenever they change - connect(this, SIGNAL(updatedRemotely()), SLOT(save())); + connect(this, &SyncableObject::updatedRemotely, this, &CoreAliasManager::save); } diff --git a/src/core/coreauthhandler.cpp b/src/core/coreauthhandler.cpp index 369a1348..6a1a9c1c 100644 --- a/src/core/coreauthhandler.cpp +++ b/src/core/coreauthhandler.cpp @@ -38,7 +38,7 @@ CoreAuthHandler::CoreAuthHandler(QTcpSocket *socket, QObject *parent) _connectionFeatures(0) { setSocket(socket); - connect(socket, SIGNAL(readyRead()), SLOT(onReadyRead())); + connect(socket, &QIODevice::readyRead, this, &CoreAuthHandler::onReadyRead); // TODO: Timeout for the handshake phase @@ -129,7 +129,7 @@ void CoreAuthHandler::setPeer(RemotePeer *peer) qDebug().nospace() << "Using " << qPrintable(peer->protocolName()) << "..."; _peer = peer; - disconnect(socket(), SIGNAL(readyRead()), this, SLOT(onReadyRead())); + disconnect(socket(), &QIODevice::readyRead, this, &CoreAuthHandler::onReadyRead); } // only in compat mode diff --git a/src/core/corebasichandler.cpp b/src/core/corebasichandler.cpp index a7a67b7a..840d9bc9 100644 --- a/src/core/corebasichandler.cpp +++ b/src/core/corebasichandler.cpp @@ -36,8 +36,8 @@ CoreBasicHandler::CoreBasicHandler(CoreNetwork *parent) connect(this, SIGNAL(putCmd(QString, const QList> &, const QByteArray &, const bool)), network(), SLOT(putCmd(QString, const QList> &, const QByteArray &, const bool))); - connect(this, SIGNAL(putRawLine(const QByteArray &, const bool)), - network(), SLOT(putRawLine(const QByteArray &, const bool))); + connect(this, &CoreBasicHandler::putRawLine, + network(), &CoreNetwork::putRawLine); } diff --git a/src/core/corebuffersyncer.cpp b/src/core/corebuffersyncer.cpp index de2b521b..d7d5be9a 100644 --- a/src/core/corebuffersyncer.cpp +++ b/src/core/corebuffersyncer.cpp @@ -36,8 +36,8 @@ CoreBufferSyncer::CoreBufferSyncer(CoreSession *parent) _coreSession(parent), _purgeBuffers(false) { - connect(parent, SIGNAL(displayMsg(Message)), SLOT(addBufferActivity(Message))); - connect(parent, SIGNAL(displayMsg(Message)), SLOT(addCoreHighlight(Message))); + connect(parent, &CoreSession::displayMsg, this, &CoreBufferSyncer::addBufferActivity); + connect(parent, &CoreSession::displayMsg, this, &CoreBufferSyncer::addCoreHighlight); } diff --git a/src/core/coredccconfig.cpp b/src/core/coredccconfig.cpp index 806bfcb6..077bb68a 100644 --- a/src/core/coredccconfig.cpp +++ b/src/core/coredccconfig.cpp @@ -36,7 +36,7 @@ CoreDccConfig::CoreDccConfig(CoreSession *session) // Otherwise, we just use the defaults initialized in the base class // We store our settings whenever they change - connect(this, SIGNAL(updatedRemotely()), SLOT(save())); + connect(this, &SyncableObject::updatedRemotely, this, &CoreDccConfig::save); } diff --git a/src/core/corehighlightrulemanager.cpp b/src/core/corehighlightrulemanager.cpp index ffd3d67f..99a046f3 100644 --- a/src/core/corehighlightrulemanager.cpp +++ b/src/core/corehighlightrulemanager.cpp @@ -36,7 +36,7 @@ CoreHighlightRuleManager::CoreHighlightRuleManager(CoreSession *session) // Otherwise, we just use the defaults initialized in the base class // We store our settings whenever they change - connect(this, SIGNAL(updatedRemotely()), SLOT(save())); + connect(this, &SyncableObject::updatedRemotely, this, &CoreHighlightRuleManager::save); } void CoreHighlightRuleManager::save() diff --git a/src/core/coreidentity.cpp b/src/core/coreidentity.cpp index 5d2bb2e3..9e6618a0 100644 --- a/src/core/coreidentity.cpp +++ b/src/core/coreidentity.cpp @@ -29,8 +29,8 @@ CoreIdentity::CoreIdentity(IdentityId id, QObject *parent) #endif { #ifdef HAVE_SSL - connect(this, SIGNAL(idSet(IdentityId)), &_certManager, SLOT(setId(IdentityId))); - connect(&_certManager, SIGNAL(updated()), this, SIGNAL(updated())); + connect(this, &Identity::idSet, &_certManager, &CoreCertManager::setId); + connect(&_certManager, &SyncableObject::updated, this, &SyncableObject::updated); #endif } @@ -42,8 +42,8 @@ CoreIdentity::CoreIdentity(const Identity &other, QObject *parent) #endif { #ifdef HAVE_SSL - connect(this, SIGNAL(idSet(IdentityId)), &_certManager, SLOT(setId(IdentityId))); - connect(&_certManager, SIGNAL(updated()), this, SIGNAL(updated())); + connect(this, &Identity::idSet, &_certManager, &CoreCertManager::setId); + connect(&_certManager, &SyncableObject::updated, this, &SyncableObject::updated); #endif } @@ -57,8 +57,8 @@ CoreIdentity::CoreIdentity(const CoreIdentity &other, QObject *parent) #endif { #ifdef HAVE_SSL - connect(this, SIGNAL(idSet(IdentityId)), &_certManager, SLOT(setId(IdentityId))); - connect(&_certManager, SIGNAL(updated()), this, SIGNAL(updated())); + connect(this, &Identity::idSet, &_certManager, &CoreCertManager::setId); + connect(&_certManager, &SyncableObject::updated, this, &SyncableObject::updated); #endif } diff --git a/src/core/coreignorelistmanager.cpp b/src/core/coreignorelistmanager.cpp index 0694b86e..1dac9617 100644 --- a/src/core/coreignorelistmanager.cpp +++ b/src/core/coreignorelistmanager.cpp @@ -36,7 +36,7 @@ CoreIgnoreListManager::CoreIgnoreListManager(CoreSession *parent) initSetIgnoreList(Core::getUserSetting(session->user(), "IgnoreList").toMap()); // we store our settings whenever they change - connect(this, SIGNAL(updatedRemotely()), SLOT(save())); + connect(this, &SyncableObject::updatedRemotely, this, &CoreIgnoreListManager::save); //if(isEmpty()) //loadDefaults(); diff --git a/src/core/corenetwork.cpp b/src/core/corenetwork.cpp index 29f10f06..e0332096 100644 --- a/src/core/corenetwork.cpp +++ b/src/core/corenetwork.cpp @@ -51,10 +51,10 @@ CoreNetwork::CoreNetwork(const NetworkId &networkid, CoreSession *session) _debugLogRawNetId = Quassel::optionValue("debug-irc-id").toInt(); _autoReconnectTimer.setSingleShot(true); - connect(&_socketCloseTimer, SIGNAL(timeout()), this, SLOT(socketCloseTimeout())); + connect(&_socketCloseTimer, &QTimer::timeout, this, &CoreNetwork::socketCloseTimeout); setPingInterval(networkConfig()->pingInterval()); - connect(&_pingTimer, SIGNAL(timeout()), this, SLOT(sendPing())); + connect(&_pingTimer, &QTimer::timeout, this, &CoreNetwork::sendPing); setAutoWhoDelay(networkConfig()->autoWhoDelay()); setAutoWhoInterval(networkConfig()->autoWhoInterval()); @@ -69,39 +69,39 @@ CoreNetwork::CoreNetwork(const NetworkId &networkid, CoreSession *session) storeChannelCipherKey(buffer.toLower(), bufferCiphers[buffer]); } - connect(networkConfig(), SIGNAL(pingTimeoutEnabledSet(bool)), SLOT(enablePingTimeout(bool))); - connect(networkConfig(), SIGNAL(pingIntervalSet(int)), SLOT(setPingInterval(int))); - connect(networkConfig(), SIGNAL(autoWhoEnabledSet(bool)), SLOT(setAutoWhoEnabled(bool))); - connect(networkConfig(), SIGNAL(autoWhoIntervalSet(int)), SLOT(setAutoWhoInterval(int))); - connect(networkConfig(), SIGNAL(autoWhoDelaySet(int)), SLOT(setAutoWhoDelay(int))); + connect(networkConfig(), &NetworkConfig::pingTimeoutEnabledSet, this, &CoreNetwork::enablePingTimeout); + connect(networkConfig(), &NetworkConfig::pingIntervalSet, this, &CoreNetwork::setPingInterval); + connect(networkConfig(), &NetworkConfig::autoWhoEnabledSet, this, &CoreNetwork::setAutoWhoEnabled); + connect(networkConfig(), &NetworkConfig::autoWhoIntervalSet, this, &CoreNetwork::setAutoWhoInterval); + connect(networkConfig(), &NetworkConfig::autoWhoDelaySet, this, &CoreNetwork::setAutoWhoDelay); - connect(&_autoReconnectTimer, SIGNAL(timeout()), this, SLOT(doAutoReconnect())); - connect(&_autoWhoTimer, SIGNAL(timeout()), this, SLOT(sendAutoWho())); - connect(&_autoWhoCycleTimer, SIGNAL(timeout()), this, SLOT(startAutoWhoCycle())); - connect(&_tokenBucketTimer, SIGNAL(timeout()), this, SLOT(checkTokenBucket())); + connect(&_autoReconnectTimer, &QTimer::timeout, this, &CoreNetwork::doAutoReconnect); + connect(&_autoWhoTimer, &QTimer::timeout, this, &CoreNetwork::sendAutoWho); + connect(&_autoWhoCycleTimer, &QTimer::timeout, this, &CoreNetwork::startAutoWhoCycle); + connect(&_tokenBucketTimer, &QTimer::timeout, this, &CoreNetwork::checkTokenBucket); connect(&socket, SIGNAL(connected()), this, SLOT(socketInitialized())); connect(&socket, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(socketError(QAbstractSocket::SocketError))); - connect(&socket, SIGNAL(stateChanged(QAbstractSocket::SocketState)), this, SLOT(socketStateChanged(QAbstractSocket::SocketState))); - connect(&socket, SIGNAL(readyRead()), this, SLOT(socketHasData())); + connect(&socket, &QAbstractSocket::stateChanged, this, &CoreNetwork::socketStateChanged); + connect(&socket, &QIODevice::readyRead, this, &CoreNetwork::socketHasData); #ifdef HAVE_SSL connect(&socket, SIGNAL(encrypted()), this, SLOT(socketInitialized())); connect(&socket, SIGNAL(sslErrors(const QList &)), this, SLOT(sslErrors(const QList &))); #endif - connect(this, SIGNAL(newEvent(Event *)), coreSession()->eventManager(), SLOT(postEvent(Event *))); + connect(this, &CoreNetwork::newEvent, coreSession()->eventManager(), &EventManager::postEvent); // Custom rate limiting // These react to the user changing settings in the client - connect(this, SIGNAL(useCustomMessageRateSet(bool)), SLOT(updateRateLimiting())); - connect(this, SIGNAL(messageRateBurstSizeSet(quint32)), SLOT(updateRateLimiting())); - connect(this, SIGNAL(messageRateDelaySet(quint32)), SLOT(updateRateLimiting())); - connect(this, SIGNAL(unlimitedMessageRateSet(bool)), SLOT(updateRateLimiting())); + connect(this, &Network::useCustomMessageRateSet, this, &CoreNetwork::updateRateLimiting); + connect(this, &Network::messageRateBurstSizeSet, this, &CoreNetwork::updateRateLimiting); + connect(this, &Network::messageRateDelaySet, this, &CoreNetwork::updateRateLimiting); + connect(this, &Network::unlimitedMessageRateSet, this, &CoreNetwork::updateRateLimiting); // IRCv3 capability handling // These react to CAP messages from the server - connect(this, SIGNAL(capAdded(QString)), this, SLOT(serverCapAdded(QString))); - connect(this, SIGNAL(capAcknowledged(QString)), this, SLOT(serverCapAcknowledged(QString))); - connect(this, SIGNAL(capRemoved(QString)), this, SLOT(serverCapRemoved(QString))); + connect(this, &Network::capAdded, this, &CoreNetwork::serverCapAdded); + connect(this, &Network::capAcknowledged, this, &CoreNetwork::serverCapAcknowledged); + connect(this, &Network::capRemoved, this, &CoreNetwork::serverCapRemoved); if (Quassel::isOptionSet("oidentd")) { connect(this, SIGNAL(socketInitialized(const CoreIdentity*, QHostAddress, quint16, QHostAddress, quint16, qint64)), @@ -739,8 +739,8 @@ void CoreNetwork::sendPerform() restoreUserModes(); } else { - connect(me_, SIGNAL(userModesSet(QString)), this, SLOT(restoreUserModes())); - connect(me_, SIGNAL(userModesAdded(QString)), this, SLOT(restoreUserModes())); + connect(me_, &IrcUser::userModesSet, this, &CoreNetwork::restoreUserModes); + connect(me_, &IrcUser::userModesAdded, this, &CoreNetwork::restoreUserModes); } } @@ -774,8 +774,8 @@ void CoreNetwork::restoreUserModes() IrcUser *me_ = me(); Q_ASSERT(me_); - disconnect(me_, SIGNAL(userModesSet(QString)), this, SLOT(restoreUserModes())); - disconnect(me_, SIGNAL(userModesAdded(QString)), this, SLOT(restoreUserModes())); + disconnect(me_, &IrcUser::userModesSet, this, &CoreNetwork::restoreUserModes); + disconnect(me_, &IrcUser::userModesAdded, this, &CoreNetwork::restoreUserModes); QString modesDelta = Core::userModes(userId(), networkId()); QString currentModes = me_->userModes(); diff --git a/src/core/coresession.cpp b/src/core/coresession.cpp index f2e96710..27805ee1 100644 --- a/src/core/coresession.cpp +++ b/src/core/coresession.cpp @@ -86,10 +86,10 @@ CoreSession::CoreSession(UserId uid, bool restoreState, bool strictIdentEnabled, p->setHeartBeatInterval(30); p->setMaxHeartBeatCount(60); // 30 mins until we throw a dead socket out - connect(p, SIGNAL(peerRemoved(Peer*)), SLOT(removeClient(Peer*))); + connect(p, &SignalProxy::peerRemoved, this, &CoreSession::removeClient); - connect(p, SIGNAL(connected()), SLOT(clientsConnected())); - connect(p, SIGNAL(disconnected()), SLOT(clientsDisconnected())); + connect(p, &SignalProxy::connected, this, &CoreSession::clientsConnected); + connect(p, &SignalProxy::disconnected, this, &CoreSession::clientsDisconnected); p->attachSlot(SIGNAL(sendInput(BufferInfo, QString)), this, SLOT(msgFromClient(BufferInfo, QString))); p->attachSignal(this, SIGNAL(displayMsg(Message))); @@ -131,7 +131,7 @@ CoreSession::CoreSession(UserId uid, bool restoreState, bool strictIdentEnabled, eventManager()->registerObject(ctcpParser(), EventManager::LowPriority, "send"); // periodically save our session state - connect(Core::instance()->syncTimer(), SIGNAL(timeout()), this, SLOT(saveSessionState())); + connect(Core::instance()->syncTimer(), &QTimer::timeout, this, &CoreSession::saveSessionState); p->synchronize(_bufferSyncer); p->synchronize(&aliasManager()); @@ -143,8 +143,8 @@ CoreSession::CoreSession(UserId uid, bool restoreState, bool strictIdentEnabled, p->synchronize(&_ignoreListManager); p->synchronize(&_highlightRuleManager); // Listen to network removed events - connect(this, SIGNAL(networkRemoved(NetworkId)), - &_highlightRuleManager, SLOT(networkRemoved(NetworkId))); + connect(this, &CoreSession::networkRemoved, + &_highlightRuleManager, &HighlightRuleManager::networkRemoved); p->synchronize(transferManager()); // Restore session state if (restoreState) @@ -566,7 +566,7 @@ void CoreSession::createIdentity(const CoreIdentity &identity) _identities[identity.id()] = coreIdentity; // CoreIdentity has its own synchronize method since its "private" sslManager needs to be synced as well coreIdentity->synchronize(signalProxy()); - connect(coreIdentity, SIGNAL(updated()), this, SLOT(updateIdentityBySender())); + connect(coreIdentity, &SyncableObject::updated, this, &CoreSession::updateIdentityBySender); emit identityCreated(*coreIdentity); } @@ -624,8 +624,8 @@ void CoreSession::createNetwork(const NetworkInfo &info_, const QStringList &per CoreNetwork *net = new CoreNetwork(id, this); connect(net, SIGNAL(displayMsg(NetworkId, Message::Type, BufferInfo::Type, const QString &, const QString &, const QString &, Message::Flags)), SLOT(recvMessageFromServer(NetworkId, Message::Type, BufferInfo::Type, const QString &, const QString &, const QString &, Message::Flags))); - connect(net, SIGNAL(displayStatusMsg(QString)), SLOT(recvStatusMsgFromServer(QString))); - connect(net, SIGNAL(disconnected(NetworkId)), SIGNAL(networkDisconnected(NetworkId))); + connect(net, &CoreNetwork::displayStatusMsg, this, &CoreSession::recvStatusMsgFromServer); + connect(net, &CoreNetwork::disconnected, this, &CoreSession::networkDisconnected); net->setNetworkInfo(info); net->setProxy(signalProxy()); @@ -651,7 +651,7 @@ void CoreSession::removeNetwork(NetworkId id) // make sure we no longer receive data from the tcp buffer disconnect(net, SIGNAL(displayMsg(NetworkId, Message::Type, BufferInfo::Type, const QString &, const QString &, const QString &, Message::Flags)), this, nullptr); disconnect(net, SIGNAL(displayStatusMsg(QString)), this, nullptr); - connect(net, SIGNAL(disconnected(NetworkId)), this, SLOT(destroyNetwork(NetworkId))); + connect(net, &CoreNetwork::disconnected, this, &CoreSession::destroyNetwork); net->disconnectFromIrc(); } else { diff --git a/src/core/coresessioneventprocessor.cpp b/src/core/coresessioneventprocessor.cpp index e0fa8921..99913ad3 100644 --- a/src/core/coresessioneventprocessor.cpp +++ b/src/core/coresessioneventprocessor.cpp @@ -44,8 +44,8 @@ CoreSessionEventProcessor::CoreSessionEventProcessor(CoreSession *session) : BasicHandler("handleCtcp", session), _coreSession(session) { - connect(coreSession(), SIGNAL(networkDisconnected(NetworkId)), this, SLOT(destroyNetsplits(NetworkId))); - connect(this, SIGNAL(newEvent(Event *)), coreSession()->eventManager(), SLOT(postEvent(Event *))); + connect(coreSession(), &CoreSession::networkDisconnected, this, &CoreSessionEventProcessor::destroyNetsplits); + connect(this, &CoreSessionEventProcessor::newEvent, coreSession()->eventManager(), &EventManager::postEvent); } @@ -729,13 +729,13 @@ void CoreSessionEventProcessor::processIrcEventQuit(IrcEvent *e) Netsplit *n; if (!_netsplits[e->network()].contains(msg)) { n = new Netsplit(e->network(), this); - connect(n, SIGNAL(finished()), this, SLOT(handleNetsplitFinished())); - connect(n, SIGNAL(netsplitJoin(Network*, QString, QStringList, QStringList, QString)), - this, SLOT(handleNetsplitJoin(Network*, QString, QStringList, QStringList, QString))); - connect(n, SIGNAL(netsplitQuit(Network*, QString, QStringList, QString)), - this, SLOT(handleNetsplitQuit(Network*, QString, QStringList, QString))); - connect(n, SIGNAL(earlyJoin(Network*, QString, QStringList, QStringList)), - this, SLOT(handleEarlyNetsplitJoin(Network*, QString, QStringList, QStringList))); + connect(n, &Netsplit::finished, this, &CoreSessionEventProcessor::handleNetsplitFinished); + connect(n, &Netsplit::netsplitJoin, + this, &CoreSessionEventProcessor::handleNetsplitJoin); + connect(n, &Netsplit::netsplitQuit, + this, &CoreSessionEventProcessor::handleNetsplitQuit); + connect(n, &Netsplit::earlyJoin, + this, &CoreSessionEventProcessor::handleEarlyNetsplitJoin); _netsplits[e->network()].insert(msg, n); } else { diff --git a/src/core/coretransfer.cpp b/src/core/coretransfer.cpp index 209a800f..38b693b3 100644 --- a/src/core/coretransfer.cpp +++ b/src/core/coretransfer.cpp @@ -122,10 +122,10 @@ void CoreTransfer::setupConnectionForReceive() setStatus(Status::Connecting); _socket = new QTcpSocket(this); - connect(_socket, SIGNAL(connected()), SLOT(startReceiving())); - connect(_socket, SIGNAL(disconnected()), SLOT(onSocketDisconnected())); + connect(_socket, &QAbstractSocket::connected, this, &CoreTransfer::startReceiving); + connect(_socket, &QAbstractSocket::disconnected, this, &CoreTransfer::onSocketDisconnected); connect(_socket, SIGNAL(error(QAbstractSocket::SocketError)), SLOT(onSocketError(QAbstractSocket::SocketError))); - connect(_socket, SIGNAL(readyRead()), SLOT(onDataReceived())); + connect(_socket, &QIODevice::readyRead, this, &CoreTransfer::onDataReceived); _socket->connectToHost(address(), port()); } diff --git a/src/core/ctcpparser.cpp b/src/core/ctcpparser.cpp index 8c43ffb3..f60311c7 100644 --- a/src/core/ctcpparser.cpp +++ b/src/core/ctcpparser.cpp @@ -40,8 +40,8 @@ CtcpParser::CtcpParser(CoreSession *coreSession, QObject *parent) setStandardCtcp(_coreSession->networkConfig()->standardCtcp()); - connect(_coreSession->networkConfig(), SIGNAL(standardCtcpSet(bool)), this, SLOT(setStandardCtcp(bool))); - connect(this, SIGNAL(newEvent(Event *)), _coreSession->eventManager(), SLOT(postEvent(Event *))); + connect(_coreSession->networkConfig(), &NetworkConfig::standardCtcpSet, this, &CtcpParser::setStandardCtcp); + connect(this, &CtcpParser::newEvent, _coreSession->eventManager(), &EventManager::postEvent); } diff --git a/src/core/eventstringifier.cpp b/src/core/eventstringifier.cpp index b8c67b9e..ed11d306 100644 --- a/src/core/eventstringifier.cpp +++ b/src/core/eventstringifier.cpp @@ -28,7 +28,7 @@ EventStringifier::EventStringifier(CoreSession *parent) : BasicHandler("handleCt _coreSession(parent), _whois(false) { - connect(this, SIGNAL(newMessageEvent(Event *)), coreSession()->eventManager(), SLOT(postEvent(Event *))); + connect(this, &EventStringifier::newMessageEvent, coreSession()->eventManager(), &EventManager::postEvent); } diff --git a/src/core/identserver.cpp b/src/core/identserver.cpp index 8a52520b..18411562 100644 --- a/src/core/identserver.cpp +++ b/src/core/identserver.cpp @@ -27,8 +27,8 @@ IdentServer::IdentServer(QObject *parent) : QObject(parent) { - connect(&_server, SIGNAL(newConnection()), this, SLOT(incomingConnection())); - connect(&_v6server, SIGNAL(newConnection()), this, SLOT(incomingConnection())); + connect(&_server, &QTcpServer::newConnection, this, &IdentServer::incomingConnection); + connect(&_v6server, &QTcpServer::newConnection, this, &IdentServer::incomingConnection); } @@ -93,8 +93,8 @@ void IdentServer::incomingConnection() Q_ASSERT(server); while (server->hasPendingConnections()) { QTcpSocket *socket = server->nextPendingConnection(); - connect(socket, SIGNAL(readyRead()), this, SLOT(respond())); - connect(socket, SIGNAL(disconnected()), socket, SLOT(deleteLater())); + connect(socket, &QIODevice::readyRead, this, &IdentServer::respond); + connect(socket, &QAbstractSocket::disconnected, socket, &QObject::deleteLater); } } diff --git a/src/core/ircparser.cpp b/src/core/ircparser.cpp index 4ffcc5d3..ea18c00e 100644 --- a/src/core/ircparser.cpp +++ b/src/core/ircparser.cpp @@ -41,7 +41,7 @@ IrcParser::IrcParser(CoreSession *session) : _debugLogRawIrc = (Quassel::isOptionSet("debug-irc") || Quassel::isOptionSet("debug-irc-id")); _debugLogRawNetId = Quassel::optionValue("debug-irc-id").toInt(); - connect(this, SIGNAL(newEvent(Event *)), coreSession()->eventManager(), SLOT(postEvent(Event *))); + connect(this, &IrcParser::newEvent, coreSession()->eventManager(), &EventManager::postEvent); } diff --git a/src/core/netsplit.cpp b/src/core/netsplit.cpp index b44c39d4..f71a29c0 100644 --- a/src/core/netsplit.cpp +++ b/src/core/netsplit.cpp @@ -32,10 +32,10 @@ Netsplit::Netsplit(Network *network, QObject *parent) _joinTimer.setSingleShot(true); _quitTimer.setSingleShot(true); - connect(&_discardTimer, SIGNAL(timeout()), this, SIGNAL(finished())); + connect(&_discardTimer, &QTimer::timeout, this, &Netsplit::finished); - connect(&_joinTimer, SIGNAL(timeout()), this, SLOT(joinTimeout())); - connect(&_quitTimer, SIGNAL(timeout()), this, SLOT(quitTimeout())); + connect(&_joinTimer, &QTimer::timeout, this, &Netsplit::joinTimeout); + connect(&_quitTimer, &QTimer::timeout, this, &Netsplit::quitTimeout); // wait for a maximum of 1 hour until we discard the netsplit _discardTimer.start(3600000); diff --git a/src/core/sessionthread.cpp b/src/core/sessionthread.cpp index 7df83068..bdc0a738 100644 --- a/src/core/sessionthread.cpp +++ b/src/core/sessionthread.cpp @@ -46,7 +46,7 @@ public slots: void initialize() { _session = new CoreSession{_userId, _restoreState, _strictIdentEnabled, this}; - connect(_session, SIGNAL(destroyed()), QThread::currentThread(), SLOT(quit())); + connect(_session, &QObject::destroyed, QThread::currentThread(), &QThread::quit); connect(_session, SIGNAL(sessionState(Protocol::SessionState)), Core::instance(), SIGNAL(sessionState(Protocol::SessionState))); emit initialized(); } @@ -96,13 +96,13 @@ SessionThread::SessionThread(UserId uid, bool restoreState, bool strictIdentEnab { auto worker = new Worker(uid, restoreState, strictIdentEnabled); worker->moveToThread(&_sessionThread); - connect(&_sessionThread, SIGNAL(started()), worker, SLOT(initialize())); - connect(&_sessionThread, SIGNAL(finished()), worker, SLOT(deleteLater())); - connect(worker, SIGNAL(initialized()), this, SLOT(onSessionInitialized())); - connect(worker, SIGNAL(destroyed()), this, SLOT(onSessionDestroyed())); + connect(&_sessionThread, &QThread::started, worker, &Worker::initialize); + connect(&_sessionThread, &QThread::finished, worker, &QObject::deleteLater); + connect(worker, &Worker::initialized, this, &SessionThread::onSessionInitialized); + connect(worker, &QObject::destroyed, this, &SessionThread::onSessionDestroyed); - connect(this, SIGNAL(addClientToWorker(Peer*)), worker, SLOT(addClient(Peer*))); - connect(this, SIGNAL(shutdownSession()), worker, SLOT(shutdown())); + connect(this, &SessionThread::addClientToWorker, worker, &Worker::addClient); + connect(this, &SessionThread::shutdownSession, worker, &Worker::shutdown); // Defer thread start through the event loop, so the SessionThread instance is fully constructed before QTimer::singleShot(0, &_sessionThread, SLOT(start())); diff --git a/src/main/monoapplication.cpp b/src/main/monoapplication.cpp index 068ec711..be6f440c 100644 --- a/src/main/monoapplication.cpp +++ b/src/main/monoapplication.cpp @@ -94,14 +94,14 @@ void MonolithicApplication::startInternalCore() // Start internal core in a separate thread, so it doesn't block the UI _core = new Core{}; _core->moveToThread(&_coreThread); - connect(&_coreThread, SIGNAL(started()), _core, SLOT(initAsync())); - connect(&_coreThread, SIGNAL(finished()), _core, SLOT(deleteLater())); + connect(&_coreThread, &QThread::started, _core.data(), &Core::initAsync); + connect(&_coreThread, &QThread::finished, _core.data(), &QObject::deleteLater); connect(this, SIGNAL(connectInternalPeer(QPointer)), _core, SLOT(connectInternalPeer(QPointer))); connect(_core, SIGNAL(sessionState(Protocol::SessionState)), Client::coreConnection(), SLOT(internalSessionStateReceived(Protocol::SessionState))); - connect(_core, SIGNAL(dbUpgradeInProgress(bool)), Client::instance(), SLOT(onDbUpgradeInProgress(bool))); - connect(_core, SIGNAL(exitRequested(int,QString)), Client::instance(), SLOT(onExitRequested(int,QString))); + connect(_core.data(), &Core::dbUpgradeInProgress, Client::instance(), &Client::onDbUpgradeInProgress); + connect(_core.data(), &Core::exitRequested, Client::instance(), &Client::onExitRequested); _coreThread.start(); } diff --git a/src/qtui/bufferwidget.cpp b/src/qtui/bufferwidget.cpp index f7af4839..f8c4cace 100644 --- a/src/qtui/bufferwidget.cpp +++ b/src/qtui/bufferwidget.cpp @@ -53,25 +53,25 @@ BufferWidget::BufferWidget(QWidget *parent) _chatViewSearchController->setSearchMsgs(ui.searchBar->searchMsgsBox()->isChecked()); _chatViewSearchController->setSearchOnlyRegularMsgs(ui.searchBar->searchOnlyRegularMsgsBox()->isChecked()); - connect(ui.searchBar, SIGNAL(searchChanged(const QString &)), - _chatViewSearchController, SLOT(setSearchString(const QString &))); - connect(ui.searchBar->caseSensitiveBox(), SIGNAL(toggled(bool)), - _chatViewSearchController, SLOT(setCaseSensitive(bool))); - connect(ui.searchBar->searchSendersBox(), SIGNAL(toggled(bool)), - _chatViewSearchController, SLOT(setSearchSenders(bool))); - connect(ui.searchBar->searchMsgsBox(), SIGNAL(toggled(bool)), - _chatViewSearchController, SLOT(setSearchMsgs(bool))); - connect(ui.searchBar->searchOnlyRegularMsgsBox(), SIGNAL(toggled(bool)), - _chatViewSearchController, SLOT(setSearchOnlyRegularMsgs(bool))); - connect(ui.searchBar->searchUpButton(), SIGNAL(clicked()), - _chatViewSearchController, SLOT(highlightPrev())); - connect(ui.searchBar->searchDownButton(), SIGNAL(clicked()), - _chatViewSearchController, SLOT(highlightNext())); + connect(ui.searchBar, &ChatViewSearchBar::searchChanged, + _chatViewSearchController, &ChatViewSearchController::setSearchString); + connect(ui.searchBar->caseSensitiveBox(), &QAbstractButton::toggled, + _chatViewSearchController, &ChatViewSearchController::setCaseSensitive); + connect(ui.searchBar->searchSendersBox(), &QAbstractButton::toggled, + _chatViewSearchController, &ChatViewSearchController::setSearchSenders); + connect(ui.searchBar->searchMsgsBox(), &QAbstractButton::toggled, + _chatViewSearchController, &ChatViewSearchController::setSearchMsgs); + connect(ui.searchBar->searchOnlyRegularMsgsBox(), &QAbstractButton::toggled, + _chatViewSearchController, &ChatViewSearchController::setSearchOnlyRegularMsgs); + connect(ui.searchBar->searchUpButton(), &QAbstractButton::clicked, + _chatViewSearchController, &ChatViewSearchController::highlightPrev); + connect(ui.searchBar->searchDownButton(), &QAbstractButton::clicked, + _chatViewSearchController, &ChatViewSearchController::highlightNext); connect(ui.searchBar, SIGNAL(hidden()), this, SLOT(setFocus())); - connect(_chatViewSearchController, SIGNAL(newCurrentHighlight(QGraphicsItem *)), - this, SLOT(scrollToHighlight(QGraphicsItem *))); + connect(_chatViewSearchController, &ChatViewSearchController::newCurrentHighlight, + this, &BufferWidget::scrollToHighlight); ActionCollection *coll = QtUi::actionCollection(); diff --git a/src/qtui/channellistdlg.cpp b/src/qtui/channellistdlg.cpp index de872a74..f5654c5b 100644 --- a/src/qtui/channellistdlg.cpp +++ b/src/qtui/channellistdlg.cpp @@ -55,15 +55,15 @@ ChannelListDlg::ChannelListDlg(QWidget *parent) setWindowIcon(icon::get("format-list-unordered")); - connect(ui.advancedModeLabel, SIGNAL(clicked()), this, SLOT(toggleMode())); - connect(ui.searchChannelsButton, SIGNAL(clicked()), this, SLOT(requestSearch())); - connect(ui.channelNameLineEdit, SIGNAL(returnPressed()), this, SLOT(requestSearch())); - connect(ui.filterLineEdit, SIGNAL(textChanged(QString)), &_sortFilter, SLOT(setFilterFixedString(QString))); - connect(Client::ircListHelper(), SIGNAL(channelListReceived(const NetworkId &, const QStringList &, QList )), - this, SLOT(receiveChannelList(NetworkId, QStringList, QList ))); - connect(Client::ircListHelper(), SIGNAL(finishedListReported(const NetworkId &)), this, SLOT(reportFinishedList())); - connect(Client::ircListHelper(), SIGNAL(errorReported(const QString &)), this, SLOT(showError(const QString &))); - connect(ui.channelListView, SIGNAL(activated(QModelIndex)), this, SLOT(joinChannel(QModelIndex))); + connect(ui.advancedModeLabel, &ClickableLabel::clicked, this, &ChannelListDlg::toggleMode); + connect(ui.searchChannelsButton, &QAbstractButton::clicked, this, &ChannelListDlg::requestSearch); + connect(ui.channelNameLineEdit, &QLineEdit::returnPressed, this, &ChannelListDlg::requestSearch); + connect(ui.filterLineEdit, &QLineEdit::textChanged, &_sortFilter, &QSortFilterProxyModel::setFilterFixedString); + connect(Client::ircListHelper(), &ClientIrcListHelper::channelListReceived, + this, &ChannelListDlg::receiveChannelList); + connect(Client::ircListHelper(), &ClientIrcListHelper::finishedListReported, this, &ChannelListDlg::reportFinishedList); + connect(Client::ircListHelper(), &ClientIrcListHelper::errorReported, this, &ChannelListDlg::showError); + connect(ui.channelListView, &QAbstractItemView::activated, this, &ChannelListDlg::joinChannel); setAdvancedMode(false); enableQuery(true); diff --git a/src/qtui/chatlinemodel.cpp b/src/qtui/chatlinemodel.cpp index 3dcef663..477643c8 100644 --- a/src/qtui/chatlinemodel.cpp +++ b/src/qtui/chatlinemodel.cpp @@ -28,7 +28,7 @@ ChatLineModel::ChatLineModel(QObject *parent) qRegisterMetaType("ChatLineModel::WrapList"); qRegisterMetaTypeStreamOperators("ChatLineModel::WrapList"); - connect(QtUi::style(), SIGNAL(changed()), SLOT(styleChanged())); + connect(QtUi::style(), &UiStyle::changed, this, &ChatLineModel::styleChanged); } diff --git a/src/qtui/chatmonitorview.cpp b/src/qtui/chatmonitorview.cpp index d337cfc3..71c975b9 100644 --- a/src/qtui/chatmonitorview.cpp +++ b/src/qtui/chatmonitorview.cpp @@ -46,7 +46,7 @@ ChatMonitorView::ChatMonitorView(ChatMonitorFilter *filter, QWidget *parent) // The normal message prefixes get replaced by the network and buffer name. Re-add brackets for // all message types. scene()->setAlwaysBracketSender(true); - connect(Client::instance(), SIGNAL(coreConnectionStateChanged(bool)), this, SLOT(coreConnectionStateChanged(bool))); + connect(Client::instance(), &Client::coreConnectionStateChanged, this, &ChatMonitorView::coreConnectionStateChanged); } diff --git a/src/qtui/chatscene.cpp b/src/qtui/chatscene.cpp index b2b1a35e..80e24a60 100644 --- a/src/qtui/chatscene.cpp +++ b/src/qtui/chatscene.cpp @@ -86,7 +86,7 @@ ChatScene::ChatScene(QAbstractItemModel *model, QString idString, qreal width, C } addItem(_markerLine); - connect(this, SIGNAL(sceneRectChanged(const QRectF &)), _markerLine, SLOT(sceneRectChanged(const QRectF &))); + connect(this, &QGraphicsScene::sceneRectChanged, _markerLine, &MarkerLineItem::sceneRectChanged); ChatViewSettings defaultSettings; _defaultFirstColHandlePos = defaultSettings.value("FirstColumnHandlePos", 80).toInt(); @@ -99,32 +99,32 @@ ChatScene::ChatScene(QAbstractItemModel *model, QString idString, qreal width, C _firstColHandle = new ColumnHandleItem(QtUi::style()->firstColumnSeparator()); addItem(_firstColHandle); _firstColHandle->setXPos(_firstColHandlePos); - connect(_firstColHandle, SIGNAL(positionChanged(qreal)), this, SLOT(firstHandlePositionChanged(qreal))); - connect(this, SIGNAL(sceneRectChanged(const QRectF &)), _firstColHandle, SLOT(sceneRectChanged(const QRectF &))); + connect(_firstColHandle, &ColumnHandleItem::positionChanged, this, &ChatScene::firstHandlePositionChanged); + connect(this, &QGraphicsScene::sceneRectChanged, _firstColHandle, &ColumnHandleItem::sceneRectChanged); _secondColHandle = new ColumnHandleItem(QtUi::style()->secondColumnSeparator()); addItem(_secondColHandle); _secondColHandle->setXPos(_secondColHandlePos); - connect(_secondColHandle, SIGNAL(positionChanged(qreal)), this, SLOT(secondHandlePositionChanged(qreal))); + connect(_secondColHandle, &ColumnHandleItem::positionChanged, this, &ChatScene::secondHandlePositionChanged); - connect(this, SIGNAL(sceneRectChanged(const QRectF &)), _secondColHandle, SLOT(sceneRectChanged(const QRectF &))); + connect(this, &QGraphicsScene::sceneRectChanged, _secondColHandle, &ColumnHandleItem::sceneRectChanged); setHandleXLimits(); if (model->rowCount() > 0) rowsInserted(QModelIndex(), 0, model->rowCount() - 1); - connect(model, SIGNAL(rowsInserted(const QModelIndex &, int, int)), - this, SLOT(rowsInserted(const QModelIndex &, int, int))); - connect(model, SIGNAL(rowsAboutToBeRemoved(const QModelIndex &, int, int)), - this, SLOT(rowsAboutToBeRemoved(const QModelIndex &, int, int))); - connect(model, SIGNAL(rowsRemoved(QModelIndex, int, int)), - this, SLOT(rowsRemoved())); - connect(model, SIGNAL(dataChanged(QModelIndex, QModelIndex)), SLOT(dataChanged(QModelIndex, QModelIndex))); + connect(model, &QAbstractItemModel::rowsInserted, + this, &ChatScene::rowsInserted); + connect(model, &QAbstractItemModel::rowsAboutToBeRemoved, + this, &ChatScene::rowsAboutToBeRemoved); + connect(model, &QAbstractItemModel::rowsRemoved, + this, &ChatScene::rowsRemoved); + connect(model, &QAbstractItemModel::dataChanged, this, &ChatScene::dataChanged); #if defined HAVE_WEBKIT || defined HAVE_WEBENGINE webPreview.timer.setSingleShot(true); - connect(&webPreview.timer, SIGNAL(timeout()), this, SLOT(webPreviewNextStep())); + connect(&webPreview.timer, &QTimer::timeout, this, &ChatScene::webPreviewNextStep); #endif _showWebPreview = defaultSettings.showWebPreview(); defaultSettings.notify("ShowWebPreview", this, SLOT(showWebPreviewChanged())); @@ -141,7 +141,7 @@ ChatScene::ChatScene(QAbstractItemModel *model, QString idString, qreal width, C _clickTimer.setInterval(QApplication::doubleClickInterval()); _clickTimer.setSingleShot(true); - connect(&_clickTimer, SIGNAL(timeout()), SLOT(clickTimeout())); + connect(&_clickTimer, &QTimer::timeout, this, &ChatScene::clickTimeout); setItemIndexMethod(QGraphicsScene::NoIndex); } diff --git a/src/qtui/chatview.cpp b/src/qtui/chatview.cpp index 007d8bb6..95ee9a18 100644 --- a/src/qtui/chatview.cpp +++ b/src/qtui/chatview.cpp @@ -72,22 +72,22 @@ void ChatView::init(MessageFilter *filter) _scrollTimer.setInterval(100); _scrollTimer.setSingleShot(true); - connect(&_scrollTimer, SIGNAL(timeout()), SLOT(scrollTimerTimeout())); + connect(&_scrollTimer, &QTimer::timeout, this, &ChatView::scrollTimerTimeout); _scene = new ChatScene(filter, filter->idString(), viewport()->width(), this); - connect(_scene, SIGNAL(sceneRectChanged(const QRectF &)), this, SLOT(adjustSceneRect())); - connect(_scene, SIGNAL(lastLineChanged(QGraphicsItem *, qreal)), this, SLOT(lastLineChanged(QGraphicsItem *, qreal))); - connect(_scene, SIGNAL(mouseMoveWhileSelecting(const QPointF &)), this, SLOT(mouseMoveWhileSelecting(const QPointF &))); + connect(_scene, &QGraphicsScene::sceneRectChanged, this, &ChatView::adjustSceneRect); + connect(_scene, &ChatScene::lastLineChanged, this, &ChatView::lastLineChanged); + connect(_scene, &ChatScene::mouseMoveWhileSelecting, this, &ChatView::mouseMoveWhileSelecting); setScene(_scene); - connect(verticalScrollBar(), SIGNAL(valueChanged(int)), this, SLOT(verticalScrollbarChanged(int))); + connect(verticalScrollBar(), &QAbstractSlider::valueChanged, this, &ChatView::verticalScrollbarChanged); _lastScrollbarPos = verticalScrollBar()->maximum(); - connect(Client::networkModel(), SIGNAL(markerLineSet(BufferId, MsgId)), SLOT(markerLineSet(BufferId, MsgId))); + connect(Client::networkModel(), &NetworkModel::markerLineSet, this, &ChatView::markerLineSet); // only connect if client is synched with a core if (Client::isConnected()) - connect(Client::ignoreListManager(), SIGNAL(ignoreListChanged()), this, SLOT(invalidateFilter())); + connect(Client::ignoreListManager(), &ClientIgnoreListManager::ignoreListChanged, this, &ChatView::invalidateFilter); } diff --git a/src/qtui/chatviewsearchbar.cpp b/src/qtui/chatviewsearchbar.cpp index a8d46806..3ebf67c9 100644 --- a/src/qtui/chatviewsearchbar.cpp +++ b/src/qtui/chatviewsearchbar.cpp @@ -47,9 +47,9 @@ ChatViewSearchBar::ChatViewSearchBar(QWidget *parent) hideSearchBar->setShortcutConfigurable(false); hideSearchBar->setShortcut(Qt::Key_Escape); - connect(ui.hideButton, SIGNAL(clicked()), toggleSearchBar, SLOT(toggle())); - connect(ui.searchEditLine, SIGNAL(textChanged(const QString &)), this, SLOT(delaySearch())); - connect(&_searchDelayTimer, SIGNAL(timeout()), this, SLOT(search())); + connect(ui.hideButton, &QAbstractButton::clicked, toggleSearchBar, &QAction::toggle); + connect(ui.searchEditLine, &QLineEdit::textChanged, this, &ChatViewSearchBar::delaySearch); + connect(&_searchDelayTimer, &QTimer::timeout, this, &ChatViewSearchBar::search); } diff --git a/src/qtui/chatviewsearchcontroller.cpp b/src/qtui/chatviewsearchcontroller.cpp index e5026cd7..cff19082 100644 --- a/src/qtui/chatviewsearchcontroller.cpp +++ b/src/qtui/chatviewsearchcontroller.cpp @@ -69,7 +69,7 @@ void ChatViewSearchController::setScene(ChatScene *scene) if (!scene) return; - connect(_scene, SIGNAL(destroyed()), this, SLOT(sceneDestroyed())); + connect(_scene, &QObject::destroyed, this, &ChatViewSearchController::sceneDestroyed); connect(_scene, SIGNAL(layoutChanged()), this, SLOT(repositionHighlights())); connect(Client::messageModel(), SIGNAL(finishedBacklogFetch(BufferId)), this, SLOT(updateHighlights())); updateHighlights(); @@ -422,7 +422,7 @@ SearchHighlightItem::SearchHighlightItem(QRectF wordRect, QGraphicsItem *parent) setPos(wordRect.x(), wordRect.y()); updateGeometry(wordRect.width(), wordRect.height()); - connect(&_timeLine, SIGNAL(valueChanged(qreal)), this, SLOT(updateHighlight(qreal))); + connect(&_timeLine, &QTimeLine::valueChanged, this, &SearchHighlightItem::updateHighlight); } diff --git a/src/qtui/coreconfigwizard.cpp b/src/qtui/coreconfigwizard.cpp index 4e458702..669d670c 100644 --- a/src/qtui/coreconfigwizard.cpp +++ b/src/qtui/coreconfigwizard.cpp @@ -137,11 +137,11 @@ CoreConfigWizard::CoreConfigWizard(CoreConnection *connection, const QVariantLis setPage(AuthenticationSelectionPage, new CoreConfigWizardPages::AuthenticationSelectionPage(authInfos, this)); setPage(StorageSelectionPage, new CoreConfigWizardPages::StorageSelectionPage(backendInfos, this)); syncPage = new CoreConfigWizardPages::SyncPage(this); - connect(syncPage, SIGNAL(setupCore(const QString &, const QVariantMap &, const QString &, const QVariantMap &)), - SLOT(prepareCoreSetup(const QString &, const QVariantMap &, const QString &, const QVariantMap &))); + connect(syncPage, &CoreConfigWizardPages::SyncPage::setupCore, + this, &CoreConfigWizard::prepareCoreSetup); setPage(SyncPage, syncPage); syncRelayPage = new CoreConfigWizardPages::SyncRelayPage(this); - connect(syncRelayPage, SIGNAL(startOver()), this, SLOT(startOver())); + connect(syncRelayPage, &CoreConfigWizardPages::SyncRelayPage::startOver, this, &CoreConfigWizard::startOver); setPage(SyncRelayPage, syncRelayPage); setStartId(IntroPage); @@ -162,9 +162,9 @@ CoreConfigWizard::CoreConfigWizard(CoreConnection *connection, const QVariantLis setWindowTitle(CoreConfigWizard::tr("Core Configuration Wizard")); setPixmap(QWizard::LogoPixmap, icon::get("quassel").pixmap(48)); - connect(connection, SIGNAL(coreSetupSuccess()), SLOT(coreSetupSuccess())); - connect(connection, SIGNAL(coreSetupFailed(QString)), SLOT(coreSetupFailed(QString))); - connect(connection, SIGNAL(synchronized()), SLOT(syncFinished())); + connect(connection, &CoreConnection::coreSetupSuccess, this, &CoreConfigWizard::coreSetupSuccess); + connect(connection, &CoreConnection::coreSetupFailed, this, &CoreConfigWizard::coreSetupFailed); + connect(connection, &CoreConnection::synchronized, this, &CoreConfigWizard::syncFinished); connect(this, SIGNAL(rejected()), connection, SLOT(disconnectFromCore())); diff --git a/src/qtui/coreconnectdlg.cpp b/src/qtui/coreconnectdlg.cpp index 7c54efbd..220e28f3 100644 --- a/src/qtui/coreconnectdlg.cpp +++ b/src/qtui/coreconnectdlg.cpp @@ -50,7 +50,7 @@ CoreConnectDlg::CoreConnectDlg(QWidget *parent) : QDialog(parent) connect(_settingsPage, SIGNAL(connectToCore(AccountId)), SLOT(accept())); connect(buttonBox, SIGNAL(accepted()), SLOT(accept())); - connect(buttonBox, SIGNAL(rejected()), SLOT(reject())); + connect(buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject); } @@ -75,8 +75,8 @@ CoreConnectAuthDlg::CoreConnectAuthDlg(CoreAccount *account, QWidget *parent) { ui.setupUi(this); - connect(ui.user, SIGNAL(textChanged(QString)), SLOT(setButtonStates())); - connect(ui.password, SIGNAL(textChanged(QString)), SLOT(setButtonStates())); + connect(ui.user, &QLineEdit::textChanged, this, &CoreConnectAuthDlg::setButtonStates); + connect(ui.password, &QLineEdit::textChanged, this, &CoreConnectAuthDlg::setButtonStates); ui.label->setText(tr("Please enter your credentials for %1:").arg(account->accountName())); ui.user->setText(account->user()); diff --git a/src/qtui/coreconnectionstatuswidget.cpp b/src/qtui/coreconnectionstatuswidget.cpp index 844b0e2f..27236b3d 100644 --- a/src/qtui/coreconnectionstatuswidget.cpp +++ b/src/qtui/coreconnectionstatuswidget.cpp @@ -33,14 +33,14 @@ CoreConnectionStatusWidget::CoreConnectionStatusWidget(CoreConnection *connectio ui.sslLabel->hide(); update(); - connect(coreConnection(), SIGNAL(progressTextChanged(QString)), ui.messageLabel, SLOT(setText(QString))); - connect(coreConnection(), SIGNAL(progressValueChanged(int)), ui.progressBar, SLOT(setValue(int))); - connect(coreConnection(), SIGNAL(progressRangeChanged(int, int)), ui.progressBar, SLOT(setRange(int, int))); - connect(coreConnection(), SIGNAL(progressRangeChanged(int, int)), this, SLOT(progressRangeChanged(int, int))); + connect(coreConnection(), &CoreConnection::progressTextChanged, ui.messageLabel, &QLabel::setText); + connect(coreConnection(), &CoreConnection::progressValueChanged, ui.progressBar, &QProgressBar::setValue); + connect(coreConnection(), &CoreConnection::progressRangeChanged, ui.progressBar, &QProgressBar::setRange); + connect(coreConnection(), &CoreConnection::progressRangeChanged, this, &CoreConnectionStatusWidget::progressRangeChanged); - connect(coreConnection(), SIGNAL(stateChanged(CoreConnection::ConnectionState)), SLOT(connectionStateChanged(CoreConnection::ConnectionState))); - connect(coreConnection(), SIGNAL(connectionError(QString)), ui.messageLabel, SLOT(setText(QString))); - connect(coreConnection(), SIGNAL(lagUpdated(int)), SLOT(updateLag(int))); + connect(coreConnection(), &CoreConnection::stateChanged, this, &CoreConnectionStatusWidget::connectionStateChanged); + connect(coreConnection(), &CoreConnection::connectionError, ui.messageLabel, &QLabel::setText); + connect(coreConnection(), &CoreConnection::lagUpdated, this, &CoreConnectionStatusWidget::updateLag); } diff --git a/src/qtui/coreinfodlg.cpp b/src/qtui/coreinfodlg.cpp index 47ab7589..13c203d9 100644 --- a/src/qtui/coreinfodlg.cpp +++ b/src/qtui/coreinfodlg.cpp @@ -31,8 +31,8 @@ CoreInfoDlg::CoreInfoDlg(QWidget *parent) : QDialog(parent) { ui.setupUi(this); // Listen for resynchronization events (pre-0.13 cores only) - connect(Client::instance(), SIGNAL(coreInfoResynchronized()), - this, SLOT(coreInfoResynchronized())); + connect(Client::instance(), &Client::coreInfoResynchronized, + this, &CoreInfoDlg::coreInfoResynchronized); // Update legacy core info for Quassel cores earlier than 0.13. This does nothing on modern // cores. @@ -60,7 +60,7 @@ void CoreInfoDlg::refreshLegacyCoreInfo() { // On legacy cores, CoreInfo data does not send signals. Periodically poll for information. // 15 seconds seems like a reasonable trade-off as this only happens while the dialog is open. - QTimer::singleShot(15 * 1000, this, SLOT(refreshLegacyCoreInfo())); + QTimer::singleShot(15 * 1000, this, &CoreInfoDlg::refreshLegacyCoreInfo); } @@ -69,8 +69,8 @@ void CoreInfoDlg::coreInfoResynchronized() { CoreInfo *coreInfo = Client::coreInfo(); // Listen for changes to core information - connect(coreInfo, SIGNAL(coreDataChanged(const QVariantMap &)), - this, SLOT(coreInfoChanged(const QVariantMap &))); + connect(coreInfo, &CoreInfo::coreDataChanged, + this, &CoreInfoDlg::coreInfoChanged); // Update with any known core information set before connecting the signal. This is needed for // both modern (0.13+) and legacy cores. diff --git a/src/qtui/debuglogdlg.cpp b/src/qtui/debuglogdlg.cpp index bebe26b9..fc701d9d 100644 --- a/src/qtui/debuglogdlg.cpp +++ b/src/qtui/debuglogdlg.cpp @@ -30,7 +30,7 @@ DebugLogDlg::DebugLogDlg(QWidget *parent) ui.textEdit->setReadOnly(true); - connect(Quassel::instance()->logger(), SIGNAL(messageLogged(Logger::LogEntry)), SLOT(logUpdated(Logger::LogEntry))); + connect(Quassel::instance()->logger(), &Logger::messageLogged, this, &DebugLogDlg::logUpdated); QString content; for (auto &&message : Quassel::instance()->logger()->messages()) { diff --git a/src/qtui/dockmanagernotificationbackend.cpp b/src/qtui/dockmanagernotificationbackend.cpp index 53557fe5..a243022f 100644 --- a/src/qtui/dockmanagernotificationbackend.cpp +++ b/src/qtui/dockmanagernotificationbackend.cpp @@ -55,7 +55,7 @@ DockManagerNotificationBackend::DockManagerNotificationBackend(QObject *parent) itemAdded(QDBusObjectPath()); connect(Client::coreConnection(), SIGNAL(progressValueChanged(int)), this, SLOT(updateProgress(int))); - connect(Client::coreConnection(), SIGNAL(synchronized()), this, SLOT(synchronized())); + connect(Client::coreConnection(), &CoreConnection::synchronized, this, &DockManagerNotificationBackend::synchronized); } @@ -184,7 +184,7 @@ DockManagerNotificationBackend::ConfigWidget::ConfigWidget(bool enabled, QWidget layout->addWidget(enabledBox = new QCheckBox(tr("Mark dockmanager entry"), this)); enabledBox->setVisible(enabled); - connect(enabledBox, SIGNAL(toggled(bool)), SLOT(widgetChanged())); + connect(enabledBox, &QAbstractButton::toggled, this, &ConfigWidget::widgetChanged); } diff --git a/src/qtui/inputwidget.cpp b/src/qtui/inputwidget.cpp index f843eced..f93c7d96 100644 --- a/src/qtui/inputwidget.cpp +++ b/src/qtui/inputwidget.cpp @@ -91,22 +91,22 @@ InputWidget::InputWidget(QWidget *parent) ui.textcolorButton->setMenu(_colorMenu); // Set the default action to clear color (last added action) ui.textcolorButton->setDefaultAction(_colorMenu->actions().last()); - connect(_colorMenu, SIGNAL(triggered(QAction *)), this, SLOT(colorChosen(QAction *))); + connect(_colorMenu, &QMenu::triggered, this, &InputWidget::colorChosen); ui.highlightcolorButton->setMenu(_colorFillMenu); // Set the default action to clear fill color (last added action) ui.highlightcolorButton->setDefaultAction(_colorFillMenu->actions().last()); - connect(_colorFillMenu, SIGNAL(triggered(QAction *)), this, SLOT(colorHighlightChosen(QAction *))); + connect(_colorFillMenu, &QMenu::triggered, this, &InputWidget::colorHighlightChosen); // Needs to be done after adding the menu, otherwise the icon mysteriously vanishes until clicked ui.textcolorButton->setIcon(icon::get("format-text-color")); ui.highlightcolorButton->setIcon(icon::get("format-fill-color")); // Show/hide style button - connect(ui.showStyleButton, SIGNAL(toggled(bool)), this, SLOT(setStyleOptionsExpanded(bool))); + connect(ui.showStyleButton, &QAbstractButton::toggled, this, &InputWidget::setStyleOptionsExpanded); // Clear formatting button - connect(ui.clearButton, SIGNAL(clicked()), this, SLOT(clearFormat())); + connect(ui.clearButton, &QAbstractButton::clicked, this, &InputWidget::clearFormat); new TabCompleter(ui.inputEdit); @@ -149,8 +149,8 @@ InputWidget::InputWidget(QWidget *parent) activateInputline->setText(tr("Focus Input Line")); activateInputline->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_L)); - connect(inputLine(), SIGNAL(textEntered(QString)), SLOT(onTextEntered(QString)), Qt::QueuedConnection); // make sure the line is already reset, bug #984 - connect(inputLine(), SIGNAL(currentCharFormatChanged(QTextCharFormat)), this, SLOT(currentCharFormatChanged(QTextCharFormat))); + connect(inputLine(), &MultiLineEdit::textEntered, this, &InputWidget::onTextEntered, Qt::QueuedConnection); // make sure the line is already reset, bug #984 + connect(inputLine(), &QTextEdit::currentCharFormatChanged, this, &InputWidget::currentCharFormatChanged); } @@ -431,7 +431,7 @@ void InputWidget::setNetwork(NetworkId networkId) const Network *network = Client::network(networkId); if (network) { - connect(network, SIGNAL(identitySet(IdentityId)), this, SLOT(setIdentity(IdentityId))); + connect(network, &Network::identitySet, this, &InputWidget::setIdentity); connectMyIrcUser(); setIdentity(network->identity()); } @@ -446,16 +446,16 @@ void InputWidget::connectMyIrcUser() { const Network *network = currentNetwork(); if (network->me()) { - connect(network->me(), SIGNAL(nickSet(const QString &)), this, SLOT(updateNickSelector())); - connect(network->me(), SIGNAL(userModesSet(QString)), this, SLOT(updateNickSelector())); - connect(network->me(), SIGNAL(userModesAdded(QString)), this, SLOT(updateNickSelector())); - connect(network->me(), SIGNAL(userModesRemoved(QString)), this, SLOT(updateNickSelector())); - connect(network->me(), SIGNAL(awaySet(bool)), this, SLOT(updateNickSelector())); - disconnect(network, SIGNAL(myNickSet(const QString &)), this, SLOT(connectMyIrcUser())); + connect(network->me(), &IrcUser::nickSet, this, &InputWidget::updateNickSelector); + connect(network->me(), &IrcUser::userModesSet, this, &InputWidget::updateNickSelector); + connect(network->me(), &IrcUser::userModesAdded, this, &InputWidget::updateNickSelector); + connect(network->me(), &IrcUser::userModesRemoved, this, &InputWidget::updateNickSelector); + connect(network->me(), &IrcUser::awaySet, this, &InputWidget::updateNickSelector); + disconnect(network, &Network::myNickSet, this, &InputWidget::connectMyIrcUser); updateNickSelector(); } else { - connect(network, SIGNAL(myNickSet(const QString &)), this, SLOT(connectMyIrcUser())); + connect(network, &Network::myNickSet, this, &InputWidget::connectMyIrcUser); } } @@ -473,7 +473,7 @@ void InputWidget::setIdentity(IdentityId identityId) const Identity *identity = Client::identity(identityId); if (identity) { - connect(identity, SIGNAL(nicksSet(QStringList)), this, SLOT(updateNickSelector())); + connect(identity, &Identity::nicksSet, this, &InputWidget::updateNickSelector); } else { _identityId = 0; diff --git a/src/qtui/ircconnectionwizard.cpp b/src/qtui/ircconnectionwizard.cpp index 1210b5c9..156c2419 100644 --- a/src/qtui/ircconnectionwizard.cpp +++ b/src/qtui/ircconnectionwizard.cpp @@ -43,7 +43,7 @@ IrcConnectionWizard::IrcConnectionWizard(QWidget *parent, Qt::WindowFlags flags) setOptions(options() | (QWizard::WizardOptions)(QWizard::NoDefaultButton | QWizard::CancelButtonOnLeft)); setOption(QWizard::NoCancelButton, false); - connect(button(QWizard::FinishButton), SIGNAL(clicked()), this, SLOT(finishClicked())); + connect(button(QWizard::FinishButton), &QAbstractButton::clicked, this, &IrcConnectionWizard::finishClicked); setButtonText(QWizard::FinishButton, tr("Save && Connect")); } @@ -72,7 +72,7 @@ void IrcConnectionWizard::finishClicked() identityReady(identity->id()); } else { - connect(Client::instance(), SIGNAL(identityCreated(IdentityId)), this, SLOT(identityReady(IdentityId))); + connect(Client::instance(), &Client::identityCreated, this, &IrcConnectionWizard::identityReady); Client::createIdentity(*identity); } } @@ -80,19 +80,19 @@ void IrcConnectionWizard::finishClicked() void IrcConnectionWizard::identityReady(IdentityId id) { - disconnect(Client::instance(), SIGNAL(identityCreated(IdentityId)), this, SLOT(identityReady(IdentityId))); + disconnect(Client::instance(), &Client::identityCreated, this, &IrcConnectionWizard::identityReady); auto *networkPage = static_cast(_networkPage); NetworkInfo networkInfo = networkPage->networkInfo(); QStringList channels = networkPage->channelList(); networkInfo.identity = id; - connect(Client::instance(), SIGNAL(networkCreated(NetworkId)), this, SLOT(networkReady(NetworkId))); + connect(Client::instance(), &Client::networkCreated, this, &IrcConnectionWizard::networkReady); Client::createNetwork(networkInfo, channels); } void IrcConnectionWizard::networkReady(NetworkId id) { - disconnect(Client::instance(), SIGNAL(networkCreated(NetworkId)), this, SLOT(networkReady(NetworkId))); + disconnect(Client::instance(), &Client::networkCreated, this, &IrcConnectionWizard::networkReady); const Network *net = Client::network(id); Q_ASSERT(net); net->requestConnect(); diff --git a/src/qtui/legacysystemtray.cpp b/src/qtui/legacysystemtray.cpp index 87ff3dfe..3fbe1dca 100644 --- a/src/qtui/legacysystemtray.cpp +++ b/src/qtui/legacysystemtray.cpp @@ -32,22 +32,22 @@ LegacySystemTray::LegacySystemTray(QWidget *parent) { #ifndef Q_OS_MAC - connect(_trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), - SLOT(onActivated(QSystemTrayIcon::ActivationReason))); + connect(_trayIcon, &QSystemTrayIcon::activated, + this, &LegacySystemTray::onActivated); #endif - connect(_trayIcon, SIGNAL(messageClicked()), - SLOT(onMessageClicked())); + connect(_trayIcon, &QSystemTrayIcon::messageClicked, + this, &LegacySystemTray::onMessageClicked); _trayIcon->setContextMenu(trayMenu()); _trayIcon->setVisible(false); setMode(Mode::Legacy); - connect(this, SIGNAL(visibilityChanged(bool)), this, SLOT(onVisibilityChanged(bool))); - connect(this, SIGNAL(modeChanged(Mode)), this, SLOT(onModeChanged(Mode))); - connect(this, SIGNAL(toolTipChanged(QString, QString)), SLOT(updateToolTip())); - connect(this, SIGNAL(iconsChanged()), this, SLOT(updateIcon())); - connect(this, SIGNAL(currentIconNameChanged()), this, SLOT(updateIcon())); + connect(this, &SystemTray::visibilityChanged, this, &LegacySystemTray::onVisibilityChanged); + connect(this, &SystemTray::modeChanged, this, &LegacySystemTray::onModeChanged); + connect(this, &SystemTray::toolTipChanged, this, &LegacySystemTray::updateToolTip); + connect(this, &SystemTray::iconsChanged, this, &LegacySystemTray::updateIcon); + connect(this, &SystemTray::currentIconNameChanged, this, &LegacySystemTray::updateIcon); updateIcon(); updateToolTip(); diff --git a/src/qtui/mainpage.cpp b/src/qtui/mainpage.cpp index f85b44a6..fe4f8a51 100644 --- a/src/qtui/mainpage.cpp +++ b/src/qtui/mainpage.cpp @@ -42,8 +42,8 @@ MainPage::MainPage(QWidget *parent) : QWidget(parent) _connectButton = new QPushButton(icon::get("network-connect"), tr("Connect to Core...")); _connectButton->setEnabled(Client::coreConnection()->state() == CoreConnection::Disconnected); - connect(Client::coreConnection(), SIGNAL(stateChanged(CoreConnection::ConnectionState)), this, SLOT(coreConnectionStateChanged())); - connect(_connectButton, SIGNAL(clicked(bool)), this, SLOT(showCoreConnectionDlg())); + connect(Client::coreConnection(), &CoreConnection::stateChanged, this, &MainPage::coreConnectionStateChanged); + connect(_connectButton, &QAbstractButton::clicked, this, &MainPage::showCoreConnectionDlg); layout->addWidget(_connectButton); } } diff --git a/src/qtui/mainwin.cpp b/src/qtui/mainwin.cpp index 6330e2cc..cccca9fb 100644 --- a/src/qtui/mainwin.cpp +++ b/src/qtui/mainwin.cpp @@ -183,29 +183,29 @@ MainWin::MainWin(QWidget *parent) void MainWin::init() { - connect(Client::instance(), SIGNAL(networkCreated(NetworkId)), SLOT(clientNetworkCreated(NetworkId))); - connect(Client::instance(), SIGNAL(networkRemoved(NetworkId)), SLOT(clientNetworkRemoved(NetworkId))); - connect(Client::messageModel(), SIGNAL(rowsInserted(const QModelIndex &, int, int)), - SLOT(messagesInserted(const QModelIndex &, int, int))); + connect(Client::instance(), &Client::networkCreated, this, &MainWin::clientNetworkCreated); + connect(Client::instance(), &Client::networkRemoved, this, &MainWin::clientNetworkRemoved); + connect(Client::messageModel(), &QAbstractItemModel::rowsInserted, + this, &MainWin::messagesInserted); connect(GraphicalUi::contextMenuActionProvider(), - SIGNAL(showChannelList(NetworkId,QString,bool)), - SLOT(showChannelList(NetworkId,QString,bool))); + &NetworkModelController::showChannelList, + this, &MainWin::showChannelList); connect(Client::instance(), - SIGNAL(showChannelList(NetworkId,QString,bool)), - SLOT(showChannelList(NetworkId,QString,bool))); - connect(GraphicalUi::contextMenuActionProvider(), SIGNAL(showNetworkConfig(NetworkId)), SLOT(showNetworkConfig(NetworkId))); - connect(GraphicalUi::contextMenuActionProvider(), SIGNAL(showIgnoreList(QString)), SLOT(showIgnoreList(QString))); - connect(Client::instance(), SIGNAL(showIgnoreList(QString)), SLOT(showIgnoreList(QString))); - connect(Client::instance(), SIGNAL(dbUpgradeInProgress(bool)), SLOT(showMigrationWarning(bool))); - connect(Client::instance(), SIGNAL(exitRequested(QString)), SLOT(onExitRequested(QString))); - - connect(Client::coreConnection(), SIGNAL(startCoreSetup(QVariantList, QVariantList)), SLOT(showCoreConfigWizard(QVariantList, QVariantList))); - connect(Client::coreConnection(), SIGNAL(connectionErrorPopup(QString)), SLOT(handleCoreConnectionError(QString))); - connect(Client::coreConnection(), SIGNAL(userAuthenticationRequired(CoreAccount *, bool *, QString)), SLOT(userAuthenticationRequired(CoreAccount *, bool *, QString))); - connect(Client::coreConnection(), SIGNAL(handleNoSslInClient(bool *)), SLOT(handleNoSslInClient(bool *))); - connect(Client::coreConnection(), SIGNAL(handleNoSslInCore(bool *)), SLOT(handleNoSslInCore(bool *))); + &Client::showChannelList, + this, &MainWin::showChannelList); + connect(GraphicalUi::contextMenuActionProvider(), &NetworkModelController::showNetworkConfig, this, &MainWin::showNetworkConfig); + connect(GraphicalUi::contextMenuActionProvider(), &NetworkModelController::showIgnoreList, this, &MainWin::showIgnoreList); + connect(Client::instance(), &Client::showIgnoreList, this, &MainWin::showIgnoreList); + connect(Client::instance(), &Client::dbUpgradeInProgress, this, &MainWin::showMigrationWarning); + connect(Client::instance(), &Client::exitRequested, this, &MainWin::onExitRequested); + + connect(Client::coreConnection(), &CoreConnection::startCoreSetup, this, &MainWin::showCoreConfigWizard); + connect(Client::coreConnection(), &CoreConnection::connectionErrorPopup, this, &MainWin::handleCoreConnectionError); + connect(Client::coreConnection(), &CoreConnection::userAuthenticationRequired, this, &MainWin::userAuthenticationRequired); + connect(Client::coreConnection(), &CoreConnection::handleNoSslInClient, this, &MainWin::handleNoSslInClient); + connect(Client::coreConnection(), &CoreConnection::handleNoSslInCore, this, &MainWin::handleNoSslInCore); #ifdef HAVE_SSL - connect(Client::coreConnection(), SIGNAL(handleSslErrors(const QSslSocket *, bool *, bool *)), SLOT(handleSslErrors(const QSslSocket *, bool *, bool *))); + connect(Client::coreConnection(), &CoreConnection::handleSslErrors, this, &MainWin::handleSslErrors); #endif // Setup Dock Areas @@ -289,7 +289,7 @@ void MainWin::init() qApp->closeAllWindows(); }); - QTimer::singleShot(0, this, SLOT(doAutoConnect())); + QTimer::singleShot(0, this, &MainWin::doAutoConnect); } @@ -394,7 +394,7 @@ void MainWin::setupActions() QAction *lockAct = coll->addAction("LockLayout", new Action(tr("&Lock Layout"), coll)); lockAct->setCheckable(true); - connect(lockAct, SIGNAL(toggled(bool)), SLOT(on_actionLockLayout_toggled(bool))); + connect(lockAct, &QAction::toggled, this, &MainWin::on_actionLockLayout_toggled); coll->addAction("ToggleSearchBar", new Action(icon::get("edit-find"), tr("Show &Search Bar"), coll, nullptr, nullptr, QKeySequence::Find))->setCheckable(true); @@ -641,7 +641,7 @@ void MainWin::setupMenus() enabled ? menuBar()->show() : menuBar()->hide(); connect(showMenuBar, SIGNAL(toggled(bool)), menuBar(), SLOT(setVisible(bool))); - connect(showMenuBar, SIGNAL(toggled(bool)), this, SLOT(saveMenuBarStatus(bool))); + connect(showMenuBar, &QAction::toggled, this, &MainWin::saveMenuBarStatus); } @@ -683,8 +683,8 @@ void MainWin::addBufferView(ClientBufferViewConfig *config) addDockWidget(Qt::LeftDockWidgetArea, dock); _bufferViewsMenu->addAction(dock->toggleViewAction()); - connect(dock->toggleViewAction(), SIGNAL(toggled(bool)), this, SLOT(bufferViewToggled(bool))); - connect(dock, SIGNAL(visibilityChanged(bool)), SLOT(bufferViewVisibilityChanged(bool))); + connect(dock->toggleViewAction(), &QAction::toggled, this, &MainWin::bufferViewToggled); + connect(dock, &QDockWidget::visibilityChanged, this, &MainWin::bufferViewVisibilityChanged); _bufferViews.append(dock); if (!activeBufferView()) @@ -1095,8 +1095,8 @@ void MainWin::setupStatusBar() showStatusbar->setChecked(enabled); enabled ? statusBar()->show() : statusBar()->hide(); - connect(showStatusbar, SIGNAL(toggled(bool)), statusBar(), SLOT(setVisible(bool))); - connect(showStatusbar, SIGNAL(toggled(bool)), this, SLOT(saveStatusBarStatus(bool))); + connect(showStatusbar, &QAction::toggled, statusBar(), &QWidget::setVisible); + connect(showStatusbar, &QAction::toggled, this, &MainWin::saveStatusBarStatus); connect(Client::coreConnection(), SIGNAL(connectionMsg(QString)), statusBar(), SLOT(showMessage(QString))); } @@ -1214,11 +1214,11 @@ void MainWin::connectedToCore() { Q_CHECK_PTR(Client::bufferViewManager()); connect(Client::bufferViewManager(), SIGNAL(bufferViewConfigAdded(int)), this, SLOT(addBufferView(int))); - connect(Client::bufferViewManager(), SIGNAL(bufferViewConfigDeleted(int)), this, SLOT(removeBufferView(int))); - connect(Client::bufferViewManager(), SIGNAL(initDone()), this, SLOT(loadLayout())); + connect(Client::bufferViewManager(), &BufferViewManager::bufferViewConfigDeleted, this, &MainWin::removeBufferView); + connect(Client::bufferViewManager(), &SyncableObject::initDone, this, &MainWin::loadLayout); if (Client::transferManager()) { - connect(Client::transferManager(), SIGNAL(transferAdded(QUuid)), SLOT(showNewTransferDlg(QUuid))); + connect(Client::transferManager(), &TransferManager::transferAdded, this, &MainWin::showNewTransferDlg); } setConnectedState(); @@ -1239,13 +1239,13 @@ void MainWin::setConnectedState() action->setVisible(!Client::internalCore()); } - disconnect(Client::backlogManager(), SIGNAL(updateProgress(int, int)), _msgProcessorStatusWidget, SLOT(setProgress(int, int))); - disconnect(Client::backlogManager(), SIGNAL(messagesRequested(const QString &)), this, SLOT(showStatusBarMessage(const QString &))); - disconnect(Client::backlogManager(), SIGNAL(messagesProcessed(const QString &)), this, SLOT(showStatusBarMessage(const QString &))); + disconnect(Client::backlogManager(), &ClientBacklogManager::updateProgress, _msgProcessorStatusWidget, &MsgProcessorStatusWidget::setProgress); + disconnect(Client::backlogManager(), &ClientBacklogManager::messagesRequested, this, &MainWin::showStatusBarMessage); + disconnect(Client::backlogManager(), &ClientBacklogManager::messagesProcessed, this, &MainWin::showStatusBarMessage); if (!Client::internalCore()) { - connect(Client::backlogManager(), SIGNAL(updateProgress(int, int)), _msgProcessorStatusWidget, SLOT(setProgress(int, int))); - connect(Client::backlogManager(), SIGNAL(messagesRequested(const QString &)), this, SLOT(showStatusBarMessage(const QString &))); - connect(Client::backlogManager(), SIGNAL(messagesProcessed(const QString &)), this, SLOT(showStatusBarMessage(const QString &))); + connect(Client::backlogManager(), &ClientBacklogManager::updateProgress, _msgProcessorStatusWidget, &MsgProcessorStatusWidget::setProgress); + connect(Client::backlogManager(), &ClientBacklogManager::messagesRequested, this, &MainWin::showStatusBarMessage); + connect(Client::backlogManager(), &ClientBacklogManager::messagesProcessed, this, &MainWin::showStatusBarMessage); } // _viewMenu->setEnabled(true); @@ -1519,7 +1519,7 @@ void MainWin::showAwayLog() auto *filter = new AwayLogFilter(Client::messageModel()); _awayLog = new AwayLogView(filter, nullptr); filter->setParent(_awayLog); - connect(_awayLog, SIGNAL(destroyed()), this, SLOT(awayLogDestroyed())); + connect(_awayLog, &QObject::destroyed, this, &MainWin::awayLogDestroyed); _awayLog->setAttribute(Qt::WA_DeleteOnClose); _awayLog->show(); } @@ -1752,8 +1752,8 @@ void MainWin::clientNetworkCreated(NetworkId id) auto *act = new QAction(net->networkName(), this); act->setObjectName(QString("NetworkAction-%1").arg(id.toInt())); act->setData(QVariant::fromValue(id)); - connect(net, SIGNAL(updatedRemotely()), this, SLOT(clientNetworkUpdated())); - connect(act, SIGNAL(triggered()), this, SLOT(connectOrDisconnectFromNet())); + connect(net, &SyncableObject::updatedRemotely, this, &MainWin::clientNetworkUpdated); + connect(act, &QAction::triggered, this, &MainWin::connectOrDisconnectFromNet); QAction *beforeAction = nullptr; foreach(QAction *action, _networksMenu->actions()) { diff --git a/src/qtui/markerlineitem.cpp b/src/qtui/markerlineitem.cpp index 68c44ae1..4ec1651f 100644 --- a/src/qtui/markerlineitem.cpp +++ b/src/qtui/markerlineitem.cpp @@ -31,7 +31,7 @@ MarkerLineItem::MarkerLineItem(qreal sceneWidth, QGraphicsItem *parent) setVisible(false); setZValue(8); styleChanged(); // init brush and height - connect(QtUi::style(), SIGNAL(changed()), SLOT(styleChanged())); + connect(QtUi::style(), &UiStyle::changed, this, &MarkerLineItem::styleChanged); } diff --git a/src/qtui/passwordchangedlg.cpp b/src/qtui/passwordchangedlg.cpp index 50cab7b2..ce016f22 100644 --- a/src/qtui/passwordchangedlg.cpp +++ b/src/qtui/passwordchangedlg.cpp @@ -34,12 +34,12 @@ PasswordChangeDlg::PasswordChangeDlg(QWidget *parent) : QDialog(parent) "on the Quassel Core running at %2.") .arg(account.user(), account.hostName())); - connect(ui.oldPasswordEdit, SIGNAL(textChanged(QString)), SLOT(inputChanged())); - connect(ui.newPasswordEdit, SIGNAL(textChanged(QString)), SLOT(inputChanged())); - connect(ui.confirmPasswordEdit, SIGNAL(textChanged(QString)), SLOT(inputChanged())); - connect(ui.buttonBox, SIGNAL(accepted()), SLOT(changePassword())); + connect(ui.oldPasswordEdit, &QLineEdit::textChanged, this, &PasswordChangeDlg::inputChanged); + connect(ui.newPasswordEdit, &QLineEdit::textChanged, this, &PasswordChangeDlg::inputChanged); + connect(ui.confirmPasswordEdit, &QLineEdit::textChanged, this, &PasswordChangeDlg::inputChanged); + connect(ui.buttonBox, &QDialogButtonBox::accepted, this, &PasswordChangeDlg::changePassword); - connect(Client::instance(), SIGNAL(passwordChanged(bool)), SLOT(passwordChanged(bool))); + connect(Client::instance(), &Client::passwordChanged, this, &PasswordChangeDlg::passwordChanged); ui.buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false); } diff --git a/src/qtui/qtmultimedianotificationbackend.cpp b/src/qtui/qtmultimedianotificationbackend.cpp index 3a32cb17..2557a923 100644 --- a/src/qtui/qtmultimedianotificationbackend.cpp +++ b/src/qtui/qtmultimedianotificationbackend.cpp @@ -103,8 +103,8 @@ QtMultimediaNotificationBackend::ConfigWidget::ConfigWidget(QWidget *parent) _audioAvailable = (QMediaPlayer().availability() == QMultimedia::Available); - connect(ui.enabled, SIGNAL(toggled(bool)), SLOT(widgetChanged())); - connect(ui.filename, SIGNAL(textChanged(const QString &)), SLOT(widgetChanged())); + connect(ui.enabled, &QAbstractButton::toggled, this, &ConfigWidget::widgetChanged); + connect(ui.filename, &QLineEdit::textChanged, this, &ConfigWidget::widgetChanged); } diff --git a/src/qtui/qtui.cpp b/src/qtui/qtui.cpp index d438c209..ea430c8c 100644 --- a/src/qtui/qtui.cpp +++ b/src/qtui/qtui.cpp @@ -83,9 +83,9 @@ void QtUi::init() _mainWin = std::make_unique(); setMainWidget(_mainWin.get()); - connect(_mainWin.get(), SIGNAL(connectToCore(const QVariantMap &)), this, SIGNAL(connectToCore(const QVariantMap &))); - connect(_mainWin.get(), SIGNAL(disconnectFromCore()), this, SIGNAL(disconnectFromCore())); - connect(Client::instance(), SIGNAL(bufferMarkedAsRead(BufferId)), SLOT(closeNotifications(BufferId))); + connect(_mainWin.get(), &MainWin::connectToCore, this, &QtUi::connectToCore); + connect(_mainWin.get(), &MainWin::disconnectFromCore, this, &QtUi::disconnectFromCore); + connect(Client::instance(), &Client::bufferMarkedAsRead, this, &QtUi::closeNotifications); _mainWin->init(); diff --git a/src/qtui/qtuiapplication.cpp b/src/qtui/qtuiapplication.cpp index ac9562f1..cb4f91c8 100644 --- a/src/qtui/qtuiapplication.cpp +++ b/src/qtui/qtuiapplication.cpp @@ -54,7 +54,7 @@ void QtUiApplication::init() // Init UI only after the event loop has started // TODO Qt5: Make this a lambda - QTimer::singleShot(0, this, SLOT(initUi())); + QTimer::singleShot(0, this, &QtUiApplication::initUi); } diff --git a/src/qtui/qtuimessageprocessor.cpp b/src/qtui/qtuimessageprocessor.cpp index ccde0c3f..64ceeed1 100644 --- a/src/qtui/qtuimessageprocessor.cpp +++ b/src/qtui/qtuimessageprocessor.cpp @@ -43,7 +43,7 @@ QtUiMessageProcessor::QtUiMessageProcessor(QObject *parent) notificationSettings.notify("Highlights/HighlightNick", this, SLOT(highlightNickChanged(const QVariant &))); _processTimer.setInterval(0); - connect(&_processTimer, SIGNAL(timeout()), this, SLOT(processNextMessage())); + connect(&_processTimer, &QTimer::timeout, this, &QtUiMessageProcessor::processNextMessage); } diff --git a/src/qtui/settingsdlg.cpp b/src/qtui/settingsdlg.cpp index d9d81fe9..3cd2f237 100644 --- a/src/qtui/settingsdlg.cpp +++ b/src/qtui/settingsdlg.cpp @@ -38,10 +38,10 @@ SettingsDlg::SettingsDlg(QWidget *parent) ui.settingsTree->setRootIsDecorated(false); - connect(ui.settingsTree, SIGNAL(itemSelectionChanged()), this, SLOT(itemSelected())); - connect(ui.buttonBox, SIGNAL(clicked(QAbstractButton *)), this, SLOT(buttonClicked(QAbstractButton *))); + connect(ui.settingsTree, &QTreeWidget::itemSelectionChanged, this, &SettingsDlg::itemSelected); + connect(ui.buttonBox, &QDialogButtonBox::clicked, this, &SettingsDlg::buttonClicked); - connect(Client::instance(), SIGNAL(coreConnectionStateChanged(bool)), SLOT(coreConnectionStateChanged())); + connect(Client::instance(), &Client::coreConnectionStateChanged, this, &SettingsDlg::coreConnectionStateChanged); setButtonStates(); } diff --git a/src/qtui/settingspagedlg.cpp b/src/qtui/settingspagedlg.cpp index fd4cb54b..49e03d53 100644 --- a/src/qtui/settingspagedlg.cpp +++ b/src/qtui/settingspagedlg.cpp @@ -46,7 +46,7 @@ SettingsPageDlg::SettingsPageDlg(SettingsPage *page, QWidget *parent) updateGeometry(); connect(page, SIGNAL(changed(bool)), this, SLOT(setButtonStates())); - connect(ui.buttonBox, SIGNAL(clicked(QAbstractButton *)), this, SLOT(buttonClicked(QAbstractButton *))); + connect(ui.buttonBox, &QDialogButtonBox::clicked, this, &SettingsPageDlg::buttonClicked); page->load(); setButtonStates(); } diff --git a/src/qtui/settingspages/aliasesmodel.cpp b/src/qtui/settingspages/aliasesmodel.cpp index cf868f02..47a701ea 100644 --- a/src/qtui/settingspages/aliasesmodel.cpp +++ b/src/qtui/settingspages/aliasesmodel.cpp @@ -30,8 +30,8 @@ AliasesModel::AliasesModel(QObject *parent) : QAbstractItemModel(parent) { // we need this signal for future connects to reset the data; - connect(Client::instance(), SIGNAL(connected()), this, SLOT(clientConnected())); - connect(Client::instance(), SIGNAL(disconnected()), this, SLOT(clientDisconnected())); + connect(Client::instance(), &Client::connected, this, &AliasesModel::clientConnected); + connect(Client::instance(), &Client::disconnected, this, &AliasesModel::clientDisconnected); if (Client::isConnected()) clientConnected(); @@ -327,7 +327,7 @@ void AliasesModel::clientConnected() if (Client::aliasManager()->isInitialized()) initDone(); else - connect(Client::aliasManager(), SIGNAL(initDone()), SLOT(initDone())); + connect(Client::aliasManager(), &SyncableObject::initDone, this, &AliasesModel::initDone); } diff --git a/src/qtui/settingspages/aliasessettingspage.cpp b/src/qtui/settingspages/aliasessettingspage.cpp index c817b45d..a159eb3c 100644 --- a/src/qtui/settingspages/aliasessettingspage.cpp +++ b/src/qtui/settingspages/aliasessettingspage.cpp @@ -41,10 +41,10 @@ AliasesSettingsPage::AliasesSettingsPage(QWidget *parent) ui.aliasesView->verticalHeader()->hide(); ui.aliasesView->horizontalHeader()->setStretchLastSection(true); - connect(ui.newAliasButton, SIGNAL(clicked()), &_aliasesModel, SLOT(newAlias())); - connect(ui.deleteAliasButton, SIGNAL(clicked()), this, SLOT(deleteSelectedAlias())); + connect(ui.newAliasButton, &QAbstractButton::clicked, &_aliasesModel, &AliasesModel::newAlias); + connect(ui.deleteAliasButton, &QAbstractButton::clicked, this, &AliasesSettingsPage::deleteSelectedAlias); connect(&_aliasesModel, SIGNAL(configChanged(bool)), this, SLOT(setChangedState(bool))); - connect(&_aliasesModel, SIGNAL(modelReady(bool)), this, SLOT(enableDialog(bool))); + connect(&_aliasesModel, &AliasesModel::modelReady, this, &AliasesSettingsPage::enableDialog); enableDialog(_aliasesModel.isReady()); } diff --git a/src/qtui/settingspages/appearancesettingspage.cpp b/src/qtui/settingspages/appearancesettingspage.cpp index f5360c34..cc713bea 100644 --- a/src/qtui/settingspages/appearancesettingspage.cpp +++ b/src/qtui/settingspages/appearancesettingspage.cpp @@ -57,22 +57,22 @@ AppearanceSettingsPage::AppearanceSettingsPage(QWidget *parent) connect(comboBox, SIGNAL(currentIndexChanged(QString)), this, SLOT(widgetHasChanged())); } foreach(QCheckBox *checkBox, findChildren()) { - connect(checkBox, SIGNAL(clicked()), this, SLOT(widgetHasChanged())); + connect(checkBox, &QAbstractButton::clicked, this, &AppearanceSettingsPage::widgetHasChanged); } - connect(ui.chooseStyleSheet, SIGNAL(clicked()), SLOT(chooseStyleSheet())); + connect(ui.chooseStyleSheet, &QAbstractButton::clicked, this, &AppearanceSettingsPage::chooseStyleSheet); - connect(ui.userNoticesInDefaultBuffer, SIGNAL(clicked(bool)), this, SLOT(widgetHasChanged())); - connect(ui.userNoticesInStatusBuffer, SIGNAL(clicked(bool)), this, SLOT(widgetHasChanged())); - connect(ui.userNoticesInCurrentBuffer, SIGNAL(clicked(bool)), this, SLOT(widgetHasChanged())); + connect(ui.userNoticesInDefaultBuffer, &QAbstractButton::clicked, this, &AppearanceSettingsPage::widgetHasChanged); + connect(ui.userNoticesInStatusBuffer, &QAbstractButton::clicked, this, &AppearanceSettingsPage::widgetHasChanged); + connect(ui.userNoticesInCurrentBuffer, &QAbstractButton::clicked, this, &AppearanceSettingsPage::widgetHasChanged); - connect(ui.serverNoticesInDefaultBuffer, SIGNAL(clicked(bool)), this, SLOT(widgetHasChanged())); - connect(ui.serverNoticesInStatusBuffer, SIGNAL(clicked(bool)), this, SLOT(widgetHasChanged())); - connect(ui.serverNoticesInCurrentBuffer, SIGNAL(clicked(bool)), this, SLOT(widgetHasChanged())); + connect(ui.serverNoticesInDefaultBuffer, &QAbstractButton::clicked, this, &AppearanceSettingsPage::widgetHasChanged); + connect(ui.serverNoticesInStatusBuffer, &QAbstractButton::clicked, this, &AppearanceSettingsPage::widgetHasChanged); + connect(ui.serverNoticesInCurrentBuffer, &QAbstractButton::clicked, this, &AppearanceSettingsPage::widgetHasChanged); - connect(ui.errorMsgsInDefaultBuffer, SIGNAL(clicked(bool)), this, SLOT(widgetHasChanged())); - connect(ui.errorMsgsInStatusBuffer, SIGNAL(clicked(bool)), this, SLOT(widgetHasChanged())); - connect(ui.errorMsgsInCurrentBuffer, SIGNAL(clicked(bool)), this, SLOT(widgetHasChanged())); + connect(ui.errorMsgsInDefaultBuffer, &QAbstractButton::clicked, this, &AppearanceSettingsPage::widgetHasChanged); + connect(ui.errorMsgsInStatusBuffer, &QAbstractButton::clicked, this, &AppearanceSettingsPage::widgetHasChanged); + connect(ui.errorMsgsInCurrentBuffer, &QAbstractButton::clicked, this, &AppearanceSettingsPage::widgetHasChanged); } diff --git a/src/qtui/settingspages/bufferviewsettingspage.cpp b/src/qtui/settingspages/bufferviewsettingspage.cpp index b9227056..b27e1ae2 100644 --- a/src/qtui/settingspages/bufferviewsettingspage.cpp +++ b/src/qtui/settingspages/bufferviewsettingspage.cpp @@ -52,20 +52,20 @@ BufferViewSettingsPage::BufferViewSettingsPage(QWidget *parent) ui.bufferViewPreview->setEnabled(false); coreConnectionStateChanged(Client::isConnected()); // need a core connection! - connect(Client::instance(), SIGNAL(coreConnectionStateChanged(bool)), this, SLOT(coreConnectionStateChanged(bool))); - connect(ui.bufferViewList->selectionModel(), SIGNAL(selectionChanged(const QItemSelection &, const QItemSelection &)), - this, SLOT(bufferViewSelectionChanged(const QItemSelection &, const QItemSelection &))); - - connect(ui.onlyStatusBuffers, SIGNAL(clicked(bool)), this, SLOT(widgetHasChanged())); - connect(ui.onlyChannelBuffers, SIGNAL(clicked(bool)), this, SLOT(widgetHasChanged())); - connect(ui.onlyQueryBuffers, SIGNAL(clicked(bool)), this, SLOT(widgetHasChanged())); - connect(ui.addNewBuffersAutomatically, SIGNAL(clicked(bool)), this, SLOT(widgetHasChanged())); - connect(ui.sortAlphabetically, SIGNAL(clicked(bool)), this, SLOT(widgetHasChanged())); - connect(ui.hideInactiveBuffers, SIGNAL(clicked(bool)), this, SLOT(widgetHasChanged())); - connect(ui.hideInactiveNetworks, SIGNAL(clicked(bool)), this, SLOT(widgetHasChanged())); + connect(Client::instance(), &Client::coreConnectionStateChanged, this, &BufferViewSettingsPage::coreConnectionStateChanged); + connect(ui.bufferViewList->selectionModel(), &QItemSelectionModel::selectionChanged, + this, &BufferViewSettingsPage::bufferViewSelectionChanged); + + connect(ui.onlyStatusBuffers, &QAbstractButton::clicked, this, &BufferViewSettingsPage::widgetHasChanged); + connect(ui.onlyChannelBuffers, &QAbstractButton::clicked, this, &BufferViewSettingsPage::widgetHasChanged); + connect(ui.onlyQueryBuffers, &QAbstractButton::clicked, this, &BufferViewSettingsPage::widgetHasChanged); + connect(ui.addNewBuffersAutomatically, &QAbstractButton::clicked, this, &BufferViewSettingsPage::widgetHasChanged); + connect(ui.sortAlphabetically, &QAbstractButton::clicked, this, &BufferViewSettingsPage::widgetHasChanged); + connect(ui.hideInactiveBuffers, &QAbstractButton::clicked, this, &BufferViewSettingsPage::widgetHasChanged); + connect(ui.hideInactiveNetworks, &QAbstractButton::clicked, this, &BufferViewSettingsPage::widgetHasChanged); connect(ui.networkSelector, SIGNAL(currentIndexChanged(int)), this, SLOT(widgetHasChanged())); connect(ui.minimumActivitySelector, SIGNAL(currentIndexChanged(int)), this, SLOT(widgetHasChanged())); - connect(ui.showSearch, SIGNAL(clicked(bool)), this, SLOT(widgetHasChanged())); + connect(ui.showSearch, &QAbstractButton::clicked, this, &BufferViewSettingsPage::widgetHasChanged); connect(ui.networkSelector, SIGNAL(currentIndexChanged(int)), this, SLOT(enableStatusBuffers(int))); } @@ -206,8 +206,8 @@ void BufferViewSettingsPage::addBufferView(BufferViewConfig *config) { auto *item = new QListWidgetItem(config->bufferViewName(), ui.bufferViewList); item->setData(Qt::UserRole, qVariantFromValue(qobject_cast(config))); - connect(config, SIGNAL(updatedRemotely()), this, SLOT(updateBufferView())); - connect(config, SIGNAL(destroyed()), this, SLOT(bufferViewDeleted())); + connect(config, &SyncableObject::updatedRemotely, this, &BufferViewSettingsPage::updateBufferView); + connect(config, &QObject::destroyed, this, &BufferViewSettingsPage::bufferViewDeleted); ui.deleteBufferView->setEnabled(ui.bufferViewList->count() > 1); } @@ -544,9 +544,9 @@ BufferViewConfig *BufferViewSettingsPage::cloneConfig(BufferViewConfig *config) changedConfig->fromVariantMap(config->toVariantMap()); changedConfig->setInitialized(); _changedBufferViews[config] = changedConfig; - connect(config, SIGNAL(bufferAdded(const BufferId &, int)), changedConfig, SLOT(addBuffer(const BufferId &, int))); - connect(config, SIGNAL(bufferMoved(const BufferId &, int)), changedConfig, SLOT(moveBuffer(const BufferId &, int))); - connect(config, SIGNAL(bufferRemoved(const BufferId &)), changedConfig, SLOT(removeBuffer(const BufferId &))); + connect(config, &BufferViewConfig::bufferAdded, changedConfig, &BufferViewConfig::addBuffer); + connect(config, &BufferViewConfig::bufferMoved, changedConfig, &BufferViewConfig::moveBuffer); + connect(config, &BufferViewConfig::bufferRemoved, changedConfig, &BufferViewConfig::removeBuffer); // connect(config, SIGNAL(addBufferRequested(const BufferId &, int)), changedConfig, SLOT(addBuffer(const BufferId &, int))); // connect(config, SIGNAL(moveBufferRequested(const BufferId &, int)), changedConfig, SLOT(moveBuffer(const BufferId &, int))); // connect(config, SIGNAL(removeBufferRequested(const BufferId &)), changedConfig, SLOT(removeBuffer(const BufferId &))); diff --git a/src/qtui/settingspages/chatmonitorsettingspage.cpp b/src/qtui/settingspages/chatmonitorsettingspage.cpp index ec3526a2..460c872d 100644 --- a/src/qtui/settingspages/chatmonitorsettingspage.cpp +++ b/src/qtui/settingspages/chatmonitorsettingspage.cpp @@ -61,11 +61,11 @@ ChatMonitorSettingsPage::ChatMonitorSettingsPage(QWidget *parent) // connect slots connect(ui.operationMode, SIGNAL(currentIndexChanged(int)), SLOT(switchOperationMode(int))); - connect(ui.showHighlights, SIGNAL(toggled(bool)), SLOT(widgetHasChanged())); - connect(ui.showOwnMessages, SIGNAL(toggled(bool)), SLOT(widgetHasChanged())); - connect(ui.alwaysOwn, SIGNAL(toggled(bool)), SLOT(widgetHasChanged())); - connect(ui.showBacklog, SIGNAL(toggled(bool)), SLOT(widgetHasChanged())); - connect(ui.includeRead, SIGNAL(toggled(bool)), SLOT(widgetHasChanged())); + connect(ui.showHighlights, &QAbstractButton::toggled, this, &ChatMonitorSettingsPage::widgetHasChanged); + connect(ui.showOwnMessages, &QAbstractButton::toggled, this, &ChatMonitorSettingsPage::widgetHasChanged); + connect(ui.alwaysOwn, &QAbstractButton::toggled, this, &ChatMonitorSettingsPage::widgetHasChanged); + connect(ui.showBacklog, &QAbstractButton::toggled, this, &ChatMonitorSettingsPage::widgetHasChanged); + connect(ui.includeRead, &QAbstractButton::toggled, this, &ChatMonitorSettingsPage::widgetHasChanged); } diff --git a/src/qtui/settingspages/connectionsettingspage.cpp b/src/qtui/settingspages/connectionsettingspage.cpp index 6356a757..364e9fdb 100644 --- a/src/qtui/settingspages/connectionsettingspage.cpp +++ b/src/qtui/settingspages/connectionsettingspage.cpp @@ -29,8 +29,8 @@ ConnectionSettingsPage::ConnectionSettingsPage(QWidget *parent) ui.setupUi(this); initAutoWidgets(); - connect(Client::instance(), SIGNAL(connected()), this, SLOT(clientConnected())); - connect(Client::instance(), SIGNAL(disconnected()), this, SLOT(clientDisconnected())); + connect(Client::instance(), &Client::connected, this, &ConnectionSettingsPage::clientConnected); + connect(Client::instance(), &Client::disconnected, this, &ConnectionSettingsPage::clientDisconnected); setEnabled(false); if (Client::isConnected()) @@ -43,7 +43,7 @@ void ConnectionSettingsPage::clientConnected() if (Client::networkConfig()->isInitialized()) initDone(); else - connect(Client::networkConfig(), SIGNAL(initDone()), SLOT(initDone())); + connect(Client::networkConfig(), &SyncableObject::initDone, this, &ConnectionSettingsPage::initDone); } diff --git a/src/qtui/settingspages/coreaccountsettingspage.cpp b/src/qtui/settingspages/coreaccountsettingspage.cpp index 3a6f1cd6..7665ce03 100644 --- a/src/qtui/settingspages/coreaccountsettingspage.cpp +++ b/src/qtui/settingspages/coreaccountsettingspage.cpp @@ -42,10 +42,10 @@ CoreAccountSettingsPage::CoreAccountSettingsPage(QWidget *parent) ui.accountView->setModel(filteredModel()); ui.autoConnectAccount->setModel(filteredModel()); - connect(filteredModel(), SIGNAL(rowsAboutToBeRemoved(QModelIndex, int, int)), SLOT(rowsAboutToBeRemoved(QModelIndex, int, int))); - connect(filteredModel(), SIGNAL(rowsInserted(QModelIndex, int, int)), SLOT(rowsInserted(QModelIndex, int, int))); + connect(filteredModel(), &QAbstractItemModel::rowsAboutToBeRemoved, this, &CoreAccountSettingsPage::rowsAboutToBeRemoved); + connect(filteredModel(), &QAbstractItemModel::rowsInserted, this, &CoreAccountSettingsPage::rowsInserted); - connect(ui.accountView->selectionModel(), SIGNAL(selectionChanged(QItemSelection, QItemSelection)), SLOT(setWidgetStates())); + connect(ui.accountView->selectionModel(), &QItemSelectionModel::selectionChanged, this, &CoreAccountSettingsPage::setWidgetStates); connect(ui.autoConnectAccount, SIGNAL(currentIndexChanged(int)), SLOT(widgetHasChanged())); setWidgetStates(); } diff --git a/src/qtui/settingspages/coreconnectionsettingspage.cpp b/src/qtui/settingspages/coreconnectionsettingspage.cpp index f29d6bad..b5d5ffd3 100644 --- a/src/qtui/settingspages/coreconnectionsettingspage.cpp +++ b/src/qtui/settingspages/coreconnectionsettingspage.cpp @@ -27,9 +27,9 @@ CoreConnectionSettingsPage::CoreConnectionSettingsPage(QWidget *parent) initAutoWidgets(); - connect(ui.useQNetworkConfigurationManager, SIGNAL(toggled(bool)), SLOT(widgetHasChanged())); - connect(ui.usePingTimeout, SIGNAL(toggled(bool)), SLOT(widgetHasChanged())); - connect(ui.useNoTimeout, SIGNAL(toggled(bool)), SLOT(widgetHasChanged())); + connect(ui.useQNetworkConfigurationManager, &QAbstractButton::toggled, this, &CoreConnectionSettingsPage::widgetHasChanged); + connect(ui.usePingTimeout, &QAbstractButton::toggled, this, &CoreConnectionSettingsPage::widgetHasChanged); + connect(ui.useNoTimeout, &QAbstractButton::toggled, this, &CoreConnectionSettingsPage::widgetHasChanged); } diff --git a/src/qtui/settingspages/corehighlightsettingspage.cpp b/src/qtui/settingspages/corehighlightsettingspage.cpp index 9315f3f8..923858dd 100644 --- a/src/qtui/settingspages/corehighlightsettingspage.cpp +++ b/src/qtui/settingspages/corehighlightsettingspage.cpp @@ -44,24 +44,24 @@ CoreHighlightSettingsPage::CoreHighlightSettingsPage(QWidget *parent) ui.highlightNicksComboBox->addItem(tr("None"), QVariant(HighlightRuleManager::NoNick)); coreConnectionStateChanged(Client::isConnected()); // need a core connection! - connect(Client::instance(), SIGNAL(coreConnectionStateChanged(bool)), this, SLOT(coreConnectionStateChanged(bool))); + connect(Client::instance(), &Client::coreConnectionStateChanged, this, &CoreHighlightSettingsPage::coreConnectionStateChanged); connect(ui.highlightAdd, SIGNAL(clicked(bool)), this, SLOT(addNewHighlightRow())); - connect(ui.highlightRemove, SIGNAL(clicked(bool)), this, SLOT(removeSelectedHighlightRows())); - connect(ui.highlightImport, SIGNAL(clicked(bool)), this, SLOT(importRules())); + connect(ui.highlightRemove, &QAbstractButton::clicked, this, &CoreHighlightSettingsPage::removeSelectedHighlightRows); + connect(ui.highlightImport, &QAbstractButton::clicked, this, &CoreHighlightSettingsPage::importRules); connect(ui.ignoredAdd, SIGNAL(clicked(bool)), this, SLOT(addNewIgnoredRow())); - connect(ui.ignoredRemove, SIGNAL(clicked(bool)), this, SLOT(removeSelectedIgnoredRows())); + connect(ui.ignoredRemove, &QAbstractButton::clicked, this, &CoreHighlightSettingsPage::removeSelectedIgnoredRows); // TODO: search for a better signal (one that emits everytime a selection has been changed for one item) connect(ui.highlightTable, - SIGNAL(itemClicked(QTableWidgetItem * )), + &QTableWidget::itemClicked, this, - SLOT(selectHighlightRow(QTableWidgetItem * ))); + &CoreHighlightSettingsPage::selectHighlightRow); connect(ui.ignoredTable, - SIGNAL(itemClicked(QTableWidgetItem * )), + &QTableWidget::itemClicked, this, - SLOT(selectIgnoredRow(QTableWidgetItem * ))); + &CoreHighlightSettingsPage::selectIgnoredRow); // Update the "Case sensitive" checkbox connect(ui.highlightNicksComboBox, @@ -70,25 +70,25 @@ CoreHighlightSettingsPage::CoreHighlightSettingsPage(QWidget *parent) SLOT(highlightNicksChanged(int))); connect(ui.highlightNicksComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(widgetHasChanged())); - connect(ui.nicksCaseSensitive, SIGNAL(clicked(bool)), this, SLOT(widgetHasChanged())); + connect(ui.nicksCaseSensitive, &QAbstractButton::clicked, this, &CoreHighlightSettingsPage::widgetHasChanged); - connect(ui.highlightAdd, SIGNAL(clicked()), this, SLOT(widgetHasChanged())); - connect(ui.highlightRemove, SIGNAL(clicked()), this, SLOT(widgetHasChanged())); + connect(ui.highlightAdd, &QAbstractButton::clicked, this, &CoreHighlightSettingsPage::widgetHasChanged); + connect(ui.highlightRemove, &QAbstractButton::clicked, this, &CoreHighlightSettingsPage::widgetHasChanged); - connect(ui.ignoredAdd, SIGNAL(clicked()), this, SLOT(widgetHasChanged())); - connect(ui.ignoredRemove, SIGNAL(clicked()), this, SLOT(widgetHasChanged())); + connect(ui.ignoredAdd, &QAbstractButton::clicked, this, &CoreHighlightSettingsPage::widgetHasChanged); + connect(ui.ignoredRemove, &QAbstractButton::clicked, this, &CoreHighlightSettingsPage::widgetHasChanged); connect(ui.highlightTable, - SIGNAL(itemChanged(QTableWidgetItem * )), + &QTableWidget::itemChanged, this, - SLOT(highlightTableChanged(QTableWidgetItem * ))); + &CoreHighlightSettingsPage::highlightTableChanged); connect(ui.ignoredTable, - SIGNAL(itemChanged(QTableWidgetItem * )), + &QTableWidget::itemChanged, this, - SLOT(ignoredTableChanged(QTableWidgetItem * ))); + &CoreHighlightSettingsPage::ignoredTableChanged); - connect(Client::instance(), SIGNAL(connected()), this, SLOT(clientConnected())); + connect(Client::instance(), &Client::connected, this, &CoreHighlightSettingsPage::clientConnected); // Warning icon ui.coreUnsupportedIcon->setPixmap(icon::get("dialog-warning").pixmap(16)); @@ -297,7 +297,7 @@ void CoreHighlightSettingsPage::updateCoreSupportStatus(bool state) void CoreHighlightSettingsPage::clientConnected() { - connect(Client::highlightRuleManager(), SIGNAL(updated()), SLOT(revert())); + connect(Client::highlightRuleManager(), &SyncableObject::updated, this, &CoreHighlightSettingsPage::revert); } diff --git a/src/qtui/settingspages/dccsettingspage.cpp b/src/qtui/settingspages/dccsettingspage.cpp index 70d792e7..084236c5 100644 --- a/src/qtui/settingspages/dccsettingspage.cpp +++ b/src/qtui/settingspages/dccsettingspage.cpp @@ -32,7 +32,7 @@ DccSettingsPage::DccSettingsPage(QWidget *parent) connect(ui.portSelectionMode, SIGNAL(currentIndexChanged(int)), SLOT(updateWidgetStates())); updateWidgetStates(); - connect(Client::instance(), SIGNAL(coreConnectionStateChanged(bool)), SLOT(onClientConfigChanged())); + connect(Client::instance(), &Client::coreConnectionStateChanged, this, &DccSettingsPage::onClientConfigChanged); setClientConfig(Client::dccConfig()); } @@ -69,7 +69,7 @@ void DccSettingsPage::setClientConfig(DccConfig *config) void DccSettingsPage::onClientConfigChanged() { if (Client::isConnected() && Client::dccConfig() && !Client::dccConfig()->isInitialized()) { - connect(Client::dccConfig(), SIGNAL(initDone()), SLOT(onClientConfigChanged())); + connect(Client::dccConfig(), &SyncableObject::initDone, this, &DccSettingsPage::onClientConfigChanged); } else { setClientConfig(Client::isConnected() ? Client::dccConfig() : nullptr); diff --git a/src/qtui/settingspages/highlightsettingspage.cpp b/src/qtui/settingspages/highlightsettingspage.cpp index b1328968..ae2b90a6 100644 --- a/src/qtui/settingspages/highlightsettingspage.cpp +++ b/src/qtui/settingspages/highlightsettingspage.cpp @@ -100,17 +100,17 @@ HighlightSettingsPage::HighlightSettingsPage(QWidget *parent) } connect(ui.add, SIGNAL(clicked(bool)), this, SLOT(addNewRow())); - connect(ui.remove, SIGNAL(clicked(bool)), this, SLOT(removeSelectedRows())); + connect(ui.remove, &QAbstractButton::clicked, this, &HighlightSettingsPage::removeSelectedRows); //TODO: search for a better signal (one that emits everytime a selection has been changed for one item) - connect(ui.highlightTable, SIGNAL(itemClicked(QTableWidgetItem *)), this, SLOT(selectRow(QTableWidgetItem *))); - - connect(ui.highlightAllNicks, SIGNAL(clicked(bool)), this, SLOT(widgetHasChanged())); - connect(ui.highlightCurrentNick, SIGNAL(clicked(bool)), this, SLOT(widgetHasChanged())); - connect(ui.highlightNoNick, SIGNAL(clicked(bool)), this, SLOT(widgetHasChanged())); - connect(ui.nicksCaseSensitive, SIGNAL(clicked(bool)), this, SLOT(widgetHasChanged())); - connect(ui.add, SIGNAL(clicked()), this, SLOT(widgetHasChanged())); - connect(ui.remove, SIGNAL(clicked()), this, SLOT(widgetHasChanged())); - connect(ui.highlightTable, SIGNAL(itemChanged(QTableWidgetItem *)), this, SLOT(tableChanged(QTableWidgetItem *))); + connect(ui.highlightTable, &QTableWidget::itemClicked, this, &HighlightSettingsPage::selectRow); + + connect(ui.highlightAllNicks, &QAbstractButton::clicked, this, &HighlightSettingsPage::widgetHasChanged); + connect(ui.highlightCurrentNick, &QAbstractButton::clicked, this, &HighlightSettingsPage::widgetHasChanged); + connect(ui.highlightNoNick, &QAbstractButton::clicked, this, &HighlightSettingsPage::widgetHasChanged); + connect(ui.nicksCaseSensitive, &QAbstractButton::clicked, this, &HighlightSettingsPage::widgetHasChanged); + connect(ui.add, &QAbstractButton::clicked, this, &HighlightSettingsPage::widgetHasChanged); + connect(ui.remove, &QAbstractButton::clicked, this, &HighlightSettingsPage::widgetHasChanged); + connect(ui.highlightTable, &QTableWidget::itemChanged, this, &HighlightSettingsPage::tableChanged); } diff --git a/src/qtui/settingspages/identitiessettingspage.cpp b/src/qtui/settingspages/identitiessettingspage.cpp index 0cf99742..af62c9ef 100644 --- a/src/qtui/settingspages/identitiessettingspage.cpp +++ b/src/qtui/settingspages/identitiessettingspage.cpp @@ -37,14 +37,14 @@ IdentitiesSettingsPage::IdentitiesSettingsPage(QWidget *parent) ui.deleteIdentity->setIcon(icon::get("list-remove-user")); coreConnectionStateChanged(Client::isConnected()); // need a core connection! - connect(Client::instance(), SIGNAL(coreConnectionStateChanged(bool)), this, SLOT(coreConnectionStateChanged(bool))); + connect(Client::instance(), &Client::coreConnectionStateChanged, this, &IdentitiesSettingsPage::coreConnectionStateChanged); - connect(Client::instance(), SIGNAL(identityCreated(IdentityId)), this, SLOT(clientIdentityCreated(IdentityId))); - connect(Client::instance(), SIGNAL(identityRemoved(IdentityId)), this, SLOT(clientIdentityRemoved(IdentityId))); + connect(Client::instance(), &Client::identityCreated, this, &IdentitiesSettingsPage::clientIdentityCreated); + connect(Client::instance(), &Client::identityRemoved, this, &IdentitiesSettingsPage::clientIdentityRemoved); - connect(ui.identityEditor, SIGNAL(widgetHasChanged()), this, SLOT(widgetHasChanged())); + connect(ui.identityEditor, &IdentityEditWidget::widgetHasChanged, this, &IdentitiesSettingsPage::widgetHasChanged); #ifdef HAVE_SSL - connect(ui.identityEditor, SIGNAL(requestEditSsl()), this, SLOT(continueUnsecured())); + connect(ui.identityEditor, &IdentityEditWidget::requestEditSsl, this, &IdentitiesSettingsPage::continueUnsecured); #endif currentId = 0; @@ -221,9 +221,9 @@ void IdentitiesSettingsPage::clientIdentityCreated(IdentityId id) #endif insertIdentity(identity); #ifdef HAVE_SSL - connect(identity, SIGNAL(sslSettingsUpdated()), this, SLOT(clientIdentityUpdated())); + connect(identity, &CertIdentity::sslSettingsUpdated, this, &IdentitiesSettingsPage::clientIdentityUpdated); #endif - connect(Client::identity(id), SIGNAL(updatedRemotely()), this, SLOT(clientIdentityUpdated())); + connect(Client::identity(id), &SyncableObject::updatedRemotely, this, &IdentitiesSettingsPage::clientIdentityUpdated); } @@ -425,8 +425,8 @@ SaveIdentitiesDlg::SaveIdentitiesDlg(const QList &toCreate, cons ui.progressBar->setMaximum(numevents); ui.progressBar->setValue(0); - connect(Client::instance(), SIGNAL(identityCreated(IdentityId)), this, SLOT(clientEvent())); - connect(Client::instance(), SIGNAL(identityRemoved(IdentityId)), this, SLOT(clientEvent())); + connect(Client::instance(), &Client::identityCreated, this, &SaveIdentitiesDlg::clientEvent); + connect(Client::instance(), &Client::identityRemoved, this, &SaveIdentitiesDlg::clientEvent); foreach(CertIdentity *id, toCreate) { Client::createIdentity(*id); @@ -438,7 +438,7 @@ SaveIdentitiesDlg::SaveIdentitiesDlg(const QList &toCreate, cons numevents--; continue; } - connect(cid, SIGNAL(updatedRemotely()), this, SLOT(clientEvent())); + connect(cid, &SyncableObject::updatedRemotely, this, &SaveIdentitiesDlg::clientEvent); Client::updateIdentity(id->id(), id->toVariantMap()); #ifdef HAVE_SSL id->requestUpdateSslSettings(); diff --git a/src/qtui/settingspages/identityeditwidget.cpp b/src/qtui/settingspages/identityeditwidget.cpp index 3a2534b6..9fdff267 100644 --- a/src/qtui/settingspages/identityeditwidget.cpp +++ b/src/qtui/settingspages/identityeditwidget.cpp @@ -43,25 +43,25 @@ IdentityEditWidget::IdentityEditWidget(QWidget *parent) ui.nickDown->setIcon(icon::get("go-down")); // We need to know whenever the state of input widgets changes... - connect(ui.realName, SIGNAL(textEdited(const QString &)), this, SIGNAL(widgetHasChanged())); - connect(ui.nicknameList, SIGNAL(itemChanged(QListWidgetItem *)), this, SIGNAL(widgetHasChanged())); - connect(ui.awayNick, SIGNAL(textEdited(const QString &)), this, SIGNAL(widgetHasChanged())); - connect(ui.awayReason, SIGNAL(textEdited(const QString &)), this, SIGNAL(widgetHasChanged())); - connect(ui.autoAwayEnabled, SIGNAL(clicked(bool)), this, SIGNAL(widgetHasChanged())); + connect(ui.realName, &QLineEdit::textEdited, this, &IdentityEditWidget::widgetHasChanged); + connect(ui.nicknameList, &QListWidget::itemChanged, this, &IdentityEditWidget::widgetHasChanged); + connect(ui.awayNick, &QLineEdit::textEdited, this, &IdentityEditWidget::widgetHasChanged); + connect(ui.awayReason, &QLineEdit::textEdited, this, &IdentityEditWidget::widgetHasChanged); + connect(ui.autoAwayEnabled, &QGroupBox::clicked, this, &IdentityEditWidget::widgetHasChanged); connect(ui.autoAwayTime, SIGNAL(valueChanged(int)), this, SIGNAL(widgetHasChanged())); - connect(ui.autoAwayReason, SIGNAL(textEdited(const QString &)), this, SIGNAL(widgetHasChanged())); - connect(ui.autoAwayReasonEnabled, SIGNAL(clicked(bool)), this, SIGNAL(widgetHasChanged())); - connect(ui.detachAwayEnabled, SIGNAL(clicked(bool)), this, SIGNAL(widgetHasChanged())); - connect(ui.detachAwayReason, SIGNAL(textEdited(const QString &)), this, SIGNAL(widgetHasChanged())); - connect(ui.ident, SIGNAL(textEdited(const QString &)), this, SIGNAL(widgetHasChanged())); - connect(ui.kickReason, SIGNAL(textEdited(const QString &)), this, SIGNAL(widgetHasChanged())); - connect(ui.partReason, SIGNAL(textEdited(const QString &)), this, SIGNAL(widgetHasChanged())); - connect(ui.quitReason, SIGNAL(textEdited(const QString &)), this, SIGNAL(widgetHasChanged())); + connect(ui.autoAwayReason, &QLineEdit::textEdited, this, &IdentityEditWidget::widgetHasChanged); + connect(ui.autoAwayReasonEnabled, &QAbstractButton::clicked, this, &IdentityEditWidget::widgetHasChanged); + connect(ui.detachAwayEnabled, &QGroupBox::clicked, this, &IdentityEditWidget::widgetHasChanged); + connect(ui.detachAwayReason, &QLineEdit::textEdited, this, &IdentityEditWidget::widgetHasChanged); + connect(ui.ident, &QLineEdit::textEdited, this, &IdentityEditWidget::widgetHasChanged); + connect(ui.kickReason, &QLineEdit::textEdited, this, &IdentityEditWidget::widgetHasChanged); + connect(ui.partReason, &QLineEdit::textEdited, this, &IdentityEditWidget::widgetHasChanged); + connect(ui.quitReason, &QLineEdit::textEdited, this, &IdentityEditWidget::widgetHasChanged); setWidgetStates(); - connect(ui.nicknameList, SIGNAL(itemSelectionChanged()), this, SLOT(setWidgetStates())); + connect(ui.nicknameList, &QListWidget::itemSelectionChanged, this, &IdentityEditWidget::setWidgetStates); - connect(ui.continueUnsecured, SIGNAL(clicked()), this, SIGNAL(requestEditSsl())); + connect(ui.continueUnsecured, &QAbstractButton::clicked, this, &IdentityEditWidget::requestEditSsl); // we would need this if we enabled drag and drop in the nicklist... //connect(ui.nicknameList, SIGNAL(rowsInserted(const QModelIndex &, int, int)), this, SLOT(setWidgetStates())); diff --git a/src/qtui/settingspages/ignorelistmodel.cpp b/src/qtui/settingspages/ignorelistmodel.cpp index ade96f77..74df6e12 100644 --- a/src/qtui/settingspages/ignorelistmodel.cpp +++ b/src/qtui/settingspages/ignorelistmodel.cpp @@ -31,8 +31,8 @@ IgnoreListModel::IgnoreListModel(QObject *parent) : QAbstractItemModel(parent) { // we need this signal for future connects to reset the data; - connect(Client::instance(), SIGNAL(connected()), this, SLOT(clientConnected())); - connect(Client::instance(), SIGNAL(disconnected()), this, SLOT(clientDisconnected())); + connect(Client::instance(), &Client::connected, this, &IgnoreListModel::clientConnected); + connect(Client::instance(), &Client::disconnected, this, &IgnoreListModel::clientDisconnected); if (Client::isConnected()) clientConnected(); @@ -293,7 +293,7 @@ void IgnoreListModel::clientConnected() if (Client::ignoreListManager()->isInitialized()) initDone(); else - connect(Client::ignoreListManager(), SIGNAL(initDone()), SLOT(initDone())); + connect(Client::ignoreListManager(), &SyncableObject::initDone, this, &IgnoreListModel::initDone); } diff --git a/src/qtui/settingspages/ignorelistsettingspage.cpp b/src/qtui/settingspages/ignorelistsettingspage.cpp index 82375bf3..6a942e4c 100644 --- a/src/qtui/settingspages/ignorelistsettingspage.cpp +++ b/src/qtui/settingspages/ignorelistsettingspage.cpp @@ -58,12 +58,12 @@ IgnoreListSettingsPage::IgnoreListSettingsPage(QWidget *parent) ui.ignoreListView->viewport()->setAttribute(Qt::WA_Hover); ui.ignoreListView->viewport()->setMouseTracking(true); - connect(ui.ignoreListView->selectionModel(), SIGNAL(selectionChanged(const QItemSelection &, const QItemSelection &)), this, SLOT(selectionChanged(const QItemSelection &, const QItemSelection &))); + connect(ui.ignoreListView->selectionModel(), &QItemSelectionModel::selectionChanged, this, &IgnoreListSettingsPage::selectionChanged); connect(ui.newIgnoreRuleButton, SIGNAL(clicked()), this, SLOT(newIgnoreRule())); - connect(ui.deleteIgnoreRuleButton, SIGNAL(clicked()), this, SLOT(deleteSelectedIgnoreRule())); - connect(ui.editIgnoreRuleButton, SIGNAL(clicked()), this, SLOT(editSelectedIgnoreRule())); + connect(ui.deleteIgnoreRuleButton, &QAbstractButton::clicked, this, &IgnoreListSettingsPage::deleteSelectedIgnoreRule); + connect(ui.editIgnoreRuleButton, &QAbstractButton::clicked, this, &IgnoreListSettingsPage::editSelectedIgnoreRule); connect(&_ignoreListModel, SIGNAL(configChanged(bool)), this, SLOT(setChangedState(bool))); - connect(&_ignoreListModel, SIGNAL(modelReady(bool)), this, SLOT(enableDialog(bool))); + connect(&_ignoreListModel, &IgnoreListModel::modelReady, this, &IgnoreListSettingsPage::enableDialog); enableDialog(_ignoreListModel.isReady()); } @@ -288,15 +288,15 @@ IgnoreListEditDlg::IgnoreListEditDlg(const IgnoreListManager::IgnoreListItem &it else ui.scopeRuleTextEdit->setPlainText(item.scopeRule()); - connect(ui.ignoreRuleLineEdit, SIGNAL(textChanged(const QString &)), this, SLOT(widgetHasChanged())); - connect(ui.scopeRuleTextEdit, SIGNAL(textChanged()), this, SLOT(widgetHasChanged())); + connect(ui.ignoreRuleLineEdit, &QLineEdit::textChanged, this, &IgnoreListEditDlg::widgetHasChanged); + connect(ui.scopeRuleTextEdit, &QPlainTextEdit::textChanged, this, &IgnoreListEditDlg::widgetHasChanged); connect(&_typeButtonGroup, SIGNAL(buttonClicked(int)), this, SLOT(widgetHasChanged())); connect(&_strictnessButtonGroup, SIGNAL(buttonClicked(int)), this, SLOT(widgetHasChanged())); connect(&_scopeButtonGroup, SIGNAL(buttonClicked(int)), this, SLOT(widgetHasChanged())); - connect(ui.isRegExCheckBox, SIGNAL(stateChanged(int)), this, SLOT(widgetHasChanged())); - connect(ui.isActiveCheckBox, SIGNAL(stateChanged(int)), this, SLOT(widgetHasChanged())); + connect(ui.isRegExCheckBox, &QCheckBox::stateChanged, this, &IgnoreListEditDlg::widgetHasChanged); + connect(ui.isActiveCheckBox, &QCheckBox::stateChanged, this, &IgnoreListEditDlg::widgetHasChanged); - connect(ui.buttonBox->button(QDialogButtonBox::Ok), SIGNAL(clicked()), this, SLOT(aboutToAccept())); + connect(ui.buttonBox->button(QDialogButtonBox::Ok), &QAbstractButton::clicked, this, &IgnoreListEditDlg::aboutToAccept); widgetHasChanged(); } diff --git a/src/qtui/settingspages/keysequencewidget.cpp b/src/qtui/settingspages/keysequencewidget.cpp index 379dd1a1..f480e7c2 100644 --- a/src/qtui/settingspages/keysequencewidget.cpp +++ b/src/qtui/settingspages/keysequencewidget.cpp @@ -183,10 +183,10 @@ KeySequenceWidget::KeySequenceWidget(QWidget *parent) setLayout(layout); - connect(_keyButton, SIGNAL(clicked()), SLOT(startRecording())); - connect(_keyButton, SIGNAL(clicked()), SIGNAL(clicked())); - connect(_clearButton, SIGNAL(clicked()), SLOT(clear())); - connect(_clearButton, SIGNAL(clicked()), SIGNAL(clicked())); + connect(_keyButton, &QAbstractButton::clicked, this, &KeySequenceWidget::startRecording); + connect(_keyButton, &QAbstractButton::clicked, this, &KeySequenceWidget::clicked); + connect(_clearButton, &QAbstractButton::clicked, this, &KeySequenceWidget::clear); + connect(_clearButton, &QAbstractButton::clicked, this, &KeySequenceWidget::clicked); } diff --git a/src/qtui/settingspages/networkssettingspage.cpp b/src/qtui/settingspages/networkssettingspage.cpp index b8b84742..d705eb65 100644 --- a/src/qtui/settingspages/networkssettingspage.cpp +++ b/src/qtui/settingspages/networkssettingspage.cpp @@ -85,37 +85,37 @@ NetworksSettingsPage::NetworksSettingsPage(QWidget *parent) currentId = 0; setEnabled(Client::isConnected()); // need a core connection! setWidgetStates(); - connect(Client::instance(), SIGNAL(coreConnectionStateChanged(bool)), this, SLOT(coreConnectionStateChanged(bool))); - connect(Client::instance(), SIGNAL(networkCreated(NetworkId)), this, SLOT(clientNetworkAdded(NetworkId))); - connect(Client::instance(), SIGNAL(networkRemoved(NetworkId)), this, SLOT(clientNetworkRemoved(NetworkId))); - connect(Client::instance(), SIGNAL(identityCreated(IdentityId)), this, SLOT(clientIdentityAdded(IdentityId))); - connect(Client::instance(), SIGNAL(identityRemoved(IdentityId)), this, SLOT(clientIdentityRemoved(IdentityId))); + connect(Client::instance(), &Client::coreConnectionStateChanged, this, &NetworksSettingsPage::coreConnectionStateChanged); + connect(Client::instance(), &Client::networkCreated, this, &NetworksSettingsPage::clientNetworkAdded); + connect(Client::instance(), &Client::networkRemoved, this, &NetworksSettingsPage::clientNetworkRemoved); + connect(Client::instance(), &Client::identityCreated, this, &NetworksSettingsPage::clientIdentityAdded); + connect(Client::instance(), &Client::identityRemoved, this, &NetworksSettingsPage::clientIdentityRemoved); connect(ui.identityList, SIGNAL(currentIndexChanged(int)), this, SLOT(widgetHasChanged())); //connect(ui.randomServer, SIGNAL(clicked(bool)), this, SLOT(widgetHasChanged())); - connect(ui.performEdit, SIGNAL(textChanged()), this, SLOT(widgetHasChanged())); - connect(ui.sasl, SIGNAL(clicked(bool)), this, SLOT(widgetHasChanged())); - connect(ui.saslAccount, SIGNAL(textEdited(QString)), this, SLOT(widgetHasChanged())); - connect(ui.saslPassword, SIGNAL(textEdited(QString)), this, SLOT(widgetHasChanged())); - connect(ui.autoIdentify, SIGNAL(clicked(bool)), this, SLOT(widgetHasChanged())); - connect(ui.autoIdentifyService, SIGNAL(textEdited(const QString &)), this, SLOT(widgetHasChanged())); - connect(ui.autoIdentifyPassword, SIGNAL(textEdited(const QString &)), this, SLOT(widgetHasChanged())); - connect(ui.useCustomEncodings, SIGNAL(clicked(bool)), this, SLOT(widgetHasChanged())); + connect(ui.performEdit, &QTextEdit::textChanged, this, &NetworksSettingsPage::widgetHasChanged); + connect(ui.sasl, &QGroupBox::clicked, this, &NetworksSettingsPage::widgetHasChanged); + connect(ui.saslAccount, &QLineEdit::textEdited, this, &NetworksSettingsPage::widgetHasChanged); + connect(ui.saslPassword, &QLineEdit::textEdited, this, &NetworksSettingsPage::widgetHasChanged); + connect(ui.autoIdentify, &QGroupBox::clicked, this, &NetworksSettingsPage::widgetHasChanged); + connect(ui.autoIdentifyService, &QLineEdit::textEdited, this, &NetworksSettingsPage::widgetHasChanged); + connect(ui.autoIdentifyPassword, &QLineEdit::textEdited, this, &NetworksSettingsPage::widgetHasChanged); + connect(ui.useCustomEncodings, &QGroupBox::clicked, this, &NetworksSettingsPage::widgetHasChanged); connect(ui.sendEncoding, SIGNAL(currentIndexChanged(int)), this, SLOT(widgetHasChanged())); connect(ui.recvEncoding, SIGNAL(currentIndexChanged(int)), this, SLOT(widgetHasChanged())); connect(ui.serverEncoding, SIGNAL(currentIndexChanged(int)), this, SLOT(widgetHasChanged())); - connect(ui.autoReconnect, SIGNAL(clicked(bool)), this, SLOT(widgetHasChanged())); + connect(ui.autoReconnect, &QGroupBox::clicked, this, &NetworksSettingsPage::widgetHasChanged); connect(ui.reconnectInterval, SIGNAL(valueChanged(int)), this, SLOT(widgetHasChanged())); connect(ui.reconnectRetries, SIGNAL(valueChanged(int)), this, SLOT(widgetHasChanged())); - connect(ui.unlimitedRetries, SIGNAL(clicked(bool)), this, SLOT(widgetHasChanged())); - connect(ui.rejoinOnReconnect, SIGNAL(clicked(bool)), this, SLOT(widgetHasChanged())); + connect(ui.unlimitedRetries, &QAbstractButton::clicked, this, &NetworksSettingsPage::widgetHasChanged); + connect(ui.rejoinOnReconnect, &QAbstractButton::clicked, this, &NetworksSettingsPage::widgetHasChanged); // Core features can change during a reconnect. Always connect these here, delaying testing for // the core feature flag in load(). - connect(ui.useCustomMessageRate, SIGNAL(clicked(bool)), this, SLOT(widgetHasChanged())); + connect(ui.useCustomMessageRate, &QGroupBox::clicked, this, &NetworksSettingsPage::widgetHasChanged); connect(ui.messageRateBurstSize, SIGNAL(valueChanged(int)), this, SLOT(widgetHasChanged())); connect(ui.messageRateDelay, SIGNAL(valueChanged(double)), this, SLOT(widgetHasChanged())); - connect(ui.unlimitedMessageRate, SIGNAL(clicked(bool)), this, SLOT(widgetHasChanged())); + connect(ui.unlimitedMessageRate, &QAbstractButton::clicked, this, &NetworksSettingsPage::widgetHasChanged); // Add additional widgets here //connect(ui., SIGNAL(), this, SLOT(widgetHasChanged())); @@ -414,7 +414,7 @@ void NetworksSettingsPage::coreConnectionStateChanged(bool state) void NetworksSettingsPage::clientIdentityAdded(IdentityId id) { const Identity *identity = Client::identity(id); - connect(identity, SIGNAL(updatedRemotely()), this, SLOT(clientIdentityUpdated())); + connect(identity, &SyncableObject::updatedRemotely, this, &NetworksSettingsPage::clientIdentityUpdated); QString name = identity->identityName(); for (int j = 0; j < ui.identityList->count(); j++) { @@ -480,14 +480,14 @@ void NetworksSettingsPage::clientNetworkAdded(NetworkId id) { insertNetwork(id); //connect(Client::network(id), SIGNAL(updatedRemotely()), this, SLOT(clientNetworkUpdated())); - connect(Client::network(id), SIGNAL(configChanged()), this, SLOT(clientNetworkUpdated())); + connect(Client::network(id), &Network::configChanged, this, &NetworksSettingsPage::clientNetworkUpdated); - connect(Client::network(id), SIGNAL(connectionStateSet(Network::ConnectionState)), this, SLOT(networkConnectionStateChanged(Network::ConnectionState))); - connect(Client::network(id), SIGNAL(connectionError(const QString &)), this, SLOT(networkConnectionError(const QString &))); + connect(Client::network(id), &Network::connectionStateSet, this, &NetworksSettingsPage::networkConnectionStateChanged); + connect(Client::network(id), &Network::connectionError, this, &NetworksSettingsPage::networkConnectionError); // Handle capability changes in case a server dis/connects with the settings window open. - connect(Client::network(id), SIGNAL(capAdded(const QString &)), this, SLOT(clientNetworkCapsUpdated())); - connect(Client::network(id), SIGNAL(capRemoved(const QString &)), this, SLOT(clientNetworkCapsUpdated())); + connect(Client::network(id), &Network::capAdded, this, &NetworksSettingsPage::clientNetworkCapsUpdated); + connect(Client::network(id), &Network::capRemoved, this, &NetworksSettingsPage::clientNetworkCapsUpdated); } @@ -593,12 +593,12 @@ void NetworksSettingsPage::displayNetwork(NetworkId id) // this is only needed when the core supports SASL EXTERNAL if (Client::isCoreFeatureEnabled(Quassel::Feature::SaslExternal)) { if (_cid) { - disconnect(_cid, SIGNAL(sslSettingsUpdated()), this, SLOT(sslUpdated())); + disconnect(_cid, &CertIdentity::sslSettingsUpdated, this, &NetworksSettingsPage::sslUpdated); delete _cid; } _cid = new CertIdentity(*Client::identity(info.identity), this); _cid->enableEditSsl(true); - connect(_cid, SIGNAL(sslSettingsUpdated()), this, SLOT(sslUpdated())); + connect(_cid, &CertIdentity::sslSettingsUpdated, this, &NetworksSettingsPage::sslUpdated); } #endif @@ -651,7 +651,7 @@ void NetworksSettingsPage::displayNetwork(NetworkId id) // just clear widgets #ifdef HAVE_SSL if (_cid) { - disconnect(_cid, SIGNAL(sslSettingsUpdated()), this, SLOT(sslUpdated())); + disconnect(_cid, &CertIdentity::sslSettingsUpdated, this, &NetworksSettingsPage::sslUpdated); delete _cid; } #endif @@ -1033,14 +1033,14 @@ NetworkAddDlg::NetworkAddDlg(QStringList exist, QWidget *parent) : QDialog(paren ui.useSSL->setIcon(icon::get("document-encrypt")); // Whenever useSSL is toggled, update the port number if not changed from the default - connect(ui.useSSL, SIGNAL(toggled(bool)), SLOT(updateSslPort(bool))); + connect(ui.useSSL, &QAbstractButton::toggled, this, &NetworkAddDlg::updateSslPort); // Do NOT call updateSslPort when loading settings, otherwise port settings may be overriden. // If useSSL is later changed to be checked by default, change port's default value, too. if (Client::isCoreFeatureEnabled(Quassel::Feature::VerifyServerSSL)) { // Synchronize requiring SSL with the use SSL checkbox ui.sslVerify->setEnabled(ui.useSSL->isChecked()); - connect(ui.useSSL, SIGNAL(toggled(bool)), ui.sslVerify, SLOT(setEnabled(bool))); + connect(ui.useSSL, &QAbstractButton::toggled, ui.sslVerify, &QWidget::setEnabled); } else { // Core isn't new enough to allow requiring SSL; disable checkbox and uncheck ui.sslVerify->setEnabled(false); @@ -1066,10 +1066,10 @@ NetworkAddDlg::NetworkAddDlg(QStringList exist, QWidget *parent) : QDialog(paren ui.useManual->setChecked(true); ui.usePreset->setEnabled(false); } - connect(ui.networkName, SIGNAL(textChanged(const QString &)), SLOT(setButtonStates())); - connect(ui.serverAddress, SIGNAL(textChanged(const QString &)), SLOT(setButtonStates())); - connect(ui.usePreset, SIGNAL(toggled(bool)), SLOT(setButtonStates())); - connect(ui.useManual, SIGNAL(toggled(bool)), SLOT(setButtonStates())); + connect(ui.networkName, &QLineEdit::textChanged, this, &NetworkAddDlg::setButtonStates); + connect(ui.serverAddress, &QLineEdit::textChanged, this, &NetworkAddDlg::setButtonStates); + connect(ui.usePreset, &QRadioButton::toggled, this, &NetworkAddDlg::setButtonStates); + connect(ui.useManual, &QRadioButton::toggled, this, &NetworkAddDlg::setButtonStates); setButtonStates(); } @@ -1182,14 +1182,14 @@ ServerEditDlg::ServerEditDlg(const Network::Server &server, QWidget *parent) : Q } // Whenever useSSL is toggled, update the port number if not changed from the default - connect(ui.useSSL, SIGNAL(toggled(bool)), SLOT(updateSslPort(bool))); + connect(ui.useSSL, &QAbstractButton::toggled, this, &ServerEditDlg::updateSslPort); // Do NOT call updateSslPort when loading settings, otherwise port settings may be overriden. // If useSSL is later changed to be checked by default, change port's default value, too. if (Client::isCoreFeatureEnabled(Quassel::Feature::VerifyServerSSL)) { // Synchronize requiring SSL with the use SSL checkbox ui.sslVerify->setEnabled(ui.useSSL->isChecked()); - connect(ui.useSSL, SIGNAL(toggled(bool)), ui.sslVerify, SLOT(setEnabled(bool))); + connect(ui.useSSL, &QAbstractButton::toggled, ui.sslVerify, &QWidget::setEnabled); } else { // Core isn't new enough to allow requiring SSL; disable checkbox and uncheck ui.sslVerify->setEnabled(false); @@ -1257,8 +1257,8 @@ SaveNetworksDlg::SaveNetworksDlg(const QList &toCreate, const QList ui.progressBar->setMaximum(numevents); ui.progressBar->setValue(0); - connect(Client::instance(), SIGNAL(networkCreated(NetworkId)), this, SLOT(clientEvent())); - connect(Client::instance(), SIGNAL(networkRemoved(NetworkId)), this, SLOT(clientEvent())); + connect(Client::instance(), &Client::networkCreated, this, &SaveNetworksDlg::clientEvent); + connect(Client::instance(), &Client::networkRemoved, this, &SaveNetworksDlg::clientEvent); foreach(NetworkId id, toRemove) { Client::removeNetwork(id); @@ -1274,7 +1274,7 @@ SaveNetworksDlg::SaveNetworksDlg(const QList &toCreate, const QList continue; } // FIXME this only checks for one changed item rather than all! - connect(net, SIGNAL(updatedRemotely()), this, SLOT(clientEvent())); + connect(net, &SyncableObject::updatedRemotely, this, &SaveNetworksDlg::clientEvent); Client::updateNetwork(info); } } diff --git a/src/qtui/settingspages/shortcutssettingspage.cpp b/src/qtui/settingspages/shortcutssettingspage.cpp index cbb4e45a..4da905f8 100644 --- a/src/qtui/settingspages/shortcutssettingspage.cpp +++ b/src/qtui/settingspages/shortcutssettingspage.cpp @@ -75,14 +75,14 @@ ShortcutsSettingsPage::ShortcutsSettingsPage(const QHashsortByColumn(0, Qt::AscendingOrder); ui.keySequenceWidget->setModel(_shortcutsModel); - connect(ui.keySequenceWidget, SIGNAL(keySequenceChanged(QKeySequence, QModelIndex)), SLOT(keySequenceChanged(QKeySequence, QModelIndex))); + connect(ui.keySequenceWidget, &KeySequenceWidget::keySequenceChanged, this, &ShortcutsSettingsPage::keySequenceChanged); - connect(ui.shortcutsView->selectionModel(), SIGNAL(currentChanged(QModelIndex, QModelIndex)), SLOT(setWidgetStates())); + connect(ui.shortcutsView->selectionModel(), &QItemSelectionModel::currentChanged, this, &ShortcutsSettingsPage::setWidgetStates); setWidgetStates(); - connect(ui.useDefault, SIGNAL(clicked(bool)), SLOT(toggledCustomOrDefault())); - connect(ui.useCustom, SIGNAL(clicked(bool)), SLOT(toggledCustomOrDefault())); + connect(ui.useDefault, &QAbstractButton::clicked, this, &ShortcutsSettingsPage::toggledCustomOrDefault); + connect(ui.useCustom, &QAbstractButton::clicked, this, &ShortcutsSettingsPage::toggledCustomOrDefault); connect(_shortcutsModel, SIGNAL(hasChanged(bool)), SLOT(setChangedState(bool))); diff --git a/src/qtui/settingspages/sonnetsettingspage.cpp b/src/qtui/settingspages/sonnetsettingspage.cpp index cf893fab..29499dbd 100644 --- a/src/qtui/settingspages/sonnetsettingspage.cpp +++ b/src/qtui/settingspages/sonnetsettingspage.cpp @@ -30,7 +30,7 @@ SonnetSettingsPage::SonnetSettingsPage(QWidget *parent) auto *layout = new QVBoxLayout(this); _configWidget = new Sonnet::ConfigWidget(this); layout->addWidget(_configWidget); - connect(_configWidget, SIGNAL(configChanged()), SLOT(widgetHasChanged())); + connect(_configWidget, &Sonnet::ConfigWidget::configChanged, this, &SonnetSettingsPage::widgetHasChanged); } diff --git a/src/qtui/simplenetworkeditor.cpp b/src/qtui/simplenetworkeditor.cpp index 00aef3d4..a8b438ed 100644 --- a/src/qtui/simplenetworkeditor.cpp +++ b/src/qtui/simplenetworkeditor.cpp @@ -34,8 +34,8 @@ SimpleNetworkEditor::SimpleNetworkEditor(QWidget *parent) ui.upServer->setIcon(icon::get("go-up")); ui.downServer->setIcon(icon::get("go-down")); - connect(ui.networkNameEdit, SIGNAL(textEdited(const QString &)), this, SIGNAL(widgetHasChanged())); - connect(ui.channelList, SIGNAL(textChanged()), this, SIGNAL(widgetHasChanged())); + connect(ui.networkNameEdit, &QLineEdit::textEdited, this, &SimpleNetworkEditor::widgetHasChanged); + connect(ui.channelList, &QTextEdit::textChanged, this, &SimpleNetworkEditor::widgetHasChanged); } diff --git a/src/qtui/statusnotifieritem.cpp b/src/qtui/statusnotifieritem.cpp index 63af7c6b..3f0a3b29 100644 --- a/src/qtui/statusnotifieritem.cpp +++ b/src/qtui/statusnotifieritem.cpp @@ -86,7 +86,7 @@ StatusNotifierItem::StatusNotifierItem(QWidget *parent) connect(this, SIGNAL(visibilityChanged(bool)), this, SLOT(onVisibilityChanged(bool))); connect(this, SIGNAL(modeChanged(Mode)), this, SLOT(onModeChanged(Mode))); - connect(this, SIGNAL(stateChanged(State)), this, SLOT(onStateChanged(State))); + connect(this, &SystemTray::stateChanged, this, &StatusNotifierItem::onStateChanged); trayMenu()->installEventFilter(this); @@ -98,37 +98,37 @@ StatusNotifierItem::StatusNotifierItem(QWidget *parent) qWarning() << "Could not create temporary directory for themed tray icons!"; } - connect(this, SIGNAL(iconsChanged()), this, SLOT(refreshIcons())); + connect(this, &SystemTray::iconsChanged, this, &StatusNotifierItem::refreshIcons); refreshIcons(); // Our own SNI service _statusNotifierItemDBus = new StatusNotifierItemDBus(this); - connect(this, SIGNAL(currentIconNameChanged()), _statusNotifierItemDBus, SIGNAL(NewIcon())); - connect(this, SIGNAL(currentIconNameChanged()), _statusNotifierItemDBus, SIGNAL(NewAttentionIcon())); - connect(this, SIGNAL(toolTipChanged(QString, QString)), _statusNotifierItemDBus, SIGNAL(NewToolTip())); + connect(this, &SystemTray::currentIconNameChanged, _statusNotifierItemDBus, &StatusNotifierItemDBus::NewIcon); + connect(this, &SystemTray::currentIconNameChanged, _statusNotifierItemDBus, &StatusNotifierItemDBus::NewAttentionIcon); + connect(this, &SystemTray::toolTipChanged, _statusNotifierItemDBus, &StatusNotifierItemDBus::NewToolTip); // Service watcher to keep track of the StatusNotifierWatcher service _serviceWatcher = new QDBusServiceWatcher(kSniWatcherService, QDBusConnection::sessionBus(), QDBusServiceWatcher::WatchForOwnerChange, this); - connect(_serviceWatcher, SIGNAL(serviceOwnerChanged(QString, QString, QString)), SLOT(serviceChange(QString, QString, QString))); + connect(_serviceWatcher, &QDBusServiceWatcher::serviceOwnerChanged, this, &StatusNotifierItem::serviceChange); // Client instance for StatusNotifierWatcher _statusNotifierWatcher = new org::kde::StatusNotifierWatcher(kSniWatcherService, kSniWatcherPath, QDBusConnection::sessionBus(), this); - connect(_statusNotifierWatcher, SIGNAL(StatusNotifierHostRegistered()), SLOT(checkForRegisteredHosts())); - connect(_statusNotifierWatcher, SIGNAL(StatusNotifierHostUnregistered()), SLOT(checkForRegisteredHosts())); + connect(_statusNotifierWatcher, &OrgKdeStatusNotifierWatcherInterface::StatusNotifierHostRegistered, this, &StatusNotifierItem::checkForRegisteredHosts); + connect(_statusNotifierWatcher, &OrgKdeStatusNotifierWatcherInterface::StatusNotifierHostUnregistered, this, &StatusNotifierItem::checkForRegisteredHosts); // Client instance for notifications _notificationsClient = new org::freedesktop::Notifications(kXdgNotificationsService, kXdgNotificationsPath, QDBusConnection::sessionBus(), this); - connect(_notificationsClient, SIGNAL(NotificationClosed(uint, uint)), SLOT(notificationClosed(uint, uint))); - connect(_notificationsClient, SIGNAL(ActionInvoked(uint, QString)), SLOT(notificationInvoked(uint, QString))); + connect(_notificationsClient, &OrgFreedesktopNotificationsInterface::NotificationClosed, this, &StatusNotifierItem::notificationClosed); + connect(_notificationsClient, &OrgFreedesktopNotificationsInterface::ActionInvoked, this, &StatusNotifierItem::notificationInvoked); if (_notificationsClient->isValid()) { QStringList desktopCapabilities = _notificationsClient->GetCapabilities(); diff --git a/src/qtui/systemtray.cpp b/src/qtui/systemtray.cpp index d4e17661..250895aa 100644 --- a/src/qtui/systemtray.cpp +++ b/src/qtui/systemtray.cpp @@ -52,13 +52,13 @@ SystemTray::SystemTray(QWidget *parent) _trayMenu->addSeparator(); _trayMenu->addAction(_minimizeRestoreAction); _trayMenu->addAction(coll->action("Quit")); - connect(_trayMenu, SIGNAL(aboutToShow()), SLOT(trayMenuAboutToShow())); + connect(_trayMenu, &QMenu::aboutToShow, this, &SystemTray::trayMenuAboutToShow); - connect(QtUi::instance(), SIGNAL(iconThemeRefreshed()), this, SIGNAL(iconsChanged())); + connect(QtUi::instance(), &QtUi::iconThemeRefreshed, this, &SystemTray::iconsChanged); _blinkTimer.setInterval(1000); _blinkTimer.setSingleShot(false); - connect(&_blinkTimer, SIGNAL(timeout()), SLOT(onBlinkTimeout())); + connect(&_blinkTimer, &QTimer::timeout, this, &SystemTray::onBlinkTimeout); } diff --git a/src/qtui/systraynotificationbackend.cpp b/src/qtui/systraynotificationbackend.cpp index 138364cb..eaec2f74 100644 --- a/src/qtui/systraynotificationbackend.cpp +++ b/src/qtui/systraynotificationbackend.cpp @@ -144,7 +144,7 @@ SystrayNotificationBackend::ConfigWidget::ConfigWidget(QWidget *parent) : Settin { _showBubbleBox = new QCheckBox(tr("Show a message in a popup")); _showBubbleBox->setIcon(icon::get("dialog-information")); - connect(_showBubbleBox, SIGNAL(toggled(bool)), this, SLOT(widgetChanged())); + connect(_showBubbleBox, &QAbstractButton::toggled, this, &ConfigWidget::widgetChanged); auto *layout = new QHBoxLayout(this); layout->addWidget(_showBubbleBox); } diff --git a/src/qtui/taskbarnotificationbackend.cpp b/src/qtui/taskbarnotificationbackend.cpp index 47109bcf..8b8b6c87 100644 --- a/src/qtui/taskbarnotificationbackend.cpp +++ b/src/qtui/taskbarnotificationbackend.cpp @@ -95,8 +95,8 @@ TaskbarNotificationBackend::ConfigWidget::ConfigWidget(QWidget *parent) : Settin layout->addWidget(timeoutBox); layout->addStretch(20); - connect(enabledBox, SIGNAL(toggled(bool)), SLOT(widgetChanged())); - connect(enabledBox, SIGNAL(toggled(bool)), timeoutBox, SLOT(setEnabled(bool))); + connect(enabledBox, &QAbstractButton::toggled, this, &ConfigWidget::widgetChanged); + connect(enabledBox, &QAbstractButton::toggled, timeoutBox, &QWidget::setEnabled); connect(timeoutBox, SIGNAL(valueChanged(int)), SLOT(widgetChanged())); } diff --git a/src/qtui/topicwidget.cpp b/src/qtui/topicwidget.cpp index 1dcc0ee1..e18625cd 100644 --- a/src/qtui/topicwidget.cpp +++ b/src/qtui/topicwidget.cpp @@ -35,8 +35,8 @@ TopicWidget::TopicWidget(QWidget *parent) ui.topicLineEdit->setLineWrapEnabled(true); ui.topicLineEdit->installEventFilter(this); - connect(ui.topicLabel, SIGNAL(clickableActivated(Clickable)), SLOT(clickableActivated(Clickable))); - connect(ui.topicLineEdit, SIGNAL(noTextEntered()), SLOT(on_topicLineEdit_textEntered())); + connect(ui.topicLabel, &StyledLabel::clickableActivated, this, &TopicWidget::clickableActivated); + connect(ui.topicLineEdit, &MultiLineEdit::noTextEntered, this, &TopicWidget::on_topicLineEdit_textEntered); UiSettings s("TopicWidget"); s.notify("DynamicResize", this, SLOT(updateResizeMode())); diff --git a/src/uisupport/abstractitemview.cpp b/src/uisupport/abstractitemview.cpp index c1076f8c..0fe22547 100644 --- a/src/uisupport/abstractitemview.cpp +++ b/src/uisupport/abstractitemview.cpp @@ -34,12 +34,12 @@ void AbstractItemView::setModel(QAbstractItemModel *model) disconnect(_model, nullptr, this, nullptr); } _model = model; - connect(model, SIGNAL(dataChanged(QModelIndex, QModelIndex)), - this, SLOT(dataChanged(QModelIndex, QModelIndex))); - connect(model, SIGNAL(rowsAboutToBeRemoved(QModelIndex, int, int)), - this, SLOT(rowsAboutToBeRemoved(QModelIndex, int, int))); - connect(model, SIGNAL(rowsInserted(QModelIndex, int, int)), - this, SLOT(rowsInserted(QModelIndex, int, int))); + connect(model, &QAbstractItemModel::dataChanged, + this, &AbstractItemView::dataChanged); + connect(model, &QAbstractItemModel::rowsAboutToBeRemoved, + this, &AbstractItemView::rowsAboutToBeRemoved); + connect(model, &QAbstractItemModel::rowsInserted, + this, &AbstractItemView::rowsInserted); } @@ -49,8 +49,8 @@ void AbstractItemView::setSelectionModel(QItemSelectionModel *selectionModel) disconnect(_selectionModel, nullptr, this, nullptr); } _selectionModel = selectionModel; - connect(selectionModel, SIGNAL(currentChanged(QModelIndex, QModelIndex)), - this, SLOT(currentChanged(QModelIndex, QModelIndex))); - connect(selectionModel, SIGNAL(selectionChanged(QItemSelection, QItemSelection)), - this, SLOT(selectionChanged(QItemSelection, QItemSelection))); + connect(selectionModel, &QItemSelectionModel::currentChanged, + this, &AbstractItemView::currentChanged); + connect(selectionModel, &QItemSelectionModel::selectionChanged, + this, &AbstractItemView::selectionChanged); } diff --git a/src/uisupport/actioncollection.cpp b/src/uisupport/actioncollection.cpp index 50001262..0ba65ba4 100644 --- a/src/uisupport/actioncollection.cpp +++ b/src/uisupport/actioncollection.cpp @@ -112,11 +112,11 @@ QAction *ActionCollection::addAction(const QString &name, QAction *action) widget->addAction(action); } - connect(action, SIGNAL(destroyed(QObject *)), SLOT(actionDestroyed(QObject *))); + connect(action, &QObject::destroyed, this, &ActionCollection::actionDestroyed); if (_connectHovered) - connect(action, SIGNAL(hovered()), SLOT(slotActionHovered())); + connect(action, &QAction::hovered, this, &ActionCollection::slotActionHovered); if (_connectTriggered) - connect(action, SIGNAL(triggered(bool)), SLOT(slotActionTriggered())); + connect(action, &QAction::triggered, this, &ActionCollection::slotActionTriggered); emit inserted(action); return action; @@ -207,14 +207,14 @@ void ActionCollection::connectNotify(const QMetaMethod &signal) if (!_connectHovered) { _connectHovered = true; foreach(QAction* action, actions()) - connect(action, SIGNAL(hovered()), SLOT(slotActionHovered())); + connect(action, &QAction::hovered, this, &ActionCollection::slotActionHovered); } } else if (QMetaMethod::fromSignal(&ActionCollection::actionTriggered) == signal) { if (!_connectTriggered) { _connectTriggered = true; foreach(QAction* action, actions()) - connect(action, SIGNAL(triggered(bool)), SLOT(slotActionTriggered())); + connect(action, &QAction::triggered, this, &ActionCollection::slotActionTriggered); } } @@ -236,7 +236,7 @@ void ActionCollection::addAssociatedWidget(QWidget *widget) if (!_associatedWidgets.contains(widget)) { widget->addActions(actions()); _associatedWidgets.append(widget); - connect(widget, SIGNAL(destroyed(QObject *)), SLOT(associatedWidgetDestroyed(QObject *))); + connect(widget, &QObject::destroyed, this, &ActionCollection::associatedWidgetDestroyed); } } @@ -246,7 +246,7 @@ void ActionCollection::removeAssociatedWidget(QWidget *widget) foreach(QAction *action, actions()) widget->removeAction(action); _associatedWidgets.removeAll(widget); - disconnect(widget, SIGNAL(destroyed(QObject *)), this, SLOT(associatedWidgetDestroyed(QObject *))); + disconnect(widget, &QObject::destroyed, this, &ActionCollection::associatedWidgetDestroyed); } diff --git a/src/uisupport/bufferview.cpp b/src/uisupport/bufferview.cpp index 620c2627..6a7badda 100644 --- a/src/uisupport/bufferview.cpp +++ b/src/uisupport/bufferview.cpp @@ -50,8 +50,8 @@ BufferView::BufferView(QWidget *parent) : TreeViewTouch(parent) { - connect(this, SIGNAL(collapsed(const QModelIndex &)), SLOT(storeExpandedState(const QModelIndex &))); - connect(this, SIGNAL(expanded(const QModelIndex &)), SLOT(storeExpandedState(const QModelIndex &))); + connect(this, &QTreeView::collapsed, this, &BufferView::storeExpandedState); + connect(this, &QTreeView::expanded, this, &BufferView::storeExpandedState); setSelectionMode(QAbstractItemView::ExtendedSelection); @@ -94,8 +94,8 @@ void BufferView::init() disconnect(this, SIGNAL(activated(QModelIndex)), this, SLOT(joinChannel(QModelIndex))); connect(this, SIGNAL(activated(QModelIndex)), SLOT(joinChannel(QModelIndex))); #else - disconnect(this, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(joinChannel(QModelIndex))); - connect(this, SIGNAL(doubleClicked(QModelIndex)), SLOT(joinChannel(QModelIndex))); + disconnect(this, &QAbstractItemView::doubleClicked, this, &BufferView::joinChannel); + connect(this, &QAbstractItemView::doubleClicked, this, &BufferView::joinChannel); #endif } @@ -124,11 +124,11 @@ void BufferView::setModel(QAbstractItemModel *model) showSection->setCheckable(true); showSection->setChecked(!isColumnHidden(i)); showSection->setProperty("column", i); - connect(showSection, SIGNAL(toggled(bool)), this, SLOT(toggleHeader(bool))); + connect(showSection, &QAction::toggled, this, &BufferView::toggleHeader); header()->addAction(showSection); } - connect(model, SIGNAL(layoutChanged()), this, SLOT(on_layoutChanged())); + connect(model, &QAbstractItemModel::layoutChanged, this, &BufferView::on_layoutChanged); // Make sure collapsation is correct after setting a model // This might not be needed here, only in BufferView::setFilteredModel(). If issues arise, just @@ -157,7 +157,7 @@ void BufferView::setFilteredModel(QAbstractItemModel *model_, BufferViewConfig * else { auto *filter = new BufferViewFilter(model_, config); setModel(filter); - connect(filter, SIGNAL(configChanged()), this, SLOT(on_configChanged())); + connect(filter, &BufferViewFilter::configChanged, this, &BufferView::on_configChanged); } setConfig(config); } @@ -174,7 +174,7 @@ void BufferView::setConfig(BufferViewConfig *config) _config = config; if (config) { - connect(config, SIGNAL(networkIdSet(const NetworkId &)), this, SLOT(setRootIndexForNetworkId(const NetworkId &))); + connect(config, &BufferViewConfig::networkIdSet, this, &BufferView::setRootIndexForNetworkId); setRootIndexForNetworkId(config->networkId()); } else { @@ -743,8 +743,8 @@ BufferViewDock::BufferViewDock(BufferViewConfig *config, QWidget *parent) setObjectName("BufferViewDock-" + QString::number(config->bufferViewId())); toggleViewAction()->setData(config->bufferViewId()); setAllowedAreas(Qt::RightDockWidgetArea|Qt::LeftDockWidgetArea); - connect(config, SIGNAL(bufferViewNameSet(const QString &)), this, SLOT(bufferViewRenamed(const QString &))); - connect(config, SIGNAL(configChanged()), SLOT(configChanged())); + connect(config, &BufferViewConfig::bufferViewNameSet, this, &BufferViewDock::bufferViewRenamed); + connect(config, &BufferViewConfig::configChanged, this, &BufferViewDock::configChanged); updateTitle(); _widget->setLayout(new QVBoxLayout); @@ -756,7 +756,7 @@ BufferViewDock::BufferViewDock(BufferViewConfig *config, QWidget *parent) _filterEdit->setFocusPolicy(Qt::ClickFocus); _filterEdit->installEventFilter(this); _filterEdit->setPlaceholderText(tr("Search...")); - connect(_filterEdit, SIGNAL(returnPressed()), SLOT(onFilterReturnPressed())); + connect(_filterEdit, &QLineEdit::returnPressed, this, &BufferViewDock::onFilterReturnPressed); _widget->layout()->addWidget(_filterEdit); QDockWidget::setWidget(_widget); @@ -904,7 +904,7 @@ void BufferViewDock::setWidget(QWidget *newWidget) _widget->layout()->addWidget(newWidget); _childWidget = newWidget; - connect(_filterEdit, SIGNAL(textChanged(QString)), bufferView(), SLOT(filterTextChanged(QString))); + connect(_filterEdit, &QLineEdit::textChanged, bufferView(), &BufferView::filterTextChanged); } void BufferViewDock::activateFilter() diff --git a/src/uisupport/bufferviewfilter.cpp b/src/uisupport/bufferviewfilter.cpp index b8b78e2c..cc746f2c 100644 --- a/src/uisupport/bufferviewfilter.cpp +++ b/src/uisupport/bufferviewfilter.cpp @@ -54,7 +54,7 @@ BufferViewFilter::BufferViewFilter(QAbstractItemModel *model, BufferViewConfig * _enableEditMode.setCheckable(true); _enableEditMode.setChecked(_editMode); - connect(&_enableEditMode, SIGNAL(toggled(bool)), this, SLOT(enableEditMode(bool))); + connect(&_enableEditMode, &QAction::toggled, this, &BufferViewFilter::enableEditMode); BufferSettings defaultSettings; defaultSettings.notify("ServerNoticesTarget", this, SLOT(showServerQueriesChanged())); @@ -85,7 +85,7 @@ void BufferViewFilter::setConfig(BufferViewConfig *config) else { // we use a queued connection here since manipulating the connection list of a sending object // doesn't seem to be such a good idea while executing a connected slots. - connect(config, SIGNAL(initDone()), this, SLOT(configInitialized()), Qt::QueuedConnection); + connect(config, &SyncableObject::initDone, this, &BufferViewFilter::configInitialized, Qt::QueuedConnection); invalidate(); } } @@ -97,7 +97,7 @@ void BufferViewFilter::configInitialized() return; // connect(config(), SIGNAL(bufferViewNameSet(const QString &)), this, SLOT(invalidate())); - connect(config(), SIGNAL(configChanged()), this, SLOT(invalidate())); + connect(config(), &BufferViewConfig::configChanged, this, &QSortFilterProxyModel::invalidate); // connect(config(), SIGNAL(networkIdSet(const NetworkId &)), this, SLOT(invalidate())); // connect(config(), SIGNAL(addNewBuffersAutomaticallySet(bool)), this, SLOT(invalidate())); // connect(config(), SIGNAL(sortAlphabeticallySet(bool)), this, SLOT(invalidate())); @@ -110,7 +110,7 @@ void BufferViewFilter::configInitialized() // connect(config(), SIGNAL(bufferRemoved(const BufferId &)), this, SLOT(invalidate())); // connect(config(), SIGNAL(bufferPermanentlyRemoved(const BufferId &)), this, SLOT(invalidate())); - disconnect(config(), SIGNAL(initDone()), this, SLOT(configInitialized())); + disconnect(config(), &SyncableObject::initDone, this, &BufferViewFilter::configInitialized); setObjectName(config()->bufferViewName()); diff --git a/src/uisupport/bufferviewoverlayfilter.cpp b/src/uisupport/bufferviewoverlayfilter.cpp index e01a0be0..df0d3a55 100644 --- a/src/uisupport/bufferviewoverlayfilter.cpp +++ b/src/uisupport/bufferviewoverlayfilter.cpp @@ -51,8 +51,8 @@ void BufferViewOverlayFilter::setOverlay(BufferViewOverlay *overlay) return; } - connect(overlay, SIGNAL(destroyed()), this, SLOT(overlayDestroyed())); - connect(overlay, SIGNAL(hasChanged()), this, SLOT(invalidate())); + connect(overlay, &QObject::destroyed, this, &BufferViewOverlayFilter::overlayDestroyed); + connect(overlay, &BufferViewOverlay::hasChanged, this, &QSortFilterProxyModel::invalidate); invalidate(); } diff --git a/src/uisupport/clearablelineedit.cpp b/src/uisupport/clearablelineedit.cpp index 1c8e0c77..e0a82c90 100644 --- a/src/uisupport/clearablelineedit.cpp +++ b/src/uisupport/clearablelineedit.cpp @@ -34,8 +34,8 @@ ClearableLineEdit::ClearableLineEdit(QWidget *parent) clearButton->setStyleSheet("QToolButton { border: none; padding: 0px; }"); clearButton->hide(); - connect(clearButton, SIGNAL(clicked()), this, SLOT(clear())); - connect(this, SIGNAL(textChanged(const QString &)), this, SLOT(updateClearButton(const QString &))); + connect(clearButton, &QAbstractButton::clicked, this, &QLineEdit::clear); + connect(this, &QLineEdit::textChanged, this, &ClearableLineEdit::updateClearButton); int frameWidth = style()->pixelMetric(QStyle::PM_DefaultFrameWidth); setStyleSheet(QString("QLineEdit { padding-right: %1px; } ").arg(clearButton->sizeHint().width() + frameWidth + 1)); diff --git a/src/uisupport/colorbutton.cpp b/src/uisupport/colorbutton.cpp index 22e03836..ac20f379 100644 --- a/src/uisupport/colorbutton.cpp +++ b/src/uisupport/colorbutton.cpp @@ -29,7 +29,7 @@ ColorButton::ColorButton(QWidget *parent) : QToolButton(parent) { setText(""); - connect(this, SIGNAL(clicked()), SLOT(chooseColor())); + connect(this, &QAbstractButton::clicked, this, &ColorButton::chooseColor); } diff --git a/src/uisupport/flatproxymodel.cpp b/src/uisupport/flatproxymodel.cpp index d722c18f..844f6e1b 100644 --- a/src/uisupport/flatproxymodel.cpp +++ b/src/uisupport/flatproxymodel.cpp @@ -226,36 +226,36 @@ void FlatProxyModel::setSourceModel(QAbstractItemModel *sourceModel) emit layoutChanged(); if (sourceModel) { - connect(sourceModel, SIGNAL(columnsAboutToBeInserted(const QModelIndex &, int, int)), - this, SLOT(on_columnsAboutToBeInserted(const QModelIndex &, int, int))); - connect(sourceModel, SIGNAL(columnsAboutToBeRemoved(const QModelIndex &, int, int)), - this, SLOT(on_columnsAboutToBeRemoved(const QModelIndex &, int, int))); - connect(sourceModel, SIGNAL(columnsInserted(const QModelIndex &, int, int)), - this, SLOT(on_columnsInserted(const QModelIndex &, int, int))); - connect(sourceModel, SIGNAL(columnsRemoved(const QModelIndex &, int, int)), - this, SLOT(on_columnsRemoved(const QModelIndex &, int, int))); - - connect(sourceModel, SIGNAL(dataChanged(const QModelIndex &, const QModelIndex &)), - this, SLOT(on_dataChanged(const QModelIndex &, const QModelIndex &))); + connect(sourceModel, &QAbstractItemModel::columnsAboutToBeInserted, + this, &FlatProxyModel::on_columnsAboutToBeInserted); + connect(sourceModel, &QAbstractItemModel::columnsAboutToBeRemoved, + this, &FlatProxyModel::on_columnsAboutToBeRemoved); + connect(sourceModel, &QAbstractItemModel::columnsInserted, + this, &FlatProxyModel::on_columnsInserted); + connect(sourceModel, &QAbstractItemModel::columnsRemoved, + this, &FlatProxyModel::on_columnsRemoved); + + connect(sourceModel, &QAbstractItemModel::dataChanged, + this, &FlatProxyModel::on_dataChanged); // on_headerDataChanged(Qt::Orientation orientation, int first, int last) - connect(sourceModel, SIGNAL(layoutAboutToBeChanged()), - this, SLOT(on_layoutAboutToBeChanged())); - connect(sourceModel, SIGNAL(layoutChanged()), - this, SLOT(on_layoutChanged())); + connect(sourceModel, &QAbstractItemModel::layoutAboutToBeChanged, + this, &FlatProxyModel::on_layoutAboutToBeChanged); + connect(sourceModel, &QAbstractItemModel::layoutChanged, + this, &FlatProxyModel::on_layoutChanged); - connect(sourceModel, SIGNAL(modelAboutToBeReset()), - this, SLOT(on_modelAboutToBeReset())); + connect(sourceModel, &QAbstractItemModel::modelAboutToBeReset, + this, &FlatProxyModel::on_modelAboutToBeReset); // void on_modelReset() - connect(sourceModel, SIGNAL(rowsAboutToBeInserted(const QModelIndex &, int, int)), - this, SLOT(on_rowsAboutToBeInserted(const QModelIndex &, int, int))); - connect(sourceModel, SIGNAL(rowsAboutToBeRemoved(const QModelIndex &, int, int)), - this, SLOT(on_rowsAboutToBeRemoved(const QModelIndex &, int, int))); - connect(sourceModel, SIGNAL(rowsInserted(const QModelIndex &, int, int)), - this, SLOT(on_rowsInserted(const QModelIndex &, int, int))); - connect(sourceModel, SIGNAL(rowsRemoved(const QModelIndex &, int, int)), - this, SLOT(on_rowsRemoved(const QModelIndex &, int, int))); + connect(sourceModel, &QAbstractItemModel::rowsAboutToBeInserted, + this, &FlatProxyModel::on_rowsAboutToBeInserted); + connect(sourceModel, &QAbstractItemModel::rowsAboutToBeRemoved, + this, &FlatProxyModel::on_rowsAboutToBeRemoved); + connect(sourceModel, &QAbstractItemModel::rowsInserted, + this, &FlatProxyModel::on_rowsInserted); + connect(sourceModel, &QAbstractItemModel::rowsRemoved, + this, &FlatProxyModel::on_rowsRemoved); } } diff --git a/src/uisupport/fontselector.cpp b/src/uisupport/fontselector.cpp index d4a341c3..bfa8b04b 100644 --- a/src/uisupport/fontselector.cpp +++ b/src/uisupport/fontselector.cpp @@ -30,7 +30,7 @@ FontSelector::FontSelector(QWidget *parent) : QWidget(parent) { auto *layout = new QHBoxLayout(this); QPushButton *chooseButton = new QPushButton(tr("Choose..."), this); - connect(chooseButton, SIGNAL(clicked()), SLOT(chooseFont())); + connect(chooseButton, &QAbstractButton::clicked, this, &FontSelector::chooseFont); layout->addWidget(_demo = new QLabel("Font")); layout->addWidget(chooseButton); diff --git a/src/uisupport/multilineedit.cpp b/src/uisupport/multilineedit.cpp index ac922351..19c222fe 100644 --- a/src/uisupport/multilineedit.cpp +++ b/src/uisupport/multilineedit.cpp @@ -52,7 +52,7 @@ MultiLineEdit::MultiLineEdit(QWidget *parent) // Prevent QTextHtmlImporter::appendNodeText from eating whitespace document()->setDefaultStyleSheet("span { white-space: pre-wrap; }"); - connect(this, SIGNAL(textChanged()), this, SLOT(on_textChanged())); + connect(this, &QTextEdit::textChanged, this, &MultiLineEdit::on_textChanged); _mircColorMap["00"] = "#ffffff"; _mircColorMap["01"] = "#000000"; @@ -96,7 +96,7 @@ void MultiLineEdit::contextMenuEvent(QContextMenuEvent *event) auto action = menu->addAction(tr("Auto Spell Check")); action->setCheckable(true); action->setChecked(highlighter()->isActive()); - connect(action, SIGNAL(toggled(bool)), this, SLOT(setSpellCheckEnabled(bool))); + connect(action, &QAction::toggled, this, &MultiLineEdit::setSpellCheckEnabled); menu->exec(event->globalPos()); delete menu; diff --git a/src/uisupport/networkmodelcontroller.cpp b/src/uisupport/networkmodelcontroller.cpp index 0112ed18..0f948f24 100644 --- a/src/uisupport/networkmodelcontroller.cpp +++ b/src/uisupport/networkmodelcontroller.cpp @@ -43,7 +43,7 @@ NetworkModelController::NetworkModelController(QObject *parent) : QObject(parent), _actionCollection(new ActionCollection(this)) { - connect(_actionCollection, SIGNAL(actionTriggered(QAction *)), SLOT(actionTriggered(QAction *))); + connect(_actionCollection, &ActionCollection::actionTriggered, this, &NetworkModelController::actionTriggered); } @@ -563,9 +563,9 @@ NetworkModelController::JoinDlg::JoinDlg(const QModelIndex &index, QWidget *pare networks->setInsertPolicy(QComboBox::InsertAlphabetically); password->setEchoMode(QLineEdit::Password); - connect(buttonBox, SIGNAL(accepted()), SLOT(accept())); - connect(buttonBox, SIGNAL(rejected()), SLOT(reject())); - connect(channel, SIGNAL(textChanged(QString)), SLOT(on_channel_textChanged(QString))); + connect(buttonBox, &QDialogButtonBox::accepted, this, &QDialog::accept); + connect(buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject); + connect(channel, &QLineEdit::textChanged, this, &JoinDlg::on_channel_textChanged); foreach(NetworkId id, Client::networkIds()) { const Network *net = Client::network(id); diff --git a/src/uisupport/nickview.cpp b/src/uisupport/nickview.cpp index 5adaf730..c0c489a0 100644 --- a/src/uisupport/nickview.cpp +++ b/src/uisupport/nickview.cpp @@ -49,13 +49,13 @@ NickView::NickView(QWidget *parent) setAnimated(true); - connect(this, SIGNAL(customContextMenuRequested(const QPoint &)), SLOT(showContextMenu(const QPoint &))); + connect(this, &QWidget::customContextMenuRequested, this, &NickView::showContextMenu); #if defined Q_OS_MACOS || defined Q_OS_WIN // afaik this is better on Mac and Windows connect(this, SIGNAL(activated(QModelIndex)), SLOT(startQuery(QModelIndex))); #else - connect(this, SIGNAL(doubleClicked(QModelIndex)), SLOT(startQuery(QModelIndex))); + connect(this, &QAbstractItemView::doubleClicked, this, &NickView::startQuery); #endif } @@ -68,8 +68,8 @@ void NickView::init() for (int i = 1; i < model()->columnCount(); i++) setColumnHidden(i, true); - connect(selectionModel(), SIGNAL(currentChanged(QModelIndex, QModelIndex)), SIGNAL(selectionUpdated())); - connect(selectionModel(), SIGNAL(selectionChanged(QItemSelection, QItemSelection)), SIGNAL(selectionUpdated())); + connect(selectionModel(), &QItemSelectionModel::currentChanged, this, &NickView::selectionUpdated); + connect(selectionModel(), &QItemSelectionModel::selectionChanged, this, &NickView::selectionUpdated); } diff --git a/src/uisupport/resizingstackedwidget.cpp b/src/uisupport/resizingstackedwidget.cpp index 2f007951..53bd4733 100644 --- a/src/uisupport/resizingstackedwidget.cpp +++ b/src/uisupport/resizingstackedwidget.cpp @@ -22,7 +22,7 @@ ResizingStackedWidget::ResizingStackedWidget(QWidget *parent) : QStackedWidget(parent) { - connect(this, SIGNAL(currentChanged(int)), SLOT(indexChanged(int))); + connect(this, &QStackedWidget::currentChanged, this, &ResizingStackedWidget::indexChanged); } diff --git a/src/uisupport/toolbaractionprovider.cpp b/src/uisupport/toolbaractionprovider.cpp index 178ccc4e..e009a333 100644 --- a/src/uisupport/toolbaractionprovider.cpp +++ b/src/uisupport/toolbaractionprovider.cpp @@ -61,8 +61,8 @@ ToolBarActionProvider::ToolBarActionProvider(QObject *parent) action(NetworkDisconnectAllWithDropdown)->setMenu(_networksDisconnectMenu); action(NetworkDisconnectAllWithDropdown)->setEnabled(false); - connect(Client::instance(), SIGNAL(networkCreated(NetworkId)), SLOT(networkCreated(NetworkId))); - connect(Client::instance(), SIGNAL(networkRemoved(NetworkId)), SLOT(networkRemoved(NetworkId))); + connect(Client::instance(), &Client::networkCreated, this, &ToolBarActionProvider::networkCreated); + connect(Client::instance(), &Client::networkRemoved, this, &ToolBarActionProvider::networkRemoved); updateStates(); } -- 2.20.1