@@ -104,11 +104,11 @@ QVariant DebugBreakpointsListModel::data(const QModelIndex& index, int role) con
104104
105105 switch (index.column ())
106106 {
107- // case DebugBreakpointsListModel::EnabledColumn:
108- // {
109- // QString text = item->enabled() ? "true " : "false ";
110- // return QVariant(text);
111- // }
107+ case DebugBreakpointsListModel::EnabledColumn:
108+ {
109+ QString text = item->enabled () ? " ☑ " : " ☐ " ;
110+ return QVariant (text);
111+ }
112112 case DebugBreakpointsListModel::LocationColumn:
113113 {
114114 QString text;
@@ -152,8 +152,8 @@ QVariant DebugBreakpointsListModel::headerData(int column, Qt::Orientation orien
152152
153153 switch (column)
154154 {
155- // case DebugBreakpointsListModel::EnabledColumn:
156- // return "Enabled";
155+ case DebugBreakpointsListModel::EnabledColumn:
156+ return " Enabled" ;
157157 case DebugBreakpointsListModel::LocationColumn:
158158 return " Location" ;
159159 case DebugBreakpointsListModel::AddressColumn:
@@ -197,7 +197,7 @@ void DebugBreakpointsItemDelegate::paint(
197197 auto data = idx.data (Qt::DisplayRole);
198198 switch (idx.column ())
199199 {
200- // case DebugBreakpointsListModel::EnabledColumn:
200+ case DebugBreakpointsListModel::EnabledColumn:
201201 case DebugBreakpointsListModel::LocationColumn:
202202 case DebugBreakpointsListModel::AddressColumn:
203203 {
@@ -291,6 +291,24 @@ DebugBreakpointsWidget::DebugBreakpointsWidget(ViewFrame* view, BinaryViewRef da
291291 m_actionHandler.bindAction (
292292 addBreakpointActionName, UIAction ([&]() { add (); }));
293293
294+ QString enableBreakpointActionName = QString::fromStdString (" Enable Breakpoint" );
295+ UIAction::registerAction (enableBreakpointActionName);
296+ m_menu->addAction (enableBreakpointActionName, " Options" , MENU_ORDER_NORMAL);
297+ m_actionHandler.bindAction (
298+ enableBreakpointActionName, UIAction ([&]() { enableSelected (); }, [&]() { return selectionNotEmpty (); }));
299+
300+ QString disableBreakpointActionName = QString::fromStdString (" Disable Breakpoint" );
301+ UIAction::registerAction (disableBreakpointActionName);
302+ m_menu->addAction (disableBreakpointActionName, " Options" , MENU_ORDER_NORMAL);
303+ m_actionHandler.bindAction (
304+ disableBreakpointActionName, UIAction ([&]() { disableSelected (); }, [&]() { return selectionNotEmpty (); }));
305+
306+ QString toggleBreakpointActionName = QString::fromStdString (" Toggle Breakpoint Enable/Disable" );
307+ UIAction::registerAction (toggleBreakpointActionName, QKeySequence (" Ctrl+Shift+B" ));
308+ m_menu->addAction (toggleBreakpointActionName, " Options" , MENU_ORDER_NORMAL);
309+ m_actionHandler.bindAction (
310+ toggleBreakpointActionName, UIAction ([&]() { toggleSelected (); }, [&]() { return selectionNotEmpty (); }));
311+
294312 connect (this , &QTableView::doubleClicked, this , &DebugBreakpointsWidget::onDoubleClicked);
295313
296314 updateContent ();
@@ -418,6 +436,42 @@ void DebugBreakpointsWidget::add()
418436}
419437
420438
439+ void DebugBreakpointsWidget::enableSelected ()
440+ {
441+ QModelIndexList sel = selectionModel ()->selectedRows ();
442+ for (const QModelIndex& index : sel)
443+ {
444+ BreakpointItem bp = m_model->getRow (index.row ());
445+ m_controller->EnableBreakpoint (bp.location ());
446+ }
447+ }
448+
449+
450+ void DebugBreakpointsWidget::disableSelected ()
451+ {
452+ QModelIndexList sel = selectionModel ()->selectedRows ();
453+ for (const QModelIndex& index : sel)
454+ {
455+ BreakpointItem bp = m_model->getRow (index.row ());
456+ m_controller->DisableBreakpoint (bp.location ());
457+ }
458+ }
459+
460+
461+ void DebugBreakpointsWidget::toggleSelected ()
462+ {
463+ QModelIndexList sel = selectionModel ()->selectedRows ();
464+ for (const QModelIndex& index : sel)
465+ {
466+ BreakpointItem bp = m_model->getRow (index.row ());
467+ if (bp.enabled ())
468+ m_controller->DisableBreakpoint (bp.location ());
469+ else
470+ m_controller->EnableBreakpoint (bp.location ());
471+ }
472+ }
473+
474+
421475void DebugBreakpointsWidget::remove ()
422476{
423477 QModelIndexList sel = selectionModel ()->selectedRows ();
0 commit comments