| 315 | } |
| 316 | |
| 317 | void SupportDialog::refreshLog() |
| 318 | { |
| 319 | auto& mgr = LogManager::instance(); |
| 320 | m_sizeLabel->setText(formatFileSize(mgr.logFileSize())); |
| 321 | |
| 322 | QFile f(mgr.logFilePath()); |
| 323 | if (!f.open(QIODevice::ReadOnly | QIODevice::Text)) { |
| 324 | m_logViewer->setPlainText("(unable to open log file)"); |
| 325 | return; |
| 326 | } |
| 327 | |
| 328 | // Read last 200KB max to keep UI responsive |
| 329 | constexpr qint64 MAX_READ = 200 * 1024; |
| 330 | if (f.size() > MAX_READ) |
| 331 | f.seek(f.size() - MAX_READ); |
| 332 | |
| 333 | m_logViewer->setPlainText(QString::fromUtf8(f.readAll())); |
| 334 | f.close(); |
| 335 | |
| 336 | // Scroll to bottom |
| 337 | auto* sb = m_logViewer->verticalScrollBar(); |
| 338 | sb->setValue(sb->maximum()); |
| 339 | } |
| 340 | |
| 341 | void SupportDialog::clearLog() |
| 342 | { |
nothing calls this directly
no test coverage detected