File indexing completed on 2024-12-29 05:05:17

0001 /*
0002     SPDX-FileCopyrightText: 2010-2016 Ivan Cukic <ivan.cukic(at)kde.org>
0003 
0004     SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0005 */
0006 
0007 #ifndef DBUS_COMMON_H
0008 #define DBUS_COMMON_H
0009 
0010 #include <QDBusConnection>
0011 #include <QDBusInterface>
0012 
0013 // clang-format off
0014 
0015 #define KAMD_DBUS_SERVICE                                                      \
0016     QStringLiteral("org.kde.ActivityManager")
0017 
0018 #define KAMD_DBUS_OBJECT_PATH(A)                                               \
0019     (sizeof(A) > 2 ? QLatin1String("/ActivityManager/" A)                      \
0020                    : QLatin1String("/ActivityManager"))
0021 
0022 #define KAMD_DBUS_OBJECT(A)                                                    \
0023     QLatin1String("org.kde.ActivityManager." A)
0024 
0025 #define KAMD_DBUS_INTERFACE(OBJECT_PATH, OBJECT, PARENT)                       \
0026     QDBusInterface(KAMD_DBUS_SERVICE,                                          \
0027                    KAMD_DBUS_OBJECT_PATH(OBJECT_PATH),                         \
0028                    KAMD_DBUS_OBJECT(OBJECT),                                   \
0029                    QDBusConnection::sessionBus(),                              \
0030                    PARENT)
0031 
0032 #define KAMD_DBUS_DECL_INTERFACE(VAR, OBJECT_PATH, OBJECT)                     \
0033     QDBusInterface VAR(KAMD_DBUS_SERVICE,                                      \
0034                    KAMD_DBUS_OBJECT_PATH(OBJECT_PATH),                         \
0035                    KAMD_DBUS_OBJECT(OBJECT),                                   \
0036                    QDBusConnection::sessionBus(),                              \
0037                    nullptr)
0038 
0039 #define KAMD_DBUS_CLASS_INTERFACE(OBJECT_PATH, OBJECT, PARENT)                 \
0040     org::kde::ActivityManager::OBJECT(                                         \
0041                 KAMD_DBUS_SERVICE,                                             \
0042                 KAMD_DBUS_OBJECT_PATH(OBJECT_PATH),                            \
0043                 QDBusConnection::sessionBus(),                                 \
0044                 PARENT)
0045 
0046 #endif // DBUS_COMMON_H
0047