mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 06:45:37 +08:00
@@ -135,11 +135,16 @@ namespace swift::core::context
|
||||
//! Set XPDR mode
|
||||
virtual bool setTransponderMode(swift::misc::aviation::CTransponder::TransponderMode mode) = 0;
|
||||
|
||||
//! Tune in a COM frequency
|
||||
//! Tune in a COM frequency (active)
|
||||
virtual bool updateActiveComFrequency(const swift::misc::physical_quantities::CFrequency &frequency,
|
||||
swift::misc::aviation::CComSystem::ComUnit comUnit,
|
||||
const swift::misc::CIdentifier &originator) = 0;
|
||||
|
||||
//! Tune in a COM frequency (standby)
|
||||
virtual bool updateStandbyComFrequency(const swift::misc::physical_quantities::CFrequency &frequency,
|
||||
swift::misc::aviation::CComSystem::ComUnit comUnit,
|
||||
const swift::misc::CIdentifier &originator) = 0;
|
||||
|
||||
//! Set current pilot
|
||||
virtual bool updateOwnAircraftPilot(const swift::misc::network::CUser &pilot) = 0;
|
||||
|
||||
|
||||
@@ -100,6 +100,18 @@ namespace swift::core::context
|
||||
return false;
|
||||
}
|
||||
|
||||
//! \copydoc IContextOwnAircraft::updateStandbyComFrequency
|
||||
bool updateStandbyComFrequency(const swift::misc::physical_quantities::CFrequency &frequency,
|
||||
swift::misc::aviation::CComSystem::ComUnit comUnit,
|
||||
const swift::misc::CIdentifier &originator) override
|
||||
{
|
||||
Q_UNUSED(frequency);
|
||||
Q_UNUSED(comUnit);
|
||||
Q_UNUSED(originator);
|
||||
logEmptyContextWarning(Q_FUNC_INFO);
|
||||
return false;
|
||||
}
|
||||
|
||||
//! \copydoc IContextOwnAircraft::updateOwnAircraftPilot
|
||||
bool updateOwnAircraftPilot(const swift::misc::network::CUser &pilot) override
|
||||
{
|
||||
|
||||
@@ -330,6 +330,26 @@ namespace swift::core::context
|
||||
return changed;
|
||||
}
|
||||
|
||||
bool CContextOwnAircraft::updateStandbyComFrequency(const CFrequency &frequency, CComSystem::ComUnit unit,
|
||||
const CIdentifier &originator)
|
||||
{
|
||||
if (unit != CComSystem::Com1 && unit != CComSystem::Com2) { return false; }
|
||||
if (!CComSystem::isValidComFrequency(frequency)) { return false; }
|
||||
CComSystem com1, com2;
|
||||
CTransponder xpdr;
|
||||
{
|
||||
QReadLocker l(&m_lockAircraft);
|
||||
com1 = m_ownAircraft.getCom1System();
|
||||
com2 = m_ownAircraft.getCom2System();
|
||||
xpdr = m_ownAircraft.getTransponder();
|
||||
}
|
||||
if (unit == CComSystem::Com1) { com1.setFrequencyStandby(frequency); }
|
||||
else { com2.setFrequencyStandby(frequency); }
|
||||
|
||||
const bool changed = this->updateCockpit(com1, com2, xpdr, originator);
|
||||
return changed;
|
||||
}
|
||||
|
||||
bool CContextOwnAircraft::updateOwnAircraftPilot(const CUser &pilot)
|
||||
{
|
||||
{
|
||||
|
||||
@@ -175,6 +175,11 @@ namespace swift::core
|
||||
swift::misc::aviation::CComSystem::ComUnit comUnit,
|
||||
const swift::misc::CIdentifier &originator) override;
|
||||
|
||||
//! \copydoc IContextOwnAircraft::updateStandbyComFrequency
|
||||
bool updateStandbyComFrequency(const swift::misc::physical_quantities::CFrequency &frequency,
|
||||
swift::misc::aviation::CComSystem::ComUnit comUnit,
|
||||
const swift::misc::CIdentifier &originator) override;
|
||||
|
||||
//! \copydoc IContextOwnAircraft::updateOwnAircraftPilot
|
||||
bool updateOwnAircraftPilot(const swift::misc::network::CUser &pilot) override;
|
||||
|
||||
|
||||
@@ -111,6 +111,14 @@ namespace swift::core::context
|
||||
originator);
|
||||
}
|
||||
|
||||
bool CContextOwnAircraftProxy::updateStandbyComFrequency(const physical_quantities::CFrequency &frequency,
|
||||
swift::misc::aviation::CComSystem::ComUnit comUnit,
|
||||
const CIdentifier &originator)
|
||||
{
|
||||
return m_dBusInterface->callDBusRet<bool>(QLatin1String("updateStandbyComFrequency"), frequency, comUnit,
|
||||
originator);
|
||||
}
|
||||
|
||||
bool CContextOwnAircraftProxy::updateOwnAircraftPilot(const swift::misc::network::CUser &pilot)
|
||||
{
|
||||
return m_dBusInterface->callDBusRet<bool>(QLatin1String("updateOwnAircraftPilot"), pilot);
|
||||
|
||||
@@ -89,6 +89,11 @@ namespace swift::core
|
||||
swift::misc::aviation::CComSystem::ComUnit comUnit,
|
||||
const swift::misc::CIdentifier &originator) override;
|
||||
|
||||
//! \copydoc swift::core::context::IContextOwnAircraft::updateStandbyComFrequency
|
||||
bool updateStandbyComFrequency(const swift::misc::physical_quantities::CFrequency &frequency,
|
||||
swift::misc::aviation::CComSystem::ComUnit comUnit,
|
||||
const swift::misc::CIdentifier &originator) override;
|
||||
|
||||
//! \copydoc swift::core::context::IContextOwnAircraft::updateOwnAircraftPilot
|
||||
bool updateOwnAircraftPilot(const swift::misc::network::CUser &pilot) override;
|
||||
|
||||
|
||||
@@ -330,11 +330,12 @@ namespace swift::gui::components
|
||||
}
|
||||
|
||||
void CAtcStationComponent::setComFrequency(const physical_quantities::CFrequency &frequency,
|
||||
CComSystem::ComUnit unit)
|
||||
CComSystem::ComUnit unit, bool active)
|
||||
{
|
||||
if (unit != CComSystem::Com1 && unit != CComSystem::Com2) { return; }
|
||||
if (!CComSystem::isValidComFrequency(frequency)) { return; }
|
||||
sGui->getIContextOwnAircraft()->updateActiveComFrequency(frequency, unit, identifier());
|
||||
if (active) { sGui->getIContextOwnAircraft()->updateActiveComFrequency(frequency, unit, identifier()); }
|
||||
else { sGui->getIContextOwnAircraft()->updateStandbyComFrequency(frequency, unit, identifier()); }
|
||||
}
|
||||
|
||||
void CAtcStationComponent::settingsChanged()
|
||||
|
||||
@@ -122,7 +122,7 @@ namespace swift::gui
|
||||
|
||||
//! Set COM frequency
|
||||
void setComFrequency(const swift::misc::physical_quantities::CFrequency &frequency,
|
||||
swift::misc::aviation::CComSystem::ComUnit unit);
|
||||
swift::misc::aviation::CComSystem::ComUnit unit, bool active);
|
||||
|
||||
//! Airports read from web readers
|
||||
void airportsRead();
|
||||
|
||||
@@ -118,18 +118,24 @@ namespace swift::gui::views
|
||||
|
||||
auto *menu = new QMenu(this); // menu
|
||||
|
||||
auto *com1 = new QAction(CIcons::appCockpit16(), "Tune in COM1", this);
|
||||
auto *com2 = new QAction(CIcons::appCockpit16(), "Tune in COM2", this);
|
||||
auto *com1 = new QAction(CIcons::appCockpit16(), "Tune in COM1 (active)", this);
|
||||
auto *com2 = new QAction(CIcons::appCockpit16(), "Tune in COM2 (active)", this);
|
||||
auto *com1_stby = new QAction(CIcons::appCockpit16(), "Tune in COM1 (standby)", this);
|
||||
auto *com2_stby = new QAction(CIcons::appCockpit16(), "Tune in COM2 (standby)", this);
|
||||
auto *text = new QAction(CIcons::appTextMessages16(), "Show text messages", this);
|
||||
auto *resize = new QAction(CIcons::resize16(), "Resize", this);
|
||||
|
||||
connect(com1, &QAction::triggered, this, [this]() { tuneInAtc(CComSystem::Com1); });
|
||||
connect(com2, &QAction::triggered, this, [this]() { tuneInAtc(CComSystem::Com2); });
|
||||
connect(com1, &QAction::triggered, this, [this]() { tuneInAtc(CComSystem::Com1, true); });
|
||||
connect(com2, &QAction::triggered, this, [this]() { tuneInAtc(CComSystem::Com2, true); });
|
||||
connect(com1_stby, &QAction::triggered, this, [this]() { tuneInAtc(CComSystem::Com1, false); });
|
||||
connect(com2_stby, &QAction::triggered, this, [this]() { tuneInAtc(CComSystem::Com2, false); });
|
||||
connect(text, &QAction::triggered, this, &CAtcStationTreeView::requestTextMessage);
|
||||
connect(resize, &QAction::triggered, this, &CAtcStationTreeView::fullResizeToContentsImpl);
|
||||
|
||||
menu->addAction(com1);
|
||||
menu->addAction(com2);
|
||||
menu->addAction(com1_stby);
|
||||
menu->addAction(com2_stby);
|
||||
menu->addAction(text);
|
||||
menu->addSeparator();
|
||||
menu->addAction(resize);
|
||||
@@ -160,11 +166,11 @@ namespace swift::gui::views
|
||||
}
|
||||
}
|
||||
|
||||
void CAtcStationTreeView::tuneInAtc(const misc::aviation::CComSystem::ComUnit unit)
|
||||
void CAtcStationTreeView::tuneInAtc(const misc::aviation::CComSystem::ComUnit unit, const bool active)
|
||||
{
|
||||
const CAtcStation s(this->selectedObject());
|
||||
if (s.getCallsign().isEmpty()) { return; }
|
||||
emit this->requestComFrequency(s.getFrequency(), unit);
|
||||
emit this->requestComFrequency(s.getFrequency(), unit, active);
|
||||
}
|
||||
|
||||
void CAtcStationTreeView::requestTextMessage()
|
||||
|
||||
@@ -63,7 +63,7 @@ namespace swift::gui
|
||||
|
||||
//! Request COM frequency
|
||||
void requestComFrequency(const swift::misc::physical_quantities::CFrequency &frequency,
|
||||
swift::misc::aviation::CComSystem::ComUnit unit);
|
||||
swift::misc::aviation::CComSystem::ComUnit unit, bool active);
|
||||
|
||||
//! Request a text message to
|
||||
void requestTextMessageWidget(const swift::misc::aviation::CCallsign &callsign);
|
||||
@@ -107,7 +107,7 @@ namespace swift::gui
|
||||
|
||||
//! @{
|
||||
//! Tune in/invoke
|
||||
void tuneInAtc(misc::aviation::CComSystem::ComUnit unit);
|
||||
void tuneInAtc(misc::aviation::CComSystem::ComUnit unit, bool active);
|
||||
void requestTextMessage();
|
||||
//! @}
|
||||
|
||||
|
||||
@@ -57,26 +57,32 @@ namespace swift::gui::views
|
||||
|
||||
if (this->hasSelection())
|
||||
{
|
||||
if (m_actions.isEmpty()) { m_actions = QList<QAction *>({ nullptr, nullptr, nullptr }); }
|
||||
if (m_actions.isEmpty()) { m_actions = QList<QAction *>({ nullptr, nullptr, nullptr, nullptr, nullptr }); }
|
||||
|
||||
m_actions[0] = menuActions.addAction(m_actions[0], CIcons::appCockpit16(), "Tune in COM1",
|
||||
m_actions[0] = menuActions.addAction(m_actions[0], CIcons::appCockpit16(), "Tune in COM1 (active)",
|
||||
CMenuAction::pathClientCom(),
|
||||
{ this, [this]() { tuneInAtc(CComSystem::Com1); } });
|
||||
m_actions[1] = menuActions.addAction(m_actions[1], CIcons::appCockpit16(), "Tune in COM2",
|
||||
{ this, [this]() { tuneInAtc(CComSystem::Com1, true); } });
|
||||
m_actions[1] = menuActions.addAction(m_actions[1], CIcons::appCockpit16(), "Tune in COM2 (active)",
|
||||
CMenuAction::pathClientCom(),
|
||||
{ this, [this]() { tuneInAtc(CComSystem::Com2); } });
|
||||
m_actions[2] =
|
||||
menuActions.addAction(m_actions[2], CIcons::appTextMessages16(), "Show text messages",
|
||||
{ this, [this]() { tuneInAtc(CComSystem::Com2, true); } });
|
||||
m_actions[2] = menuActions.addAction(m_actions[2], CIcons::appCockpit16(), "Tune in COM1 (standby)",
|
||||
CMenuAction::pathClientCom(),
|
||||
{ this, [this]() { tuneInAtc(CComSystem::Com1, false); } });
|
||||
m_actions[3] = menuActions.addAction(m_actions[3], CIcons::appCockpit16(), "Tune in COM2 (standby)",
|
||||
CMenuAction::pathClientCom(),
|
||||
{ this, [this]() { tuneInAtc(CComSystem::Com2, false); } });
|
||||
m_actions[4] =
|
||||
menuActions.addAction(m_actions[4], CIcons::appTextMessages16(), "Show text messages",
|
||||
CMenuAction::pathClientCom(), { this, &CAtcStationView::requestTextMessage });
|
||||
}
|
||||
CViewBase::customMenu(menuActions);
|
||||
}
|
||||
|
||||
void CAtcStationView::tuneInAtc(const misc::aviation::CComSystem::ComUnit unit)
|
||||
void CAtcStationView::tuneInAtc(const misc::aviation::CComSystem::ComUnit unit, const bool active)
|
||||
{
|
||||
const CAtcStation s(this->selectedObject());
|
||||
if (s.getCallsign().isEmpty()) { return; }
|
||||
emit this->requestComFrequency(s.getFrequency(), unit);
|
||||
emit this->requestComFrequency(s.getFrequency(), unit, active);
|
||||
}
|
||||
|
||||
void CAtcStationView::requestTextMessage()
|
||||
|
||||
@@ -52,7 +52,7 @@ namespace swift::gui
|
||||
|
||||
//! Request COM frequency
|
||||
void requestComFrequency(const swift::misc::physical_quantities::CFrequency &frequency,
|
||||
swift::misc::aviation::CComSystem::ComUnit unit);
|
||||
swift::misc::aviation::CComSystem::ComUnit unit, bool active);
|
||||
|
||||
//! Request a text message to
|
||||
void requestTextMessageWidget(const swift::misc::aviation::CCallsign &callsign);
|
||||
@@ -64,7 +64,7 @@ namespace swift::gui
|
||||
private:
|
||||
void emitTestRequest1kAtcOnlineDummies() { emit this->testRequestDummyAtcOnlineStations(1000); }
|
||||
void emitTestRequest3kAtcOnlineDummies() { emit this->testRequestDummyAtcOnlineStations(3000); }
|
||||
void tuneInAtc(misc::aviation::CComSystem::ComUnit unit);
|
||||
void tuneInAtc(misc::aviation::CComSystem::ComUnit unit, bool active);
|
||||
void requestTextMessage();
|
||||
|
||||
QList<QAction *> m_actions; //!< real actions
|
||||
|
||||
Reference in New Issue
Block a user