6 #include <QApplication>
10 #include <QStringBuilder>
12 #include <QToolButton>
13 #include <QVBoxLayout>
18 #include "ui_textmessagecomponent.h"
45 using namespace swift::core::context;
48 using namespace swift::gui::settings;
50 using namespace swift::misc::network;
51 using namespace swift::misc::audio;
52 using namespace swift::misc::aviation;
53 using namespace swift::misc::physical_quantities;
54 using namespace swift::misc::simulation;
58 CTextMessageComponent::CTextMessageComponent(QWidget *parent) : QFrame(parent), ui(new Ui::
CTextMessageComponent)
61 ui->tw_TextMessages->setCurrentIndex(0);
62 ui->fr_TextMessage->setVisible(
false);
63 ui->tvp_TextMessagesAll->setResizeMode(CTextMessageView::ResizingAuto);
64 ui->tvp_TextMessagesAll->setWordWrap(
false);
65 ui->comp_AtcStations->setWithIcons(
false);
69 &CTextMessageComponent::textMessageEntered, Qt::QueuedConnection);
70 Q_ASSERT_X(c, Q_FUNC_INFO,
"Missing connect");
71 c = connect(ui->gb_Settings, &QGroupBox::toggled,
this, &CTextMessageComponent::onSettingsChecked,
72 Qt::QueuedConnection);
73 Q_ASSERT_X(c, Q_FUNC_INFO,
"Missing connect");
74 c = connect(ui->gb_MessageTo, &QGroupBox::toggled,
this, &CTextMessageComponent::onMessageToChecked,
75 Qt::QueuedConnection);
76 Q_ASSERT_X(c, Q_FUNC_INFO,
"Missing connect");
79 &CTextMessageComponent::onAtcButtonClicked, Qt::QueuedConnection);
80 Q_ASSERT_X(c, Q_FUNC_INFO,
"Missing connect");
82 c = connect(ui->cb_LatestFirst, &QCheckBox::toggled,
this, &CTextMessageComponent::onLatestFirstChanged,
83 Qt::QueuedConnection);
84 Q_ASSERT_X(c, Q_FUNC_INFO,
"Missing connect");
88 Qt::QueuedConnection);
89 Q_ASSERT_X(c, Q_FUNC_INFO,
"Missing connect");
91 &CTextMessageComponent::updateSettings, Qt::QueuedConnection);
92 Q_ASSERT_X(c, Q_FUNC_INFO,
"Missing connect");
97 &CCoreFacade::parseCommandLine, Qt::QueuedConnection);
98 Q_ASSERT_X(c, Q_FUNC_INFO,
"Missing connect");
100 &CTextMessageComponent::onTextMessageReceived, Qt::QueuedConnection);
101 Q_ASSERT_X(c, Q_FUNC_INFO,
"Missing connect");
103 &CTextMessageComponent::onTextMessageSent, Qt::QueuedConnection);
104 Q_ASSERT_X(c, Q_FUNC_INFO,
"Missing connect");
106 &CTextMessageComponent::onChangedAircraftCockpit, Qt::QueuedConnection);
107 Q_ASSERT_X(c, Q_FUNC_INFO,
"Missing connect");
112 const QPointer<CTextMessageComponent> myself(
this);
116 this->onSettingsChanged();
117 this->showCurrentFrequenciesFromCockpit();
118 const bool latestFirst = m_messageSettings.get().isLatestFirst();
119 ui->tvp_TextMessagesAll->setSorting(CTextMessage::IndexUtcTimestamp,
120 latestFirst ? Qt::DescendingOrder : Qt::AscendingOrder);
123 ui->gb_Settings->setChecked(
false);
124 ui->gb_MessageTo->setChecked(
false);
134 &CTextMessageComponent::topLevelChanged, Qt::QueuedConnection);
135 Q_ASSERT_X(c, Q_FUNC_INFO,
"Missing connect");
139 QWidget *CTextMessageComponent::getTabWidget(
TextMessageTab tab)
const
143 case TextMessagesAll:
return ui->tb_TextMessagesAll;
144 case TextMessagesCom1:
return ui->tb_TextMessagesCOM1;
145 case TextMessagesCom2:
return ui->tb_TextMessagesCOM2;
146 case TextMessagesUnicom:
return ui->tb_TextMessagesUnicom;
147 default: Q_ASSERT_X(
false, Q_FUNC_INFO,
"Wrong index");
break;
154 QWidget *w = this->getTabWidget(tab);
155 if (!w) {
return nullptr; }
156 return this->findChild<CTextMessageTextEdit *>();
161 QWidget *w = this->getTabWidget(tab);
162 if (w) { ui->tw_TextMessages->setCurrentWidget(w); }
165 void CTextMessageComponent::selectTabWidget(
const CCallsign &callsign,
bool addIfNotExisting)
167 QWidget *tab = this->findTextMessageTabByCallsign(callsign);
168 if (!tab && addIfNotExisting) { tab = this->addNewTextMessageTab(callsign); }
169 if (!tab) {
return; }
170 ui->tw_TextMessages->setCurrentWidget(tab);
173 bool CTextMessageComponent::isCloseableTab(
const QWidget *tabWidget)
const
175 if (!tabWidget) {
return false; }
176 return (tabWidget != ui->tb_TextMessagesAll && tabWidget != ui->tb_TextMessagesCOM1 &&
177 tabWidget != ui->tb_TextMessagesCOM2 && tabWidget != ui->tb_TextMessagesUnicom);
180 void CTextMessageComponent::displayTextMessage(
const CTextMessageList &messages)
182 using namespace std::chrono_literals;
183 if (messages.
isEmpty()) {
return; }
188 const bool audioCsMentioned = playNotification && m_audioSettings.get().textCallsignMentioned();
190 bool addedToAllMessages =
false;
193 bool relevantForMe =
false;
197 if (!m_usedAsOverlayWidget && message.isSelcalMessage() &&
198 ownAircraft.isSelcalSelected(message.getSelcalCode()))
203 if (msgSettings.popupSelcalMessages())
206 this->emitDisplayInInfoWindow(CVariant::from(msg), 3s);
212 if (message.isSendToUnicom())
214 ui->tep_TextMessagesUnicom->insertTextMessage(message);
217 if (!message.wasSent()) { notification = CNotificationSounds::NotificationTextMessageUnicom; }
218 relevantForMe =
true;
222 if (message.isServerMessage())
226 else if (message.isBroadcastMessage())
229 this->addPrivateChannelTextMessage(message);
230 relevantForMe =
true;
232 else if (message.isRadioMessage())
235 if (message.isSendToFrequency(ownAircraft.getCom1System().getFrequencyActive()))
237 ui->tep_TextMessagesCOM1->insertTextMessage(message);
238 if (!message.isSendToUnicom())
240 notification = CNotificationSounds::NotificationTextMessageFrequency;
242 relevantForMe =
true;
244 if (message.isSendToFrequency(ownAircraft.getCom2System().getFrequencyActive()))
246 ui->tep_TextMessagesCOM2->insertTextMessage(message);
247 if (!message.isSendToUnicom())
249 notification = CNotificationSounds::NotificationTextMessageFrequency;
251 relevantForMe =
true;
255 if (relevantForMe && audioCsMentioned && ownAircraft.hasCallsign() &&
256 message.mentionsCallsign(ownAircraft.getCallsign()))
258 notification = CNotificationSounds::NotificationTextCallsignMentioned;
260 QApplication::alert(QWidget::topLevelWidget());
263 else if (message.isPrivateMessage())
266 this->addPrivateChannelTextMessage(message);
267 relevantForMe =
true;
269 QApplication::alert(QWidget::topLevelWidget());
280 ui->tvp_TextMessagesAll->push_back(message);
281 ui->tvp_TextMessagesAll->resort();
282 addedToAllMessages =
true;
284 if (!relevantForMe) {
continue; }
287 if (playNotification && notification != CNotificationSounds::NoNotifications)
293 if (message.isServerMessage()) {
continue; }
294 if (message.isBroadcastMessage()) {
continue; }
296 if (!message.wasSent() && !message.isSendToUnicom())
299 if (!this->isCorrespondingTextMessageTabSelected(message))
301 if (msgSettings.popup(message, ownAircraft))
303 this->emitDisplayInInfoWindow(CVariant::from(message), 15s);
309 if (addedToAllMessages && ui->tvp_TextMessagesAll->isSortedByTimestampPropertyLatestLast())
311 ui->tvp_TextMessagesAll->scrollToBottom();
315 void CTextMessageComponent::onChangedAircraftCockpit(
const CSimulatedAircraft &aircraft,
321 this->showCurrentFrequenciesFromCockpit(aircraft);
324 void CTextMessageComponent::onSettingsChecked(
bool checked)
326 ui->comp_SettingsOverlay->setVisible(checked);
327 ui->comp_SettingsStyle->setVisible(checked);
328 ui->cb_LatestFirst->setVisible(checked);
329 ui->gb_Settings->setFlat(!checked);
332 void CTextMessageComponent::onMessageToChecked(
bool checked)
334 ui->comp_AtcStations->setVisible(checked);
335 ui->gb_MessageTo->setFlat(!checked);
336 if (checked) { ui->comp_AtcStations->updateStations(); }
339 void CTextMessageComponent::onSettingsChanged()
341 QList<CTextMessageTextEdit *> textEdits = this->findAllTextEdit();
342 const QString style = this->getStyleSheet();
343 const bool latestFirst = m_messageSettings.get().isLatestFirst();
346 textEdit->setLatestFirst(latestFirst);
347 textEdit->setStyleSheetForContent(style);
349 ui->comp_SettingsStyle->setStyle(this->getStyleSheet());
350 if (latestFirst != ui->cb_LatestFirst->isChecked()) { ui->cb_LatestFirst->setChecked(latestFirst); }
354 void CTextMessageComponent::onLatestFirstChanged(
bool checked)
360 CLogMessage::preformatted(m);
361 this->onSettingsChanged();
364 void CTextMessageComponent::onStyleSheetChanged()
366 this->onSettingsChanged();
369 void CTextMessageComponent::onAtcButtonClicked(
const CAtcStation &station)
375 void CTextMessageComponent::updateSettings()
377 const QString style = ui->comp_SettingsStyle->getStyle();
382 CLogMessage::preformatted(m);
383 this->onStyleSheetChanged();
386 QList<CTextMessageTextEdit *> CTextMessageComponent::findAllTextEdit()
const
388 return this->findChildren<CTextMessageTextEdit *>();
391 QString CTextMessageComponent::getStyleSheet()
const
393 const QString styleSheet = m_messageSettings.get().getStyleSheet();
394 return styleSheet.isEmpty() &&
sGui ?
399 bool CTextMessageComponent::isCorrespondingTextMessageTabSelected(
const CTextMessage &textMessage)
const
401 if (!this->isVisibleWidgetHack()) {
return false; }
403 if (textMessage.
isEmpty()) {
return false; }
408 if (cs.
isEmpty()) {
return false; }
409 const QWidget *tab = this->findTextMessageTabByCallsign(cs,
false);
410 if (!tab) {
return false; }
411 return ui->tw_TextMessages->currentWidget() == tab;
417 if (ui->tw_TextMessages->currentWidget() == ui->tb_TextMessagesAll) {
return true; }
418 if (textMessage.
isSendToFrequency(ownAircraft.getCom1System().getFrequencyActive()))
420 return ui->tw_TextMessages->currentWidget() == ui->tb_TextMessagesCOM1;
422 if (textMessage.
isSendToFrequency(ownAircraft.getCom2System().getFrequencyActive()))
424 return ui->tw_TextMessages->currentWidget() == ui->tb_TextMessagesCOM2;
430 bool CTextMessageComponent::isNetworkConnected()
const
435 void CTextMessageComponent::showCurrentFrequenciesFromCockpit()
438 this->showCurrentFrequenciesFromCockpit(ownAircraft);
441 void CTextMessageComponent::showCurrentFrequenciesFromCockpit(
const CSimulatedAircraft &ownAircraft)
454 const QString f1n = QString::asprintf(
"%03.3f", freq1.
valueRounded(CFrequencyUnit::MHz(), 3));
455 const QString f2n = QString::asprintf(
"%03.3f", freq2.
valueRounded(CFrequencyUnit::MHz(), 3));
456 QString f1 = QStringLiteral(
"COM1: %1").arg(f1n);
457 QString f2 = QStringLiteral(
"COM2: %1").arg(f2n);
461 ui->tb_TextMessagesCOM1->setToolTip(f1);
462 ui->tb_TextMessagesCOM1->setToolTip(f2);
464 ui->tw_TextMessages->setTabText(ui->tw_TextMessages->indexOf(ui->tb_TextMessagesCOM1), f1);
465 ui->tw_TextMessages->setTabText(ui->tw_TextMessages->indexOf(ui->tb_TextMessagesCOM2), f2);
468 this->updateAllTabs();
471 QWidget *CTextMessageComponent::addNewTextMessageTab(
const CCallsign &callsign)
473 if (callsign.
isEmpty()) {
return nullptr; }
474 QWidget *w = this->findTextMessageTabByCallsign(callsign,
false);
477 const QString tabName = callsign.
asString();
478 const QString style = this->getStyleSheet();
480 QWidget *newTabWidget =
new QWidget(
this);
481 newTabWidget->setObjectName(u
"Tab widget " % tabName);
482 newTabWidget->setProperty(
"callsign", callsign.
asString());
483 QPushButton *closeButton =
new QPushButton(
"Close", newTabWidget);
484 QVBoxLayout *layout =
new QVBoxLayout(newTabWidget);
486 textEdit->setObjectName(
"tep_" + tabName);
487 int marginLeft, marginRight, marginTop, marginBottom;
488 ui->tb_TextMessagesAll->layout()->getContentsMargins(&marginLeft, &marginTop, &marginRight, &marginBottom);
489 newTabWidget->layout()->setContentsMargins(marginLeft, marginTop, marginRight, 2);
490 layout->addWidget(textEdit);
491 layout->addWidget(closeButton);
492 newTabWidget->setLayout(layout);
493 textEdit->setContextMenuPolicy(Qt::CustomContextMenu);
494 textEdit->setProperty(
"supervisormsg", supervisor);
497 const int index = ui->tw_TextMessages->addTab(newTabWidget, this->getCallsignAndRealName(callsign));
498 QToolButton *closeButtonInTab =
new QToolButton(newTabWidget);
499 closeButtonInTab->setText(
"[X]");
500 closeButtonInTab->setProperty(
"supervisormsg", supervisor);
501 QTabBar *bar = ui->tw_TextMessages->tabBar();
502 bar->setTabButton(index, QTabBar::RightSide, closeButtonInTab);
507 bar->setTabTextColor(index, QColor(Qt::yellow));
509 ui->tw_TextMessages->setCurrentIndex(index);
510 closeButtonInTab->setProperty(
"tabName", tabName);
511 closeButton->setProperty(
"tabName", tabName);
513 connect(closeButton, &QPushButton::released,
this, &CTextMessageComponent::closeTextMessageTab);
514 connect(closeButtonInTab, &QPushButton::released,
this, &CTextMessageComponent::closeTextMessageTab);
516 this->setTabWidgetDescription(callsign, index);
520 void CTextMessageComponent::setTabWidgetDescription(
const CCallsign &callsign,
int widgetIndex)
522 if (callsign.
isEmpty()) {
return; }
528 if (!realName.isEmpty()) { ui->tw_TextMessages->setTabToolTip(widgetIndex, realName); }
530 const QString tt = realName.isEmpty() ? callsign.
asString() : callsign.
asString() % u
": " % realName;
531 ui->tw_TextMessages->setTabText(widgetIndex, tt);
534 QString CTextMessageComponent::getCallsignAndRealName(
const CCallsign &callsign)
const
536 if (callsign.
isEmpty()) {
return {}; }
540 if (!realName.isEmpty()) {
return callsign.
asString() % u
": " % realName; }
545 void CTextMessageComponent::updateAllTabs()
547 for (
int index = ui->tw_TextMessages->count() - 1; index >= 0; index--)
549 QWidget *tab = ui->tw_TextMessages->widget(index);
550 if (!tab) {
continue; }
551 if (!tab->toolTip().isEmpty()) {
continue; }
552 const QString cs = tab->property(
"callsign").toString();
553 if (cs.isEmpty()) {
continue; }
554 this->setTabWidgetDescription(
CCallsign(cs), index);
558 void CTextMessageComponent::addPrivateChannelTextMessage(
const CTextMessage &textMessage)
570 const QWidget *tab = this->findTextMessageTabByCallsign(cs);
571 if (!tab) { tab = this->addNewTextMessageTab(cs); }
572 Q_ASSERT_X(tab, Q_FUNC_INFO,
"Missing tab");
575 if (!textEdit) {
return; }
580 if (isBroadcast) {
return; }
606 QWidget *CTextMessageComponent::findTextMessageTabByCallsign(
const CCallsign &callsign,
607 bool callsignResolution)
const
610 for (
int index = ui->tw_TextMessages->count() - 1; index >= 0; index--)
612 QWidget *tab = ui->tw_TextMessages->widget(index);
613 if (tab && tab->property(
"callsign").toString() == callsign.
asString()) {
return tab; }
616 QWidget *w = this->findTextMessageTabByName(callsign.
asString());
618 if (!callsignResolution) {
return nullptr; }
628 return this->getTabWidget(TextMessagesCom1);
632 return this->getTabWidget(TextMessagesCom2);
638 QWidget *CTextMessageComponent::findTextMessageTabByName(
const QString &name)
const
640 if (name.isEmpty()) {
return nullptr; }
643 for (
int index = ui->tw_TextMessages->count() - 1; index >= 0; index--)
645 const QString tabName = ui->tw_TextMessages->tabText(index);
646 if (!tabName.startsWith(name, Qt::CaseInsensitive)) {
continue; }
647 QWidget *tab = ui->tw_TextMessages->widget(index);
653 void CTextMessageComponent::closeTextMessageTab()
656 const QObject *sender = QObject::sender();
657 const QString tabName = sender->property(
"tabName").toString();
658 QWidget *tw = this->findTextMessageTabByName(tabName);
659 if (!this->isCloseableTab(tw)) {
return; }
660 if (tw) { index = ui->tw_TextMessages->indexOf(tw); }
661 if (index >= 0) { ui->tw_TextMessages->removeTab(index); }
664 void CTextMessageComponent::topLevelChanged(QWidget *widget,
bool topLevel)
668 ui->fr_TextMessage->setVisible(topLevel);
671 void CTextMessageComponent::textMessageEntered()
673 if (!ui->fr_TextMessage->isVisible() || !ui->lep_TextMessages->isVisible()) {
return; }
674 if (!this->isVisible()) {
return; }
676 const QString cl(ui->lep_TextMessages->getLastEnteredLineFormatted());
677 if (!cl.isEmpty()) { this->handleEnteredTextMessage(cl); }
680 bool CTextMessageComponent::isVisibleWidgetHack()
const
685 CCallsign CTextMessageComponent::getCallsignPropertyForTab(
int tabIndex,
bool validated)
const
687 if (tabIndex < 0 || tabIndex >= ui->tw_TextMessages->count()) {
return {}; }
688 QWidget *tab = ui->tw_TextMessages->widget(tabIndex);
689 if (tab && !tab->property(
"callsign").toString().isEmpty())
691 const CCallsign cs(tab->property(
"callsign").toString());
692 if (!validated) {
return cs; }
712 void CTextMessageComponent::emitDisplayInInfoWindow(
const CVariant &message,
713 std::chrono::milliseconds displayDuration)
715 if (m_usedAsOverlayWidget) {
return; }
719 void CTextMessageComponent::handleEnteredTextMessage(
const QString &textMessage)
721 if (!this->isVisibleWidgetHack()) {
return; }
723 QString cl(textMessage.trimmed().simplified());
724 if (cl.isEmpty()) {
return; }
727 if (!cl.startsWith(
"."))
730 cl = this->textMessageToCommand(cl);
734 if (cl.isEmpty()) {
return; }
738 QString CTextMessageComponent::textMessageToCommand(
const QString &enteredLine)
741 if (enteredLine.isEmpty()) {
return {}; }
743 const int index = ui->tw_TextMessages->currentIndex();
744 QString cmd(
".msg ");
745 if (index < 0 || index == ui->tw_TextMessages->indexOf(ui->tb_TextMessagesAll))
750 else if (ui->tw_TextMessages->tabText(index) ==
"SUP")
753 u
"Message cannot be send to SUP channel. To send another wallop message use .wallop instead");
758 if (index == ui->tw_TextMessages->indexOf(ui->tb_TextMessagesCOM1))
760 cmd.append(QString::number(this->getOwnAircraft().getCom1System().getFrequencyActive().valueRounded(
761 CFrequencyUnit::MHz(), 3)));
763 else if (index == ui->tw_TextMessages->indexOf(ui->tb_TextMessagesCOM2))
765 cmd.append(QString::number(this->getOwnAircraft().getCom2System().getFrequencyActive().valueRounded(
766 CFrequencyUnit::MHz(), 3)));
768 else if (index == ui->tw_TextMessages->indexOf(ui->tb_TextMessagesUnicom))
770 cmd.append(QString::number(
771 CPhysicalQuantitiesConstants::FrequencyUnicom().valueRounded(CFrequencyUnit::MHz(), 3)));
777 const QString selectedTabText = firstPartOfTabText(ui->tw_TextMessages->tabText(index).trimmed());
778 const double frequency = selectedTabText.toDouble(&isNumber);
782 if (CComSystem::isValidCivilAviationFrequency(radioFrequency))
784 cmd.append(QString::number(radioFrequency.
valueRounded(CFrequencyUnit::MHz(), 3)));
790 const CCallsign cs = this->getCallsignPropertyForTab(index,
true);
791 if (cs.
isEmpty()) { cmd.append(selectedTabText); }
795 else { cmd.append(selectedTabText); }
797 return cmd % u
" " % enteredLine;
801 void CTextMessageComponent::onTextMessageReceived(
const CTextMessageList &messages)
803 if (!m_activeReceive) {
return; }
804 this->displayTextMessage(messages);
807 void CTextMessageComponent::onTextMessageSent(
const CTextMessage &sentMessage)
809 if (!m_activeSend) {
return; }
810 this->displayTextMessage(sentMessage);
815 if (originator == this->componentIdentifier()) {
return false; }
816 if (commandLine.isEmpty() || commandLine.startsWith(
".")) {
return false; }
819 if (!this->isVisibleWidgetHack()) {
return false; }
820 this->handleEnteredTextMessage(commandLine);
832 QWidget *w = this->findTextMessageTabByCallsign(callsign,
true);
838 w = this->addNewTextMessageTab(callsign);
843 w = this->addNewTextMessageTab(callsign);
847 ui->tw_TextMessages->setCurrentWidget(w);
860 if (freq1 == frequency)
862 this->
setTab(TextMessagesCom1);
865 if (freq2 == frequency)
867 this->
setTab(TextMessagesCom2);
870 this->
setTab(TextMessagesAll);
882 case TextMessagesAll: ui->tw_TextMessages->setCurrentWidget(ui->tb_TextMessagesAll);
break;
883 case TextMessagesCom1: ui->tw_TextMessages->setCurrentWidget(ui->tb_TextMessagesCOM1);
break;
884 case TextMessagesCom2: ui->tw_TextMessages->setCurrentWidget(ui->tb_TextMessagesCOM2);
break;
885 case TextMessagesUnicom: ui->tw_TextMessages->setCurrentWidget(ui->tb_TextMessagesUnicom);
break;
894 ui->comp_AtcStations->setRowsColumns(rows, cols, setMaxElements);
899 ui->comp_AtcStations->setBackgroundUpdates(backgroundUpdates);
904 if (!ui->gb_MessageTo->isChecked()) {
return; }
905 ui->comp_AtcStations->updateStations();
910 return ui->tw_TextMessages->widget(0) == ui->tb_TextMessagesAll;
919 if (!ui->lep_TextMessages->isVisible()) {
return; }
922 ui->lep_TextMessages->setFocus();
930 m_activeReceive = receive;
933 QString CTextMessageComponent::firstPartOfTabText(
const QString &tabText)
935 if (tabText.isEmpty()) {
return {}; }
936 int index = tabText.indexOf(
':');
937 if (index < 0) { index = tabText.indexOf(
' '); }
938 if (index >= 0) {
return tabText.left(index); }
const context::IContextAudio * getIContextAudio() const
Direct access to contexts if a CCoreFacade has been initialized.
const context::IContextOwnAircraft * getIContextOwnAircraft() const
Direct access to contexts if a CCoreFacade has been initialized.
CCoreFacade * getCoreFacade()
Get the facade.
const context::IContextNetwork * getIContextNetwork() const
Direct access to contexts if a CCoreFacade has been initialized.
bool isShuttingDown() const
Is application shutting down?
const context::CContextAudioBase * getCContextAudioBase() const
Direct access to contexts if a CCoreFacade has been initialized.
void playSelcalTone(const swift::misc::aviation::CSelcal &selcal)
SELCAL.
void playNotification(swift::misc::audio::CNotificationSounds::NotificationFlag notification, bool considerSettings, int volume=-1)
Notification sounds.
virtual swift::misc::aviation::CAtcStationList getOnlineStationsForFrequency(const swift::misc::physical_quantities::CFrequency &frequency) const =0
Online stations for frequency.
virtual swift::misc::simulation::CSimulatedAircraft getAircraftInRangeForCallsign(const swift::misc::aviation::CCallsign &callsign) const =0
Aircraft for given callsign.
virtual swift::misc::network::CUser getUserForCallsign(const swift::misc::aviation::CCallsign &callsign) const =0
User for given callsign, e.g. for text messages.
virtual bool isOnlineStation(const swift::misc::aviation::CCallsign &callsign) const =0
Online station for callsign?
virtual swift::misc::aviation::CAtcStation getOnlineStationForCallsign(const swift::misc::aviation::CCallsign &callsign) const =0
Online station for callsign.
virtual bool isAircraftInRange(const swift::misc::aviation::CCallsign &callsign) const =0
Aircraft in range.
virtual bool isConnected() const =0
Network connected?
virtual swift::misc::simulation::CSimulatedAircraft getOwnAircraft() const =0
Get own aircraft.
const CStyleSheetUtility & getStyleSheetUtility() const
Style sheet handling.
void styleSheetsChanged()
Style sheet changed.
void returnPressedUnemptyLine()
Return has been pressed, line is NOT empty (spaces are trimmed)
static const QString & fileNameTextMessage()
File name textmessage.qss.
QString style(const QString &fileName) const
Style for given file name.
Specialized text edit for displaying text messages.
void insertTextMessage(const swift::misc::network::CTextMessage &textMessage, int maxMessages=-1)
Insert a message.
void setStyleSheetForContent(const QString &styleSheet)
Stylesheet for content.
void changed()
Font or style changed from within the component.
bool hasAllMessagesTab() const
Has an all tab.
void showTextMessageEntry(bool show)
Show an text entry field.
void removeAllMessagesTab()
Remove the all tab, the operation cannot be undone.
bool handleGlobalCommandLineText(const QString &commandLine, const swift::misc::CIdentifier &originator)
Used to allow direct input from global command line when visible.
void commandEntered(const QString &commandLine, const swift::misc::CIdentifier &originator)
Command line was entered.
void displayInInfoWindow(const swift::misc::CVariant &message, std::chrono::milliseconds displayDuration)
Message to be displayed in central info window.
void textMessageTabSelected()
Text message tab selected.
void setAtcButtonsRowsColumns(int rows, int cols, bool setMaxElements)
Rows/columns.
void fontSizePlus()
Font size.
void setTab(TextMessageTab tab)
Set tab.
void showCorrespondingTab(const swift::misc::aviation::CCallsign &callsign)
Display the tab for given callsign.
void updateAtcStationsButtons()
Update buttons.
virtual ~CTextMessageComponent()
Destructor.
void showSettings(bool show)
Show the settings.
virtual bool setParentDockWidgetInfoArea(CDockWidgetInfoArea *parentDockableWidget)
Corresponding dockable widget in info area.
void fontSizeMinus()
Font size.
void setAtcButtonsBackgroundUpdates(bool backgroundUpdates)
Background updates or explicitly called.
void focusTextEntry()
Focus the text entry field.
void showCorrespondingTabForFrequency(const swift::misc::physical_quantities::CFrequency &frequency)
Display the tab for given frequency.
void activate(bool send, bool receive)
Ignore incoming send/receive signals.
bool isActivated() const
Text activated.
void setStyleSheet(const QString &styleSheet)
CSS style sheet.
bool focusOverlayWindow() const
Focus in the overlay window.
void setLatestFirst(bool latestFirst)
Latest messages 1st?
bool isLatestFirst() const
Latest messages 1st?
T get() const
Get a copy of the current value.
Value object for icons. An icon is stored in the global icon repository and identified by its index....
QIcon toQIcon() const
A QIcon.
Value object encapsulating information identifying a component of a modular distributed swift process...
Class for emitting a log message.
Derived & warning(const char16_t(&format)[N])
Set the severity to warning, providing a format string.
Derived & validationError(const char16_t(&format)[N])
Set the severity to error, providing a format string, and adding the validation category.
Derived & info(const char16_t(&format)[N])
Set the severity to info, providing a format string.
size_type size() const
Returns number of elements in the sequence.
reference front()
Access the first element.
bool isEmpty() const
Synonym for empty.
Streamable status message, e.g.
Wrapper around QVariant which provides transparent access to CValueObject methods of the contained ob...
Value object encapsulating information of audio related settings.
bool textMessageSupervisor() const
Simplified functions.
bool textMessagePrivate() const
Simplified functions.
Value object encapsulating information about an ATC station.
const CCallsign & getCallsign() const
Get callsign.
QString getCallsignAndControllerRealName() const
Callsign and controller's name if available.
const physical_quantities::CFrequency & getFrequency() const
Get frequency.
bool hasCallsign() const
Has callsign?
Value object for a list of ATC stations.
Value object encapsulating information of a callsign.
const QString & asString() const
Get callsign (normalized)
CIcons::IconIndex toIcon() const
As icon, not implemented by all classes.
void markAsBroadcastCallsign()
Set a human readable name as "broadcast" callsign.
void markAsWallopCallsign()
Set a human readable name as "wallop-channel" callsign.
bool isSupervisorCallsign() const
Supervisor?
bool isEmpty() const
Is empty?
bool isAtcCallsign() const
ATC callsign.
const QString & getStringAsSet() const
Get callsign.
bool isActiveFrequencySameFrequency(const physical_quantities::CFrequency &comFrequency) const
Is active frequency the same frequency.
swift::misc::physical_quantities::CFrequency getFrequencyActive() const
Active frequency.
Value object encapsulating information of a text message.
bool isWallopMessage() const
Is this a message send via .wallop.
bool isPrivateMessage() const
Is private message?
bool isBroadcastMessage() const
Is this a broadcast message.
bool isEmpty() const
Empty message.
bool isServerMessage() const
Initial message of server?
bool hasValidRecipient() const
Valid receviver?
bool isSendToFrequency(const physical_quantities::CFrequency &frequency) const
Send to particular frequency?
bool wasSent() const
Was sent?
const aviation::CCallsign & getSenderCallsign() const
Get callsign (from)
const aviation::CCallsign & getRecipientCallsign() const
Get callsign (to)
bool isSupervisorMessage() const
Supervisor message?
Value object encapsulating a list of text messages.
const QString & getRealName() const
Get full name.
double valueRounded(MU unit, int digits=-1) const
Rounded value in given unit.
Comprehensive information of an aircraft.
const aviation::CComSystem & getCom2System() const
Get COM2 system.
bool hasCallsign() const
Callsign not empty, no further checks.
const aviation::CCallsign & getCallsign() const
Get callsign.
const aviation::CComSystem & getCom1System() const
Get COM1 system.
SWIFT_GUI_EXPORT swift::gui::CGuiApplication * sGui
Single instance of GUI application object.
Backend services of the swift project, like dealing with the network or the simulators.
High level reusable GUI components.
Views, mainly QTableView.
Free functions in swift::misc.
auto singleShot(int msec, QObject *target, F &&task)
Starts a single-shot timer which will call a task in the thread of the given object when it times out...
NotificationFlag
Play notification.
#define SWIFT_AUDIT_X(COND, WHERE, WHAT)
A weaker kind of verify.
#define SWIFT_VERIFY_X(COND, WHERE, WHAT)
A weaker kind of assert.