[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [kdevelop] kdevplatform/shell: Create action to jump to the current execution line in debug mode.
From: Amish Naidu <null () kde ! org>
Date: 2018-09-15 10:01:05
Message-ID: E1g17Nx-0008SF-4h () code ! kde ! org
[Download RAW message or body]
Git commit 59d823957de8f685d4cf94919bca2738328aa197 by Amish Naidu.
Committed on 15/09/2018 at 10:00.
Pushed by anaidu into branch 'master'.
Create action to jump to the current execution line in debug mode.
Summary:
Added new action called "Show Current Line" that will jump to the
execution position of the debugging program. This allows setting a
shortcut to it, while the previous workaround of clicking on the active
frame in the frame stack didn't.
FEATURE: 361411
Reviewers: #kdevelop, brauch
Reviewed By: #kdevelop, brauch
Subscribers: kossebau, brauch, kdevelop-devel
Tags: #kdevelop
Differential Revision: https://phabricator.kde.org/D14618
M +19 -0 kdevplatform/shell/debugcontroller.cpp
M +5 -3 kdevplatform/shell/debugcontroller.h
M +10 -6 kdevplatform/shell/debugger/kdevdebuggershellui.rc
https://commits.kde.org/kdevelop/59d823957de8f685d4cf94919bca2738328aa197
diff --git a/kdevplatform/shell/debugcontroller.cpp \
b/kdevplatform/shell/debugcontroller.cpp index dd2549cb07..2bac8d531a 100644
--- a/kdevplatform/shell/debugcontroller.cpp
+++ b/kdevplatform/shell/debugcontroller.cpp
@@ -273,6 +273,12 @@ void DebugController::setupActions()
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::toggleBreakpoint()
}
}
+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/debugcontroller.h \
b/kdevplatform/shell/debugcontroller.h index cc87363800..6834086546 100644
--- a/kdevplatform/shell/debugcontroller.h
+++ b/kdevplatform/shell/debugcontroller.h
@@ -78,11 +78,12 @@ private Q_SLOTS:
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 @@ private:
QAction* m_stepOverInstruction = nullptr;
QAction* m_stepOut = nullptr;
QAction* m_toggleBreakpoint = nullptr;
+ QAction* m_showCurrentLine = nullptr;
QPointer<IDebugSession> m_currentSession;
BreakpointModel *m_breakpointModel;
- VariableCollection *m_variableCollection;
-
+ VariableCollection *m_variableCollection;
+
bool m_uiInitialized = false;
};
diff --git a/kdevplatform/shell/debugger/kdevdebuggershellui.rc \
b/kdevplatform/shell/debugger/kdevdebuggershellui.rc index 669c3a4eb5..b82f24634c \
100644
--- a/kdevplatform/shell/debugger/kdevdebuggershellui.rc
+++ b/kdevplatform/shell/debugger/kdevdebuggershellui.rc
@@ -1,11 +1,11 @@
<!DOCTYPE gui SYSTEM "kpartgui.dtd">
-<gui name="kdevdebuggershellui" version="8" translationDomain="kdevplatform">
+<gui name="kdevdebuggershellui" version="9" translationDomain="kdevplatform">
<MenuBar>
<Menu name="run">
<Separator group="debug"/>
<Action name="debug_continue" group="debug"/>
<Action name="debug_pause" group="debug"/>
-
+
<Separator group="debug"/>
<Action name="debug_stepover" group="debug"/>
<Action name="debug_stepoverinst" group="debug"/>
@@ -13,14 +13,14 @@
<Action name="debug_stepintoinst" group="debug"/>
<Action name="debug_stepout" group="debug"/>
<Action name="debug_runtocursor" group="debug"/>
-
+
<Separator group="debug"/>
<Action name="debug_jumptocursor" group="debug"/>
<Action name="debug_toggle_breakpoint" group="debug"/>
-
+ <Action name="debug_showcurrentline" group="debug"/>
</Menu>
</MenuBar>
-
+
<ToolBar name="debugToolBar">
<text>Debugger Toolbar</text>
<Action name="debug_continue"/>
@@ -29,7 +29,7 @@
<Action name="debug_stepout"/>
<WeakSeparator/>
</ToolBar>
-
+
<State name="ended">
<enable>
<Action name="debug_continue"/>
@@ -43,6 +43,7 @@
<Action name="debug_stepintoinst"/>
<Action name="debug_stepout"/>
<Action name="debug_jumptocursor"/>
+ <Action name="debug_showcurrentline"/>
</disable>
</State>
<State name="paused">
@@ -55,6 +56,7 @@
<Action name="debug_stepintoinst"/>
<Action name="debug_stepout"/>
<Action name="debug_jumptocursor"/>
+ <Action name="debug_showcurrentline"/>
</enable>
</State>
<State name="active">
@@ -70,6 +72,7 @@
<Action name="debug_stepintoinst"/>
<Action name="debug_stepout"/>
<Action name="debug_jumptocursor"/>
+ <Action name="debug_showcurrentline"/>
</disable>
</State>
<State name="stopped">
@@ -85,6 +88,7 @@
<Action name="debug_stepintoinst"/>
<Action name="debug_stepout"/>
<Action name="debug_jumptocursor"/>
+ <Action name="debug_showcurrentline"/>
</disable>
</State>
</gui>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic