Commit 2c46a935 authored by hjk's avatar hjk
Browse files

debugger: make more bits private

parent fde3ced4
......@@ -116,6 +116,9 @@ public:
bool isQmlActive() const;
void setSimpleDockWidgetArrangement();
void updateUi();
// Debuggable languages are registered with this function.
void addLanguage(const DebuggerLanguage &language, const Core::Context &context);
public slots:
void resetDebuggerLayout();
......@@ -237,9 +240,8 @@ DebuggerMainWindow::DebuggerMainWindow()
{
d = new DebuggerMainWindowPrivate(this);
d->createViewsMenuItems();
addLanguage(CppLanguage, Context(C_CPPDEBUGGER));
addLanguage(QmlLanguage, Context(C_QMLDEBUGGER));
d->addLanguage(CppLanguage, Context(C_CPPDEBUGGER));
d->addLanguage(QmlLanguage, Context(C_QMLDEBUGGER));
}
DebuggerMainWindow::~DebuggerMainWindow()
......@@ -329,14 +331,14 @@ void DebuggerMainWindowPrivate::createViewsMenuItems()
m_viewsMenu->addAction(cmd);
}
void DebuggerMainWindow::addLanguage(const DebuggerLanguage &languageId,
void DebuggerMainWindowPrivate::addLanguage(const DebuggerLanguage &languageId,
const Context &context)
{
d->m_supportedLanguages = d->m_supportedLanguages | languageId;
d->m_languageCount++;
m_supportedLanguages = m_supportedLanguages | languageId;
m_languageCount++;
d->m_toolBars.insert(languageId, 0);
d->m_contextsForLanguage.insert(languageId, context);
m_toolBars.insert(languageId, 0);
m_contextsForLanguage.insert(languageId, context);
}
void DebuggerMainWindowPrivate::updateUi()
......
......@@ -61,9 +61,6 @@ public:
DebuggerMainWindow();
~DebuggerMainWindow();
// Debuggable languages are registered with this function.
void addLanguage(const DebuggerLanguage &language, const Core::Context &context);
// Debugger toolbars are registered with this function.
void setToolbar(const DebuggerLanguage &language, QWidget *widget);
......@@ -73,7 +70,6 @@ public:
// Called when all dependent plugins have loaded.
void initialize();
void onModeChanged(Core::IMode *mode);
QDockWidget *dockWidget(const QString &objectName) const;
bool isDockVisible(const QString &objectName) const;
......
......@@ -422,31 +422,6 @@ AbstractGdbAdapter *DebuggerRunControlPrivate::gdbAdapter() const
//
////////////////////////////////////////////////////////////////////////
DebuggerRunControl::DebuggerRunControl(RunConfiguration *runConfiguration,
unsigned enabledEngines, const DebuggerStartParameters &sp)
: RunControl(runConfiguration, Constants::DEBUGMODE),
d(new DebuggerRunControlPrivate(this, runConfiguration, enabledEngines))
{
connect(this, SIGNAL(finished()), SLOT(handleFinished()));
createEngine(sp);
}
DebuggerRunControl::~DebuggerRunControl()
{
disconnect();
if (DebuggerEngine *engine = d->m_engine) {
d->m_engine = 0;
engine->disconnect();
delete engine;
}
}
const DebuggerStartParameters &DebuggerRunControl::startParameters() const
{
QTC_ASSERT(d->m_engine, return *(new DebuggerStartParameters()));
return d->m_engine->startParameters();
}
static DebuggerEngineType engineForToolChain(int toolChainType)
{
switch (toolChainType) {
......@@ -481,13 +456,17 @@ static DebuggerEngineType engineForToolChain(int toolChainType)
return NoEngineType;
}
void DebuggerRunControl::createEngine(const DebuggerStartParameters &startParams)
DebuggerRunControl::DebuggerRunControl(RunConfiguration *runConfiguration,
unsigned enabledEngines, const DebuggerStartParameters &startParams)
: RunControl(runConfiguration, Constants::DEBUGMODE),
d(new DebuggerRunControlPrivate(this, runConfiguration, enabledEngines))
{
DebuggerStartParameters sp = startParams;
connect(this, SIGNAL(finished()), SLOT(handleFinished()));
// Figure out engine according to toolchain, executable, attach or default.
DebuggerEngineType engineType = NoEngineType;
DebuggerLanguages activeLangs = debuggerCore()->activeLanguages();
DebuggerStartParameters sp = startParams;
const unsigned enabledEngineTypes = d->enabledEngines();
if (sp.executable.endsWith(_(".js")))
engineType = ScriptEngineType;
......@@ -581,6 +560,22 @@ void DebuggerRunControl::createEngine(const DebuggerStartParameters &startParams
}
}
DebuggerRunControl::~DebuggerRunControl()
{
disconnect();
if (DebuggerEngine *engine = d->m_engine) {
d->m_engine = 0;
engine->disconnect();
delete engine;
}
}
const DebuggerStartParameters &DebuggerRunControl::startParameters() const
{
QTC_ASSERT(d->m_engine, return *(new DebuggerStartParameters()));
return d->m_engine->startParameters();
}
QString DebuggerRunControl::displayName() const
{
QTC_ASSERT(d->m_engine, return QString());
......@@ -808,16 +803,6 @@ void DebuggerRunControl::handleRemoteSetupFailed(const QString &message)
QTC_ASSERT(false, /**/);
}
void DebuggerRunControl::emitAddToOutputWindow(const QString &line, bool onStdErr)
{
emit addToOutputWindow(this, line, onStdErr);
}
void DebuggerRunControl::emitAppendMessage(const QString &m, bool isError)
{
emit appendMessage(this, m, isError);
}
RunConfiguration *DebuggerRunControl::runConfiguration() const
{
return d->m_myRunConfiguration.data();
......
......@@ -83,18 +83,17 @@ class DEBUGGER_EXPORT DebuggerRunControl
public:
typedef ProjectExplorer::RunConfiguration RunConfiguration;
explicit DebuggerRunControl(RunConfiguration *runConfiguration,
DebuggerRunControl(RunConfiguration *runConfiguration,
unsigned enabledEngines, const DebuggerStartParameters &sp);
~DebuggerRunControl();
// ProjectExplorer::RunControl
virtual void start();
virtual bool aboutToStop() const;
virtual StopResult stop();
virtual bool isRunning() const;
void start();
bool aboutToStop() const;
StopResult stop(); // Called from SnapshotWindow.
bool isRunning() const;
QString displayName() const;
void createEngine(const DebuggerStartParameters &startParameters);
void setCustomEnvironment(Utils::Environment env);
void startFailed();
void debuggingFinished();
......@@ -117,10 +116,6 @@ public:
signals:
void engineRequestSetup();
public slots:
void emitAddToOutputWindow(const QString &line, bool onStdErr);
void emitAppendMessage(const QString &, bool isError);
private slots:
void handleFinished();
......
......@@ -203,11 +203,11 @@ void QmlEngine::setupInferior()
emit remoteStartupRequested();
} else {
connect(&d->m_applicationLauncher, SIGNAL(processExited(int)),
this, SLOT(disconnected()));
SLOT(disconnected()));
connect(&d->m_applicationLauncher, SIGNAL(appendMessage(QString,bool)),
runControl(), SLOT(emitAppendMessage(QString,bool)));
connect(&d->m_applicationLauncher, SIGNAL(appendOutput(QString, bool)),
runControl(), SLOT(emitAddToOutputWindow(QString, bool)));
SLOT(appendMessage(QString,bool)));
connect(&d->m_applicationLauncher, SIGNAL(appendOutput(QString,bool)),
SLOT(appendOutput(QString,bool)));
connect(&d->m_applicationLauncher, SIGNAL(bringToForegroundRequested(qint64)),
runControl(), SLOT(bringApplicationToForeground(qint64)));
......@@ -218,6 +218,16 @@ void QmlEngine::setupInferior()
}
}
void QmlEngine::appendMessage(const QString &msg, bool)
{
showMessage(msg, AppStuff);
}
void QmlEngine::appendOutput(const QString &msg, bool)
{
showMessage(msg, AppOutput);
}
void QmlEngine::connectionEstablished()
{
attemptBreakpointSynchronization();
......
......@@ -121,6 +121,8 @@ private slots:
void connectionStartupFailed();
void connectionError(QAbstractSocket::SocketError error);
void serviceConnectionError(const QString &service);
void appendMessage(const QString &msg, bool);
void appendOutput(const QString &msg, bool);
private:
void expandObject(const QByteArray &iname, quint64 objectId);
......
......@@ -554,7 +554,7 @@ void InspectorUi::setupDockWidgets()
QWidget *observerWidget = new QWidget;
observerWidget->setWindowTitle(tr("QML Observer"));
observerWidget->setObjectName(QLatin1String("QMLObserver"));
observerWidget->setObjectName(Debugger::Constants::DOCKWIDGET_QML_INSPECTOR);
QVBoxLayout *wlay = new QVBoxLayout(observerWidget);
wlay->setMargin(0);
......@@ -565,9 +565,7 @@ void InspectorUi::setupDockWidgets()
wlay->addWidget(m_crumblePath);
Debugger::DebuggerMainWindow *mw = Debugger::DebuggerPlugin::mainWindow();
QDockWidget *dock = mw->createDockWidget(Debugger::QmlLanguage,
observerWidget, Debugger::Constants::DOCKWIDGET_QML_INSPECTOR,
Qt::BottomDockWidgetArea);
QDockWidget *dock = mw->createDockWidget(Debugger::QmlLanguage, observerWidget);
dock->setAllowedAreas(Qt::TopDockWidgetArea | Qt::BottomDockWidgetArea);
dock->setTitleBarWidget(new QWidget(dock));
}
......
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