| 39 | /***************************************************************************/ |
| 40 | |
| 41 | GDBOutputWidget::GDBOutputWidget(CppDebuggerPlugin* plugin, QWidget *parent) : |
| 42 | QWidget(parent), |
| 43 | m_userGDBCmdEditor(nullptr), |
| 44 | m_Interrupt(nullptr), |
| 45 | m_gdbView(nullptr), |
| 46 | m_showInternalCommands(false), |
| 47 | m_maxLines(5000) |
| 48 | { |
| 49 | setWindowIcon(QIcon::fromTheme(QStringLiteral("dialog-scripts"), windowIcon())); |
| 50 | setWindowTitle(i18nc("@title:window", "GDB Output")); |
| 51 | setWhatsThis(i18nc("@info:whatsthis", "<b>GDB output</b><p>" |
| 52 | "Shows all GDB commands being executed. " |
| 53 | "You can also issue any other GDB command while debugging.</p>")); |
| 54 | |
| 55 | m_gdbView = new QPlainTextEdit(this); |
| 56 | m_gdbView->setFont(QFontDatabase::systemFont(QFontDatabase::FixedFont)); |
| 57 | m_gdbView->setReadOnly(true); |
| 58 | |
| 59 | m_gdbView->setContextMenuPolicy(Qt::CustomContextMenu); |
| 60 | connect(m_gdbView, &QWidget::customContextMenuRequested, this, &GDBOutputWidget::gdbViewContextMenuRequested); |
| 61 | |
| 62 | m_userGDBCmdEditor = new KHistoryComboBox (this); |
| 63 | |
| 64 | auto* label = new QLabel(i18nc("@label:listbox", "&GDB command:"), this); |
| 65 | label->setBuddy(m_userGDBCmdEditor); |
| 66 | |
| 67 | m_Interrupt = new QToolButton( this ); |
| 68 | m_Interrupt->setIcon ( QIcon::fromTheme( QStringLiteral("media-playback-pause") ) ); |
| 69 | m_Interrupt->setToolTip(i18nc("@info:tooltip", "Pause execution of the app to enter GDB commands")); |
| 70 | |
| 71 | auto *topLayout = new QVBoxLayout(this); |
| 72 | topLayout->addWidget(m_gdbView); |
| 73 | topLayout->setStretchFactor(m_gdbView, 1); |
| 74 | topLayout->setContentsMargins(0, 0, 0, 0); |
| 75 | |
| 76 | QBoxLayout *userGDBCmdEntry = new QHBoxLayout(); |
| 77 | userGDBCmdEntry->addWidget(label); |
| 78 | userGDBCmdEntry->addWidget(m_userGDBCmdEditor); |
| 79 | userGDBCmdEntry->setStretchFactor(m_userGDBCmdEditor, 1); |
| 80 | userGDBCmdEntry->addWidget(m_Interrupt); |
| 81 | topLayout->addLayout(userGDBCmdEntry); |
| 82 | |
| 83 | setLayout(topLayout); |
| 84 | |
| 85 | connect(m_userGDBCmdEditor, QOverload<const QString&>::of(&KHistoryComboBox::returnPressed), |
| 86 | this, &GDBOutputWidget::slotGDBCmd); |
| 87 | connect(m_Interrupt, &QToolButton::clicked, this, &GDBOutputWidget::breakInto); |
| 88 | |
| 89 | m_updateTimer.setSingleShot(true); |
| 90 | m_updateTimer.setInterval(100); |
| 91 | connect(&m_updateTimer, &QTimer::timeout, |
| 92 | this, &GDBOutputWidget::flushPending); |
| 93 | |
| 94 | connect(KDevelop::ICore::self()->debugController(), &KDevelop::IDebugController::currentSessionChanged, |
| 95 | this, &GDBOutputWidget::currentSessionChanged); |
| 96 | |
| 97 | if (plugin) { |
| 98 | connect(plugin, &CppDebuggerPlugin::raiseDebuggerConsoleViews, this, [plugin, this] { |
nothing calls this directly
no test coverage detected