Qt: simplify log logic. We can in fact only flush once.

Also invert a negation
This commit is contained in:
Megamouse 2022-08-26 02:16:42 +02:00
commit e49679484a

View file

@ -688,19 +688,18 @@ void log_frame::UpdateUI()
is_first_rep = false; is_first_rep = false;
if (m_log_counter > 1) // Add counter suffix if needed. Try not to hold too much data at a time so the frame content will be updated frequently.
if (m_log_counter > 1 || m_log_text.size() > 0x1000)
{ {
// Add counter suffix if needed
flush(); flush();
} }
if (m_log_text.size() > 0x1000) if (m_log_text.isEmpty())
{ {
// Try not to hold too much data at a time so the frame content will be updated frequently m_old_log_level = packet->sev;
flush(); m_log_text += font_start_tag(m_color[static_cast<int>(m_old_log_level)]);
} }
else
if (!m_log_text.isEmpty())
{ {
if (packet->sev != m_old_log_level) if (packet->sev != m_old_log_level)
{ {
@ -713,11 +712,6 @@ void log_frame::UpdateUI()
m_log_text += QStringLiteral("<br/>"); m_log_text += QStringLiteral("<br/>");
} }
} }
else
{
m_old_log_level = packet->sev;
m_log_text += font_start_tag(m_color[static_cast<int>(m_old_log_level)]);
}
switch (packet->sev) switch (packet->sev)
{ {