コード例 #1
0
QtMultimediaNotificationBackend::QtMultimediaNotificationBackend(QObject* parent)
    : AbstractNotificationBackend(parent)
{
    NotificationSettings notificationSettings;
    notificationSettings.notify("QtMultimedia/Enabled", this, &QtMultimediaNotificationBackend::enabledChanged);
    notificationSettings.notify("QtMultimedia/AudioFile", this, &QtMultimediaNotificationBackend::audioFileChanged);

    createMediaObject(notificationSettings.value("QtMultimedia/AudioFile", QString()).toString());

    _enabled = notificationSettings.value("QtMultimedia/Enabled", true).toBool();
}
コード例 #2
0
TaskbarNotificationBackend::TaskbarNotificationBackend(QObject* parent)
    : AbstractNotificationBackend(parent)
{
    NotificationSettings notificationSettings;
    _enabled = notificationSettings.value("Taskbar/Enabled", true).toBool();
    _timeout = notificationSettings.value("Taskbar/Timeout", 0).toInt();

    notificationSettings.notify("Taskbar/Enabled", this, &TaskbarNotificationBackend::enabledChanged);
    notificationSettings.notify("Taskbar/Timeout", this, &TaskbarNotificationBackend::timeoutChanged);
}
コード例 #3
0
DockManagerNotificationBackend::DockManagerNotificationBackend(QObject* parent)
    : AbstractNotificationBackend(parent)
    , _bus(QDBusConnection::sessionBus())
{
    NotificationSettings notificationSettings;
    _enabled = notificationSettings.value("DockManager/Enabled", false).toBool();

    notificationSettings.notify("DockManager/Enabled", this, &DockManagerNotificationBackend::enabledChanged);

    _dock = new QDBusInterface("net.launchpad.DockManager", "/net/launchpad/DockManager", "net.launchpad.DockManager", _bus, this);
    if (_dock->isValid()) {
        _bus.connect("net.launchpad.DockManager",
                     "/net/launchpad/DockManager",
                     "net.launchpad.DockManager",
                     "ItemAdded",
                     this,
                     SLOT(itemAdded(QDBusObjectPath)));
    }
    else {
        // evil implementations (awn) use fd.o
        _dock = new QDBusInterface("org.freedesktop.DockManager", "/org/freedesktop/DockManager", "org.freedesktop.DockManager", _bus, this);
        if (_dock->isValid()) {
            _bus.connect("org.freedesktop.DockManager",
                         "/org/freedesktop/DockManager",
                         "org.freedesktop.DockManager",
                         "ItemAdded",
                         this,
                         SLOT(itemAdded(QDBusObjectPath)));
        }
        else {
            _available = _enabled = false;
            return;
        }
    }
    _available = true;

    itemAdded(QDBusObjectPath());

    connect(Client::coreConnection(),
            &CoreConnection::progressValueChanged,
            this,
            selectOverload<int>(&DockManagerNotificationBackend::updateProgress));
    connect(Client::coreConnection(), &CoreConnection::synchronized, this, &DockManagerNotificationBackend::synchronized);
}