| 56 | } |
| 57 | |
| 58 | FramestackWidget::FramestackWidget(IDebugController* controller, QWidget* parent) |
| 59 | : AutoOrientedSplitter(Qt::Horizontal, parent), m_session(nullptr) |
| 60 | { |
| 61 | connect(controller, |
| 62 | &IDebugController::currentSessionChanged, |
| 63 | this, &FramestackWidget::currentSessionChanged); |
| 64 | connect(controller, &IDebugController::raiseFramestackViews, this, [this] { |
| 65 | ICore::self()->uiController()->raiseToolView(this); |
| 66 | }); |
| 67 | |
| 68 | setWhatsThis(i18n("<b>Frame stack</b>" |
| 69 | "Often referred to as the \"call stack\", " |
| 70 | "this is a list showing which function is " |
| 71 | "currently active, and what called each " |
| 72 | "function to get to this point in your " |
| 73 | "program. By clicking on an item you " |
| 74 | "can see the values in any of the " |
| 75 | "previous calling functions.")); |
| 76 | setWindowIcon(QIcon::fromTheme(QStringLiteral("view-list-text"), windowIcon())); |
| 77 | m_threadsWidget = new QWidget(this); |
| 78 | m_threadsListView = new QListView(m_threadsWidget); |
| 79 | m_framesTreeView = new QTreeView(this); |
| 80 | m_framesTreeView->setRootIsDecorated(false); |
| 81 | m_framesTreeView->setItemDelegate(new FrameStackItemDelegate(this)); |
| 82 | m_framesTreeView->setSelectionMode(QAbstractItemView::ContiguousSelection); |
| 83 | m_framesTreeView->setSelectionBehavior(QAbstractItemView::SelectRows); |
| 84 | m_framesTreeView->setAllColumnsShowFocus(true); |
| 85 | m_framesTreeView->setContextMenuPolicy(Qt::CustomContextMenu); |
| 86 | |
| 87 | m_framesContextMenu = new QMenu(m_framesTreeView); |
| 88 | |
| 89 | QAction* selectAllAction = KStandardAction::selectAll(m_framesTreeView); |
| 90 | selectAllAction->setShortcut(QKeySequence()); //FIXME: why does CTRL-A conflict with Katepart (while CTRL-Cbelow doesn't) ? |
| 91 | selectAllAction->setShortcutContext(Qt::WidgetWithChildrenShortcut); |
| 92 | connect(selectAllAction, &QAction::triggered, this, &FramestackWidget::selectAll); |
| 93 | m_framesContextMenu->addAction(selectAllAction); |
| 94 | |
| 95 | QAction* copyAction = KStandardAction::copy(m_framesTreeView); |
| 96 | copyAction->setShortcutContext(Qt::WidgetWithChildrenShortcut); |
| 97 | connect(copyAction, &QAction::triggered, this, &FramestackWidget::copySelection); |
| 98 | m_framesContextMenu->addAction(copyAction); |
| 99 | addAction(copyAction); |
| 100 | |
| 101 | connect(m_framesTreeView, &QTreeView::customContextMenuRequested, this, &FramestackWidget::frameContextMenuRequested); |
| 102 | |
| 103 | m_threadsWidget->setLayout(new QVBoxLayout()); |
| 104 | m_threadsWidget->layout()->addWidget(new QLabel(i18n("Threads:"))); |
| 105 | m_threadsWidget->layout()->addWidget(m_threadsListView); |
| 106 | addWidget(m_threadsWidget); |
| 107 | addWidget(m_framesTreeView); |
| 108 | |
| 109 | setStretchFactor(1, 3); |
| 110 | connect(m_framesTreeView->verticalScrollBar(), &QScrollBar::valueChanged, this, &FramestackWidget::checkFetchMoreFrames); |
| 111 | |
| 112 | // Show the selected frame when clicked, even if it has previously been selected |
| 113 | connect(m_framesTreeView, &QTreeView::clicked, this, &FramestackWidget::frameSelectionChanged); |
| 114 | |
| 115 | currentSessionChanged(controller->currentSession(), nullptr); |
nothing calls this directly
no test coverage detected