| 266 | |
| 267 | |
| 268 | DebugModulesWidget::DebugModulesWidget(ViewFrame* view, BinaryViewRef data) : QTableView(view), m_view(view) |
| 269 | { |
| 270 | m_controller = DebuggerController::GetController(data); |
| 271 | if (!m_controller) |
| 272 | return; |
| 273 | |
| 274 | m_model = new DebugModulesListModel(this, view); |
| 275 | m_filter = new DebugModulesFilterProxyModel(this); |
| 276 | m_filter->setSourceModel(m_model); |
| 277 | setModel(m_filter); |
| 278 | setShowGrid(false); |
| 279 | |
| 280 | m_delegate = new DebugModulesItemDelegate(this); |
| 281 | setItemDelegate(m_delegate); |
| 282 | |
| 283 | setSelectionBehavior(QAbstractItemView::SelectItems); |
| 284 | |
| 285 | verticalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents); |
| 286 | verticalHeader()->setVisible(false); |
| 287 | |
| 288 | horizontalHeader()->setStretchLastSection(true); |
| 289 | horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents); |
| 290 | |
| 291 | setHorizontalScrollMode(QAbstractItemView::ScrollPerPixel); |
| 292 | setVerticalScrollMode(QAbstractItemView::ScrollPerPixel); |
| 293 | |
| 294 | resizeColumnsToContents(); |
| 295 | resizeRowsToContents(); |
| 296 | |
| 297 | m_actionHandler.setupActionHandler(this); |
| 298 | m_contextMenuManager = new ContextMenuManager(this); |
| 299 | m_menu = new Menu(); |
| 300 | |
| 301 | QString actionName = QString::fromStdString("Jump To Start"); |
| 302 | UIAction::registerAction(actionName); |
| 303 | m_menu->addAction(actionName, "Options", MENU_ORDER_FIRST); |
| 304 | m_actionHandler.bindAction(actionName, UIAction([=]() { jumpToStart(); })); |
| 305 | |
| 306 | actionName = QString::fromStdString("Jump To End"); |
| 307 | UIAction::registerAction(actionName); |
| 308 | m_menu->addAction(actionName, "Options", MENU_ORDER_FIRST); |
| 309 | m_actionHandler.bindAction(actionName, UIAction([=]() { jumpToEnd(); })); |
| 310 | |
| 311 | m_menu->addAction("Copy", "Options", MENU_ORDER_NORMAL); |
| 312 | m_actionHandler.bindAction("Copy", UIAction([&]() { copy(); }, [&]() { return canCopy(); })); |
| 313 | m_actionHandler.setActionDisplayName("Copy", [&]() { |
| 314 | QModelIndexList sel = selectionModel()->selectedIndexes(); |
| 315 | if (sel.empty()) |
| 316 | return "Copy"; |
| 317 | |
| 318 | switch (sel[0].column()) |
| 319 | { |
| 320 | case DebugModulesListModel::AddressColumn: |
| 321 | return "Copy Start"; |
| 322 | case DebugModulesListModel::EndAddressColumn: |
| 323 | return "Copy End"; |
| 324 | case DebugModulesListModel::SizeColumn: |
| 325 | return "Copy Size"; |
nothing calls this directly
no test coverage detected