diff --git a/src/cpp/proxy/domainmap.cpp b/src/cpp/proxy/domainmap.cpp index 7853a6af..1006dd9a 100644 --- a/src/cpp/proxy/domainmap.cpp +++ b/src/cpp/proxy/domainmap.cpp @@ -285,7 +285,7 @@ class DomainMap::Worker : public QObject log_info("routes loaded with %d entries", allRules.count()); - QMetaObject::invokeMethod(this, "changed", Qt::QueuedConnection); + QMetaObject::invokeMethod(this, "doChanged", Qt::QueuedConnection); } // mutex must be locked when calling this method @@ -301,11 +301,15 @@ class DomainMap::Worker : public QObject return true; } -signals: - void started(); - void changed(); + Signal started; + Signal changed; public slots: + void doChanged() + { + changed(); + } + void start() { if(!fileName.isEmpty()) @@ -316,7 +320,7 @@ public slots: reload(); } - emit started(); + started(); } void fileChanged(const QString &path) @@ -732,13 +736,13 @@ class DomainMap::Thread : public QThread { worker = new Worker; worker->fileName = fileName; - connect(worker, &Worker::started, this, &Thread::worker_started, Qt::DirectConnection); + Connection startedConnection = worker->started.connect(boost::bind(&Thread::worker_started, this)); QMetaObject::invokeMethod(worker, "start", Qt::QueuedConnection); exec(); delete worker; } -public slots: +public: void worker_started() { QMutexLocker locker(&m); @@ -750,6 +754,8 @@ class DomainMap::Private : public QObject { Q_OBJECT + Connection changedConnection; + public: DomainMap *q; Thread *thread; @@ -773,13 +779,13 @@ class DomainMap::Private : public QObject thread->start(); // worker guaranteed to exist after starting - connect(thread->worker, &Worker::changed, this, &Private::doChanged); + changedConnection = thread->worker->changed.connect(boost::bind(&Private::doChanged, this)); } -public slots: +public: void doChanged() { - emit q->changed(); + q->changed(); } }; diff --git a/src/cpp/proxy/domainmap.h b/src/cpp/proxy/domainmap.h index 1c3f00fd..ddf7d8b2 100644 --- a/src/cpp/proxy/domainmap.h +++ b/src/cpp/proxy/domainmap.h @@ -32,6 +32,7 @@ #include using Signal = boost::signals2::signal; +using Connection = boost::signals2::scoped_connection; // this class offers fast access to the routes file. the table is maintained // by a background thread so that file access doesn't cause blocking.