| 536 | |
| 537 | |
| 538 | ThreadFramesWidget::ThreadFramesWidget(QWidget* parent, ViewFrame* frame, BinaryViewRef data) : |
| 539 | QTreeView(parent), m_view(frame) |
| 540 | { |
| 541 | m_debugger = DebuggerController::GetController(data); |
| 542 | if (!m_debugger) |
| 543 | return; |
| 544 | |
| 545 | setExpandsOnDoubleClick(false); |
| 546 | setSelectionBehavior(QAbstractItemView::SelectItems); |
| 547 | setHorizontalScrollMode(QAbstractItemView::ScrollPerPixel); |
| 548 | setVerticalScrollMode(QAbstractItemView::ScrollPerPixel); |
| 549 | header()->setSectionResizeMode(QHeaderView::ResizeToContents); |
| 550 | |
| 551 | m_model = new ThreadFrameModel(this, m_debugger); |
| 552 | setModel(m_model); |
| 553 | |
| 554 | m_delegate = new ThreadFramesItemDelegate(this, m_debugger); |
| 555 | setItemDelegate(m_delegate); |
| 556 | |
| 557 | // Set up colors |
| 558 | QPalette widgetPalette = this->palette(); |
| 559 | |
| 560 | m_actionHandler.setupActionHandler(this); |
| 561 | m_contextMenuManager = new ContextMenuManager(this); |
| 562 | m_menu = new Menu(); |
| 563 | |
| 564 | QString actionName = QString::fromStdString("Suspend Thread"); |
| 565 | UIAction::registerAction(actionName); |
| 566 | m_menu->addAction(actionName, "Options", MENU_ORDER_FIRST); |
| 567 | m_actionHandler.bindAction( |
| 568 | actionName, UIAction([=]() { suspendThread(); }, [=]() { return canSuspendOrResume(); })); |
| 569 | |
| 570 | actionName = QString::fromStdString("Resume Thread"); |
| 571 | UIAction::registerAction(actionName); |
| 572 | m_menu->addAction(actionName, "Options", MENU_ORDER_FIRST); |
| 573 | m_actionHandler.bindAction(actionName, UIAction([=]() { resumeThread(); }, [=]() { return canSuspendOrResume(); })); |
| 574 | |
| 575 | actionName = QString::fromStdString("Make It Solo Thread"); |
| 576 | UIAction::registerAction(actionName); |
| 577 | m_menu->addAction(actionName, "Options", MENU_ORDER_FIRST); |
| 578 | m_actionHandler.bindAction( |
| 579 | actionName, UIAction([=]() { makeItSoloThread(); }, [=]() { return canSuspendOrResume(); })); |
| 580 | |
| 581 | m_menu->addAction("Copy", "Options", MENU_ORDER_NORMAL); |
| 582 | m_actionHandler.bindAction("Copy", UIAction([&]() { copy(); }, [&]() { return selectionNotEmpty(); })); |
| 583 | m_actionHandler.setActionDisplayName("Copy", [&]() { |
| 584 | QModelIndexList sel = selectionModel()->selectedIndexes(); |
| 585 | if (sel.empty()) |
| 586 | return "Copy"; |
| 587 | |
| 588 | switch (sel[0].column()) |
| 589 | { |
| 590 | case ThreadFrameModel::StateColumn: |
| 591 | return "Copy State"; |
| 592 | case ThreadFrameModel::ThreadColumn: |
| 593 | return "Copy Thread"; |
| 594 | case ThreadFrameModel::FrameIndexColumn: |
| 595 | return "Copy Frame Index"; |
nothing calls this directly
no test coverage detected