mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-31 04:25:35 +08:00
No updates when UI component is invisible or unchanged HTML code
This commit is contained in:
committed by
Mathew Sutcliffe
parent
4a0ddfb5d1
commit
6a63bcf666
@@ -19,6 +19,7 @@
|
||||
#include <QCompleter>
|
||||
#include <QStringBuilder>
|
||||
#include <QStringListModel>
|
||||
#include <QHash>
|
||||
|
||||
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()
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user