mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-02 15:15:50 +08:00
refs #42
- Added DBus handler interface - Added more complex flow to both samples - Added custom class to be transfered
This commit is contained in:
30
src/blackmisc/dbus_handler.cpp
Normal file
30
src/blackmisc/dbus_handler.cpp
Normal file
@@ -0,0 +1,30 @@
|
||||
/* Copyright (C) 2013 VATSIM Community / contributors
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "blackcore/dbus_server.h"
|
||||
#include "blackmisc/dbus_handler.h"
|
||||
|
||||
namespace BlackMisc
|
||||
{
|
||||
|
||||
IDBusHandler::IDBusHandler(QObject *parent) :
|
||||
QObject(parent), m_dbusserver(0), m_parent(parent)
|
||||
{
|
||||
}
|
||||
|
||||
void IDBusHandler::setDBusServer(BlackCore::CDBusServer *dbusServer)
|
||||
{
|
||||
m_dbusserver = dbusServer;
|
||||
|
||||
if (m_dbusserver)
|
||||
m_dbusserver->addObject(m_dbusPath, this);
|
||||
}
|
||||
|
||||
void IDBusHandler::setDBusObjectPath(const QString &dbusPath)
|
||||
{
|
||||
m_dbusPath = dbusPath;
|
||||
}
|
||||
|
||||
} // namespace BlackMisc
|
||||
59
src/blackmisc/dbus_handler.h
Normal file
59
src/blackmisc/dbus_handler.h
Normal file
@@ -0,0 +1,59 @@
|
||||
/* Copyright (C) 2013 VATSIM Community / contributors
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef DBUS_HANDLER_BASE_H
|
||||
#define DBUS_HANDLER_BASE_H
|
||||
|
||||
#include <QObject>
|
||||
|
||||
namespace BlackCore {
|
||||
class CDBusServer;
|
||||
}
|
||||
|
||||
namespace BlackMisc
|
||||
{
|
||||
|
||||
/*!
|
||||
* \brief DBus Handler Base class
|
||||
* \details This class implements the basic methods any DBus handler class needs to use. If you want
|
||||
* to implement your own DBus handler derive it from this one.
|
||||
*/
|
||||
|
||||
class IDBusHandler : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
protected:
|
||||
|
||||
BlackCore::CDBusServer *m_dbusserver; //!< Our DBusServer
|
||||
QString m_dbusPath; //!< DBus object path
|
||||
|
||||
QObject *m_parent; //!< Pointer to the parent plane manager object
|
||||
|
||||
public:
|
||||
|
||||
/*!
|
||||
* \brief Default constructor
|
||||
* \param parent
|
||||
*/
|
||||
IDBusHandler(QObject *parent = 0);
|
||||
|
||||
/*!
|
||||
* \brief Sets the DBusServer
|
||||
* \param dbusServer
|
||||
*/
|
||||
void setDBusServer(BlackCore::CDBusServer *dbusServer);
|
||||
|
||||
void setDBusObjectPath( const QString &dbusPath);
|
||||
|
||||
signals:
|
||||
|
||||
public slots:
|
||||
|
||||
};
|
||||
|
||||
} // namespace BlackMisc
|
||||
|
||||
#endif // DBUS_HANDLER_BASE_H
|
||||
Reference in New Issue
Block a user