10#include <private/qproperty_p.h>
11#include <private/qobject_p.h>
12#include <private/qdbusconnection_p.h>
29 q_func()->setWatchedServices(
list);
37 q_func()->setWatchMode(
mode);
44 QDBusServiceWatcher::WatchMode newMode);
50void QDBusServiceWatcherPrivate::_q_serviceOwnerChanged(
const QString &service,
const QString &oldOwner,
const QString &newOwner)
53 emit q->serviceOwnerChanged(service, oldOwner, newOwner);
54 if (oldOwner.isEmpty())
55 emit q->serviceRegistered(service);
56 else if (newOwner.isEmpty())
57 emit q->serviceUnregistered(service);
62 QDBusServiceWatcher::WatchMode newMode)
64 const QStringList oldServices = watchedServicesData.valueBypassingBindings();
65 const QDBusServiceWatcher::WatchMode oldMode = watchMode.valueBypassingBindings();
73 watchMode.setValueBypassingBindings(newMode);
74 watchedServicesData.setValueBypassingBindings(newServices);
84 QDBusServiceWatcher::WatchMode
mode)
87 if (
d &&
d->shouldWatchService(service))
92 QDBusServiceWatcher::WatchMode
mode)
95 if (
d &&
d->shouldWatchService(service))
251 return d_func()->watchedServicesData;
267 d->watchedServicesData.removeBindingUnlessInWrapper();
268 if (
services ==
d->watchedServicesData.valueBypassingBindings())
271 d->setConnection(
services,
d->connection,
d->watchMode);
272 d->watchedServicesData.notify();
278 return &
d->watchedServicesData;
291 d->watchedServicesData.removeBindingUnlessInWrapper();
292 auto services =
d->watchedServicesData.valueBypassingBindings();
296 d->addService(newService,
d->watchMode);
299 d->watchedServicesData.setValueBypassingBindings(
services);
301 d->watchedServicesData.notify();
317 d->watchedServicesData.removeBindingUnlessInWrapper();
318 auto tempList =
d->watchedServicesData.valueBypassingBindings();
319 const bool result = tempList.removeOne(service);
324 d->removeService(service,
d->watchMode);
325 d->watchedServicesData.setValueBypassingBindings(tempList);
326 d->watchedServicesData.notify();
332 return d_func()->watchMode;
337 return &d_func()->watchMode;
343 d->watchMode.removeBindingUnlessInWrapper();
344 if (
mode ==
d->watchMode.valueBypassingBindings())
347 d->setConnection(
d->watchedServicesData,
d->connection,
mode);
348 d->watchMode.notify();
358 return d_func()->connection;
378 d->setConnection(
d->watchedServicesData,
connection,
d->watchMode);
385#include "moc_qdbusservicewatcher.cpp"
std::vector< ObjCStrongReference< CBMutableService > > services
static QDBusConnectionPrivate * d(const QDBusConnection &q)
const QString const QString &void setConnection(const QStringList &newServices, const QDBusConnection &newConnection, QDBusServiceWatcher::WatchMode newMode)
void setWatchedServicesForwardToQ(const QStringList &list)
QDBusServiceWatcherPrivate(const QDBusConnection &c, QDBusServiceWatcher::WatchMode wm)
void setWatchModeForwardToQ(QDBusServiceWatcher::WatchMode mode)
Q_OBJECT_COMPAT_PROPERTY(QDBusServiceWatcherPrivate, QStringList, watchedServicesData, &QDBusServiceWatcherPrivate::setWatchedServicesForwardToQ) QDBusConnection connection
Q_OBJECT_COMPAT_PROPERTY(QDBusServiceWatcherPrivate, QDBusServiceWatcher::WatchMode, watchMode, &QDBusServiceWatcherPrivate::setWatchModeForwardToQ) void _q_serviceOwnerChanged(const QString &
void removeService(const QString &service, QDBusServiceWatcher::WatchMode mode)
void addService(const QString &service, QDBusServiceWatcher::WatchMode mode)
The QDBusServiceWatcher class allows the user to watch for a bus service change.
bool removeWatchedService(const QString &service)
Removes the service from the list of services being watched by this object.
QStringList watchedServices
the list of services watched.
~QDBusServiceWatcher()
Destroys the QDBusServiceWatcher object and releases any resources associated with it.
void setConnection(const QDBusConnection &connection)
Sets the D-Bus connection that this object is attached to be connection.
QBindable< QStringList > bindableWatchedServices()
QDBusConnection connection() const
Returns the QDBusConnection that this object is attached to.
WatchMode watchMode
the current watch mode for this QDBusServiceWatcher object.
QDBusServiceWatcher(QObject *parent=nullptr)
Creates a QDBusServiceWatcher object.
void addWatchedService(const QString &newService)
Adds newService to the list of services to be watched by this object.
void setWatchMode(WatchMode mode)
QBindable< WatchMode > bindableWatchMode()
void setWatchedServices(const QStringList &services)
Sets the list of D-Bus services being watched to be services.
\macro QT_RESTRICTED_CAST_FROM_ASCII
Combined button and popup list for selecting options.
QList< QString > QStringList
Constructs a string list that contains the given string, str.
DBusConnection * connection
GLdouble GLdouble GLdouble GLdouble q