mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-03 15:45:46 +08:00
Ref T536, Ref T531 improved message handling
* do not activate COM/ATC overlay messages as central frame overlay is used * ignore signals if not activated
This commit is contained in:
committed by
Mat Sutcliffe
parent
dfd3d9f884
commit
d68726080f
@@ -70,8 +70,6 @@ namespace BlackGui
|
||||
CUpperCaseValidator *ucv = new CUpperCaseValidator(ui->le_AtcStationsOnlineMetar);
|
||||
ui->le_AtcStationsOnlineMetar->setValidator(ucv);
|
||||
|
||||
this->activateTextMessages(true);
|
||||
|
||||
// some icons
|
||||
ui->tb_AtcStationsAtisReload->setIcon(CIcons::atis());
|
||||
ui->tb_AtcStationsAtisReload->setText("ATIS");
|
||||
|
||||
@@ -27,7 +27,6 @@ namespace BlackGui
|
||||
{
|
||||
ui->setupUi(this);
|
||||
m_minHeightInfoArea = ui->comp_CockpitInfoArea->minimumHeight();
|
||||
this->activateTextMessages(true);
|
||||
|
||||
connect(ui->wip_CockpitComPanelShowHideBar, &CShowHideBar::toggleShowHide, this, &CCockpitComponent::onToggleShowHideDetails);
|
||||
connect(ui->comp_CockpitComComponent, &CCockpitComComponent::requestCom1TextMessage, this, &CCockpitComponent::onRequestTextMessageCom1);
|
||||
|
||||
@@ -94,7 +94,7 @@ namespace BlackGui
|
||||
Q_ASSERT_X(c, Q_FUNC_INFO, "Missing connect");
|
||||
c = connect(sGui->getIContextNetwork(), &IContextNetwork::textMessageSent, this, &CTextMessageComponent::onTextMessageSent, Qt::QueuedConnection);
|
||||
Q_ASSERT_X(c, Q_FUNC_INFO, "Missing connect");
|
||||
c = connect(sGui->getIContextOwnAircraft(), &IContextOwnAircraft::changedAircraftCockpit, this, &CTextMessageComponent::onChangedAircraftCockpit);
|
||||
c = connect(sGui->getIContextOwnAircraft(), &IContextOwnAircraft::changedAircraftCockpit, this, &CTextMessageComponent::onChangedAircraftCockpit, Qt::QueuedConnection);
|
||||
Q_ASSERT_X(c, Q_FUNC_INFO, "Missing connect");
|
||||
}
|
||||
Q_UNUSED(c);
|
||||
@@ -106,7 +106,7 @@ namespace BlackGui
|
||||
// init decoupled when sub components are fully init
|
||||
if (!myself || !sGui || sGui->isShuttingDown()) { return; }
|
||||
this->onSettingsChanged();
|
||||
this->onChangedAircraftCockpit();
|
||||
this->showCurrentFrequenciesFromCockpit();
|
||||
|
||||
// hde for the beginning
|
||||
ui->gb_Settings->setChecked(false);
|
||||
@@ -257,9 +257,12 @@ namespace BlackGui
|
||||
} // for
|
||||
}
|
||||
|
||||
void CTextMessageComponent::onChangedAircraftCockpit()
|
||||
void CTextMessageComponent::onChangedAircraftCockpit(const CSimulatedAircraft &aircraft, const CIdentifier &originator)
|
||||
{
|
||||
this->showCurrentFrequenciesFromCockpit();
|
||||
// this is called for every overlay widget as well
|
||||
Q_UNUSED(originator);
|
||||
if (!this->isActivated()) { return; }
|
||||
this->showCurrentFrequenciesFromCockpit(aircraft);
|
||||
}
|
||||
|
||||
void CTextMessageComponent::onSettingsChecked(bool checked)
|
||||
@@ -361,6 +364,11 @@ namespace BlackGui
|
||||
void CTextMessageComponent::showCurrentFrequenciesFromCockpit()
|
||||
{
|
||||
const CSimulatedAircraft ownAircraft = this->getOwnAircraft();
|
||||
this->showCurrentFrequenciesFromCockpit(ownAircraft);
|
||||
}
|
||||
|
||||
void CTextMessageComponent::showCurrentFrequenciesFromCockpit(const CSimulatedAircraft &ownAircraft)
|
||||
{
|
||||
const CFrequency freq1 = ownAircraft.getCom1System().getFrequencyActive();
|
||||
const CFrequency freq2 = ownAircraft.getCom2System().getFrequencyActive();
|
||||
|
||||
@@ -760,5 +768,12 @@ namespace BlackGui
|
||||
{
|
||||
ui->tw_TextMessages->removeTab(0);
|
||||
}
|
||||
|
||||
void CTextMessageComponent::activate(bool send, bool receive)
|
||||
{
|
||||
m_activeSend = send;
|
||||
m_activeReceive = receive;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace
|
||||
|
||||
@@ -16,9 +16,9 @@
|
||||
#include "blackgui/settings/textmessagesettings.h"
|
||||
#include "blackgui/enablefordockwidgetinfoarea.h"
|
||||
#include "blackgui/blackguiexport.h"
|
||||
#include "blackmisc/audio/audiosettings.h"
|
||||
#include "blackmisc/aviation/atcstation.h"
|
||||
#include "blackmisc/simulation/simulatedaircraft.h"
|
||||
#include "blackmisc/aviation/atcstation.h"
|
||||
#include "blackmisc/audio/audiosettings.h"
|
||||
#include "blackmisc/identifier.h"
|
||||
#include "blackmisc/variant.h"
|
||||
|
||||
@@ -56,17 +56,17 @@ namespace BlackGui
|
||||
//! \remark takes the messages, turns it into a ".msg" command, and emits it
|
||||
bool handleGlobalCommandLineText(const QString &commandLine, const BlackMisc::CIdentifier &originator);
|
||||
|
||||
//! Font size @{
|
||||
void fontSizeMinus();
|
||||
void fontSizePlus();
|
||||
//! @}
|
||||
|
||||
//! Display the tab for given callsign
|
||||
void showCorrespondingTab(const BlackMisc::Aviation::CCallsign &callsign);
|
||||
|
||||
//! Display the tab for given frequency
|
||||
void showCorrespondingTabForFrequency(const BlackMisc::PhysicalQuantities::CFrequency &frequency);
|
||||
|
||||
//! Font size @{
|
||||
void fontSizeMinus();
|
||||
void fontSizePlus();
|
||||
//! @}
|
||||
|
||||
//! Set tab
|
||||
void setTab(TextMessageTab tab);
|
||||
|
||||
@@ -91,10 +91,10 @@ namespace BlackGui
|
||||
void setAsUsedInOverlayMode() { m_usedAsOverlayWidget = true; }
|
||||
|
||||
//! Ignore incoming send/receive signals
|
||||
void activate(bool send, bool receive) { m_activeSend = send; m_activeReceive = receive; }
|
||||
void activate(bool send, bool receive);
|
||||
|
||||
//! Text activated
|
||||
bool isActivated() const { return m_activeSend && m_activeReceive; }
|
||||
bool isActivated() const { return m_activeSend || m_activeReceive; }
|
||||
|
||||
//! Rows/columns
|
||||
void setAtcButtonsRowsColumns(int rows, int cols, bool setMaxElements);
|
||||
@@ -119,7 +119,7 @@ namespace BlackGui
|
||||
BlackMisc::CSetting<Settings::TextMessageSettings> m_messageSettings { this, &CTextMessageComponent::onSettingsChanged };
|
||||
BlackMisc::CSetting<BlackMisc::Audio::TSettings> m_audioSettings { this };
|
||||
bool m_usedAsOverlayWidget = false; //!< disables dockwidget parts if used as overlay widget
|
||||
bool m_activeSend = true; //!< ignore sent callback
|
||||
bool m_activeSend = true; //!< ignore sent messages
|
||||
bool m_activeReceive = true; //!< ignore received messages
|
||||
|
||||
//! Enum to widget
|
||||
@@ -158,8 +158,10 @@ namespace BlackGui
|
||||
//! Network connected?
|
||||
bool isNetworkConnected() const;
|
||||
|
||||
//! Show current frequencies
|
||||
//! Show current frequencies @{
|
||||
void showCurrentFrequenciesFromCockpit();
|
||||
void showCurrentFrequenciesFromCockpit(const BlackMisc::Simulation::CSimulatedAircraft &ownAircraft);
|
||||
//! @}
|
||||
|
||||
//! Append text messages (received, to be sent) to GUI
|
||||
void displayTextMessage(const BlackMisc::Network::CTextMessageList &messages);
|
||||
@@ -180,7 +182,7 @@ namespace BlackGui
|
||||
void onTextMessageSent(const BlackMisc::Network::CTextMessage &sentMessage);
|
||||
|
||||
//! Cockpit values changed, used to updated some components
|
||||
void onChangedAircraftCockpit();
|
||||
void onChangedAircraftCockpit(const BlackMisc::Simulation::CSimulatedAircraft &aircraft, const BlackMisc::CIdentifier &originator);
|
||||
|
||||
//! Settings have been checked (group box visible/invisible)
|
||||
void onSettingsChecked(bool checked);
|
||||
|
||||
Reference in New Issue
Block a user