Commit 4e5089d9 authored by Lasse Holmstedt's avatar Lasse Holmstedt

Merge branch 'debugintegration'

Conflicts:
	src/plugins/qmlprojectmanager/qmlproject.cpp
	src/plugins/qmlprojectmanager/qmlproject.h
parents 5262ca20 580280af
......@@ -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
......@@ -36,6 +36,8 @@
#include "idebuggerengine.h"
#include "debuggerstringutils.h"
#include "watchutils.h"
#include "debuggeruiswitcher.h"
#include "debuggermainwindow.h"
#include "breakwindow.h"
#include "debuggeroutputwindow.h"
......@@ -60,10 +62,10 @@
# include "shared/peutils.h"
#endif
#include <coreplugin/minisplitter.h>
#include <coreplugin/icore.h>
#include <coreplugin/editormanager/editormanager.h>
#include <utils/qtcassert.h>
#include <utils/fancymainwindow.h>
#include <projectexplorer/toolchain.h>
#include <cplusplus/CppDocument.h>
#include <cpptools/cppmodelmanagerinterface.h>
......@@ -260,7 +262,7 @@ struct DebuggerManagerPrivate
qint64 m_inferiorPid;
/// Views
Utils::FancyMainWindow *m_mainWindow;
DebuggerMainWindow *m_mainWindow;
QLabel *m_statusLabel;
QDockWidget *m_breakDock;
......@@ -272,6 +274,7 @@ struct DebuggerManagerPrivate
QDockWidget *m_stackDock;
QDockWidget *m_threadsDock;
QDockWidget *m_watchDock;
QList<QDockWidget *> m_dockWidgets;
BreakHandler *m_breakHandler;
ModulesHandler *m_modulesHandler;
......@@ -364,9 +367,7 @@ void DebuggerManager::init()
d->m_watchersWindow = new WatchWindow(WatchWindow::WatchersType, this);
d->m_statusTimer = new QTimer(this);
d->m_mainWindow = new Utils::FancyMainWindow;
d->m_mainWindow->setTabPosition(Qt::AllDockWidgetAreas, QTabWidget::North);
d->m_mainWindow->setDocumentMode(true);
d->m_mainWindow = DebuggerUISwitcher::instance()->mainWindow();
// Snapshots
d->m_snapshotHandler = new SnapshotHandler;
......@@ -551,30 +552,32 @@ void DebuggerManager::init()
connect(theDebuggerAction(OperateByInstruction), SIGNAL(triggered()),
this, SLOT(operateByInstructionTriggered()));
DebuggerUISwitcher *uiSwitcher = DebuggerUISwitcher::instance();
d->m_breakDock = uiSwitcher->createDockWidget(LANG_CPP, d->m_breakWindow);
d->m_modulesDock = uiSwitcher->createDockWidget(LANG_CPP, d->m_modulesWindow,
Qt::TopDockWidgetArea, false);
d->m_breakDock = d->m_mainWindow->addDockForWidget(d->m_breakWindow);
d->m_modulesDock = d->m_mainWindow->addDockForWidget(d->m_modulesWindow);
connect(d->m_modulesDock->toggleViewAction(), SIGNAL(toggled(bool)),
this, SLOT(reloadModules()), Qt::QueuedConnection);
d->m_registerDock = d->m_mainWindow->addDockForWidget(d->m_registerWindow);
d->m_registerDock = uiSwitcher->createDockWidget(LANG_CPP, d->m_registerWindow,
Qt::TopDockWidgetArea, false);
connect(d->m_registerDock->toggleViewAction(), SIGNAL(toggled(bool)),
this, SLOT(reloadRegisters()), Qt::QueuedConnection);
d->m_outputDock = d->m_mainWindow->addDockForWidget(d->m_outputWindow);
d->m_snapshotDock = d->m_mainWindow->addDockForWidget(d->m_snapshotWindow);
d->m_stackDock = d->m_mainWindow->addDockForWidget(d->m_stackWindow);
d->m_outputDock = uiSwitcher->createDockWidget(LANG_CPP, d->m_outputWindow,
Qt::TopDockWidgetArea, false);
d->m_sourceFilesDock = d->m_mainWindow->addDockForWidget(d->m_sourceFilesWindow);
d->m_snapshotDock = uiSwitcher->createDockWidget(LANG_CPP, d->m_snapshotWindow);
d->m_stackDock = uiSwitcher->createDockWidget(LANG_CPP, d->m_stackWindow);
d->m_sourceFilesDock = uiSwitcher->createDockWidget(LANG_CPP, d->m_sourceFilesWindow,
Qt::TopDockWidgetArea, false);
connect(d->m_sourceFilesDock->toggleViewAction(), SIGNAL(toggled(bool)),
this, SLOT(reloadSourceFiles()), Qt::QueuedConnection);
d->m_threadsDock = d->m_mainWindow->addDockForWidget(d->m_threadsWindow);
d->m_threadsDock = uiSwitcher->createDockWidget(LANG_CPP, d->m_threadsWindow);
QSplitter *localsAndWatchers = new QSplitter(Qt::Vertical, 0);
QSplitter *localsAndWatchers = new Core::MiniSplitter(Qt::Vertical);
localsAndWatchers->setWindowTitle(d->m_localsWindow->windowTitle());
localsAndWatchers->addWidget(d->m_localsWindow);
localsAndWatchers->addWidget(d->m_watchersWindow);
......@@ -582,7 +585,10 @@ void DebuggerManager::init()
localsAndWatchers->setStretchFactor(0, 3);
localsAndWatchers->setStretchFactor(1, 1);
localsAndWatchers->setStretchFactor(2, 1);
d->m_watchDock = d->m_mainWindow->addDockForWidget(localsAndWatchers);
d->m_watchDock = DebuggerUISwitcher::instance()->createDockWidget(LANG_CPP, localsAndWatchers);
d->m_dockWidgets << d->m_breakDock << d->m_modulesDock << d->m_registerDock
<< d->m_outputDock << d->m_stackDock << d->m_sourceFilesDock
<< d->m_threadsDock << d->m_watchDock;
setState(DebuggerNotReady);
}
......@@ -613,11 +619,6 @@ DebuggerManagerActions DebuggerManager::debuggerManagerActions() const
return d->m_actions;
}
Utils::FancyMainWindow *DebuggerManager::mainWindow() const
{
return d->m_mainWindow;
}
QLabel *DebuggerManager::statusLabel() const
{
return d->m_statusLabel;
......@@ -687,30 +688,36 @@ QWidget *DebuggerManager::threadsWindow() const
void DebuggerManager::createNewDock(QWidget *widget)
{
QDockWidget *dockWidget = new QDockWidget(widget->windowTitle(), d->m_mainWindow);
QDockWidget *dockWidget = DebuggerUISwitcher::instance()->createDockWidget(LANG_CPP, widget);
dockWidget->setWindowTitle(widget->windowTitle());
dockWidget->setObjectName(widget->windowTitle());
dockWidget->setFeatures(QDockWidget::DockWidgetClosable);
dockWidget->setWidget(widget);
d->m_mainWindow->addDockWidget(Qt::TopDockWidgetArea, dockWidget);
//dockWidget->setWidget(widget);
//d->m_mainWindow->addDockWidget(Qt::TopDockWidgetArea, dockWidget);
dockWidget->show();
}
void DebuggerManager::setSimpleDockWidgetArrangement()
void DebuggerManager::setSimpleDockWidgetArrangement(const QString &activeLanguage)
{
if (activeLanguage == LANG_CPP || !activeLanguage.length()) {
d->m_mainWindow->setTrackingEnabled(false);
QList<QDockWidget *> dockWidgets = d->m_mainWindow->dockWidgets();
foreach (QDockWidget *dockWidget, dockWidgets) {
if (d->m_dockWidgets.contains(dockWidget)) {
dockWidget->setFloating(false);
d->m_mainWindow->removeDockWidget(dockWidget);
}
}
foreach (QDockWidget *dockWidget, dockWidgets) {
if (d->m_dockWidgets.contains(dockWidget)) {
if (dockWidget == d->m_outputDock)
d->m_mainWindow->addDockWidget(Qt::TopDockWidgetArea, dockWidget);
else
d->m_mainWindow->addDockWidget(Qt::BottomDockWidgetArea, dockWidget);
dockWidget->show();
}
}
d->m_mainWindow->tabifyDockWidget(d->m_watchDock, d->m_breakDock);
d->m_mainWindow->tabifyDockWidget(d->m_watchDock, d->m_modulesDock);
......@@ -718,7 +725,6 @@ void DebuggerManager::setSimpleDockWidgetArrangement()
d->m_mainWindow->tabifyDockWidget(d->m_watchDock, d->m_threadsDock);
d->m_mainWindow->tabifyDockWidget(d->m_watchDock, d->m_sourceFilesDock);
d->m_mainWindow->tabifyDockWidget(d->m_watchDock, d->m_snapshotDock);
// They following views are rarely used in ordinary debugging. Hiding them
// saves cycles since the corresponding information won't be retrieved.
d->m_sourceFilesDock->hide();
......@@ -726,6 +732,7 @@ void DebuggerManager::setSimpleDockWidgetArrangement()
d->m_modulesDock->hide();
d->m_outputDock->hide();
d->m_mainWindow->setTrackingEnabled(true);
}
}
QAbstractItemModel *DebuggerManager::threadsModel()
......@@ -1248,7 +1255,7 @@ void DebuggerManager::saveSessionData()
void DebuggerManager::dumpLog()
{
QString fileName = QFileDialog::getSaveFileName(mainWindow(),
QString fileName = QFileDialog::getSaveFileName(d->m_mainWindow,
tr("Save Debugger Log"), QDir::tempPath());
if (fileName.isEmpty())
return;
......@@ -1575,7 +1582,7 @@ QStringList DebuggerManager::qtDumperLibraryLocations() const
void DebuggerManager::showQtDumperLibraryWarning(const QString &details)
{
QMessageBox dialog(mainWindow());
QMessageBox dialog(d->m_mainWindow);
QPushButton *qtPref = dialog.addButton(tr("Open Qt preferences"),
QMessageBox::ActionRole);
QPushButton *helperOff = dialog.addButton(tr("Turn off helper usage"),
......@@ -1636,7 +1643,7 @@ QMessageBox *DebuggerManager::showMessageBox(int icon, const QString &title,
const QString &text, int buttons)
{
QMessageBox *mb = new QMessageBox(QMessageBox::Icon(icon),
title, text, QMessageBox::StandardButtons(buttons), mainWindow());
title, text, QMessageBox::StandardButtons(buttons), d->m_mainWindow);
mb->setAttribute(Qt::WA_DeleteOnClose);
mb->show();
return mb;
......@@ -1748,7 +1755,7 @@ void DebuggerManager::setState(DebuggerState state, bool forced)
const bool stopped = state == InferiorStopped;
if (stopped)
QApplication::alert(mainWindow(), 3000);
QApplication::alert(d->m_mainWindow, 3000);
const bool actionsEnabled = debuggerActionsEnabled();
const unsigned engineCapabilities = debuggerCapabilities();
......
......@@ -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;