mirror of
https://github.com/redis/RedisDesktopManager.git
synced 2026-10-24 08:25:03 +08:00
17 lines
605 B
C++
17 lines
605 B
C++
#include "events.h"
|
|
|
|
void Events::registerLoggerForConnection(RedisClient::Connection& c) {
|
|
auto self = sharedFromThis().toWeakRef();
|
|
QObject::connect(
|
|
&c, &RedisClient::Connection::log, this, [self](const QString& info) {
|
|
if (!self) return;
|
|
emit self.toStrongRef()->log(QString("Connection: %1").arg(info));
|
|
}, Qt::QueuedConnection);
|
|
|
|
QObject::connect(
|
|
&c, &RedisClient::Connection::error, this, [self](const QString& error) {
|
|
if (!self) return;
|
|
emit self.toStrongRef()->log(QString("Connection: %1").arg(error));
|
|
}, Qt::QueuedConnection);
|
|
}
|