Commit 580280af authored by Lasse Holmstedt's avatar Lasse Holmstedt

Changed QML Inspector from a separate global mode to a plugin.

The new QML Inspector depends on DebuggerPlugin. Also added a dropdown menu into
the debugger toolbar from which the user can select the used debugging
language, e.g. C++ or QML.
parent 70c47334
......@@ -43,7 +43,9 @@ HEADERS += breakhandler.h \
threadswindow.h \
watchhandler.h \
watchwindow.h \
name_demangler.h
name_demangler.h \
debuggeruiswitcher.h \
debuggermainwindow.h
SOURCES += breakhandler.cpp \
breakwindow.cpp \
breakwindow.h \
......@@ -70,7 +72,10 @@ SOURCES += breakhandler.cpp \
threadswindow.cpp \
watchhandler.cpp \
watchwindow.cpp \
name_demangler.cpp
name_demangler.cpp \
debuggeruiswitcher.cpp \
debuggermainwindow.cpp
FORMS += attachexternaldialog.ui \
attachcoredialog.ui \
breakbyfunction.ui \
......
......@@ -38,7 +38,7 @@ namespace Constants {
// modes and their priorities
const char * const MODE_DEBUG = "Debugger.Mode.Debug";
const int P_MODE_DEBUG = 85;
const char * const LANG_CPP = "C++";
// common actions
const char * const INTERRUPT = "Debugger.Interrupt";
const char * const RESET = "Debugger.Reset";
......
#include "debuggermainwindow.h"
#include <QtCore/QCoreApplication>
#include <QtGui/QApplication>
#include <QtGui/QMenu>
#include <QtGui/QLayout>
#include <QtGui/QMainWindow>
#include <QtGui/QDockWidget>
#include <QtGui/QStyle>
#include <QDebug>
namespace Debugger {
DebuggerMainWindow::DebuggerMainWindow(DebuggerUISwitcher *uiSwitcher, QWidget *parent) :
FancyMainWindow(parent), m_uiSwitcher(uiSwitcher)
{
// TODO how to "append" style sheet?
// QString sheet;
// After setting it, all prev. style stuff seem to be ignored.
/* sheet = QLatin1String(
"Debugger--DebuggerMainWindow::separator {"
" background: black;"
" width: 1px;"
" height: 1px;"
"}"
);
setStyleSheet(sheet);
*/
}
DebuggerMainWindow::~DebuggerMainWindow()
{
}
QMenu* DebuggerMainWindow::createPopupMenu()
{
QMenu *menu = 0;
QList<Internal::DebugToolWindow* > dockwidgets = m_uiSwitcher->m_dockWidgets;
if (!dockwidgets.isEmpty()) {
menu = new QMenu(this);
for (int i = 0; i < dockwidgets.size(); ++i) {
QDockWidget *dockWidget = dockwidgets.at(i)->m_dockWidget;
if (dockWidget->parentWidget() == this &&
dockwidgets.at(i)->m_languageId == m_uiSwitcher->m_activeLanguage) {
menu->addAction(dockWidget->toggleViewAction());
}
}
menu->addSeparator();
}
return menu;
}
}
#ifndef DEBUGGERMAINWINDOW_H
#define DEBUGGERMAINWINDOW_H
#include "debuggeruiswitcher.h"
#include <utils/fancymainwindow.h>
class QMenu;
namespace Debugger {
class DebuggerMainWindow : public Utils::FancyMainWindow
{
public:
DebuggerMainWindow(DebuggerUISwitcher *uiSwitcher, QWidget *parent = 0);
~DebuggerMainWindow();
protected:
virtual QMenu *createPopupMenu();
private:
DebuggerUISwitcher *m_uiSwitcher;
};
}
#endif // DEBUGGERMAINWINDOW_H
This diff is collapsed.
......@@ -53,9 +53,6 @@ QT_END_NAMESPACE
namespace Core {
class IOptionsPage;
}
namespace Utils {
class FancyMainWindow;
}
namespace TextEditor {
class ITextEditor;
......@@ -180,7 +177,6 @@ public:
DebuggerState state() const;
QList<Core::IOptionsPage*> initializeEngines(unsigned enabledTypeFlags);
Utils::FancyMainWindow *mainWindow() const;
QLabel *statusLabel() const;
Internal::IDebuggerEngine *currentEngine() const;
......@@ -208,7 +204,7 @@ public slots:
void startNewDebugger(const DebuggerStartParametersPtr &sp);
void exitDebugger();
void setSimpleDockWidgetArrangement();
void setSimpleDockWidgetArrangement(const QString &activeLanguage);
void setBusyCursor(bool on);
void queryCurrentTextEditor(QString *fileName, int *lineNumber, QObject **ed);
......
This diff is collapsed.
......@@ -40,6 +40,7 @@ class QAction;
class QCursor;
class QMenu;
class QPoint;
class QComboBox;
QT_END_NAMESPACE
namespace Core {
......@@ -54,7 +55,9 @@ class BaseTextMark;
}
namespace Debugger {
class DebuggerManager;
class DebuggerUISwitcher;
namespace Internal {
......@@ -122,12 +125,14 @@ private:
void writeSettings() const;
void attachExternalApplication(qint64 pid, const QString &crashParameter = QString());
void attachCore(const QString &core, const QString &exeFileName);
QWidget *createToolbar() const;
friend class Debugger::DebuggerManager;
friend class GdbOptionPage;
friend class DebuggingHelperOptionPage;
friend class Debugger::Internal::DebugMode; // FIXME: Just a hack now so that it can access the views
DebuggerUISwitcher *m_uiSwitcher;
DebuggerManager *m_manager;
DebugMode *m_debugMode;
DebuggerRunControlFactory *m_debuggerRunControlFactory;
......@@ -138,13 +143,12 @@ private:
AttachRemoteParameters m_attachRemoteParameters;
unsigned m_cmdLineEnabledEngines;
QAction *m_toggleLockedAction;
QAction *m_startExternalAction;
QAction *m_startRemoteAction;
QAction *m_attachExternalAction;
QAction *m_attachCoreAction;
QAction *m_detachAction;
QComboBox *m_langBox;
};
} // namespace Internal
......
This diff is collapsed.
#ifndef DEBUGGERUISWITCHER_H
#define DEBUGGERUISWITCHER_H
#include "debugger_global.h"
#include <coreplugin/basemode.h>
#include <QtCore/QObject>
#include <QtGui/QStandardItemModel>
#include <QtCore/QList>
namespace Core {
class ActionContainer;
class Command;
}
class QAction;
class QDockWidget;
class QStackedWidget;
class QComboBox;
namespace Debugger {
class DebuggerMainWindow;
namespace Internal {
class DebugToolWindow {
public:
DebugToolWindow() : m_visible(false) {}
QDockWidget* m_dockWidget;
int m_languageId;
bool m_visible;
};
}
}
namespace Debugger {
class DEBUGGER_EXPORT DebuggerUISwitcher : public QObject
{
Q_OBJECT
public:
DebuggerUISwitcher(Core::BaseMode *mode, QObject *parent = 0);
~DebuggerUISwitcher();
static DebuggerUISwitcher *instance();
// debuggable languages are registered with this function
void addLanguage(const QString &langName);
// debugger toolbars are registered with this function
void setToolbar(const QString &langName, QWidget *widget);
// menu actions are registered with this function
void addMenuAction(Core::Command *command,
const QString &group = QString());
void setActiveLanguage(const QString &langName);
// called when all dependent plugins have loaded
void initialize();
void shutdown();
// dockwidgets are registered to the main window
QDockWidget *createDockWidget(const QString &langName, QWidget *widget,
Qt::DockWidgetArea area = Qt::TopDockWidgetArea,
bool visibleByDefault = true);
DebuggerMainWindow *mainWindow() const;
signals:
void languageChanged(const QString &langName);
// emit when dock needs to be reset
void dockArranged(const QString &activeLanguage);
private slots:
void modeChanged(Core::IMode *mode);
void changeDebuggerUI(int langId);
void resetDebuggerLayout();
private:
void hideInactiveWidgets();
void createViewsMenuItems();
void readSettings();
void writeSettings() const;
QModelIndex modelIndexForLanguage(const QString &langName);
QWidget *createContents(Core::BaseMode *mode);
QWidget *createMainWindow(Core::BaseMode *mode);
// first: language id, second: menu item
typedef QPair<int, QAction* > ViewsMenuItems;
QList< ViewsMenuItems > m_viewsMenuItems;
QList< Internal::DebugToolWindow* > m_dockWidgets;
QStandardItemModel *m_model;
QStackedWidget *m_toolbarStack;
QComboBox *m_langBox;
DebuggerMainWindow *m_mainWindow;
int m_activeLanguage;
bool m_isActiveMode;
bool m_changingUI;
QAction *m_toggleLockedAction;
const static int StackIndexRole = Qt::UserRole + 11;
Core::ActionContainer *m_viewsMenu;
Core::ActionContainer *m_debugMenu;
static DebuggerUISwitcher *m_instance;
friend class DebuggerMainWindow;
};
}
#endif // DEBUGGERUISWITCHER_H
......@@ -33,6 +33,8 @@
#include "gdboptionspage.h"
#include "trkoptions.h"
#include "trkoptionspage.h"
#include "debugger/debuggeruiswitcher.h"
#include "debugger/debuggermainwindow.h"
#include "attachgdbadapter.h"
#include "coregdbadapter.h"
......@@ -210,7 +212,7 @@ DebuggerStartMode GdbEngine::startMode() const
QMainWindow *GdbEngine::mainWindow() const
{
return m_manager->mainWindow();
return DebuggerUISwitcher::instance()->mainWindow();
}
GdbEngine::~GdbEngine()
......
......@@ -189,6 +189,7 @@ plugin_qmlinspector.depends += plugin_projectexplorer
plugin_qmlinspector.depends += plugin_coreplugin
plugin_qmlinspector.depends += plugin_texteditor
plugin_qmlinspector.depends += plugin_qmlprojectmanager
plugin_qmlinspector.depends += plugin_debugger
plugin_mercurial.subdir = mercurial
plugin_mercurial.depends = plugin_texteditor
......
......@@ -24,5 +24,6 @@ will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.</license>
<dependency name="CppTools" version="1.3.80"/>
<dependency name="CppEditor" version="1.3.80"/>
<dependency name="Help" version="1.3.80"/>
<dependency name="Debugger" version="1.3.80"/>
</dependencyList>
</plugin>
......@@ -30,6 +30,8 @@
#include <QtGui/qtextedit.h>
using namespace Qml;
InspectorOutputPane::InspectorOutputPane(QObject *parent)
: Core::IOutputPane(parent),
m_textEdit(new QTextEdit)
......
......@@ -33,12 +33,11 @@
#include <QtCore/QObject>
QT_BEGIN_NAMESPACE
class QTextEdit;
class RunControl;
namespace Qml {
class InspectorOutputPane : public Core::IOutputPane
{
Q_OBJECT
......@@ -76,7 +75,7 @@ private:
QTextEdit *m_textEdit;
};
QT_END_NAMESPACE
}
#endif
......@@ -26,28 +26,92 @@
** contact the sales department at http://qt.nokia.com/contact.
**
**************************************************************************/
#ifndef QMLINSPECTOR_H
#define QMLINSPECTOR_H
#ifndef QMLINSPECTORMODE_H
#define QMLINSPECTORMODE_H
#include <QString>
#include "qmlinspector_global.h"
#include <coreplugin/basemode.h>
namespace QmlInspector {
namespace Constants {
const char * const RUN = "QmlInspector.Run";
const char * const STOP = "QmlInspector.Stop";
#include <QtGui/QAction>
#include <QtCore/QObject>
const char * const C_INSPECTOR = "QmlInspector";
};
QT_BEGIN_NAMESPACE
class StartParameters
{
public:
StartParameters() : port(0) {}
~StartParameters() {}
class QDockWidget;
class QToolButton;
class QLineEdit;
class QSpinBox;
class QLabel;
class QmlEngineDebug;
class QmlDebugConnection;
class QmlDebugEnginesQuery;
class QmlDebugRootContextQuery;
class QmlDebugObjectReference;
class ObjectTree;
class WatchTableModel;
class WatchTableView;
class ObjectPropertiesView;
class CanvasFrameRate;
class ExpressionQueryWidget;
namespace Qml {
class EngineSpinBox;
class QMLINSPECTOR_EXPORT QmlInspector : public QObject
{
Q_OBJECT
public:
QmlInspector(QObject *parent = 0);
bool connectToViewer(); // using host, port from widgets
signals:
void statusMessage(const QString &text);
public slots:
void disconnectFromViewer();
void setSimpleDockWidgetArrangement();
private slots:
void connectionStateChanged();
void connectionError();
void reloadEngines();
void enginesChanged();
void queryEngineContext(int);
void contextChanged();
void treeObjectActivated(const QmlDebugObjectReference &obj);
private:
void initWidgets();
QmlDebugConnection *m_conn;
QmlEngineDebug *m_client;
QmlDebugEnginesQuery *m_engineQuery;
QmlDebugRootContextQuery *m_contextQuery;
ObjectTree *m_objectTreeWidget;
ObjectPropertiesView *m_propertiesWidget;
WatchTableModel *m_watchTableModel;
WatchTableView *m_watchTableView;
CanvasFrameRate *m_frameRateWidget;
ExpressionQueryWidget *m_expressionWidget;
EngineSpinBox *m_engineSpinBox;
QDockWidget *m_objectTreeDock;
QDockWidget *m_frameRateDock;
QDockWidget *m_propertyWatcherDock;
QList<QDockWidget*> m_dockWidgets;
QString address;
quint16 port;
};
};
}
QT_END_NAMESPACE
#endif
......@@ -6,13 +6,16 @@ DEPENDPATH += .
include(components/qmldebugger.pri)
DEFINES += QMLINSPECTOR_LIBRARY
HEADERS += qmlinspectorplugin.h \
qmlinspectorconstants.h \
qmlinspector.h \
qmlinspectormode.h \
inspectoroutputpane.h
inspectoroutputpane.h \
qmlinspector_global.h
SOURCES += qmlinspectorplugin.cpp \
qmlinspectormode.cpp \
qmlinspector.cpp \
inspectoroutputpane.cpp
OTHER_FILES += QmlInspector.pluginspec
......@@ -23,4 +26,4 @@ include(../../plugins/projectexplorer/projectexplorer.pri)
include(../../plugins/qmlprojectmanager/qmlprojectmanager.pri)
include(../../plugins/coreplugin/coreplugin.pri)
include(../../plugins/texteditor/texteditor.pri)
include(../../plugins/debugger/debugger.pri)
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** Commercial Usage
**
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
**
** GNU Lesser General Public License Usage
**
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at http://qt.nokia.com/contact.
**
**************************************************************************/
#ifndef QMLINSPECTOR_GLOBAL_H
#define QMLINSPECTOR_GLOBAL_H
#include <QtCore/QtGlobal>
#if defined(QMLINSPECTOR_LIBRARY)
# define QMLINSPECTOR_EXPORT Q_DECL_EXPORT
#else
# define QMLINSPECTOR_EXPORT Q_DECL_IMPORT
#endif
#endif // QMLINSPECTOR_GLOBAL_H
......@@ -26,81 +26,29 @@
** contact the sales department at http://qt.nokia.com/contact.
**
**************************************************************************/
#ifndef QMLINSPECTORMODE_H
#define QMLINSPECTORMODE_H
#ifndef QMLINSPECTORCONSTANTS_H
#define QMLINSPECTORCONSTANTS_H
#include <coreplugin/basemode.h>
#include <QString>
#include <QtGui/QAction>
#include <QtCore/QObject>
namespace Qml {
namespace Constants {
const char * const RUN = "QmlInspector.Run";
const char * const STOP = "QmlInspector.Stop";
QT_BEGIN_NAMESPACE
const char * const C_INSPECTOR = "QmlInspector";
const char * const LANG_QML = "QML";
};
class QToolButton;
class QLineEdit;
class QSpinBox;
class QLabel;
class StartParameters
{
public:
StartParameters() : port(0) {}
~StartParameters() {}
class QmlEngineDebug;
class QmlDebugConnection;
class QmlDebugEnginesQuery;
class QmlDebugRootContextQuery;
class QmlDebugObjectReference;
class ObjectTree;
class WatchTableModel;
class WatchTableView;
class ObjectPropertiesView;
class CanvasFrameRate;
class ExpressionQueryWidget;
class EngineSpinBox;
class QmlInspectorMode : public Core::BaseMode
{
Q_OBJECT
public:
QmlInspectorMode(QObject *parent = 0);
signals:
void statusMessage(const QString &text);
public slots:
void connectToViewer(); // using host, port from widgets
void disconnectFromViewer();
private slots:
void connectionStateChanged();
void connectionError();
void reloadEngines();
void enginesChanged();
void queryEngineContext(int);
void contextChanged();
void treeObjectActivated(const QmlDebugObjectReference &obj);
private:
QWidget *createModeWindow();
QWidget *createMainView();
void initWidgets();
QWidget *createBottomWindow();
QToolButton *createToolButton(QAction *action