forked from qt-creator/qt-creator
Move QmlConsole to Debugger
Now it is closer to its only user and possibly reusable for no-QML uses there. We also drop the QML/JS syntax checker. The application being debugged can already tell us about syntax errors. There is no need to duplicate that functionality. Change-Id: I2ba151f9f4c854c6119ba5462c21be40bddcebf9 Reviewed-by: Ulf Hermann <ulf.hermann@theqtcompany.com> Reviewed-by: hjk <hjk@theqtcompany.com>
This commit is contained in:
@@ -84,7 +84,7 @@
|
|||||||
\image qtquick-example-setting-breakpoint3.png
|
\image qtquick-example-setting-breakpoint3.png
|
||||||
|
|
||||||
\li To execute JavaScript commands in the current context, open the
|
\li To execute JavaScript commands in the current context, open the
|
||||||
\uicontrol {QML/JS Console} output pane.
|
\uicontrol {Debugger Console} output pane.
|
||||||
|
|
||||||
\li To change the score to 1000, enter \c{gameCanvas.score = 1000}
|
\li To change the score to 1000, enter \c{gameCanvas.score = 1000}
|
||||||
in the console.
|
in the console.
|
||||||
@@ -108,7 +108,7 @@
|
|||||||
\inlineimage qml-inspector-select-button.png
|
\inlineimage qml-inspector-select-button.png
|
||||||
(\uicontrol Select) to activate selection mode and then click the
|
(\uicontrol Select) to activate selection mode and then click the
|
||||||
\uicontrol {Quit} button to move into the \uicontrol ButtonLabel component
|
\uicontrol {Quit} button to move into the \uicontrol ButtonLabel component
|
||||||
in the \uicontrol {QML/JS Console} and the code editor.
|
in the \uicontrol {Locals and Expressions} and the code editor.
|
||||||
|
|
||||||
\li In the \uicontrol {Locals and Expressions} view, double-click the value of
|
\li In the \uicontrol {Locals and Expressions} view, double-click the value of
|
||||||
the \c text property to change it temporarily from \uicontrol {Quit} to
|
the \c text property to change it temporarily from \uicontrol {Quit} to
|
||||||
|
|||||||
@@ -158,17 +158,17 @@
|
|||||||
\section1 Executing JavaScript Expressions
|
\section1 Executing JavaScript Expressions
|
||||||
|
|
||||||
When the application is interrupted by a breakpoint, you can use the
|
When the application is interrupted by a breakpoint, you can use the
|
||||||
\uicontrol {QML/JS Console} to execute JavaScript expressions in the current
|
\uicontrol {Debugger Console} to execute JavaScript expressions in the current
|
||||||
context. To open it, choose \uicontrol Window > \uicontrol {Output Panes}
|
context. To open it, choose \uicontrol Window > \uicontrol {Output Panes}
|
||||||
> \uicontrol {QML/JS Console}.
|
> \uicontrol {Debugger Console}.
|
||||||
|
|
||||||
\image qml-script-console.png "QML/JS Console"
|
\image qml-script-console.png "Debugger Console"
|
||||||
|
|
||||||
For more information about using the console, see \l{QML/JS Console}.
|
For more information about using the console, see \l{Debugger Console}.
|
||||||
|
|
||||||
\section1 Applying QML Changes at Runtime
|
\section1 Applying QML Changes at Runtime
|
||||||
|
|
||||||
When you change property values in the \uicontrol {QML/JS Console} or in the
|
When you change property values in the \uicontrol {Debugger Console} or in the
|
||||||
\uicontrol {Locals and Expressions} view, they are immediately updated in the running
|
\uicontrol {Locals and Expressions} view, they are immediately updated in the running
|
||||||
application, but not in the source code.
|
application, but not in the source code.
|
||||||
|
|
||||||
|
|||||||
@@ -335,7 +335,7 @@
|
|||||||
|
|
||||||
\li \uicontrol{Compile Output}
|
\li \uicontrol{Compile Output}
|
||||||
|
|
||||||
\li \uicontrol {QML/JS Console}
|
\li \uicontrol {Debugger Console}
|
||||||
|
|
||||||
\li \uicontrol {To-Do Entries}
|
\li \uicontrol {To-Do Entries}
|
||||||
|
|
||||||
@@ -460,14 +460,14 @@
|
|||||||
|
|
||||||
Select the \uicontrol {Cancel Build} button to cancel the build.
|
Select the \uicontrol {Cancel Build} button to cancel the build.
|
||||||
|
|
||||||
\section2 QML/JS Console
|
\section2 Debugger Console
|
||||||
|
|
||||||
In the \uicontrol {QML/JS Console}, you can type JavaScript expressions and use them to get
|
In the \uicontrol {Debugger Console}, you can type JavaScript expressions and use them to get
|
||||||
information about the state of your application during debugging. You can change property
|
information about the state of your application during debugging. You can change property
|
||||||
values temporarily, without editing the source, and view the results in the running
|
values temporarily, without editing the source, and view the results in the running
|
||||||
application.
|
application.
|
||||||
|
|
||||||
\image qml-script-console.png "QML/JS Console"
|
\image qml-script-console.png "Debugger Console"
|
||||||
|
|
||||||
You can change the property values permanently in the code editor.
|
You can change the property values permanently in the code editor.
|
||||||
|
|
||||||
|
|||||||
@@ -1,55 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2015 The Qt Company Ltd.
|
|
||||||
** Contact: http://www.qt.io/licensing
|
|
||||||
**
|
|
||||||
** 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 The Qt Company. For licensing terms and
|
|
||||||
** conditions see http://www.qt.io/terms-conditions. For further information
|
|
||||||
** use the contact form at http://www.qt.io/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 or version 3 as published by the Free
|
|
||||||
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
|
||||||
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
|
||||||
** following information to ensure the GNU Lesser General Public License
|
|
||||||
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
|
||||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
||||||
**
|
|
||||||
** In addition, as a special exception, The Qt Company gives you certain additional
|
|
||||||
** rights. These rights are described in The Qt Company LGPL Exception
|
|
||||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#include "consolemanagerinterface.h"
|
|
||||||
|
|
||||||
namespace QmlJS {
|
|
||||||
|
|
||||||
static ConsoleManagerInterface *g_instance = 0;
|
|
||||||
|
|
||||||
ConsoleManagerInterface::ConsoleManagerInterface(QObject *parent)
|
|
||||||
: QObject(parent)
|
|
||||||
{
|
|
||||||
Q_ASSERT(!g_instance);
|
|
||||||
g_instance = this;
|
|
||||||
}
|
|
||||||
|
|
||||||
ConsoleManagerInterface::~ConsoleManagerInterface()
|
|
||||||
{
|
|
||||||
Q_ASSERT(g_instance == this);
|
|
||||||
g_instance = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
ConsoleManagerInterface *ConsoleManagerInterface::instance()
|
|
||||||
{
|
|
||||||
return g_instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // QmlJS
|
|
||||||
@@ -1,63 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2015 The Qt Company Ltd.
|
|
||||||
** Contact: http://www.qt.io/licensing
|
|
||||||
**
|
|
||||||
** 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 The Qt Company. For licensing terms and
|
|
||||||
** conditions see http://www.qt.io/terms-conditions. For further information
|
|
||||||
** use the contact form at http://www.qt.io/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 or version 3 as published by the Free
|
|
||||||
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
|
||||||
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
|
||||||
** following information to ensure the GNU Lesser General Public License
|
|
||||||
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
|
||||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
||||||
**
|
|
||||||
** In addition, as a special exception, The Qt Company gives you certain additional
|
|
||||||
** rights. These rights are described in The Qt Company LGPL Exception
|
|
||||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#ifndef CONSOLEMANAGERINTERFACE_H
|
|
||||||
#define CONSOLEMANAGERINTERFACE_H
|
|
||||||
|
|
||||||
#include "qmljs_global.h"
|
|
||||||
#include "consoleitem.h"
|
|
||||||
|
|
||||||
#include <QObject>
|
|
||||||
|
|
||||||
namespace QmlJS {
|
|
||||||
|
|
||||||
class IScriptEvaluator;
|
|
||||||
class QMLJS_EXPORT ConsoleManagerInterface : public QObject
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
ConsoleManagerInterface(QObject *parent = 0);
|
|
||||||
~ConsoleManagerInterface();
|
|
||||||
|
|
||||||
static ConsoleManagerInterface *instance();
|
|
||||||
|
|
||||||
virtual void showConsolePane() = 0;
|
|
||||||
|
|
||||||
virtual void setScriptEvaluator(IScriptEvaluator *scriptEvaluator) = 0;
|
|
||||||
virtual void setContext(const QString &context) = 0;
|
|
||||||
|
|
||||||
virtual void printToConsolePane(ConsoleItem::ItemType itemType, const QString &text,
|
|
||||||
bool bringToForeground = false) = 0;
|
|
||||||
virtual void printToConsolePane(ConsoleItem *item, bool bringToForeground = false) = 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // QmlJS
|
|
||||||
|
|
||||||
#endif // CONSOLEMANAGERINTERFACE_H
|
|
||||||
@@ -1,49 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2015 The Qt Company Ltd.
|
|
||||||
** Contact: http://www.qt.io/licensing
|
|
||||||
**
|
|
||||||
** 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 The Qt Company. For licensing terms and
|
|
||||||
** conditions see http://www.qt.io/terms-conditions. For further information
|
|
||||||
** use the contact form at http://www.qt.io/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 or version 3 as published by the Free
|
|
||||||
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
|
||||||
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
|
||||||
** following information to ensure the GNU Lesser General Public License
|
|
||||||
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
|
||||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
||||||
**
|
|
||||||
** In addition, as a special exception, The Qt Company gives you certain additional
|
|
||||||
** rights. These rights are described in The Qt Company LGPL Exception
|
|
||||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#ifndef ISCRIPTEVALUATOR_H
|
|
||||||
#define ISCRIPTEVALUATOR_H
|
|
||||||
|
|
||||||
#include "qmljs_global.h"
|
|
||||||
|
|
||||||
#include <QString>
|
|
||||||
|
|
||||||
namespace QmlJS {
|
|
||||||
|
|
||||||
class IScriptEvaluator
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
IScriptEvaluator() {}
|
|
||||||
|
|
||||||
virtual bool evaluateScript(const QString &script) = 0;
|
|
||||||
};
|
|
||||||
} // QmlJS
|
|
||||||
|
|
||||||
#endif // ISCRIPTEVALUATOR_H
|
|
||||||
@@ -34,9 +34,6 @@ HEADERS += \
|
|||||||
$$PWD/qmljsutils.h \
|
$$PWD/qmljsutils.h \
|
||||||
$$PWD/qmljsstaticanalysismessage.h \
|
$$PWD/qmljsstaticanalysismessage.h \
|
||||||
$$PWD/jsoncheck.h \
|
$$PWD/jsoncheck.h \
|
||||||
$$PWD/consolemanagerinterface.h \
|
|
||||||
$$PWD/consoleitem.h \
|
|
||||||
$$PWD/iscriptevaluator.h \
|
|
||||||
$$PWD/qmljssimplereader.h \
|
$$PWD/qmljssimplereader.h \
|
||||||
$$PWD/persistenttrie.h \
|
$$PWD/persistenttrie.h \
|
||||||
$$PWD/qmljsqrcparser.h \
|
$$PWD/qmljsqrcparser.h \
|
||||||
@@ -72,8 +69,6 @@ SOURCES += \
|
|||||||
$$PWD/qmljsutils.cpp \
|
$$PWD/qmljsutils.cpp \
|
||||||
$$PWD/qmljsstaticanalysismessage.cpp \
|
$$PWD/qmljsstaticanalysismessage.cpp \
|
||||||
$$PWD/jsoncheck.cpp \
|
$$PWD/jsoncheck.cpp \
|
||||||
$$PWD/consolemanagerinterface.cpp \
|
|
||||||
$$PWD/consoleitem.cpp \
|
|
||||||
$$PWD/qmljssimplereader.cpp \
|
$$PWD/qmljssimplereader.cpp \
|
||||||
$$PWD/persistenttrie.cpp \
|
$$PWD/persistenttrie.cpp \
|
||||||
$$PWD/qmljsqrcparser.cpp \
|
$$PWD/qmljsqrcparser.cpp \
|
||||||
|
|||||||
@@ -17,9 +17,6 @@ QtcLibrary {
|
|||||||
Group {
|
Group {
|
||||||
name: "General"
|
name: "General"
|
||||||
files: [
|
files: [
|
||||||
"consoleitem.cpp", "consoleitem.h",
|
|
||||||
"consolemanagerinterface.cpp", "consolemanagerinterface.h",
|
|
||||||
"iscriptevaluator.h",
|
|
||||||
"jsoncheck.cpp", "jsoncheck.h",
|
"jsoncheck.cpp", "jsoncheck.h",
|
||||||
"persistenttrie.cpp", "persistenttrie.h",
|
"persistenttrie.cpp", "persistenttrie.h",
|
||||||
"qmljs.qrc",
|
"qmljs.qrc",
|
||||||
|
|||||||
@@ -28,40 +28,42 @@
|
|||||||
**
|
**
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include "qmlconsolepane.h"
|
#include "console.h"
|
||||||
#include "qmlconsoleview.h"
|
#include "consoleview.h"
|
||||||
#include "qmlconsoleproxymodel.h"
|
#include "consoleproxymodel.h"
|
||||||
#include "qmlconsoleitemdelegate.h"
|
#include "consoleitemdelegate.h"
|
||||||
|
|
||||||
#include <coreplugin/coreconstants.h>
|
#include <coreplugin/coreconstants.h>
|
||||||
#include <coreplugin/coreicons.h>
|
#include <coreplugin/coreicons.h>
|
||||||
#include <coreplugin/icore.h>
|
|
||||||
#include <coreplugin/findplaceholder.h>
|
#include <coreplugin/findplaceholder.h>
|
||||||
|
#include <coreplugin/icore.h>
|
||||||
#include <utils/savedaction.h>
|
#include <utils/savedaction.h>
|
||||||
#include <aggregation/aggregate.h>
|
#include <aggregation/aggregate.h>
|
||||||
#include <coreplugin/find/itemviewfind.h>
|
#include <coreplugin/find/itemviewfind.h>
|
||||||
|
|
||||||
|
#include <QCoreApplication>
|
||||||
#include <QToolButton>
|
#include <QToolButton>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
|
|
||||||
static const char CONSOLE[] = "Console";
|
const char CONSOLE[] = "Console";
|
||||||
static const char SHOW_LOG[] = "showLog";
|
const char SHOW_LOG[] = "showLog";
|
||||||
static const char SHOW_WARNING[] = "showWarning";
|
const char SHOW_WARNING[] = "showWarning";
|
||||||
static const char SHOW_ERROR[] = "showError";
|
const char SHOW_ERROR[] = "showError";
|
||||||
|
|
||||||
namespace QmlJSTools {
|
namespace Debugger {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// QmlConsolePane
|
// Console
|
||||||
//
|
//
|
||||||
/////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
QmlConsolePane::QmlConsolePane(QObject *parent)
|
Console::Console()
|
||||||
: Core::IOutputPane(parent)
|
|
||||||
{
|
{
|
||||||
|
m_consoleItemModel = new ConsoleItemModel;
|
||||||
|
|
||||||
m_consoleWidget = new QWidget;
|
m_consoleWidget = new QWidget;
|
||||||
m_consoleWidget->setWindowTitle(displayName());
|
m_consoleWidget->setWindowTitle(displayName());
|
||||||
m_consoleWidget->setEnabled(true);
|
m_consoleWidget->setEnabled(true);
|
||||||
@@ -70,32 +72,30 @@ QmlConsolePane::QmlConsolePane(QObject *parent)
|
|||||||
vbox->setMargin(0);
|
vbox->setMargin(0);
|
||||||
vbox->setSpacing(0);
|
vbox->setSpacing(0);
|
||||||
|
|
||||||
m_consoleView = new QmlConsoleView(m_consoleWidget);
|
m_consoleView = new ConsoleView(m_consoleItemModel, m_consoleWidget);
|
||||||
m_proxyModel = new QmlConsoleProxyModel(this);
|
auto proxyModel = new ConsoleProxyModel(this);
|
||||||
m_proxyModel->setSourceModel(QmlConsoleModel::qmlConsoleItemModel());
|
proxyModel->setSourceModel(m_consoleItemModel);
|
||||||
connect(QmlConsoleModel::qmlConsoleItemModel(),
|
connect(m_consoleItemModel,
|
||||||
&QmlConsoleItemModel::selectEditableRow,
|
&ConsoleItemModel::selectEditableRow,
|
||||||
m_proxyModel,
|
proxyModel,
|
||||||
&QmlConsoleProxyModel::selectEditableRow);
|
&ConsoleProxyModel::selectEditableRow);
|
||||||
|
|
||||||
//Scroll to bottom when rows matching current filter settings are inserted
|
//Scroll to bottom when rows matching current filter settings are inserted
|
||||||
//Not connecting rowsRemoved as the only way to remove rows is to clear the
|
//Not connecting rowsRemoved as the only way to remove rows is to clear the
|
||||||
//model which will automatically reset the view.
|
//model which will automatically reset the view.
|
||||||
connect(QmlConsoleModel::qmlConsoleItemModel(), &QAbstractItemModel::rowsInserted,
|
connect(m_consoleItemModel, &QAbstractItemModel::rowsInserted,
|
||||||
m_proxyModel, &QmlConsoleProxyModel::onRowsInserted);
|
proxyModel, &ConsoleProxyModel::onRowsInserted);
|
||||||
m_consoleView->setModel(m_proxyModel);
|
m_consoleView->setModel(proxyModel);
|
||||||
|
|
||||||
connect(m_proxyModel,
|
connect(proxyModel, &ConsoleProxyModel::setCurrentIndex,
|
||||||
SIGNAL(setCurrentIndex(QModelIndex,QItemSelectionModel::SelectionFlags)),
|
m_consoleView->selectionModel(), &QItemSelectionModel::setCurrentIndex);
|
||||||
m_consoleView->selectionModel(),
|
connect(proxyModel, &ConsoleProxyModel::scrollToBottom,
|
||||||
SLOT(setCurrentIndex(QModelIndex,QItemSelectionModel::SelectionFlags)));
|
m_consoleView, &ConsoleView::onScrollToBottom);
|
||||||
connect(m_proxyModel, &QmlConsoleProxyModel::scrollToBottom,
|
|
||||||
m_consoleView, &QmlConsoleView::onScrollToBottom);
|
|
||||||
|
|
||||||
m_itemDelegate = new QmlConsoleItemDelegate(this);
|
auto itemDelegate = new ConsoleItemDelegate(m_consoleItemModel, this);
|
||||||
connect(m_consoleView->selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex)),
|
connect(m_consoleView->selectionModel(), &QItemSelectionModel::currentChanged,
|
||||||
m_itemDelegate, SLOT(currentChanged(QModelIndex,QModelIndex)));
|
itemDelegate, &ConsoleItemDelegate::currentChanged);
|
||||||
m_consoleView->setItemDelegate(m_itemDelegate);
|
m_consoleView->setItemDelegate(itemDelegate);
|
||||||
|
|
||||||
Aggregation::Aggregate *aggregate = new Aggregation::Aggregate();
|
Aggregation::Aggregate *aggregate = new Aggregation::Aggregate();
|
||||||
aggregate->add(m_consoleView);
|
aggregate->add(m_consoleView);
|
||||||
@@ -115,7 +115,7 @@ QmlConsolePane::QmlConsolePane(QObject *parent)
|
|||||||
m_showDebugButtonAction->setChecked(true);
|
m_showDebugButtonAction->setChecked(true);
|
||||||
m_showDebugButtonAction->setIcon(Core::Icons::INFO_TOOLBAR.icon());
|
m_showDebugButtonAction->setIcon(Core::Icons::INFO_TOOLBAR.icon());
|
||||||
connect(m_showDebugButtonAction, &Utils::SavedAction::toggled,
|
connect(m_showDebugButtonAction, &Utils::SavedAction::toggled,
|
||||||
m_proxyModel, &QmlConsoleProxyModel::setShowLogs);
|
proxyModel, &ConsoleProxyModel::setShowLogs);
|
||||||
m_showDebugButton->setDefaultAction(m_showDebugButtonAction);
|
m_showDebugButton->setDefaultAction(m_showDebugButtonAction);
|
||||||
|
|
||||||
m_showWarningButton = new QToolButton(m_consoleWidget);
|
m_showWarningButton = new QToolButton(m_consoleWidget);
|
||||||
@@ -129,7 +129,7 @@ QmlConsolePane::QmlConsolePane(QObject *parent)
|
|||||||
m_showWarningButtonAction->setChecked(true);
|
m_showWarningButtonAction->setChecked(true);
|
||||||
m_showWarningButtonAction->setIcon(Core::Icons::WARNING_TOOLBAR.icon());
|
m_showWarningButtonAction->setIcon(Core::Icons::WARNING_TOOLBAR.icon());
|
||||||
connect(m_showWarningButtonAction, &Utils::SavedAction::toggled,
|
connect(m_showWarningButtonAction, &Utils::SavedAction::toggled,
|
||||||
m_proxyModel, &QmlConsoleProxyModel::setShowWarnings);
|
proxyModel, &ConsoleProxyModel::setShowWarnings);
|
||||||
m_showWarningButton->setDefaultAction(m_showWarningButtonAction);
|
m_showWarningButton->setDefaultAction(m_showWarningButtonAction);
|
||||||
|
|
||||||
m_showErrorButton = new QToolButton(m_consoleWidget);
|
m_showErrorButton = new QToolButton(m_consoleWidget);
|
||||||
@@ -142,7 +142,8 @@ QmlConsolePane::QmlConsolePane(QObject *parent)
|
|||||||
m_showErrorButtonAction->setCheckable(true);
|
m_showErrorButtonAction->setCheckable(true);
|
||||||
m_showErrorButtonAction->setChecked(true);
|
m_showErrorButtonAction->setChecked(true);
|
||||||
m_showErrorButtonAction->setIcon(Core::Icons::ERROR_TOOLBAR.icon());
|
m_showErrorButtonAction->setIcon(Core::Icons::ERROR_TOOLBAR.icon());
|
||||||
connect(m_showErrorButtonAction, &Utils::SavedAction::toggled, m_proxyModel, &QmlConsoleProxyModel::setShowErrors);
|
connect(m_showErrorButtonAction, &Utils::SavedAction::toggled,
|
||||||
|
proxyModel, &ConsoleProxyModel::setShowErrors);
|
||||||
m_showErrorButton->setDefaultAction(m_showErrorButtonAction);
|
m_showErrorButton->setDefaultAction(m_showErrorButtonAction);
|
||||||
|
|
||||||
m_spacer = new QWidget(m_consoleWidget);
|
m_spacer = new QWidget(m_consoleWidget);
|
||||||
@@ -151,46 +152,47 @@ QmlConsolePane::QmlConsolePane(QObject *parent)
|
|||||||
m_statusLabel = new QLabel(m_consoleWidget);
|
m_statusLabel = new QLabel(m_consoleWidget);
|
||||||
|
|
||||||
readSettings();
|
readSettings();
|
||||||
connect(Core::ICore::instance(), SIGNAL(saveSettingsRequested()), SLOT(writeSettings()));
|
connect(Core::ICore::instance(), &Core::ICore::saveSettingsRequested,
|
||||||
|
this, &Console::writeSettings);
|
||||||
}
|
}
|
||||||
|
|
||||||
QmlConsolePane::~QmlConsolePane()
|
Console::~Console()
|
||||||
{
|
{
|
||||||
writeSettings();
|
writeSettings();
|
||||||
delete m_consoleWidget;
|
delete m_consoleWidget;
|
||||||
}
|
}
|
||||||
|
|
||||||
QWidget *QmlConsolePane::outputWidget(QWidget *)
|
QWidget *Console::outputWidget(QWidget *)
|
||||||
{
|
{
|
||||||
return m_consoleWidget;
|
return m_consoleWidget;
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<QWidget *> QmlConsolePane::toolBarWidgets() const
|
QList<QWidget *> Console::toolBarWidgets() const
|
||||||
{
|
{
|
||||||
return QList<QWidget *>() << m_showDebugButton << m_showWarningButton << m_showErrorButton
|
return { m_showDebugButton, m_showWarningButton, m_showErrorButton,
|
||||||
<< m_spacer << m_statusLabel;
|
m_spacer, m_statusLabel };
|
||||||
}
|
}
|
||||||
|
|
||||||
int QmlConsolePane::priorityInStatusBar() const
|
int Console::priorityInStatusBar() const
|
||||||
{
|
{
|
||||||
return 20;
|
return 20;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlConsolePane::clearContents()
|
void Console::clearContents()
|
||||||
{
|
{
|
||||||
QmlConsoleModel::qmlConsoleItemModel()->clear();
|
m_consoleItemModel->clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlConsolePane::visibilityChanged(bool /*visible*/)
|
void Console::visibilityChanged(bool /*visible*/)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QmlConsolePane::canFocus() const
|
bool Console::canFocus() const
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QmlConsolePane::hasFocus() const
|
bool Console::hasFocus() const
|
||||||
{
|
{
|
||||||
for (QWidget *widget = m_consoleWidget->window()->focusWidget(); widget != 0;
|
for (QWidget *widget = m_consoleWidget->window()->focusWidget(); widget != 0;
|
||||||
widget = widget->parentWidget()) {
|
widget = widget->parentWidget()) {
|
||||||
@@ -200,35 +202,35 @@ bool QmlConsolePane::hasFocus() const
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlConsolePane::setFocus()
|
void Console::setFocus()
|
||||||
{
|
{
|
||||||
m_consoleView->setFocus();
|
m_consoleView->setFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QmlConsolePane::canNext() const
|
bool Console::canNext() const
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QmlConsolePane::canPrevious() const
|
bool Console::canPrevious() const
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlConsolePane::goToNext()
|
void Console::goToNext()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlConsolePane::goToPrev()
|
void Console::goToPrev()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QmlConsolePane::canNavigate() const
|
bool Console::canNavigate() const
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlConsolePane::readSettings()
|
void Console::readSettings()
|
||||||
{
|
{
|
||||||
QSettings *settings = Core::ICore::settings();
|
QSettings *settings = Core::ICore::settings();
|
||||||
m_showDebugButtonAction->readSettings(settings);
|
m_showDebugButtonAction->readSettings(settings);
|
||||||
@@ -236,12 +238,12 @@ void QmlConsolePane::readSettings()
|
|||||||
m_showErrorButtonAction->readSettings(settings);
|
m_showErrorButtonAction->readSettings(settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlConsolePane::setContext(const QString &context)
|
void Console::setContext(const QString &context)
|
||||||
{
|
{
|
||||||
m_statusLabel->setText(context);
|
m_statusLabel->setText(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlConsolePane::writeSettings() const
|
void Console::writeSettings() const
|
||||||
{
|
{
|
||||||
QSettings *settings = Core::ICore::settings();
|
QSettings *settings = Core::ICore::settings();
|
||||||
m_showDebugButtonAction->writeSettings(settings);
|
m_showDebugButtonAction->writeSettings(settings);
|
||||||
@@ -249,5 +251,47 @@ void QmlConsolePane::writeSettings() const
|
|||||||
m_showErrorButtonAction->writeSettings(settings);
|
m_showErrorButtonAction->writeSettings(settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Console::setScriptEvaluator(const ScriptEvaluator &evaluator)
|
||||||
|
{
|
||||||
|
m_scriptEvaluator = evaluator;
|
||||||
|
if (!m_scriptEvaluator)
|
||||||
|
setContext(QString());
|
||||||
|
}
|
||||||
|
|
||||||
|
void Console::printItem(ConsoleItem::ItemType itemType, const QString &text)
|
||||||
|
{
|
||||||
|
printItem(new ConsoleItem(itemType, text));
|
||||||
|
}
|
||||||
|
|
||||||
|
void Console::printItem(ConsoleItem *item)
|
||||||
|
{
|
||||||
|
m_consoleItemModel->appendItem(item);
|
||||||
|
if (item->itemType() == ConsoleItem::ErrorType)
|
||||||
|
popup(Core::IOutputPane::ModeSwitch);
|
||||||
|
else if (item->itemType() == ConsoleItem::WarningType)
|
||||||
|
flash();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Console::evaluate(const QString &expression)
|
||||||
|
{
|
||||||
|
if (m_scriptEvaluator) {
|
||||||
|
m_consoleItemModel->shiftEditableRow();
|
||||||
|
m_scriptEvaluator(expression);
|
||||||
|
} else {
|
||||||
|
auto item = new ConsoleItem(ConsoleItem::ErrorType,
|
||||||
|
QCoreApplication::translate(
|
||||||
|
"Debugger::Internal::Console",
|
||||||
|
"Can only evaluate during a debug session."));
|
||||||
|
m_consoleItemModel->shiftEditableRow();
|
||||||
|
printItem(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Console *debuggerConsole()
|
||||||
|
{
|
||||||
|
static Console *theConsole = new Console;
|
||||||
|
return theConsole;
|
||||||
|
}
|
||||||
|
|
||||||
} // Internal
|
} // Internal
|
||||||
} // QmlJSTools
|
} // Debugger
|
||||||
@@ -28,11 +28,17 @@
|
|||||||
**
|
**
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifndef QMLCONSOLEPANE_H
|
#ifndef DEBUGGER_CONSOLE_H
|
||||||
#define QMLCONSOLEPANE_H
|
#define DEBUGGER_CONSOLE_H
|
||||||
|
|
||||||
|
#include "consoleitem.h"
|
||||||
|
|
||||||
#include <coreplugin/ioutputpane.h>
|
#include <coreplugin/ioutputpane.h>
|
||||||
|
|
||||||
|
#include <functional>
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
class QToolButton;
|
class QToolButton;
|
||||||
class QLabel;
|
class QLabel;
|
||||||
@@ -40,25 +46,25 @@ QT_END_NAMESPACE
|
|||||||
|
|
||||||
namespace Utils { class SavedAction; }
|
namespace Utils { class SavedAction; }
|
||||||
|
|
||||||
namespace QmlJSTools {
|
namespace Debugger {
|
||||||
|
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
class QmlConsoleView;
|
typedef std::function<bool(QString)> ScriptEvaluator;
|
||||||
class QmlConsoleItemDelegate;
|
|
||||||
class QmlConsoleProxyModel;
|
|
||||||
class QmlConsoleItemModel;
|
|
||||||
|
|
||||||
class QmlConsolePane : public Core::IOutputPane
|
class ConsoleItemModel;
|
||||||
|
class ConsoleView;
|
||||||
|
|
||||||
|
class Console : public Core::IOutputPane
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
QmlConsolePane(QObject *parent);
|
Console();
|
||||||
~QmlConsolePane();
|
~Console();
|
||||||
|
|
||||||
QWidget *outputWidget(QWidget *);
|
QWidget *outputWidget(QWidget *);
|
||||||
QList<QWidget *> toolBarWidgets() const;
|
QList<QWidget *> toolBarWidgets() const;
|
||||||
QString displayName() const { return tr("QML/JS Console"); }
|
QString displayName() const { return tr("Debugger Console"); }
|
||||||
int priorityInStatusBar() const;
|
int priorityInStatusBar() const;
|
||||||
void clearContents();
|
void clearContents();
|
||||||
void visibilityChanged(bool visible);
|
void visibilityChanged(bool visible);
|
||||||
@@ -75,7 +81,12 @@ public:
|
|||||||
void readSettings();
|
void readSettings();
|
||||||
void setContext(const QString &context);
|
void setContext(const QString &context);
|
||||||
|
|
||||||
public slots:
|
void setScriptEvaluator(const ScriptEvaluator &evaluator);
|
||||||
|
|
||||||
|
void evaluate(const QString &expression);
|
||||||
|
void printItem(ConsoleItem *item);
|
||||||
|
void printItem(ConsoleItem::ItemType itemType, const QString &text);
|
||||||
|
|
||||||
void writeSettings() const;
|
void writeSettings() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -87,13 +98,15 @@ private:
|
|||||||
Utils::SavedAction *m_showErrorButtonAction;
|
Utils::SavedAction *m_showErrorButtonAction;
|
||||||
QWidget *m_spacer;
|
QWidget *m_spacer;
|
||||||
QLabel *m_statusLabel;
|
QLabel *m_statusLabel;
|
||||||
QmlConsoleView *m_consoleView;
|
ConsoleItemModel *m_consoleItemModel;
|
||||||
QmlConsoleItemDelegate *m_itemDelegate;
|
ConsoleView *m_consoleView;
|
||||||
QmlConsoleProxyModel *m_proxyModel;
|
|
||||||
QWidget *m_consoleWidget;
|
QWidget *m_consoleWidget;
|
||||||
|
ScriptEvaluator m_scriptEvaluator;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
Console *debuggerConsole();
|
||||||
} // namespace QmlJSTools
|
|
||||||
|
|
||||||
#endif // QMLCONSOLEPANE_H
|
} // namespace Internal
|
||||||
|
} // namespace Debugger
|
||||||
|
|
||||||
|
#endif // DEBUGGER_CONSOLE_H
|
||||||
17
src/plugins/debugger/console/console.pri
Normal file
17
src/plugins/debugger/console/console.pri
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
HEADERS += \
|
||||||
|
$$PWD/consoleitem.h \
|
||||||
|
$$PWD/consoleedit.h \
|
||||||
|
$$PWD/consoleitemdelegate.h \
|
||||||
|
$$PWD/consoleitemmodel.h \
|
||||||
|
$$PWD/console.h \
|
||||||
|
$$PWD/consoleproxymodel.h \
|
||||||
|
$$PWD/consoleview.h
|
||||||
|
|
||||||
|
SOURCES += \
|
||||||
|
$$PWD/consoleitem.cpp \
|
||||||
|
$$PWD/consoleedit.cpp \
|
||||||
|
$$PWD/consoleitemdelegate.cpp \
|
||||||
|
$$PWD/consoleitemmodel.cpp \
|
||||||
|
$$PWD/console.cpp \
|
||||||
|
$$PWD/consoleproxymodel.cpp \
|
||||||
|
$$PWD/consoleview.cpp
|
||||||
@@ -28,28 +28,25 @@
|
|||||||
**
|
**
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include "qmlconsoleedit.h"
|
#include "consoleedit.h"
|
||||||
#include "qmlconsoleitemmodel.h"
|
#include "consoleitemmodel.h"
|
||||||
#include "qmlconsolemodel.h"
|
#include "console.h"
|
||||||
|
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
#include <QKeyEvent>
|
#include <QKeyEvent>
|
||||||
|
|
||||||
using namespace QmlJS;
|
namespace Debugger {
|
||||||
|
|
||||||
namespace QmlJSTools {
|
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// QmlConsoleEdit
|
// ConsoleEdit
|
||||||
//
|
//
|
||||||
///////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
QmlConsoleEdit::QmlConsoleEdit(const QModelIndex &index, QWidget *parent) :
|
ConsoleEdit::ConsoleEdit(const QModelIndex &index, QWidget *parent) :
|
||||||
QTextEdit(parent),
|
QTextEdit(parent),
|
||||||
m_historyIndex(index)
|
m_historyIndex(index)
|
||||||
{
|
{
|
||||||
@@ -60,7 +57,7 @@ QmlConsoleEdit::QmlConsoleEdit(const QModelIndex &index, QWidget *parent) :
|
|||||||
setTextInteractionFlags(Qt::TextEditorInteraction);
|
setTextInteractionFlags(Qt::TextEditorInteraction);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlConsoleEdit::keyPressEvent(QKeyEvent *e)
|
void ConsoleEdit::keyPressEvent(QKeyEvent *e)
|
||||||
{
|
{
|
||||||
bool keyConsumed = false;
|
bool keyConsumed = false;
|
||||||
|
|
||||||
@@ -68,10 +65,8 @@ void QmlConsoleEdit::keyPressEvent(QKeyEvent *e)
|
|||||||
case Qt::Key_Return:
|
case Qt::Key_Return:
|
||||||
case Qt::Key_Enter: {
|
case Qt::Key_Enter: {
|
||||||
QString currentScript = getCurrentScript();
|
QString currentScript = getCurrentScript();
|
||||||
if (m_interpreter.canEvaluate(currentScript)) {
|
debuggerConsole()->evaluate(currentScript);
|
||||||
QmlConsoleModel::evaluate(currentScript);
|
|
||||||
emit editingFinished();
|
emit editingFinished();
|
||||||
}
|
|
||||||
keyConsumed = true;
|
keyConsumed = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -94,12 +89,12 @@ void QmlConsoleEdit::keyPressEvent(QKeyEvent *e)
|
|||||||
QTextEdit::keyPressEvent(e);
|
QTextEdit::keyPressEvent(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlConsoleEdit::focusOutEvent(QFocusEvent * /*e*/)
|
void ConsoleEdit::focusOutEvent(QFocusEvent * /*e*/)
|
||||||
{
|
{
|
||||||
emit editingFinished();
|
emit editingFinished();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlConsoleEdit::handleUpKey()
|
void ConsoleEdit::handleUpKey()
|
||||||
{
|
{
|
||||||
QTC_ASSERT(m_historyIndex.isValid(), return);
|
QTC_ASSERT(m_historyIndex.isValid(), return);
|
||||||
int currentRow = m_historyIndex.row();
|
int currentRow = m_historyIndex.row();
|
||||||
@@ -122,7 +117,7 @@ void QmlConsoleEdit::handleUpKey()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlConsoleEdit::handleDownKey()
|
void ConsoleEdit::handleDownKey()
|
||||||
{
|
{
|
||||||
QTC_ASSERT(m_historyIndex.isValid(), return);
|
QTC_ASSERT(m_historyIndex.isValid(), return);
|
||||||
int currentRow = m_historyIndex.row();
|
int currentRow = m_historyIndex.row();
|
||||||
@@ -146,7 +141,7 @@ void QmlConsoleEdit::handleDownKey()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QString QmlConsoleEdit::getCurrentScript() const
|
QString ConsoleEdit::getCurrentScript() const
|
||||||
{
|
{
|
||||||
QTextCursor cursor = textCursor();
|
QTextCursor cursor = textCursor();
|
||||||
cursor.setPosition(0);
|
cursor.setPosition(0);
|
||||||
@@ -154,7 +149,7 @@ QString QmlConsoleEdit::getCurrentScript() const
|
|||||||
return cursor.selectedText();
|
return cursor.selectedText();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlConsoleEdit::replaceCurrentScript(const QString &script)
|
void ConsoleEdit::replaceCurrentScript(const QString &script)
|
||||||
{
|
{
|
||||||
QTextCursor cursor = textCursor();
|
QTextCursor cursor = textCursor();
|
||||||
cursor.setPosition(0);
|
cursor.setPosition(0);
|
||||||
@@ -165,4 +160,4 @@ void QmlConsoleEdit::replaceCurrentScript(const QString &script)
|
|||||||
}
|
}
|
||||||
|
|
||||||
} // Internal
|
} // Internal
|
||||||
} // QmlJSTools
|
} // Debugger
|
||||||
@@ -28,23 +28,22 @@
|
|||||||
**
|
**
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifndef QMLCONSOLEEDIT_H
|
#ifndef DEBUGGER_CONSOLEEDIT_H
|
||||||
#define QMLCONSOLEEDIT_H
|
#define DEBUGGER_CONSOLEEDIT_H
|
||||||
|
|
||||||
#include "qmljsinterpreter.h"
|
|
||||||
|
|
||||||
#include <QTextEdit>
|
|
||||||
#include <QModelIndex>
|
#include <QModelIndex>
|
||||||
|
#include <QString>
|
||||||
|
#include <QTextEdit>
|
||||||
|
|
||||||
namespace QmlJSTools {
|
namespace Debugger {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
class QmlConsoleEdit : public QTextEdit
|
class ConsoleEdit : public QTextEdit
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
|
||||||
QmlConsoleEdit(const QModelIndex &index, QWidget *parent);
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
ConsoleEdit(const QModelIndex &index, QWidget *parent);
|
||||||
QString getCurrentScript() const;
|
QString getCurrentScript() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@@ -57,16 +56,14 @@ signals:
|
|||||||
protected:
|
protected:
|
||||||
void handleUpKey();
|
void handleUpKey();
|
||||||
void handleDownKey();
|
void handleDownKey();
|
||||||
|
|
||||||
void replaceCurrentScript(const QString &script);
|
void replaceCurrentScript(const QString &script);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QModelIndex m_historyIndex;
|
QModelIndex m_historyIndex;
|
||||||
QString m_cachedScript;
|
QString m_cachedScript;
|
||||||
QmlJSInterpreter m_interpreter;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // QmlJSTools
|
} // Debugger
|
||||||
} // Internal
|
} // Internal
|
||||||
|
|
||||||
#endif // QMLCONSOLEEDIT_H
|
#endif // DEBUGGER_CONSOLEEDIT_H
|
||||||
@@ -30,15 +30,10 @@
|
|||||||
|
|
||||||
#include "consoleitem.h"
|
#include "consoleitem.h"
|
||||||
|
|
||||||
namespace QmlJS {
|
namespace Debugger {
|
||||||
|
namespace Internal {
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////
|
static QString addZeroWidthSpace(QString text)
|
||||||
//
|
|
||||||
// ConsoleItem
|
|
||||||
//
|
|
||||||
///////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
QString addZeroWidthSpace(QString text)
|
|
||||||
{
|
{
|
||||||
for (int i = 0; i < text.length(); ++i) {
|
for (int i = 0; i < text.length(); ++i) {
|
||||||
if (text.at(i).isPunct())
|
if (text.at(i).isPunct())
|
||||||
@@ -164,4 +159,5 @@ QString ConsoleItem::expression() const
|
|||||||
return text().remove(QChar(0x200b)); // ZERO WIDTH SPACE
|
return text().remove(QChar(0x200b)); // ZERO WIDTH SPACE
|
||||||
}
|
}
|
||||||
|
|
||||||
} // QmlJS
|
} // Internal
|
||||||
|
} // Debugger
|
||||||
@@ -31,15 +31,15 @@
|
|||||||
#ifndef CONSOLEITEM_H
|
#ifndef CONSOLEITEM_H
|
||||||
#define CONSOLEITEM_H
|
#define CONSOLEITEM_H
|
||||||
|
|
||||||
#include "qmljs_global.h"
|
|
||||||
#include <utils/treemodel.h>
|
#include <utils/treemodel.h>
|
||||||
|
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
|
||||||
namespace QmlJS {
|
namespace Debugger {
|
||||||
|
namespace Internal {
|
||||||
|
|
||||||
class QMLJS_EXPORT ConsoleItem : public Utils::TreeItem
|
class ConsoleItem : public Utils::TreeItem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
enum Roles {
|
enum Roles {
|
||||||
@@ -85,6 +85,7 @@ private:
|
|||||||
std::function<void(ConsoleItem *)> m_doFetch;
|
std::function<void(ConsoleItem *)> m_doFetch;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // QmlJS
|
} // Internal
|
||||||
|
} // Debugger
|
||||||
|
|
||||||
#endif // CONSOLEITEM_H
|
#endif // CONSOLEITEM_H
|
||||||
@@ -28,8 +28,8 @@
|
|||||||
**
|
**
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include "qmlconsoleitemdelegate.h"
|
#include "consoleitemdelegate.h"
|
||||||
#include "qmlconsoleedit.h"
|
#include "consoleedit.h"
|
||||||
|
|
||||||
#include <coreplugin/coreconstants.h>
|
#include <coreplugin/coreconstants.h>
|
||||||
#include <coreplugin/coreicons.h>
|
#include <coreplugin/coreicons.h>
|
||||||
@@ -59,19 +59,18 @@ const char CONSOLE_BORDER_COLOR[] = "#C9C9C9";
|
|||||||
|
|
||||||
const int ELLIPSIS_GRADIENT_WIDTH = 16;
|
const int ELLIPSIS_GRADIENT_WIDTH = 16;
|
||||||
|
|
||||||
using namespace QmlJS;
|
namespace Debugger {
|
||||||
|
|
||||||
namespace QmlJSTools {
|
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// QmlConsoleItemDelegate
|
// ConsoleItemDelegate
|
||||||
//
|
//
|
||||||
///////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
QmlConsoleItemDelegate::QmlConsoleItemDelegate(QObject *parent) :
|
ConsoleItemDelegate::ConsoleItemDelegate(ConsoleItemModel *model, QObject *parent) :
|
||||||
QStyledItemDelegate(parent),
|
QStyledItemDelegate(parent),
|
||||||
|
m_model(model),
|
||||||
m_logIcon(Core::Icons::INFO.icon()),
|
m_logIcon(Core::Icons::INFO.icon()),
|
||||||
m_warningIcon(Core::Icons::WARNING.icon()),
|
m_warningIcon(Core::Icons::WARNING.icon()),
|
||||||
m_errorIcon(Core::Icons::ERROR.icon()),
|
m_errorIcon(Core::Icons::ERROR.icon()),
|
||||||
@@ -82,12 +81,12 @@ QmlConsoleItemDelegate::QmlConsoleItemDelegate(QObject *parent) :
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlConsoleItemDelegate::emitSizeHintChanged(const QModelIndex &index)
|
void ConsoleItemDelegate::emitSizeHintChanged(const QModelIndex &index)
|
||||||
{
|
{
|
||||||
emit sizeHintChanged(index);
|
emit sizeHintChanged(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
QColor QmlConsoleItemDelegate::drawBackground(QPainter *painter, const QRect &rect,
|
QColor ConsoleItemDelegate::drawBackground(QPainter *painter, const QRect &rect,
|
||||||
const QModelIndex &index,
|
const QModelIndex &index,
|
||||||
bool selected) const
|
bool selected) const
|
||||||
{
|
{
|
||||||
@@ -128,7 +127,7 @@ QColor QmlConsoleItemDelegate::drawBackground(QPainter *painter, const QRect &re
|
|||||||
return backgroundColor;
|
return backgroundColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlConsoleItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option,
|
void ConsoleItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option,
|
||||||
const QModelIndex &index) const
|
const QModelIndex &index) const
|
||||||
{
|
{
|
||||||
QStyleOptionViewItemV4 opt = option;
|
QStyleOptionViewItemV4 opt = option;
|
||||||
@@ -179,7 +178,7 @@ void QmlConsoleItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem
|
|||||||
bool showExpandableIcon = type == ConsoleItem::DefaultType;
|
bool showExpandableIcon = type == ConsoleItem::DefaultType;
|
||||||
|
|
||||||
QRect rect(opt.rect.x(), opt.rect.top(), width, opt.rect.height());
|
QRect rect(opt.rect.x(), opt.rect.top(), width, opt.rect.height());
|
||||||
ConsoleItemPositions positions(rect, opt.font, showTypeIcon, showExpandableIcon);
|
ConsoleItemPositions positions(m_model, rect, opt.font, showTypeIcon, showExpandableIcon);
|
||||||
|
|
||||||
// Paint TaskIconArea:
|
// Paint TaskIconArea:
|
||||||
if (showTypeIcon)
|
if (showTypeIcon)
|
||||||
@@ -256,7 +255,7 @@ void QmlConsoleItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem
|
|||||||
painter->restore();
|
painter->restore();
|
||||||
}
|
}
|
||||||
|
|
||||||
QSize QmlConsoleItemDelegate::sizeHint(const QStyleOptionViewItem &option,
|
QSize ConsoleItemDelegate::sizeHint(const QStyleOptionViewItem &option,
|
||||||
const QModelIndex &index) const
|
const QModelIndex &index) const
|
||||||
{
|
{
|
||||||
QStyleOptionViewItemV4 opt = option;
|
QStyleOptionViewItemV4 opt = option;
|
||||||
@@ -281,7 +280,7 @@ QSize QmlConsoleItemDelegate::sizeHint(const QStyleOptionViewItem &option,
|
|||||||
bool showExpandableIcon = type == ConsoleItem::DefaultType;
|
bool showExpandableIcon = type == ConsoleItem::DefaultType;
|
||||||
|
|
||||||
QRect rect(level * view->indentation(), 0, width, 0);
|
QRect rect(level * view->indentation(), 0, width, 0);
|
||||||
ConsoleItemPositions positions(rect, opt.font, showTypeIcon, showExpandableIcon);
|
ConsoleItemPositions positions(m_model, rect, opt.font, showTypeIcon, showExpandableIcon);
|
||||||
|
|
||||||
QFontMetrics fm(option.font);
|
QFontMetrics fm(option.font);
|
||||||
qreal height = fm.height();
|
qreal height = fm.height();
|
||||||
@@ -306,12 +305,12 @@ QSize QmlConsoleItemDelegate::sizeHint(const QStyleOptionViewItem &option,
|
|||||||
return QSize(width, height);
|
return QSize(width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
QWidget *QmlConsoleItemDelegate::createEditor(QWidget *parent,
|
QWidget *ConsoleItemDelegate::createEditor(QWidget *parent,
|
||||||
const QStyleOptionViewItem &/*option*/,
|
const QStyleOptionViewItem &/*option*/,
|
||||||
const QModelIndex &index) const
|
const QModelIndex &index) const
|
||||||
|
|
||||||
{
|
{
|
||||||
QmlConsoleEdit *editor = new QmlConsoleEdit(index, parent);
|
ConsoleEdit *editor = new ConsoleEdit(index, parent);
|
||||||
// Fiddle the prompt into the margin so that we don't have to put it into the text.
|
// Fiddle the prompt into the margin so that we don't have to put it into the text.
|
||||||
// Apparently you can have both background-image and background-color, which conveniently
|
// Apparently you can have both background-image and background-color, which conveniently
|
||||||
// prevents the painted text from shining through.
|
// prevents the painted text from shining through.
|
||||||
@@ -324,28 +323,28 @@ QWidget *QmlConsoleItemDelegate::createEditor(QWidget *parent,
|
|||||||
"background-origin: margin;"
|
"background-origin: margin;"
|
||||||
"background-repeat: none;"
|
"background-repeat: none;"
|
||||||
"}"));
|
"}"));
|
||||||
connect(editor, &QmlConsoleEdit::editingFinished,
|
connect(editor, &ConsoleEdit::editingFinished,
|
||||||
this, &QmlConsoleItemDelegate::commitAndCloseEditor);
|
this, &ConsoleItemDelegate::commitAndCloseEditor);
|
||||||
return editor;
|
return editor;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlConsoleItemDelegate::setEditorData(QWidget *editor,
|
void ConsoleItemDelegate::setEditorData(QWidget *editor,
|
||||||
const QModelIndex &index) const
|
const QModelIndex &index) const
|
||||||
{
|
{
|
||||||
QmlConsoleEdit *edtr = qobject_cast<QmlConsoleEdit *>(editor);
|
ConsoleEdit *edtr = qobject_cast<ConsoleEdit *>(editor);
|
||||||
edtr->insertPlainText(index.data(ConsoleItem::ExpressionRole).toString());
|
edtr->insertPlainText(index.data(ConsoleItem::ExpressionRole).toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlConsoleItemDelegate::setModelData(QWidget *editor,
|
void ConsoleItemDelegate::setModelData(QWidget *editor,
|
||||||
QAbstractItemModel *model,
|
QAbstractItemModel *model,
|
||||||
const QModelIndex &index) const
|
const QModelIndex &index) const
|
||||||
{
|
{
|
||||||
QmlConsoleEdit *edtr = qobject_cast<QmlConsoleEdit *>(editor);
|
ConsoleEdit *edtr = qobject_cast<ConsoleEdit *>(editor);
|
||||||
model->setData(index, edtr->getCurrentScript(), ConsoleItem::ExpressionRole);
|
model->setData(index, edtr->getCurrentScript(), ConsoleItem::ExpressionRole);
|
||||||
model->setData(index, ConsoleItem::InputType, ConsoleItem::TypeRole);
|
model->setData(index, ConsoleItem::InputType, ConsoleItem::TypeRole);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlConsoleItemDelegate::updateEditorGeometry(QWidget *editor,
|
void ConsoleItemDelegate::updateEditorGeometry(QWidget *editor,
|
||||||
const QStyleOptionViewItem &option,
|
const QStyleOptionViewItem &option,
|
||||||
const QModelIndex &/*index*/) const
|
const QModelIndex &/*index*/) const
|
||||||
{
|
{
|
||||||
@@ -353,21 +352,21 @@ void QmlConsoleItemDelegate::updateEditorGeometry(QWidget *editor,
|
|||||||
editor->setGeometry(QRect(opt.rect.x(), opt.rect.top(), opt.rect.width(), opt.rect.bottom()));
|
editor->setGeometry(QRect(opt.rect.x(), opt.rect.top(), opt.rect.width(), opt.rect.bottom()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlConsoleItemDelegate::currentChanged(const QModelIndex ¤t,
|
void ConsoleItemDelegate::currentChanged(const QModelIndex ¤t,
|
||||||
const QModelIndex &previous)
|
const QModelIndex &previous)
|
||||||
{
|
{
|
||||||
emit sizeHintChanged(current);
|
emit sizeHintChanged(current);
|
||||||
emit sizeHintChanged(previous);
|
emit sizeHintChanged(previous);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlConsoleItemDelegate::commitAndCloseEditor()
|
void ConsoleItemDelegate::commitAndCloseEditor()
|
||||||
{
|
{
|
||||||
QmlConsoleEdit *editor = qobject_cast<QmlConsoleEdit *>(sender());
|
ConsoleEdit *editor = qobject_cast<ConsoleEdit *>(sender());
|
||||||
emit commitData(editor);
|
emit commitData(editor);
|
||||||
emit closeEditor(editor);
|
emit closeEditor(editor);
|
||||||
}
|
}
|
||||||
|
|
||||||
qreal QmlConsoleItemDelegate::layoutText(QTextLayout &tl, int width,
|
qreal ConsoleItemDelegate::layoutText(QTextLayout &tl, int width,
|
||||||
bool *showFileLineInfo) const
|
bool *showFileLineInfo) const
|
||||||
{
|
{
|
||||||
qreal height = 0;
|
qreal height = 0;
|
||||||
@@ -389,4 +388,4 @@ qreal QmlConsoleItemDelegate::layoutText(QTextLayout &tl, int width,
|
|||||||
}
|
}
|
||||||
|
|
||||||
} // Internal
|
} // Internal
|
||||||
} // QmlJSTools
|
} // Debugger
|
||||||
@@ -28,24 +28,24 @@
|
|||||||
**
|
**
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifndef QMLCONSOLEITEMDELEGATE_H
|
#ifndef DEBUGGER_CONSOLEITEMDELEGATE_H
|
||||||
#define QMLCONSOLEITEMDELEGATE_H
|
#define DEBUGGER_CONSOLEITEMDELEGATE_H
|
||||||
|
|
||||||
#include "qmlconsoleitemmodel.h"
|
#include "consoleitemmodel.h"
|
||||||
#include "qmlconsolemodel.h"
|
#include "console.h"
|
||||||
|
|
||||||
#include <QStyledItemDelegate>
|
#include <QStyledItemDelegate>
|
||||||
|
|
||||||
QT_FORWARD_DECLARE_CLASS(QTextLayout)
|
QT_FORWARD_DECLARE_CLASS(QTextLayout)
|
||||||
|
|
||||||
namespace QmlJSTools {
|
namespace Debugger {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
class QmlConsoleItemDelegate : public QStyledItemDelegate
|
class ConsoleItemDelegate : public QStyledItemDelegate
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
QmlConsoleItemDelegate(QObject *parent);
|
ConsoleItemDelegate(ConsoleItemModel *model, QObject *parent);
|
||||||
|
|
||||||
void emitSizeHintChanged(const QModelIndex &index);
|
void emitSizeHintChanged(const QModelIndex &index);
|
||||||
QColor drawBackground(QPainter *painter, const QRect &rect, const QModelIndex &index,
|
QColor drawBackground(QPainter *painter, const QRect &rect, const QModelIndex &index,
|
||||||
@@ -74,6 +74,7 @@ private:
|
|||||||
qreal layoutText(QTextLayout &tl, int width, bool *success = 0) const;
|
qreal layoutText(QTextLayout &tl, int width, bool *success = 0) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
ConsoleItemModel *m_model;
|
||||||
const QIcon m_logIcon;
|
const QIcon m_logIcon;
|
||||||
const QIcon m_warningIcon;
|
const QIcon m_warningIcon;
|
||||||
const QIcon m_errorIcon;
|
const QIcon m_errorIcon;
|
||||||
@@ -99,8 +100,8 @@ private:
|
|||||||
class ConsoleItemPositions
|
class ConsoleItemPositions
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ConsoleItemPositions(const QRect &rect, const QFont &font, bool showTaskIconArea,
|
ConsoleItemPositions(ConsoleItemModel *model, const QRect &rect,
|
||||||
bool showExpandableIconArea)
|
const QFont &font, bool showTaskIconArea, bool showExpandableIconArea)
|
||||||
: m_x(rect.x()),
|
: m_x(rect.x()),
|
||||||
m_width(rect.width()),
|
m_width(rect.width()),
|
||||||
m_top(rect.top()),
|
m_top(rect.top()),
|
||||||
@@ -111,7 +112,6 @@ public:
|
|||||||
m_showExpandableIconArea(showExpandableIconArea)
|
m_showExpandableIconArea(showExpandableIconArea)
|
||||||
{
|
{
|
||||||
m_fontHeight = QFontMetrics(font).height();
|
m_fontHeight = QFontMetrics(font).height();
|
||||||
QmlConsoleItemModel *model = QmlConsoleModel::qmlConsoleItemModel();
|
|
||||||
m_maxFileLength = model->sizeOfFile(font);
|
m_maxFileLength = model->sizeOfFile(font);
|
||||||
m_maxLineLength = model->sizeOfLineNumber(font);
|
m_maxLineLength = model->sizeOfLineNumber(font);
|
||||||
}
|
}
|
||||||
@@ -174,10 +174,9 @@ public:
|
|||||||
static const int TASK_ICON_SIZE = 16;
|
static const int TASK_ICON_SIZE = 16;
|
||||||
static const int ITEM_PADDING = 8;
|
static const int ITEM_PADDING = 8;
|
||||||
static const int ITEM_SPACING = 4;
|
static const int ITEM_SPACING = 4;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
} // namespace QmlJSTools
|
} // namespace Debugger
|
||||||
|
|
||||||
#endif // QMLCONSOLEITEMDELEGATE_H
|
#endif // DEBUGGER_CONSOLEITEMDELEGATE_H
|
||||||
@@ -28,37 +28,35 @@
|
|||||||
**
|
**
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include "qmlconsoleitemmodel.h"
|
#include "consoleitemmodel.h"
|
||||||
|
|
||||||
#include <QFontMetrics>
|
#include <QFontMetrics>
|
||||||
#include <QFont>
|
#include <QFont>
|
||||||
|
|
||||||
using namespace QmlJS;
|
namespace Debugger {
|
||||||
|
|
||||||
namespace QmlJSTools {
|
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// QmlConsoleItemModel
|
// ConsoleItemModel
|
||||||
//
|
//
|
||||||
///////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
QmlConsoleItemModel::QmlConsoleItemModel(QObject *parent) :
|
ConsoleItemModel::ConsoleItemModel(QObject *parent) :
|
||||||
Utils::TreeModel(new ConsoleItem, parent),
|
Utils::TreeModel(new ConsoleItem, parent),
|
||||||
m_maxSizeOfFileName(0)
|
m_maxSizeOfFileName(0)
|
||||||
{
|
{
|
||||||
clear();
|
clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlConsoleItemModel::clear()
|
void ConsoleItemModel::clear()
|
||||||
{
|
{
|
||||||
Utils::TreeModel::clear();
|
Utils::TreeModel::clear();
|
||||||
appendItem(new ConsoleItem(ConsoleItem::InputType));
|
appendItem(new ConsoleItem(ConsoleItem::InputType));
|
||||||
emit selectEditableRow(index(0, 0, QModelIndex()), QItemSelectionModel::ClearAndSelect);
|
emit selectEditableRow(index(0, 0, QModelIndex()), QItemSelectionModel::ClearAndSelect);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlConsoleItemModel::appendItem(ConsoleItem *item, int position)
|
void ConsoleItemModel::appendItem(ConsoleItem *item, int position)
|
||||||
{
|
{
|
||||||
if (position < 0)
|
if (position < 0)
|
||||||
position = rootItem()->childCount() - 1; // append before editable row
|
position = rootItem()->childCount() - 1; // append before editable row
|
||||||
@@ -69,13 +67,7 @@ void QmlConsoleItemModel::appendItem(ConsoleItem *item, int position)
|
|||||||
rootItem()->insertChild(position, item);
|
rootItem()->insertChild(position, item);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlConsoleItemModel::appendMessage(ConsoleItem::ItemType itemType,
|
void ConsoleItemModel::shiftEditableRow()
|
||||||
const QString &message, int position)
|
|
||||||
{
|
|
||||||
appendItem(new ConsoleItem(itemType, message), position);
|
|
||||||
}
|
|
||||||
|
|
||||||
void QmlConsoleItemModel::shiftEditableRow()
|
|
||||||
{
|
{
|
||||||
int position = rootItem()->childCount();
|
int position = rootItem()->childCount();
|
||||||
Q_ASSERT(position > 0);
|
Q_ASSERT(position > 0);
|
||||||
@@ -87,7 +79,7 @@ void QmlConsoleItemModel::shiftEditableRow()
|
|||||||
emit selectEditableRow(index(position, 0, QModelIndex()), QItemSelectionModel::ClearAndSelect);
|
emit selectEditableRow(index(position, 0, QModelIndex()), QItemSelectionModel::ClearAndSelect);
|
||||||
}
|
}
|
||||||
|
|
||||||
int QmlConsoleItemModel::sizeOfFile(const QFont &font)
|
int ConsoleItemModel::sizeOfFile(const QFont &font)
|
||||||
{
|
{
|
||||||
int lastReadOnlyRow = rootItem()->childCount();
|
int lastReadOnlyRow = rootItem()->childCount();
|
||||||
lastReadOnlyRow -= 2; // skip editable row
|
lastReadOnlyRow -= 2; // skip editable row
|
||||||
@@ -104,11 +96,11 @@ int QmlConsoleItemModel::sizeOfFile(const QFont &font)
|
|||||||
return m_maxSizeOfFileName;
|
return m_maxSizeOfFileName;
|
||||||
}
|
}
|
||||||
|
|
||||||
int QmlConsoleItemModel::sizeOfLineNumber(const QFont &font)
|
int ConsoleItemModel::sizeOfLineNumber(const QFont &font)
|
||||||
{
|
{
|
||||||
QFontMetrics fm(font);
|
QFontMetrics fm(font);
|
||||||
return fm.width(QLatin1String("88888"));
|
return fm.width(QLatin1String("88888"));
|
||||||
}
|
}
|
||||||
|
|
||||||
} // Internal
|
} // Internal
|
||||||
} // QmlJSTools
|
} // Debugger
|
||||||
@@ -28,31 +28,31 @@
|
|||||||
**
|
**
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifndef QMLCONSOLEITEMMODEL_H
|
#ifndef DEBUGGER_CONSOLEITEMMODEL_H
|
||||||
#define QMLCONSOLEITEMMODEL_H
|
#define DEBUGGER_CONSOLEITEMMODEL_H
|
||||||
|
|
||||||
#include <qmljs/consoleitem.h>
|
#include "consoleitem.h"
|
||||||
#include <utils/treemodel.h>
|
#include <utils/treemodel.h>
|
||||||
|
|
||||||
#include <QItemSelectionModel>
|
#include <QItemSelectionModel>
|
||||||
|
|
||||||
QT_FORWARD_DECLARE_CLASS(QFont)
|
QT_BEGIN_NAMESPACE
|
||||||
|
class QFont;
|
||||||
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
namespace QmlJSTools {
|
namespace Debugger {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
class QmlConsoleItemModel : public Utils::TreeModel
|
class ConsoleItemModel : public Utils::TreeModel
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
|
|
||||||
explicit QmlConsoleItemModel(QObject *parent = 0);
|
explicit ConsoleItemModel(QObject *parent = 0);
|
||||||
|
|
||||||
void shiftEditableRow();
|
void shiftEditableRow();
|
||||||
|
|
||||||
void appendItem(QmlJS::ConsoleItem *item, int position = -1);
|
void appendItem(ConsoleItem *item, int position = -1);
|
||||||
void appendMessage(QmlJS::ConsoleItem::ItemType itemType, const QString &message,
|
|
||||||
int position = -1);
|
|
||||||
|
|
||||||
int sizeOfFile(const QFont &font);
|
int sizeOfFile(const QFont &font);
|
||||||
int sizeOfLineNumber(const QFont &font);
|
int sizeOfLineNumber(const QFont &font);
|
||||||
@@ -68,6 +68,6 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
} // Internal
|
} // Internal
|
||||||
} // QmlJSTools
|
} // Debugger
|
||||||
|
|
||||||
#endif // QMLCONSOLEITEMMODEL_H
|
#endif // DEBUGGER_CONSOLEITEMMODEL_H
|
||||||
@@ -28,48 +28,46 @@
|
|||||||
**
|
**
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include "qmlconsoleproxymodel.h"
|
#include "consoleproxymodel.h"
|
||||||
#include "qmlconsoleitemmodel.h"
|
#include "consoleitemmodel.h"
|
||||||
|
|
||||||
using namespace QmlJS;
|
namespace Debugger {
|
||||||
|
|
||||||
namespace QmlJSTools {
|
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
QmlConsoleProxyModel::QmlConsoleProxyModel(QObject *parent) :
|
ConsoleProxyModel::ConsoleProxyModel(QObject *parent) :
|
||||||
QSortFilterProxyModel(parent),
|
QSortFilterProxyModel(parent),
|
||||||
m_filter(ConsoleItem::AllTypes)
|
m_filter(ConsoleItem::AllTypes)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlConsoleProxyModel::setShowLogs(bool show)
|
void ConsoleProxyModel::setShowLogs(bool show)
|
||||||
{
|
{
|
||||||
m_filter = show ? (m_filter | ConsoleItem::DebugType)
|
m_filter = show ? (m_filter | ConsoleItem::DebugType)
|
||||||
: (m_filter & ~ConsoleItem::DebugType);
|
: (m_filter & ~ConsoleItem::DebugType);
|
||||||
invalidateFilter();
|
invalidateFilter();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlConsoleProxyModel::setShowWarnings(bool show)
|
void ConsoleProxyModel::setShowWarnings(bool show)
|
||||||
{
|
{
|
||||||
m_filter = show ? (m_filter | ConsoleItem::WarningType)
|
m_filter = show ? (m_filter | ConsoleItem::WarningType)
|
||||||
: (m_filter & ~ConsoleItem::WarningType);
|
: (m_filter & ~ConsoleItem::WarningType);
|
||||||
invalidateFilter();
|
invalidateFilter();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlConsoleProxyModel::setShowErrors(bool show)
|
void ConsoleProxyModel::setShowErrors(bool show)
|
||||||
{
|
{
|
||||||
m_filter = show ? (m_filter | ConsoleItem::ErrorType)
|
m_filter = show ? (m_filter | ConsoleItem::ErrorType)
|
||||||
: (m_filter & ~ConsoleItem::ErrorType);
|
: (m_filter & ~ConsoleItem::ErrorType);
|
||||||
invalidateFilter();
|
invalidateFilter();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlConsoleProxyModel::selectEditableRow(const QModelIndex &index,
|
void ConsoleProxyModel::selectEditableRow(const QModelIndex &index,
|
||||||
QItemSelectionModel::SelectionFlags command)
|
QItemSelectionModel::SelectionFlags command)
|
||||||
{
|
{
|
||||||
emit setCurrentIndex(mapFromSource(index), command);
|
emit setCurrentIndex(mapFromSource(index), command);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QmlConsoleProxyModel::filterAcceptsRow(int sourceRow,
|
bool ConsoleProxyModel::filterAcceptsRow(int sourceRow,
|
||||||
const QModelIndex &sourceParent) const
|
const QModelIndex &sourceParent) const
|
||||||
{
|
{
|
||||||
QModelIndex index = sourceModel()->index(sourceRow, 0, sourceParent);
|
QModelIndex index = sourceModel()->index(sourceRow, 0, sourceParent);
|
||||||
@@ -77,7 +75,7 @@ bool QmlConsoleProxyModel::filterAcceptsRow(int sourceRow,
|
|||||||
index, ConsoleItem::TypeRole).toInt());
|
index, ConsoleItem::TypeRole).toInt());
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlConsoleProxyModel::onRowsInserted(const QModelIndex &index, int start, int end)
|
void ConsoleProxyModel::onRowsInserted(const QModelIndex &index, int start, int end)
|
||||||
{
|
{
|
||||||
int rowIndex = end;
|
int rowIndex = end;
|
||||||
do {
|
do {
|
||||||
@@ -89,4 +87,4 @@ void QmlConsoleProxyModel::onRowsInserted(const QModelIndex &index, int start, i
|
|||||||
}
|
}
|
||||||
|
|
||||||
} // Internal
|
} // Internal
|
||||||
} // QmlJSTools
|
} // Debugger
|
||||||
@@ -28,22 +28,22 @@
|
|||||||
**
|
**
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifndef QMLCONSOLEPROXYMODEL_H
|
#ifndef DEBUGGER_CONSOLEPROXYMODEL_H
|
||||||
#define QMLCONSOLEPROXYMODEL_H
|
#define DEBUGGER_CONSOLEPROXYMODEL_H
|
||||||
|
|
||||||
#include <qmljs/consoleitem.h>
|
#include "consoleitem.h"
|
||||||
|
|
||||||
#include <QSortFilterProxyModel>
|
#include <QSortFilterProxyModel>
|
||||||
#include <QItemSelectionModel>
|
#include <QItemSelectionModel>
|
||||||
|
|
||||||
namespace QmlJSTools {
|
namespace Debugger {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
class QmlConsoleProxyModel : public QSortFilterProxyModel
|
class ConsoleProxyModel : public QSortFilterProxyModel
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit QmlConsoleProxyModel(QObject *parent);
|
explicit ConsoleProxyModel(QObject *parent);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void setShowLogs(bool show);
|
void setShowLogs(bool show);
|
||||||
@@ -62,10 +62,10 @@ protected:
|
|||||||
bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const;
|
bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QFlags<QmlJS::ConsoleItem::ItemType> m_filter;
|
QFlags<ConsoleItem::ItemType> m_filter;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // Internal
|
} // Internal
|
||||||
} // QmlJSTools
|
} // Debugger
|
||||||
|
|
||||||
#endif // QMLCONSOLEPROXYMODEL_H
|
#endif // DEBUGGER_CONSOLEPROXYMODEL_H
|
||||||
@@ -28,9 +28,9 @@
|
|||||||
**
|
**
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include "qmlconsoleview.h"
|
#include "consoleview.h"
|
||||||
#include "qmlconsoleitemdelegate.h"
|
#include "consoleitemdelegate.h"
|
||||||
#include "qmlconsoleitemmodel.h"
|
#include "consoleitemmodel.h"
|
||||||
|
|
||||||
#include <coreplugin/editormanager/editormanager.h>
|
#include <coreplugin/editormanager/editormanager.h>
|
||||||
#include <coreplugin/manhattanstyle.h>
|
#include <coreplugin/manhattanstyle.h>
|
||||||
@@ -49,15 +49,13 @@
|
|||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
|
|
||||||
using namespace QmlJS;
|
namespace Debugger {
|
||||||
|
|
||||||
namespace QmlJSTools {
|
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
class QmlConsoleViewStyle : public ManhattanStyle
|
class ConsoleViewStyle : public ManhattanStyle
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
QmlConsoleViewStyle(const QString &baseStyleName) : ManhattanStyle(baseStyleName) {}
|
ConsoleViewStyle(const QString &baseStyleName) : ManhattanStyle(baseStyleName) {}
|
||||||
|
|
||||||
void drawPrimitive(PrimitiveElement element, const QStyleOption *option, QPainter *painter,
|
void drawPrimitive(PrimitiveElement element, const QStyleOption *option, QPainter *painter,
|
||||||
const QWidget *widget = 0) const
|
const QWidget *widget = 0) const
|
||||||
@@ -77,12 +75,12 @@ public:
|
|||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// QmlConsoleView
|
// ConsoleView
|
||||||
//
|
//
|
||||||
///////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
QmlConsoleView::QmlConsoleView(QWidget *parent) :
|
ConsoleView::ConsoleView(ConsoleItemModel *model, QWidget *parent) :
|
||||||
Utils::TreeView(parent)
|
Utils::TreeView(parent), m_model(model)
|
||||||
{
|
{
|
||||||
setFrameStyle(QFrame::NoFrame);
|
setFrameStyle(QFrame::NoFrame);
|
||||||
setHeaderHidden(true);
|
setHeaderHidden(true);
|
||||||
@@ -122,7 +120,7 @@ QmlConsoleView::QmlConsoleView(QWidget *parent) :
|
|||||||
baseName = QLatin1String("cleanlooks");
|
baseName = QLatin1String("cleanlooks");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
QmlConsoleViewStyle *style = new QmlConsoleViewStyle(baseName);
|
ConsoleViewStyle *style = new ConsoleViewStyle(baseName);
|
||||||
setStyle(style);
|
setStyle(style);
|
||||||
style->setParent(this);
|
style->setParent(this);
|
||||||
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||||
@@ -131,17 +129,17 @@ QmlConsoleView::QmlConsoleView(QWidget *parent) :
|
|||||||
horizontalScrollBar()->setSingleStep(20);
|
horizontalScrollBar()->setSingleStep(20);
|
||||||
verticalScrollBar()->setSingleStep(20);
|
verticalScrollBar()->setSingleStep(20);
|
||||||
|
|
||||||
connect(this, &QmlConsoleView::activated, this, &QmlConsoleView::onRowActivated);
|
connect(this, &ConsoleView::activated, this, &ConsoleView::onRowActivated);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlConsoleView::onScrollToBottom()
|
void ConsoleView::onScrollToBottom()
|
||||||
{
|
{
|
||||||
// Keep scrolling to bottom if scroll bar is not at maximum()
|
// Keep scrolling to bottom if scroll bar is not at maximum()
|
||||||
if (verticalScrollBar()->value() != verticalScrollBar()->maximum())
|
if (verticalScrollBar()->value() != verticalScrollBar()->maximum())
|
||||||
scrollToBottom();
|
scrollToBottom();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlConsoleView::mousePressEvent(QMouseEvent *event)
|
void ConsoleView::mousePressEvent(QMouseEvent *event)
|
||||||
{
|
{
|
||||||
QPoint pos = event->pos();
|
QPoint pos = event->pos();
|
||||||
QModelIndex index = indexAt(pos);
|
QModelIndex index = indexAt(pos);
|
||||||
@@ -151,7 +149,7 @@ void QmlConsoleView::mousePressEvent(QMouseEvent *event)
|
|||||||
bool handled = false;
|
bool handled = false;
|
||||||
if (type == ConsoleItem::DefaultType) {
|
if (type == ConsoleItem::DefaultType) {
|
||||||
bool showTypeIcon = index.parent() == QModelIndex();
|
bool showTypeIcon = index.parent() == QModelIndex();
|
||||||
ConsoleItemPositions positions(visualRect(index), viewOptions().font, showTypeIcon,
|
ConsoleItemPositions positions(m_model, visualRect(index), viewOptions().font, showTypeIcon,
|
||||||
true);
|
true);
|
||||||
|
|
||||||
if (positions.expandCollapseIcon().contains(pos)) {
|
if (positions.expandCollapseIcon().contains(pos)) {
|
||||||
@@ -167,22 +165,22 @@ void QmlConsoleView::mousePressEvent(QMouseEvent *event)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlConsoleView::resizeEvent(QResizeEvent *e)
|
void ConsoleView::resizeEvent(QResizeEvent *e)
|
||||||
{
|
{
|
||||||
static_cast<QmlConsoleItemDelegate *>(itemDelegate())->emitSizeHintChanged(
|
static_cast<ConsoleItemDelegate *>(itemDelegate())->emitSizeHintChanged(
|
||||||
selectionModel()->currentIndex());
|
selectionModel()->currentIndex());
|
||||||
Utils::TreeView::resizeEvent(e);
|
Utils::TreeView::resizeEvent(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlConsoleView::drawBranches(QPainter *painter, const QRect &rect,
|
void ConsoleView::drawBranches(QPainter *painter, const QRect &rect,
|
||||||
const QModelIndex &index) const
|
const QModelIndex &index) const
|
||||||
{
|
{
|
||||||
static_cast<QmlConsoleItemDelegate *>(itemDelegate())->drawBackground(painter, rect, index,
|
static_cast<ConsoleItemDelegate *>(itemDelegate())->drawBackground(painter, rect, index,
|
||||||
false);
|
false);
|
||||||
Utils::TreeView::drawBranches(painter, rect, index);
|
Utils::TreeView::drawBranches(painter, rect, index);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlConsoleView::contextMenuEvent(QContextMenuEvent *event)
|
void ConsoleView::contextMenuEvent(QContextMenuEvent *event)
|
||||||
{
|
{
|
||||||
QModelIndex itemIndex = indexAt(event->pos());
|
QModelIndex itemIndex = indexAt(event->pos());
|
||||||
QMenu menu;
|
QMenu menu;
|
||||||
@@ -207,20 +205,20 @@ void QmlConsoleView::contextMenuEvent(QContextMenuEvent *event)
|
|||||||
onRowActivated(itemIndex);
|
onRowActivated(itemIndex);
|
||||||
} else if (a == clear) {
|
} else if (a == clear) {
|
||||||
QAbstractProxyModel *proxyModel = qobject_cast<QAbstractProxyModel *>(model());
|
QAbstractProxyModel *proxyModel = qobject_cast<QAbstractProxyModel *>(model());
|
||||||
QmlConsoleItemModel *handler = qobject_cast<QmlConsoleItemModel *>(
|
ConsoleItemModel *handler = qobject_cast<ConsoleItemModel *>(
|
||||||
proxyModel->sourceModel());
|
proxyModel->sourceModel());
|
||||||
handler->clear();
|
handler->clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlConsoleView::focusInEvent(QFocusEvent *event)
|
void ConsoleView::focusInEvent(QFocusEvent *event)
|
||||||
{
|
{
|
||||||
Q_UNUSED(event);
|
Q_UNUSED(event);
|
||||||
selectionModel()->setCurrentIndex(model()->index(model()->rowCount() - 1, 0),
|
selectionModel()->setCurrentIndex(model()->index(model()->rowCount() - 1, 0),
|
||||||
QItemSelectionModel::ClearAndSelect);
|
QItemSelectionModel::ClearAndSelect);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlConsoleView::onRowActivated(const QModelIndex &index)
|
void ConsoleView::onRowActivated(const QModelIndex &index)
|
||||||
{
|
{
|
||||||
if (!index.isValid())
|
if (!index.isValid())
|
||||||
return;
|
return;
|
||||||
@@ -239,7 +237,7 @@ void QmlConsoleView::onRowActivated(const QModelIndex &index)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlConsoleView::copyToClipboard(const QModelIndex &index)
|
void ConsoleView::copyToClipboard(const QModelIndex &index)
|
||||||
{
|
{
|
||||||
if (!index.isValid())
|
if (!index.isValid())
|
||||||
return;
|
return;
|
||||||
@@ -258,7 +256,7 @@ void QmlConsoleView::copyToClipboard(const QModelIndex &index)
|
|||||||
cb->setText(contents);
|
cb->setText(contents);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QmlConsoleView::canShowItemInTextEditor(const QModelIndex &index)
|
bool ConsoleView::canShowItemInTextEditor(const QModelIndex &index)
|
||||||
{
|
{
|
||||||
if (!index.isValid())
|
if (!index.isValid())
|
||||||
return false;
|
return false;
|
||||||
@@ -277,4 +275,4 @@ bool QmlConsoleView::canShowItemInTextEditor(const QModelIndex &index)
|
|||||||
}
|
}
|
||||||
|
|
||||||
} // Internal
|
} // Internal
|
||||||
} // QmlJSTools
|
} // Debugger
|
||||||
@@ -28,19 +28,22 @@
|
|||||||
**
|
**
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifndef QMLCONSOLEVIEW_H
|
#ifndef DEBUGGER_CONSOLEVIEW_H
|
||||||
#define QMLCONSOLEVIEW_H
|
#define DEBUGGER_CONSOLEVIEW_H
|
||||||
|
|
||||||
#include <utils/itemviews.h>
|
#include <utils/itemviews.h>
|
||||||
|
|
||||||
namespace QmlJSTools {
|
namespace Debugger {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
class QmlConsoleView : public Utils::TreeView
|
class ConsoleItemModel;
|
||||||
|
|
||||||
|
class ConsoleView : public Utils::TreeView
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
QmlConsoleView(QWidget *parent);
|
ConsoleView(ConsoleItemModel *model, QWidget *parent);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void onScrollToBottom();
|
void onScrollToBottom();
|
||||||
@@ -53,15 +56,15 @@ protected:
|
|||||||
void contextMenuEvent(QContextMenuEvent *event);
|
void contextMenuEvent(QContextMenuEvent *event);
|
||||||
void focusInEvent(QFocusEvent *event);
|
void focusInEvent(QFocusEvent *event);
|
||||||
|
|
||||||
private slots:
|
|
||||||
void onRowActivated(const QModelIndex &index);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void onRowActivated(const QModelIndex &index);
|
||||||
void copyToClipboard(const QModelIndex &index);
|
void copyToClipboard(const QModelIndex &index);
|
||||||
bool canShowItemInTextEditor(const QModelIndex &index);
|
bool canShowItemInTextEditor(const QModelIndex &index);
|
||||||
|
|
||||||
|
ConsoleItemModel *m_model;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // Internal
|
} // Internal
|
||||||
} // QmlJSTools
|
} // Debugger
|
||||||
|
|
||||||
#endif // QMLCONSOLEVIEW_H
|
#endif // DEBUGGER_CONSOLEVIEW_H
|
||||||
@@ -147,5 +147,6 @@ include(pdb/pdb.pri)
|
|||||||
include(lldb/lldb.pri)
|
include(lldb/lldb.pri)
|
||||||
include(qml/qml.pri)
|
include(qml/qml.pri)
|
||||||
include(namedemangler/namedemangler.pri)
|
include(namedemangler/namedemangler.pri)
|
||||||
|
include(console/console.pri)
|
||||||
|
|
||||||
include(shared/shared.pri)
|
include(shared/shared.pri)
|
||||||
|
|||||||
@@ -156,6 +156,20 @@ QtcPlugin {
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Group {
|
||||||
|
name: "Debugger Console"
|
||||||
|
prefix: "console/"
|
||||||
|
files: [
|
||||||
|
"consoleitem.cpp", "consoleitem.h",
|
||||||
|
"consoleedit.cpp", "consoleedit.h",
|
||||||
|
"consoleitemdelegate.cpp", "consoleitemdelegate.h",
|
||||||
|
"consoleitemmodel.cpp", "consoleitemmodel.h",
|
||||||
|
"console.cpp", "console.h",
|
||||||
|
"consoleproxymodel.cpp", "consoleproxymodel.h",
|
||||||
|
"consoleview.cpp" "consoleview.h"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
Group {
|
Group {
|
||||||
name: "shared"
|
name: "shared"
|
||||||
prefix: "shared/"
|
prefix: "shared/"
|
||||||
|
|||||||
@@ -51,7 +51,8 @@
|
|||||||
#include "terminal.h"
|
#include "terminal.h"
|
||||||
#include "threadshandler.h"
|
#include "threadshandler.h"
|
||||||
#include "watchhandler.h"
|
#include "watchhandler.h"
|
||||||
#include <debugger/shared/peutils.h>
|
#include "debugger/shared/peutils.h"
|
||||||
|
#include "console/console.h"
|
||||||
|
|
||||||
#include <coreplugin/editormanager/editormanager.h>
|
#include <coreplugin/editormanager/editormanager.h>
|
||||||
#include <coreplugin/editormanager/ieditor.h>
|
#include <coreplugin/editormanager/ieditor.h>
|
||||||
@@ -71,8 +72,6 @@
|
|||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
#include <utils/savedaction.h>
|
#include <utils/savedaction.h>
|
||||||
|
|
||||||
#include <qmljs/consolemanagerinterface.h>
|
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
@@ -526,9 +525,8 @@ void DebuggerEngine::showMessage(const QString &msg, int channel, int timeout) c
|
|||||||
}
|
}
|
||||||
//if (msg.size() && msg.at(0).isUpper() && msg.at(1).isUpper())
|
//if (msg.size() && msg.at(0).isUpper() && msg.at(1).isUpper())
|
||||||
// qDebug() << qPrintable(msg) << "IN STATE" << state();
|
// qDebug() << qPrintable(msg) << "IN STATE" << state();
|
||||||
QmlJS::ConsoleManagerInterface *consoleManager = QmlJS::ConsoleManagerInterface::instance();
|
if (channel == ConsoleOutput)
|
||||||
if (channel == ConsoleOutput && consoleManager)
|
debuggerConsole()->printItem(ConsoleItem::DefaultType, msg);
|
||||||
consoleManager->printToConsolePane(QmlJS::ConsoleItem::DefaultType, msg);
|
|
||||||
|
|
||||||
Internal::showMessage(msg, channel, timeout);
|
Internal::showMessage(msg, channel, timeout);
|
||||||
if (d->m_runControl) {
|
if (d->m_runControl) {
|
||||||
@@ -1744,6 +1742,12 @@ void DebuggerEngine::executeDebuggerCommand(const QString &, DebuggerLanguages)
|
|||||||
showStatusMessage(tr("This debugger cannot handle user input."));
|
showStatusMessage(tr("This debugger cannot handle user input."));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool DebuggerEngine::evaluateScript(const QString &)
|
||||||
|
{
|
||||||
|
showStatusMessage(tr("This debugger cannot handle user scripts."));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
BreakHandler *DebuggerEngine::breakHandler() const
|
BreakHandler *DebuggerEngine::breakHandler() const
|
||||||
{
|
{
|
||||||
return Internal::breakHandler();
|
return Internal::breakHandler();
|
||||||
|
|||||||
@@ -263,6 +263,7 @@ public:
|
|||||||
|
|
||||||
virtual bool acceptsDebuggerCommands() const { return true; }
|
virtual bool acceptsDebuggerCommands() const { return true; }
|
||||||
virtual void executeDebuggerCommand(const QString &command, DebuggerLanguages languages);
|
virtual void executeDebuggerCommand(const QString &command, DebuggerLanguages languages);
|
||||||
|
virtual bool evaluateScript(const QString &expression);
|
||||||
|
|
||||||
virtual void assignValueInDebugger(WatchItem *item,
|
virtual void assignValueInDebugger(WatchItem *item,
|
||||||
const QString &expr, const QVariant &value);
|
const QString &expr, const QVariant &value);
|
||||||
|
|||||||
@@ -66,7 +66,8 @@
|
|||||||
#include "localsandexpressionswindow.h"
|
#include "localsandexpressionswindow.h"
|
||||||
#include "loadcoredialog.h"
|
#include "loadcoredialog.h"
|
||||||
#include "sourceutils.h"
|
#include "sourceutils.h"
|
||||||
#include <debugger/shared/hostutils.h>
|
#include "shared/hostutils.h"
|
||||||
|
#include "console/console.h"
|
||||||
|
|
||||||
#include "snapshothandler.h"
|
#include "snapshothandler.h"
|
||||||
#include "threadshandler.h"
|
#include "threadshandler.h"
|
||||||
@@ -1239,8 +1240,9 @@ bool DebuggerPluginPrivate::initialize(const QStringList &arguments,
|
|||||||
if (!m_arguments.isEmpty())
|
if (!m_arguments.isEmpty())
|
||||||
connect(KitManager::instance(), &KitManager::kitsLoaded,
|
connect(KitManager::instance(), &KitManager::kitsLoaded,
|
||||||
this, &DebuggerPluginPrivate::parseCommandLineArguments);
|
this, &DebuggerPluginPrivate::parseCommandLineArguments);
|
||||||
// Cpp/Qml ui setup
|
|
||||||
m_mainWindow = new DebuggerMainWindow;
|
m_mainWindow = new DebuggerMainWindow;
|
||||||
|
m_plugin->addAutoReleasedObject(debuggerConsole());
|
||||||
|
|
||||||
TaskHub::addCategory(TASK_CATEGORY_DEBUGGER_DEBUGINFO,
|
TaskHub::addCategory(TASK_CATEGORY_DEBUGGER_DEBUGINFO,
|
||||||
tr("Debug Information"));
|
tr("Debug Information"));
|
||||||
|
|||||||
@@ -38,11 +38,11 @@
|
|||||||
#include <debugger/stackhandler.h>
|
#include <debugger/stackhandler.h>
|
||||||
#include <debugger/threaddata.h>
|
#include <debugger/threaddata.h>
|
||||||
#include <debugger/watchhandler.h>
|
#include <debugger/watchhandler.h>
|
||||||
|
#include <debugger/console/console.h>
|
||||||
|
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
#include <qmljseditor/qmljseditorconstants.h>
|
#include <qmljseditor/qmljseditorconstants.h>
|
||||||
#include <cppeditor/cppeditorconstants.h>
|
#include <cppeditor/cppeditorconstants.h>
|
||||||
#include <qmljs/consolemanagerinterface.h>
|
|
||||||
|
|
||||||
namespace Debugger {
|
namespace Debugger {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
@@ -451,9 +451,7 @@ void QmlCppEngine::shutdownEngine()
|
|||||||
{
|
{
|
||||||
EDEBUG("\nMASTER SHUTDOWN ENGINE");
|
EDEBUG("\nMASTER SHUTDOWN ENGINE");
|
||||||
m_cppEngine->shutdownSlaveEngine();
|
m_cppEngine->shutdownSlaveEngine();
|
||||||
QmlJS::ConsoleManagerInterface *consoleManager = QmlJS::ConsoleManagerInterface::instance();
|
debuggerConsole()->setScriptEvaluator(ScriptEvaluator());
|
||||||
if (consoleManager)
|
|
||||||
consoleManager->setScriptEvaluator(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlCppEngine::quitDebugger()
|
void QmlCppEngine::quitDebugger()
|
||||||
|
|||||||
@@ -47,6 +47,7 @@
|
|||||||
#include <debugger/threaddata.h>
|
#include <debugger/threaddata.h>
|
||||||
#include <debugger/watchhandler.h>
|
#include <debugger/watchhandler.h>
|
||||||
#include <debugger/watchwindow.h>
|
#include <debugger/watchwindow.h>
|
||||||
|
#include <debugger/console/console.h>
|
||||||
|
|
||||||
#include <coreplugin/editormanager/editormanager.h>
|
#include <coreplugin/editormanager/editormanager.h>
|
||||||
#include <coreplugin/helpmanager.h>
|
#include <coreplugin/helpmanager.h>
|
||||||
@@ -56,7 +57,6 @@
|
|||||||
|
|
||||||
#include <qmljseditor/qmljseditorconstants.h>
|
#include <qmljseditor/qmljseditorconstants.h>
|
||||||
#include <qmljs/qmljsmodelmanagerinterface.h>
|
#include <qmljs/qmljsmodelmanagerinterface.h>
|
||||||
#include <qmljs/consolemanagerinterface.h>
|
|
||||||
#include <qmldebug/qpacketprotocol.h>
|
#include <qmldebug/qpacketprotocol.h>
|
||||||
|
|
||||||
#include <texteditor/textdocument.h>
|
#include <texteditor/textdocument.h>
|
||||||
@@ -282,9 +282,9 @@ QmlEngine::QmlEngine(const DebuggerRunParameters &startParameters, DebuggerEngin
|
|||||||
d->automaticConnect = true;
|
d->automaticConnect = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (auto consoleManager = ConsoleManagerInterface::instance())
|
debuggerConsole()->setScriptEvaluator([this](const QString &expr) -> bool {
|
||||||
consoleManager->setScriptEvaluator(this);
|
return evaluateScript(expr);
|
||||||
|
});
|
||||||
|
|
||||||
d->connectionTimer.setInterval(4000);
|
d->connectionTimer.setInterval(4000);
|
||||||
d->connectionTimer.setSingleShot(true);
|
d->connectionTimer.setSingleShot(true);
|
||||||
@@ -442,7 +442,7 @@ void QmlEngine::appStartupFailed(const QString &errorMessage)
|
|||||||
this, &QmlEngine::errorMessageBoxFinished);
|
this, &QmlEngine::errorMessageBoxFinished);
|
||||||
infoBox->show();
|
infoBox->show();
|
||||||
} else {
|
} else {
|
||||||
ConsoleManagerInterface::instance()->printToConsolePane(ConsoleItem::WarningType, error);
|
debuggerConsole()->printItem(ConsoleItem::WarningType, error);
|
||||||
}
|
}
|
||||||
|
|
||||||
notifyEngineRunFailed();
|
notifyEngineRunFailed();
|
||||||
@@ -622,8 +622,7 @@ void QmlEngine::shutdownEngine()
|
|||||||
{
|
{
|
||||||
clearExceptionSelection();
|
clearExceptionSelection();
|
||||||
|
|
||||||
if (auto consoleManager = ConsoleManagerInterface::instance())
|
debuggerConsole()->setScriptEvaluator(ScriptEvaluator());
|
||||||
consoleManager->setScriptEvaluator(0);
|
|
||||||
d->noDebugOutputTimer.stop();
|
d->noDebugOutputTimer.stop();
|
||||||
|
|
||||||
// double check (ill engine?):
|
// double check (ill engine?):
|
||||||
@@ -1048,10 +1047,8 @@ void QmlEngine::expressionEvaluated(quint32 queryId, const QVariant &result)
|
|||||||
{
|
{
|
||||||
if (d->queryIds.contains(queryId)) {
|
if (d->queryIds.contains(queryId)) {
|
||||||
d->queryIds.removeOne(queryId);
|
d->queryIds.removeOne(queryId);
|
||||||
if (auto consoleManager = ConsoleManagerInterface::instance()) {
|
|
||||||
if (ConsoleItem *item = constructLogItemTree(result))
|
if (ConsoleItem *item = constructLogItemTree(result))
|
||||||
consoleManager->printToConsolePane(item);
|
debuggerConsole()->printItem(item);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1105,8 +1102,7 @@ void QmlEngine::updateCurrentContext()
|
|||||||
context = grandParentData->name;
|
context = grandParentData->name;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (auto consoleManager = ConsoleManagerInterface::instance())
|
debuggerConsole()->setContext(tr("Context:") + QLatin1Char(' ') + context);
|
||||||
consoleManager->setContext(tr("Context:") + QLatin1Char(' ') + context);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlEngine::executeDebuggerCommand(const QString &command, DebuggerLanguages languages)
|
void QmlEngine::executeDebuggerCommand(const QString &command, DebuggerLanguages languages)
|
||||||
@@ -1137,10 +1133,7 @@ bool QmlEngine::evaluateScript(const QString &expression)
|
|||||||
d->queryIds.append(queryId);
|
d->queryIds.append(queryId);
|
||||||
} else {
|
} else {
|
||||||
didEvaluate = false;
|
didEvaluate = false;
|
||||||
if (auto consoleManager = ConsoleManagerInterface::instance()) {
|
debuggerConsole()->printItem(ConsoleItem::ErrorType, _("Error evaluating expression."));
|
||||||
consoleManager->printToConsolePane(ConsoleItem::ErrorType,
|
|
||||||
_("Error evaluating expression."));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
executeDebuggerCommand(expression, QmlLanguage);
|
executeDebuggerCommand(expression, QmlLanguage);
|
||||||
@@ -2014,8 +2007,7 @@ void QmlEnginePrivate::messageReceived(const QByteArray &data)
|
|||||||
//This is most probably due to a wrong eval expression.
|
//This is most probably due to a wrong eval expression.
|
||||||
//Redirect output to console.
|
//Redirect output to console.
|
||||||
if (eventType.isEmpty()) {
|
if (eventType.isEmpty()) {
|
||||||
if (auto consoleManager = ConsoleManagerInterface::instance())
|
debuggerConsole()->printItem(new ConsoleItem(
|
||||||
consoleManager->printToConsolePane(new ConsoleItem(
|
|
||||||
ConsoleItem::ErrorType,
|
ConsoleItem::ErrorType,
|
||||||
resp.value(_(MESSAGE)).toString()));
|
resp.value(_(MESSAGE)).toString()));
|
||||||
}
|
}
|
||||||
@@ -2435,20 +2427,15 @@ void QmlEnginePrivate::insertSubItems(WatchItem *parent, const QVariantList &pro
|
|||||||
|
|
||||||
void QmlEnginePrivate::handleExecuteDebuggerCommand(const QVariantMap &response)
|
void QmlEnginePrivate::handleExecuteDebuggerCommand(const QVariantMap &response)
|
||||||
{
|
{
|
||||||
auto consoleManager = ConsoleManagerInterface::instance();
|
|
||||||
if (!consoleManager)
|
|
||||||
return;
|
|
||||||
|
|
||||||
auto it = response.constFind(_(SUCCESS));
|
auto it = response.constFind(_(SUCCESS));
|
||||||
if (it != response.constEnd() && it.value().toBool()) {
|
if (it != response.constEnd() && it.value().toBool()) {
|
||||||
consoleManager->printToConsolePane(constructLogItemTree(
|
debuggerConsole()->printItem(constructLogItemTree(extractData(response.value(_(BODY)))));
|
||||||
extractData(response.value(_(BODY)))));
|
|
||||||
|
|
||||||
// Update the locals
|
// Update the locals
|
||||||
foreach (int index, currentFrameScopes)
|
foreach (int index, currentFrameScopes)
|
||||||
scope(index);
|
scope(index);
|
||||||
} else {
|
} else {
|
||||||
consoleManager->printToConsolePane(new ConsoleItem(ConsoleItem::ErrorType,
|
debuggerConsole()->printItem(new ConsoleItem(ConsoleItem::ErrorType,
|
||||||
response.value(_(MESSAGE)).toString()));
|
response.value(_(MESSAGE)).toString()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,7 +35,6 @@
|
|||||||
|
|
||||||
#include <qmldebug/qdebugmessageclient.h>
|
#include <qmldebug/qdebugmessageclient.h>
|
||||||
#include <qmldebug/qmloutputparser.h>
|
#include <qmldebug/qmloutputparser.h>
|
||||||
#include <qmljs/iscriptevaluator.h>
|
|
||||||
#include <qmljs/qmljsdocument.h>
|
#include <qmljs/qmljsdocument.h>
|
||||||
|
|
||||||
namespace Debugger {
|
namespace Debugger {
|
||||||
@@ -46,7 +45,7 @@ class WatchItem;
|
|||||||
class QmlEnginePrivate;
|
class QmlEnginePrivate;
|
||||||
class QmlInspectorAgent;
|
class QmlInspectorAgent;
|
||||||
|
|
||||||
class QmlEngine : public DebuggerEngine, QmlJS::IScriptEvaluator
|
class QmlEngine : public DebuggerEngine
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
|||||||
@@ -32,7 +32,7 @@
|
|||||||
|
|
||||||
#include <qmljs/parser/qmljsast_p.h>
|
#include <qmljs/parser/qmljsast_p.h>
|
||||||
#include <qmljs/qmljsmodelmanagerinterface.h>
|
#include <qmljs/qmljsmodelmanagerinterface.h>
|
||||||
#include <qmljs/consolemanagerinterface.h>
|
#include <debugger/console/console.h>
|
||||||
|
|
||||||
#include <coreplugin/editormanager/documentmodel.h>
|
#include <coreplugin/editormanager/documentmodel.h>
|
||||||
|
|
||||||
@@ -228,9 +228,7 @@ void appendDebugOutput(QtMsgType type, const QString &message, const QDebugConte
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (auto consoleManager = ConsoleManagerInterface::instance())
|
debuggerConsole()->printItem(new ConsoleItem(itemType, message, info.file, info.line));
|
||||||
consoleManager->printToConsolePane(new ConsoleItem(itemType, message, info.file,
|
|
||||||
info.line));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void clearExceptionSelection()
|
void clearExceptionSelection()
|
||||||
|
|||||||
@@ -1,146 +0,0 @@
|
|||||||
/**************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2015 The Qt Company Ltd.
|
|
||||||
** Contact: http://www.qt.io/licensing
|
|
||||||
**
|
|
||||||
** 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 The Qt Company. For licensing terms and
|
|
||||||
** conditions see http://www.qt.io/terms-conditions. For further information
|
|
||||||
** use the contact form at http://www.qt.io/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 or version 3 as published by the Free
|
|
||||||
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
|
||||||
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
|
||||||
** following information to ensure the GNU Lesser General Public License
|
|
||||||
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
|
||||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
||||||
**
|
|
||||||
** In addition, as a special exception, The Qt Company gives you certain additional
|
|
||||||
** rights. These rights are described in The Qt Company LGPL Exception
|
|
||||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#include "qmlconsolemanager.h"
|
|
||||||
#include "qmlconsolepane.h"
|
|
||||||
#include "qmlconsoleitemmodel.h"
|
|
||||||
#include "qmlconsolemodel.h"
|
|
||||||
|
|
||||||
#include <extensionsystem/pluginmanager.h>
|
|
||||||
|
|
||||||
#include <qmljs/iscriptevaluator.h>
|
|
||||||
|
|
||||||
#include <QVariant>
|
|
||||||
#include <QCoreApplication>
|
|
||||||
|
|
||||||
using namespace QmlJS;
|
|
||||||
|
|
||||||
namespace QmlJSTools {
|
|
||||||
|
|
||||||
class QmlConsoleManagerPrivate
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
Internal::QmlConsoleItemModel *qmlConsoleItemModel;
|
|
||||||
Internal::QmlConsolePane *qmlConsolePane;
|
|
||||||
IScriptEvaluator *scriptEvaluator;
|
|
||||||
};
|
|
||||||
|
|
||||||
QmlConsoleManager::QmlConsoleManager(QObject *parent)
|
|
||||||
: ConsoleManagerInterface(parent),
|
|
||||||
d(new QmlConsoleManagerPrivate)
|
|
||||||
{
|
|
||||||
d->qmlConsoleItemModel = new Internal::QmlConsoleItemModel(this);
|
|
||||||
d->qmlConsolePane = new Internal::QmlConsolePane(this);
|
|
||||||
d->scriptEvaluator = 0;
|
|
||||||
ExtensionSystem::PluginManager::addObject(d->qmlConsolePane);
|
|
||||||
}
|
|
||||||
|
|
||||||
QmlConsoleManager::~QmlConsoleManager()
|
|
||||||
{
|
|
||||||
if (d->qmlConsolePane)
|
|
||||||
ExtensionSystem::PluginManager::removeObject(d->qmlConsolePane);
|
|
||||||
delete d;
|
|
||||||
}
|
|
||||||
|
|
||||||
void QmlConsoleManager::showConsolePane()
|
|
||||||
{
|
|
||||||
if (d->qmlConsolePane)
|
|
||||||
d->qmlConsolePane->popup(Core::IOutputPane::ModeSwitch);
|
|
||||||
}
|
|
||||||
|
|
||||||
void QmlConsoleManager::setScriptEvaluator(IScriptEvaluator *scriptEvaluator)
|
|
||||||
{
|
|
||||||
d->scriptEvaluator = scriptEvaluator;
|
|
||||||
if (!scriptEvaluator)
|
|
||||||
setContext(QString());
|
|
||||||
}
|
|
||||||
|
|
||||||
void QmlConsoleManager::setContext(const QString &context)
|
|
||||||
{
|
|
||||||
d->qmlConsolePane->setContext(context);
|
|
||||||
}
|
|
||||||
|
|
||||||
void QmlConsoleManager::printToConsolePane(ConsoleItem::ItemType itemType,
|
|
||||||
const QString &text, bool bringToForeground)
|
|
||||||
{
|
|
||||||
if (!d->qmlConsolePane)
|
|
||||||
return;
|
|
||||||
if (itemType == ConsoleItem::ErrorType)
|
|
||||||
bringToForeground = true;
|
|
||||||
if (bringToForeground)
|
|
||||||
d->qmlConsolePane->popup(Core::IOutputPane::ModeSwitch);
|
|
||||||
d->qmlConsoleItemModel->appendMessage(itemType, text);
|
|
||||||
if (itemType == ConsoleItem::WarningType)
|
|
||||||
d->qmlConsolePane->flash();
|
|
||||||
}
|
|
||||||
|
|
||||||
void QmlConsoleManager::printToConsolePane(ConsoleItem *item, bool bringToForeground)
|
|
||||||
{
|
|
||||||
if (!d->qmlConsolePane)
|
|
||||||
return;
|
|
||||||
if (item->itemType() == ConsoleItem::ErrorType)
|
|
||||||
bringToForeground = true;
|
|
||||||
if (bringToForeground)
|
|
||||||
d->qmlConsolePane->popup(Core::IOutputPane::ModeSwitch);
|
|
||||||
d->qmlConsoleItemModel->appendItem(item);
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace Internal {
|
|
||||||
|
|
||||||
QmlConsoleItemModel *QmlConsoleModel::qmlConsoleItemModel()
|
|
||||||
{
|
|
||||||
QmlConsoleManager *manager = qobject_cast<QmlConsoleManager *>(QmlConsoleManager::instance());
|
|
||||||
if (manager)
|
|
||||||
return manager->d->qmlConsoleItemModel;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void QmlConsoleModel::evaluate(const QString &expression)
|
|
||||||
{
|
|
||||||
QmlConsoleManager *manager = qobject_cast<QmlConsoleManager *>(QmlConsoleManager::instance());
|
|
||||||
if (manager) {
|
|
||||||
if (manager->d->scriptEvaluator) {
|
|
||||||
QmlConsoleModel::qmlConsoleItemModel()->shiftEditableRow();
|
|
||||||
manager->d->scriptEvaluator->evaluateScript(expression);
|
|
||||||
} else {
|
|
||||||
ConsoleItem *item = new ConsoleItem(
|
|
||||||
ConsoleItem::ErrorType, QCoreApplication::translate(
|
|
||||||
"QmlJSTools::Internal::QmlConsoleModel",
|
|
||||||
"Can only evaluate during a QML debug session."));
|
|
||||||
if (item) {
|
|
||||||
QmlConsoleModel::qmlConsoleItemModel()->shiftEditableRow();
|
|
||||||
manager->printToConsolePane(item);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
} // Internal
|
|
||||||
} // QmlJSTools
|
|
||||||
@@ -1,69 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2015 The Qt Company Ltd.
|
|
||||||
** Contact: http://www.qt.io/licensing
|
|
||||||
**
|
|
||||||
** 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 The Qt Company. For licensing terms and
|
|
||||||
** conditions see http://www.qt.io/terms-conditions. For further information
|
|
||||||
** use the contact form at http://www.qt.io/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 or version 3 as published by the Free
|
|
||||||
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
|
||||||
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
|
||||||
** following information to ensure the GNU Lesser General Public License
|
|
||||||
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
|
||||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
||||||
**
|
|
||||||
** In addition, as a special exception, The Qt Company gives you certain additional
|
|
||||||
** rights. These rights are described in The Qt Company LGPL Exception
|
|
||||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#ifndef QMLCONSOLEMANAGER_H
|
|
||||||
#define QMLCONSOLEMANAGER_H
|
|
||||||
|
|
||||||
#include "qmljstools_global.h"
|
|
||||||
|
|
||||||
#include <qmljs/consolemanagerinterface.h>
|
|
||||||
|
|
||||||
#include <QObject>
|
|
||||||
|
|
||||||
namespace QmlJS { class IScriptEvaluator; }
|
|
||||||
namespace QmlJSTools {
|
|
||||||
|
|
||||||
namespace Internal { class QmlConsoleModel; }
|
|
||||||
|
|
||||||
class QmlConsoleManagerPrivate;
|
|
||||||
class QMLJSTOOLS_EXPORT QmlConsoleManager : public QmlJS::ConsoleManagerInterface
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
QmlConsoleManager(QObject *parent);
|
|
||||||
~QmlConsoleManager();
|
|
||||||
|
|
||||||
void showConsolePane();
|
|
||||||
|
|
||||||
void setScriptEvaluator(QmlJS::IScriptEvaluator *scriptEvaluator);
|
|
||||||
void setContext(const QString &context);
|
|
||||||
|
|
||||||
void printToConsolePane(QmlJS::ConsoleItem::ItemType itemType, const QString &text,
|
|
||||||
bool bringToForeground = false);
|
|
||||||
void printToConsolePane(QmlJS::ConsoleItem *item, bool bringToForeground = false);
|
|
||||||
|
|
||||||
private:
|
|
||||||
QmlConsoleManagerPrivate *d;
|
|
||||||
friend class Internal::QmlConsoleModel;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace QmlJSTools
|
|
||||||
|
|
||||||
#endif // QMLCONSOLEMANAGER_H
|
|
||||||
@@ -1,51 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2015 The Qt Company Ltd.
|
|
||||||
** Contact: http://www.qt.io/licensing
|
|
||||||
**
|
|
||||||
** 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 The Qt Company. For licensing terms and
|
|
||||||
** conditions see http://www.qt.io/terms-conditions. For further information
|
|
||||||
** use the contact form at http://www.qt.io/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 or version 3 as published by the Free
|
|
||||||
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
|
||||||
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
|
||||||
** following information to ensure the GNU Lesser General Public License
|
|
||||||
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
|
||||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
||||||
**
|
|
||||||
** In addition, as a special exception, The Qt Company gives you certain additional
|
|
||||||
** rights. These rights are described in The Qt Company LGPL Exception
|
|
||||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#ifndef QMLCONSOLEMODEL_H
|
|
||||||
#define QMLCONSOLEMODEL_H
|
|
||||||
|
|
||||||
#include <QString>
|
|
||||||
|
|
||||||
namespace QmlJSTools {
|
|
||||||
namespace Internal {
|
|
||||||
|
|
||||||
class QmlConsoleItemModel;
|
|
||||||
|
|
||||||
class QmlConsoleModel
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
static QmlConsoleItemModel *qmlConsoleItemModel();
|
|
||||||
static void evaluate(const QString &expression);
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace Internal
|
|
||||||
} // namespace QmlJSTools
|
|
||||||
|
|
||||||
#endif // QMLCONSOLEMODEL_H
|
|
||||||
@@ -20,16 +20,7 @@ HEADERS += \
|
|||||||
$$PWD/qmljsindenter.h \
|
$$PWD/qmljsindenter.h \
|
||||||
$$PWD/qmljscodestylesettingspage.h \
|
$$PWD/qmljscodestylesettingspage.h \
|
||||||
$$PWD/qmljssemanticinfo.h \
|
$$PWD/qmljssemanticinfo.h \
|
||||||
$$PWD/qmljstools_global.h \
|
$$PWD/qmljstools_global.h
|
||||||
$$PWD/qmlconsolemanager.h \
|
|
||||||
$$PWD/qmlconsoleitemmodel.h \
|
|
||||||
$$PWD/qmlconsolemodel.h \
|
|
||||||
$$PWD/qmlconsolepane.h \
|
|
||||||
$$PWD/qmlconsoleview.h \
|
|
||||||
$$PWD/qmlconsoleitemdelegate.h \
|
|
||||||
$$PWD/qmlconsoleedit.h \
|
|
||||||
$$PWD/qmljsinterpreter.h \
|
|
||||||
$$PWD/qmlconsoleproxymodel.h
|
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
$$PWD/qmljsbundleprovider.cpp \
|
$$PWD/qmljsbundleprovider.cpp \
|
||||||
@@ -43,15 +34,7 @@ SOURCES += \
|
|||||||
$$PWD/qmljslocatordata.cpp \
|
$$PWD/qmljslocatordata.cpp \
|
||||||
$$PWD/qmljsindenter.cpp \
|
$$PWD/qmljsindenter.cpp \
|
||||||
$$PWD/qmljscodestylesettingspage.cpp \
|
$$PWD/qmljscodestylesettingspage.cpp \
|
||||||
$$PWD/qmljssemanticinfo.cpp \
|
$$PWD/qmljssemanticinfo.cpp
|
||||||
$$PWD/qmlconsolemanager.cpp \
|
|
||||||
$$PWD/qmlconsoleitemmodel.cpp \
|
|
||||||
$$PWD/qmlconsolepane.cpp \
|
|
||||||
$$PWD/qmlconsoleview.cpp \
|
|
||||||
$$PWD/qmlconsoleitemdelegate.cpp \
|
|
||||||
$$PWD/qmlconsoleedit.cpp \
|
|
||||||
$$PWD/qmljsinterpreter.cpp \
|
|
||||||
$$PWD/qmlconsoleproxymodel.cpp
|
|
||||||
|
|
||||||
RESOURCES += \
|
RESOURCES += \
|
||||||
qmljstools.qrc
|
qmljstools.qrc
|
||||||
|
|||||||
@@ -44,22 +44,6 @@ QtcPlugin {
|
|||||||
"qmljstoolsplugin.h",
|
"qmljstoolsplugin.h",
|
||||||
"qmljstoolssettings.cpp",
|
"qmljstoolssettings.cpp",
|
||||||
"qmljstoolssettings.h",
|
"qmljstoolssettings.h",
|
||||||
"qmlconsolemanager.cpp",
|
|
||||||
"qmlconsolemanager.h",
|
|
||||||
"qmlconsoleitemmodel.cpp",
|
|
||||||
"qmlconsoleitemmodel.h",
|
|
||||||
"qmlconsolepane.cpp",
|
|
||||||
"qmlconsolepane.h",
|
|
||||||
"qmlconsoleview.cpp",
|
|
||||||
"qmlconsoleview.h",
|
|
||||||
"qmlconsoleitemdelegate.cpp",
|
|
||||||
"qmlconsoleitemdelegate.h",
|
|
||||||
"qmlconsoleedit.cpp",
|
|
||||||
"qmlconsoleedit.h",
|
|
||||||
"qmlconsoleproxymodel.cpp",
|
|
||||||
"qmlconsoleproxymodel.h",
|
|
||||||
"qmljsinterpreter.cpp",
|
|
||||||
"qmljsinterpreter.h",
|
|
||||||
"qmljstools.qrc"
|
"qmljstools.qrc"
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|||||||
@@ -35,7 +35,6 @@
|
|||||||
#include "qmljscodestylesettingspage.h"
|
#include "qmljscodestylesettingspage.h"
|
||||||
#include "qmljstoolsconstants.h"
|
#include "qmljstoolsconstants.h"
|
||||||
#include "qmljstoolssettings.h"
|
#include "qmljstoolssettings.h"
|
||||||
#include "qmlconsolemanager.h"
|
|
||||||
#include "qmljsbundleprovider.h"
|
#include "qmljsbundleprovider.h"
|
||||||
|
|
||||||
#include <coreplugin/icontext.h>
|
#include <coreplugin/icontext.h>
|
||||||
@@ -67,7 +66,6 @@ QmlJSToolsPlugin::~QmlJSToolsPlugin()
|
|||||||
{
|
{
|
||||||
m_instance = 0;
|
m_instance = 0;
|
||||||
m_modelManager = 0; // deleted automatically
|
m_modelManager = 0; // deleted automatically
|
||||||
m_consoleManager = 0; // deleted automatically
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QmlJSToolsPlugin::initialize(const QStringList &arguments, QString *error)
|
bool QmlJSToolsPlugin::initialize(const QStringList &arguments, QString *error)
|
||||||
@@ -81,7 +79,6 @@ bool QmlJSToolsPlugin::initialize(const QStringList &arguments, QString *error)
|
|||||||
|
|
||||||
// Objects
|
// Objects
|
||||||
m_modelManager = new ModelManager(this);
|
m_modelManager = new ModelManager(this);
|
||||||
m_consoleManager = new QmlConsoleManager(this);
|
|
||||||
|
|
||||||
// VCSManager *vcsManager = core->vcsManager();
|
// VCSManager *vcsManager = core->vcsManager();
|
||||||
// DocumentManager *fileManager = core->fileManager();
|
// DocumentManager *fileManager = core->fileManager();
|
||||||
|
|||||||
@@ -43,7 +43,6 @@ QT_END_NAMESPACE
|
|||||||
namespace QmlJSTools {
|
namespace QmlJSTools {
|
||||||
|
|
||||||
class QmlJSToolsSettings;
|
class QmlJSToolsSettings;
|
||||||
class QmlConsoleManager;
|
|
||||||
|
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
@@ -75,7 +74,6 @@ private slots:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
ModelManager *m_modelManager;
|
ModelManager *m_modelManager;
|
||||||
QmlConsoleManager *m_consoleManager;
|
|
||||||
QmlJSToolsSettings *m_settings;
|
QmlJSToolsSettings *m_settings;
|
||||||
QAction *m_resetCodeModelAction;
|
QAction *m_resetCodeModelAction;
|
||||||
|
|
||||||
|
|||||||
@@ -66,7 +66,7 @@
|
|||||||
:DebugModeWidget.Locals and Expressions_QDockWidget {container=':Qt Creator.DebugModeWidget_QSplitter' name='Debugger.Docks.LocalsAndWatchers' type='QDockWidget' visible='1' windowTitle='Locals and Expressions'}
|
:DebugModeWidget.Locals and Expressions_QDockWidget {container=':Qt Creator.DebugModeWidget_QSplitter' name='Debugger.Docks.LocalsAndWatchers' type='QDockWidget' visible='1' windowTitle='Locals and Expressions'}
|
||||||
:DebugModeWidget.OK_QPushButton {container=':Qt Creator.DebugModeWidget_QSplitter' text='OK' type='QPushButton' unnamed='1' visible='1'}
|
:DebugModeWidget.OK_QPushButton {container=':Qt Creator.DebugModeWidget_QSplitter' text='OK' type='QPushButton' unnamed='1' visible='1'}
|
||||||
:DebugModeWidget_QComboBox {container=':Qt Creator.DebugModeWidget_QSplitter' occurrence='2' type='QComboBox' unnamed='1' visible='1'}
|
:DebugModeWidget_QComboBox {container=':Qt Creator.DebugModeWidget_QSplitter' occurrence='2' type='QComboBox' unnamed='1' visible='1'}
|
||||||
:DebugModeWidget_QmlJSTools::Internal::QmlConsoleView {container=':Qt Creator.DebugModeWidget_QSplitter' type='QmlJSTools::Internal::QmlConsoleView' unnamed='1' visible='1'}
|
:DebugModeWidget_Debugger::Internal::ConsoleView {container=':Qt Creator.DebugModeWidget_QSplitter' type='Debugger::Internal::ConsoleView' unnamed='1' visible='1'}
|
||||||
:Debugger Toolbar.Continue_QToolButton {container=':DebugModeWidget.Debugger Toolbar_QDockWidget' text='Continue' type='QToolButton' unnamed='1' visible='1'}
|
:Debugger Toolbar.Continue_QToolButton {container=':DebugModeWidget.Debugger Toolbar_QDockWidget' text='Continue' type='QToolButton' unnamed='1' visible='1'}
|
||||||
:Debugger Toolbar.Exit Debugger_QToolButton {container=':DebugModeWidget.Debugger Toolbar_QDockWidget' text='Stop Debugger' type='QToolButton' unnamed='1' visible='1'}
|
:Debugger Toolbar.Exit Debugger_QToolButton {container=':DebugModeWidget.Debugger Toolbar_QDockWidget' text='Stop Debugger' type='QToolButton' unnamed='1' visible='1'}
|
||||||
:Debugger Toolbar.StatusText_Utils::StatusLabel {container=':DebugModeWidget.Debugger Toolbar_QDockWidget' type='Utils::StatusLabel' unnamed='1'}
|
:Debugger Toolbar.StatusText_Utils::StatusLabel {container=':DebugModeWidget.Debugger Toolbar_QDockWidget' type='Utils::StatusLabel' unnamed='1'}
|
||||||
@@ -124,7 +124,7 @@
|
|||||||
:Path.Utils_BaseValidatingLineEdit {container=':qt_tabwidget_stackedwidget_QWidget' name='LineEdit' type='Utils::FancyLineEdit' visible='1'}
|
:Path.Utils_BaseValidatingLineEdit {container=':qt_tabwidget_stackedwidget_QWidget' name='LineEdit' type='Utils::FancyLineEdit' visible='1'}
|
||||||
:QML Debugging.No_QPushButton {text='No' type='QPushButton' unnamed='1' visible='1' window=':QML Debugging_QMessageBox'}
|
:QML Debugging.No_QPushButton {text='No' type='QPushButton' unnamed='1' visible='1' window=':QML Debugging_QMessageBox'}
|
||||||
:QML Debugging_QMessageBox {text='The option will only take effect if the project is recompiled. Do you want to recompile now?' type='QMessageBox' unnamed='1' visible='1'}
|
:QML Debugging_QMessageBox {text='The option will only take effect if the project is recompiled. Do you want to recompile now?' type='QMessageBox' unnamed='1' visible='1'}
|
||||||
:QmlJSTools::Internal::QmlConsoleEdit {columnIndex='0' container=':DebugModeWidget_QmlJSTools::Internal::QmlConsoleView' rowIndex='0' type='QmlJSTools::Internal::QmlConsoleEdit' unnamed='1' visible='1'}
|
:Debugger::Internal::ConsoleEdit {columnIndex='0' container=':DebugModeWidget_Debugger::Internal::ConsoleView' rowIndex='0' type='Debugger::Internal::ConsoleEdit' unnamed='1' visible='1'}
|
||||||
:Qt Creator.Add Bookmark_QToolButton {text='Add Bookmark' type='QToolButton' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
|
:Qt Creator.Add Bookmark_QToolButton {text='Add Bookmark' type='QToolButton' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
|
||||||
:Qt Creator.Analyzer Toolbar_QDockWidget {name='Analyzer Toolbar' type='QDockWidget' visible='1' window=':Qt Creator_Core::Internal::MainWindow' windowTitle='Analyzer Toolbar'}
|
:Qt Creator.Analyzer Toolbar_QDockWidget {name='Analyzer Toolbar' type='QDockWidget' visible='1' window=':Qt Creator_Core::Internal::MainWindow' windowTitle='Analyzer Toolbar'}
|
||||||
:Qt Creator.CloseDoc_QToolButton {toolTip?='Close Document *' type='QToolButton' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
|
:Qt Creator.CloseDoc_QToolButton {toolTip?='Close Document *' type='QToolButton' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
|
||||||
|
|||||||
@@ -30,15 +30,15 @@
|
|||||||
|
|
||||||
source("../../shared/qtcreator.py")
|
source("../../shared/qtcreator.py")
|
||||||
|
|
||||||
def typeToQmlConsole(expression):
|
def typeToDebuggerConsole(expression):
|
||||||
editableIndex = getQModelIndexStr("text=''",
|
editableIndex = getQModelIndexStr("text=''",
|
||||||
":DebugModeWidget_QmlJSTools::Internal::QmlConsoleView")
|
":DebugModeWidget_Debugger::Internal::ConsoleView")
|
||||||
mouseClick(editableIndex, 5, 5, 0, Qt.LeftButton)
|
mouseClick(editableIndex, 5, 5, 0, Qt.LeftButton)
|
||||||
type(waitForObject(":QmlJSTools::Internal::QmlConsoleEdit"), expression)
|
type(waitForObject(":Debugger::Internal::ConsoleEdit"), expression)
|
||||||
type(waitForObject(":QmlJSTools::Internal::QmlConsoleEdit"), "<Return>")
|
type(waitForObject(":Debigger::Internal::ConsoleEdit"), "<Return>")
|
||||||
|
|
||||||
def useQmlJSConsole(expression, expectedOutput, check=None, checkOutp=None):
|
def useDebuggerConsole(expression, expectedOutput, check=None, checkOutp=None):
|
||||||
typeToQmlConsole(expression)
|
typeToDebuggerConsole(expression)
|
||||||
|
|
||||||
if expectedOutput == None:
|
if expectedOutput == None:
|
||||||
result = getQmlJSConsoleOutput()[-1]
|
result = getQmlJSConsoleOutput()[-1]
|
||||||
@@ -46,7 +46,7 @@ def useQmlJSConsole(expression, expectedOutput, check=None, checkOutp=None):
|
|||||||
return result
|
return result
|
||||||
|
|
||||||
expected = getQModelIndexStr("text='%s'" % expectedOutput,
|
expected = getQModelIndexStr("text='%s'" % expectedOutput,
|
||||||
":DebugModeWidget_QmlJSTools::Internal::QmlConsoleView")
|
":DebugModeWidget_Debugger::Internal::ConsoleView")
|
||||||
try:
|
try:
|
||||||
obj = waitForObject(expected, 3000)
|
obj = waitForObject(expected, 3000)
|
||||||
test.compare(obj.text, expectedOutput, "Verifying whether expected output appeared.")
|
test.compare(obj.text, expectedOutput, "Verifying whether expected output appeared.")
|
||||||
@@ -74,7 +74,7 @@ def debuggerHasStopped():
|
|||||||
def getQmlJSConsoleOutput():
|
def getQmlJSConsoleOutput():
|
||||||
try:
|
try:
|
||||||
result = []
|
result = []
|
||||||
consoleView = waitForObject(":DebugModeWidget_QmlJSTools::Internal::QmlConsoleView")
|
consoleView = waitForObject(":DebugModeWidget_Debugger::Internal::ConsoleView")
|
||||||
model = consoleView.model()
|
model = consoleView.model()
|
||||||
return dumpItems(model)[:-1]
|
return dumpItems(model)[:-1]
|
||||||
except:
|
except:
|
||||||
@@ -98,7 +98,7 @@ def testLoggingFeatures():
|
|||||||
)
|
)
|
||||||
|
|
||||||
for expression, expect, tooltip in zip(expressions, expected, filterToolTips):
|
for expression, expect, tooltip in zip(expressions, expected, filterToolTips):
|
||||||
typeToQmlConsole(expression)
|
typeToDebuggerConsole(expression)
|
||||||
output = getQmlJSConsoleOutput()[1:]
|
output = getQmlJSConsoleOutput()[1:]
|
||||||
test.compare(output, expect, "Verifying expected output.")
|
test.compare(output, expect, "Verifying expected output.")
|
||||||
filterButton = waitForObject("{container=':Qt Creator.DebugModeWidget_QSplitter' "
|
filterButton = waitForObject("{container=':Qt Creator.DebugModeWidget_QSplitter' "
|
||||||
@@ -143,8 +143,8 @@ def main():
|
|||||||
":Locals and Expressions_Debugger::Internal::WatchTreeView")
|
":Locals and Expressions_Debugger::Internal::WatchTreeView")
|
||||||
# make sure the items inside the root item are visible
|
# make sure the items inside the root item are visible
|
||||||
doubleClick(waitForObject(rootIndex))
|
doubleClick(waitForObject(rootIndex))
|
||||||
if not object.exists(":DebugModeWidget_QmlJSTools::Internal::QmlConsoleView"):
|
if not object.exists(":DebugModeWidget_Debugger::Internal::ConsoleView"):
|
||||||
invokeMenuItem("Window", "Output Panes", "QML/JS Console")
|
invokeMenuItem("Window", "Output Panes", "Debugger Console")
|
||||||
progressBarWait()
|
progressBarWait()
|
||||||
# color and float values have additional ZERO WIDTH SPACE (\u200b), different usage of
|
# color and float values have additional ZERO WIDTH SPACE (\u200b), different usage of
|
||||||
# whitespaces inside expressions is part of the test
|
# whitespaces inside expressions is part of the test
|
||||||
|
|||||||
Reference in New Issue
Block a user