forked from qt-creator/qt-creator
Debugger: Add context menu entries to enable/disable all breakpoints
Fixes: QTCREATORBUG-30564 Change-Id: I8b0458eed859c23f1ef9d40c0ad7cbe6b61ecf90 Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
This commit is contained in:
@@ -1637,6 +1637,8 @@ bool BreakHandler::contextMenuEvent(const ItemViewEvent &ev)
|
|||||||
// bp.setThreadSpec(threadId);
|
// bp.setThreadSpec(threadId);
|
||||||
// });
|
// });
|
||||||
|
|
||||||
|
menu->addSeparator();
|
||||||
|
|
||||||
addAction(this, menu,
|
addAction(this, menu,
|
||||||
selectedBreakpoints.size() > 1
|
selectedBreakpoints.size() > 1
|
||||||
? breakpointsEnabled ? Tr::tr("Disable Selected Breakpoints") : Tr::tr("Enable Selected Breakpoints")
|
? breakpointsEnabled ? Tr::tr("Disable Selected Breakpoints") : Tr::tr("Enable Selected Breakpoints")
|
||||||
@@ -1651,6 +1653,37 @@ bool BreakHandler::contextMenuEvent(const ItemViewEvent &ev)
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
QList<Breakpoint> enabledBreakpoints;
|
||||||
|
QList<Breakpoint> disabledBreakpoints;
|
||||||
|
forItemsAtLevel<1>([&enabledBreakpoints, &disabledBreakpoints](Breakpoint bp) {
|
||||||
|
if (bp) {
|
||||||
|
if (bp->isEnabled())
|
||||||
|
enabledBreakpoints.append(bp);
|
||||||
|
else
|
||||||
|
disabledBreakpoints.append(bp);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
addAction(this, menu, Tr::tr("Disable All Breakpoints"),
|
||||||
|
!enabledBreakpoints.isEmpty(),
|
||||||
|
[this, enabledBreakpoints] {
|
||||||
|
for (Breakpoint bp : enabledBreakpoints) {
|
||||||
|
if (GlobalBreakpoint gbp = bp->globalBreakpoint())
|
||||||
|
gbp->setEnabled(false, false);
|
||||||
|
requestBreakpointEnabling(bp, false);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
addAction(this, menu, Tr::tr("Enable All Breakpoints"),
|
||||||
|
!disabledBreakpoints.isEmpty(),
|
||||||
|
[this, disabledBreakpoints] {
|
||||||
|
for (Breakpoint bp : disabledBreakpoints) {
|
||||||
|
if (GlobalBreakpoint gbp = bp->globalBreakpoint())
|
||||||
|
gbp->setEnabled(true, false);
|
||||||
|
requestBreakpointEnabling(bp, true);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
addAction(this, menu,
|
addAction(this, menu,
|
||||||
selectedLocations.size() > 1
|
selectedLocations.size() > 1
|
||||||
? locationsEnabled ? Tr::tr("Disable Selected Locations") : Tr::tr("Enable Selected Locations")
|
? locationsEnabled ? Tr::tr("Disable Selected Locations") : Tr::tr("Enable Selected Locations")
|
||||||
@@ -2661,6 +2694,31 @@ bool BreakpointManager::contextMenuEvent(const ItemViewEvent &ev)
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
QList<GlobalBreakpoint> enabledBreakpoints;
|
||||||
|
QList<GlobalBreakpoint> disabledBreakpoints;
|
||||||
|
forItemsAtLevel<1>([&enabledBreakpoints, &disabledBreakpoints](GlobalBreakpoint gbp) {
|
||||||
|
if (gbp) {
|
||||||
|
if (gbp->isEnabled())
|
||||||
|
enabledBreakpoints.append(gbp);
|
||||||
|
else
|
||||||
|
disabledBreakpoints.append(gbp);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
addAction(this, menu, Tr::tr("Disable All Breakpoints"),
|
||||||
|
!enabledBreakpoints.isEmpty(),
|
||||||
|
[enabledBreakpoints] {
|
||||||
|
for (GlobalBreakpoint gbp : enabledBreakpoints)
|
||||||
|
gbp->setEnabled(false);
|
||||||
|
});
|
||||||
|
|
||||||
|
addAction(this, menu, Tr::tr("Enable All Breakpoints"),
|
||||||
|
!disabledBreakpoints.isEmpty(),
|
||||||
|
[disabledBreakpoints] {
|
||||||
|
for (GlobalBreakpoint gbp : disabledBreakpoints)
|
||||||
|
gbp->setEnabled(true);
|
||||||
|
});
|
||||||
|
|
||||||
menu->addSeparator();
|
menu->addSeparator();
|
||||||
|
|
||||||
addAction(this, menu, Tr::tr("Delete All Breakpoints"),
|
addAction(this, menu, Tr::tr("Delete All Breakpoints"),
|
||||||
|
Reference in New Issue
Block a user