From 10ca783442534677bc259d84bf0ddfd8be1ec1ea Mon Sep 17 00:00:00 2001 From: Matt Broadstone Date: Fri, 30 May 2014 15:40:38 -0400 Subject: [PATCH] split binded to bound/unbound, replaced invokeMetaMethod with Q_EMIT --- src/amqp_queue.cpp | 19 ++++++++++--------- src/amqp_queue.h | 4 ++-- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/amqp_queue.cpp b/src/amqp_queue.cpp index 8b7a9f6..00c7f7a 100644 --- a/src/amqp_queue.cpp +++ b/src/amqp_queue.cpp @@ -399,7 +399,7 @@ bool QueuePrivate::_q_method(const Frame::Method &frame) getOk(frame); break; case bmGetEmpty: - QMetaObject::invokeMethod(q, "empty"); + Q_EMIT q->empty(); break; default: break; @@ -424,7 +424,7 @@ void QueuePrivate::declareOk(const Frame::Method &frame) stream >> messageCount >> consumerCount; qDebug("Message count %d\nConsumer count: %d", messageCount, consumerCount); - QMetaObject::invokeMethod(q, "declared"); + Q_EMIT q->declared(); } void QueuePrivate::deleteOk(const Frame::Method &frame) @@ -438,25 +438,26 @@ void QueuePrivate::deleteOk(const Frame::Method &frame) qint32 messageCount = 0; stream >> messageCount; qDebug("Message count %d", messageCount); - QMetaObject::invokeMethod(q, "removed"); + + Q_EMIT q->removed(); } void QueuePrivate::bindOk(const Frame::Method &frame) { Q_UNUSED(frame) - Q_Q(Queue); - qDebug() << "bound to queue: " << name; - QMetaObject::invokeMethod(q, "binded", Q_ARG(bool, true)); + Q_Q(Queue); + qDebug() << Q_FUNC_INFO << "bound to queue: " << name; + Q_EMIT q->bound(); } void QueuePrivate::unbindOk(const Frame::Method &frame) { Q_UNUSED(frame) - Q_Q(Queue); - qDebug() << "unbound queue: " << name; - QMetaObject::invokeMethod(q, "binded", Q_ARG(bool, false)); + Q_Q(Queue); + qDebug() << Q_FUNC_INFO << "unbound queue: " << name; + Q_EMIT q->unbound(); } void QueuePrivate::getOk(const Frame::Method &frame) diff --git a/src/amqp_queue.h b/src/amqp_queue.h index d0fa3ea..d10ffb7 100644 --- a/src/amqp_queue.h +++ b/src/amqp_queue.h @@ -47,7 +47,6 @@ public: void declare(const QString &name = QString(), QueueOptions options = QueueOptions(Durable | AutoDelete)); void remove(bool ifUnused = true, bool ifEmpty = true, bool noWait = true); - void purge(); void bind(const QString &exchangeName, const QString &key); @@ -70,7 +69,8 @@ public: Q_SIGNALS: void declared(); - void binded(bool); + void bound(); + void unbound(); void removed(); void messageReceived(Queue *pQueue); void empty();