blob: 8a5fc92ecfc706cd75a979ef5806270833d6e572 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
|
/***************************************************************************
**
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (directui@nokia.com)
**
** This file is part of mcompositor.
**
** If you have questions regarding the use of this file, please contact
** Nokia at directui@nokia.com.
**
** This library is free software; you can redistribute it and/or
** modify it under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation
** and appearing in the file LICENSE.LGPL included in the packaging
** of this file.
**
****************************************************************************/
// -*- C++ -*-
#ifndef MRMISERVER_H
#define MRMISERVER_H
#include <QObject>
#include "mexport.h"
class MRmiServerPrivate;
class MRmiServerPrivateSocket;
/*!
* \class MRmiServer
* \brief The MRmiServer provides a way for member functions of QObject-based
* classes to be directly invoked from another process without relying on an
* external transport such as d-bus.
*
* To make a QObject-based class remotely callable from another process,
* ensure that the object has Q_OBJECT macro and the member functions you want
* to export are public slots themselves.
*
* The types of the arguments of those member functions need to be supported
* by QVariant as well. Most Qt types are supported. This include from plain
* old data types to complex GUI types such as QRect, QColor, QImages, and more.
* Container types such as QList are even supported.
*
* If needed, custom complex classes can also be sent across the wire
* provided the operator QVariant(), operator<<() and
* operator>>() are overloaded, and the class is declared in Qt's metaobject
* system using qRegisterMetaType(). Qt uses this class internally for
* mashalling/unmarshalling types (see QMetaType for details).
*/
class M_EXPORT MRmiServer: public QObject
{
Q_OBJECT
public:
/*!
* Creates a MRmiServer
*
* \param key a unique key that identifies this server
* \param parent QObject.
*/
explicit MRmiServer(const QString& key, QObject* parent = 0);
/*!
* Disconnects all connections and destroys this object
*/
virtual ~MRmiServer();
/*!
* Export a QObject for remote invocation. Currently only one QObject per
* MRmiServer is supported.
*
* \param object QObject to be exported.
*/
void exportObject(QObject* object);
private:
Q_DISABLE_COPY(MRmiServer)
Q_DECLARE_PRIVATE(MRmiServer)
Q_PRIVATE_SLOT(d_func(), void _q_incoming())
Q_PRIVATE_SLOT(d_func(), void _q_readData())
MRmiServerPrivate * const d_ptr;
friend class MRmiServerPrivateSocket;
};
#endif
|