Commit f38ff964 authored by Lasse Holmstedt's avatar Lasse Holmstedt
Browse files

Moved Qml Inspector Output pane to a dock widget within the debugger.

parent a2f1889c
......@@ -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)
{
}
InspectorOutputPane::~InspectorOutputPane()
{
delete m_textEdit;
}
QWidget *InspectorOutputPane::outputWidget(QWidget *parent)
{
Q_UNUSED(parent);
return m_textEdit;
}
QList<QWidget*> InspectorOutputPane::toolBarWidgets() const
{
return QList<QWidget *>();
}
QString InspectorOutputPane::name() const
{
return tr("Inspector Output");
}
int InspectorOutputPane::priorityInStatusBar() const
{
return 1;
}
void InspectorOutputPane::clearContents()
{
m_textEdit->clear();
}
void InspectorOutputPane::visibilityChanged(bool visible)
{
Q_UNUSED(visible);
}
void InspectorOutputPane::setFocus()
{
m_textEdit->setFocus();
}
bool InspectorOutputPane::hasFocus()
{
return m_textEdit->hasFocus();
}
setWindowTitle(tr("Output"));
bool InspectorOutputPane::canFocus()
{
return true;
m_clearContents = new QAction(QString(tr("Clear")), this);
m_clearContents->setIcon(QIcon(Core::Constants::ICON_CLEAR));
connect(m_clearContents, SIGNAL(triggered()), SLOT(clear()));
}
bool InspectorOutputPane::canNavigate()
InspectorOutputWidget::~InspectorOutputWidget()
{
return false;
}
bool InspectorOutputPane::canNext()
{
return false;
}
bool InspectorOutputPane::canPrevious()
void InspectorOutputWidget::contextMenuEvent(QContextMenuEvent *e)
{
return false;
}
QMenu *menu = createStandardContextMenu(e->globalPos());
void InspectorOutputPane::goToNext()
{
}
void InspectorOutputPane::goToPrev()
{
menu->addSeparator();
menu->addAction(m_clearContents);
menu->exec(e->globalPos());
}
void InspectorOutputPane::addOutput(RunControl *, const QString &text)
void InspectorOutputWidget::addOutput(RunControl *, const QString &text)
{
m_textEdit->insertPlainText(text);
m_textEdit->moveCursor(QTextCursor::End);
insertPlainText(text);
moveCursor(QTextCursor::End);
}
void InspectorOutputPane::addOutputInline(RunControl *, const QString &text)
void InspectorOutputWidget::addOutputInline(RunControl *, const QString &text)
{
m_textEdit->insertPlainText(text);
m_textEdit->moveCursor(QTextCursor::End);
insertPlainText(text);
moveCursor(QTextCursor::End);
}
void InspectorOutputPane::addErrorOutput(RunControl *, const QString &text)
void InspectorOutputWidget::addErrorOutput(RunControl *, const QString &text)
{
m_textEdit->append(text);
m_textEdit->moveCursor(QTextCursor::End);
append(text);
moveCursor(QTextCursor::End);
}
void InspectorOutputPane::addInspectorStatus(const QString &text)
void InspectorOutputWidget::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();
public:
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;
};
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment