| 227 | |
| 228 | |
| 229 | DebugBreakpointsWidget::DebugBreakpointsWidget(ViewFrame* view, BinaryViewRef data, Menu* menu): |
| 230 | QTableView(view), m_view(view) |
| 231 | { |
| 232 | m_controller = DebuggerController::GetController(data); |
| 233 | if (!m_controller) |
| 234 | return; |
| 235 | |
| 236 | m_model = new DebugBreakpointsListModel(this, view); |
| 237 | setModel(m_model); |
| 238 | setSelectionBehavior(QAbstractItemView::SelectItems); |
| 239 | setSelectionMode(QAbstractItemView::ExtendedSelection); |
| 240 | |
| 241 | m_delegate = new DebugBreakpointsItemDelegate(this); |
| 242 | setItemDelegate(m_delegate); |
| 243 | |
| 244 | setSelectionBehavior(QAbstractItemView::SelectRows); |
| 245 | setSelectionMode(QAbstractItemView::ExtendedSelection); |
| 246 | |
| 247 | verticalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents); |
| 248 | verticalHeader()->setVisible(false); |
| 249 | |
| 250 | setHorizontalScrollMode(QAbstractItemView::ScrollPerPixel); |
| 251 | setVerticalScrollMode(QAbstractItemView::ScrollPerPixel); |
| 252 | |
| 253 | resizeColumnsToContents(); |
| 254 | resizeRowsToContents(); |
| 255 | horizontalHeader()->setSectionResizeMode(0, QHeaderView::Stretch); |
| 256 | |
| 257 | m_actionHandler.setupActionHandler(this); |
| 258 | m_contextMenuManager = new ContextMenuManager(this); |
| 259 | m_menu = menu; |
| 260 | if (m_menu == nullptr) |
| 261 | m_menu = new Menu(); |
| 262 | |
| 263 | QString removeBreakpointActionName = QString::fromStdString("Remove Breakpoint"); |
| 264 | UIAction::registerAction(removeBreakpointActionName, QKeySequence::Delete); |
| 265 | m_menu->addAction(removeBreakpointActionName, "Options", MENU_ORDER_NORMAL); |
| 266 | m_actionHandler.bindAction( |
| 267 | removeBreakpointActionName, UIAction([&]() { remove(); }, [&]() { return selectionNotEmpty(); })); |
| 268 | |
| 269 | QString jumpToBreakpointActionName = QString::fromStdString("Jump To Breakpoint"); |
| 270 | UIAction::registerAction(jumpToBreakpointActionName); |
| 271 | m_menu->addAction(jumpToBreakpointActionName, "Options", MENU_ORDER_NORMAL); |
| 272 | m_actionHandler.bindAction( |
| 273 | jumpToBreakpointActionName, UIAction([&]() { jump(); }, [&]() { return selectionNotEmpty(); })); |
| 274 | |
| 275 | QString addBreakpointActionName = QString::fromStdString("Add Breakpoint..."); |
| 276 | UIAction::registerAction(addBreakpointActionName); |
| 277 | m_menu->addAction(addBreakpointActionName, "Options", MENU_ORDER_NORMAL); |
| 278 | m_actionHandler.bindAction( |
| 279 | addBreakpointActionName, UIAction([&]() { add(); })); |
| 280 | |
| 281 | connect(this, &QTableView::doubleClicked, this, &DebugBreakpointsWidget::onDoubleClicked); |
| 282 | |
| 283 | updateContent(); |
| 284 | } |
| 285 | |
| 286 |
nothing calls this directly
no outgoing calls
no test coverage detected