mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-01 05:26:45 +08:00
style and consistency:
* rename CStatusMessages to CStatusMessageList * rename NetworkVatlib to CNetworkVatlib * replace all occurrences of Realname with RealName (correct camel case) * CSequence method corresponding to CList::append is push_back * don't compile the qdbuscpp2xml metadata plugin by default * CAircraftIcao string members always trimmed and capitalized * added CComSystem::roundTo25KHz * using epsilon comparison in a couple of places refs #81
This commit is contained in:
committed by
Mathew Sutcliffe
parent
b5c3a5543f
commit
bb61654a29
@@ -54,41 +54,6 @@ namespace BlackMisc
|
||||
return !((*this) == other);
|
||||
}
|
||||
|
||||
/*
|
||||
* Set / append ATIS message
|
||||
*/
|
||||
void CInformationMessage::addMessage(const QString &message)
|
||||
{
|
||||
const QString np = message.trimmed();
|
||||
if (np.isEmpty()) return;
|
||||
|
||||
// detect the stupid z1, z2, z3 placeholders
|
||||
// TODO: Anything better as this stupid code here?
|
||||
const QString test = np.toLower().remove(QRegExp("[\\n\\t\\r]"));
|
||||
if (test == "z") return;
|
||||
if (test.startsWith("z") && test.length() == 2) return;
|
||||
if (test.length() == 1) return;
|
||||
|
||||
// set message
|
||||
bool outdated = this->isOutdated();
|
||||
if (outdated) this->m_message.clear();
|
||||
if (!this->m_message.isEmpty()) this->m_message.append("\n");
|
||||
this->m_message.append(np);
|
||||
this->m_receivedTimestamp = QDateTime::currentDateTimeUtc();
|
||||
}
|
||||
|
||||
/*
|
||||
* Outdated? New ATIS, or just a part
|
||||
*/
|
||||
bool CInformationMessage::isOutdated() const
|
||||
{
|
||||
// everything received within this timespan is considered to be the
|
||||
// same ATIS values
|
||||
// FSD sends messages as parts
|
||||
qint64 diff = this->m_receivedTimestamp.msecsTo(QDateTime::currentDateTimeUtc());
|
||||
return (diff > 1000 * 10); // n seconds
|
||||
}
|
||||
|
||||
/*
|
||||
* Register metadata
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user