mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-13 15:45:42 +08:00
refs #393, allow to highlight a certain aircraft by blinking
* signatures in contexts * some specialized functions in aircraft list * context menus in aircraft view * default "blinking" implementation in driver common base class
This commit is contained in:
@@ -90,6 +90,12 @@ namespace BlackMisc
|
||||
m_situation.setCallsign(this->getCallsign());
|
||||
}
|
||||
|
||||
void CAircraft::setPilot(const Network::CUser &user)
|
||||
{
|
||||
m_pilot = user;
|
||||
this->m_pilot.setCallsign(this->m_callsign);
|
||||
}
|
||||
|
||||
const CComSystem CAircraft::getComSystem(CComSystem::ComUnit unit) const
|
||||
{
|
||||
switch (unit)
|
||||
@@ -150,12 +156,32 @@ namespace BlackMisc
|
||||
this->setTransponder(xpdr);
|
||||
}
|
||||
|
||||
CAircraftLights CAircraft::getLights() const
|
||||
{
|
||||
return m_parts.getLights();
|
||||
}
|
||||
|
||||
void CAircraft::setParts(const CAircraftParts &parts)
|
||||
{
|
||||
m_parts = parts;
|
||||
m_parts.setCallsign(this->getCallsign());
|
||||
}
|
||||
|
||||
void CAircraft::setLights(CAircraftLights &lights)
|
||||
{
|
||||
m_parts.setLights(lights);
|
||||
}
|
||||
|
||||
void CAircraft::setAllLightsOn()
|
||||
{
|
||||
m_parts.setAllLightsOn();
|
||||
}
|
||||
|
||||
void CAircraft::setAllLightsOff()
|
||||
{
|
||||
m_parts.setAllLightsOff();
|
||||
}
|
||||
|
||||
bool CAircraft::isVtol() const
|
||||
{
|
||||
return m_icao.isVtol();
|
||||
|
||||
@@ -84,7 +84,7 @@ namespace BlackMisc
|
||||
QString getPilotId() { return m_pilot.getId(); }
|
||||
|
||||
//! Set pilot (user)
|
||||
virtual void setPilot(const BlackMisc::Network::CUser &user) { m_pilot = user; this->m_pilot.setCallsign(this->m_callsign);}
|
||||
virtual void setPilot(const BlackMisc::Network::CUser &user);
|
||||
|
||||
//! Get ICAO info
|
||||
const CAircraftIcao &getIcaoInfo() const { return m_icao; }
|
||||
@@ -247,9 +247,21 @@ namespace BlackMisc
|
||||
//! Get aircraft parts
|
||||
const BlackMisc::Aviation::CAircraftParts &getParts() const { return m_parts; }
|
||||
|
||||
//! Get aircraft parts
|
||||
CAircraftLights getLights() const;
|
||||
|
||||
//! Set aircraft parts
|
||||
void setParts(const BlackMisc::Aviation::CAircraftParts &parts);
|
||||
|
||||
//! Set aircraft lights
|
||||
void setLights(BlackMisc::Aviation::CAircraftLights &lights);
|
||||
|
||||
//! Set aircraft lights on
|
||||
void setAllLightsOn();
|
||||
|
||||
//! Set aircraft lights off
|
||||
void setAllLightsOff();
|
||||
|
||||
//! VTOL aircraft?
|
||||
bool isVtol() const;
|
||||
|
||||
|
||||
@@ -107,5 +107,25 @@ namespace BlackMisc
|
||||
}
|
||||
}
|
||||
|
||||
void CAircraftLights::setAllOn()
|
||||
{
|
||||
m_beaconOn = true;
|
||||
m_landingOn = true;
|
||||
m_logoOn = true;
|
||||
m_navOn = true;
|
||||
m_strobeOn = true;
|
||||
m_taxiOn = true;
|
||||
}
|
||||
|
||||
void CAircraftLights::setAllOff()
|
||||
{
|
||||
m_beaconOn = false;
|
||||
m_landingOn = false;
|
||||
m_logoOn = false;
|
||||
m_navOn = false;
|
||||
m_strobeOn = false;
|
||||
m_taxiOn = false;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace
|
||||
|
||||
@@ -83,6 +83,12 @@ namespace BlackMisc
|
||||
//! Set logo lights
|
||||
void setLogoOn(bool on) { m_logoOn = on; }
|
||||
|
||||
//! All on
|
||||
void setAllOn();
|
||||
|
||||
//! All off
|
||||
void setAllOff();
|
||||
|
||||
//! Returns object with all lights switched on
|
||||
static CAircraftLights allLightsOn();
|
||||
|
||||
|
||||
@@ -98,6 +98,16 @@ namespace BlackMisc
|
||||
}
|
||||
}
|
||||
|
||||
void CAircraftParts::setAllLightsOn()
|
||||
{
|
||||
m_lights.setAllOn();
|
||||
}
|
||||
|
||||
void CAircraftParts::setAllLightsOff()
|
||||
{
|
||||
m_lights.setAllOff();
|
||||
}
|
||||
|
||||
CAircraftEngine CAircraftParts::getEngine(int number) const
|
||||
{
|
||||
return this->m_engines.getEngine(number);
|
||||
|
||||
@@ -70,6 +70,12 @@ namespace BlackMisc
|
||||
//! Set aircraft lights
|
||||
void setLights(const CAircraftLights &lights) { m_lights = lights; }
|
||||
|
||||
//! Set all lights on
|
||||
void setAllLightsOn();
|
||||
|
||||
//! Set all lights off
|
||||
void setAllLightsOff();
|
||||
|
||||
//! Is gear down?
|
||||
bool isGearDown() const { return m_gearDown; }
|
||||
|
||||
|
||||
@@ -66,6 +66,60 @@ namespace BlackMisc
|
||||
return csl;
|
||||
}
|
||||
|
||||
void CSimulatedAircraftList::markAllAsNotRendered()
|
||||
{
|
||||
for (CSimulatedAircraft &aircraft : (*this))
|
||||
{
|
||||
if (!aircraft.isRendered()) { continue; }
|
||||
aircraft.setRendered(false);
|
||||
}
|
||||
}
|
||||
|
||||
int CSimulatedAircraftList::setRendered(const CCallsign &callsign, bool rendered)
|
||||
{
|
||||
int c = 0;
|
||||
for (CSimulatedAircraft &aircraft : (*this))
|
||||
{
|
||||
if (aircraft.getCallsign() != callsign) { continue; }
|
||||
aircraft.setRendered(rendered);
|
||||
c++;
|
||||
}
|
||||
return c;
|
||||
}
|
||||
|
||||
int CSimulatedAircraftList::setAircraftParts(const CCallsign &callsign, const CAircraftParts &parts)
|
||||
{
|
||||
int c = 0;
|
||||
for (CSimulatedAircraft &aircraft : (*this))
|
||||
{
|
||||
if (aircraft.getCallsign() != callsign) { continue; }
|
||||
aircraft.setParts(parts);
|
||||
aircraft.setPartsSynchronized(true);
|
||||
c++;
|
||||
}
|
||||
return c;
|
||||
}
|
||||
|
||||
bool CSimulatedAircraftList::isEnabled(const CCallsign &callsign) const
|
||||
{
|
||||
for (const CSimulatedAircraft &aircraft : (*this))
|
||||
{
|
||||
if (aircraft.getCallsign() != callsign) { continue; }
|
||||
return aircraft.isEnabled();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CSimulatedAircraftList::isRendered(const CCallsign &callsign) const
|
||||
{
|
||||
for (const CSimulatedAircraft &aircraft : (*this))
|
||||
{
|
||||
if (aircraft.getCallsign() != callsign) { continue; }
|
||||
return aircraft.isRendered();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
CAircraftList CSimulatedAircraftList::toAircraftList() const
|
||||
{
|
||||
CAircraftList al;
|
||||
|
||||
@@ -46,6 +46,21 @@ namespace BlackMisc
|
||||
//! Callsigns of aircraft with synchronized parts
|
||||
BlackMisc::Aviation::CCallsignList getCallsignsWithSyncronizedParts() const;
|
||||
|
||||
//! Mark all aircraft as unrendered
|
||||
void markAllAsNotRendered();
|
||||
|
||||
//! Mark as rendered
|
||||
int setRendered(const BlackMisc::Aviation::CCallsign &callsign, bool rendered);
|
||||
|
||||
//! Set aircraft parts
|
||||
int setAircraftParts(const BlackMisc::Aviation::CCallsign &callsign, const BlackMisc::Aviation::CAircraftParts &parts);
|
||||
|
||||
//! Enabled?
|
||||
bool isEnabled(const BlackMisc::Aviation::CCallsign &callsign) const;
|
||||
|
||||
//! Rendered?
|
||||
bool isRendered(const BlackMisc::Aviation::CCallsign &callsign) const;
|
||||
|
||||
//! \copydoc CValueObject::toQVariant
|
||||
virtual QVariant toQVariant() const override { return QVariant::fromValue(*this); }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user