diff --git a/kdevplatform/shell/debugcontroller.h b/kdevplatform/shell/debugcontroller.h --- a/kdevplatform/shell/debugcontroller.h +++ b/kdevplatform/shell/debugcontroller.h @@ -78,11 +78,12 @@ void stepOverInstruction(); void stepOut(); void toggleBreakpoint(); + void showCurrentLine(); void debuggerStateChanged(KDevelop::IDebugSession::DebuggerState state); void showStepInSource(const QUrl &file, int line); void clearExecutionPoint(); - + void partAdded(KParts::Part* part); void areaChanged(Sublime::Area* newArea); @@ -108,11 +109,12 @@ QAction* m_stepOverInstruction = nullptr; QAction* m_stepOut = nullptr; QAction* m_toggleBreakpoint = nullptr; + QAction* m_showCurrentLine = nullptr; QPointer m_currentSession; BreakpointModel *m_breakpointModel; - VariableCollection *m_variableCollection; - + VariableCollection *m_variableCollection; + bool m_uiInitialized = false; }; diff --git a/kdevplatform/shell/debugcontroller.cpp b/kdevplatform/shell/debugcontroller.cpp --- a/kdevplatform/shell/debugcontroller.cpp +++ b/kdevplatform/shell/debugcontroller.cpp @@ -273,6 +273,12 @@ action->setWhatsThis(i18n("Toggles the breakpoint at the current line in editor.")); connect(action, &QAction::triggered, this, &DebugController::toggleBreakpoint); ac->addAction(QStringLiteral("debug_toggle_breakpoint"), action); + + m_showCurrentLine = action = new QAction(QIcon::fromTheme(QStringLiteral("go-jump")), i18n("Show Current Line"), this); + action->setToolTip(i18n("Show the current execution position")); + action->setWhatsThis(i18n("Jumps to the execution line in the editor.")); + connect(action, &QAction::triggered, this, &DebugController::showCurrentLine); + ac->addAction(QStringLiteral("debug_showcurrentline"), action); } void DebugController::addSession(IDebugSession* session) @@ -546,6 +552,19 @@ } } +void DebugController::showCurrentLine() +{ + const auto location = qMakePair(m_currentSession->currentUrl(), m_currentSession->currentLine()); + + if (location.second != -1) { + const auto localLocation = m_currentSession->convertToLocalUrl(location); + ICore::self()->documentController()->openDocument(localLocation.first, + KTextEditor::Cursor(localLocation.second, 0), + IDocumentController::DefaultMode); + } + +} + const QPixmap* DebugController::executionPointPixmap() { static QPixmap pixmap=QIcon::fromTheme(QStringLiteral("go-next")).pixmap(QSize(22,22), QIcon::Normal, QIcon::Off); diff --git a/kdevplatform/shell/debugger/kdevdebuggershellui.rc b/kdevplatform/shell/debugger/kdevdebuggershellui.rc --- a/kdevplatform/shell/debugger/kdevdebuggershellui.rc +++ b/kdevplatform/shell/debugger/kdevdebuggershellui.rc @@ -1,35 +1,35 @@ - + - + - + - + - + Debugger Toolbar - + @@ -43,6 +43,7 @@ + @@ -55,6 +56,7 @@ + @@ -70,6 +72,7 @@ + @@ -85,6 +88,7 @@ +