diff --git a/src/blackgui/components/textmessagecomponent.cpp b/src/blackgui/components/textmessagecomponent.cpp index b9560f5aaf..ac7f30b5e2 100644 --- a/src/blackgui/components/textmessagecomponent.cpp +++ b/src/blackgui/components/textmessagecomponent.cpp @@ -189,6 +189,7 @@ namespace BlackGui::Components for (const CTextMessage &message : messages) { bool relevantForMe = false; + CNotificationSounds::NotificationFlag notification = CNotificationSounds::NoNotifications; // SELCAL if (!m_usedAsOverlayWidget && message.isSelcalMessage() && ownAircraft.isSelcalSelected(message.getSelcalCode())) @@ -211,6 +212,12 @@ namespace BlackGui::Components if (message.isSendToUnicom()) { ui->tep_TextMessagesUnicom->insertTextMessage(message); + + // Message was received from others + if (!message.wasSent()) + { + notification = CNotificationSounds::NotificationTextMessageUnicom; + } relevantForMe = true; } @@ -231,18 +238,26 @@ namespace BlackGui::Components if (message.isSendToFrequency(ownAircraft.getCom1System().getFrequencyActive())) { ui->tep_TextMessagesCOM1->insertTextMessage(message); + if (!message.isSendToUnicom()) + { + notification = CNotificationSounds::NotificationTextMessageFrequency; + } relevantForMe = true; } if (message.isSendToFrequency(ownAircraft.getCom2System().getFrequencyActive())) { ui->tep_TextMessagesCOM2->insertTextMessage(message); + if (!message.isSendToUnicom()) + { + notification = CNotificationSounds::NotificationTextMessageFrequency; + } relevantForMe = true; } // callsign mentioned notification if (relevantForMe && audioCsMentioned && ownAircraft.hasCallsign() && message.mentionsCallsign(ownAircraft.getCallsign())) { - sGui->getCContextAudioBase()->playNotification(CNotificationSounds::NotificationTextCallsignMentioned, false); + notification = CNotificationSounds::NotificationTextCallsignMentioned; // Flash taskbar icon QApplication::alert(QWidget::topLevelWidget()); } @@ -270,6 +285,12 @@ namespace BlackGui::Components } if (!relevantForMe) { continue; } + // Play notification + if (playNotification && notification != CNotificationSounds::NoNotifications) + { + sGui->getCContextAudioBase()->playNotification(notification, true); + } + // overlay message if this channel is not selected if (message.isServerMessage()) { continue; } if (message.isBroadcastMessage()) { continue; }