~alan-griffiths/miral/debug

« back to all changes in this revision

Viewing changes to miral-qt/src/common/abstractdbusservicemonitor.h

  • Committer: Gerry Boland
  • Date: 2016-06-01 22:06:51 UTC
  • mto: This revision was merged to the branch mainline in revision 178.
  • Revision ID: gerry.boland@canonical.com-20160601220651-ge508tffql4e7u7c
Import QtMir code into miral-qt subdirectory. Disabled by default, use -DMIRAL_ENABLE_QT=1 to build.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (C) 2011-2015 Canonical, Ltd.
 
3
 *
 
4
 * This program is free software: you can redistribute it and/or modify it under
 
5
 * the terms of the GNU Lesser General Public License version 3, as published by
 
6
 * the Free Software Foundation.
 
7
 *
 
8
 * This program is distributed in the hope that it will be useful, but WITHOUT
 
9
 * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
 
10
 * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
11
 * Lesser General Public License for more details.
 
12
 *
 
13
 * You should have received a copy of the GNU Lesser General Public License
 
14
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
15
 */
 
16
 
 
17
#ifndef ABSTRACTDBUSSERVICEMONITOR_H
 
18
#define ABSTRACTDBUSSERVICEMONITOR_H
 
19
 
 
20
#include <QObject>
 
21
#include <QString>
 
22
#include <QDBusConnection>
 
23
 
 
24
class QDBusAbstractInterface;
 
25
class QDBusServiceWatcher;
 
26
 
 
27
class Q_DECL_EXPORT AbstractDBusServiceMonitor : public QObject
 
28
{
 
29
    Q_OBJECT
 
30
    Q_PROPERTY(bool serviceAvailable READ serviceAvailable NOTIFY serviceAvailableChanged)
 
31
 
 
32
public:
 
33
    explicit AbstractDBusServiceMonitor(const QString &service, const QString &path, const QString &interface,
 
34
                                        const QDBusConnection &connection = QDBusConnection::sessionBus(),
 
35
                                        QObject *parent = 0);
 
36
    ~AbstractDBusServiceMonitor();
 
37
 
 
38
    QDBusAbstractInterface* dbusInterface() const;
 
39
 
 
40
    bool serviceAvailable() const;
 
41
 
 
42
Q_SIGNALS:
 
43
    void serviceAvailableChanged(bool available);
 
44
 
 
45
private Q_SLOTS:
 
46
    void createInterface(const QString &service);
 
47
    void destroyInterface(const QString &service);
 
48
 
 
49
protected:
 
50
    const QString m_service;
 
51
    const QString m_path;
 
52
    const QString m_interface;
 
53
    const QDBusConnection m_busConnection;
 
54
    QDBusServiceWatcher* m_watcher;
 
55
    QDBusAbstractInterface* m_dbusInterface;
 
56
};
 
57
 
 
58
#endif // ABSTRACTDBUSSERVICEMONITOR_H