forked from qt-creator/qt-creator
debugger: some code reorganization
This commit is contained in:
@@ -22,7 +22,6 @@ HEADERS += attachexternaldialog.h \
|
||||
debuggeroutputwindow.h \
|
||||
debuggerplugin.h \
|
||||
debuggerrunner.h \
|
||||
mode.h \
|
||||
disassemblerhandler.h \
|
||||
disassemblerwindow.h \
|
||||
gdbengine.h \
|
||||
@@ -52,7 +51,6 @@ SOURCES += attachexternaldialog.cpp \
|
||||
debuggeroutputwindow.cpp \
|
||||
debuggerplugin.cpp \
|
||||
debuggerrunner.cpp \
|
||||
mode.cpp \
|
||||
disassemblerhandler.cpp \
|
||||
disassemblerwindow.cpp \
|
||||
gdbengine.cpp \
|
||||
|
||||
@@ -483,11 +483,6 @@ IDebuggerManagerAccessForEngines *DebuggerManager::engineInterface()
|
||||
return dynamic_cast<IDebuggerManagerAccessForEngines *>(this);
|
||||
}
|
||||
|
||||
IDebuggerManagerAccessForDebugMode *DebuggerManager::debugModeInterface()
|
||||
{
|
||||
return dynamic_cast<IDebuggerManagerAccessForDebugMode *>(this);
|
||||
}
|
||||
|
||||
void DebuggerManager::createDockWidgets()
|
||||
{
|
||||
QSplitter *localsAndWatchers = new QSplitter(Qt::Vertical, 0);
|
||||
|
||||
@@ -180,32 +180,12 @@ private:
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// IDebuggerManagerAccessForDebugMode
|
||||
//
|
||||
|
||||
class IDebuggerManagerAccessForDebugMode
|
||||
{
|
||||
public:
|
||||
virtual ~IDebuggerManagerAccessForDebugMode() {}
|
||||
|
||||
private:
|
||||
friend class DebugMode;
|
||||
|
||||
virtual QWidget *threadsWindow() const = 0;
|
||||
virtual QLabel *statusLabel() const = 0;
|
||||
virtual QList<QDockWidget*> dockWidgets() const = 0;
|
||||
virtual void createDockWidgets() = 0;
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// DebuggerManager
|
||||
//
|
||||
|
||||
class DebuggerManager : public QObject,
|
||||
public IDebuggerManagerAccessForEngines,
|
||||
public IDebuggerManagerAccessForDebugMode
|
||||
public IDebuggerManagerAccessForEngines
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -214,7 +194,6 @@ public:
|
||||
~DebuggerManager();
|
||||
|
||||
IDebuggerManagerAccessForEngines *engineInterface();
|
||||
IDebuggerManagerAccessForDebugMode *debugModeInterface();
|
||||
QMainWindow *mainWindow() const { return m_mainWindow; }
|
||||
QLabel *statusLabel() const { return m_statusLabel; }
|
||||
|
||||
|
||||
@@ -38,14 +38,19 @@
|
||||
#include "debuggerrunner.h"
|
||||
#include "gdboptionpage.h"
|
||||
#include "gdbengine.h"
|
||||
#include "mode.h"
|
||||
|
||||
#include <coreplugin/actionmanager/actionmanager.h>
|
||||
#include <coreplugin/basemode.h>
|
||||
#include <coreplugin/coreconstants.h>
|
||||
#include <coreplugin/editormanager/editormanager.h>
|
||||
#include <coreplugin/findplaceholder.h>
|
||||
#include <coreplugin/icore.h>
|
||||
#include <coreplugin/messagemanager.h>
|
||||
#include <coreplugin/minisplitter.h>
|
||||
#include <coreplugin/modemanager.h>
|
||||
#include <coreplugin/navigationwidget.h>
|
||||
#include <coreplugin/outputpane.h>
|
||||
#include <coreplugin/rightpane.h>
|
||||
#include <coreplugin/uniqueidmanager.h>
|
||||
|
||||
#include <cplusplus/ExpressionUnderCursor.h>
|
||||
@@ -69,17 +74,17 @@
|
||||
#include <QtCore/QtPlugin>
|
||||
|
||||
#include <QtGui/QDockWidget>
|
||||
#include <QtGui/QMainWindow>
|
||||
#include <QtGui/QPlainTextEdit>
|
||||
#include <QtGui/QTextBlock>
|
||||
#include <QtGui/QTextCursor>
|
||||
|
||||
|
||||
using namespace Debugger::Internal;
|
||||
using namespace Debugger::Constants;
|
||||
using namespace TextEditor;
|
||||
using namespace Core;
|
||||
using namespace Debugger::Constants;
|
||||
using namespace Debugger::Internal;
|
||||
using namespace ProjectExplorer;
|
||||
using namespace CPlusPlus;
|
||||
using namespace TextEditor;
|
||||
|
||||
|
||||
namespace Debugger {
|
||||
@@ -138,6 +143,39 @@ const char * const ADD_TO_WATCH_KEY = "Ctrl+Alt+Q";
|
||||
} // namespace Debugger
|
||||
|
||||
|
||||
namespace Debugger {
|
||||
namespace Internal {
|
||||
|
||||
class DebugMode : public Core::BaseMode
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
DebugMode(QObject *parent = 0);
|
||||
~DebugMode();
|
||||
|
||||
// IMode
|
||||
void activated() {}
|
||||
void shutdown() {}
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Debugger
|
||||
|
||||
DebugMode::DebugMode(QObject *parent)
|
||||
: BaseMode(tr("Debug"), Constants::MODE_DEBUG,
|
||||
QIcon(":/fancyactionbar/images/mode_Debug.png"),
|
||||
Constants::P_MODE_DEBUG, 0, parent)
|
||||
{
|
||||
}
|
||||
|
||||
DebugMode::~DebugMode()
|
||||
{
|
||||
// Make sure the editor manager does not get deleted
|
||||
EditorManager::instance()->setParent(0);
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// LocationMark
|
||||
@@ -172,6 +210,7 @@ QIcon LocationMark::icon() const
|
||||
return icon;
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// DebuggerPlugin
|
||||
@@ -184,11 +223,17 @@ DebuggerPlugin::DebuggerPlugin()
|
||||
m_generalOptionPage = 0;
|
||||
m_locationMark = 0;
|
||||
m_manager = 0;
|
||||
m_debugMode = 0;
|
||||
}
|
||||
|
||||
DebuggerPlugin::~DebuggerPlugin()
|
||||
{}
|
||||
|
||||
static QSettings *settings()
|
||||
{
|
||||
return ExtensionSystem::PluginManager::instance()->getObject<ICore>()->settings();
|
||||
}
|
||||
|
||||
void DebuggerPlugin::shutdown()
|
||||
{
|
||||
if (m_debugMode)
|
||||
@@ -197,6 +242,8 @@ void DebuggerPlugin::shutdown()
|
||||
if (m_manager)
|
||||
m_manager->shutdown();
|
||||
|
||||
writeSettings();
|
||||
|
||||
//qDebug() << "DebuggerPlugin::~DebuggerPlugin";
|
||||
removeObject(m_debugMode);
|
||||
removeObject(m_generalOptionPage);
|
||||
@@ -435,12 +482,98 @@ bool DebuggerPlugin::initialize(const QStringList &arguments, QString *error_mes
|
||||
|
||||
m_locationMark = 0;
|
||||
|
||||
m_debugMode = new DebugMode(m_manager, this);
|
||||
|
||||
//
|
||||
// Debug mode setup
|
||||
//
|
||||
m_debugMode = new DebugMode(this);
|
||||
//addAutoReleasedObject(m_debugMode);
|
||||
addObject(m_debugMode);
|
||||
|
||||
addAutoReleasedObject(new DebuggerRunner(m_manager));
|
||||
|
||||
QList<int> context;
|
||||
context.append(uidm->uniqueIdentifier(Core::Constants::C_EDITORMANAGER));
|
||||
context.append(uidm->uniqueIdentifier(Debugger::Constants::C_GDBDEBUGGER));
|
||||
context.append(uidm->uniqueIdentifier(Core::Constants::C_NAVIGATION_PANE));
|
||||
m_debugMode->setContext(context);
|
||||
|
||||
QBoxLayout *editorHolderLayout = new QVBoxLayout;
|
||||
editorHolderLayout->setMargin(0);
|
||||
editorHolderLayout->setSpacing(0);
|
||||
editorHolderLayout->addWidget(new EditorManagerPlaceHolder(m_debugMode));
|
||||
editorHolderLayout->addWidget(new FindToolBarPlaceHolder(m_debugMode));
|
||||
|
||||
QWidget *editorAndFindWidget = new QWidget;
|
||||
editorAndFindWidget->setLayout(editorHolderLayout);
|
||||
|
||||
MiniSplitter *rightPaneSplitter = new MiniSplitter;
|
||||
rightPaneSplitter->addWidget(editorAndFindWidget);
|
||||
rightPaneSplitter->addWidget(new RightPanePlaceHolder(m_debugMode));
|
||||
rightPaneSplitter->setStretchFactor(0, 1);
|
||||
rightPaneSplitter->setStretchFactor(1, 0);
|
||||
|
||||
QWidget *centralWidget = new QWidget;
|
||||
|
||||
m_manager->mainWindow()->setCentralWidget(centralWidget);
|
||||
|
||||
MiniSplitter *splitter = new MiniSplitter;
|
||||
splitter->addWidget(m_manager->mainWindow());
|
||||
splitter->addWidget(new OutputPanePlaceHolder(m_debugMode));
|
||||
splitter->setStretchFactor(0, 10);
|
||||
splitter->setStretchFactor(1, 0);
|
||||
splitter->setOrientation(Qt::Vertical);
|
||||
|
||||
MiniSplitter *splitter2 = new MiniSplitter;
|
||||
splitter2 = new MiniSplitter;
|
||||
splitter2->addWidget(new NavigationWidgetPlaceHolder(m_debugMode));
|
||||
splitter2->addWidget(splitter);
|
||||
splitter2->setStretchFactor(0, 0);
|
||||
splitter2->setStretchFactor(1, 1);
|
||||
|
||||
m_debugMode->setWidget(splitter2);
|
||||
|
||||
QToolBar *debugToolBar = new QToolBar;
|
||||
debugToolBar->addAction(am->command(ProjectExplorer::Constants::DEBUG)->action());
|
||||
debugToolBar->addAction(am->command(Constants::INTERRUPT)->action());
|
||||
debugToolBar->addAction(am->command(Constants::NEXT)->action());
|
||||
debugToolBar->addAction(am->command(Constants::STEP)->action());
|
||||
debugToolBar->addAction(am->command(Constants::STEPOUT)->action());
|
||||
debugToolBar->addSeparator();
|
||||
debugToolBar->addAction(am->command(Constants::STEPI)->action());
|
||||
debugToolBar->addAction(am->command(Constants::NEXTI)->action());
|
||||
debugToolBar->addSeparator();
|
||||
debugToolBar->addWidget(new QLabel(tr("Threads:")));
|
||||
|
||||
QComboBox *threadBox = new QComboBox;
|
||||
threadBox->setModel(m_manager->threadsModel());
|
||||
connect(threadBox, SIGNAL(activated(int)),
|
||||
m_manager->threadsWindow(), SIGNAL(threadSelected(int)));
|
||||
debugToolBar->addWidget(threadBox);
|
||||
debugToolBar->addWidget(m_manager->statusLabel());
|
||||
|
||||
QWidget *stretch = new QWidget;
|
||||
stretch->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum);
|
||||
debugToolBar->addWidget(stretch);
|
||||
|
||||
QBoxLayout *toolBarAddingLayout = new QVBoxLayout(centralWidget);
|
||||
toolBarAddingLayout->setMargin(0);
|
||||
toolBarAddingLayout->setSpacing(0);
|
||||
toolBarAddingLayout->addWidget(rightPaneSplitter);
|
||||
toolBarAddingLayout->addWidget(debugToolBar);
|
||||
|
||||
m_manager->createDockWidgets();
|
||||
m_manager->setSimpleDockWidgetArrangement();
|
||||
readSettings();
|
||||
|
||||
connect(ModeManager::instance(), SIGNAL(currentModeChanged(Core::IMode*)),
|
||||
this, SLOT(focusCurrentEditor(Core::IMode*)));
|
||||
m_debugMode->widget()->setFocusProxy(EditorManager::instance());
|
||||
addObject(m_debugMode);
|
||||
|
||||
//
|
||||
// Connections
|
||||
//
|
||||
|
||||
// ProjectExplorer
|
||||
connect(projectExplorer()->session(), SIGNAL(sessionLoaded()),
|
||||
m_manager, SLOT(sessionLoaded()));
|
||||
@@ -593,7 +726,7 @@ void DebuggerPlugin::showToolTip(TextEditor::ITextEditor *editor,
|
||||
tc.movePosition(QTextCursor::EndOfWord);
|
||||
|
||||
// Fetch the expression's code.
|
||||
ExpressionUnderCursor expressionUnderCursor;
|
||||
CPlusPlus::ExpressionUnderCursor expressionUnderCursor;
|
||||
expr = expressionUnderCursor(tc);
|
||||
}
|
||||
//qDebug() << " TOOLTIP EXPR " << expr;
|
||||
@@ -621,13 +754,13 @@ void DebuggerPlugin::querySessionValue(const QString &name, QVariant *value)
|
||||
void DebuggerPlugin::setConfigValue(const QString &name, const QVariant &value)
|
||||
{
|
||||
QTC_ASSERT(m_debugMode, return);
|
||||
m_debugMode->settings()->setValue(name, value);
|
||||
settings()->setValue(name, value);
|
||||
}
|
||||
|
||||
void DebuggerPlugin::queryConfigValue(const QString &name, QVariant *value)
|
||||
{
|
||||
QTC_ASSERT(m_debugMode, return);
|
||||
*value = m_debugMode->settings()->value(name);
|
||||
*value = settings()->value(name);
|
||||
}
|
||||
|
||||
void DebuggerPlugin::resetLocation()
|
||||
@@ -662,6 +795,37 @@ void DebuggerPlugin::changeStatus(int status)
|
||||
}
|
||||
}
|
||||
|
||||
void DebuggerPlugin::writeSettings() const
|
||||
{
|
||||
QSettings *s = settings();
|
||||
QTC_ASSERT(m_manager, return);
|
||||
QTC_ASSERT(m_manager->mainWindow(), return);
|
||||
s->beginGroup(QLatin1String("DebugMode"));
|
||||
s->setValue(QLatin1String("State"), m_manager->mainWindow()->saveState());
|
||||
s->setValue(QLatin1String("Locked"), m_toggleLockedAction->isChecked());
|
||||
s->endGroup();
|
||||
}
|
||||
|
||||
void DebuggerPlugin::readSettings()
|
||||
{
|
||||
QSettings *s = settings();
|
||||
s->beginGroup(QLatin1String("DebugMode"));
|
||||
m_manager->mainWindow()->restoreState(s->value(QLatin1String("State"), QByteArray()).toByteArray());
|
||||
m_toggleLockedAction->setChecked(s->value(QLatin1String("Locked"), true).toBool());
|
||||
s->endGroup();
|
||||
}
|
||||
|
||||
void DebuggerPlugin::focusCurrentEditor(IMode *mode)
|
||||
{
|
||||
if (mode != m_debugMode)
|
||||
return;
|
||||
|
||||
EditorManager *editorManager = EditorManager::instance();
|
||||
|
||||
if (editorManager->currentEditor())
|
||||
editorManager->currentEditor()->widget()->setFocus();
|
||||
}
|
||||
|
||||
#include "debuggerplugin.moc"
|
||||
|
||||
Q_EXPORT_PLUGIN(DebuggerPlugin)
|
||||
|
||||
@@ -90,8 +90,12 @@ private slots:
|
||||
void gotoLocation(const QString &fileName, int line, bool setMarker);
|
||||
|
||||
void breakpointMarginActionTriggered();
|
||||
void focusCurrentEditor(Core::IMode *mode);
|
||||
|
||||
private:
|
||||
void readSettings();
|
||||
void writeSettings() const;
|
||||
|
||||
friend class DebuggerManager;
|
||||
friend class DebugMode; // FIXME: Just a hack now so that it can access the views
|
||||
|
||||
|
||||
@@ -1,217 +0,0 @@
|
||||
/***************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||
**
|
||||
**
|
||||
** Non-Open Source Usage
|
||||
**
|
||||
** Licensees may use this file in accordance with the Qt Beta Version
|
||||
** License Agreement, Agreement version 2.2 provided with the Software or,
|
||||
** alternatively, in accordance with the terms contained in a written
|
||||
** agreement between you and Nokia.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
**
|
||||
** Alternatively, this file may be used under the terms of the GNU General
|
||||
** Public License versions 2.0 or 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the packaging
|
||||
** of this file. Please review the following information to ensure GNU
|
||||
** General Public Licensing requirements will be met:
|
||||
**
|
||||
** http://www.fsf.org/licensing/licenses/info/GPLv2.html and
|
||||
** http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt GPL Exception
|
||||
** version 1.3, included in the file GPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
***************************************************************************/
|
||||
|
||||
#include "mode.h"
|
||||
|
||||
#include "debuggerconstants.h"
|
||||
#include "debuggermanager.h"
|
||||
|
||||
#include <coreplugin/coreconstants.h>
|
||||
#include <coreplugin/icore.h>
|
||||
#include <coreplugin/modemanager.h>
|
||||
#include <coreplugin/uniqueidmanager.h>
|
||||
#include <coreplugin/actionmanager/actionmanager.h>
|
||||
#include <coreplugin/editormanager/editormanager.h>
|
||||
#include <coreplugin/minisplitter.h>
|
||||
#include <coreplugin/findplaceholder.h>
|
||||
#include <coreplugin/outputpane.h>
|
||||
#include <coreplugin/navigationwidget.h>
|
||||
#include <coreplugin/rightpane.h>
|
||||
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QtCore/QDebug>
|
||||
#include <QtCore/QSettings>
|
||||
|
||||
#include <QtGui/QLabel>
|
||||
#include <QtGui/QMainWindow>
|
||||
#include <QtGui/QVBoxLayout>
|
||||
#include <QtGui/QWidget>
|
||||
|
||||
using namespace Core;
|
||||
using namespace ExtensionSystem;
|
||||
using namespace Debugger;
|
||||
using namespace Debugger::Internal;
|
||||
using namespace Debugger::Constants;
|
||||
|
||||
|
||||
DebugMode::DebugMode(DebuggerManager *manager, QObject *parent)
|
||||
: BaseMode(tr("Debug"), Constants::MODE_DEBUG,
|
||||
QIcon(":/fancyactionbar/images/mode_Debug.png"),
|
||||
Constants::P_MODE_DEBUG, 0, parent),
|
||||
m_manager(manager)
|
||||
{
|
||||
IDebuggerManagerAccessForDebugMode *managerAccess =
|
||||
m_manager->debugModeInterface();
|
||||
UniqueIDManager *uidm =
|
||||
PluginManager::instance()->getObject<ICore>()->uniqueIDManager();
|
||||
QList<int> context;
|
||||
context.append(uidm->uniqueIdentifier(Core::Constants::C_EDITORMANAGER));
|
||||
context.append(uidm->uniqueIdentifier(Constants::C_GDBDEBUGGER));
|
||||
context.append(uidm->uniqueIdentifier(Core::Constants::C_NAVIGATION_PANE));
|
||||
setContext(context);
|
||||
|
||||
QBoxLayout *editorHolderLayout = new QVBoxLayout;
|
||||
editorHolderLayout->setMargin(0);
|
||||
editorHolderLayout->setSpacing(0);
|
||||
editorHolderLayout->addWidget(new EditorManagerPlaceHolder(this));
|
||||
editorHolderLayout->addWidget(new FindToolBarPlaceHolder(this));
|
||||
|
||||
QWidget *editorAndFindWidget = new QWidget;
|
||||
editorAndFindWidget->setLayout(editorHolderLayout);
|
||||
|
||||
MiniSplitter *rightPaneSplitter = new MiniSplitter;
|
||||
rightPaneSplitter->addWidget(editorAndFindWidget);
|
||||
rightPaneSplitter->addWidget(new RightPanePlaceHolder(this));
|
||||
rightPaneSplitter->setStretchFactor(0, 1);
|
||||
rightPaneSplitter->setStretchFactor(1, 0);
|
||||
|
||||
QWidget *centralWidget = new QWidget;
|
||||
QBoxLayout *toolBarAddingLayout = new QVBoxLayout(centralWidget);
|
||||
toolBarAddingLayout->setMargin(0);
|
||||
toolBarAddingLayout->setSpacing(0);
|
||||
toolBarAddingLayout->addWidget(rightPaneSplitter);
|
||||
|
||||
m_manager->mainWindow()->setCentralWidget(centralWidget);
|
||||
|
||||
MiniSplitter *splitter = new MiniSplitter;
|
||||
splitter->addWidget(m_manager->mainWindow());
|
||||
splitter->addWidget(new OutputPanePlaceHolder(this));
|
||||
splitter->setStretchFactor(0, 10);
|
||||
splitter->setStretchFactor(1, 0);
|
||||
splitter->setOrientation(Qt::Vertical);
|
||||
|
||||
MiniSplitter *splitter2 = new MiniSplitter;
|
||||
splitter2 = new MiniSplitter;
|
||||
splitter2->addWidget(new NavigationWidgetPlaceHolder(this));
|
||||
splitter2->addWidget(splitter);
|
||||
splitter2->setStretchFactor(0, 0);
|
||||
splitter2->setStretchFactor(1, 1);
|
||||
|
||||
setWidget(splitter2);
|
||||
|
||||
QToolBar *toolBar = createToolBar();
|
||||
toolBarAddingLayout->addWidget(toolBar);
|
||||
|
||||
managerAccess->createDockWidgets();
|
||||
m_manager->setSimpleDockWidgetArrangement();
|
||||
readSettings();
|
||||
|
||||
connect(ModeManager::instance(), SIGNAL(currentModeChanged(Core::IMode*)),
|
||||
this, SLOT(focusCurrentEditor(Core::IMode*)));
|
||||
widget()->setFocusProxy(EditorManager::instance());
|
||||
}
|
||||
|
||||
DebugMode::~DebugMode()
|
||||
{
|
||||
// Make sure the editor manager does not get deleted
|
||||
EditorManager::instance()->setParent(0);
|
||||
}
|
||||
|
||||
void DebugMode::shutdown()
|
||||
{
|
||||
writeSettings();
|
||||
}
|
||||
|
||||
QToolBar *DebugMode::createToolBar()
|
||||
{
|
||||
IDebuggerManagerAccessForDebugMode *managerAccess =
|
||||
m_manager->debugModeInterface();
|
||||
|
||||
Core::ActionManager *am =
|
||||
ExtensionSystem::PluginManager::instance()
|
||||
->getObject<Core::ICore>()->actionManager();
|
||||
QToolBar *debugToolBar = new QToolBar;
|
||||
debugToolBar->addAction(am->command(ProjectExplorer::Constants::DEBUG)->action());
|
||||
debugToolBar->addAction(am->command(Constants::INTERRUPT)->action());
|
||||
debugToolBar->addAction(am->command(Constants::NEXT)->action());
|
||||
debugToolBar->addAction(am->command(Constants::STEP)->action());
|
||||
debugToolBar->addAction(am->command(Constants::STEPOUT)->action());
|
||||
debugToolBar->addSeparator();
|
||||
debugToolBar->addAction(am->command(Constants::STEPI)->action());
|
||||
debugToolBar->addAction(am->command(Constants::NEXTI)->action());
|
||||
debugToolBar->addSeparator();
|
||||
debugToolBar->addWidget(new QLabel(tr("Threads:")));
|
||||
|
||||
QComboBox *threadBox = new QComboBox;
|
||||
threadBox->setModel(m_manager->threadsModel());
|
||||
connect(threadBox, SIGNAL(activated(int)),
|
||||
managerAccess->threadsWindow(), SIGNAL(threadSelected(int)));
|
||||
debugToolBar->addWidget(threadBox);
|
||||
|
||||
debugToolBar->addWidget(managerAccess->statusLabel());
|
||||
|
||||
QWidget *stretch = new QWidget;
|
||||
stretch->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum);
|
||||
debugToolBar->addWidget(stretch);
|
||||
|
||||
return debugToolBar;
|
||||
}
|
||||
|
||||
void DebugMode::focusCurrentEditor(IMode *mode)
|
||||
{
|
||||
if (mode != this)
|
||||
return;
|
||||
|
||||
EditorManager *editorManager = EditorManager::instance();
|
||||
|
||||
if (editorManager->currentEditor())
|
||||
editorManager->currentEditor()->widget()->setFocus();
|
||||
}
|
||||
|
||||
void DebugMode::writeSettings() const
|
||||
{
|
||||
QSettings *s = settings();
|
||||
QTC_ASSERT(m_manager, return);
|
||||
QTC_ASSERT(m_manager->mainWindow(), return);
|
||||
s->beginGroup(QLatin1String("DebugMode"));
|
||||
s->setValue(QLatin1String("State"), m_manager->mainWindow()->saveState());
|
||||
//s->setValue(QLatin1String("Locked"), m_toggleLockedAction->isChecked());
|
||||
s->endGroup();
|
||||
}
|
||||
|
||||
void DebugMode::readSettings()
|
||||
{
|
||||
QSettings *s = settings();
|
||||
s->beginGroup(QLatin1String("DebugMode"));
|
||||
m_manager->mainWindow()->restoreState(s->value(QLatin1String("State"), QByteArray()).toByteArray());
|
||||
//m_toggleLockedAction->setChecked(s->value(QLatin1String("Locked"), true).toBool());
|
||||
s->endGroup();
|
||||
}
|
||||
|
||||
QSettings *DebugMode::settings()
|
||||
{
|
||||
return PluginManager::instance()->getObject<ICore>()->settings();
|
||||
}
|
||||
@@ -1,84 +0,0 @@
|
||||
/***************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||
**
|
||||
**
|
||||
** Non-Open Source Usage
|
||||
**
|
||||
** Licensees may use this file in accordance with the Qt Beta Version
|
||||
** License Agreement, Agreement version 2.2 provided with the Software or,
|
||||
** alternatively, in accordance with the terms contained in a written
|
||||
** agreement between you and Nokia.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
**
|
||||
** Alternatively, this file may be used under the terms of the GNU General
|
||||
** Public License versions 2.0 or 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the packaging
|
||||
** of this file. Please review the following information to ensure GNU
|
||||
** General Public Licensing requirements will be met:
|
||||
**
|
||||
** http://www.fsf.org/licensing/licenses/info/GPLv2.html and
|
||||
** http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt GPL Exception
|
||||
** version 1.3, included in the file GPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef DEBUGGER_DEBUGMODE_H
|
||||
#define DEBUGGER_DEBUGMODE_H
|
||||
|
||||
#include <coreplugin/basemode.h>
|
||||
|
||||
#include <QtCore/QList>
|
||||
#include <QtCore/QPointer>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QAction;
|
||||
class QDockWidget;
|
||||
class QMainWindow;
|
||||
class QSettings;
|
||||
class QSplitter;
|
||||
class QToolBar;
|
||||
class QWidget;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace Debugger {
|
||||
namespace Internal {
|
||||
|
||||
class DebuggerManager;
|
||||
|
||||
class DebugMode : public Core::BaseMode
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
DebugMode(DebuggerManager *manager, QObject *parent = 0);
|
||||
~DebugMode();
|
||||
|
||||
// IMode
|
||||
void activated();
|
||||
void shutdown();
|
||||
static QSettings *settings();
|
||||
|
||||
private slots:
|
||||
void focusCurrentEditor(Core::IMode *mode);
|
||||
|
||||
private:
|
||||
QToolBar *createToolBar();
|
||||
void writeSettings() const;
|
||||
void readSettings();
|
||||
|
||||
QPointer<DebuggerManager> m_manager;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Debugger
|
||||
|
||||
#endif // DEBUGGER_DEBUGMODE_H
|
||||
Reference in New Issue
Block a user