diff options
author | Andrew Christian <andrew.christian@nokia.com> | 2012-02-16 07:16:20 -0500 |
---|---|---|
committer | Chris Craig <ext-chris.craig@nokia.com> | 2012-02-16 16:26:04 +0100 |
commit | eca172878a135b0d60f4540c8495b3a6dad0dc3c (patch) | |
tree | 74f14293a42fa334079b4de8c0c38c7d3f115875 /src | |
parent | 7496a35a5cf1480efab3a8f1c7f4ca80858a4f06 (diff) |
Added DeclarativeSocketLauncher class and created test cases.
Change-Id: I67fc3561256c279acf6e10def3ffe58f12c68195
Reviewed-by: Chris Craig <ext-chris.craig@nokia.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/declarative/declarative-lib.pri | 2 | ||||
-rw-r--r-- | src/declarative/declarativeprocessmanager.cpp | 4 | ||||
-rw-r--r-- | src/declarative/declarativeprocessmanager.h | 2 | ||||
-rw-r--r-- | src/declarative/declarativesocketlauncher.cpp | 104 | ||||
-rw-r--r-- | src/declarative/declarativesocketlauncher.h | 78 |
5 files changed, 187 insertions, 3 deletions
diff --git a/src/declarative/declarative-lib.pri b/src/declarative/declarative-lib.pri index 32b785a..ad55646 100644 --- a/src/declarative/declarative-lib.pri +++ b/src/declarative/declarative-lib.pri @@ -6,8 +6,10 @@ INCLUDEPATH += $$PWD HEADERS += \ $$PWD/declarativeprocessmanager.h \ + $$PWD/declarativesocketlauncher.h \ $$PWD/processinfotemplate.h SOURCES += \ $$PWD/declarativeprocessmanager.cpp \ + $$PWD/declarativesocketlauncher.cpp \ $$PWD/processinfotemplate.cpp diff --git a/src/declarative/declarativeprocessmanager.cpp b/src/declarative/declarativeprocessmanager.cpp index 3ae9964..b4c30e1 100644 --- a/src/declarative/declarativeprocessmanager.cpp +++ b/src/declarative/declarativeprocessmanager.cpp @@ -77,8 +77,8 @@ void DeclarativeProcessManager::componentComplete() /*! \internal */ -void append_factory(QDeclarativeListProperty<ProcessBackendFactory> *list, - ProcessBackendFactory *factory) +void DeclarativeProcessManager::append_factory(QDeclarativeListProperty<ProcessBackendFactory> *list, + ProcessBackendFactory *factory) { DeclarativeProcessManager *manager = static_cast<DeclarativeProcessManager *>(list->object); if (factory && manager) diff --git a/src/declarative/declarativeprocessmanager.h b/src/declarative/declarativeprocessmanager.h index be7474b..c0ad19d 100644 --- a/src/declarative/declarativeprocessmanager.h +++ b/src/declarative/declarativeprocessmanager.h @@ -82,7 +82,7 @@ protected slots: virtual void processFrontendDestroyed(); private: - friend void append_factory(QDeclarativeListProperty<ProcessBackendFactory>*, + static void append_factory(QDeclarativeListProperty<ProcessBackendFactory>*, ProcessBackendFactory*); }; diff --git a/src/declarative/declarativesocketlauncher.cpp b/src/declarative/declarativesocketlauncher.cpp new file mode 100644 index 0000000..a8b150a --- /dev/null +++ b/src/declarative/declarativesocketlauncher.cpp @@ -0,0 +1,104 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used 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. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "declarativesocketlauncher.h" + +QT_BEGIN_NAMESPACE_PROCESSMANAGER + +/*! + \class DeclarativeSocketLauncher DeclarativeSocketLauncher + \brief The DeclarativeSocketLauncher class encapsulates ways of creating and tracking processes + suitable for QtDeclarative programs. +*/ + +/*! + Construct a DeclarativeSocketLauncher with an optional \a parent +*/ + +DeclarativeSocketLauncher::DeclarativeSocketLauncher(QObject *parent) + : SocketLauncher(parent) +{ +} + +/*! + \internal +*/ +void DeclarativeSocketLauncher::classBegin() +{ +} + +/*! + \internal +*/ +void DeclarativeSocketLauncher::componentComplete() +{ +} + +/*! + \internal +*/ +void DeclarativeSocketLauncher::append_factory(QDeclarativeListProperty<ProcessBackendFactory> *list, + ProcessBackendFactory *factory) +{ + DeclarativeSocketLauncher *launcher = static_cast<DeclarativeSocketLauncher *>(list->object); + if (factory && launcher) + launcher->addFactory(factory); +} + +/*! + \internal + */ + +QDeclarativeListProperty<ProcessBackendFactory> DeclarativeSocketLauncher::factories() +{ + return QDeclarativeListProperty<ProcessBackendFactory>(this, NULL, append_factory); +} + +/*! + \internal +*/ + +QDeclarativeListProperty<QObject> DeclarativeSocketLauncher::children() +{ + return QDeclarativeListProperty<QObject>(this, m_children); +} + +#include "moc_declarativesocketlauncher.cpp" + +QT_END_NAMESPACE_PROCESSMANAGER diff --git a/src/declarative/declarativesocketlauncher.h b/src/declarative/declarativesocketlauncher.h new file mode 100644 index 0000000..494b4bc --- /dev/null +++ b/src/declarative/declarativesocketlauncher.h @@ -0,0 +1,78 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used 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. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef DECLARATIVE_SOCKET_LAUNCHER_H +#define DECLARATIVE_SOCKET_LAUNCHER_H + +#include <QtDeclarative> +#include "socketlauncher.h" + +class JsonAuthority; +class QtAddOn::JsonStream::JsonAuthority; + +QT_BEGIN_NAMESPACE_PROCESSMANAGER + +class Q_ADDON_PROCESSMANAGER_EXPORT DeclarativeSocketLauncher : public SocketLauncher, + public QDeclarativeParserStatus +{ + Q_OBJECT + Q_INTERFACES(QDeclarativeParserStatus) + Q_PROPERTY(QDeclarativeListProperty<ProcessBackendFactory> factories READ factories) + Q_PROPERTY(QDeclarativeListProperty<QObject> children READ children) + Q_CLASSINFO("DefaultProperty", "children") + +public: + DeclarativeSocketLauncher(QObject *parent=0); + QDeclarativeListProperty<ProcessBackendFactory> factories(); + QDeclarativeListProperty<QObject> children(); + + void classBegin(); + void componentComplete(); + +private: + static void append_factory(QDeclarativeListProperty<ProcessBackendFactory>*, + ProcessBackendFactory*); + QList<QObject *> m_children; +}; + +QT_END_NAMESPACE_PROCESSMANAGER + +QML_DECLARE_TYPE(QT_PREPEND_NAMESPACE_PROCESSMANAGER(DeclarativeSocketLauncher)) + +#endif // DECLARATIVE_SOCKET_LAUNCHER_H |