Commit 58f987cd authored by Kai Koehne's avatar Kai Koehne

Debugger: Always show "Start Debugging" methods

Don't rely on the 'current' project settings for actions like
Attach to QML port. Also, group the actions in a General,
Cpp and QML part, and add separators in between.

Change-Id: I3103a6fc777180a69eee128d39d19de17f312ff3
Reviewed-on: http://codereview.qt-project.org/6323
Sanity-Review: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: default avatarhjk <qthjk@ovi.com>
parent 0b4484c5
......@@ -46,6 +46,10 @@ const char C_DEBUGMODE[] = "Debugger.DebugMode";
const char C_CPPDEBUGGER[] = "Gdb Debugger";
const char C_QMLDEBUGGER[] = "Qml/JavaScript Debugger";
// Menu Groups
const char G_START_CPP[] = "Debugger.Group.Start.Cpp";
const char G_START_QML[] = "Debugger.Group.Start.Cpp";
// Project Explorer run mode (RUN/DEBUG)
const char DEBUGMODE[] = "Debugger.DebugMode";
const char DEBUGMODE2[] = "Debugger.DebugMode2"; // Breaks on main.
......
......@@ -1400,16 +1400,6 @@ void DebuggerPluginPrivate::onCurrentProjectChanged(Project *project)
void DebuggerPluginPrivate::languagesChanged()
{
const bool debuggerIsCPP =
m_mainWindow->activeDebugLanguages() & CppLanguage;
//qDebug() << "DEBUGGER IS CPP: " << debuggerIsCPP;
m_startExternalAction->setVisible(debuggerIsCPP);
m_attachExternalAction->setVisible(debuggerIsCPP);
m_attachCoreAction->setVisible(debuggerIsCPP);
m_startRemoteAction->setVisible(debuggerIsCPP);
m_attachRemoteAction->setVisible(debuggerIsCPP);
m_detachAction->setVisible(debuggerIsCPP);
m_attachToQmlPortAction->setVisible(m_mainWindow->activeDebugLanguages() & QmlLanguage);
}
void DebuggerPluginPrivate::debugProject()
......@@ -2962,6 +2952,12 @@ void DebuggerPluginPrivate::extensionsInitialized()
act->setText(tr("Detach Debugger"));
connect(act, SIGNAL(triggered()), SLOT(handleExecDetach()));
// "Start Debugging" sub-menu
// groups:
// G_DEFAULT_ONE
// G_START_CPP
// G_START_QML
Command *cmd = 0;
ActionContainer *mstart = am->actionContainer(PE::M_DEBUG_STARTDEBUGGING);
......@@ -2969,7 +2965,7 @@ void DebuggerPluginPrivate::extensionsInitialized()
cmd->setDefaultText(tr("Start Debugging"));
cmd->setDefaultKeySequence(QKeySequence(Constants::DEBUG_KEY));
cmd->setAttribute(Command::CA_UpdateText);
mstart->addAction(cmd, Core::Constants::G_DEFAULT_ONE);
mstart->addAction(cmd, CC::G_DEFAULT_ONE);
m_visibleStartAction = new Utils::ProxyAction(this);
m_visibleStartAction->initialize(m_startAction);
......@@ -2983,52 +2979,54 @@ void DebuggerPluginPrivate::extensionsInitialized()
cmd = am->registerAction(m_startExternalAction,
"Debugger.StartExternal", globalcontext);
cmd->setAttribute(Command::CA_Hide);
mstart->addAction(cmd, CC::G_DEFAULT_ONE);
mstart->addAction(cmd, Constants::G_START_CPP);
cmd = am->registerAction(m_attachExternalAction,
"Debugger.AttachExternal", globalcontext);
cmd->setAttribute(Command::CA_Hide);
mstart->addAction(cmd, CC::G_DEFAULT_ONE);
mstart->addAction(cmd, Constants::G_START_CPP);
cmd = am->registerAction(m_attachCoreAction,
"Debugger.AttachCore", globalcontext);
cmd->setAttribute(Command::CA_Hide);
mstart->addAction(cmd, CC::G_DEFAULT_ONE);
mstart->addAction(cmd, Constants::G_START_CPP);
cmd = am->registerAction(m_startRemoteAction,
"Debugger.StartRemote", globalcontext);
cmd->setAttribute(Command::CA_Hide);
mstart->addAction(cmd, CC::G_DEFAULT_ONE);
mstart->addAction(cmd, Constants::G_START_CPP);
cmd = am->registerAction(m_attachRemoteAction,
"Debugger.AttachRemote", globalcontext);
cmd->setAttribute(Command::CA_Hide);
mstart->addAction(cmd, CC::G_DEFAULT_ONE);
mstart->addAction(cmd, Constants::G_START_CPP);
cmd = am->registerAction(m_attachToQmlPortAction,
"Debugger.AttachToQmlPort", globalcontext);
cmd->setAttribute(Command::CA_Hide);
mstart->addAction(cmd, CC::G_DEFAULT_ONE);
#ifdef WITH_LLDB
cmd = am->registerAction(m_startRemoteLldbAction,
"Debugger.RemoteLldb", globalcontext);
cmd->setAttribute(Command::CA_Hide);
mstart->addAction(cmd, CC::G_DEFAULT_ONE);
mstart->addAction(cmd, Constants::G_START_CPP);
#endif
if (m_startRemoteCdbAction) {
cmd = am->registerAction(m_startRemoteCdbAction,
"Debugger.AttachRemoteCdb", globalcontext);
cmd->setAttribute(Command::CA_Hide);
mstart->addAction(cmd, CC::G_DEFAULT_ONE);
mstart->addAction(cmd, Constants::G_START_CPP);
}
QAction *sep = new QAction(this);
QAction *sep = new QAction(mstart);
sep->setSeparator(true);
cmd = am->registerAction(sep, "Debugger.Sep.Start", globalcontext);
mstart->addAction(cmd);
cmd = am->registerAction(sep,
"Debugger.Start.Qml", globalcontext);
mstart->addAction(cmd, Constants::G_START_QML);
cmd = am->registerAction(m_attachToQmlPortAction,
"Debugger.AttachToQmlPort", globalcontext);
cmd->setAttribute(Command::CA_Hide);
mstart->addAction(cmd, Constants::G_START_QML);
cmd = am->registerAction(m_detachAction,
"Debugger.Detach", globalcontext);
......@@ -3378,6 +3376,25 @@ DebuggerPlugin::~DebuggerPlugin()
bool DebuggerPlugin::initialize(const QStringList &arguments, QString *errorMessage)
{
ICore *core = ICore::instance();
QTC_ASSERT(core, return true);
// Menu groups
const Context globalcontext(CC::C_GLOBAL);
Core::ActionManager *am = core->actionManager();
ActionContainer *mstart = am->actionContainer(PE::M_DEBUG_STARTDEBUGGING);
mstart->appendGroup(Constants::G_START_CPP);
mstart->appendGroup(Constants::G_START_QML);
// add cpp separator
QAction *sep = new QAction(mstart);
sep->setSeparator(true);
Command *cmd = am->registerAction(sep,
"Debugger.Start.Cpp", globalcontext);
mstart->addAction(cmd, Constants::G_START_CPP);
return theDebuggerCore->initialize(arguments, errorMessage);
}
......
......@@ -48,6 +48,8 @@
#include <coreplugin/actionmanager/actionmanager.h>
#include <coreplugin/actionmanager/actioncontainer.h>
#include <debugger/debuggerconstants.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <QtCore/QtPlugin>
......@@ -92,7 +94,7 @@ void RemoteLinuxPlugin::extensionsInitialized()
QAction *startGdbServerAction = new QAction(tr("Start Remote Debug Server"), 0);
Command *cmd = am->registerAction(startGdbServerAction, "StartGdbServer", globalcontext);
cmd->setDefaultText(tr("Start Gdbserver"));
mstart->addAction(cmd, Constants::G_DEFAULT_TWO);
mstart->addAction(cmd, Debugger::Constants::G_START_CPP);
connect(startGdbServerAction, SIGNAL(triggered()), SLOT(startGdbServer()));
}
......
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