| 80 | } // unnamed namespace |
| 81 | |
| 82 | VariableWidget::VariableWidget(IDebugController* controller, QWidget *parent) |
| 83 | : QWidget(parent), m_variablesRoot(controller->variableCollection()->root()) |
| 84 | { |
| 85 | //setWindowIcon(QIcon::fromTheme("math_brace")); |
| 86 | setWindowIcon(QIcon::fromTheme(QStringLiteral("debugger"), windowIcon())); |
| 87 | setWindowTitle(i18n("Debugger Variables")); |
| 88 | |
| 89 | m_varTree = new VariableTree(controller, this, new VariableSortProxyModel(this)); |
| 90 | setFocusProxy(m_varTree); |
| 91 | |
| 92 | m_watchVarEditor = new KHistoryComboBox( this ); |
| 93 | |
| 94 | auto *topLayout = new QVBoxLayout(this); |
| 95 | topLayout->addWidget(m_varTree, 10); |
| 96 | topLayout->addWidget(m_watchVarEditor); |
| 97 | topLayout->setContentsMargins(0, 0, 0, 0); |
| 98 | |
| 99 | connect(m_watchVarEditor, QOverload<const QString&>::of(&KHistoryComboBox::returnPressed), |
| 100 | this, &VariableWidget::slotAddWatch); |
| 101 | |
| 102 | const bool autoResizeColumns = variablesViewConfigGroup().readEntry(autoResizeColumnsKey, true); |
| 103 | m_varTree->setAutoResizeColumns(autoResizeColumns); |
| 104 | |
| 105 | auto* const autoResizeColumnsAction = new QAction(i18nc("@option:check", "Auto-resize columns on click"), this); |
| 106 | autoResizeColumnsAction->setIcon(QIcon::fromTheme(QStringLiteral("resizecol"))); |
| 107 | autoResizeColumnsAction->setCheckable(true); |
| 108 | autoResizeColumnsAction->setChecked(autoResizeColumns); |
| 109 | connect(autoResizeColumnsAction, &QAction::triggered, this, [this](bool on) { |
| 110 | m_varTree->setAutoResizeColumns(on); |
| 111 | variablesViewConfigGroup().writeEntry(autoResizeColumnsKey, on); |
| 112 | }); |
| 113 | addAction(autoResizeColumnsAction); |
| 114 | |
| 115 | //TODO |
| 116 | //connect(plugin, SIGNAL(raiseVariableViews()), this, SIGNAL(requestRaise())); |
| 117 | |
| 118 | // Setup help items. |
| 119 | |
| 120 | setWhatsThis( i18n( |
| 121 | "<b>Variable tree</b>" |
| 122 | "The variable tree allows you to see the values of local " |
| 123 | "variables and arbitrary expressions.<br />" |
| 124 | "Local variables are displayed automatically and are updated " |
| 125 | "as you step through your program. " |
| 126 | "For each expression you enter, you can either evaluate it once, " |
| 127 | "or \"watch\" it (make it auto-updated). Expressions that are not " |
| 128 | "auto-updated can be updated manually from the context menu. " |
| 129 | "Expressions can be renamed to more descriptive names by clicking " |
| 130 | "on the name column.<br />" |
| 131 | "To change the value of a variable or an expression, " |
| 132 | "click on the value.<br />")); |
| 133 | |
| 134 | m_watchVarEditor->setWhatsThis( |
| 135 | i18n("<b>Expression entry</b>" |
| 136 | "Type in expression to watch.")); |
| 137 | |
| 138 | } |
| 139 |
nothing calls this directly
no test coverage detected