mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-30 11:55:35 +08:00
Ref T190, improved display of text messages
* tooltip * using QStringBuilder
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
|
||||
#include <Qt>
|
||||
#include <QtGlobal>
|
||||
#include <QStringBuilder>
|
||||
|
||||
using namespace BlackMisc::Aviation;
|
||||
using namespace BlackMisc::PhysicalQuantities;
|
||||
@@ -37,17 +38,13 @@ namespace BlackMisc
|
||||
|
||||
QString CTextMessage::convertToQString(bool i18n) const
|
||||
{
|
||||
QString s(m_message);
|
||||
if (this->isPrivateMessage())
|
||||
{
|
||||
s.append(" ").append(m_senderCallsign.toQString(i18n));
|
||||
s.append(" ").append(m_recipientCallsign.toQString(i18n));
|
||||
return m_message %
|
||||
QStringLiteral(" ") % m_senderCallsign.toQString(i18n) %
|
||||
QStringLiteral(" ") % m_recipientCallsign.toQString(i18n);
|
||||
}
|
||||
else
|
||||
{
|
||||
s.append(" ").append(m_frequency.toQString(i18n));
|
||||
}
|
||||
return s;
|
||||
return m_message % QStringLiteral(" ") % m_frequency.toQString(i18n);
|
||||
}
|
||||
|
||||
bool CTextMessage::isPrivateMessage() const
|
||||
@@ -171,6 +168,11 @@ namespace BlackMisc
|
||||
return { this, CStatusMessage::SeverityInfo, m };
|
||||
}
|
||||
|
||||
QString CTextMessage::asHtmlSummary(const QString &separator) const
|
||||
{
|
||||
return this->asString(true, true, separator);
|
||||
}
|
||||
|
||||
void CTextMessage::toggleSenderRecipient()
|
||||
{
|
||||
qSwap(m_senderCallsign, m_recipientCallsign);
|
||||
|
||||
@@ -119,6 +119,9 @@ namespace BlackMisc
|
||||
//! \param separator values separated by given value
|
||||
CStatusMessage asStatusMessage(bool withSender, bool withRecipient, const QString &separator = ", ") const;
|
||||
|
||||
//! Summary HTML code
|
||||
QString asHtmlSummary(const QString &separator = "<br>") const;
|
||||
|
||||
//! Toggle sender receiver, can be used to ping my own message
|
||||
void toggleSenderRecipient();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user