Commit 97ad34bc authored by Friedemann Kleint's avatar Friedemann Kleint
Browse files

Debugger: Set tooltips on Step into/Next.

Indicating they'll do Stop & Break at main().
Do not display for QML projects.

Change-Id: I10b6ee381f17dca89c7152e38514fb95776bc329
Reviewed-on: http://codereview.qt.nokia.com/1777

Reviewed-by: default avatarQt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: default avatarKai Koehne <kai.koehne@nokia.com>
Reviewed-by: default avatarChristiaan Janssen <christiaan.janssen@nokia.com>
parent 050af038
......@@ -2124,6 +2124,8 @@ void DebuggerPluginPrivate::updateState(DebuggerEngine *engine)
m_stepAction->setEnabled(stopped || state == DebuggerNotReady);
m_nextAction->setEnabled(stopped || state == DebuggerNotReady);
m_stepAction->setToolTip(QString());
m_nextAction->setToolTip(QString());
m_stepOutAction->setEnabled(stopped);
m_runToLineAction->setEnabled(stopped && (caps & RunToLineCapability));
......@@ -2152,14 +2154,31 @@ void DebuggerPluginPrivate::updateDebugActions()
{
ProjectExplorerPlugin *pe = ProjectExplorerPlugin::instance();
Project *project = pe->startupProject();
m_debugAction->setEnabled(pe->canRun(project, _(Constants::DEBUGMODE)));
m_debugAction->setToolTip(pe->cannotRunReason(project, _(Constants::DEBUGMODE)));
const bool canStepInto = pe->canRun(project, _(Constants::DEBUGMODE2));
const QString cannotStepIntoReason = pe->cannotRunReason(project, _(Constants::DEBUGMODE2));
m_stepAction->setEnabled(canStepInto);
m_nextAction->setEnabled(canStepInto);
m_stepAction->setToolTip(cannotStepIntoReason);
m_nextAction->setToolTip(cannotStepIntoReason);
const QString debugMode = _(Constants::DEBUGMODE);
const bool canRun = pe->canRun(project, debugMode);
m_debugAction->setEnabled(canRun);
m_debugAction->setToolTip(canRun ? QString() : pe->cannotRunReason(project, debugMode));
// Step into/next: Start and break at 'main' unless a debugger is running.
if (m_snapshotHandler->currentIndex() < 0) {
const QString debugMode2 = _(Constants::DEBUGMODE2);
const bool canRunAndBreakMain = pe->canRun(project, debugMode2);
m_stepAction->setEnabled(canRunAndBreakMain);
m_nextAction->setEnabled(canRunAndBreakMain);
QString toolTip;
if (canRunAndBreakMain) {
QTC_ASSERT(project, return ; );
toolTip = tr("Start '%1' and break at function 'main()'")
.arg(project->displayName());
} else {
// Do not display long tooltip saying 'debugMode2 is not supported
// for project' for projects to which 'break at main' is not applicable.
if (!canRun)
toolTip = pe->cannotRunReason(project, debugMode2);
}
m_stepAction->setToolTip(toolTip);
m_nextAction->setToolTip(toolTip);
}
}
void DebuggerPluginPrivate::onCoreAboutToOpen()
......@@ -2922,12 +2941,14 @@ void DebuggerPluginPrivate::extensionsInitialized()
Constants::NEXT, globalcontext);
cmd->setDefaultKeySequence(QKeySequence(Constants::NEXT_KEY));
cmd->setAttribute(Command::CA_Hide);
cmd->setAttribute(Command::CA_UpdateText);
debugMenu->addAction(cmd);
cmd = am->registerAction(m_stepAction,
Constants::STEP, globalcontext);
cmd->setDefaultKeySequence(QKeySequence(Constants::STEP_KEY));
cmd->setAttribute(Command::CA_Hide);
cmd->setAttribute(Command::CA_UpdateText);
debugMenu->addAction(cmd);
cmd = am->registerAction(m_stepOutAction,
......
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