diff options
author | Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io> | 2023-08-16 15:25:51 +0200 |
---|---|---|
committer | Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io> | 2023-08-22 16:26:02 +0200 |
commit | e073d7d20c4ce3dfb8ead25ce0a458ad4fe52a1a (patch) | |
tree | 5d50034a9479a7fa82dba95dc8244be2ac2227b2 /src/dbus/qdbusserver.cpp | |
parent | a1ab2297a90d9a5a840f491c513b5b39eab40dc0 (diff) |
QDBusServer: Delegate construction to two-argument constructor
This reduces code duplication.
Change-Id: Ia637045f9495d68dba41bc146c9ba807f5619c5d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/dbus/qdbusserver.cpp')
-rw-r--r-- | src/dbus/qdbusserver.cpp | 24 |
1 files changed, 6 insertions, 18 deletions
diff --git a/src/dbus/qdbusserver.cpp b/src/dbus/qdbusserver.cpp index cb3cee3d6b..3d9dff891d 100644 --- a/src/dbus/qdbusserver.cpp +++ b/src/dbus/qdbusserver.cpp @@ -51,27 +51,15 @@ QDBusServer::QDBusServer(const QString &address, QObject *parent) localhost (elsewhere). */ QDBusServer::QDBusServer(QObject *parent) - : QObject(parent), d(nullptr) -{ + : QDBusServer( #ifdef Q_OS_UNIX - // Use Unix sockets on Unix systems only - const QString address = QStringLiteral("unix:tmpdir=/tmp"); + // Use Unix sockets on Unix systems only + QStringLiteral("unix:tmpdir=/tmp"), #else - const QString address = QStringLiteral("tcp:"); + QStringLiteral("tcp:"), #endif - - if (!qdbus_loadLibDBus()) - return; - - QDBusConnectionManager *instance = QDBusConnectionManager::instance(); - if (!instance) - return; - - instance->createServer(address, this); - Q_ASSERT(d != nullptr); - - QObject::connect(d, SIGNAL(newServerConnection(QDBusConnectionPrivate*)), - this, SLOT(_q_newConnection(QDBusConnectionPrivate*)), Qt::QueuedConnection); + parent) +{ } /*! |