forked from qt-creator/qt-creator
Moved Qml Inspector Output pane to a dock widget within the debugger.
This commit is contained in:
@@ -27,114 +27,63 @@
|
||||
**
|
||||
**************************************************************************/
|
||||
#include "inspectoroutputpane.h"
|
||||
#include <coreplugin/coreconstants.h>
|
||||
|
||||
#include <QtGui/qtextedit.h>
|
||||
#include <QtGui/QTextEdit>
|
||||
#include <QtGui/QContextMenuEvent>
|
||||
#include <QtGui/QMenu>
|
||||
#include <QtGui/QAction>
|
||||
#include <QtGui/QIcon>
|
||||
|
||||
using namespace Qml;
|
||||
|
||||
InspectorOutputPane::InspectorOutputPane(QObject *parent)
|
||||
: Core::IOutputPane(parent),
|
||||
m_textEdit(new QTextEdit)
|
||||
InspectorOutputWidget::InspectorOutputWidget(QWidget *parent)
|
||||
: QTextEdit(parent)
|
||||
{
|
||||
setWindowTitle(tr("Output"));
|
||||
|
||||
m_clearContents = new QAction(QString(tr("Clear")), this);
|
||||
m_clearContents->setIcon(QIcon(Core::Constants::ICON_CLEAR));
|
||||
connect(m_clearContents, SIGNAL(triggered()), SLOT(clear()));
|
||||
}
|
||||
|
||||
InspectorOutputPane::~InspectorOutputPane()
|
||||
InspectorOutputWidget::~InspectorOutputWidget()
|
||||
{
|
||||
delete m_textEdit;
|
||||
|
||||
}
|
||||
|
||||
QWidget *InspectorOutputPane::outputWidget(QWidget *parent)
|
||||
void InspectorOutputWidget::contextMenuEvent(QContextMenuEvent *e)
|
||||
{
|
||||
Q_UNUSED(parent);
|
||||
return m_textEdit;
|
||||
QMenu *menu = createStandardContextMenu(e->globalPos());
|
||||
|
||||
menu->addSeparator();
|
||||
menu->addAction(m_clearContents);
|
||||
menu->exec(e->globalPos());
|
||||
}
|
||||
|
||||
QList<QWidget*> InspectorOutputPane::toolBarWidgets() const
|
||||
void InspectorOutputWidget::addOutput(RunControl *, const QString &text)
|
||||
{
|
||||
return QList<QWidget *>();
|
||||
insertPlainText(text);
|
||||
moveCursor(QTextCursor::End);
|
||||
}
|
||||
|
||||
QString InspectorOutputPane::name() const
|
||||
void InspectorOutputWidget::addOutputInline(RunControl *, const QString &text)
|
||||
{
|
||||
return tr("Inspector Output");
|
||||
insertPlainText(text);
|
||||
moveCursor(QTextCursor::End);
|
||||
}
|
||||
|
||||
int InspectorOutputPane::priorityInStatusBar() const
|
||||
void InspectorOutputWidget::addErrorOutput(RunControl *, const QString &text)
|
||||
{
|
||||
return 1;
|
||||
append(text);
|
||||
moveCursor(QTextCursor::End);
|
||||
}
|
||||
|
||||
void InspectorOutputPane::clearContents()
|
||||
void InspectorOutputWidget::addInspectorStatus(const QString &text)
|
||||
{
|
||||
m_textEdit->clear();
|
||||
}
|
||||
|
||||
void InspectorOutputPane::visibilityChanged(bool visible)
|
||||
{
|
||||
Q_UNUSED(visible);
|
||||
}
|
||||
|
||||
void InspectorOutputPane::setFocus()
|
||||
{
|
||||
m_textEdit->setFocus();
|
||||
}
|
||||
|
||||
bool InspectorOutputPane::hasFocus()
|
||||
{
|
||||
return m_textEdit->hasFocus();
|
||||
}
|
||||
|
||||
bool InspectorOutputPane::canFocus()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool InspectorOutputPane::canNavigate()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool InspectorOutputPane::canNext()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool InspectorOutputPane::canPrevious()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
void InspectorOutputPane::goToNext()
|
||||
{
|
||||
}
|
||||
|
||||
void InspectorOutputPane::goToPrev()
|
||||
{
|
||||
}
|
||||
|
||||
void InspectorOutputPane::addOutput(RunControl *, const QString &text)
|
||||
{
|
||||
m_textEdit->insertPlainText(text);
|
||||
m_textEdit->moveCursor(QTextCursor::End);
|
||||
}
|
||||
|
||||
void InspectorOutputPane::addOutputInline(RunControl *, const QString &text)
|
||||
{
|
||||
m_textEdit->insertPlainText(text);
|
||||
m_textEdit->moveCursor(QTextCursor::End);
|
||||
}
|
||||
|
||||
void InspectorOutputPane::addErrorOutput(RunControl *, const QString &text)
|
||||
{
|
||||
m_textEdit->append(text);
|
||||
m_textEdit->moveCursor(QTextCursor::End);
|
||||
}
|
||||
|
||||
void InspectorOutputPane::addInspectorStatus(const QString &text)
|
||||
{
|
||||
m_textEdit->setTextColor(Qt::darkGreen);
|
||||
m_textEdit->append(text);
|
||||
m_textEdit->moveCursor(QTextCursor::End);
|
||||
m_textEdit->setTextColor(Qt::black);
|
||||
setTextColor(Qt::darkGreen);
|
||||
append(text);
|
||||
moveCursor(QTextCursor::End);
|
||||
setTextColor(Qt::black);
|
||||
}
|
||||
|
||||
|
||||
@@ -26,43 +26,28 @@
|
||||
** contact the sales department at http://qt.nokia.com/contact.
|
||||
**
|
||||
**************************************************************************/
|
||||
#ifndef INSPECTOROUTPUTPANE_H
|
||||
#define INSPECTOROUTPUTPANE_H
|
||||
|
||||
#include <coreplugin/ioutputpane.h>
|
||||
#ifndef INSPECTOROUTPUTWIDGET_H
|
||||
#define INSPECTOROUTPUTWIDGET_H
|
||||
|
||||
#include <QtCore/QObject>
|
||||
#include <QtGui/QTextEdit>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QAction;
|
||||
class QContextMenuEvent;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
QT_FORWARD_DECLARE_CLASS(QTextEdit);
|
||||
QT_FORWARD_DECLARE_CLASS(RunControl);
|
||||
|
||||
namespace Qml {
|
||||
|
||||
class InspectorOutputPane : public Core::IOutputPane
|
||||
class InspectorOutputWidget : public QTextEdit
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
InspectorOutputPane(QObject *parent = 0);
|
||||
virtual ~InspectorOutputPane();
|
||||
|
||||
virtual QWidget *outputWidget(QWidget *parent);
|
||||
virtual QList<QWidget*> toolBarWidgets() const;
|
||||
virtual QString name() const;
|
||||
|
||||
virtual int priorityInStatusBar() const;
|
||||
|
||||
virtual void clearContents();
|
||||
virtual void visibilityChanged(bool visible);
|
||||
|
||||
virtual void setFocus();
|
||||
virtual bool hasFocus();
|
||||
virtual bool canFocus();
|
||||
|
||||
virtual bool canNavigate();
|
||||
virtual bool canNext();
|
||||
virtual bool canPrevious();
|
||||
virtual void goToNext();
|
||||
virtual void goToPrev();
|
||||
InspectorOutputWidget(QWidget *parent = 0);
|
||||
virtual ~InspectorOutputWidget();
|
||||
|
||||
public slots:
|
||||
void addOutput(RunControl *, const QString &text);
|
||||
@@ -71,11 +56,14 @@ public slots:
|
||||
void addErrorOutput(RunControl *, const QString &text);
|
||||
void addInspectorStatus(const QString &text);
|
||||
|
||||
protected:
|
||||
void contextMenuEvent(QContextMenuEvent *e);
|
||||
|
||||
private:
|
||||
QTextEdit *m_textEdit;
|
||||
QAction *m_clearContents;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif // INSPECTOROUTPUTWIDGET_H
|
||||
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
#include "qmlinspectorconstants.h"
|
||||
#include "qmlinspector.h"
|
||||
#include "debugger/debuggermainwindow.h"
|
||||
#include "inspectoroutputwidget.h"
|
||||
|
||||
#include <debugger/debuggeruiswitcher.h>
|
||||
|
||||
@@ -163,7 +164,11 @@ QmlInspector::QmlInspector(QObject *parent)
|
||||
m_conn(0),
|
||||
m_client(0),
|
||||
m_engineQuery(0),
|
||||
m_contextQuery(0)
|
||||
m_contextQuery(0),
|
||||
m_objectTreeDock(0),
|
||||
m_frameRateDock(0),
|
||||
m_propertyWatcherDock(0),
|
||||
m_inspectorOutputDock(0)
|
||||
{
|
||||
m_watchTableModel = new WatchTableModel(0, this);
|
||||
|
||||
@@ -346,13 +351,20 @@ void QmlInspector::initWidgets()
|
||||
propSplitter->setStretchFactor(1, 1);
|
||||
propSplitter->setWindowTitle(tr("Properties and Watchers"));
|
||||
|
||||
|
||||
InspectorOutputWidget *inspectorOutput = new InspectorOutputWidget();
|
||||
connect(this, SIGNAL(statusMessage(QString)),
|
||||
inspectorOutput, SLOT(addInspectorStatus(QString)));
|
||||
|
||||
m_objectTreeDock = Debugger::DebuggerUISwitcher::instance()->createDockWidget(Qml::Constants::LANG_QML,
|
||||
treeWindow, Qt::BottomDockWidgetArea);
|
||||
m_frameRateDock = Debugger::DebuggerUISwitcher::instance()->createDockWidget(Qml::Constants::LANG_QML,
|
||||
m_frameRateWidget, Qt::BottomDockWidgetArea);
|
||||
m_propertyWatcherDock = Debugger::DebuggerUISwitcher::instance()->createDockWidget(Qml::Constants::LANG_QML,
|
||||
propSplitter, Qt::BottomDockWidgetArea);
|
||||
m_dockWidgets << m_objectTreeDock << m_frameRateDock << m_propertyWatcherDock;
|
||||
m_inspectorOutputDock = Debugger::DebuggerUISwitcher::instance()->createDockWidget(Qml::Constants::LANG_QML,
|
||||
inspectorOutput, Qt::BottomDockWidgetArea);
|
||||
m_dockWidgets << m_objectTreeDock << m_frameRateDock << m_propertyWatcherDock << m_inspectorOutputDock;
|
||||
}
|
||||
|
||||
void QmlInspector::setSimpleDockWidgetArrangement()
|
||||
@@ -381,6 +393,8 @@ void QmlInspector::setSimpleDockWidgetArrangement()
|
||||
}
|
||||
|
||||
mainWindow->tabifyDockWidget(m_frameRateDock, m_propertyWatcherDock);
|
||||
mainWindow->tabifyDockWidget(m_frameRateDock, m_inspectorOutputDock);
|
||||
|
||||
mainWindow->setTrackingEnabled(true);
|
||||
}
|
||||
|
||||
|
||||
@@ -107,6 +107,7 @@ private:
|
||||
QDockWidget *m_objectTreeDock;
|
||||
QDockWidget *m_frameRateDock;
|
||||
QDockWidget *m_propertyWatcherDock;
|
||||
QDockWidget *m_inspectorOutputDock;
|
||||
QList<QDockWidget*> m_dockWidgets;
|
||||
|
||||
};
|
||||
|
||||
@@ -11,12 +11,12 @@ DEFINES += QMLINSPECTOR_LIBRARY
|
||||
HEADERS += qmlinspectorplugin.h \
|
||||
qmlinspectorconstants.h \
|
||||
qmlinspector.h \
|
||||
inspectoroutputpane.h \
|
||||
inspectoroutputwidget.h \
|
||||
qmlinspector_global.h
|
||||
|
||||
SOURCES += qmlinspectorplugin.cpp \
|
||||
qmlinspector.cpp \
|
||||
inspectoroutputpane.cpp
|
||||
inspectoroutputwidget.cpp
|
||||
|
||||
OTHER_FILES += QmlInspector.pluginspec
|
||||
RESOURCES += qmlinspector.qrc
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
**************************************************************************/
|
||||
#include "qmlinspectorconstants.h"
|
||||
#include "qmlinspector.h"
|
||||
#include "inspectoroutputpane.h"
|
||||
#include "qmlinspectorplugin.h"
|
||||
|
||||
#include <debugger/debuggeruiswitcher.h>
|
||||
@@ -89,10 +88,6 @@ QmlInspectorPlugin::~QmlInspectorPlugin()
|
||||
|
||||
void QmlInspectorPlugin::shutdown()
|
||||
{
|
||||
removeObject(m_outputPane);
|
||||
delete m_outputPane;
|
||||
m_outputPane = 0;
|
||||
|
||||
removeObject(m_inspector);
|
||||
delete m_inspector;
|
||||
m_inspector = 0;
|
||||
@@ -115,12 +110,6 @@ bool QmlInspectorPlugin::initialize(const QStringList &arguments, QString *error
|
||||
|
||||
connect(m_connectionTimer, SIGNAL(timeout()), SLOT(pollInspector()));
|
||||
|
||||
m_outputPane = new InspectorOutputPane;
|
||||
addObject(m_outputPane);
|
||||
|
||||
connect(m_inspector, SIGNAL(statusMessage(QString)),
|
||||
m_outputPane, SLOT(addInspectorStatus(QString)));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -47,7 +47,6 @@ namespace ProjectExplorer {
|
||||
|
||||
namespace Qml {
|
||||
class QmlInspector;
|
||||
class InspectorOutputPane;
|
||||
|
||||
const int MaxConnectionAttempts = 20;
|
||||
|
||||
@@ -74,7 +73,6 @@ private slots:
|
||||
|
||||
private:
|
||||
QmlInspector *m_inspector;
|
||||
InspectorOutputPane *m_outputPane;
|
||||
QTimer *m_connectionTimer;
|
||||
int m_connectionAttempts;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user