diff --git a/src/blackgui/components/aircraftpartshistory.cpp b/src/blackgui/components/aircraftpartshistory.cpp index 82e44abd9..fe62f7eea 100644 --- a/src/blackgui/components/aircraftpartshistory.cpp +++ b/src/blackgui/components/aircraftpartshistory.cpp @@ -19,6 +19,7 @@ #include #include #include +#include using namespace BlackMisc; using namespace BlackMisc::Aviation; @@ -106,7 +107,8 @@ namespace BlackGui void CAircraftPartsHistory::updatePartsHistory() { if (!this->hasContexts()) { return; } - if (isBeingModified) { return; } + if (!this->isVisible()) { return; } + if (m_isBeingModified) { return; } const CCallsign cs(ui->le_Callsign->text().trimmed().toUpper()); if (cs.isEmpty()) { return; } const auto currentAircraftParts = sGui->getIContextNetwork()->getRemoteAircraftParts(cs, -1).frontOrDefault(); @@ -149,6 +151,9 @@ namespace BlackGui } } + uint hash = qHash(html); + if (hash == m_htmlHash) { return; } // avoid to always scroll to the end when there is no update + m_htmlHash = hash; this->m_text.setHtml(html); ui->te_Messages->setDocument(&this->m_text); @@ -162,14 +167,14 @@ namespace BlackGui void CAircraftPartsHistory::callsignEntered() { - isBeingModified = false; + m_isBeingModified = false; updatePartsHistory(); m_timerUpdateHistory.start(); } void CAircraftPartsHistory::callsignModified() { - isBeingModified = true; + m_isBeingModified = true; } void CAircraftPartsHistory::valuesChanged() diff --git a/src/blackgui/components/aircraftpartshistory.h b/src/blackgui/components/aircraftpartshistory.h index b4f491931..9c22eb131 100644 --- a/src/blackgui/components/aircraftpartshistory.h +++ b/src/blackgui/components/aircraftpartshistory.h @@ -42,7 +42,8 @@ namespace BlackGui QTimer m_timerCallsignUpdate { this }; QTimer m_timerUpdateHistory { this }; QTextDocument m_text { this }; - bool isBeingModified = false; + uint m_htmlHash = 0; + bool m_isBeingModified = false; //! Init void initGui();