Commit 05f6151d authored by hjk's avatar hjk

debugger: merger DebuggerMainWindow and DebuggerUISwitcher

parent def49bf9
......@@ -28,7 +28,6 @@ HEADERS += breakhandler.h \
debuggerconstants.h \
debuggerdialogs.h \
debuggerengine.h \
debuggermainwindow.h \
debuggerplugin.h \
debuggerrunner.h \
debuggerstreamops.h \
......@@ -69,7 +68,6 @@ SOURCES += breakhandler.cpp \
debuggeragents.cpp \
debuggerdialogs.cpp \
debuggerengine.cpp \
debuggermainwindow.cpp \
debuggerplugin.cpp \
debuggerrunner.cpp \
debuggerstreamops.cpp \
......
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2010 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.
**
**************************************************************************/
#include "debuggermainwindow.h"
#include "debuggeruiswitcher.h"
#include <QtGui/QMenu>
#include <QtGui/QDockWidget>
#include <QtCore/QDebug>
namespace Debugger {
namespace Internal {
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);
*/
}
QMenu *DebuggerMainWindow::createPopupMenu()
{
QMenu *menu = 0;
const QList<QDockWidget* > dockwidgets = m_uiSwitcher->dockWidgets();
if (!dockwidgets.isEmpty()) {
menu = FancyMainWindow::createPopupMenu();
foreach (QDockWidget *dockWidget, dockwidgets) {
if (dockWidget->parentWidget() == this)
menu->addAction(dockWidget->toggleViewAction());
}
menu->addSeparator();
}
return menu;
}
} // namespace Internal
} // namespace Debugger
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2010 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 DEBUGGERMAINWINDOW_H
#define DEBUGGERMAINWINDOW_H
#include <utils/fancymainwindow.h>
QT_FORWARD_DECLARE_CLASS(QMenu);
namespace Debugger {
class DebuggerUISwitcher;
namespace Internal {
class DebuggerMainWindow : public Utils::FancyMainWindow
{
Q_OBJECT
public:
explicit DebuggerMainWindow(DebuggerUISwitcher *uiSwitcher, QWidget *parent = 0);
protected:
virtual QMenu *createPopupMenu();
private:
DebuggerUISwitcher *m_uiSwitcher;
};
} // namespace Internal
} // namespace Debugger
#endif // DEBUGGERMAINWINDOW_H
This diff is collapsed.
......@@ -45,7 +45,7 @@ namespace Debugger {
class DebuggerRunControl;
class DebuggerStartParameters;
class DebuggerUISwitcher;
class DebuggerMainWindow;
// This is the "external" interface of the debugger plugin that's
// visible from Creator core. The internal interfact to global
......@@ -65,7 +65,7 @@ public:
static void startDebugger(ProjectExplorer::RunControl *runControl);
static void displayDebugger(ProjectExplorer::RunControl *runControl);
static bool isActiveDebugLanguage(int language);
static DebuggerUISwitcher *uiSwitcher();
static DebuggerMainWindow *mainWindow();
private:
// IPlugin implementation.
......
This diff is collapsed.
......@@ -33,11 +33,14 @@
#include "debugger_global.h"
#include "debuggerconstants.h"
#include <utils/fancymainwindow.h>
#include <QtCore/QObject>
QT_BEGIN_NAMESPACE
class QDockWidget;
class QSettings;
class QMenu;
QT_END_NAMESPACE
namespace Core {
......@@ -46,10 +49,6 @@ class Context;
class IMode;
}
namespace Utils {
class FancyMainWindow;
}
namespace ProjectExplorer {
class Project;
class Target;
......@@ -57,19 +56,18 @@ class RunConfiguration;
}
namespace Debugger {
struct DebuggerUISwitcherPrivate;
namespace Internal {
class DebuggerMainWindow;
};
class DebuggerMainWindowPrivate;
}
class DEBUGGER_EXPORT DebuggerUISwitcher : public QObject
class DEBUGGER_EXPORT DebuggerMainWindow : public Utils::FancyMainWindow
{
Q_OBJECT
public:
explicit DebuggerUISwitcher(QObject *parent = 0);
~DebuggerUISwitcher();
DebuggerMainWindow();
~DebuggerMainWindow();
// debuggable languages are registered with this function.
void addLanguage(const DebuggerLanguage &language, const Core::Context &context);
......@@ -107,8 +105,8 @@ public:
QDockWidget *createDockWidget(const DebuggerLanguage &language, QWidget *widget,
Qt::DockWidgetArea area = Qt::TopDockWidgetArea);
Utils::FancyMainWindow *mainWindow() const;
QWidget *createContents(Core::IMode *mode);
QMenu *createPopupMenu();
signals:
// emit when user changes active languages from the menu.
......@@ -134,10 +132,6 @@ public slots:
void writeSettings() const;
private:
// Used by MainWindow
friend class Internal::DebuggerMainWindow;
QList<QDockWidget *> dockWidgets() const;
void activateQmlCppLayout();
void activateCppLayout();
......@@ -146,7 +140,7 @@ private:
bool isQmlCppActive() const;
bool isQmlActive() const;
DebuggerUISwitcherPrivate *d;
Internal::DebuggerMainWindowPrivate *d;
};
} // namespace Debugger
......
......@@ -33,7 +33,6 @@
#include "gdboptionspage.h"
#include "debuggeruiswitcher.h"
#include "debuggermainwindow.h"
#include "debuggercore.h"
#include "debuggerplugin.h"
#include "debuggerrunner.h"
......
......@@ -488,8 +488,7 @@ void InspectorUi::reloadQmlViewer()
void InspectorUi::setSimpleDockWidgetArrangement(const Debugger::DebuggerLanguages &activeLanguages)
{
Debugger::DebuggerUISwitcher *uiSwitcher = Debugger::DebuggerPlugin::uiSwitcher();
Utils::FancyMainWindow *mw = uiSwitcher->mainWindow();
Debugger::DebuggerMainWindow *mw = Debugger::DebuggerPlugin::mainWindow();
mw->setTrackingEnabled(false);
......@@ -502,7 +501,7 @@ void InspectorUi::setSimpleDockWidgetArrangement(const Debugger::DebuggerLanguag
mw->removeDockWidget(dockWidget);
}
foreach (QDockWidget *dockWidget, dockWidgets) {
if (dockWidget == uiSwitcher->outputWindow()) {
if (dockWidget == mw->outputWindow()) {
mw->addDockWidget(Qt::TopDockWidgetArea, dockWidget);
} else {
mw->addDockWidget(Qt::BottomDockWidgetArea, dockWidget);
......@@ -515,17 +514,17 @@ void InspectorUi::setSimpleDockWidgetArrangement(const Debugger::DebuggerLanguag
}
}
uiSwitcher->stackWindow()->show();
uiSwitcher->watchWindow()->show();
uiSwitcher->breakWindow()->show();
uiSwitcher->threadsWindow()->show();
uiSwitcher->snapshotsWindow()->show();
mw->stackWindow()->show();
mw->watchWindow()->show();
mw->breakWindow()->show();
mw->threadsWindow()->show();
mw->snapshotsWindow()->show();
m_inspectorDockWidget->show();
mw->splitDockWidget(mw->toolBarDockWidget(), uiSwitcher->stackWindow(), Qt::Vertical);
mw->splitDockWidget(uiSwitcher->stackWindow(), uiSwitcher->watchWindow(), Qt::Horizontal);
mw->tabifyDockWidget(uiSwitcher->watchWindow(), uiSwitcher->breakWindow());
mw->tabifyDockWidget(uiSwitcher->watchWindow(), m_inspectorDockWidget);
mw->splitDockWidget(mw->toolBarDockWidget(), mw->stackWindow(), Qt::Vertical);
mw->splitDockWidget(mw->stackWindow(), mw->watchWindow(), Qt::Horizontal);
mw->tabifyDockWidget(mw->watchWindow(), mw->breakWindow());
mw->tabifyDockWidget(mw->watchWindow(), m_inspectorDockWidget);
}
......@@ -594,8 +593,6 @@ bool InspectorUi::addQuotesForData(const QVariant &value) const
void InspectorUi::setupDockWidgets()
{
Debugger::DebuggerUISwitcher *uiSwitcher = Debugger::DebuggerPlugin::uiSwitcher();
m_toolbar->createActions(Core::Context(Debugger::Constants::C_QMLDEBUGGER));
m_toolbar->setObjectName("QmlInspectorToolbar");
......@@ -618,9 +615,9 @@ void InspectorUi::setupDockWidgets()
wlay->addWidget(m_objectTreeWidget);
wlay->addWidget(m_crumblePath);
m_inspectorDockWidget = uiSwitcher->createDockWidget(Debugger::QmlLanguage,
observerWidget, Qt::BottomDockWidgetArea);
Debugger::DebuggerMainWindow *mw = Debugger::DebuggerPlugin::mainWindow();
m_inspectorDockWidget = mw->createDockWidget(Debugger::QmlLanguage,
observerWidget, Qt::BottomDockWidgetArea);
m_inspectorDockWidget->setObjectName(Debugger::Constants::DOCKWIDGET_QML_INSPECTOR);
m_inspectorDockWidget->setAllowedAreas(Qt::TopDockWidgetArea | Qt::BottomDockWidgetArea);
m_inspectorDockWidget->setTitleBarWidget(new QWidget(m_inspectorDockWidget));
......
Markdown is supported
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