public slots:
virtual void process(Message &msg) = 0;
virtual void process(QList<Message> &msgs) = 0;
+ virtual void networkRemoved(NetworkId id) = 0;
protected:
// updateBufferActivity also sets the Message::Redirected flag which is later used
}
}
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();
}
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...
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);
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();
}
#include "clientsettings.h"
#include "logmessage.h"
#include "peerfactory.h"
+#include "util.h"
using namespace Protocol;
// 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:
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);
}
}
if (peer->protocol() == Protocol::LegacyProtocol) {
- connect(peer, SIGNAL(protocolVersionMismatch(int,int)), SLOT(onProtocolVersionMismatch(int,int)));
+ connect(peer, &RemotePeer::protocolVersionMismatch, this, &ClientAuthHandler::onProtocolVersionMismatch);
_legacy = true;
}
auto *sslSocket = qobject_cast<QSslSocket *>(socket());
Q_ASSERT(sslSocket);
connect(sslSocket, &QSslSocket::encrypted, this, &ClientAuthHandler::onSslSocketEncrypted);
- connect(sslSocket, SIGNAL(sslErrors(QList<QSslError>)), SLOT(onSslErrors()));
+ connect(sslSocket, selectOverload<const QList<QSslError>&>(&QSslSocket::sslErrors), this, &ClientAuthHandler::onSslErrors);
qDebug() << "Starting encryption...";
sslSocket->flush();
sslSocket->startClientEncryption();
_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<const QString&, bool>(&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();
bool connectToCore(AccountId = 0);
void reconnectToCore();
void disconnectFromCore();
+ void internalSessionStateReceived(const Protocol::SessionState &sessionState);
void setupCore(const Protocol::SetupData &setupData);
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);
#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<int, QProcess::ExitStatus>(&QProcess::finished), this, &ExecWrapper::processFinished);
+ connect(&_process, selectOverload<QProcess::ProcessError>(&QProcess::error), this, &ExecWrapper::processError);
connect(this, &ExecWrapper::output, this, &ExecWrapper::postStdout);
connect(this, &ExecWrapper::error, this, &ExecWrapper::postStderr);
// 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);
}
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);
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);
}
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);
}
_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<IrcUser *> )),
- this, SLOT(join(QList<IrcUser *> )));
- connect(ircChannel, &IrcChannel::ircUserParted,
- this, &ChannelBufferItem::part);
- connect(ircChannel, &IrcChannel::parted,
- this, &ChannelBufferItem::ircChannelParted);
- connect(ircChannel, &IrcChannel::ircUserModesSet,
- this, &ChannelBufferItem::userModeChanged);
- connect(ircChannel, &IrcChannel::ircUserModeAdded,
- this, &ChannelBufferItem::userModeChanged);
- connect(ircChannel, &IrcChannel::ircUserModeRemoved,
- this, &ChannelBufferItem::userModeChanged);
+ 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());
{
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(); });
}
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()));
#include <QHostAddress>
#include "authhandler.h"
+#include "util.h"
AuthHandler::AuthHandler(QObject *parent)
: QObject(parent)
void AuthHandler::setSocket(QTcpSocket *socket)
{
_socket = socket;
- connect(socket, SIGNAL(error(QAbstractSocket::SocketError)), SLOT(onSocketError(QAbstractSocket::SocketError)));
+ connect(socket, selectOverload<QAbstractSocket::SocketError>(&QTcpSocket::error), this, &AuthHandler::onSocketError);
connect(socket, &QAbstractSocket::disconnected, this, &AuthHandler::onSocketDisconnected);
}
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;
}
***************************************************************************/
#include "internalpeer.h"
+#include "util.h"
using namespace Protocol;
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<const Protocol::SyncMessage&>(&InternalPeer::dispatchMessage),
+ this, selectOverload<const Protocol::SyncMessage&>(&InternalPeer::handleMessage));
+ connect(peer, selectOverload<const Protocol::RpcCall&>(&InternalPeer::dispatchMessage),
+ this, selectOverload<const Protocol::RpcCall&>(&InternalPeer::handleMessage));
+ connect(peer, selectOverload<const Protocol::InitRequest&>(&InternalPeer::dispatchMessage),
+ this, selectOverload<const Protocol::InitRequest&>(&InternalPeer::handleMessage));
+ connect(peer, selectOverload<const Protocol::InitData&>(&InternalPeer::dispatchMessage),
+ this, selectOverload<const Protocol::InitData&>(&InternalPeer::handleMessage));
connect(peer, &Peer::disconnected, this, &InternalPeer::peerDisconnected);
_userModes[ircuser] = sortedModes[i];
ircuser->joinChannel(this, true);
- connect(ircuser, SIGNAL(nickSet(QString)), this, SLOT(ircUserNickSet(QString)));
+ connect(ircuser, &IrcUser::nickSet, this, selectOverload<QString>(&IrcChannel::ircUserNickSet));
// connect(ircuser, SIGNAL(destroyed()), this, SLOT(ircUserDestroyed()));
// If you wonder why there is no counterpart to ircUserJoined:
// void channelModeAdded(const QChar &mode, const QString &value);
// void channelModeRemoved(const QChar &mode, const QString &value);
- void ircUsersJoined(QList<IrcUser *> ircusers);
+ void ircUsersJoined(const QList<IrcUser *> &ircusers);
// void ircUsersJoined(QStringList nicks, QStringList modes);
void ircUserParted(IrcUser *ircuser);
void ircUserNickSet(IrcUser *ircuser, QString nick);
}
_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);
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);
#else
_signalWatcher = new WindowsSignalWatcher(this);
#endif
- connect(_signalWatcher, SIGNAL(handleSignal(AbstractSignalWatcher::Action)), this, SLOT(handleSignal(AbstractSignalWatcher::Action)));
+ connect(_signalWatcher, &AbstractSignalWatcher::handleSignal, this, &Quassel::handleSignal);
}
#endif
#include "remotepeer.h"
+#include "util.h"
using namespace Protocol;
{
socket->setParent(this);
connect(socket, &QAbstractSocket::stateChanged, this, &RemotePeer::onSocketStateChanged);
- connect(socket, SIGNAL(error(QAbstractSocket::SocketError)), SLOT(onSocketError(QAbstractSocket::SocketError)));
+ connect(socket, selectOverload<QAbstractSocket::SocketError>(&QAbstractSocket::error), this, &RemotePeer::onSocketError);
connect(socket, &QAbstractSocket::disconnected, this, &Peer::disconnected);
#ifdef HAVE_SSL
auto *sslSocket = qobject_cast<QSslSocket *>(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);
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;
}
for (auto &&session : _sessions) {
- connect(session, SIGNAL(shutdownComplete(SessionThread*)), this, SLOT(onSessionShutdown(SessionThread*)));
+ connect(session, &SessionThread::shutdownComplete, this, &Core::onSessionShutdown);
session->shutdown();
}
}
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);
: QCoreApplication(argc, argv)
{
Quassel::registerQuitHandler([this]() {
- connect(_core.get(), SIGNAL(shutdownComplete()), this, SLOT(onShutdownComplete()));
+ connect(_core.get(), &Core::shutdownComplete, this, &CoreApplication::onShutdownComplete);
_core->shutdown();
});
}
void CoreApplication::onShutdownComplete()
{
- connect(_core.get(), SIGNAL(destroyed()), QCoreApplication::instance(), SLOT(quit()));
+ connect(_core.get(), &QObject::destroyed, QCoreApplication::instance(), &QCoreApplication::quit);
_core.release()->deleteLater();
}
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;
}
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);
Q_ASSERT(sslSocket);
qDebug() << qPrintable(tr("Starting encryption for Client:")) << _peer->description();
- connect(sslSocket, SIGNAL(sslErrors(const QList<QSslError> &)), SLOT(onSslErrors()));
+ connect(sslSocket, selectOverload<const QList<QSslError> &>(&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 */
: 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<QByteArray> &, const QByteArray &, const bool)),
- network(), SLOT(putCmd(QString, const QList<QByteArray> &, const QByteArray &, const bool)));
-
- connect(this, SIGNAL(putCmd(QString, const QList<QList<QByteArray>> &, const QByteArray &, const bool)),
- network(), SLOT(putCmd(QString, const QList<QList<QByteArray>> &, 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 QString&, const QList<QByteArray>&, const QByteArray&, bool>(&CoreBasicHandler::putCmd),
+ network(), selectOverload<const QString&, const QList<QByteArray>&, const QByteArray&, bool>(&CoreNetwork::putCmd));
+ connect(this, selectOverload<const QString&, const QList<QList<QByteArray>>&, const QByteArray&, bool>(&CoreBasicHandler::putCmd),
+ network(), selectOverload<const QString&, const QList<QList<QByteArray>>&, const QByteArray&, bool>(&CoreNetwork::putCmd));
}
*
* @see CoreNetwork::putCmd(const QString &cmd, const QList<QByteArray> ¶ms, const QByteArray &prefix = QByteArray(), const bool prepend = false)
*/
- void putCmd(const QString &cmd, const QList<QByteArray> ¶ms, const QByteArray &prefix = QByteArray(), const bool prepend = false);
+ void putCmd(const QString &cmd, const QList<QByteArray> ¶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<QList<QByteArray>> ¶ms, const QByteArray &prefix = QByteArray(), const bool prepend = false)
*/
- void putCmd(const QString &cmd, const QList<QList<QByteArray>> ¶ms, const QByteArray &prefix = QByteArray(), const bool prepend = false);
+ void putCmd(const QString &cmd, const QList<QList<QByteArray>> ¶ms, const QByteArray &prefix = {}, bool prepend = false);
protected:
/**
_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);
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::SocketError>(&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<QSslError> &)), this, SLOT(sslErrors(const QList<QSslError> &)));
+ connect(&socket, &QSslSocket::encrypted, this, &CoreNetwork::onSocketInitialized);
+ connect(&socket, selectOverload<const QList<QSslError>&>(&QSslSocket::sslErrors), this, &CoreNetwork::onSslErrors);
#endif
connect(this, &CoreNetwork::newEvent, coreSession()->eventManager(), &EventManager::postEvent);
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);
}
}
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;
}
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);
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) {
}
-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());
}
-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.
}
-void CoreNetwork::socketHasData()
+void CoreNetwork::onSocketHasData()
{
while (socket.canReadLine()) {
QByteArray s = socket.readLine();
}
-void CoreNetwork::socketError(QAbstractSocket::SocketError error)
+void CoreNetwork::onSocketError(QAbstractSocket::SocketError error)
{
// Ignore socket closed errors if expected
if (_disconnectExpected && error == QAbstractSocket::RemoteHostClosedError) {
_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) {
// 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()) {
}
-void CoreNetwork::socketDisconnected()
+void CoreNetwork::onSocketDisconnected()
{
disablePingTimeout();
_msgQueue.clear();
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);
}
-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:
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,
// 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 {
// 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
// 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
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).
_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();
}
// 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;
}
#ifdef HAVE_SSL
-void CoreNetwork::sslErrors(const QList<QSslError> &sslErrors)
+void CoreNetwork::onSslErrors(const QList<QSslError> &sslErrors)
{
Server server = usedServer();
if (server.sslVerify) {
// 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.
// 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();
}
-QList<QList<QByteArray>> CoreNetwork::splitMessage(const QString &cmd, const QString &message, std::function<QList<QByteArray>(QString &)> cmdGenerator)
+QList<QList<QByteArray>> CoreNetwork::splitMessage(const QString &cmd, const QString &message, const std::function<QList<QByteArray>(QString &)> &cmdGenerator)
{
QString wrkMsg(message);
QList<QList<QByteArray>> msgsToSend;
*/
inline bool isPongReplyPending() const { return _pongReplyPending; }
- QList<QList<QByteArray>> splitMessage(const QString &cmd, const QString &message, std::function<QList<QByteArray>(QString &)> cmdGenerator);
+ QList<QList<QByteArray>> splitMessage(const QString &cmd, const QString &message, const std::function<QList<QByteArray>(QString &)> &cmdGenerator);
// IRCv3 capability negotiation
*
* @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.
*/
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.
* 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.
* maintain PING/PONG replies, the other side will close the connection.
* @endparmblock
*/
- void putCmd(const QString &cmd, const QList<QByteArray> ¶ms, const QByteArray &prefix = QByteArray(), const bool prepend = false);
+ void putCmd(const QString &cmd, const QList<QByteArray> ¶ms, const QByteArray &prefix = {}, bool prepend = false);
/**
* Sends the command for each set of encoded parameters, with optional prefix or high priority.
* cannot maintain PING/PONG replies, the other side will close the connection.
* @endparmblock
*/
- void putCmd(const QString &cmd, const QList<QList<QByteArray>> ¶ms, const QByteArray &prefix = QByteArray(), const bool prependAll = false);
+ void putCmd(const QString &cmd, const QList<QList<QByteArray>> ¶ms, const QByteArray &prefix = {}, bool prependAll = false);
void setChannelJoined(const QString &channel);
void setChannelParted(const QString &channel);
*/
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);
}
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);
//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();
void startAutoWhoCycle();
#ifdef HAVE_SSL
- void sslErrors(const QList<QSslError> &errors);
+ void onSslErrors(const QList<QSslError> &errors);
#endif
/**
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;
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();
}
}
void CoreSession::addClient(InternalPeer *peer)
{
signalProxy()->addPeer(peer);
- emit sessionState(sessionState());
+ emit sessionStateReceived(sessionState());
}
}
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);
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();
}
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);
#include <QTcpSocket>
#include "coretransfer.h"
+#include "util.h"
const qint64 chunkSize = 16 * 1024;
_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::SocketError>(&QAbstractSocket::error), this, &CoreTransfer::onSocketError);
connect(_socket, &QIODevice::readyRead, this, &CoreTransfer::onDataReceived);
_socket->connectToHost(address(), port());
{
_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();
}
{
QtUiApplication::init();
- connect(Client::coreConnection(), SIGNAL(connectToInternalCore(QPointer<InternalPeer>)), this, SLOT(onConnectionRequest(QPointer<InternalPeer>)));
+ 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,
{
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();
};
}
void MonolithicApplication::onClientDestroyed()
{
if (_core) {
- connect(_core, SIGNAL(shutdownComplete()), this, SLOT(onCoreShutdown()));
+ connect(_core, &Core::shutdownComplete, this, &MonolithicApplication::onCoreShutdown);
_core->shutdown();
}
else {
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();
}
connect(&_coreThread, &QThread::started, _core.data(), &Core::initAsync);
connect(&_coreThread, &QThread::finished, _core.data(), &QObject::deleteLater);
- connect(this, SIGNAL(connectInternalPeer(QPointer<InternalPeer>)), _core, SLOT(connectInternalPeer(QPointer<InternalPeer>)));
- 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);
#include <QAction>
#include <QMenu>
+#include "action.h"
#include "awaylogfilter.h"
#include "chatlinemodel.h"
#include "chatscene.h"
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);
}
}
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);
#include <QTextLayout>
#include <QMenu>
+#include "action.h"
#include "buffermodel.h"
#include "bufferview.h"
#include "chatline.h"
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<void *>(this));
+ auto action = new Action{icon::get("edit-copy"), tr("Copy Link Address"), menu, &_actionProxy, SLOT(copyLinkToClipboard())};
+ action->setData(QVariant::fromValue<void *>(this));
+ menu->addAction(action);
break;
+ }
case Clickable::Channel:
{
// Remove existing menu actions, they confuse us when right-clicking on a clickable
#include <QMenu>
#include <QContextMenuEvent>
+#include "action.h"
#include "buffermodel.h"
#include "chatmonitorfilter.h"
#include "chatlinemodel.h"
{
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())));
}
void ChatMonitorView::coreConnectionStateChanged(bool connected)
{
if (connected)
- connect(Client::ignoreListManager(), SIGNAL(ignoreListChanged()), _filter, SLOT(invalidateFilter()));
+ connect(Client::ignoreListManager(), &ClientIgnoreListManager::ignoreListChanged, _filter, &ChatMonitorFilter::invalidateFilter);
}
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<Action>("HideSearchBar", toggleSearchBar, SLOT(setChecked(bool)));
hideSearchBar->setShortcutConfigurable(false);
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();
}
_animation->setDirection(QPropertyAnimation::Forward);
_animation->setDuration(350);
_animation->setEasingCurve(QEasingCurve::InOutSine);
-
- //connect(&_timeLine, SIGNAL(valueChanged(qreal)), this, SLOT(hoverChanged(qreal)));
}
#include "client.h"
#include "coreconnection.h"
#include "icon.h"
+#include "util.h"
namespace {
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
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);
}
// 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);
}
}
: 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<QString, QVariant> 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...
void disconnectClicked(int);
private slots:
- void disconnectClicked();
+ void onDisconnectClicked();
private:
Ui::CoreSessionWidget ui;
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);
}
#include "clientsettings.h"
#include "coreconnection.h"
#include "clientbacklogmanager.h"
+#include "util.h"
DockManagerNotificationBackend::DockManagerNotificationBackend(QObject *parent)
: AbstractNotificationBackend(parent), _bus(QDBusConnection::sessionBus())
itemAdded(QDBusObjectPath());
- connect(Client::coreConnection(), SIGNAL(progressValueChanged(int)), this, SLOT(updateProgress(int)));
+ connect(Client::coreConnection(), &CoreConnection::progressValueChanged, this, selectOverload<int>(&DockManagerNotificationBackend::updateProgress));
connect(Client::coreConnection(), &CoreConnection::synchronized, this, &DockManagerNotificationBackend::synchronized);
}
void DockManagerNotificationBackend::synchronized()
{
- connect(Client::backlogManager(), SIGNAL(updateProgress(int, int)), this, SLOT(updateProgress(int, int)));
+ connect(Client::backlogManager(), &ClientBacklogManager::updateProgress, this, selectOverload<int, int>(&DockManagerNotificationBackend::updateProgress));
}
#include "qtui.h"
#include "qtuisettings.h"
#include "tabcompleter.h"
+#include "util.h"
const int leftMargin = 3;
_networkId(0)
{
ui.setupUi(this);
- connect(ui.ownNick, SIGNAL(activated(QString)), this, SLOT(changeNick(QString)));
+ connect(ui.ownNick, selectOverload<const QString&>(&QComboBox::activated), this, &InputWidget::changeNick);
layout()->setAlignment(ui.ownNick, Qt::AlignBottom);
layout()->setAlignment(ui.inputEdit, Qt::AlignBottom);
ActionCollection *coll = QtUi::actionCollection();
auto *activateInputline = coll->add<Action>("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));
#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<SystemTray::ActivationReason>(&KNotificationBackend::notificationActivated));
updateToolTip();
}
KNotification::RaiseWidgetOnActivation
|KNotification::CloseWhenWidgetActivated
|KNotification::CloseOnTimeout);
- connect(notification, SIGNAL(activated(uint)), SLOT(notificationActivated()));
+ connect(notification, selectOverload<uint>(&KNotification::activated), this, selectOverload<>(&KNotificationBackend::notificationActivated));
notification->setActions(QStringList("View"));
notification->setProperty("notificationId", n.notificationId);
QVBoxLayout *layout = new QVBoxLayout(this);
layout->addWidget(_widget);
- connect(_widget, SIGNAL(changed(bool)), SLOT(widgetChanged(bool)));
+ connect(_widget, &KNotifyConfigWidget::changed, this, &ConfigWidget::widgetChanged);
}
// we assume that at this point, all configurable actions are defined!
QtUi::loadShortcuts();
- connect(bufferWidget(), SIGNAL(currentChanged(BufferId)), SLOT(currentBufferChanged(BufferId)));
+ connect(bufferWidget(), selectOverload<BufferId>(&AbstractBufferContainer::currentChanged), this, &MainWin::currentBufferChanged);
setDisconnectedState(); // Disable menus and stuff
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);
}
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());
_inputWidget->setSelectionModel(Client::bufferModel()->standardSelectionModel());
_inputWidget->inputLine()->installEventFilter(_bufferWidget);
-
- connect(_topicWidget, SIGNAL(switchedPlain()), _bufferWidget, SLOT(setFocus()));
}
_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());
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);
+ });
}
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<const QModelIndex&>(&AbstractBufferContainer::currentChanged),
+ QtUi::toolBarActionProvider(), &ToolBarActionProvider::onCurrentBufferChanged);
+ connect(_nickListWidget, &NickListWidget::nickSelectionChanged,
+ QtUi::toolBarActionProvider(), &ToolBarActionProvider::onNickSelectionChanged);
#ifdef Q_OS_MAC
setUnifiedTitleAndToolBarOnMac(true);
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
}
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<int>(&MainWin::addBufferView));
connect(Client::bufferViewManager(), &BufferViewManager::bufferViewConfigDeleted, this, &MainWin::removeBufferView);
connect(Client::bufferViewManager(), &SyncableObject::initDone, this, &MainWin::loadLayout);
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<NickView *>(sender());
Q_ASSERT(view);
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;
: 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);
}
{
if (!_notificationBackends.contains(backend)) {
_notificationBackends.append(backend);
- instance()->connect(backend, SIGNAL(activated(uint)), SLOT(notificationActivated(uint)));
+ connect(backend, &AbstractNotificationBackend::activated, instance(), &QtUi::notificationActivated);
}
}
// 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();
};
}
}
+void QtUiMessageProcessor::networkRemoved(NetworkId id)
+{
+ // Clean up nickname matching cache
+ _nickMatcher.removeNetwork(id);
+}
+
+
/**************************************************************************
* LegacyHighlightRule
*************************************************************************/
*
* @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();
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<QTreeWidgetItem *> cats = ui.settingsTree->findItems(sp->category(), Qt::MatchExactly);
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();
void AliasesModel::clientConnected()
{
- connect(Client::aliasManager(), SIGNAL(updated()), SLOT(revert()));
+ connect(Client::aliasManager(), &AliasManager::updated, this, &AliasesModel::revert);
if (Client::aliasManager()->isInitialized())
initDone();
else
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:
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());
void AliasesSettingsPage::load()
{
- if (_aliasesModel.configChanged())
+ if (_aliasesModel.hasConfigChanged())
_aliasesModel.revert();
}
void AliasesSettingsPage::save()
{
- if (_aliasesModel.configChanged())
+ if (_aliasesModel.hasConfigChanged())
_aliasesModel.commit();
}
initIconThemeComboBox();
foreach(QComboBox *comboBox, findChildren<QComboBox *>()) {
- connect(comboBox, SIGNAL(currentIndexChanged(QString)), this, SLOT(widgetHasChanged()));
+ connect(comboBox, selectOverload<const QString&>(&QComboBox::currentIndexChanged), this, &AppearanceSettingsPage::widgetHasChanged);
}
foreach(QCheckBox *checkBox, findChildren<QCheckBox *>()) {
connect(checkBox, &QAbstractButton::clicked, this, &AppearanceSettingsPage::widgetHasChanged);
// 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<int>(&QComboBox::currentIndexChanged), this, &BacklogSettingsPage::widgetHasChanged);
}
connect(ui.sortAlphabetically, &QAbstractButton::clicked, this, &BufferViewSettingsPage::widgetHasChanged);
connect(ui.hideInactiveBuffers, &QAbstractButton::clicked, this, &BufferViewSettingsPage::widgetHasChanged);
connect(ui.hideInactiveNetworks, &QAbstractButton::clicked, this, &BufferViewSettingsPage::widgetHasChanged);
- connect(ui.networkSelector, SIGNAL(currentIndexChanged(int)), this, SLOT(widgetHasChanged()));
- connect(ui.minimumActivitySelector, SIGNAL(currentIndexChanged(int)), this, SLOT(widgetHasChanged()));
+ connect(ui.networkSelector, selectOverload<int>(&QComboBox::currentIndexChanged), this, &BufferViewSettingsPage::widgetHasChanged);
+ connect(ui.minimumActivitySelector, selectOverload<int>(&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<int>(&QComboBox::currentIndexChanged), this, &BufferViewSettingsPage::enableStatusBuffers);
}
setEnabled(state);
if (state) {
load();
- connect(Client::bufferViewManager(), SIGNAL(bufferViewConfigAdded(int)), this, SLOT(addBufferView(int)));
+ connect(Client::bufferViewManager(), selectOverload<int>(&BufferViewManager::bufferViewConfigAdded),
+ this, selectOverload<int>(&BufferViewSettingsPage::addBufferView));
}
else {
reset();
BufferViewEditDlg dlg(QString(), existing, this);
if (dlg.exec() == QDialog::Accepted) {
newBufferView(dlg.bufferViewName());
- changed();
+ setChangedState(true);
}
}
BufferViewConfig *changedConfig = cloneConfig(config);
changedConfig->setBufferViewName(dlg.bufferViewName());
ui.bufferViewList->item(listPos(config))->setText(dlg.bufferViewName());
- changed();
+ setChangedState(true);
}
}
delete currentItem;
if (viewId >= 0) {
_deleteBufferViews << viewId;
- changed();
+ setChangedState(true);
}
else if (config) {
QList<BufferViewConfig *>::iterator iter = _newBufferViews.begin();
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<BufferId>(config->bufferList()));
// if this is the currently displayed view we have to change the config of the preview filter
ui.operationMode->addItem(tr("Opt Out"), ChatViewSettings::OptOut);
// connect slots
- connect(ui.operationMode, SIGNAL(currentIndexChanged(int)), SLOT(switchOperationMode(int)));
+ connect(ui.operationMode, selectOverload<int>(&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);
#include "clientsettings.h"
#include "coreaccountmodel.h"
#include "icon.h"
+#include "util.h"
CoreAccountSettingsPage::CoreAccountSettingsPage(QWidget *parent)
: SettingsPage(tr("Remote Cores"), QString(), 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<int>(&QComboBox::currentIndexChanged), this, &CoreAccountSettingsPage::widgetHasChanged);
setWidgetStates();
}
#include "corehighlightsettingspage.h"
#include "icon.h"
#include "qtui.h"
+#include "util.h"
CoreHighlightSettingsPage::CoreHighlightSettingsPage(QWidget *parent)
: SettingsPage(tr("Interface"),
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<int>(&QComboBox::currentIndexChanged), this, &CoreHighlightSettingsPage::highlightNicksChanged);
+ connect(ui.highlightNicksComboBox, selectOverload<int>(&QComboBox::currentIndexChanged), this, &CoreHighlightSettingsPage::widgetHasChanged);
connect(ui.nicksCaseSensitive, &QAbstractButton::clicked, this, &CoreHighlightSettingsPage::widgetHasChanged);
connect(ui.highlightAdd, &QAbstractButton::clicked, this, &CoreHighlightSettingsPage::widgetHasChanged);
#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<int>(&QComboBox::currentIndexChanged), this, &DccSettingsPage::updateWidgetStates);
+ connect(ui.portSelectionMode, selectOverload<int>(&QComboBox::currentIndexChanged), this, &DccSettingsPage::updateWidgetStates);
updateWidgetStates();
connect(Client::instance(), &Client::coreConnectionStateChanged, this, &DccSettingsPage::onClientConfigChanged);
}
_clientConfig = config;
if (_clientConfig) {
- connect(_clientConfig, SIGNAL(updated()), SLOT(load()));
+ connect(_clientConfig, &DccConfig::updated, this, &DccSettingsPage::load);
load();
ui.dccEnabled->setEnabled(true);
}
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);
#endif
currentId = 0;
-
- //connect(ui.identityList, SIGNAL(editTextChanged(const QString &)), this, SLOT(widgetHasChanged()));
}
#include "client.h"
#include "icon.h"
+#include "util.h"
IdentityEditWidget::IdentityEditWidget(QWidget *parent)
: 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<int>(&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);
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();
void IgnoreListModel::clientConnected()
{
- connect(Client::ignoreListManager(), SIGNAL(updated()), SLOT(revert()));
+ connect(Client::ignoreListManager(), &IgnoreListManager::updated, this, &IgnoreListModel::revert);
if (Client::ignoreListManager()->isInitialized())
initDone();
else
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;
#include <QDebug>
#include "expressionmatch.h"
-
#include "icon.h"
+#include "util.h"
IgnoreListSettingsPage::IgnoreListSettingsPage(QWidget *parent)
: SettingsPage(tr("IRC"), tr("Ignore List"), 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());
void IgnoreListSettingsPage::load()
{
- if (_ignoreListModel.configChanged())
+ if (_ignoreListModel.hasConfigChanged())
_ignoreListModel.revert();
ui.ignoreListView->selectionModel()->reset();
ui.editIgnoreRuleButton->setEnabled(false);
void IgnoreListSettingsPage::save()
{
- if (_ignoreListModel.configChanged()) {
+ if (_ignoreListModel.hasConfigChanged()) {
_ignoreListModel.commit();
}
ui.ignoreListView->selectionModel()->reset();
}
-void IgnoreListSettingsPage::newIgnoreRule(QString rule)
+void IgnoreListSettingsPage::newIgnoreRule(const QString &rule)
{
IgnoreListManager::IgnoreListItem newItem = IgnoreListManager::IgnoreListItem();
newItem.setStrictness(IgnoreListManager::SoftStrictness);
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<int>(&QButtonGroup::buttonClicked), this, &IgnoreListEditDlg::widgetHasChanged);
+ connect(&_strictnessButtonGroup, selectOverload<int>(&QButtonGroup::buttonClicked), this, &IgnoreListEditDlg::widgetHasChanged);
+ connect(&_scopeButtonGroup, selectOverload<int>(&QButtonGroup::buttonClicked), this, &IgnoreListEditDlg::widgetHasChanged);
connect(ui.isRegExCheckBox, &QCheckBox::stateChanged, this, &IgnoreListEditDlg::widgetHasChanged);
connect(ui.isActiveCheckBox, &QCheckBox::stateChanged, this, &IgnoreListEditDlg::widgetHasChanged);
void save() override;
void load() override;
void defaults() override;
- void newIgnoreRule(QString rule = QString());
+ void newIgnoreRule(const QString &rule = {});
private slots:
void enableDialog(bool);
ui.bufferViewPreview->expandAll();
foreach(ColorButton *button, findChildren<ColorButton *>()) {
- 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<QWidget*>(&QSignalMapper::mapped), this, &ItemViewSettingsPage::updateBufferViewPreview);
initAutoWidgets();
}
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<int>(&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);
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<int>(&QComboBox::currentIndexChanged), this, &NetworksSettingsPage::widgetHasChanged);
+ connect(ui.recvEncoding, selectOverload<int>(&QComboBox::currentIndexChanged), this, &NetworksSettingsPage::widgetHasChanged);
+ connect(ui.serverEncoding, selectOverload<int>(&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<int>(&QSpinBox::valueChanged), this, &NetworksSettingsPage::widgetHasChanged);
+ connect(ui.reconnectRetries, selectOverload<int>(&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<int>(&QSpinBox::valueChanged), this, &NetworksSettingsPage::widgetHasChanged);
+ connect(ui.messageRateDelay, selectOverload<double>(&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);
}
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);
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();
}
}
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;
emit dataChanged(index(0, 1), index(rowCount()-1, 1));
if (_changedCount != 0) {
_changedCount = 0;
- emit hasChanged(false);
+ emit changed(false);
}
}
}
if (_changedCount != 0) {
_changedCount = 0;
- emit hasChanged(false);
+ emit changed(false);
}
}
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 {
connect(ui.useDefault, &QAbstractButton::clicked, this, &ShortcutsSettingsPage::toggledCustomOrDefault);
connect(ui.useCustom, &QAbstractButton::clicked, this, &ShortcutsSettingsPage::toggledCustomOrDefault);
- connect(_shortcutsModel, SIGNAL(hasChanged(bool)), SLOT(setChangedState(bool)));
+ connect(_shortcutsModel, &ShortcutsModel::changed, this, &ShortcutsSettingsPage::setChangedState);
// fugly, but directly setting it from the ctor doesn't seem to work
- QTimer::singleShot(0, ui.searchEdit, SLOT(setFocus()));
+ QTimer::singleShot(0, ui.searchEdit, [widget = ui.searchEdit]() { widget->setFocus(); });
}
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);
: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
void SnoreNotificationBackend::ConfigWidget::defaults()
{
- useSnnoreChanged(false);
+ useSnoreChanged(false);
ui.widget->reset();
}
load();
}
-void SnoreNotificationBackend::ConfigWidget::useSnnoreChanged(bool b)
+void SnoreNotificationBackend::ConfigWidget::useSnoreChanged(bool b)
{
ui.useSnoreCheckBox->setChecked(b);
ui.widget->setEnabled(b);
void load();
void save();
private slots:
- void useSnnoreChanged(bool);
+ void useSnoreChanged(bool);
private:
Ui::SnoreNotificationConfigWidget ui;
ui.encryption->setText(cipher.name());
ui.protocol->setText(cipher.protocolString());
- connect(ui.certificateChain, SIGNAL(currentIndexChanged(int)), SLOT(setCurrentCert(int)));
+ connect(ui.certificateChain, selectOverload<int>(&QComboBox::currentIndexChanged), this, &SslInfoDlg::setCurrentCert);
foreach(const QSslCertificate &cert, socket->peerCertificateChain()) {
ui.certificateChain->addItem(subjectInfo(cert, QSslCertificate::CommonName));
}
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);
// 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,
*/
QDBusObjectPath Menu() const;
-public Q_SLOTS:
+public slots:
//interaction
/**
* Shows the context menu associated to this item
*/
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
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<uint>(&SystrayNotificationBackend::onNotificationActivated));
+ connect(QtUi::mainWindow()->systemTray(), &SystemTray::activated,
+ this, selectOverload<SystemTray::ActivationReason>(&SystrayNotificationBackend::onNotificationActivated));
QApplication::instance()->installEventFilter(this);
}
-void SystrayNotificationBackend::notificationActivated(uint notificationId)
+void SystrayNotificationBackend::onNotificationActivated(uint notificationId)
{
if (!_blockActivation) {
QList<Notification>::iterator i = _notifications.begin();
}
-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();
+ }
}
}
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();
connect(enabledBox, &QAbstractButton::toggled, this, &ConfigWidget::widgetChanged);
connect(enabledBox, &QAbstractButton::toggled, timeoutBox, &QWidget::setEnabled);
- connect(timeoutBox, SIGNAL(valueChanged(int)), SLOT(widgetChanged()));
+ connect(timeoutBox, selectOverload<int>(&QSpinBox::valueChanged), this, &ConfigWidget::widgetChanged);
}
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); }
void Action::init()
{
- connect(this, SIGNAL(triggered(bool)), this, SLOT(slotTriggered()));
+ connect(this, &QAction::triggered, this, &Action::slotTriggered);
setProperty("isShortcutConfigurable", true);
}
#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
}
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);
#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
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);
}
-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();
_networkActions[id] = act;
act->setObjectName(QString("NetworkAction-%1").arg(id.toInt()));
act->setData(QVariant::fromValue<NetworkId>(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);
}
public slots:
void disconnectedFromCore() override;
+ void onCurrentBufferChanged(const QModelIndex &);
+ void onNickSelectionChanged(const QModelIndexList &);
protected:
void handleNetworkAction(ActionType, QAction *) override;
void networkUpdated(const Network *net = nullptr);
void connectOrDisconnectNet();
- void currentBufferChanged(const QModelIndex &);
- void nickSelectionChanged(const QModelIndexList &);
-
void updateStates();
private: