From 6eefdfc697067d184a589fc8a231b16316c09106 Mon Sep 17 00:00:00 2001 From: Manuel Nickschas Date: Wed, 12 Sep 2018 19:45:13 +0200 Subject: [PATCH] modernize: Replace most remaining old-style connects by PMF ones Manually replace old-style connects (using the SIGNAL/SLOT macros) by the much more efficient and typesafe pointer-to-member-function- based ones. This fixes the cases where clazy could not auto-migrate to the new syntax for a variety of reasons. In most of the cases, we need to remove overloads or explicitly select the desired one, because the plain syntax cannot deal with overloads. Another issue is trying to connect to signals in a baseclass that are only declared in a derived class (which works with the old-style runtime connection handling, but obviously no longer with the compile-time version). Also do some selected cleanups in places. --- src/client/abstractmessageprocessor.h | 1 + src/client/bufferviewoverlay.cpp | 5 +- src/client/client.cpp | 4 +- src/client/clientauthhandler.cpp | 11 ++- src/client/coreconnection.cpp | 39 ++++---- src/client/coreconnection.h | 2 +- src/client/execwrapper.cpp | 5 +- src/client/networkmodel.cpp | 53 ++++------ src/common/authhandler.cpp | 3 +- src/common/compressor.cpp | 2 +- src/common/internalpeer.cpp | 13 ++- src/common/ircchannel.cpp | 2 +- src/common/ircchannel.h | 2 +- src/common/posixsignalwatcher.cpp | 2 +- src/common/protocols/legacy/legacypeer.h | 3 - src/common/quassel.cpp | 2 +- src/common/remotepeer.cpp | 8 +- src/common/remotepeer.h | 3 + src/core/core.cpp | 2 +- src/core/core.h | 2 +- src/core/coreapplication.cpp | 4 +- src/core/coreauthhandler.cpp | 6 +- src/core/corebasichandler.cpp | 17 ++-- src/core/corebasichandler.h | 4 +- src/core/corenetwork.cpp | 98 +++++++++---------- src/core/corenetwork.h | 43 +++++--- src/core/coresession.cpp | 11 +-- src/core/coresession.h | 2 +- src/core/coretransfer.cpp | 3 +- src/core/sessionthread.cpp | 2 +- src/main/monoapplication.cpp | 12 +-- src/qtui/awaylogview.cpp | 7 +- src/qtui/bufferwidget.cpp | 2 +- src/qtui/chatitem.cpp | 8 +- src/qtui/chatmonitorview.cpp | 14 ++- src/qtui/chatviewsearchbar.cpp | 2 +- src/qtui/chatviewsearchcontroller.cpp | 4 +- src/qtui/columnhandleitem.cpp | 2 - src/qtui/coreconfigwizard.cpp | 3 +- src/qtui/coreconnectdlg.cpp | 4 +- src/qtui/coreinfodlg.cpp | 2 +- src/qtui/coresessionwidget.cpp | 4 +- src/qtui/coresessionwidget.h | 2 +- src/qtui/debugbufferviewoverlay.cpp | 2 +- src/qtui/dockmanagernotificationbackend.cpp | 5 +- src/qtui/inputwidget.cpp | 5 +- src/qtui/knotificationbackend.cpp | 9 +- src/qtui/mainwin.cpp | 26 ++--- src/qtui/nicklistwidget.cpp | 4 +- src/qtui/nicklistwidget.h | 4 +- src/qtui/osxnotificationbackend.mm | 2 +- src/qtui/qtui.cpp | 2 +- src/qtui/qtuiapplication.cpp | 2 +- src/qtui/qtuimessageprocessor.cpp | 7 ++ src/qtui/qtuimessageprocessor.h | 5 +- src/qtui/settingsdlg.cpp | 2 +- src/qtui/settingspagedlg.cpp | 2 +- src/qtui/settingspages/aliasesmodel.cpp | 2 +- src/qtui/settingspages/aliasesmodel.h | 2 +- .../settingspages/aliasessettingspage.cpp | 6 +- .../settingspages/appearancesettingspage.cpp | 2 +- .../settingspages/backlogsettingspage.cpp | 2 +- .../settingspages/bufferviewsettingspage.cpp | 21 ++-- .../settingspages/chatmonitorsettingspage.cpp | 2 +- .../settingspages/coreaccountsettingspage.cpp | 3 +- .../corehighlightsettingspage.cpp | 23 ++--- src/qtui/settingspages/dccsettingspage.cpp | 7 +- .../settingspages/highlightsettingspage.cpp | 2 +- .../settingspages/identitiessettingspage.cpp | 2 - src/qtui/settingspages/identityeditwidget.cpp | 7 +- src/qtui/settingspages/ignorelistmodel.cpp | 2 +- src/qtui/settingspages/ignorelistmodel.h | 2 +- .../settingspages/ignorelistsettingspage.cpp | 18 ++-- .../settingspages/ignorelistsettingspage.h | 2 +- .../settingspages/itemviewsettingspage.cpp | 4 +- .../settingspages/networkssettingspage.cpp | 24 ++--- .../notificationssettingspage.cpp | 2 +- src/qtui/settingspages/shortcutsmodel.cpp | 8 +- src/qtui/settingspages/shortcutsmodel.h | 2 +- .../settingspages/shortcutssettingspage.cpp | 4 +- src/qtui/snorenotificationbackend.cpp | 8 +- src/qtui/snorenotificationbackend.h | 2 +- src/qtui/sslinfodlg.cpp | 2 +- src/qtui/statusnotifieritem.cpp | 12 +-- src/qtui/statusnotifieritemdbus.h | 4 +- src/qtui/systraynotificationbackend.cpp | 19 ++-- src/qtui/systraynotificationbackend.h | 4 +- src/qtui/taskbarnotificationbackend.cpp | 2 +- src/uisupport/abstractnotificationbackend.h | 4 +- src/uisupport/action.cpp | 2 +- src/uisupport/bufferview.cpp | 6 +- src/uisupport/bufferviewfilter.cpp | 12 --- src/uisupport/nickview.cpp | 2 +- src/uisupport/settingspage.h | 3 - src/uisupport/toolbaractionprovider.cpp | 8 +- src/uisupport/toolbaractionprovider.h | 5 +- 96 files changed, 363 insertions(+), 378 deletions(-) diff --git a/src/client/abstractmessageprocessor.h b/src/client/abstractmessageprocessor.h index 1ac52fb0..a1b34668 100644 --- a/src/client/abstractmessageprocessor.h +++ b/src/client/abstractmessageprocessor.h @@ -37,6 +37,7 @@ public: public slots: virtual void process(Message &msg) = 0; virtual void process(QList &msgs) = 0; + virtual void networkRemoved(NetworkId id) = 0; protected: // updateBufferActivity also sets the Message::Redirected flag which is later used diff --git a/src/client/bufferviewoverlay.cpp b/src/client/bufferviewoverlay.cpp index 0769435f..02e57029 100644 --- a/src/client/bufferviewoverlay.cpp +++ b/src/client/bufferviewoverlay.cpp @@ -109,10 +109,9 @@ void BufferViewOverlay::addView(int viewId) } } else { - disconnect(config, SIGNAL(initDone()), this, SLOT(viewInitialized())); // 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(viewInitialized()), Qt::QueuedConnection); + connect(config, &BufferViewConfig::initDone, this, selectOverload<>(&BufferViewOverlay::viewInitialized), Qt::QueuedConnection); } save(); } @@ -157,8 +156,6 @@ void BufferViewOverlay::viewInitialized(BufferViewConfig *config) qWarning() << "BufferViewOverlay::viewInitialized() received invalid view!"; return; } - disconnect(config, SIGNAL(initDone()), this, SLOT(viewInitialized())); - connect(config, &BufferViewConfig::configChanged, this, &BufferViewOverlay::update); // check if the view was removed in the meantime... diff --git a/src/client/client.cpp b/src/client/client.cpp index f4c50891..91262394 100644 --- a/src/client/client.cpp +++ b/src/client/client.cpp @@ -81,7 +81,7 @@ Client::Client(std::unique_ptr ui, QObject *parent) connect(this, &Client::disconnected, mainUi(), &AbstractUi::disconnectedFromCore); connect(this, &Client::networkRemoved, _networkModel, &NetworkModel::networkRemoved); - connect(this, SIGNAL(networkRemoved(NetworkId)), _messageProcessor, SLOT(networkRemoved(NetworkId))); + connect(this, &Client::networkRemoved, _messageProcessor, &AbstractMessageProcessor::networkRemoved); connect(backlogManager(), &ClientBacklogManager::messagesReceived, _messageModel, &MessageModel::messagesReceived); connect(coreConnection(), &CoreConnection::stateChanged, this, &Client::connectionStateChanged); @@ -530,7 +530,7 @@ void Client::setDisconnectedFromCore() while (netIter != _networks.end()) { Network *net = netIter.value(); emit networkRemoved(net->networkId()); - disconnect(net, SIGNAL(destroyed()), this, nullptr); + disconnect(net, &Network::destroyed, this, nullptr); netIter = _networks.erase(netIter); net->deleteLater(); } diff --git a/src/client/clientauthhandler.cpp b/src/client/clientauthhandler.cpp index 68f545ee..668c4a47 100644 --- a/src/client/clientauthhandler.cpp +++ b/src/client/clientauthhandler.cpp @@ -32,6 +32,7 @@ #include "clientsettings.h" #include "logmessage.h" #include "peerfactory.h" +#include "util.h" using namespace Protocol; @@ -132,7 +133,7 @@ void ClientAuthHandler::onSocketStateChanged(QAbstractSocket::SocketState socket // The baseclass implementation will make sure to only send the signal once. // However, we do want to prefer a potential socket error signal that may be on route already, so // give this a chance to overtake us by spinning the loop... - QTimer::singleShot(0, this, SLOT(onSocketDisconnected())); + QTimer::singleShot(0, this, &ClientAuthHandler::onSocketDisconnected); } break; default: @@ -214,9 +215,9 @@ void ClientAuthHandler::onSocketConnected() qDebug() << "Legacy core detected, switching to compatibility mode"; - RemotePeer *peer = PeerFactory::createPeer(PeerFactory::ProtoDescriptor(Protocol::LegacyProtocol, 0), this, socket(), Compressor::NoCompression, this); + auto *peer = PeerFactory::createPeer(PeerFactory::ProtoDescriptor(Protocol::LegacyProtocol, 0), this, socket(), Compressor::NoCompression, this); // Only needed for the legacy peer, as all others check the protocol version before instantiation - connect(peer, SIGNAL(protocolVersionMismatch(int,int)), SLOT(onProtocolVersionMismatch(int,int))); + connect(peer, &RemotePeer::protocolVersionMismatch, this, &ClientAuthHandler::onProtocolVersionMismatch); setPeer(peer); } @@ -258,7 +259,7 @@ void ClientAuthHandler::onReadyRead() } if (peer->protocol() == Protocol::LegacyProtocol) { - connect(peer, SIGNAL(protocolVersionMismatch(int,int)), SLOT(onProtocolVersionMismatch(int,int))); + connect(peer, &RemotePeer::protocolVersionMismatch, this, &ClientAuthHandler::onProtocolVersionMismatch); _legacy = true; } @@ -434,7 +435,7 @@ void ClientAuthHandler::checkAndEnableSsl(bool coreSupportsSsl) auto *sslSocket = qobject_cast(socket()); Q_ASSERT(sslSocket); connect(sslSocket, &QSslSocket::encrypted, this, &ClientAuthHandler::onSslSocketEncrypted); - connect(sslSocket, SIGNAL(sslErrors(QList)), SLOT(onSslErrors())); + connect(sslSocket, selectOverload&>(&QSslSocket::sslErrors), this, &ClientAuthHandler::onSslErrors); qDebug() << "Starting encryption..."; sslSocket->flush(); sslSocket->startClientEncryption(); diff --git a/src/client/coreconnection.cpp b/src/client/coreconnection.cpp index 982e439a..e41ccdc6 100644 --- a/src/client/coreconnection.cpp +++ b/src/client/coreconnection.cpp @@ -386,28 +386,27 @@ void CoreConnection::connectToCurrentAccount() _authHandler = new ClientAuthHandler(currentAccount(), this); - 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.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); + connect(_authHandler, &ClientAuthHandler::disconnected, this, &CoreConnection::coreSocketDisconnected); + connect(_authHandler, &ClientAuthHandler::connectionReady, this, &CoreConnection::onConnectionReady); + connect(_authHandler, &ClientAuthHandler::socketError, this, &CoreConnection::coreSocketError); + connect(_authHandler, &ClientAuthHandler::transferProgress, this, &CoreConnection::updateProgress); + connect(_authHandler, &ClientAuthHandler::requestDisconnect, this, selectOverload(&CoreConnection::disconnectFromCore)); + + connect(_authHandler, &ClientAuthHandler::errorMessage, this, &CoreConnection::connectionError); + connect(_authHandler, &ClientAuthHandler::errorPopup, this, &CoreConnection::connectionErrorPopup, Qt::QueuedConnection); + connect(_authHandler, &ClientAuthHandler::statusMessage, this, &CoreConnection::connectionMsg); + connect(_authHandler, &ClientAuthHandler::encrypted, this, &CoreConnection::encrypted); + connect(_authHandler, &ClientAuthHandler::startCoreSetup, this, &CoreConnection::startCoreSetup); + connect(_authHandler, &ClientAuthHandler::coreSetupFailed, this, &CoreConnection::coreSetupFailed); + connect(_authHandler, &ClientAuthHandler::coreSetupSuccessful, this, &CoreConnection::coreSetupSuccess); + connect(_authHandler, &ClientAuthHandler::userAuthenticationRequired, this, &CoreConnection::userAuthenticationRequired); + connect(_authHandler, &ClientAuthHandler::handleNoSslInClient, this, &CoreConnection::handleNoSslInClient); + connect(_authHandler, &ClientAuthHandler::handleNoSslInCore, this, &CoreConnection::handleNoSslInCore); #ifdef HAVE_SSL - connect(_authHandler.data(), &ClientAuthHandler::handleSslErrors, this, &CoreConnection::handleSslErrors); + connect(_authHandler, &ClientAuthHandler::handleSslErrors, this, &CoreConnection::handleSslErrors); #endif - - connect(_authHandler.data(), &ClientAuthHandler::loginSuccessful, this, &CoreConnection::onLoginSuccessful); - connect(_authHandler.data(), &ClientAuthHandler::handshakeComplete, this, &CoreConnection::onHandshakeComplete); + connect(_authHandler, &ClientAuthHandler::loginSuccessful, this, &CoreConnection::onLoginSuccessful); + connect(_authHandler, &ClientAuthHandler::handshakeComplete, this, &CoreConnection::onHandshakeComplete); setState(Connecting); _authHandler->connectToCore(); diff --git a/src/client/coreconnection.h b/src/client/coreconnection.h index 79020220..dff1f5a7 100644 --- a/src/client/coreconnection.h +++ b/src/client/coreconnection.h @@ -81,6 +81,7 @@ public slots: bool connectToCore(AccountId = 0); void reconnectToCore(); void disconnectFromCore(); + void internalSessionStateReceived(const Protocol::SessionState &sessionState); void setupCore(const Protocol::SetupData &setupData); @@ -126,7 +127,6 @@ private slots: void loginToCore(const QString &user, const QString &password, bool remember); // for config wizard void syncToCore(const Protocol::SessionState &sessionState); - void internalSessionStateReceived(const Protocol::SessionState &sessionState); void resetConnection(bool wantReconnect = false); diff --git a/src/client/execwrapper.cpp b/src/client/execwrapper.cpp index c44b69ce..67292df2 100644 --- a/src/client/execwrapper.cpp +++ b/src/client/execwrapper.cpp @@ -26,13 +26,14 @@ #include "client.h" #include "messagemodel.h" #include "quassel.h" +#include "util.h" ExecWrapper::ExecWrapper(QObject *parent) : QObject(parent) { 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(&_process, selectOverload(&QProcess::finished), this, &ExecWrapper::processFinished); + connect(&_process, selectOverload(&QProcess::error), this, &ExecWrapper::processError); connect(this, &ExecWrapper::output, this, &ExecWrapper::postStdout); connect(this, &ExecWrapper::error, this, &ExecWrapper::postStderr); diff --git a/src/client/networkmodel.cpp b/src/client/networkmodel.cpp index dca6ffe5..223e09ca 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, &NetworkItem::networkDataChanged, this, &AbstractTreeItem::dataChanged); - connect(this, &AbstractTreeItem::beginRemoveChilds, this, &NetworkItem::onBeginRemoveChilds); + connect(this, &NetworkItem::networkDataChanged, this, &NetworkItem::dataChanged); + connect(this, &NetworkItem::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, &NetworkItem::networkDataChanged, this, &AbstractTreeItem::dataChanged); - connect(this, &NetworkItem::networkDataChanged, bufferItem, &AbstractTreeItem::dataChanged); - connect(bufferItem, &AbstractTreeItem::dataChanged, this, &AbstractTreeItem::dataChanged); + disconnect(this, &NetworkItem::networkDataChanged, this, &NetworkItem::dataChanged); + connect(this, &NetworkItem::networkDataChanged, bufferItem, &BufferItem::dataChanged); + connect(bufferItem, &BufferItem::dataChanged, this, &NetworkItem::dataChanged); break; case BufferInfo::ChannelBuffer: bufferItem = new ChannelBufferItem(bufferInfo, this); @@ -175,7 +175,7 @@ void NetworkItem::attachNetwork(Network *network) connect(network, &Network::ircUserAdded, this, &NetworkItem::attachIrcUser); connect(network, &Network::connectedSet, - this, &NetworkItem::networkDataChanged); + this, [this]() { emit networkDataChanged(); }); connect(network, &QObject::destroyed, this, &NetworkItem::onNetworkDestroyed); @@ -698,9 +698,9 @@ void QueryBufferItem::setIrcUser(IrcUser *ircUser) } if (ircUser) { - connect(ircUser, &QObject::destroyed, this, &QueryBufferItem::removeIrcUser); + connect(ircUser, &IrcUser::destroyed, this, &QueryBufferItem::removeIrcUser); connect(ircUser, &IrcUser::quited, this, &QueryBufferItem::removeIrcUser); - connect(ircUser, &IrcUser::awaySet, this, &AbstractTreeItem::dataChanged); + connect(ircUser, &IrcUser::awaySet, this, [this]() { emit dataChanged(); }); connect(ircUser, &IrcUser::encryptedSet, this, &BufferItem::setEncrypted); } @@ -809,24 +809,15 @@ void ChannelBufferItem::attachIrcChannel(IrcChannel *ircChannel) _ircChannel = ircChannel; - 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, &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); + connect(ircChannel, &QObject::destroyed, this, &ChannelBufferItem::ircChannelDestroyed); + connect(ircChannel, &IrcChannel::topicSet, this, &ChannelBufferItem::setTopic); + connect(ircChannel, &IrcChannel::encryptedSet, this, &ChannelBufferItem::setEncrypted); + connect(ircChannel, &IrcChannel::ircUsersJoined, this, &ChannelBufferItem::join); + 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()); @@ -1114,8 +1105,8 @@ IrcUserItem::IrcUserItem(IrcUser *ircUser, AbstractTreeItem *parent) { setObjectName(ircUser->nick()); connect(ircUser, &IrcUser::quited, this, &IrcUserItem::ircUserQuited); - connect(ircUser, SIGNAL(nickSet(QString)), this, SIGNAL(dataChanged())); - connect(ircUser, &IrcUser::awaySet, this, &AbstractTreeItem::dataChanged); + connect(ircUser, &IrcUser::nickSet, this, [this]() { emit dataChanged(); }); + connect(ircUser, &IrcUser::awaySet, this, [this]() { emit dataChanged(); }); } @@ -1289,10 +1280,8 @@ QString IrcUserItem::channelModes() const NetworkModel::NetworkModel(QObject *parent) : TreeModel(NetworkModel::defaultHeader(), parent) { - connect(this, &QAbstractItemModel::rowsInserted, - this, &NetworkModel::checkForNewBuffers); - connect(this, &QAbstractItemModel::rowsAboutToBeRemoved, - this, &NetworkModel::checkForRemovedBuffers); + connect(this, &NetworkModel::rowsInserted, this, &NetworkModel::checkForNewBuffers); + connect(this, &NetworkModel::rowsAboutToBeRemoved, this, &NetworkModel::checkForRemovedBuffers); BufferSettings defaultSettings; defaultSettings.notify("UserNoticesTarget", this, SLOT(messageRedirectionSettingsChanged())); diff --git a/src/common/authhandler.cpp b/src/common/authhandler.cpp index f1dc2920..ddc8fcfb 100644 --- a/src/common/authhandler.cpp +++ b/src/common/authhandler.cpp @@ -21,6 +21,7 @@ #include #include "authhandler.h" +#include "util.h" AuthHandler::AuthHandler(QObject *parent) : QObject(parent) @@ -38,7 +39,7 @@ QTcpSocket *AuthHandler::socket() const void AuthHandler::setSocket(QTcpSocket *socket) { _socket = socket; - connect(socket, SIGNAL(error(QAbstractSocket::SocketError)), SLOT(onSocketError(QAbstractSocket::SocketError))); + connect(socket, selectOverload(&QTcpSocket::error), this, &AuthHandler::onSocketError); connect(socket, &QAbstractSocket::disconnected, this, &AuthHandler::onSocketDisconnected); } diff --git a/src/common/compressor.cpp b/src/common/compressor.cpp index bef6dbbe..816f26c8 100644 --- a/src/common/compressor.cpp +++ b/src/common/compressor.cpp @@ -41,7 +41,7 @@ Compressor::Compressor(QTcpSocket *socket, Compressor::CompressionLevel level, Q if (!ok) { // something went wrong during initialization... but we can only emit an error after RemotePeer has connected its signal - QTimer::singleShot(0, this, SIGNAL(error())); + QTimer::singleShot(0, this, [this]() { emit error(); }); return; } diff --git a/src/common/internalpeer.cpp b/src/common/internalpeer.cpp index 5ac80cb5..b538d2a3 100644 --- a/src/common/internalpeer.cpp +++ b/src/common/internalpeer.cpp @@ -19,6 +19,7 @@ ***************************************************************************/ #include "internalpeer.h" +#include "util.h" using namespace Protocol; @@ -125,10 +126,14 @@ void InternalPeer::setSignalProxy(::SignalProxy *proxy) void InternalPeer::setPeer(InternalPeer *peer) { - connect(peer, SIGNAL(dispatchMessage(Protocol::SyncMessage)), SLOT(handleMessage(Protocol::SyncMessage))); - connect(peer, SIGNAL(dispatchMessage(Protocol::RpcCall)) , SLOT(handleMessage(Protocol::RpcCall))); - connect(peer, SIGNAL(dispatchMessage(Protocol::InitRequest)), SLOT(handleMessage(Protocol::InitRequest))); - connect(peer, SIGNAL(dispatchMessage(Protocol::InitData)) , SLOT(handleMessage(Protocol::InitData))); + connect(peer, selectOverload(&InternalPeer::dispatchMessage), + this, selectOverload(&InternalPeer::handleMessage)); + connect(peer, selectOverload(&InternalPeer::dispatchMessage), + this, selectOverload(&InternalPeer::handleMessage)); + connect(peer, selectOverload(&InternalPeer::dispatchMessage), + this, selectOverload(&InternalPeer::handleMessage)); + connect(peer, selectOverload(&InternalPeer::dispatchMessage), + this, selectOverload(&InternalPeer::handleMessage)); connect(peer, &Peer::disconnected, this, &InternalPeer::peerDisconnected); diff --git a/src/common/ircchannel.cpp b/src/common/ircchannel.cpp index 7bb83ed4..37318d9e 100644 --- a/src/common/ircchannel.cpp +++ b/src/common/ircchannel.cpp @@ -191,7 +191,7 @@ void IrcChannel::joinIrcUsers(const QList &users, const QStringList & _userModes[ircuser] = sortedModes[i]; ircuser->joinChannel(this, true); - connect(ircuser, SIGNAL(nickSet(QString)), this, SLOT(ircUserNickSet(QString))); + connect(ircuser, &IrcUser::nickSet, this, selectOverload(&IrcChannel::ircUserNickSet)); // connect(ircuser, SIGNAL(destroyed()), this, SLOT(ircUserDestroyed())); // If you wonder why there is no counterpart to ircUserJoined: diff --git a/src/common/ircchannel.h b/src/common/ircchannel.h index 4c50700c..bcb6f59e 100644 --- a/src/common/ircchannel.h +++ b/src/common/ircchannel.h @@ -117,7 +117,7 @@ signals: // void channelModeAdded(const QChar &mode, const QString &value); // void channelModeRemoved(const QChar &mode, const QString &value); - void ircUsersJoined(QList ircusers); + void ircUsersJoined(const QList &ircusers); // void ircUsersJoined(QStringList nicks, QStringList modes); void ircUserParted(IrcUser *ircuser); void ircUserNickSet(IrcUser *ircuser, QString nick); diff --git a/src/common/posixsignalwatcher.cpp b/src/common/posixsignalwatcher.cpp index 7de0e773..4da9539a 100644 --- a/src/common/posixsignalwatcher.cpp +++ b/src/common/posixsignalwatcher.cpp @@ -45,7 +45,7 @@ PosixSignalWatcher::PosixSignalWatcher(QObject *parent) } _notifier = new QSocketNotifier(_sockpair[1], QSocketNotifier::Read, this); - connect(_notifier, SIGNAL(activated(int)), this, SLOT(onNotify(int))); + connect(_notifier, &QSocketNotifier::activated, this, &PosixSignalWatcher::onNotify); _notifier->setEnabled(true); registerSignal(SIGINT); diff --git a/src/common/protocols/legacy/legacypeer.h b/src/common/protocols/legacy/legacypeer.h index e2a2317b..47cadcc1 100644 --- a/src/common/protocols/legacy/legacypeer.h +++ b/src/common/protocols/legacy/legacypeer.h @@ -66,9 +66,6 @@ public: signals: void protocolError(const QString &errorString); - // only used in compat mode - void protocolVersionMismatch(int actual, int expected); - private: using RemotePeer::writeMessage; void writeMessage(const QVariant &item); diff --git a/src/common/quassel.cpp b/src/common/quassel.cpp index 03cf739a..14d6a639 100644 --- a/src/common/quassel.cpp +++ b/src/common/quassel.cpp @@ -293,7 +293,7 @@ void Quassel::setupSignalHandling() #else _signalWatcher = new WindowsSignalWatcher(this); #endif - connect(_signalWatcher, SIGNAL(handleSignal(AbstractSignalWatcher::Action)), this, SLOT(handleSignal(AbstractSignalWatcher::Action))); + connect(_signalWatcher, &AbstractSignalWatcher::handleSignal, this, &Quassel::handleSignal); } diff --git a/src/common/remotepeer.cpp b/src/common/remotepeer.cpp index 942bbd68..c3ad24f0 100644 --- a/src/common/remotepeer.cpp +++ b/src/common/remotepeer.cpp @@ -30,6 +30,7 @@ #endif #include "remotepeer.h" +#include "util.h" using namespace Protocol; @@ -47,13 +48,14 @@ RemotePeer::RemotePeer(::AuthHandler *authHandler, QTcpSocket *socket, Compresso { socket->setParent(this); connect(socket, &QAbstractSocket::stateChanged, this, &RemotePeer::onSocketStateChanged); - connect(socket, SIGNAL(error(QAbstractSocket::SocketError)), SLOT(onSocketError(QAbstractSocket::SocketError))); + connect(socket, selectOverload(&QAbstractSocket::error), this, &RemotePeer::onSocketError); connect(socket, &QAbstractSocket::disconnected, this, &Peer::disconnected); #ifdef HAVE_SSL auto *sslSocket = qobject_cast(socket); - if (sslSocket) - connect(sslSocket, SIGNAL(encrypted()), SIGNAL(secureStateChanged())); + if (sslSocket) { + connect(sslSocket, &QSslSocket::encrypted, this, [this]() { emit secureStateChanged(true); }); + } #endif connect(_compressor, &Compressor::readyRead, this, &RemotePeer::onReadyRead); diff --git a/src/common/remotepeer.h b/src/common/remotepeer.h index 8a47b0a7..5e064252 100644 --- a/src/common/remotepeer.h +++ b/src/common/remotepeer.h @@ -72,6 +72,9 @@ signals: void socketError(QAbstractSocket::SocketError error, const QString &errorString); void statusMessage(const QString &msg); + // Only used by LegacyPeer + void protocolVersionMismatch(int actual, int expected); + protected: SignalProxy *signalProxy() const override; diff --git a/src/core/core.cpp b/src/core/core.cpp index 84ce9796..556eec67 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp @@ -273,7 +273,7 @@ void Core::shutdown() } for (auto &&session : _sessions) { - connect(session, SIGNAL(shutdownComplete(SessionThread*)), this, SLOT(onSessionShutdown(SessionThread*))); + connect(session, &SessionThread::shutdownComplete, this, &Core::onSessionShutdown); session->shutdown(); } } diff --git a/src/core/core.h b/src/core/core.h index 45d06072..aa94725e 100644 --- a/src/core/core.h +++ b/src/core/core.h @@ -704,7 +704,7 @@ signals: void bufferInfoUpdated(UserId user, const BufferInfo &info); //! Relay from CoreSession::sessionState(). Used for internal connection only - void sessionState(const Protocol::SessionState &sessionState); + void sessionStateReceived(const Protocol::SessionState &sessionState); //! Emitted when database schema upgrade starts or ends void dbUpgradeInProgress(bool inProgress); diff --git a/src/core/coreapplication.cpp b/src/core/coreapplication.cpp index 8fbf4aaf..c8171dc2 100644 --- a/src/core/coreapplication.cpp +++ b/src/core/coreapplication.cpp @@ -24,7 +24,7 @@ CoreApplication::CoreApplication(int &argc, char **argv) : QCoreApplication(argc, argv) { Quassel::registerQuitHandler([this]() { - connect(_core.get(), SIGNAL(shutdownComplete()), this, SLOT(onShutdownComplete())); + connect(_core.get(), &Core::shutdownComplete, this, &CoreApplication::onShutdownComplete); _core->shutdown(); }); } @@ -39,6 +39,6 @@ void CoreApplication::init() void CoreApplication::onShutdownComplete() { - connect(_core.get(), SIGNAL(destroyed()), QCoreApplication::instance(), SLOT(quit())); + connect(_core.get(), &QObject::destroyed, QCoreApplication::instance(), &QCoreApplication::quit); _core.release()->deleteLater(); } diff --git a/src/core/coreauthhandler.cpp b/src/core/coreauthhandler.cpp index 6a1a9c1c..ade356ee 100644 --- a/src/core/coreauthhandler.cpp +++ b/src/core/coreauthhandler.cpp @@ -64,7 +64,7 @@ void CoreAuthHandler::onReadyRead() qDebug() << "Legacy client detected, switching to compatibility mode"; _legacy = true; RemotePeer *peer = PeerFactory::createPeer(PeerFactory::ProtoDescriptor(Protocol::LegacyProtocol, 0), this, socket(), Compressor::NoCompression, this); - connect(peer, SIGNAL(protocolVersionMismatch(int,int)), SLOT(onProtocolVersionMismatch(int,int))); + connect(peer, &RemotePeer::protocolVersionMismatch, this, &CoreAuthHandler::onProtocolVersionMismatch); setPeer(peer); return; } @@ -106,7 +106,7 @@ void CoreAuthHandler::onReadyRead() if (peer->protocol() == Protocol::LegacyProtocol) { _legacy = true; - connect(peer, SIGNAL(protocolVersionMismatch(int,int)), SLOT(onProtocolVersionMismatch(int,int))); + connect(peer, &RemotePeer::protocolVersionMismatch, this, &CoreAuthHandler::onProtocolVersionMismatch); } setPeer(peer); @@ -274,7 +274,7 @@ void CoreAuthHandler::startSsl() Q_ASSERT(sslSocket); qDebug() << qPrintable(tr("Starting encryption for Client:")) << _peer->description(); - connect(sslSocket, SIGNAL(sslErrors(const QList &)), SLOT(onSslErrors())); + connect(sslSocket, selectOverload &>(&QSslSocket::sslErrors), this, &CoreAuthHandler::onSslErrors); sslSocket->flush(); // ensure that the write cache is flushed before we switch to ssl (bug 682) sslSocket->startServerEncryption(); #endif /* HAVE_SSL */ diff --git a/src/core/corebasichandler.cpp b/src/core/corebasichandler.cpp index 840d9bc9..a458b79a 100644 --- a/src/core/corebasichandler.cpp +++ b/src/core/corebasichandler.cpp @@ -27,17 +27,12 @@ CoreBasicHandler::CoreBasicHandler(CoreNetwork *parent) : BasicHandler(parent), _network(parent) { - connect(this, SIGNAL(displayMsg(Message::Type, BufferInfo::Type, const QString &, const QString &, const QString &, Message::Flags)), - network(), SLOT(displayMsg(Message::Type, BufferInfo::Type, const QString &, const QString &, const QString &, Message::Flags))); - - connect(this, SIGNAL(putCmd(QString, const QList &, const QByteArray &, const bool)), - network(), SLOT(putCmd(QString, const QList &, const QByteArray &, const bool))); - - connect(this, SIGNAL(putCmd(QString, const QList> &, const QByteArray &, const bool)), - network(), SLOT(putCmd(QString, const QList> &, const QByteArray &, const bool))); - - connect(this, &CoreBasicHandler::putRawLine, - network(), &CoreNetwork::putRawLine); + connect(this, &CoreBasicHandler::displayMsg, network(), &CoreNetwork::onDisplayMsg); + connect(this, &CoreBasicHandler::putRawLine, network(), &CoreNetwork::putRawLine); + connect(this, selectOverload&, const QByteArray&, bool>(&CoreBasicHandler::putCmd), + network(), selectOverload&, const QByteArray&, bool>(&CoreNetwork::putCmd)); + connect(this, selectOverload>&, const QByteArray&, bool>(&CoreBasicHandler::putCmd), + network(), selectOverload>&, const QByteArray&, bool>(&CoreNetwork::putCmd)); } diff --git a/src/core/corebasichandler.h b/src/core/corebasichandler.h index 39e41cb8..f741112e 100644 --- a/src/core/corebasichandler.h +++ b/src/core/corebasichandler.h @@ -67,14 +67,14 @@ signals: * * @see CoreNetwork::putCmd(const QString &cmd, const QList ¶ms, const QByteArray &prefix = QByteArray(), const bool prepend = false) */ - void putCmd(const QString &cmd, const QList ¶ms, const QByteArray &prefix = QByteArray(), const bool prepend = false); + void putCmd(const QString &cmd, const QList ¶ms, const QByteArray &prefix = {}, bool prepend = false); /** * Sends the command for each set of encoded parameters, with optional prefix or high priority. * * @see CoreNetwork::putCmd(const QString &cmd, const QList> ¶ms, const QByteArray &prefix = QByteArray(), const bool prepend = false) */ - void putCmd(const QString &cmd, const QList> ¶ms, const QByteArray &prefix = QByteArray(), const bool prepend = false); + void putCmd(const QString &cmd, const QList> ¶ms, const QByteArray &prefix = {}, bool prepend = false); protected: /** diff --git a/src/core/corenetwork.cpp b/src/core/corenetwork.cpp index e0332096..81e1b5ed 100644 --- a/src/core/corenetwork.cpp +++ b/src/core/corenetwork.cpp @@ -51,7 +51,7 @@ CoreNetwork::CoreNetwork(const NetworkId &networkid, CoreSession *session) _debugLogRawNetId = Quassel::optionValue("debug-irc-id").toInt(); _autoReconnectTimer.setSingleShot(true); - connect(&_socketCloseTimer, &QTimer::timeout, this, &CoreNetwork::socketCloseTimeout); + connect(&_socketCloseTimer, &QTimer::timeout, this, &CoreNetwork::onSocketCloseTimeout); setPingInterval(networkConfig()->pingInterval()); connect(&_pingTimer, &QTimer::timeout, this, &CoreNetwork::sendPing); @@ -80,13 +80,13 @@ CoreNetwork::CoreNetwork(const NetworkId &networkid, CoreSession *session) 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, &QAbstractSocket::stateChanged, this, &CoreNetwork::socketStateChanged); - connect(&socket, &QIODevice::readyRead, this, &CoreNetwork::socketHasData); + connect(&socket, &QAbstractSocket::connected, this, &CoreNetwork::onSocketInitialized); + connect(&socket, selectOverload(&QAbstractSocket::error), this, &CoreNetwork::onSocketError); + connect(&socket, &QAbstractSocket::stateChanged, this, &CoreNetwork::onSocketStateChanged); + connect(&socket, &QIODevice::readyRead, this, &CoreNetwork::onSocketHasData); #ifdef HAVE_SSL - connect(&socket, SIGNAL(encrypted()), this, SLOT(socketInitialized())); - connect(&socket, SIGNAL(sslErrors(const QList &)), this, SLOT(sslErrors(const QList &))); + connect(&socket, &QSslSocket::encrypted, this, &CoreNetwork::onSocketInitialized); + connect(&socket, selectOverload&>(&QSslSocket::sslErrors), this, &CoreNetwork::onSslErrors); #endif connect(this, &CoreNetwork::newEvent, coreSession()->eventManager(), &EventManager::postEvent); @@ -104,17 +104,13 @@ CoreNetwork::CoreNetwork(const NetworkId &networkid, CoreSession *session) connect(this, &Network::capRemoved, this, &CoreNetwork::serverCapRemoved); if (Quassel::isOptionSet("oidentd")) { - connect(this, SIGNAL(socketInitialized(const CoreIdentity*, QHostAddress, quint16, QHostAddress, quint16, qint64)), - Core::instance()->oidentdConfigGenerator(), SLOT(addSocket(const CoreIdentity*, QHostAddress, quint16, QHostAddress, quint16, qint64)), Qt::BlockingQueuedConnection); - connect(this, SIGNAL(socketDisconnected(const CoreIdentity*, QHostAddress, quint16, QHostAddress, quint16, qint64)), - Core::instance()->oidentdConfigGenerator(), SLOT(removeSocket(const CoreIdentity*, QHostAddress, quint16, QHostAddress, quint16, qint64))); + connect(this, &CoreNetwork::socketInitialized, Core::instance()->oidentdConfigGenerator(), &OidentdConfigGenerator::addSocket); + connect(this, &CoreNetwork::socketDisconnected, Core::instance()->oidentdConfigGenerator(), &OidentdConfigGenerator::removeSocket); } if (Quassel::isOptionSet("ident-daemon")) { - connect(this, SIGNAL(socketInitialized(const CoreIdentity*, QHostAddress, quint16, QHostAddress, quint16, qint64)), - Core::instance()->identServer(), SLOT(addSocket(const CoreIdentity*, QHostAddress, quint16, QHostAddress, quint16, qint64)), Qt::BlockingQueuedConnection); - connect(this, SIGNAL(socketDisconnected(const CoreIdentity*, QHostAddress, quint16, QHostAddress, quint16, qint64)), - Core::instance()->identServer(), SLOT(removeSocket(const CoreIdentity*, QHostAddress, quint16, QHostAddress, quint16, qint64))); + connect(this, &CoreNetwork::socketInitialized, Core::instance()->identServer(), &IdentServer::addSocket); + connect(this, &CoreNetwork::socketDisconnected, Core::instance()->identServer(), &IdentServer::removeSocket); } } @@ -229,7 +225,7 @@ void CoreNetwork::connectToIrc(bool reconnecting) else if (_previousConnectionAttemptFailed) { // cycle to next server if previous connection attempt failed _previousConnectionAttemptFailed = false; - displayMsg(Message::Server, BufferInfo::StatusBuffer, "", tr("Connection failed. Cycling to next Server")); + showMessage(Message::Server, BufferInfo::StatusBuffer, "", tr("Connection failed. Cycling to next Server")); if (++_lastUsedServerIndex >= serverList().size()) { _lastUsedServerIndex = 0; } @@ -241,7 +237,7 @@ void CoreNetwork::connectToIrc(bool reconnecting) Server server = usedServer(); displayStatusMsg(tr("Connecting to %1:%2...").arg(server.host).arg(server.port)); - displayMsg(Message::Server, BufferInfo::StatusBuffer, "", tr("Connecting to %1:%2...").arg(server.host).arg(server.port)); + showMessage(Message::Server, BufferInfo::StatusBuffer, "", tr("Connecting to %1:%2...").arg(server.host).arg(server.port)); if (server.useProxy) { QNetworkProxy proxy((QNetworkProxy::ProxyType)server.proxyType, server.proxyHost, server.proxyPort, server.proxyUser, server.proxyPass); @@ -306,9 +302,9 @@ void CoreNetwork::disconnectFromIrc(bool requested, const QString &reason, bool else _quitReason = reason; - displayMsg(Message::Server, BufferInfo::StatusBuffer, "", tr("Disconnecting. (%1)").arg((!requested && !withReconnect) ? tr("Core Shutdown") : _quitReason)); + showMessage(Message::Server, BufferInfo::StatusBuffer, "", tr("Disconnecting. (%1)").arg((!requested && !withReconnect) ? tr("Core Shutdown") : _quitReason)); if (socket.state() == QAbstractSocket::UnconnectedState) { - socketDisconnected(); + onSocketDisconnected(); } else { if (socket.state() == QAbstractSocket::ConnectedState) { @@ -326,7 +322,7 @@ void CoreNetwork::disconnectFromIrc(bool requested, const QString &reason, bool } -void CoreNetwork::socketCloseTimeout() +void CoreNetwork::onSocketCloseTimeout() { qWarning() << QString{"Timed out quitting network %1 (network ID: %2, user ID: %3)"} .arg(networkName()).arg(networkId().toInt()).arg(userId().toInt()); @@ -341,15 +337,15 @@ void CoreNetwork::shutdown() } -void CoreNetwork::userInput(BufferInfo buf, QString msg) +void CoreNetwork::userInput(const BufferInfo &buf, QString msg) { userInputHandler()->handleUserInput(buf, msg); } -void CoreNetwork::putRawLine(const QByteArray s, const bool prepend) +void CoreNetwork::putRawLine(const QByteArray &s, bool prepend) { - if (_tokenBucket > 0 || (_skipMessageRates && _msgQueue.size() == 0)) { + if (_tokenBucket > 0 || (_skipMessageRates && _msgQueue.isEmpty())) { // If there's tokens remaining, ... // Or rate limits don't apply AND no messages are in queue (to prevent out-of-order), ... // Send the message now. @@ -524,7 +520,7 @@ void CoreNetwork::setMyNick(const QString &mynick) } -void CoreNetwork::socketHasData() +void CoreNetwork::onSocketHasData() { while (socket.canReadLine()) { QByteArray s = socket.readLine(); @@ -539,7 +535,7 @@ void CoreNetwork::socketHasData() } -void CoreNetwork::socketError(QAbstractSocket::SocketError error) +void CoreNetwork::onSocketError(QAbstractSocket::SocketError error) { // Ignore socket closed errors if expected if (_disconnectExpected && error == QAbstractSocket::RemoteHostClosedError) { @@ -549,15 +545,15 @@ void CoreNetwork::socketError(QAbstractSocket::SocketError error) _previousConnectionAttemptFailed = true; qWarning() << qPrintable(tr("Could not connect to %1 (%2)").arg(networkName(), socket.errorString())); emit connectionError(socket.errorString()); - displayMsg(Message::Error, BufferInfo::StatusBuffer, "", tr("Connection failure: %1").arg(socket.errorString())); + showMessage(Message::Error, BufferInfo::StatusBuffer, "", tr("Connection failure: %1").arg(socket.errorString())); emitConnectionError(socket.errorString()); if (socket.state() < QAbstractSocket::ConnectedState) { - socketDisconnected(); + onSocketDisconnected(); } } -void CoreNetwork::socketInitialized() +void CoreNetwork::onSocketInitialized() { CoreIdentity *identity = identityPtr(); if (!identity) { @@ -597,7 +593,7 @@ void CoreNetwork::socketInitialized() // Request capabilities as per IRCv3.2 specifications // Older servers should ignore this; newer servers won't downgrade to RFC1459 - displayMsg(Message::Server, BufferInfo::StatusBuffer, "", tr("Requesting capability list...")); + showMessage(Message::Server, BufferInfo::StatusBuffer, "", tr("Requesting capability list...")); putRawLine(serverEncode(QString("CAP LS 302"))); if (!server.password.isEmpty()) { @@ -619,7 +615,7 @@ void CoreNetwork::socketInitialized() } -void CoreNetwork::socketDisconnected() +void CoreNetwork::onSocketDisconnected() { disablePingTimeout(); _msgQueue.clear(); @@ -636,7 +632,7 @@ void CoreNetwork::socketDisconnected() IrcUser *me_ = me(); if (me_) { foreach(QString channel, me_->channels()) - displayMsg(Message::Quit, BufferInfo::ChannelBuffer, channel, _quitReason, me_->hostmask()); + showMessage(Message::Quit, BufferInfo::ChannelBuffer, channel, _quitReason, me_->hostmask()); } setConnected(false); @@ -659,13 +655,13 @@ void CoreNetwork::socketDisconnected() } -void CoreNetwork::socketStateChanged(QAbstractSocket::SocketState socketState) +void CoreNetwork::onSocketStateChanged(QAbstractSocket::SocketState socketState) { Network::ConnectionState state; switch (socketState) { case QAbstractSocket::UnconnectedState: state = Network::Disconnected; - socketDisconnected(); + onSocketDisconnected(); break; case QAbstractSocket::HostLookupState: case QAbstractSocket::ConnectingState: @@ -1041,7 +1037,7 @@ void CoreNetwork::updateRateLimiting(const bool forceUnlimited) if (_skipMessageRates) { // If the message queue already contains messages, they need sent before disabling the // timer. Set the timer to a rapid pace and let it disable itself. - if (_msgQueue.size() > 0) { + if (!_msgQueue.isEmpty()) { qDebug() << "Outgoing message queue contains messages while disabling rate " "limiting. Sending remaining queued messages..."; // Promptly run the timer again to clear the messages. Rate limiting is disabled, @@ -1123,8 +1119,7 @@ void CoreNetwork::serverCapAcknowledged(const QString &capability) // EXTERNAL authentication supported, send request putRawLine(serverEncode("AUTHENTICATE EXTERNAL")); } else { - displayMsg(Message::Error, BufferInfo::StatusBuffer, "", - tr("SASL EXTERNAL authentication not supported")); + showMessage(Message::Error, BufferInfo::StatusBuffer, "", tr("SASL EXTERNAL authentication not supported")); sendNextCap(); } } else { @@ -1134,8 +1129,7 @@ void CoreNetwork::serverCapAcknowledged(const QString &capability) // Only working with PLAIN atm, blowfish later putRawLine(serverEncode("AUTHENTICATE PLAIN")); } else { - displayMsg(Message::Error, BufferInfo::StatusBuffer, "", - tr("SASL PLAIN authentication not supported")); + showMessage(Message::Error, BufferInfo::StatusBuffer, "", tr("SASL PLAIN authentication not supported")); sendNextCap(); } #ifdef HAVE_SSL @@ -1240,9 +1234,9 @@ void CoreNetwork::retryCapsIndividually() // Add most recently tried capability set to individual list, re-requesting them one at a time _capsQueuedIndividual.append(_capsQueuedLastBundle); // Warn of this issue to explain the slower login. Servers usually shouldn't trigger this. - displayMsg(Message::Server, BufferInfo::StatusBuffer, "", - tr("Could not negotiate some capabilities, retrying individually (%1)...") - .arg(_capsQueuedLastBundle.join(", "))); + showMessage(Message::Server, BufferInfo::StatusBuffer, "", + tr("Could not negotiate some capabilities, retrying individually (%1)...") + .arg(_capsQueuedLastBundle.join(", "))); // Capabilities are already removed from the capability bundle queue via takeQueuedCaps(), no // need to remove them here. // Clear the most recently tried set to reduce risk that mistakes elsewhere causes retrying @@ -1256,14 +1250,13 @@ void CoreNetwork::beginCapNegotiation() if (!capNegotiationInProgress()) { // If the server doesn't have any capabilities, but supports CAP LS, continue on with the // normal connection. - displayMsg(Message::Server, BufferInfo::StatusBuffer, "", tr("No capabilities available")); + showMessage(Message::Server, BufferInfo::StatusBuffer, "", tr("No capabilities available")); endCapNegotiation(); return; } _capNegotiationActive = true; - displayMsg(Message::Server, BufferInfo::StatusBuffer, "", - tr("Ready to negotiate (found: %1)").arg(caps().join(", "))); + showMessage(Message::Server, BufferInfo::StatusBuffer, "", tr("Ready to negotiate (found: %1)").arg(caps().join(", "))); // Build a list of queued capabilities, starting with individual, then bundled, only adding the // comma separator between the two if needed (both individual and bundled caps exist). @@ -1271,8 +1264,7 @@ void CoreNetwork::beginCapNegotiation() _capsQueuedIndividual.join(", ") + ((!_capsQueuedIndividual.empty() && !_capsQueuedBundled.empty()) ? ", " : "") + _capsQueuedBundled.join(", "); - displayMsg(Message::Server, BufferInfo::StatusBuffer, "", - tr("Negotiating capabilities (requesting: %1)...").arg(queuedCapsDisplay)); + showMessage(Message::Server, BufferInfo::StatusBuffer, "", tr("Negotiating capabilities (requesting: %1)...").arg(queuedCapsDisplay)); sendNextCap(); } @@ -1286,12 +1278,10 @@ void CoreNetwork::sendNextCap() // No pending desired capabilities, capability negotiation finished // If SASL requested but not available, print a warning if (networkInfo().useSasl && !capEnabled(IrcCap::SASL)) - displayMsg(Message::Error, BufferInfo::StatusBuffer, "", - tr("SASL authentication currently not supported by server")); + showMessage(Message::Error, BufferInfo::StatusBuffer, "", tr("SASL authentication currently not supported by server")); if (_capNegotiationActive) { - displayMsg(Message::Server, BufferInfo::StatusBuffer, "", - tr("Capability negotiation finished (enabled: %1)").arg(capsEnabled().join(", "))); + showMessage(Message::Server, BufferInfo::StatusBuffer, "", tr("Capability negotiation finished (enabled: %1)").arg(capsEnabled().join(", "))); _capNegotiationActive = false; } @@ -1422,7 +1412,7 @@ void CoreNetwork::sendAutoWho() #ifdef HAVE_SSL -void CoreNetwork::sslErrors(const QList &sslErrors) +void CoreNetwork::onSslErrors(const QList &sslErrors) { Server server = usedServer(); if (server.sslVerify) { @@ -1433,7 +1423,7 @@ void CoreNetwork::sslErrors(const QList &sslErrors) // Add the error reason if known sslErrorMessage.append(tr(" (Reason: %1)").arg(sslErrors.first().errorString())); } - displayMsg(Message::Error, BufferInfo::StatusBuffer, "", sslErrorMessage); + showMessage(Message::Error, BufferInfo::StatusBuffer, "", sslErrorMessage); // Disconnect, triggering a reconnect in case it's a temporary issue with certificate // validity, network trouble, etc. @@ -1446,7 +1436,7 @@ void CoreNetwork::sslErrors(const QList &sslErrors) // Add the error reason if known sslErrorMessage.append(tr(" (Reason: %1)").arg(sslErrors.first().errorString())); } - displayMsg(Message::Info, BufferInfo::StatusBuffer, "", sslErrorMessage); + showMessage(Message::Info, BufferInfo::StatusBuffer, "", sslErrorMessage); // Proceed with the connection socket.ignoreSslErrors(); @@ -1560,7 +1550,7 @@ void CoreNetwork::requestSetNetworkInfo(const NetworkInfo &info) } -QList> CoreNetwork::splitMessage(const QString &cmd, const QString &message, std::function(QString &)> cmdGenerator) +QList> CoreNetwork::splitMessage(const QString &cmd, const QString &message, const std::function(QString &)> &cmdGenerator) { QString wrkMsg(message); QList> msgsToSend; diff --git a/src/core/corenetwork.h b/src/core/corenetwork.h index a7749124..c67d4792 100644 --- a/src/core/corenetwork.h +++ b/src/core/corenetwork.h @@ -135,7 +135,7 @@ public: */ inline bool isPongReplyPending() const { return _pongReplyPending; } - QList> splitMessage(const QString &cmd, const QString &message, std::function(QString &)> cmdGenerator); + QList> splitMessage(const QString &cmd, const QString &message, const std::function(QString &)> &cmdGenerator); // IRCv3 capability negotiation @@ -144,8 +144,7 @@ public: * * @returns True if in progress, otherwise false */ - inline bool capNegotiationInProgress() const { return (!_capsQueuedIndividual.empty() || - !_capsQueuedBundled.empty()); } + inline bool capNegotiationInProgress() const { return (!_capsQueuedIndividual.empty() || !_capsQueuedBundled.empty()); } /** * Queues a capability to be requested. @@ -256,7 +255,7 @@ public slots: */ bool forceDisconnect(int msecs = 1000); - void userInput(BufferInfo bufferInfo, QString msg); + void userInput(const BufferInfo &bufferInfo, QString msg); /** * Sends the raw (encoded) line, adding to the queue if needed, optionally with higher priority. @@ -269,7 +268,7 @@ public slots: * PING/PONG replies, the other side will close the connection. * @endparmblock */ - void putRawLine(const QByteArray input, const bool prepend = false); + void putRawLine(const QByteArray &input, bool prepend = false); /** * Sends the command with encoded parameters, with optional prefix or high priority. @@ -284,7 +283,7 @@ public slots: * maintain PING/PONG replies, the other side will close the connection. * @endparmblock */ - void putCmd(const QString &cmd, const QList ¶ms, const QByteArray &prefix = QByteArray(), const bool prepend = false); + void putCmd(const QString &cmd, const QList ¶ms, const QByteArray &prefix = {}, bool prepend = false); /** * Sends the command for each set of encoded parameters, with optional prefix or high priority. @@ -303,7 +302,7 @@ public slots: * cannot maintain PING/PONG replies, the other side will close the connection. * @endparmblock */ - void putCmd(const QString &cmd, const QList> ¶ms, const QByteArray &prefix = QByteArray(), const bool prependAll = false); + void putCmd(const QString &cmd, const QList> ¶ms, const QByteArray &prefix = {}, bool prependAll = false); void setChannelJoined(const QString &channel); void setChannelParted(const QString &channel); @@ -424,7 +423,7 @@ public slots: */ inline void resetPongReplyPending() { _pongReplyPending = false; } - inline void displayMsg(Message::Type msgType, BufferInfo::Type bufferType, const QString &target, const QString &text, const QString &sender = "", Message::Flags flags = Message::None) + void onDisplayMsg(Message::Type msgType, BufferInfo::Type bufferType, const QString &target, const QString &text, const QString &sender, Message::Flags flags) { emit displayMsg(networkId(), msgType, bufferType, target, text, sender, flags); } @@ -433,7 +432,7 @@ public slots: signals: void recvRawServerMsg(QString); void displayStatusMsg(QString); - void displayMsg(NetworkId, Message::Type, BufferInfo::Type, const QString &target, const QString &text, const QString &sender = "", Message::Flags flags = Message::None); + void displayMsg(NetworkId, Message::Type, BufferInfo::Type, const QString &target, const QString &text, const QString &sender, Message::Flags flags); void disconnected(NetworkId networkId); void connectionError(const QString &errorMsg); @@ -455,12 +454,13 @@ protected slots: //virtual void removeChansAndUsers(); private slots: - void socketHasData(); - void socketError(QAbstractSocket::SocketError); - void socketInitialized(); - void socketCloseTimeout(); - void socketDisconnected(); - void socketStateChanged(QAbstractSocket::SocketState); + void onSocketHasData(); + void onSocketError(QAbstractSocket::SocketError); + void onSocketInitialized(); + void onSocketCloseTimeout(); + void onSocketDisconnected(); + void onSocketStateChanged(QAbstractSocket::SocketState); + void networkInitialized(); void sendPerform(); @@ -473,7 +473,7 @@ private slots: void startAutoWhoCycle(); #ifdef HAVE_SSL - void sslErrors(const QList &errors); + void onSslErrors(const QList &errors); #endif /** @@ -497,6 +497,17 @@ private slots: void writeToSocket(const QByteArray &data); +private: + void showMessage(Message::Type msgType, + BufferInfo::Type bufferType, + const QString &target, + const QString &text, + const QString &sender = "", + Message::Flags flags = Message::None) + { + emit displayMsg(networkId(), msgType, bufferType, target, text, sender, flags); + } + private: CoreSession *_coreSession; diff --git a/src/core/coresession.cpp b/src/core/coresession.cpp index 27805ee1..d258df7f 100644 --- a/src/core/coresession.cpp +++ b/src/core/coresession.cpp @@ -163,7 +163,7 @@ void CoreSession::shutdown() for (CoreNetwork *net : _networks.values()) { if (net->socketState() != QAbstractSocket::UnconnectedState) { _networksPendingDisconnect.insert(net->networkId()); - connect(net, SIGNAL(disconnected(NetworkId)), this, SLOT(onNetworkDisconnected(NetworkId))); + connect(net, &CoreNetwork::disconnected, this, &CoreSession::onNetworkDisconnected); net->shutdown(); } } @@ -269,7 +269,7 @@ void CoreSession::addClient(RemotePeer *peer) void CoreSession::addClient(InternalPeer *peer) { signalProxy()->addPeer(peer); - emit sessionState(sessionState()); + emit sessionStateReceived(sessionState()); } @@ -622,8 +622,7 @@ 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, &CoreNetwork::displayMsg, this, &CoreSession::recvMessageFromServer); connect(net, &CoreNetwork::displayStatusMsg, this, &CoreSession::recvStatusMsgFromServer); connect(net, &CoreNetwork::disconnected, this, &CoreSession::networkDisconnected); @@ -649,8 +648,8 @@ void CoreSession::removeNetwork(NetworkId id) if (net->connectionState() != Network::Disconnected) { // 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); + disconnect(net, &CoreNetwork::displayMsg, this, nullptr); + disconnect(net, &CoreNetwork::displayStatusMsg, this, nullptr); connect(net, &CoreNetwork::disconnected, this, &CoreSession::destroyNetwork); net->disconnectFromIrc(); } diff --git a/src/core/coresession.h b/src/core/coresession.h index ed9b5fea..dade24b3 100644 --- a/src/core/coresession.h +++ b/src/core/coresession.h @@ -167,7 +167,7 @@ public slots: signals: void initialized(); - void sessionState(const Protocol::SessionState &sessionState); + void sessionStateReceived(const Protocol::SessionState &sessionState); //void msgFromGui(uint netid, QString buf, QString message); void displayMsg(Message message); diff --git a/src/core/coretransfer.cpp b/src/core/coretransfer.cpp index 38b693b3..e178cdab 100644 --- a/src/core/coretransfer.cpp +++ b/src/core/coretransfer.cpp @@ -24,6 +24,7 @@ #include #include "coretransfer.h" +#include "util.h" const qint64 chunkSize = 16 * 1024; @@ -124,7 +125,7 @@ void CoreTransfer::setupConnectionForReceive() _socket = new QTcpSocket(this); 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, selectOverload(&QAbstractSocket::error), this, &CoreTransfer::onSocketError); connect(_socket, &QIODevice::readyRead, this, &CoreTransfer::onDataReceived); _socket->connectToHost(address(), port()); diff --git a/src/core/sessionthread.cpp b/src/core/sessionthread.cpp index bdc0a738..80ecdd39 100644 --- a/src/core/sessionthread.cpp +++ b/src/core/sessionthread.cpp @@ -47,7 +47,7 @@ public slots: { _session = new CoreSession{_userId, _restoreState, _strictIdentEnabled, this}; connect(_session, &QObject::destroyed, QThread::currentThread(), &QThread::quit); - connect(_session, SIGNAL(sessionState(Protocol::SessionState)), Core::instance(), SIGNAL(sessionState(Protocol::SessionState))); + connect(_session, &CoreSession::sessionStateReceived, Core::instance(), &Core::sessionStateReceived); emit initialized(); } diff --git a/src/main/monoapplication.cpp b/src/main/monoapplication.cpp index be6f440c..f6dc5221 100644 --- a/src/main/monoapplication.cpp +++ b/src/main/monoapplication.cpp @@ -38,7 +38,7 @@ void MonolithicApplication::init() { QtUiApplication::init(); - connect(Client::coreConnection(), SIGNAL(connectToInternalCore(QPointer)), this, SLOT(onConnectionRequest(QPointer))); + connect(Client::coreConnection(), &CoreConnection::connectToInternalCore, this, &MonolithicApplication::onConnectionRequest); // If port is set, start internal core directly so external clients can connect // This is useful in case the mono client re-gains remote connection capability, @@ -53,7 +53,7 @@ Quassel::QuitHandler MonolithicApplication::quitHandler() { return [this]() { quInfo() << "Client shutting down..."; - connect(_client.get(), SIGNAL(destroyed()), this, SLOT(onClientDestroyed())); + connect(_client.get(), &QObject::destroyed, this, &MonolithicApplication::onClientDestroyed); _client.release()->deleteLater(); }; } @@ -62,7 +62,7 @@ Quassel::QuitHandler MonolithicApplication::quitHandler() void MonolithicApplication::onClientDestroyed() { if (_core) { - connect(_core, SIGNAL(shutdownComplete()), this, SLOT(onCoreShutdown())); + connect(_core, &Core::shutdownComplete, this, &MonolithicApplication::onCoreShutdown); _core->shutdown(); } else { @@ -74,7 +74,7 @@ void MonolithicApplication::onClientDestroyed() void MonolithicApplication::onCoreShutdown() { if (_core) { - connect(_core, SIGNAL(destroyed()), QCoreApplication::instance(), SLOT(quit())); + connect(_core, &QObject::destroyed, QCoreApplication::instance(), &QCoreApplication::quit); _coreThread.quit(); _coreThread.wait(); } @@ -97,8 +97,8 @@ void MonolithicApplication::startInternalCore() 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(this, &MonolithicApplication::connectInternalPeer, _core, &Core::connectInternalPeer); + connect(_core, &Core::sessionStateReceived, Client::coreConnection(), &CoreConnection::internalSessionStateReceived); connect(_core.data(), &Core::dbUpgradeInProgress, Client::instance(), &Client::onDbUpgradeInProgress); connect(_core.data(), &Core::exitRequested, Client::instance(), &Client::onExitRequested); diff --git a/src/qtui/awaylogview.cpp b/src/qtui/awaylogview.cpp index d44868ac..4ff1adc3 100644 --- a/src/qtui/awaylogview.cpp +++ b/src/qtui/awaylogview.cpp @@ -23,6 +23,7 @@ #include #include +#include "action.h" #include "awaylogfilter.h" #include "chatlinemodel.h" #include "chatscene.h" @@ -43,14 +44,16 @@ void AwayLogView::addActionsToMenu(QMenu *menu, const QPointF &pos) if (scene()->columnByScenePos(pos) == ChatLineModel::SenderColumn) { menu->addSeparator(); - QAction *showNetworkAction = menu->addAction(tr("Show Network Name"), this, SLOT(showFieldsChanged(bool))); + auto *showNetworkAction = new Action(tr("Show Network Name"), menu, this, SLOT(showFieldsChanged(bool))); showNetworkAction->setCheckable(true); showNetworkAction->setChecked(filter()->showFields() & ChatMonitorFilter::NetworkField); showNetworkAction->setData(ChatMonitorFilter::NetworkField); + menu->addAction(showNetworkAction); - QAction *showBufferAction = menu->addAction(tr("Show Buffer Name"), this, SLOT(showFieldsChanged(bool))); + auto *showBufferAction = new Action(tr("Show Buffer Name"), menu, this, SLOT(showFieldsChanged(bool))); showBufferAction->setCheckable(true); showBufferAction->setChecked(filter()->showFields() & ChatMonitorFilter::BufferField); showBufferAction->setData(ChatMonitorFilter::BufferField); + menu->addAction(showBufferAction); } } diff --git a/src/qtui/bufferwidget.cpp b/src/qtui/bufferwidget.cpp index f8c4cace..cd93228b 100644 --- a/src/qtui/bufferwidget.cpp +++ b/src/qtui/bufferwidget.cpp @@ -68,7 +68,7 @@ BufferWidget::BufferWidget(QWidget *parent) connect(ui.searchBar->searchDownButton(), &QAbstractButton::clicked, _chatViewSearchController, &ChatViewSearchController::highlightNext); - connect(ui.searchBar, SIGNAL(hidden()), this, SLOT(setFocus())); + connect(ui.searchBar, &ChatViewSearchBar::hidden, this, selectOverload<>(&QWidget::setFocus)); connect(_chatViewSearchController, &ChatViewSearchController::newCurrentHighlight, this, &BufferWidget::scrollToHighlight); diff --git a/src/qtui/chatitem.cpp b/src/qtui/chatitem.cpp index cda1fd8f..d94a2a91 100644 --- a/src/qtui/chatitem.cpp +++ b/src/qtui/chatitem.cpp @@ -33,6 +33,7 @@ #include #include +#include "action.h" #include "buffermodel.h" #include "bufferview.h" #include "chatline.h" @@ -869,10 +870,13 @@ void ContentsChatItem::addActionsToMenu(QMenu *menu, const QPointF &pos) Clickable click = privateData()->currentClickable; switch (click.type()) { case Clickable::Url: + { privateData()->activeClickable = click; - menu->addAction(icon::get("edit-copy"), tr("Copy Link Address"), - &_actionProxy, SLOT(copyLinkToClipboard()))->setData(QVariant::fromValue(this)); + auto action = new Action{icon::get("edit-copy"), tr("Copy Link Address"), menu, &_actionProxy, SLOT(copyLinkToClipboard())}; + action->setData(QVariant::fromValue(this)); + menu->addAction(action); break; + } case Clickable::Channel: { // Remove existing menu actions, they confuse us when right-clicking on a clickable diff --git a/src/qtui/chatmonitorview.cpp b/src/qtui/chatmonitorview.cpp index 71c975b9..a2740c64 100644 --- a/src/qtui/chatmonitorview.cpp +++ b/src/qtui/chatmonitorview.cpp @@ -24,6 +24,7 @@ #include #include +#include "action.h" #include "buffermodel.h" #include "chatmonitorfilter.h" #include "chatlinemodel.h" @@ -54,26 +55,29 @@ void ChatMonitorView::addActionsToMenu(QMenu *menu, const QPointF &pos) { ChatView::addActionsToMenu(menu, pos); menu->addSeparator(); - QAction *showOwnNicksAction = menu->addAction(tr("Show Own Messages"), _filter, SLOT(setShowOwnMessages(bool))); + auto showOwnNicksAction = new Action(tr("Show Own Messages"), menu, _filter, SLOT(setShowOwnMessages(bool))); showOwnNicksAction->setCheckable(true); showOwnNicksAction->setChecked(_filter->showOwnMessages()); + menu->addAction(showOwnNicksAction); if (scene()->columnByScenePos(pos) == ChatLineModel::SenderColumn) { menu->addSeparator(); - QAction *showNetworkAction = menu->addAction(tr("Show Network Name"), this, SLOT(showFieldsChanged(bool))); + auto showNetworkAction = new Action(tr("Show Network Name"), menu, this, SLOT(showFieldsChanged(bool))); showNetworkAction->setCheckable(true); showNetworkAction->setChecked(_filter->showFields() & ChatMonitorFilter::NetworkField); showNetworkAction->setData(ChatMonitorFilter::NetworkField); + menu->addAction(showNetworkAction); - QAction *showBufferAction = menu->addAction(tr("Show Buffer Name"), this, SLOT(showFieldsChanged(bool))); + auto showBufferAction = new Action(tr("Show Buffer Name"), menu, this, SLOT(showFieldsChanged(bool))); showBufferAction->setCheckable(true); showBufferAction->setChecked(_filter->showFields() & ChatMonitorFilter::BufferField); showBufferAction->setData(ChatMonitorFilter::BufferField); + menu->addAction(showBufferAction); } menu->addSeparator(); - menu->addAction(icon::get("configure"), tr("Configure..."), this, SLOT(showSettingsPage())); + menu->addAction(new Action(icon::get("configure"), tr("Configure..."), menu, this, SLOT(showSettingsPage()))); } @@ -124,5 +128,5 @@ void ChatMonitorView::showSettingsPage() void ChatMonitorView::coreConnectionStateChanged(bool connected) { if (connected) - connect(Client::ignoreListManager(), SIGNAL(ignoreListChanged()), _filter, SLOT(invalidateFilter())); + connect(Client::ignoreListManager(), &ClientIgnoreListManager::ignoreListChanged, _filter, &ChatMonitorFilter::invalidateFilter); } diff --git a/src/qtui/chatviewsearchbar.cpp b/src/qtui/chatviewsearchbar.cpp index 3ebf67c9..18b0b438 100644 --- a/src/qtui/chatviewsearchbar.cpp +++ b/src/qtui/chatviewsearchbar.cpp @@ -41,7 +41,7 @@ ChatViewSearchBar::ChatViewSearchBar(QWidget *parent) ActionCollection *coll = QtUi::actionCollection("General"); QAction *toggleSearchBar = coll->action("ToggleSearchBar"); - connect(toggleSearchBar, SIGNAL(toggled(bool)), SLOT(setVisible(bool))); + connect(toggleSearchBar, &QAction::toggled, this, &QWidget::setVisible); auto *hideSearchBar = coll->add("HideSearchBar", toggleSearchBar, SLOT(setChecked(bool))); hideSearchBar->setShortcutConfigurable(false); diff --git a/src/qtui/chatviewsearchcontroller.cpp b/src/qtui/chatviewsearchcontroller.cpp index cff19082..f12bfa01 100644 --- a/src/qtui/chatviewsearchcontroller.cpp +++ b/src/qtui/chatviewsearchcontroller.cpp @@ -70,8 +70,8 @@ void ChatViewSearchController::setScene(ChatScene *scene) return; connect(_scene, &QObject::destroyed, this, &ChatViewSearchController::sceneDestroyed); - connect(_scene, SIGNAL(layoutChanged()), this, SLOT(repositionHighlights())); - connect(Client::messageModel(), SIGNAL(finishedBacklogFetch(BufferId)), this, SLOT(updateHighlights())); + connect(_scene, &ChatScene::layoutChanged, this, [this]() { repositionHighlights(); }); + connect(Client::messageModel(), &MessageModel::finishedBacklogFetch, this, [this]() { updateHighlights(); }); updateHighlights(); } diff --git a/src/qtui/columnhandleitem.cpp b/src/qtui/columnhandleitem.cpp index 0f9aca52..978e6a09 100644 --- a/src/qtui/columnhandleitem.cpp +++ b/src/qtui/columnhandleitem.cpp @@ -47,8 +47,6 @@ ColumnHandleItem::ColumnHandleItem(qreal w, QGraphicsItem *parent) _animation->setDirection(QPropertyAnimation::Forward); _animation->setDuration(350); _animation->setEasingCurve(QEasingCurve::InOutSine); - - //connect(&_timeLine, SIGNAL(valueChanged(qreal)), this, SLOT(hoverChanged(qreal))); } diff --git a/src/qtui/coreconfigwizard.cpp b/src/qtui/coreconfigwizard.cpp index 669d670c..e8305123 100644 --- a/src/qtui/coreconfigwizard.cpp +++ b/src/qtui/coreconfigwizard.cpp @@ -29,6 +29,7 @@ #include "client.h" #include "coreconnection.h" #include "icon.h" +#include "util.h" namespace { @@ -165,7 +166,7 @@ CoreConfigWizard::CoreConfigWizard(CoreConnection *connection, const QVariantLis 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())); + connect(this, &QDialog::rejected, connection, selectOverload<>(&CoreConnection::disconnectFromCore)); // Resize all pages to the size hint of the largest one, so the wizard is large enough diff --git a/src/qtui/coreconnectdlg.cpp b/src/qtui/coreconnectdlg.cpp index 220e28f3..e22bfc54 100644 --- a/src/qtui/coreconnectdlg.cpp +++ b/src/qtui/coreconnectdlg.cpp @@ -48,8 +48,8 @@ CoreConnectDlg::CoreConnectDlg(QWidget *parent) : QDialog(parent) buttonBox->setStandardButtons(QDialogButtonBox::Ok|QDialogButtonBox::Cancel); layout->addWidget(buttonBox); - connect(_settingsPage, SIGNAL(connectToCore(AccountId)), SLOT(accept())); - connect(buttonBox, SIGNAL(accepted()), SLOT(accept())); + connect(_settingsPage, &CoreAccountSettingsPage::connectToCore, this, &QDialog::accept); + connect(buttonBox, &QDialogButtonBox::accepted, this, &QDialog::accept); connect(buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject); } diff --git a/src/qtui/coreinfodlg.cpp b/src/qtui/coreinfodlg.cpp index 13c203d9..d7b1c3c1 100644 --- a/src/qtui/coreinfodlg.cpp +++ b/src/qtui/coreinfodlg.cpp @@ -129,7 +129,7 @@ void CoreInfoDlg::coreInfoChanged(const QVariantMap &coreInfo) { // The layout stretch item should never be removed, so count should always be >= 1. ui.coreSessionContainer->insertWidget(ui.coreSessionContainer->count() - 1, coreSessionWidget, 0, Qt::AlignTop); - connect(coreSessionWidget, SIGNAL(disconnectClicked(int)), this, SLOT(disconnectClicked(int))); + connect(coreSessionWidget, &CoreSessionWidget::disconnectClicked, this, &CoreInfoDlg::disconnectClicked); } } diff --git a/src/qtui/coresessionwidget.cpp b/src/qtui/coresessionwidget.cpp index 29f323e1..c0f96868 100644 --- a/src/qtui/coresessionwidget.cpp +++ b/src/qtui/coresessionwidget.cpp @@ -29,7 +29,7 @@ CoreSessionWidget::CoreSessionWidget(QWidget *parent) : QWidget(parent) { ui.setupUi(this); - connect(ui.disconnectButton, SIGNAL(released()), this, SLOT(disconnectClicked())); + connect(ui.disconnectButton, &QPushButton::released, this, &CoreSessionWidget::onDisconnectClicked); } void CoreSessionWidget::setData(QMap map) @@ -78,7 +78,7 @@ void CoreSessionWidget::setData(QMap map) if (!success) _peerId = -1; } -void CoreSessionWidget::disconnectClicked() +void CoreSessionWidget::onDisconnectClicked() { // Don't allow the End Session button to be spammed; Quassel's protocol isn't lossy and it // should reach the destination eventually... diff --git a/src/qtui/coresessionwidget.h b/src/qtui/coresessionwidget.h index 0a5ff267..07eae95c 100644 --- a/src/qtui/coresessionwidget.h +++ b/src/qtui/coresessionwidget.h @@ -37,7 +37,7 @@ signals: void disconnectClicked(int); private slots: - void disconnectClicked(); + void onDisconnectClicked(); private: Ui::CoreSessionWidget ui; diff --git a/src/qtui/debugbufferviewoverlay.cpp b/src/qtui/debugbufferviewoverlay.cpp index e5a0ed59..23b48b84 100644 --- a/src/qtui/debugbufferviewoverlay.cpp +++ b/src/qtui/debugbufferviewoverlay.cpp @@ -60,7 +60,7 @@ DebugBufferViewOverlay::DebugBufferViewOverlay(QWidget *parent) layout->addRow(tr("Is initialized:"), _isInitialized = new QLabel(this)); update(); - connect(Client::bufferViewOverlay(), SIGNAL(hasChanged()), this, SLOT(update())); + connect(Client::bufferViewOverlay(), &BufferViewOverlay::hasChanged, this, &DebugBufferViewOverlay::update); } diff --git a/src/qtui/dockmanagernotificationbackend.cpp b/src/qtui/dockmanagernotificationbackend.cpp index a243022f..2a6ea9bf 100644 --- a/src/qtui/dockmanagernotificationbackend.cpp +++ b/src/qtui/dockmanagernotificationbackend.cpp @@ -28,6 +28,7 @@ #include "clientsettings.h" #include "coreconnection.h" #include "clientbacklogmanager.h" +#include "util.h" DockManagerNotificationBackend::DockManagerNotificationBackend(QObject *parent) : AbstractNotificationBackend(parent), _bus(QDBusConnection::sessionBus()) @@ -54,7 +55,7 @@ DockManagerNotificationBackend::DockManagerNotificationBackend(QObject *parent) itemAdded(QDBusObjectPath()); - connect(Client::coreConnection(), SIGNAL(progressValueChanged(int)), this, SLOT(updateProgress(int))); + connect(Client::coreConnection(), &CoreConnection::progressValueChanged, this, selectOverload(&DockManagerNotificationBackend::updateProgress)); connect(Client::coreConnection(), &CoreConnection::synchronized, this, &DockManagerNotificationBackend::synchronized); } @@ -123,7 +124,7 @@ void DockManagerNotificationBackend::updateProgress(int done, int total) void DockManagerNotificationBackend::synchronized() { - connect(Client::backlogManager(), SIGNAL(updateProgress(int, int)), this, SLOT(updateProgress(int, int))); + connect(Client::backlogManager(), &ClientBacklogManager::updateProgress, this, selectOverload(&DockManagerNotificationBackend::updateProgress)); } diff --git a/src/qtui/inputwidget.cpp b/src/qtui/inputwidget.cpp index f93c7d96..891501e8 100644 --- a/src/qtui/inputwidget.cpp +++ b/src/qtui/inputwidget.cpp @@ -35,6 +35,7 @@ #include "qtui.h" #include "qtuisettings.h" #include "tabcompleter.h" +#include "util.h" const int leftMargin = 3; @@ -43,7 +44,7 @@ InputWidget::InputWidget(QWidget *parent) _networkId(0) { ui.setupUi(this); - connect(ui.ownNick, SIGNAL(activated(QString)), this, SLOT(changeNick(QString))); + connect(ui.ownNick, selectOverload(&QComboBox::activated), this, &InputWidget::changeNick); layout()->setAlignment(ui.ownNick, Qt::AlignBottom); layout()->setAlignment(ui.inputEdit, Qt::AlignBottom); @@ -145,7 +146,7 @@ InputWidget::InputWidget(QWidget *parent) ActionCollection *coll = QtUi::actionCollection(); auto *activateInputline = coll->add("FocusInputLine"); - connect(activateInputline, SIGNAL(triggered()), SLOT(setFocus())); + connect(activateInputline, &QAction::triggered, this, selectOverload<>(&QWidget::setFocus)); activateInputline->setText(tr("Focus Input Line")); activateInputline->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_L)); diff --git a/src/qtui/knotificationbackend.cpp b/src/qtui/knotificationbackend.cpp index 9ca881ef..4faea24c 100644 --- a/src/qtui/knotificationbackend.cpp +++ b/src/qtui/knotificationbackend.cpp @@ -31,12 +31,13 @@ #include "mainwin.h" #include "networkmodel.h" #include "qtui.h" +#include "util.h" KNotificationBackend::KNotificationBackend(QObject *parent) : AbstractNotificationBackend(parent) { - connect(QtUi::mainWindow()->systemTray(), SIGNAL(activated(SystemTray::ActivationReason)), - SLOT(notificationActivated(SystemTray::ActivationReason))); + connect(QtUi::mainWindow()->systemTray(), &SystemTray::activated, + this, selectOverload(&KNotificationBackend::notificationActivated)); updateToolTip(); } @@ -61,7 +62,7 @@ void KNotificationBackend::notify(const Notification &n) KNotification::RaiseWidgetOnActivation |KNotification::CloseWhenWidgetActivated |KNotification::CloseOnTimeout); - connect(notification, SIGNAL(activated(uint)), SLOT(notificationActivated())); + connect(notification, selectOverload(&KNotification::activated), this, selectOverload<>(&KNotificationBackend::notificationActivated)); notification->setActions(QStringList("View")); notification->setProperty("notificationId", n.notificationId); @@ -145,7 +146,7 @@ KNotificationBackend::ConfigWidget::ConfigWidget(QWidget *parent) : SettingsPage QVBoxLayout *layout = new QVBoxLayout(this); layout->addWidget(_widget); - connect(_widget, SIGNAL(changed(bool)), SLOT(widgetChanged(bool))); + connect(_widget, &KNotifyConfigWidget::changed, this, &ConfigWidget::widgetChanged); } diff --git a/src/qtui/mainwin.cpp b/src/qtui/mainwin.cpp index cccca9fb..48bbcce9 100644 --- a/src/qtui/mainwin.cpp +++ b/src/qtui/mainwin.cpp @@ -264,7 +264,7 @@ void MainWin::init() // we assume that at this point, all configurable actions are defined! QtUi::loadShortcuts(); - connect(bufferWidget(), SIGNAL(currentChanged(BufferId)), SLOT(currentBufferChanged(BufferId))); + connect(bufferWidget(), selectOverload(&AbstractBufferContainer::currentChanged), this, &MainWin::currentBufferChanged); setDisconnectedState(); // Disable menus and stuff @@ -640,7 +640,7 @@ void MainWin::setupMenus() showMenuBar->setChecked(enabled); enabled ? menuBar()->show() : menuBar()->hide(); - connect(showMenuBar, SIGNAL(toggled(bool)), menuBar(), SLOT(setVisible(bool))); + connect(showMenuBar, &QAction::toggled, menuBar(), &QMenuBar::setVisible); connect(showMenuBar, &QAction::toggled, this, &MainWin::saveMenuBarStatus); } @@ -976,7 +976,7 @@ void MainWin::setupNickWidget() nickDock->toggleViewAction()->setText(tr("Show Nick List")); // See NickListDock::NickListDock(); - // connect(nickDock->toggleViewAction(), SIGNAL(triggered(bool)), nickListWidget, SLOT(showWidget(bool))); + // connect(nickDock->toggleViewAction(), &NickListDock::triggered, nickListWidget, &QWidget::showWidget); // attach the NickListWidget to the BufferModel and the default selection _nickListWidget->setModel(Client::bufferModel()); @@ -1020,8 +1020,6 @@ void MainWin::setupInputWidget() _inputWidget->setSelectionModel(Client::bufferModel()->standardSelectionModel()); _inputWidget->inputLine()->installEventFilter(_bufferWidget); - - connect(_topicWidget, SIGNAL(switchedPlain()), _bufferWidget, SLOT(setFocus())); } @@ -1036,6 +1034,8 @@ void MainWin::setupTopicWidget() _topicWidget->setModel(Client::bufferModel()); _topicWidget->setSelectionModel(Client::bufferModel()->standardSelectionModel()); + connect(_topicWidget, &TopicWidget::switchedPlain, _bufferWidget, selectOverload<>(&QWidget::setFocus)); + addDockWidget(Qt::TopDockWidgetArea, dock, Qt::Vertical); _viewMenu->addAction(dock->toggleViewAction()); @@ -1098,7 +1098,9 @@ void MainWin::setupStatusBar() connect(showStatusbar, &QAction::toggled, statusBar(), &QWidget::setVisible); connect(showStatusbar, &QAction::toggled, this, &MainWin::saveStatusBarStatus); - connect(Client::coreConnection(), SIGNAL(connectionMsg(QString)), statusBar(), SLOT(showMessage(QString))); + connect(Client::coreConnection(), &CoreConnection::connectionMsg, statusBar(), [statusBar = statusBar()](auto &&message) { + statusBar->showMessage(message); + }); } @@ -1138,10 +1140,10 @@ void MainWin::setupSystray() void MainWin::setupToolBars() { - connect(_bufferWidget, SIGNAL(currentChanged(QModelIndex)), - QtUi::toolBarActionProvider(), SLOT(currentBufferChanged(QModelIndex))); - connect(_nickListWidget, SIGNAL(nickSelectionChanged(QModelIndexList)), - QtUi::toolBarActionProvider(), SLOT(nickSelectionChanged(QModelIndexList))); + connect(_bufferWidget, selectOverload(&AbstractBufferContainer::currentChanged), + QtUi::toolBarActionProvider(), &ToolBarActionProvider::onCurrentBufferChanged); + connect(_nickListWidget, &NickListWidget::nickSelectionChanged, + QtUi::toolBarActionProvider(), &ToolBarActionProvider::onNickSelectionChanged); #ifdef Q_OS_MAC setUnifiedTitleAndToolBarOnMac(true); @@ -1186,7 +1188,7 @@ void MainWin::setupToolBars() bool visible = uiSettings.value("ShowMainToolBar", QVariant(true)).toBool(); _mainToolBar->setVisible(visible); - connect(_mainToolBar, SIGNAL(visibilityChanged(bool)), this, SLOT(saveMainToolBarStatus(bool))); + connect(_mainToolBar, &QToolBar::visibilityChanged, this, &MainWin::saveMainToolBarStatus); #endif } @@ -1213,7 +1215,7 @@ void MainWin::doAutoConnect() void MainWin::connectedToCore() { Q_CHECK_PTR(Client::bufferViewManager()); - connect(Client::bufferViewManager(), SIGNAL(bufferViewConfigAdded(int)), this, SLOT(addBufferView(int))); + connect(Client::bufferViewManager(), &BufferViewManager::bufferViewConfigAdded, this, selectOverload(&MainWin::addBufferView)); connect(Client::bufferViewManager(), &BufferViewManager::bufferViewConfigDeleted, this, &MainWin::removeBufferView); connect(Client::bufferViewManager(), &SyncableObject::initDone, this, &MainWin::loadLayout); diff --git a/src/qtui/nicklistwidget.cpp b/src/qtui/nicklistwidget.cpp index a47e5092..7d683e6a 100644 --- a/src/qtui/nicklistwidget.cpp +++ b/src/qtui/nicklistwidget.cpp @@ -142,13 +142,13 @@ void NickListWidget::currentChanged(const QModelIndex ¤t, const QModelInde nickViews[newBufferId] = view; ui.stackedWidget->addWidget(view); ui.stackedWidget->setCurrentWidget(view); - connect(view, SIGNAL(selectionUpdated()), SLOT(nickSelectionChanged())); + connect(view, &NickView::selectionUpdated, this, &NickListWidget::onNickSelectionChanged); } emit nickSelectionChanged(view->selectedIndexes()); } -void NickListWidget::nickSelectionChanged() +void NickListWidget::onNickSelectionChanged() { auto *view = qobject_cast(sender()); Q_ASSERT(view); diff --git a/src/qtui/nicklistwidget.h b/src/qtui/nicklistwidget.h index a4e5ecbb..97ae4a0c 100644 --- a/src/qtui/nicklistwidget.h +++ b/src/qtui/nicklistwidget.h @@ -57,9 +57,9 @@ protected slots: void currentChanged(const QModelIndex ¤t, const QModelIndex &previous) override; void rowsAboutToBeRemoved(const QModelIndex &parent, int start, int end) override; -private slots: +private: void removeBuffer(BufferId bufferId); - void nickSelectionChanged(); + void onNickSelectionChanged(); private: Ui::NickListWidget ui; diff --git a/src/qtui/osxnotificationbackend.mm b/src/qtui/osxnotificationbackend.mm index 738ee265..5294431a 100644 --- a/src/qtui/osxnotificationbackend.mm +++ b/src/qtui/osxnotificationbackend.mm @@ -86,7 +86,7 @@ OSXNotificationBackend::ConfigWidget::ConfigWidget(QWidget *parent) : SettingsPage("Internal", "OSXNotification", parent) { _enabledBox = new QCheckBox(tr("Show OS X notifications")); - connect(_enabledBox, SIGNAL(toggled(bool)), this, SLOT(widgetChanged())); + connect(_enabledBox, &QCheckBox::toggled, this, &ConfigWidget::widgetChanged); QHBoxLayout *layout = new QHBoxLayout(this); layout->addWidget(_enabledBox); } diff --git a/src/qtui/qtui.cpp b/src/qtui/qtui.cpp index ea430c8c..3bdb6e1c 100644 --- a/src/qtui/qtui.cpp +++ b/src/qtui/qtui.cpp @@ -167,7 +167,7 @@ void QtUi::registerNotificationBackend(AbstractNotificationBackend *backend) { if (!_notificationBackends.contains(backend)) { _notificationBackends.append(backend); - instance()->connect(backend, SIGNAL(activated(uint)), SLOT(notificationActivated(uint))); + connect(backend, &AbstractNotificationBackend::activated, instance(), &QtUi::notificationActivated); } } diff --git a/src/qtui/qtuiapplication.cpp b/src/qtui/qtuiapplication.cpp index 9eea3c61..2438d9cc 100644 --- a/src/qtui/qtuiapplication.cpp +++ b/src/qtui/qtuiapplication.cpp @@ -68,7 +68,7 @@ Quassel::QuitHandler QtUiApplication::quitHandler() // Wait until the Client instance is destroyed before quitting the event loop return [this]() { quInfo() << "Client shutting down..."; - connect(_client.get(), SIGNAL(destroyed()), QCoreApplication::instance(), SLOT(quit())); + connect(_client.get(), &QObject::destroyed, QCoreApplication::instance(), &QCoreApplication::quit); _client.release()->deleteLater(); }; } diff --git a/src/qtui/qtuimessageprocessor.cpp b/src/qtui/qtuimessageprocessor.cpp index 64ceeed1..cb9cd8fd 100644 --- a/src/qtui/qtuimessageprocessor.cpp +++ b/src/qtui/qtuimessageprocessor.cpp @@ -219,6 +219,13 @@ void QtUiMessageProcessor::highlightNickChanged(const QVariant &variant) } +void QtUiMessageProcessor::networkRemoved(NetworkId id) +{ + // Clean up nickname matching cache + _nickMatcher.removeNetwork(id); +} + + /************************************************************************** * LegacyHighlightRule *************************************************************************/ diff --git a/src/qtui/qtuimessageprocessor.h b/src/qtui/qtuimessageprocessor.h index 3b331324..f31f75b9 100644 --- a/src/qtui/qtuimessageprocessor.h +++ b/src/qtui/qtuimessageprocessor.h @@ -56,10 +56,7 @@ public slots: * * @param id Network ID of removed network */ - inline void networkRemoved(NetworkId id) { - // Clean up nickname matching cache - _nickMatcher.removeNetwork(id); - } + void networkRemoved(NetworkId id) override; private slots: void processNextMessage(); diff --git a/src/qtui/settingsdlg.cpp b/src/qtui/settingsdlg.cpp index 3cd2f237..56c3cdc3 100644 --- a/src/qtui/settingsdlg.cpp +++ b/src/qtui/settingsdlg.cpp @@ -75,7 +75,7 @@ void SettingsDlg::registerSettingsPage(SettingsPage *sp) sp->setParent(ui.settingsStack); ui.settingsStack->addWidget(sp); - connect(sp, SIGNAL(changed(bool)), this, SLOT(setButtonStates())); + connect(sp, &SettingsPage::changed, this, &SettingsDlg::setButtonStates); QTreeWidgetItem *cat; QList cats = ui.settingsTree->findItems(sp->category(), Qt::MatchExactly); diff --git a/src/qtui/settingspagedlg.cpp b/src/qtui/settingspagedlg.cpp index 49e03d53..48a660b8 100644 --- a/src/qtui/settingspagedlg.cpp +++ b/src/qtui/settingspagedlg.cpp @@ -45,7 +45,7 @@ SettingsPageDlg::SettingsPageDlg(SettingsPage *page, QWidget *parent) updateGeometry(); - connect(page, SIGNAL(changed(bool)), this, SLOT(setButtonStates())); + connect(page, &SettingsPage::changed, this, &SettingsPageDlg::setButtonStates); 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 47a701ea..54dbfd9b 100644 --- a/src/qtui/settingspages/aliasesmodel.cpp +++ b/src/qtui/settingspages/aliasesmodel.cpp @@ -323,7 +323,7 @@ void AliasesModel::initDone() void AliasesModel::clientConnected() { - connect(Client::aliasManager(), SIGNAL(updated()), SLOT(revert())); + connect(Client::aliasManager(), &AliasManager::updated, this, &AliasesModel::revert); if (Client::aliasManager()->isInitialized()) initDone(); else diff --git a/src/qtui/settingspages/aliasesmodel.h b/src/qtui/settingspages/aliasesmodel.h index dc6b08fe..0bc93e84 100644 --- a/src/qtui/settingspages/aliasesmodel.h +++ b/src/qtui/settingspages/aliasesmodel.h @@ -47,7 +47,7 @@ public: inline int rowCount(const QModelIndex &parent = QModelIndex()) const override; inline int columnCount(const QModelIndex &parent = QModelIndex()) const override; - inline bool configChanged() const { return _configChanged; } + inline bool hasConfigChanged() const { return _configChanged; } inline bool isReady() const { return _modelReady; } public slots: diff --git a/src/qtui/settingspages/aliasessettingspage.cpp b/src/qtui/settingspages/aliasessettingspage.cpp index a159eb3c..20aa1a8b 100644 --- a/src/qtui/settingspages/aliasessettingspage.cpp +++ b/src/qtui/settingspages/aliasessettingspage.cpp @@ -43,7 +43,7 @@ AliasesSettingsPage::AliasesSettingsPage(QWidget *parent) 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, &AliasesModel::configChanged, this, &AliasesSettingsPage::setChangedState); connect(&_aliasesModel, &AliasesModel::modelReady, this, &AliasesSettingsPage::enableDialog); enableDialog(_aliasesModel.isReady()); @@ -52,7 +52,7 @@ AliasesSettingsPage::AliasesSettingsPage(QWidget *parent) void AliasesSettingsPage::load() { - if (_aliasesModel.configChanged()) + if (_aliasesModel.hasConfigChanged()) _aliasesModel.revert(); } @@ -65,7 +65,7 @@ void AliasesSettingsPage::defaults() void AliasesSettingsPage::save() { - if (_aliasesModel.configChanged()) + if (_aliasesModel.hasConfigChanged()) _aliasesModel.commit(); } diff --git a/src/qtui/settingspages/appearancesettingspage.cpp b/src/qtui/settingspages/appearancesettingspage.cpp index cc713bea..d193b415 100644 --- a/src/qtui/settingspages/appearancesettingspage.cpp +++ b/src/qtui/settingspages/appearancesettingspage.cpp @@ -54,7 +54,7 @@ AppearanceSettingsPage::AppearanceSettingsPage(QWidget *parent) initIconThemeComboBox(); foreach(QComboBox *comboBox, findChildren()) { - connect(comboBox, SIGNAL(currentIndexChanged(QString)), this, SLOT(widgetHasChanged())); + connect(comboBox, selectOverload(&QComboBox::currentIndexChanged), this, &AppearanceSettingsPage::widgetHasChanged); } foreach(QCheckBox *checkBox, findChildren()) { connect(checkBox, &QAbstractButton::clicked, this, &AppearanceSettingsPage::widgetHasChanged); diff --git a/src/qtui/settingspages/backlogsettingspage.cpp b/src/qtui/settingspages/backlogsettingspage.cpp index 12022dd6..f0ec4ab6 100644 --- a/src/qtui/settingspages/backlogsettingspage.cpp +++ b/src/qtui/settingspages/backlogsettingspage.cpp @@ -36,7 +36,7 @@ BacklogSettingsPage::BacklogSettingsPage(QWidget *parent) // FIXME: global backlog requester disabled until issues ruled out ui.requesterType->removeItem(2); - connect(ui.requesterType, SIGNAL(currentIndexChanged(int)), this, SLOT(widgetHasChanged())); + connect(ui.requesterType, selectOverload(&QComboBox::currentIndexChanged), this, &BacklogSettingsPage::widgetHasChanged); } diff --git a/src/qtui/settingspages/bufferviewsettingspage.cpp b/src/qtui/settingspages/bufferviewsettingspage.cpp index b27e1ae2..029f1201 100644 --- a/src/qtui/settingspages/bufferviewsettingspage.cpp +++ b/src/qtui/settingspages/bufferviewsettingspage.cpp @@ -63,11 +63,11 @@ BufferViewSettingsPage::BufferViewSettingsPage(QWidget *parent) 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.networkSelector, selectOverload(&QComboBox::currentIndexChanged), this, &BufferViewSettingsPage::widgetHasChanged); + connect(ui.minimumActivitySelector, selectOverload(&QComboBox::currentIndexChanged), this, &BufferViewSettingsPage::widgetHasChanged); connect(ui.showSearch, &QAbstractButton::clicked, this, &BufferViewSettingsPage::widgetHasChanged); - connect(ui.networkSelector, SIGNAL(currentIndexChanged(int)), this, SLOT(enableStatusBuffers(int))); + connect(ui.networkSelector, selectOverload(&QComboBox::currentIndexChanged), this, &BufferViewSettingsPage::enableStatusBuffers); } @@ -194,7 +194,8 @@ void BufferViewSettingsPage::coreConnectionStateChanged(bool state) setEnabled(state); if (state) { load(); - connect(Client::bufferViewManager(), SIGNAL(bufferViewConfigAdded(int)), this, SLOT(addBufferView(int))); + connect(Client::bufferViewManager(), selectOverload(&BufferViewManager::bufferViewConfigAdded), + this, selectOverload(&BufferViewSettingsPage::addBufferView)); } else { reset(); @@ -339,7 +340,7 @@ void BufferViewSettingsPage::on_addBufferView_clicked() BufferViewEditDlg dlg(QString(), existing, this); if (dlg.exec() == QDialog::Accepted) { newBufferView(dlg.bufferViewName()); - changed(); + setChangedState(true); } } @@ -366,7 +367,7 @@ void BufferViewSettingsPage::on_renameBufferView_clicked() BufferViewConfig *changedConfig = cloneConfig(config); changedConfig->setBufferViewName(dlg.bufferViewName()); ui.bufferViewList->item(listPos(config))->setText(dlg.bufferViewName()); - changed(); + setChangedState(true); } } @@ -389,7 +390,7 @@ void BufferViewSettingsPage::on_deleteBufferView_clicked() delete currentItem; if (viewId >= 0) { _deleteBufferViews << viewId; - changed(); + setChangedState(true); } else if (config) { QList::iterator iter = _newBufferViews.begin(); @@ -547,9 +548,9 @@ BufferViewConfig *BufferViewSettingsPage::cloneConfig(BufferViewConfig *config) 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 &))); + // connect(config, &BufferViewConfig::addBufferRequested, changedConfig, &BufferViewConfig::addBuffer); + // connect(config, &BufferViewConfig::moveBufferRequested, changedConfig, &BufferViewConfig::moveBuffer); + // connect(config, &BufferViewconfig::removeBufferRequested, changedConfig, &BufferViewConfig::removeBuffer); changedConfig->setProperty("OriginalBufferList", toVariantList(config->bufferList())); // if this is the currently displayed view we have to change the config of the preview filter diff --git a/src/qtui/settingspages/chatmonitorsettingspage.cpp b/src/qtui/settingspages/chatmonitorsettingspage.cpp index 460c872d..bf546b1d 100644 --- a/src/qtui/settingspages/chatmonitorsettingspage.cpp +++ b/src/qtui/settingspages/chatmonitorsettingspage.cpp @@ -60,7 +60,7 @@ ChatMonitorSettingsPage::ChatMonitorSettingsPage(QWidget *parent) ui.operationMode->addItem(tr("Opt Out"), ChatViewSettings::OptOut); // connect slots - connect(ui.operationMode, SIGNAL(currentIndexChanged(int)), SLOT(switchOperationMode(int))); + connect(ui.operationMode, selectOverload(&QComboBox::currentIndexChanged), this, &ChatMonitorSettingsPage::switchOperationMode); connect(ui.showHighlights, &QAbstractButton::toggled, this, &ChatMonitorSettingsPage::widgetHasChanged); connect(ui.showOwnMessages, &QAbstractButton::toggled, this, &ChatMonitorSettingsPage::widgetHasChanged); connect(ui.alwaysOwn, &QAbstractButton::toggled, this, &ChatMonitorSettingsPage::widgetHasChanged); diff --git a/src/qtui/settingspages/coreaccountsettingspage.cpp b/src/qtui/settingspages/coreaccountsettingspage.cpp index 7665ce03..f732030f 100644 --- a/src/qtui/settingspages/coreaccountsettingspage.cpp +++ b/src/qtui/settingspages/coreaccountsettingspage.cpp @@ -24,6 +24,7 @@ #include "clientsettings.h" #include "coreaccountmodel.h" #include "icon.h" +#include "util.h" CoreAccountSettingsPage::CoreAccountSettingsPage(QWidget *parent) : SettingsPage(tr("Remote Cores"), QString(), parent), @@ -46,7 +47,7 @@ CoreAccountSettingsPage::CoreAccountSettingsPage(QWidget *parent) connect(filteredModel(), &QAbstractItemModel::rowsInserted, this, &CoreAccountSettingsPage::rowsInserted); connect(ui.accountView->selectionModel(), &QItemSelectionModel::selectionChanged, this, &CoreAccountSettingsPage::setWidgetStates); - connect(ui.autoConnectAccount, SIGNAL(currentIndexChanged(int)), SLOT(widgetHasChanged())); + connect(ui.autoConnectAccount, selectOverload(&QComboBox::currentIndexChanged), this, &CoreAccountSettingsPage::widgetHasChanged); setWidgetStates(); } diff --git a/src/qtui/settingspages/corehighlightsettingspage.cpp b/src/qtui/settingspages/corehighlightsettingspage.cpp index 923858dd..43957247 100644 --- a/src/qtui/settingspages/corehighlightsettingspage.cpp +++ b/src/qtui/settingspages/corehighlightsettingspage.cpp @@ -26,6 +26,7 @@ #include "corehighlightsettingspage.h" #include "icon.h" #include "qtui.h" +#include "util.h" CoreHighlightSettingsPage::CoreHighlightSettingsPage(QWidget *parent) : SettingsPage(tr("Interface"), @@ -46,30 +47,20 @@ CoreHighlightSettingsPage::CoreHighlightSettingsPage(QWidget *parent) coreConnectionStateChanged(Client::isConnected()); // need a core connection! connect(Client::instance(), &Client::coreConnectionStateChanged, this, &CoreHighlightSettingsPage::coreConnectionStateChanged); - connect(ui.highlightAdd, SIGNAL(clicked(bool)), this, SLOT(addNewHighlightRow())); + connect(ui.highlightAdd, &QAbstractButton::clicked, this, [this]() { addNewHighlightRow(); }); 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.ignoredAdd, &QAbstractButton::clicked, this, [this]() { addNewIgnoredRow(); }); 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, - &QTableWidget::itemClicked, - this, - &CoreHighlightSettingsPage::selectHighlightRow); - connect(ui.ignoredTable, - &QTableWidget::itemClicked, - this, - &CoreHighlightSettingsPage::selectIgnoredRow); + connect(ui.highlightTable, &QTableWidget::itemClicked, this, &CoreHighlightSettingsPage::selectHighlightRow); + connect(ui.ignoredTable, &QTableWidget::itemClicked, this, &CoreHighlightSettingsPage::selectIgnoredRow); // Update the "Case sensitive" checkbox - connect(ui.highlightNicksComboBox, - SIGNAL(currentIndexChanged(int)), - this, - SLOT(highlightNicksChanged(int))); - - connect(ui.highlightNicksComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(widgetHasChanged())); + connect(ui.highlightNicksComboBox, selectOverload(&QComboBox::currentIndexChanged), this, &CoreHighlightSettingsPage::highlightNicksChanged); + connect(ui.highlightNicksComboBox, selectOverload(&QComboBox::currentIndexChanged), this, &CoreHighlightSettingsPage::widgetHasChanged); connect(ui.nicksCaseSensitive, &QAbstractButton::clicked, this, &CoreHighlightSettingsPage::widgetHasChanged); connect(ui.highlightAdd, &QAbstractButton::clicked, this, &CoreHighlightSettingsPage::widgetHasChanged); diff --git a/src/qtui/settingspages/dccsettingspage.cpp b/src/qtui/settingspages/dccsettingspage.cpp index 084236c5..f84a81af 100644 --- a/src/qtui/settingspages/dccsettingspage.cpp +++ b/src/qtui/settingspages/dccsettingspage.cpp @@ -22,14 +22,15 @@ #include "client.h" #include "clienttransfermanager.h" +#include "util.h" DccSettingsPage::DccSettingsPage(QWidget *parent) : SettingsPage(tr("IRC"), tr("DCC"), parent) { ui.setupUi(this); initAutoWidgets(); - connect(ui.ipDetectionMode, SIGNAL(currentIndexChanged(int)), SLOT(updateWidgetStates())); - connect(ui.portSelectionMode, SIGNAL(currentIndexChanged(int)), SLOT(updateWidgetStates())); + connect(ui.ipDetectionMode, selectOverload(&QComboBox::currentIndexChanged), this, &DccSettingsPage::updateWidgetStates); + connect(ui.portSelectionMode, selectOverload(&QComboBox::currentIndexChanged), this, &DccSettingsPage::updateWidgetStates); updateWidgetStates(); connect(Client::instance(), &Client::coreConnectionStateChanged, this, &DccSettingsPage::onClientConfigChanged); @@ -56,7 +57,7 @@ void DccSettingsPage::setClientConfig(DccConfig *config) } _clientConfig = config; if (_clientConfig) { - connect(_clientConfig, SIGNAL(updated()), SLOT(load())); + connect(_clientConfig, &DccConfig::updated, this, &DccSettingsPage::load); load(); ui.dccEnabled->setEnabled(true); } diff --git a/src/qtui/settingspages/highlightsettingspage.cpp b/src/qtui/settingspages/highlightsettingspage.cpp index ae2b90a6..f881645f 100644 --- a/src/qtui/settingspages/highlightsettingspage.cpp +++ b/src/qtui/settingspages/highlightsettingspage.cpp @@ -99,7 +99,7 @@ HighlightSettingsPage::HighlightSettingsPage(QWidget *parent) ui.localHighlightsLabel->setText(tr("Local Highlights apply to this device only")); } - connect(ui.add, SIGNAL(clicked(bool)), this, SLOT(addNewRow())); + connect(ui.add, &QAbstractButton::clicked, this, [this]() { addNewRow(); }); 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, &QTableWidget::itemClicked, this, &HighlightSettingsPage::selectRow); diff --git a/src/qtui/settingspages/identitiessettingspage.cpp b/src/qtui/settingspages/identitiessettingspage.cpp index af62c9ef..027dd34c 100644 --- a/src/qtui/settingspages/identitiessettingspage.cpp +++ b/src/qtui/settingspages/identitiessettingspage.cpp @@ -48,8 +48,6 @@ IdentitiesSettingsPage::IdentitiesSettingsPage(QWidget *parent) #endif currentId = 0; - - //connect(ui.identityList, SIGNAL(editTextChanged(const QString &)), this, SLOT(widgetHasChanged())); } diff --git a/src/qtui/settingspages/identityeditwidget.cpp b/src/qtui/settingspages/identityeditwidget.cpp index 9fdff267..0e553071 100644 --- a/src/qtui/settingspages/identityeditwidget.cpp +++ b/src/qtui/settingspages/identityeditwidget.cpp @@ -30,6 +30,7 @@ #include "client.h" #include "icon.h" +#include "util.h" IdentityEditWidget::IdentityEditWidget(QWidget *parent) : QWidget(parent) @@ -48,7 +49,7 @@ IdentityEditWidget::IdentityEditWidget(QWidget *parent) 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.autoAwayTime, selectOverload(&QSpinBox::valueChanged), this, &IdentityEditWidget::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); @@ -64,8 +65,8 @@ IdentityEditWidget::IdentityEditWidget(QWidget *parent) 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())); - //connect(ui.nicknameList->model(), SIGNAL(rowsInserted(const QModelIndex &, int, int)), this, SLOT(nicklistHasChanged())); + //connect(ui.nicknameList, &QListWidget::rowsInserted, this, &IdentityEditWidget::setWidgetStates); + //connect(ui.nicknameList->model(), &NickListModel::rowsInserted, this, IdentityEditWidget::nicklistHasChanged); // disabling unused stuff ui.autoAwayEnabled->hide(); diff --git a/src/qtui/settingspages/ignorelistmodel.cpp b/src/qtui/settingspages/ignorelistmodel.cpp index 74df6e12..774c4250 100644 --- a/src/qtui/settingspages/ignorelistmodel.cpp +++ b/src/qtui/settingspages/ignorelistmodel.cpp @@ -289,7 +289,7 @@ void IgnoreListModel::initDone() void IgnoreListModel::clientConnected() { - connect(Client::ignoreListManager(), SIGNAL(updated()), SLOT(revert())); + connect(Client::ignoreListManager(), &IgnoreListManager::updated, this, &IgnoreListModel::revert); if (Client::ignoreListManager()->isInitialized()) initDone(); else diff --git a/src/qtui/settingspages/ignorelistmodel.h b/src/qtui/settingspages/ignorelistmodel.h index 4af351e7..9a3a44b7 100644 --- a/src/qtui/settingspages/ignorelistmodel.h +++ b/src/qtui/settingspages/ignorelistmodel.h @@ -47,7 +47,7 @@ public: inline int rowCount(const QModelIndex &parent = QModelIndex()) const override; inline int columnCount(const QModelIndex &parent = QModelIndex()) const override; - inline bool configChanged() const { return _configChanged; } + inline bool hasConfigChanged() const { return _configChanged; } inline bool isReady() const { return _modelReady; } const IgnoreListManager::IgnoreListItem &ignoreListItemAt(int row) const; diff --git a/src/qtui/settingspages/ignorelistsettingspage.cpp b/src/qtui/settingspages/ignorelistsettingspage.cpp index 6a942e4c..3af49309 100644 --- a/src/qtui/settingspages/ignorelistsettingspage.cpp +++ b/src/qtui/settingspages/ignorelistsettingspage.cpp @@ -30,8 +30,8 @@ #include #include "expressionmatch.h" - #include "icon.h" +#include "util.h" IgnoreListSettingsPage::IgnoreListSettingsPage(QWidget *parent) : SettingsPage(tr("IRC"), tr("Ignore List"), parent) @@ -59,10 +59,10 @@ IgnoreListSettingsPage::IgnoreListSettingsPage(QWidget *parent) ui.ignoreListView->viewport()->setMouseTracking(true); connect(ui.ignoreListView->selectionModel(), &QItemSelectionModel::selectionChanged, this, &IgnoreListSettingsPage::selectionChanged); - connect(ui.newIgnoreRuleButton, SIGNAL(clicked()), this, SLOT(newIgnoreRule())); + connect(ui.newIgnoreRuleButton, &QAbstractButton::clicked, this, [this]() { newIgnoreRule(); }); 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, &IgnoreListModel::configChanged, this, &IgnoreListSettingsPage::setChangedState); connect(&_ignoreListModel, &IgnoreListModel::modelReady, this, &IgnoreListSettingsPage::enableDialog); enableDialog(_ignoreListModel.isReady()); @@ -77,7 +77,7 @@ IgnoreListSettingsPage::~IgnoreListSettingsPage() void IgnoreListSettingsPage::load() { - if (_ignoreListModel.configChanged()) + if (_ignoreListModel.hasConfigChanged()) _ignoreListModel.revert(); ui.ignoreListView->selectionModel()->reset(); ui.editIgnoreRuleButton->setEnabled(false); @@ -92,7 +92,7 @@ void IgnoreListSettingsPage::defaults() void IgnoreListSettingsPage::save() { - if (_ignoreListModel.configChanged()) { + if (_ignoreListModel.hasConfigChanged()) { _ignoreListModel.commit(); } ui.ignoreListView->selectionModel()->reset(); @@ -124,7 +124,7 @@ void IgnoreListSettingsPage::deleteSelectedIgnoreRule() } -void IgnoreListSettingsPage::newIgnoreRule(QString rule) +void IgnoreListSettingsPage::newIgnoreRule(const QString &rule) { IgnoreListManager::IgnoreListItem newItem = IgnoreListManager::IgnoreListItem(); newItem.setStrictness(IgnoreListManager::SoftStrictness); @@ -290,9 +290,9 @@ IgnoreListEditDlg::IgnoreListEditDlg(const IgnoreListManager::IgnoreListItem &it 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(&_typeButtonGroup, selectOverload(&QButtonGroup::buttonClicked), this, &IgnoreListEditDlg::widgetHasChanged); + connect(&_strictnessButtonGroup, selectOverload(&QButtonGroup::buttonClicked), this, &IgnoreListEditDlg::widgetHasChanged); + connect(&_scopeButtonGroup, selectOverload(&QButtonGroup::buttonClicked), this, &IgnoreListEditDlg::widgetHasChanged); connect(ui.isRegExCheckBox, &QCheckBox::stateChanged, this, &IgnoreListEditDlg::widgetHasChanged); connect(ui.isActiveCheckBox, &QCheckBox::stateChanged, this, &IgnoreListEditDlg::widgetHasChanged); diff --git a/src/qtui/settingspages/ignorelistsettingspage.h b/src/qtui/settingspages/ignorelistsettingspage.h index 41c39713..7dc687a7 100644 --- a/src/qtui/settingspages/ignorelistsettingspage.h +++ b/src/qtui/settingspages/ignorelistsettingspage.h @@ -87,7 +87,7 @@ public slots: void save() override; void load() override; void defaults() override; - void newIgnoreRule(QString rule = QString()); + void newIgnoreRule(const QString &rule = {}); private slots: void enableDialog(bool); diff --git a/src/qtui/settingspages/itemviewsettingspage.cpp b/src/qtui/settingspages/itemviewsettingspage.cpp index 0a51f4a3..1a35fb86 100644 --- a/src/qtui/settingspages/itemviewsettingspage.cpp +++ b/src/qtui/settingspages/itemviewsettingspage.cpp @@ -43,10 +43,10 @@ ItemViewSettingsPage::ItemViewSettingsPage(QWidget *parent) ui.bufferViewPreview->expandAll(); foreach(ColorButton *button, findChildren()) { - connect(button, SIGNAL(colorChanged(QColor)), _mapper, SLOT(map())); + connect(button, &ColorButton::colorChanged, _mapper, selectOverload<>(&QSignalMapper::map)); _mapper->setMapping(button, button); } - connect(_mapper, SIGNAL(mapped(QWidget *)), SLOT(updateBufferViewPreview(QWidget *))); + connect(_mapper, selectOverload(&QSignalMapper::mapped), this, &ItemViewSettingsPage::updateBufferViewPreview); initAutoWidgets(); } diff --git a/src/qtui/settingspages/networkssettingspage.cpp b/src/qtui/settingspages/networkssettingspage.cpp index d705eb65..050ffc55 100644 --- a/src/qtui/settingspages/networkssettingspage.cpp +++ b/src/qtui/settingspages/networkssettingspage.cpp @@ -91,8 +91,8 @@ NetworksSettingsPage::NetworksSettingsPage(QWidget *parent) 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.identityList, selectOverload(&QComboBox::currentIndexChanged), this, &NetworksSettingsPage::widgetHasChanged); + //connect(ui.randomServer, &QAbstractButton::clicked, this, &NetworksSettingsPage::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); @@ -101,26 +101,22 @@ NetworksSettingsPage::NetworksSettingsPage(QWidget *parent) 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.sendEncoding, selectOverload(&QComboBox::currentIndexChanged), this, &NetworksSettingsPage::widgetHasChanged); + connect(ui.recvEncoding, selectOverload(&QComboBox::currentIndexChanged), this, &NetworksSettingsPage::widgetHasChanged); + connect(ui.serverEncoding, selectOverload(&QComboBox::currentIndexChanged), this, &NetworksSettingsPage::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.reconnectInterval, selectOverload(&QSpinBox::valueChanged), this, &NetworksSettingsPage::widgetHasChanged); + connect(ui.reconnectRetries, selectOverload(&QSpinBox::valueChanged), this, &NetworksSettingsPage::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, &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.messageRateBurstSize, selectOverload(&QSpinBox::valueChanged), this, &NetworksSettingsPage::widgetHasChanged); + connect(ui.messageRateDelay, selectOverload(&QDoubleSpinBox::valueChanged), this, &NetworksSettingsPage::widgetHasChanged); connect(ui.unlimitedMessageRate, &QAbstractButton::clicked, this, &NetworksSettingsPage::widgetHasChanged); - // Add additional widgets here - //connect(ui., SIGNAL(), this, SLOT(widgetHasChanged())); - //connect(ui., SIGNAL(), this, SLOT(widgetHasChanged())); - foreach(IdentityId id, Client::identityIds()) { clientIdentityAdded(id); } @@ -479,7 +475,7 @@ QListWidgetItem *NetworksSettingsPage::networkItem(NetworkId id) const void NetworksSettingsPage::clientNetworkAdded(NetworkId id) { insertNetwork(id); - //connect(Client::network(id), SIGNAL(updatedRemotely()), this, SLOT(clientNetworkUpdated())); + //connect(Client::network(id), &Network::updatedRemotely, this, &NetworksSettingsPage::clientNetworkUpdated); connect(Client::network(id), &Network::configChanged, this, &NetworksSettingsPage::clientNetworkUpdated); connect(Client::network(id), &Network::connectionStateSet, this, &NetworksSettingsPage::networkConnectionStateChanged); diff --git a/src/qtui/settingspages/notificationssettingspage.cpp b/src/qtui/settingspages/notificationssettingspage.cpp index 5b9795a2..93922aed 100644 --- a/src/qtui/settingspages/notificationssettingspage.cpp +++ b/src/qtui/settingspages/notificationssettingspage.cpp @@ -34,7 +34,7 @@ NotificationsSettingsPage::NotificationsSettingsPage(QWidget *parent) cw->setParent(this); _configWidgets.append(cw); layout->addWidget(cw); - connect(cw, SIGNAL(changed(bool)), SLOT(widgetHasChanged())); + connect(cw, &SettingsPage::changed, this, &NotificationsSettingsPage::widgetHasChanged); _hasDefaults |= cw->hasDefaults(); } } diff --git a/src/qtui/settingspages/shortcutsmodel.cpp b/src/qtui/settingspages/shortcutsmodel.cpp index 372bafae..b4abf87b 100644 --- a/src/qtui/settingspages/shortcutsmodel.cpp +++ b/src/qtui/settingspages/shortcutsmodel.cpp @@ -202,11 +202,11 @@ bool ShortcutsModel::setData(const QModelIndex &index, const QVariant &value, in if (oldSeq == storedSeq && newSeq != storedSeq) { if (++_changedCount == 1) - emit hasChanged(true); + emit changed(true); } else if (oldSeq != storedSeq && newSeq == storedSeq) { if (--_changedCount == 0) - emit hasChanged(false); + emit changed(false); } return true; @@ -223,7 +223,7 @@ void ShortcutsModel::load() emit dataChanged(index(0, 1), index(rowCount()-1, 1)); if (_changedCount != 0) { _changedCount = 0; - emit hasChanged(false); + emit changed(false); } } @@ -237,7 +237,7 @@ void ShortcutsModel::commit() } if (_changedCount != 0) { _changedCount = 0; - emit hasChanged(false); + emit changed(false); } } diff --git a/src/qtui/settingspages/shortcutsmodel.h b/src/qtui/settingspages/shortcutsmodel.h index 0502b322..12420bdc 100644 --- a/src/qtui/settingspages/shortcutsmodel.h +++ b/src/qtui/settingspages/shortcutsmodel.h @@ -76,7 +76,7 @@ public slots: signals: //! Reflects the difference between model contents and the ActionCollections we loaded this from - void hasChanged(bool changed); + void changed(bool changed); private: struct Item { diff --git a/src/qtui/settingspages/shortcutssettingspage.cpp b/src/qtui/settingspages/shortcutssettingspage.cpp index 4da905f8..46e02b76 100644 --- a/src/qtui/settingspages/shortcutssettingspage.cpp +++ b/src/qtui/settingspages/shortcutssettingspage.cpp @@ -84,10 +84,10 @@ ShortcutsSettingsPage::ShortcutsSettingsPage(const QHashsetFocus(); }); } diff --git a/src/qtui/snorenotificationbackend.cpp b/src/qtui/snorenotificationbackend.cpp index 07c6a9a9..bdabcf13 100644 --- a/src/qtui/snorenotificationbackend.cpp +++ b/src/qtui/snorenotificationbackend.cpp @@ -50,7 +50,7 @@ SnoreNotificationBackend::SnoreNotificationBackend (QObject *parent) m_application.hints().setValue("windows-app-id","QuasselProject.QuasselIRC"); m_application.hints().setValue("pushover-token", "arNtsi983QSZUqU3KAZrFLKHGFPkdL"); - connect(&Snore::SnoreCore::instance(), SIGNAL(actionInvoked(Snore::Notification)), this, SLOT(actionInvoked(Snore::Notification))); + connect(&Snore::SnoreCore::instance(), &Snore::SnoreCore::actionInvoked, this, &SnoreNotificationBackend::actionInvoked); m_alert = Snore::Alert(tr("Private Message"), m_icon); @@ -140,7 +140,7 @@ SnoreNotificationBackend::ConfigWidget::ConfigWidget(QWidget *parent) :SettingsPage("Internal", "SnoreNotification", parent) { ui.setupUi(this); - connect(ui.useSnoreCheckBox, SIGNAL(toggled(bool)), this, SLOT(useSnnoreChanged(bool))); + connect(ui.useSnoreCheckBox, &QCheckBox::toggled, this, &ConfigWidget::useSnoreChanged); } bool SnoreNotificationBackend::ConfigWidget::hasDefaults() const @@ -150,7 +150,7 @@ bool SnoreNotificationBackend::ConfigWidget::hasDefaults() const void SnoreNotificationBackend::ConfigWidget::defaults() { - useSnnoreChanged(false); + useSnoreChanged(false); ui.widget->reset(); } @@ -172,7 +172,7 @@ void SnoreNotificationBackend::ConfigWidget::save() load(); } -void SnoreNotificationBackend::ConfigWidget::useSnnoreChanged(bool b) +void SnoreNotificationBackend::ConfigWidget::useSnoreChanged(bool b) { ui.useSnoreCheckBox->setChecked(b); ui.widget->setEnabled(b); diff --git a/src/qtui/snorenotificationbackend.h b/src/qtui/snorenotificationbackend.h index 10e40cf2..00f399b9 100644 --- a/src/qtui/snorenotificationbackend.h +++ b/src/qtui/snorenotificationbackend.h @@ -72,7 +72,7 @@ public: void load(); void save(); private slots: - void useSnnoreChanged(bool); + void useSnoreChanged(bool); private: Ui::SnoreNotificationConfigWidget ui; diff --git a/src/qtui/sslinfodlg.cpp b/src/qtui/sslinfodlg.cpp index a549d8fc..7db4c3e4 100644 --- a/src/qtui/sslinfodlg.cpp +++ b/src/qtui/sslinfodlg.cpp @@ -43,7 +43,7 @@ SslInfoDlg::SslInfoDlg(const QSslSocket *socket, QWidget *parent) ui.encryption->setText(cipher.name()); ui.protocol->setText(cipher.protocolString()); - connect(ui.certificateChain, SIGNAL(currentIndexChanged(int)), SLOT(setCurrentCert(int))); + connect(ui.certificateChain, selectOverload(&QComboBox::currentIndexChanged), this, &SslInfoDlg::setCurrentCert); foreach(const QSslCertificate &cert, socket->peerCertificateChain()) { ui.certificateChain->addItem(subjectInfo(cert, QSslCertificate::CommonName)); } diff --git a/src/qtui/statusnotifieritem.cpp b/src/qtui/statusnotifieritem.cpp index 3f0a3b29..25b14bfb 100644 --- a/src/qtui/statusnotifieritem.cpp +++ b/src/qtui/statusnotifieritem.cpp @@ -84,9 +84,9 @@ StatusNotifierItem::StatusNotifierItem(QWidget *parent) setMode(Mode::StatusNotifier); - connect(this, SIGNAL(visibilityChanged(bool)), this, SLOT(onVisibilityChanged(bool))); - connect(this, SIGNAL(modeChanged(Mode)), this, SLOT(onModeChanged(Mode))); - connect(this, &SystemTray::stateChanged, this, &StatusNotifierItem::onStateChanged); + connect(this, &StatusNotifierItem::visibilityChanged, this, &StatusNotifierItem::onVisibilityChanged); + connect(this, &StatusNotifierItem::modeChanged, this, &StatusNotifierItem::onModeChanged); + connect(this, &StatusNotifierItem::stateChanged, this, &StatusNotifierItem::onStateChanged); trayMenu()->installEventFilter(this); @@ -103,9 +103,9 @@ StatusNotifierItem::StatusNotifierItem(QWidget *parent) // Our own SNI service _statusNotifierItemDBus = new StatusNotifierItemDBus(this); - connect(this, &SystemTray::currentIconNameChanged, _statusNotifierItemDBus, &StatusNotifierItemDBus::NewIcon); - connect(this, &SystemTray::currentIconNameChanged, _statusNotifierItemDBus, &StatusNotifierItemDBus::NewAttentionIcon); - connect(this, &SystemTray::toolTipChanged, _statusNotifierItemDBus, &StatusNotifierItemDBus::NewToolTip); + connect(this, &StatusNotifierItem::currentIconNameChanged, _statusNotifierItemDBus, &StatusNotifierItemDBus::NewIcon); + connect(this, &StatusNotifierItem::currentIconNameChanged, _statusNotifierItemDBus, &StatusNotifierItemDBus::NewAttentionIcon); + connect(this, &StatusNotifierItem::toolTipChanged, _statusNotifierItemDBus, &StatusNotifierItemDBus::NewToolTip); // Service watcher to keep track of the StatusNotifierWatcher service _serviceWatcher = new QDBusServiceWatcher(kSniWatcherService, diff --git a/src/qtui/statusnotifieritemdbus.h b/src/qtui/statusnotifieritemdbus.h index 719c8259..9eb6e22d 100644 --- a/src/qtui/statusnotifieritemdbus.h +++ b/src/qtui/statusnotifieritemdbus.h @@ -172,7 +172,7 @@ public: */ QDBusObjectPath Menu() const; -public Q_SLOTS: +public slots: //interaction /** * Shows the context menu associated to this item @@ -196,7 +196,7 @@ public Q_SLOTS: */ void Scroll(int delta, const QString &orientation); -Q_SIGNALS: +signals: /** * Inform the systemtray that the own main icon has been changed, * so should be reloaded diff --git a/src/qtui/systraynotificationbackend.cpp b/src/qtui/systraynotificationbackend.cpp index eaec2f74..db92a9e3 100644 --- a/src/qtui/systraynotificationbackend.cpp +++ b/src/qtui/systraynotificationbackend.cpp @@ -39,9 +39,10 @@ SystrayNotificationBackend::SystrayNotificationBackend(QObject *parent) NotificationSettings notificationSettings; notificationSettings.initAndNotify("Systray/ShowBubble", this, SLOT(showBubbleChanged(QVariant)), true); - connect(QtUi::mainWindow()->systemTray(), SIGNAL(messageClicked(uint)), SLOT(notificationActivated(uint))); - connect(QtUi::mainWindow()->systemTray(), SIGNAL(activated(SystemTray::ActivationReason)), - SLOT(notificationActivated(SystemTray::ActivationReason))); + connect(QtUi::mainWindow()->systemTray(), &SystemTray::messageClicked, + this, selectOverload(&SystrayNotificationBackend::onNotificationActivated)); + connect(QtUi::mainWindow()->systemTray(), &SystemTray::activated, + this, selectOverload(&SystrayNotificationBackend::onNotificationActivated)); QApplication::instance()->installEventFilter(this); @@ -81,7 +82,7 @@ void SystrayNotificationBackend::close(uint notificationId) } -void SystrayNotificationBackend::notificationActivated(uint notificationId) +void SystrayNotificationBackend::onNotificationActivated(uint notificationId) { if (!_blockActivation) { QList::iterator i = _notifications.begin(); @@ -98,13 +99,15 @@ void SystrayNotificationBackend::notificationActivated(uint notificationId) } -void SystrayNotificationBackend::notificationActivated(SystemTray::ActivationReason reason) +void SystrayNotificationBackend::onNotificationActivated(SystemTray::ActivationReason reason) { if (reason == SystemTray::Trigger) { - if (_notifications.count()) - notificationActivated(_notifications.last().notificationId); - else + if (_notifications.count()) { + onNotificationActivated(_notifications.last().notificationId); + } + else { GraphicalUi::toggleMainWidget(); + } } } diff --git a/src/qtui/systraynotificationbackend.h b/src/qtui/systraynotificationbackend.h index d8af7e39..0e78600c 100644 --- a/src/qtui/systraynotificationbackend.h +++ b/src/qtui/systraynotificationbackend.h @@ -41,8 +41,8 @@ protected: bool eventFilter(QObject *obj, QEvent *event) override; private slots: - void notificationActivated(uint notificationId); - void notificationActivated(SystemTray::ActivationReason); + void onNotificationActivated(uint notificationId); + void onNotificationActivated(SystemTray::ActivationReason); void showBubbleChanged(const QVariant &); void updateToolTip(); diff --git a/src/qtui/taskbarnotificationbackend.cpp b/src/qtui/taskbarnotificationbackend.cpp index 8b8b6c87..c86c9333 100644 --- a/src/qtui/taskbarnotificationbackend.cpp +++ b/src/qtui/taskbarnotificationbackend.cpp @@ -97,7 +97,7 @@ TaskbarNotificationBackend::ConfigWidget::ConfigWidget(QWidget *parent) : Settin connect(enabledBox, &QAbstractButton::toggled, this, &ConfigWidget::widgetChanged); connect(enabledBox, &QAbstractButton::toggled, timeoutBox, &QWidget::setEnabled); - connect(timeoutBox, SIGNAL(valueChanged(int)), SLOT(widgetChanged())); + connect(timeoutBox, selectOverload(&QSpinBox::valueChanged), this, &ConfigWidget::widgetChanged); } diff --git a/src/uisupport/abstractnotificationbackend.h b/src/uisupport/abstractnotificationbackend.h index 5f00daa7..7a48d0ef 100644 --- a/src/uisupport/abstractnotificationbackend.h +++ b/src/uisupport/abstractnotificationbackend.h @@ -50,10 +50,10 @@ public: QString message; Notification(uint id_, BufferId buf_, NotificationType type_, QString sender_, QString msg_) - : notificationId(id_), bufferId(buf_), type(type_), sender(std::move(sender_)), message(std::move(msg_)) {}; + : notificationId(id_), bufferId(buf_), type(type_), sender(std::move(sender_)), message(std::move(msg_)) {} }; - inline AbstractNotificationBackend(QObject *parent) : QObject(parent) {}; + using QObject::QObject; virtual void notify(const Notification &) = 0; virtual void close(uint notificationId) { Q_UNUSED(notificationId); } diff --git a/src/uisupport/action.cpp b/src/uisupport/action.cpp index 55427392..a61339a3 100644 --- a/src/uisupport/action.cpp +++ b/src/uisupport/action.cpp @@ -56,7 +56,7 @@ Action::Action(const QIcon &icon, const QString &text, QObject *parent, const QO void Action::init() { - connect(this, SIGNAL(triggered(bool)), this, SLOT(slotTriggered())); + connect(this, &QAction::triggered, this, &Action::slotTriggered); setProperty("isShortcutConfigurable", true); } diff --git a/src/uisupport/bufferview.cpp b/src/uisupport/bufferview.cpp index 6a7badda..046dad91 100644 --- a/src/uisupport/bufferview.cpp +++ b/src/uisupport/bufferview.cpp @@ -91,11 +91,9 @@ void BufferView::init() #if defined Q_OS_MACOS || defined Q_OS_WIN // afaik this is better on Mac and Windows - disconnect(this, SIGNAL(activated(QModelIndex)), this, SLOT(joinChannel(QModelIndex))); - connect(this, SIGNAL(activated(QModelIndex)), SLOT(joinChannel(QModelIndex))); + connect(this, &QAbstractItemView::activated, this, &BufferView::joinChannel, Qt::UniqueConnection); #else - disconnect(this, &QAbstractItemView::doubleClicked, this, &BufferView::joinChannel); - connect(this, &QAbstractItemView::doubleClicked, this, &BufferView::joinChannel); + connect(this, &QAbstractItemView::doubleClicked, this, &BufferView::joinChannel, Qt::UniqueConnection); #endif } diff --git a/src/uisupport/bufferviewfilter.cpp b/src/uisupport/bufferviewfilter.cpp index cc746f2c..059e47e5 100644 --- a/src/uisupport/bufferviewfilter.cpp +++ b/src/uisupport/bufferviewfilter.cpp @@ -96,19 +96,7 @@ void BufferViewFilter::configInitialized() if (!config()) return; -// connect(config(), SIGNAL(bufferViewNameSet(const QString &)), 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())); -// connect(config(), SIGNAL(hideInactiveBuffersSet(bool)), this, SLOT(invalidate())); -// connect(config(), SIGNAL(allowedBufferTypesSet(int)), this, SLOT(invalidate())); -// connect(config(), SIGNAL(minimumActivitySet(int)), this, SLOT(invalidate())); -// connect(config(), SIGNAL(bufferListSet()), this, SLOT(invalidate())); -// connect(config(), SIGNAL(bufferAdded(const BufferId &, int)), this, SLOT(invalidate())); -// connect(config(), SIGNAL(bufferMoved(const BufferId &, int)), this, SLOT(invalidate())); -// connect(config(), SIGNAL(bufferRemoved(const BufferId &)), this, SLOT(invalidate())); -// connect(config(), SIGNAL(bufferPermanentlyRemoved(const BufferId &)), this, SLOT(invalidate())); disconnect(config(), &SyncableObject::initDone, this, &BufferViewFilter::configInitialized); diff --git a/src/uisupport/nickview.cpp b/src/uisupport/nickview.cpp index c0c489a0..2fdb7081 100644 --- a/src/uisupport/nickview.cpp +++ b/src/uisupport/nickview.cpp @@ -53,7 +53,7 @@ NickView::NickView(QWidget *parent) #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))); + connect(this, &QAbstractItemView::activated, this, &NickView::startQuery); #else connect(this, &QAbstractItemView::doubleClicked, this, &NickView::startQuery); #endif diff --git a/src/uisupport/settingspage.h b/src/uisupport/settingspage.h index 730418e7..994a3e4f 100644 --- a/src/uisupport/settingspage.h +++ b/src/uisupport/settingspage.h @@ -139,9 +139,6 @@ public slots: virtual void defaults(); protected slots: - //! Calling this slot is equivalent to calling setChangedState(true). - inline void changed() { setChangedState(true); } - //! This should be called whenever the widget state changes from unchanged to change or the other way round. void setChangedState(bool hasChanged = true); diff --git a/src/uisupport/toolbaractionprovider.cpp b/src/uisupport/toolbaractionprovider.cpp index e009a333..b444deb4 100644 --- a/src/uisupport/toolbaractionprovider.cpp +++ b/src/uisupport/toolbaractionprovider.cpp @@ -111,14 +111,14 @@ void ToolBarActionProvider::addActions(QToolBar *bar, ToolBarType type) } -void ToolBarActionProvider::currentBufferChanged(const QModelIndex &index) +void ToolBarActionProvider::onCurrentBufferChanged(const QModelIndex &index) { _currentBuffer = index; updateStates(); } -void ToolBarActionProvider::nickSelectionChanged(const QModelIndexList &indexList) +void ToolBarActionProvider::onNickSelectionChanged(const QModelIndexList &indexList) { _selectedNicks = indexList; updateStates(); @@ -161,8 +161,8 @@ void ToolBarActionProvider::networkCreated(NetworkId id) _networkActions[id] = act; act->setObjectName(QString("NetworkAction-%1").arg(id.toInt())); act->setData(QVariant::fromValue(id)); - connect(net, SIGNAL(updatedRemotely()), SLOT(networkUpdated())); - connect(act, SIGNAL(triggered()), SLOT(connectOrDisconnectNet())); + connect(net, &Network::updatedRemotely, this, [this]() { networkUpdated(); }); + connect(act, &QAction::triggered, this, &ToolBarActionProvider::connectOrDisconnectNet); networkUpdated(net); } diff --git a/src/uisupport/toolbaractionprovider.h b/src/uisupport/toolbaractionprovider.h index 9d80d37b..6cb77615 100644 --- a/src/uisupport/toolbaractionprovider.h +++ b/src/uisupport/toolbaractionprovider.h @@ -43,6 +43,8 @@ public: public slots: void disconnectedFromCore() override; + void onCurrentBufferChanged(const QModelIndex &); + void onNickSelectionChanged(const QModelIndexList &); protected: void handleNetworkAction(ActionType, QAction *) override; @@ -56,9 +58,6 @@ private slots: void networkUpdated(const Network *net = nullptr); void connectOrDisconnectNet(); - void currentBufferChanged(const QModelIndex &); - void nickSelectionChanged(const QModelIndexList &); - void updateStates(); private: -- 2.20.1