Commit d7bd46db authored by Marco Bubke's avatar Marco Bubke

QmlDesigner.NodeInstances: Add end puppet command

Change-Id: Ice3c6ce1bb0d16d4ffbc33557b12fa147ac6058c
Reviewed-by: default avatarThomas Hartmann <Thomas.Hartmann@digia.com>
parent dc2527f3
INCLUDEPATH += $$PWD/
HEADERS += $$PWD/synchronizecommand.h
HEADERS += $$PWD/endpuppetcommand.h
HEADERS += $$PWD/tokencommand.h
HEADERS += $$PWD/componentcompletedcommand.h
HEADERS += $$PWD/completecomponentcommand.h
......@@ -25,6 +26,7 @@ HEADERS += $$PWD/changeauxiliarycommand.h
HEADERS += $$PWD/removesharedmemorycommand.h
SOURCES += $$PWD/synchronizecommand.cpp
SOURCES += $$PWD/endpuppetcommand.cpp
SOURCES += $$PWD/tokencommand.cpp
SOURCES += $$PWD/componentcompletedcommand.cpp
SOURCES += $$PWD/completecomponentcommand.cpp
......
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Nokia Corporation (qt-info@nokia.com)
**
**
** 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.
**
** 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.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
**
**************************************************************************/
#include "endpuppetcommand.h"
namespace QmlDesigner {
EndPuppetCommand::EndPuppetCommand()
{
}
QDataStream &operator<<(QDataStream &out, const EndPuppetCommand &/*command*/)
{
return out;
}
QDataStream &operator>>(QDataStream &in, EndPuppetCommand &/*command*/)
{
return in;
}
} // namespace QmlDesigner
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Nokia Corporation (qt-info@nokia.com)
**
**
** 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.
**
** 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.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
**
**************************************************************************/
#ifndef QMLDESIGNER_ENDPUPPETCOMMAND_H
#define QMLDESIGNER_ENDPUPPETCOMMAND_H
#include <qmetatype.h>
namespace QmlDesigner {
class EndPuppetCommand
{
public:
EndPuppetCommand();
};
QDataStream &operator<<(QDataStream &out, const EndPuppetCommand &command);
QDataStream &operator>>(QDataStream &in, EndPuppetCommand &command);
} // namespace QmlDesigner
Q_DECLARE_METATYPE(QmlDesigner::EndPuppetCommand)
#endif // QMLDESIGNER_ENDPUPPETCOMMAND_H
......@@ -61,6 +61,7 @@
#include "synchronizecommand.h"
#include "tokencommand.h"
#include "removesharedmemorycommand.h"
#include "endpuppetcommand.h"
namespace QmlDesigner {
......@@ -175,6 +176,9 @@ void NodeInstanceServerInterface::registerCommands()
qRegisterMetaType<RemoveSharedMemoryCommand>("RemoveSharedMemoryCommand");
qRegisterMetaTypeStreamOperators<RemoveSharedMemoryCommand>("RemoveSharedMemoryCommand");
qRegisterMetaType<EndPuppetCommand>("EndPuppetCommand");
qRegisterMetaTypeStreamOperators<EndPuppetCommand>("EndPuppetCommand");
}
}
......@@ -66,6 +66,7 @@
#include "statepreviewimagechangedcommand.h"
#include "componentcompletedcommand.h"
#include "changenodesourcecommand.h"
#include "endpuppetcommand.h"
namespace QmlDesigner {
......@@ -287,6 +288,12 @@ void NodeInstanceClientProxy::redirectToken(const TokenCommand &command)
nodeInstanceServer()->token(command);
}
void NodeInstanceClientProxy::redirectToken(const EndPuppetCommand &command)
{
qDebug() << "End Process: " << QCoreApplication::applicationPid();
QCoreApplication::exit();
}
void NodeInstanceClientProxy::dispatchCommand(const QVariant &command)
{
static const int createInstancesCommandType = QMetaType::type("CreateInstancesCommand");
......@@ -306,6 +313,7 @@ void NodeInstanceClientProxy::dispatchCommand(const QVariant &command)
static const int changeNodeSourceCommandType = QMetaType::type("ChangeNodeSourceCommand");
static const int removeSharedMemoryCommandType = QMetaType::type("RemoveSharedMemoryCommand");
static const int tokenCommandType = QMetaType::type("TokenCommand");
static const int endPuppetCommandType = QMetaType::type("EndPuppetCommand");
if (command.userType() == createInstancesCommandType) {
createInstances(command.value<CreateInstancesCommand>());
......@@ -339,6 +347,8 @@ void NodeInstanceClientProxy::dispatchCommand(const QVariant &command)
removeSharedMemory(command.value<RemoveSharedMemoryCommand>());
else if (command.userType() == tokenCommandType)
redirectToken(command.value<TokenCommand>());
else if (command.userType() == endPuppetCommandType)
redirectToken(command.value<EndPuppetCommand>());
else if (command.userType() == synchronizeCommandType) {
SynchronizeCommand synchronizeCommand = command.value<SynchronizeCommand>();
m_synchronizeId = synchronizeCommand.synchronizeId();
......
......@@ -58,6 +58,7 @@ class RemovePropertiesCommand;
class CompleteComponentCommand;
class ChangeStateCommand;
class ChangeNodeSourceCommand;
class EndPuppetCommand;
class NodeInstanceClientProxy : public QObject, public NodeInstanceClientInterface
......@@ -102,6 +103,7 @@ protected:
void changeNodeSource(const ChangeNodeSourceCommand &command);
void removeSharedMemory(const RemoveSharedMemoryCommand &command);
void redirectToken(const TokenCommand &command);
void redirectToken(const EndPuppetCommand &command);
private slots:
void readDataStream();
......
......@@ -36,6 +36,7 @@
#include <QCoreApplication>
#include <QUuid>
#include <QFileInfo>
#include <QTimer>
#include "propertyabstractcontainer.h"
#include "propertyvaluecontainer.h"
......@@ -65,7 +66,7 @@
#include "componentcompletedcommand.h"
#include "tokencommand.h"
#include "removesharedmemorycommand.h"
#include "endpuppetcommand.h"
#include "synchronizecommand.h"
#include "nodeinstanceview.h"
......@@ -234,6 +235,8 @@ NodeInstanceServerProxy::~NodeInstanceServerProxy()
{
disconnect(this, SLOT(processFinished(int,QProcess::ExitStatus)));
writeCommand(QVariant::fromValue(EndPuppetCommand()));
if (m_firstSocket)
m_firstSocket->close();
......@@ -245,13 +248,13 @@ NodeInstanceServerProxy::~NodeInstanceServerProxy()
if (m_qmlPuppetEditorProcess)
m_qmlPuppetEditorProcess->terminate();
QTimer::singleShot(3000, m_qmlPuppetEditorProcess.data(), SLOT(terminate()));
if (m_qmlPuppetPreviewProcess)
m_qmlPuppetPreviewProcess->terminate();
QTimer::singleShot(3000, m_qmlPuppetPreviewProcess.data(), SLOT(terminate()));
if (m_qmlPuppetRenderProcess)
m_qmlPuppetRenderProcess->terminate();
QTimer::singleShot(3000, m_qmlPuppetRenderProcess.data(), SLOT(terminate()));
}
void NodeInstanceServerProxy::dispatchCommand(const QVariant &command)
......@@ -331,6 +334,9 @@ void NodeInstanceServerProxy::writeCommand(const QVariant &command)
void NodeInstanceServerProxy::processFinished(int /*exitCode*/, QProcess::ExitStatus exitStatus)
{
qDebug() << "Process finished:" << sender();
writeCommand(QVariant::fromValue(EndPuppetCommand()));
if (m_firstSocket)
m_firstSocket->close();
if (m_secondSocket)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment