本文整理汇总了C++中QDBusConnectionPrivate类的典型用法代码示例。如果您正苦于以下问题:C++ QDBusConnectionPrivate类的具体用法?C++ QDBusConnectionPrivate怎么用?C++ QDBusConnectionPrivate使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了QDBusConnectionPrivate类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QDBusConnection
/*!
\since 4.8
Opens a peer-to-peer connection on address \a address and associate with it the
connection name \a name. Returns a QDBusConnection object associated with that connection.
*/
QDBusConnection QDBusConnection::connectToPeer(const QString &address,
const QString &name)
{
// Q_ASSERT_X(QCoreApplication::instance(), "QDBusConnection::addConnection",
// "Cannot create connection without a Q[Core]Application instance");
if (!qdbus_loadLibDBus()) {
QDBusConnectionPrivate *d = 0;
return QDBusConnection(d);
}
QMutexLocker locker(&_q_manager()->mutex);
QDBusConnectionPrivate *d = _q_manager()->connection(name);
if (d || name.isEmpty())
return QDBusConnection(d);
d = new QDBusConnectionPrivate;
// setPeer does the error handling for us
QDBusErrorInternal error;
DBusConnection *c = q_dbus_connection_open_private(address.toUtf8().constData(), error);
d->setPeer(c, error);
_q_manager()->setConnection(name, d);
QDBusConnection retval(d);
return retval;
}
示例2: Q_D
/*!
\internal
Catch signal disconnections.
*/
void QDBusAbstractInterface::disconnectNotify(const QMetaMethod &signal)
{
// someone disconnecting from one of our signals
Q_D(QDBusAbstractInterface);
if (!d->isValid)
return;
QDBusConnectionPrivate *conn = d->connectionPrivate();
if (conn && signal.isValid() && !isSignalConnected(signal))
return conn->disconnectRelay(d->service, d->path, d->interface,
this, signal);
if (!conn)
return;
// wildcard disconnecting, we need to figure out which of our signals are
// no longer connected to anything
const QMetaObject *mo = metaObject();
int midx = QObject::staticMetaObject.methodCount();
const int end = mo->methodCount();
for ( ; midx < end; ++midx) {
QMetaMethod mm = mo->method(midx);
if (mm.methodType() == QMetaMethod::Signal && !isSignalConnected(mm))
conn->disconnectRelay(d->service, d->path, d->interface, this, mm);
}
}
示例3: manager
QDBusConnection QDBusConnection::addConnection(BusType type, const QString &name)
{
// Q_ASSERT_X(QCoreApplication::instance(), "QDBusConnection::addConnection",
// "Cannot create connection without a Q[Core]Application instance");
QDBusConnectionPrivate *d = manager()->connection(name);
if (d)
return QDBusConnection(name);
d = new QDBusConnectionPrivate;
DBusConnection *c = 0;
switch (type) {
case SystemBus:
c = dbus_bus_get(DBUS_BUS_SYSTEM, &d->error);
break;
case SessionBus:
c = dbus_bus_get(DBUS_BUS_SESSION, &d->error);
break;
case ActivationBus:
c = dbus_bus_get(DBUS_BUS_STARTER, &d->error);
break;
}
d->setConnection(c); //setConnection does the error handling for us
manager()->setConnection(name, d);
return QDBusConnection(name);
}
示例4: Q_D
/*!
\internal
Catch signal disconnections.
*/
void QDBusAbstractInterface::disconnectNotify(const char *signal)
{
// someone disconnecting from one of our signals
Q_D(QDBusAbstractInterface);
QDBusConnectionPrivate *conn = d->connectionPrivate();
if (conn)
conn->disconnectRelay(d->service, d->currentOwner, d->path, d->interface,
this, signal);
}
示例5:
QDBusConnectionManager::~QDBusConnectionManager()
{
for (QHash<QString, QDBusConnectionPrivate *>::const_iterator it = connectionHash.constBegin();
it != connectionHash.constEnd(); ++it) {
QDBusConnectionPrivate *d = it.value();
if (!d->ref.deref())
d->deleteYourself();
else
d->closeConnection();
}
connectionHash.clear();
}
示例6: removeConnection
void QDBusConnectionManager::removeConnection(const QString &name)
{
QDBusConnectionPrivate *d = 0;
d = connectionHash.take(name);
if (d && !d->ref.deref())
d->deleteYourself();
// Static objects may be keeping the connection open.
// However, it is harmless to have outstanding references to a connection that is
// closing as long as those references will be soon dropped without being used.
// ### Output a warning if connections are being used after they have been removed.
}
示例7: Q_D
/*!
\internal
Catch signal connections.
*/
void QDBusAbstractInterface::connectNotify(const char *signal)
{
// someone connecting to one of our signals
Q_D(QDBusAbstractInterface);
if (!d->isValid)
return;
// we end up recursing here, so optimize away
if (qstrcmp(signal + 1, "destroyed(QObject*)") == 0)
return;
QDBusConnectionPrivate *conn = d->connectionPrivate();
if (conn) {
conn->connectRelay(d->service, d->path, d->interface,
this, signal);
}
}
示例8: bindToApplication
void QDBusConnectionManager::bindToApplication()
{
if (default_connection) {
default_connection->bindToApplication();
}
/* FIXME-QT4
for (QHash<QString, QDBusConnectionPrivate *>::const_iterator it = connectionHash.constBegin();
it != connectionHash.constEnd(); ++it) {
(*it)->bindToApplication();
}*/
for (ConnectionHash::ConstIterator it = connectionHash.begin();
it != connectionHash.end(); ++it)
{
it.data()->bindToApplication();
}
}