mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-07 19:35:32 +08:00
Unified "simplification" to ASCII only for text messages
Based on the codepage discussion of text messages * in text message value object still store the unicode string * the text is only "cleaned" up and Qt "simplified" (do not confuse with conversion to ASCII) * only place where we simplify to ASCII only is ** in VATLIB ** or the utility
This commit is contained in:
committed by
Mat Sutcliffe
parent
1e35519a0d
commit
cb084427ec
@@ -27,14 +27,17 @@ namespace BlackMisc
|
||||
namespace Network
|
||||
{
|
||||
CTextMessage::CTextMessage(const QString &message, const CFrequency &frequency, const CCallsign &senderCallsign)
|
||||
: m_message(message.trimmed().simplified()), m_senderCallsign(senderCallsign), m_frequency(frequency)
|
||||
: m_senderCallsign(senderCallsign), m_frequency(frequency)
|
||||
{
|
||||
this->setMessage(message); // single place to modify message
|
||||
m_frequency.switchUnit(PhysicalQuantities::CFrequencyUnit::MHz());
|
||||
}
|
||||
|
||||
CTextMessage::CTextMessage(const QString &message, const CCallsign &senderCallsign, const CCallsign &recipientCallsign)
|
||||
: m_message(message.trimmed().simplified()), m_senderCallsign(senderCallsign), m_recipientCallsign(recipientCallsign), m_frequency(0, nullptr)
|
||||
{}
|
||||
: m_senderCallsign(senderCallsign), m_recipientCallsign(recipientCallsign), m_frequency(0, nullptr)
|
||||
{
|
||||
this->setMessage(message); // single place to modify message
|
||||
}
|
||||
|
||||
QString CTextMessage::convertToQString(bool i18n) const
|
||||
{
|
||||
@@ -115,9 +118,15 @@ namespace BlackMisc
|
||||
return CComSystem::isValidCivilAviationFrequency(m_frequency);
|
||||
}
|
||||
|
||||
QString CTextMessage::getAsciiOnlyMessage() const
|
||||
{
|
||||
if (m_message.isEmpty()) { return {}; }
|
||||
return asciiOnlyString(simplifyAccents(m_message));
|
||||
}
|
||||
|
||||
void CTextMessage::setMessage(const QString &message)
|
||||
{
|
||||
m_message = asciiOnlyString(simplifyAccents(message.simplified().trimmed()));
|
||||
m_message = message.simplified().trimmed();
|
||||
}
|
||||
|
||||
bool CTextMessage::isRadioMessage() const
|
||||
|
||||
@@ -85,6 +85,9 @@ namespace BlackMisc
|
||||
//! Get message
|
||||
const QString &getMessage() const { return m_message; }
|
||||
|
||||
//! Get ASCII only message
|
||||
QString getAsciiOnlyMessage() const;
|
||||
|
||||
//! Empty message
|
||||
bool isEmpty() const { return m_message.isEmpty(); }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user