mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-05-02 23:27:09 +08:00
Add feedback when .wallop message is sent
This does the following: - Opens a message-tab called "SUP" when a .wallop message is sent. - Throws a validation error if another message is directly send into this "SUP" channel as another .wallop should be used.
This commit is contained in:
@@ -546,6 +546,14 @@ namespace BlackCore
|
|||||||
else { return; }
|
else { return; }
|
||||||
const TextMessage textMessage(getOwnCallsignAsString(), receiver, message);
|
const TextMessage textMessage(getOwnCallsignAsString(), receiver, message);
|
||||||
sendQueudedMessage(textMessage);
|
sendQueudedMessage(textMessage);
|
||||||
|
if(receiver == QStringLiteral("*S"))
|
||||||
|
{
|
||||||
|
const CCallsign sender(getOwnCallsignAsString());
|
||||||
|
const CCallsign recipient(receiver);
|
||||||
|
CTextMessage t(message, sender, recipient);
|
||||||
|
t.markAsSent();
|
||||||
|
emit textMessageSent(t);
|
||||||
|
}
|
||||||
increaseStatisticsValue(QStringLiteral("sendTextMessages"));
|
increaseStatisticsValue(QStringLiteral("sendTextMessages"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -550,6 +550,9 @@ namespace BlackGui
|
|||||||
const bool isBroadcast = textMessage.isBroadcastMessage();
|
const bool isBroadcast = textMessage.isBroadcastMessage();
|
||||||
if (isBroadcast) { cs.markAsBroadcastCallsign(); }
|
if (isBroadcast) { cs.markAsBroadcastCallsign(); }
|
||||||
|
|
||||||
|
const bool isWallopMessage = textMessage.isWallopMessage();
|
||||||
|
if(isWallopMessage) { cs.markAsWallopCallsign(); }
|
||||||
|
|
||||||
const QWidget *tab = this->findTextMessageTabByCallsign(cs);
|
const QWidget *tab = this->findTextMessageTabByCallsign(cs);
|
||||||
if (!tab) { tab = this->addNewTextMessageTab(cs); }
|
if (!tab) { tab = this->addNewTextMessageTab(cs); }
|
||||||
Q_ASSERT_X(tab, Q_FUNC_INFO, "Missing tab");
|
Q_ASSERT_X(tab, Q_FUNC_INFO, "Missing tab");
|
||||||
@@ -725,6 +728,10 @@ namespace BlackGui
|
|||||||
{
|
{
|
||||||
CLogMessage(this).validationError(u"Incorrect message channel");
|
CLogMessage(this).validationError(u"Incorrect message channel");
|
||||||
return {};
|
return {};
|
||||||
|
} else if (ui->tw_TextMessages->tabText(index) == "SUP")
|
||||||
|
{
|
||||||
|
CLogMessage(this).validationError(u"Message cannot be send to SUP channel. To send another wallop message use .wallop instead");
|
||||||
|
return{};
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -145,6 +145,12 @@ namespace BlackMisc
|
|||||||
m_callsign = "BROADCAST";
|
m_callsign = "BROADCAST";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CCallsign::markAsWallopCallsign()
|
||||||
|
{
|
||||||
|
m_callsignAsSet = "SUP";
|
||||||
|
m_callsign = "SUP";
|
||||||
|
}
|
||||||
|
|
||||||
bool CCallsign::isMaybeCopilotCallsign(const CCallsign &pilotCallsign) const
|
bool CCallsign::isMaybeCopilotCallsign(const CCallsign &pilotCallsign) const
|
||||||
{
|
{
|
||||||
return m_callsign.startsWith(pilotCallsign.asString()) &&
|
return m_callsign.startsWith(pilotCallsign.asString()) &&
|
||||||
|
|||||||
@@ -86,6 +86,9 @@ namespace BlackMisc
|
|||||||
//! \remark hack, workaround for VATSIM using "*" as callsign for text messages
|
//! \remark hack, workaround for VATSIM using "*" as callsign for text messages
|
||||||
void markAsBroadcastCallsign();
|
void markAsBroadcastCallsign();
|
||||||
|
|
||||||
|
//! Set a human readable name as "wallop-channel" callsign
|
||||||
|
void markAsWallopCallsign();
|
||||||
|
|
||||||
//! Returns true if this is a co-pilot callsign of pilot. The logic is that the callsign is the same as the pilot one
|
//! Returns true if this is a co-pilot callsign of pilot. The logic is that the callsign is the same as the pilot one
|
||||||
//! but with a single character as suffix.
|
//! but with a single character as suffix.
|
||||||
//! e.g Pilot logged in as DLH123, observer logged in as DLH123A
|
//! e.g Pilot logged in as DLH123, observer logged in as DLH123A
|
||||||
|
|||||||
@@ -208,6 +208,12 @@ namespace BlackMisc
|
|||||||
return cs.isBroadcastCallsign();
|
return cs.isBroadcastCallsign();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CTextMessage::isWallopMessage() const
|
||||||
|
{
|
||||||
|
const CCallsign cs = this->getRecipientCallsign();
|
||||||
|
return cs.getStringAsSet() == "*S";
|
||||||
|
}
|
||||||
|
|
||||||
QString CTextMessage::asString(bool withSender, bool withRecipient, const QString &separator) const
|
QString CTextMessage::asString(bool withSender, bool withRecipient, const QString &separator) const
|
||||||
{
|
{
|
||||||
QString s(this->getFormattedUtcTimestampHms());
|
QString s(this->getFormattedUtcTimestampHms());
|
||||||
|
|||||||
@@ -117,6 +117,9 @@ namespace BlackMisc
|
|||||||
//! Is this a broadcast message
|
//! Is this a broadcast message
|
||||||
bool isBroadcastMessage() const;
|
bool isBroadcastMessage() const;
|
||||||
|
|
||||||
|
//! Is this a message send via .wallop
|
||||||
|
bool isWallopMessage() const;
|
||||||
|
|
||||||
//! Whole message as formatted string. Used to display message in a console window.
|
//! Whole message as formatted string. Used to display message in a console window.
|
||||||
//! \param withSender include sender information in string?
|
//! \param withSender include sender information in string?
|
||||||
//! \param withRecipient include recipient information in string?
|
//! \param withRecipient include recipient information in string?
|
||||||
|
|||||||
Reference in New Issue
Block a user