QDBusServer: Delegate construction to two-argument constructor

This reduces code duplication.

Change-Id: Ia637045f9495d68dba41bc146c9ba807f5619c5d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Ievgenii Meshcheriakov 2023-08-16 15:25:51 +02:00
parent a1ab2297a9
commit e073d7d20c

View File

@ -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)
{
}
/*!