Changeset View
Changeset View
Standalone View
Standalone View
src/backtracewidget.cpp
Show First 20 Lines • Show All 136 Lines • ▼ Show 20 Line(s) | 123 | { | |||
---|---|---|---|---|---|
137 | ui.m_extraDetailsLabel->setVisible(false); | 137 | ui.m_extraDetailsLabel->setVisible(false); | ||
138 | ui.m_extraDetailsLabel->clear(); | 138 | ui.m_extraDetailsLabel->clear(); | ||
139 | 139 | | |||
140 | ui.m_installDebugButton->setVisible(false); | 140 | ui.m_installDebugButton->setVisible(false); | ||
141 | ui.m_reloadBacktraceButton->setEnabled(false); | 141 | ui.m_reloadBacktraceButton->setEnabled(false); | ||
142 | 142 | | |||
143 | ui.m_copyButton->setEnabled(false); | 143 | ui.m_copyButton->setEnabled(false); | ||
144 | ui.m_saveButton->setEnabled(false); | 144 | ui.m_saveButton->setEnabled(false); | ||
145 | | ||||
146 | adjustWindowSize(); | ||||
147 | } | ||||
148 | | ||||
149 | void BacktraceWidget::adjustWindowSize() | ||||
150 | { | ||||
151 | // We substantially change label content in-place so the window might need | ||||
152 | // resizing to fit everything again. This should get called whenever label | ||||
153 | // content is changed. | ||||
154 | // We'll only increase our size but never shrink it. Shrinking would almost | ||||
155 | // always screw with user expectation (e.g. button position or manually | ||||
156 | // resized window). | ||||
157 | // https://bugs.kde.org/show_bug.cgi?id=406748 | ||||
158 | // https://bugs.kde.org/show_bug.cgi?id=337319 | ||||
159 | const auto hint = window()->sizeHint(); | ||||
160 | const auto size = window()->size(); | ||||
161 | if (hint.width() > size.width() || hint.height() > size.height()) { | ||||
162 | window()->adjustSize(); | ||||
163 | } | ||||
145 | } | 164 | } | ||
146 | 165 | | |||
147 | //Force backtrace generation | 166 | //Force backtrace generation | ||
148 | void BacktraceWidget::regenerateBacktrace() | 167 | void BacktraceWidget::regenerateBacktrace() | ||
149 | { | 168 | { | ||
150 | setAsLoading(); | 169 | setAsLoading(); | ||
151 | 170 | | |||
152 | if (!DrKonqi::debuggerManager()->debuggerIsRunning()) { | 171 | if (!DrKonqi::debuggerManager()->debuggerIsRunning()) { | ||
Show All 34 Lines | 199 | { | |||
187 | ui.m_statusWidget->setIdle(i18nc("@info:status", "The crash information could not be fetched.")); | 206 | ui.m_statusWidget->setIdle(i18nc("@info:status", "The crash information could not be fetched.")); | ||
188 | ui.m_extraDetailsLabel->setVisible(true); | 207 | ui.m_extraDetailsLabel->setVisible(true); | ||
189 | ui.m_extraDetailsLabel->setText(xi18nc("@info/rich", "Another debugging process is attached to " | 208 | ui.m_extraDetailsLabel->setText(xi18nc("@info/rich", "Another debugging process is attached to " | ||
190 | "the crashed application. Therefore, the DrKonqi debugger cannot " | 209 | "the crashed application. Therefore, the DrKonqi debugger cannot " | ||
191 | "fetch the backtrace. Please close the other debugger and " | 210 | "fetch the backtrace. Please close the other debugger and " | ||
192 | "click <interface>Reload</interface>.")); | 211 | "click <interface>Reload</interface>.")); | ||
193 | ui.m_installDebugButton->setVisible(false); | 212 | ui.m_installDebugButton->setVisible(false); | ||
194 | ui.m_reloadBacktraceButton->setEnabled(true); | 213 | ui.m_reloadBacktraceButton->setEnabled(true); | ||
214 | | ||||
215 | adjustWindowSize(); | ||||
195 | } | 216 | } | ||
196 | 217 | | |||
197 | void BacktraceWidget::loadData() | 218 | void BacktraceWidget::loadData() | ||
198 | { | 219 | { | ||
199 | //Load the backtrace data from the generator | 220 | //Load the backtrace data from the generator | ||
200 | m_backtraceRatingWidget->setState(m_btGenerator->state()); | 221 | m_backtraceRatingWidget->setState(m_btGenerator->state()); | ||
201 | 222 | | |||
202 | if (m_btGenerator->state() == BacktraceGenerator::Loaded) { | 223 | if (m_btGenerator->state() == BacktraceGenerator::Loaded) { | ||
▲ Show 20 Lines • Show All 103 Lines • ▼ Show 20 Line(s) | 316 | } else if (m_btGenerator->state() == BacktraceGenerator::FailedToStart) { | |||
306 | ui.m_extraDetailsLabel->setText(xi18nc("@info/rich", "<strong>You need to first install the debugger " | 327 | ui.m_extraDetailsLabel->setText(xi18nc("@info/rich", "<strong>You need to first install the debugger " | ||
307 | "application (%1) then click the <interface>Reload" | 328 | "application (%1) then click the <interface>Reload" | ||
308 | "</interface> button.</strong>", | 329 | "</interface> button.</strong>", | ||
309 | m_btGenerator->debugger().name())); | 330 | m_btGenerator->debugger().name())); | ||
310 | } | 331 | } | ||
311 | 332 | | |||
312 | ui.m_reloadBacktraceButton->setEnabled(true); | 333 | ui.m_reloadBacktraceButton->setEnabled(true); | ||
313 | 334 | | |||
314 | // We substantially change label content, the window might need resizing to | 335 | adjustWindowSize(); | ||
315 | // fit it all. | | |||
316 | // https://bugs.kde.org/show_bug.cgi?id=337319 | | |||
317 | window()->adjustSize(); | | |||
318 | 336 | | |||
319 | emit stateChanged(); | 337 | emit stateChanged(); | ||
320 | } | 338 | } | ||
321 | 339 | | |||
322 | void BacktraceWidget::backtraceNewLine(const QString & line) | 340 | void BacktraceWidget::backtraceNewLine(const QString & line) | ||
323 | { | 341 | { | ||
324 | //While loading the backtrace (unparsed) a new line was sent from the debugger, append it | 342 | //While loading the backtrace (unparsed) a new line was sent from the debugger, append it | ||
325 | ui.m_backtraceEdit->append(line.trimmed()); | 343 | ui.m_backtraceEdit->append(line.trimmed()); | ||
▲ Show 20 Lines • Show All 86 Lines • Show Last 20 Lines |