Connection syntax migration (#637)
This commit is contained in:
@@ -48,8 +48,8 @@ ObjectHelper* ClosureBase::helper() const {
|
||||
|
||||
ObjectHelper::ObjectHelper(QObject *sender, const char *signal, ClosureBase *closure) : closure_(closure) {
|
||||
|
||||
connect(sender, signal, SLOT(Invoked()));
|
||||
connect(sender, SIGNAL(destroyed()), SLOT(deleteLater()));
|
||||
QObject::connect(sender, signal, SLOT(Invoked()));
|
||||
QObject::connect(sender, &QObject::destroyed, this, &ObjectHelper::deleteLater);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -110,7 +110,7 @@ class Closure : public ClosureBase {
|
||||
const int index = meta_receiver->indexOfSlot(normalised_slot.constData());
|
||||
Q_ASSERT(index != -1);
|
||||
slot_ = meta_receiver->method(index);
|
||||
QObject::connect(receiver_, SIGNAL(destroyed()), helper_, SLOT(deleteLater()));
|
||||
QObject::connect(receiver_, &QObject::destroyed, helper_, &QObject::deleteLater);
|
||||
}
|
||||
|
||||
void Invoke() override {
|
||||
@@ -207,7 +207,7 @@ template <typename T, typename... Args>
|
||||
_detail::ClosureBase *NewClosure(QFuture<T> future, QObject *receiver, const char *slot, const Args&... args) {
|
||||
QFutureWatcher<T> *watcher = new QFutureWatcher<T>;
|
||||
watcher->setFuture(future);
|
||||
QObject::connect(watcher, SIGNAL(finished()), watcher, SLOT(deleteLater()));
|
||||
QObject::connect(watcher, &QFutureWatcher<T>::finished, watcher, &QFutureWatcher<T>::deleteLater);
|
||||
return NewClosure(watcher, SIGNAL(finished()), receiver, slot, args...);
|
||||
}
|
||||
|
||||
@@ -215,7 +215,7 @@ template <typename T, typename F, typename... Args>
|
||||
_detail::ClosureBase *NewClosure(QFuture<T> future, const F &callback, const Args&... args) {
|
||||
QFutureWatcher<T> *watcher = new QFutureWatcher<T>;
|
||||
watcher->setFuture(future);
|
||||
QObject::connect(watcher, SIGNAL(finished()), watcher, SLOT(deleteLater()));
|
||||
QObject::connect(watcher, &QFutureWatcher<T>::finished, watcher, &QFutureWatcher<T>::deleteLater);
|
||||
return NewClosure(watcher, SIGNAL(finished()), callback, args...);
|
||||
}
|
||||
|
||||
@@ -228,7 +228,7 @@ void DoAfter(std::function<void()> callback, std::chrono::duration<R, P> duratio
|
||||
QTimer *timer = new QTimer;
|
||||
timer->setSingleShot(true);
|
||||
NewClosure(timer, SIGNAL(timeout()), callback);
|
||||
QObject::connect(timer, SIGNAL(timeout()), timer, SLOT(deleteLater()));
|
||||
QObject::connect(timer, &QTimer::timeout, timer, &QTimer::deleteLater);
|
||||
std::chrono::milliseconds msec = std::chrono::duration_cast<std::chrono::milliseconds>(duration);
|
||||
timer->start(msec.count());
|
||||
}
|
||||
|
||||
@@ -44,16 +44,16 @@ void _MessageHandlerBase::SetDevice(QIODevice *device) {
|
||||
|
||||
buffer_.open(QIODevice::ReadWrite);
|
||||
|
||||
connect(device, SIGNAL(readyRead()), SLOT(DeviceReadyRead()));
|
||||
QObject::connect(device, &QIODevice::readyRead, this, &_MessageHandlerBase::DeviceReadyRead);
|
||||
|
||||
// Yeah I know.
|
||||
if (QAbstractSocket *abstractsocket = qobject_cast<QAbstractSocket*>(device)) {
|
||||
flush_abstract_socket_ = &QAbstractSocket::flush;
|
||||
connect(abstractsocket, SIGNAL(disconnected()), SLOT(DeviceClosed()));
|
||||
QObject::connect(abstractsocket, &QAbstractSocket::disconnected, this, &_MessageHandlerBase::DeviceClosed);
|
||||
}
|
||||
else if (QLocalSocket *localsocket = qobject_cast<QLocalSocket*>(device)) {
|
||||
flush_local_socket_ = &QLocalSocket::flush;
|
||||
connect(localsocket, SIGNAL(disconnected()), SLOT(DeviceClosed()));
|
||||
QObject::connect(localsocket, &QLocalSocket::disconnected, this, &_MessageHandlerBase::DeviceClosed);
|
||||
}
|
||||
else {
|
||||
qFatal("Unsupported device type passed to _MessageHandlerBase");
|
||||
|
||||
@@ -173,7 +173,7 @@ WorkerPool<HandlerType>::~WorkerPool() {
|
||||
|
||||
for (const Worker &worker : workers_) {
|
||||
if (worker.local_socket_ && worker.process_) {
|
||||
disconnect(worker.process_, SIGNAL(errorOccurred(QProcess::ProcessError)), this, SLOT(ProcessError(QProcess::ProcessError)));
|
||||
QObject::disconnect(worker.process_, &QProcess::errorOccurred, this, &WorkerPool::ProcessError);
|
||||
|
||||
// The worker is connected. Close his socket and wait for him to exit.
|
||||
qLog(Debug) << "Closing worker socket";
|
||||
@@ -272,8 +272,8 @@ void WorkerPool<HandlerType>::StartOneWorker(Worker *worker) {
|
||||
worker->local_server_ = new QLocalServer(this);
|
||||
worker->process_ = new QProcess(this);
|
||||
|
||||
connect(worker->local_server_, SIGNAL(newConnection()), SLOT(NewConnection()));
|
||||
connect(worker->process_, SIGNAL(errorOccurred(QProcess::ProcessError)), SLOT(ProcessError(QProcess::ProcessError)));
|
||||
QObject::connect(worker->local_server_, &QLocalServer::newConnection, this, &WorkerPool::NewConnection);
|
||||
QObject::connect(worker->process_, &QProcess::errorOccurred, this, &WorkerPool::ProcessError);
|
||||
|
||||
// Create a server, find an unused name and start listening
|
||||
forever {
|
||||
|
||||
Reference in New Issue
Block a user