nodeinstanceserverproxy.h 4.51 KB
Newer Older
hjk's avatar
hjk committed
1
/****************************************************************************
2
**
3
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
hjk's avatar
hjk committed
4
** Contact: http://www.qt-project.org/legal
5
**
hjk's avatar
hjk committed
6
** This file is part of Qt Creator.
7
**
hjk's avatar
hjk committed
8 9 10 11 12 13 14
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia.  For licensing terms and
** conditions see http://qt.digia.com/licensing.  For further information
** use the contact form at http://qt.digia.com/contact-us.
15 16
**
** GNU Lesser General Public License Usage
hjk's avatar
hjk committed
17 18 19 20 21 22 23 24 25
** Alternatively, 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, Digia gives you certain additional
** rights.  These rights are described in the Digia Qt LGPL Exception
26 27
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
hjk's avatar
hjk committed
28
****************************************************************************/
29

30 31 32 33 34 35 36
#ifndef NODEINSTANCESERVERPROXY_H
#define NODEINSTANCESERVERPROXY_H

#include "nodeinstanceserverinterface.h"

#include <QWeakPointer>
#include <QProcess>
37
#include <QFile>
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54

QT_BEGIN_NAMESPACE
class QLocalServer;
class QLocalSocket;
class QProcess;
QT_END_NAMESPACE

namespace QmlDesigner {

class NodeInstanceClientInterface;
class NodeInstanceView;
class NodeInstanceClientProxy;

class NodeInstanceServerProxy : public NodeInstanceServerInterface
{
    Q_OBJECT
public:
55
    explicit NodeInstanceServerProxy(NodeInstanceView *nodeInstanceView, RunModus runModus = NormalModus, const QString &pathToQt = QString());
56 57 58 59 60 61 62 63 64
    ~NodeInstanceServerProxy();
    void createInstances(const CreateInstancesCommand &command);
    void changeFileUrl(const ChangeFileUrlCommand &command);
    void createScene(const CreateSceneCommand &command);
    void clearScene(const ClearSceneCommand &command);
    void removeInstances(const RemoveInstancesCommand &command);
    void removeProperties(const RemovePropertiesCommand &command);
    void changePropertyBindings(const ChangeBindingsCommand &command);
    void changePropertyValues(const ChangeValuesCommand &command);
65
    void changeAuxiliaryValues(const ChangeAuxiliaryCommand &command);
66 67 68
    void reparentInstances(const ReparentInstancesCommand &command);
    void changeIds(const ChangeIdsCommand &command);
    void changeState(const ChangeStateCommand &command);
69
    void completeComponent(const CompleteComponentCommand &command);
70
    void changeNodeSource(const ChangeNodeSourceCommand &command);
71
    void token(const TokenCommand &command);
72
    void removeSharedMemory(const RemoveSharedMemoryCommand &command);
73 74 75 76 77

protected:
    void writeCommand(const QVariant &command);
    void dispatchCommand(const QVariant &command);
    NodeInstanceClientInterface *nodeInstanceClient() const;
78
    QString missingQmlPuppetErrorMessage(const QString &applicationPath) const;
79 80
    QString qmlPuppetApplicationName() const;
    QString macOSBundlePath(const QString &path) const;
81 82 83 84 85 86

signals:
    void processCrashed();

private slots:
    void processFinished(int exitCode, QProcess::ExitStatus exitStatus);
87 88
    void readFirstDataStream();
    void readSecondDataStream();
89
    void readThirdDataStream();
90

91 92 93
    void printEditorProcessOutput();
    void printPreviewProcessOutput();
    void printRenderProcessOutput();
94
private:
95
    QFile m_captureFileForTest;
96
    QWeakPointer<QLocalServer> m_localServer;
97 98
    QWeakPointer<QLocalSocket> m_firstSocket;
    QWeakPointer<QLocalSocket> m_secondSocket;
99
    QWeakPointer<QLocalSocket> m_thirdSocket;
100
    QWeakPointer<NodeInstanceView> m_nodeInstanceView;
101 102
    QWeakPointer<QProcess> m_qmlPuppetEditorProcess;
    QWeakPointer<QProcess> m_qmlPuppetPreviewProcess;
103
    QWeakPointer<QProcess> m_qmlPuppetRenderProcess;
104 105
    quint32 m_firstBlockSize;
    quint32 m_secondBlockSize;
106
    quint32 m_thirdBlockSize;
107 108 109 110
    quint32 m_writeCommandCounter;
    quint32 m_firstLastReadCommandCounter;
    quint32 m_secondLastReadCommandCounter;
    quint32 m_thirdLastReadCommandCounter;
111 112
    RunModus m_runModus;
    int m_synchronizeId;
113 114 115 116 117
};

} // namespace QmlDesigner

#endif // NODEINSTANCESERVERPROXY_H