From 7cec8601f191a68745e8b58256328e0a59655420 Mon Sep 17 00:00:00 2001 From: Silent Date: Sat, 31 Aug 2019 00:05:01 +0200 Subject: [PATCH] LogWidget: Remove scrollbar tampering code (doesn't seem to do anything), clear text queue on clearing log --- Source/Core/DolphinQt/Config/LogWidget.cpp | 30 ++++------------------ 1 file changed, 5 insertions(+), 25 deletions(-) diff --git a/Source/Core/DolphinQt/Config/LogWidget.cpp b/Source/Core/DolphinQt/Config/LogWidget.cpp index e3567353b0..e274183606 100644 --- a/Source/Core/DolphinQt/Config/LogWidget.cpp +++ b/Source/Core/DolphinQt/Config/LogWidget.cpp @@ -11,7 +11,6 @@ #include #include #include -#include #include #include "Core/ConfigManager.h" @@ -68,32 +67,11 @@ void LogWidget::UpdateLog() if (m_log_queue.empty()) return; - auto* vscroll = m_log_text->verticalScrollBar(); - auto* hscroll = m_log_text->horizontalScrollBar(); - - // If the vertical scrollbar is within 50 units of the maximum value, count it as being at the - // bottom - bool vscroll_bottom = vscroll->maximum() - vscroll->value() < 50; - - int old_horizontal = hscroll->value(); - int old_vertical = vscroll->value(); - for (size_t i = 0; !m_log_queue.empty() && i < MAX_LOG_LINES_TO_UPDATE; i++) { m_log_text->appendHtml(m_log_queue.front()); m_log_queue.pop(); } - - if (hscroll->value() != old_horizontal) - hscroll->setValue(old_horizontal); - - if (vscroll->value() != old_vertical) - { - if (vscroll_bottom) - vscroll->setValue(vscroll->maximum()); - else - vscroll->setValue(old_vertical); - } } void LogWidget::UpdateFont() @@ -148,13 +126,15 @@ void LogWidget::CreateWidgets() void LogWidget::ConnectWidgets() { - connect(m_log_clear, &QPushButton::clicked, m_log_text, &QPlainTextEdit::clear); + connect(m_log_clear, &QPushButton::clicked, [this] { + m_log_text->clear(); + m_log_queue = {}; + }); connect(m_log_wrap, &QCheckBox::toggled, this, &LogWidget::SaveSettings); connect(m_log_font, static_cast(&QComboBox::currentIndexChanged), this, &LogWidget::SaveSettings); connect(this, &QDockWidget::topLevelChanged, this, &LogWidget::SaveSettings); - connect(&Settings::Instance(), &Settings::LogVisibilityChanged, this, - [this](bool visible) { setHidden(!visible); }); + connect(&Settings::Instance(), &Settings::LogVisibilityChanged, this, &LogWidget::setVisible); } void LogWidget::LoadSettings()