Commit 4f2ceefe authored by Marco Bubke's avatar Marco Bubke Committed by Thomas Hartmann

Add debug output command

Adds a infrastructure to get text information back to the client.

Change-Id: Ie5b92f875fe4cbd5f5a8e4d60a797efa0e5cbf70
Reviewed-by: default avatarThomas Hartmann <Thomas.Hartmann@digia.com>
parent e0411334
INCLUDEPATH += $$PWD/
HEADERS += $$PWD/synchronizecommand.h
HEADERS += $$PWD//debugoutputcommand.h
HEADERS += $$PWD/endpuppetcommand.h
HEADERS += $$PWD/tokencommand.h
HEADERS += $$PWD/componentcompletedcommand.h
......@@ -26,6 +27,7 @@ HEADERS += $$PWD/changeauxiliarycommand.h
HEADERS += $$PWD/removesharedmemorycommand.h
SOURCES += $$PWD/synchronizecommand.cpp
SOURCES += $$PWD/debugoutputcommand.cpp
SOURCES += $$PWD/endpuppetcommand.cpp
SOURCES += $$PWD/tokencommand.cpp
SOURCES += $$PWD/componentcompletedcommand.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 "debugoutputcommand.h"
namespace QmlDesigner {
DebugOutputCommand::DebugOutputCommand()
{
}
DebugOutputCommand::DebugOutputCommand(const QString &text, DebugOutputCommand::Type type)
: m_text(text),
m_type(type)
{
}
qint32 DebugOutputCommand::type() const
{
return m_type;
}
QString DebugOutputCommand::text() const
{
return m_text;
}
QDataStream &operator<<(QDataStream &out, const DebugOutputCommand &command)
{
out << command.type();
out << command.text();
return out;
}
QDataStream &operator>>(QDataStream &in, DebugOutputCommand &command)
{
in >> command.m_type;
in >> command.m_text;
return in;
}
} // namespace QmlDesigner
/****************************************************************************
**
** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of Qt Creator.
**
** 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.
**
** GNU Lesser General Public License Usage
** 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
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
#ifndef QMLDESIGNER_DEBUGOUTPUTCOMMAND_H
#define QMLDESIGNER_DEBUGOUTPUTCOMMAND_H
#include <QMetaType>
#include <QString>
#include <QDataStream>
namespace QmlDesigner {
class DebugOutputCommand
{
friend QDataStream &operator>>(QDataStream &in, DebugOutputCommand &command);
public:
enum Type {
DebugType,
WarningType,
ErrorType,
FatalType
};
DebugOutputCommand();
DebugOutputCommand(const QString &text, Type type);
qint32 type() const;
QString text() const;
private:
QString m_text;
quint32 m_type;
};
QDataStream &operator<<(QDataStream &out, const DebugOutputCommand &command);
QDataStream &operator>>(QDataStream &in, DebugOutputCommand &command);
} // namespace QmlDesigner
Q_DECLARE_METATYPE(QmlDesigner::DebugOutputCommand)
#endif // QMLDESIGNER_DEBUGOUTPUTCOMMAND_H
......@@ -66,6 +66,7 @@
#include "componentcompletedcommand.h"
#include "changenodesourcecommand.h"
#include "endpuppetcommand.h"
#include "debugoutputcommand.h"
namespace QmlDesigner {
......@@ -139,6 +140,11 @@ void NodeInstanceClientProxy::token(const TokenCommand &command)
writeCommand(QVariant::fromValue(command));
}
void NodeInstanceClientProxy::debugOutput(const DebugOutputCommand &command)
{
writeCommand(QVariant::fromValue(command));
}
void NodeInstanceClientProxy::flush()
{
}
......
......@@ -74,6 +74,7 @@ public:
void statePreviewImagesChanged(const StatePreviewImageChangedCommand &command);
void componentCompleted(const ComponentCompletedCommand &command);
void token(const TokenCommand &command);
void debugOutput(const DebugOutputCommand &command);
void flush();
void synchronizeWithClientProcess();
......
......@@ -42,6 +42,7 @@ class StatePreviewImageChangedCommand;
class ComponentCompletedCommand;
class TokenCommand;
class RemoveSharedMemoryCommand;
class DebugOutputCommand;
class NodeInstanceClientInterface
{
......@@ -53,6 +54,7 @@ public:
virtual void statePreviewImagesChanged(const StatePreviewImageChangedCommand &command) = 0;
virtual void componentCompleted(const ComponentCompletedCommand &command) = 0;
virtual void token(const TokenCommand &command) = 0;
virtual void debugOutput(const DebugOutputCommand &command) = 0;
virtual void flush() {};
virtual void synchronizeWithClientProcess() {}
......
......@@ -61,7 +61,7 @@
#include "tokencommand.h"
#include "removesharedmemorycommand.h"
#include "endpuppetcommand.h"
#include "debugoutputcommand.h"
namespace QmlDesigner {
......@@ -178,6 +178,9 @@ void NodeInstanceServerInterface::registerCommands()
qRegisterMetaType<EndPuppetCommand>("EndPuppetCommand");
qRegisterMetaTypeStreamOperators<EndPuppetCommand>("EndPuppetCommand");
qRegisterMetaType<DebugOutputCommand>("DebugOutputCommand");
qRegisterMetaTypeStreamOperators<DebugOutputCommand>("DebugOutputCommand");
}
}
......@@ -1027,6 +1027,12 @@ QObject *NodeInstanceServer::dummyContextObject() const
return m_dummyContextObject.data();
}
void NodeInstanceServer::sendDebugOutput(DebugOutputCommand::Type type, const QString &message)
{
DebugOutputCommand command(message, type);
nodeInstanceClient()->debugOutput(command);
}
void NodeInstanceServer::notifyPropertyChange(qint32 instanceid, const QString &propertyName)
{
if (hasInstanceForId(instanceid))
......
......@@ -38,6 +38,8 @@
#include <nodeinstanceserverinterface.h>
#include "servernodeinstance.h"
#include "debugoutputcommand.h"
QT_BEGIN_NAMESPACE
class QFileSystemWatcher;
class QDeclarativeView;
......@@ -125,6 +127,8 @@ public:
virtual QDeclarativeView *declarativeView() const = 0;
virtual QSGView *sgView() const = 0;
void sendDebugOutput(DebugOutputCommand::Type type, const QString &message);
public slots:
void refreshLocalFileProperty(const QString &path);
void refreshDummyData(const QString &path);
......
......@@ -135,6 +135,7 @@ public:
void statePreviewImagesChanged(const StatePreviewImageChangedCommand &command);
void componentCompleted(const ComponentCompletedCommand &command);
void token(const TokenCommand &command);
void debugOutput(const DebugOutputCommand &command);
QImage statePreviewImage(const ModelNode &stateNode) const;
......
......@@ -67,6 +67,7 @@
#include "removesharedmemorycommand.h"
#include "endpuppetcommand.h"
#include "synchronizecommand.h"
#include "debugoutputcommand.h"
#include "nodeinstanceview.h"
......@@ -263,6 +264,7 @@ void NodeInstanceServerProxy::dispatchCommand(const QVariant &command)
static const int componentCompletedCommandType = QMetaType::type("ComponentCompletedCommand");
static const int synchronizeCommandType = QMetaType::type("SynchronizeCommand");
static const int tokenCommandType = QMetaType::type("TokenCommand");
static const int debugOutputCommandType = QMetaType::type("DebugOutputCommand");
if (command.userType() == informationChangedCommandType)
nodeInstanceClient()->informationChanged(command.value<InformationChangedCommand>());
......@@ -278,6 +280,8 @@ void NodeInstanceServerProxy::dispatchCommand(const QVariant &command)
nodeInstanceClient()->componentCompleted(command.value<ComponentCompletedCommand>());
else if (command.userType() == tokenCommandType)
nodeInstanceClient()->token(command.value<TokenCommand>());
else if (command.userType() == debugOutputCommandType)
nodeInstanceClient()->debugOutput(command.value<DebugOutputCommand>());
else if (command.userType() == synchronizeCommandType) {
SynchronizeCommand synchronizeCommand = command.value<SynchronizeCommand>();
m_synchronizeId = synchronizeCommand.synchronizeId();
......
......@@ -1217,6 +1217,10 @@ void NodeInstanceView::token(const TokenCommand &command)
emitInstanceToken(command.tokenName(), command.tokenNumber(), nodeVector);
}
void NodeInstanceView::debugOutput(const DebugOutputCommand & /*command*/)
{
}
void NodeInstanceView::sendToken(const QString &token, int number, const QVector<ModelNode> &nodeVector)
{
QVector<qint32> instanceIdVector;
......
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