feat: Add wing light property

This commit is contained in:
tzobler
2026-01-31 11:11:10 +01:00
committed by Lars Toenning
parent 44272548ad
commit 48f1676f8d
2 changed files with 29 additions and 4 deletions

View File

@@ -23,14 +23,20 @@ namespace swift::misc::aviation
m_logoOn(logoOn), m_recognitionOn(recognition), m_cabinOn(cabin)
{}
CAircraftLights::CAircraftLights(bool strobeOn, bool landingOn, bool taxiOn, bool beaconOn, bool navOn, bool logoOn,
bool recognition, bool cabin, bool wing)
: m_strobeOn(strobeOn), m_landingOn(landingOn), m_taxiOn(taxiOn), m_beaconOn(beaconOn), m_navOn(navOn),
m_logoOn(logoOn), m_recognitionOn(recognition), m_cabinOn(cabin), m_wingOn(wing)
{}
CAircraftLights CAircraftLights::allLightsOn()
{
return CAircraftLights { true, true, true, true, true, true, true, true };
return CAircraftLights { true, true, true, true, true, true, true, true, true };
}
CAircraftLights CAircraftLights::allLightsOff()
{
return CAircraftLights { false, false, false, false, false, false, false, false };
return CAircraftLights { false, false, false, false, false, false, false, false, false };
}
QString CAircraftLights::convertToQString(bool i18n) const
@@ -39,7 +45,8 @@ namespace swift::misc::aviation
const QString s = u"strobe: " % boolToYesNo(m_strobeOn) % u" landing: " % boolToYesNo(m_landingOn) %
u" taxi: " % boolToYesNo(m_taxiOn) % u" beacon: " % boolToYesNo(m_beaconOn) % u" nav: " %
boolToYesNo(m_navOn) % u" logo: " % boolToYesNo(m_logoOn) % u" recognition: " %
boolToYesNo(m_recognitionOn) % u" cabin: " % boolToYesNo(m_cabinOn);
boolToYesNo(m_recognitionOn) % u" cabin: " % boolToYesNo(m_cabinOn) % u" cabin: " %
boolToYesNo(m_wingOn);
return s;
}
@@ -59,6 +66,7 @@ namespace swift::misc::aviation
case IndexTaxi: return QVariant::fromValue(m_taxiOn);
case IndexRecognition: return QVariant::fromValue(m_recognitionOn);
case IndexCabin: return QVariant::fromValue(m_cabinOn);
case IndexWing: return QVariant::fromValue(m_wingOn);
default: return CValueObject::propertyByIndex(index);
}
}
@@ -83,6 +91,7 @@ namespace swift::misc::aviation
case IndexTaxi: m_taxiOn = variant.toBool(); break;
case IndexCabin: m_cabinOn = variant.toBool(); break;
case IndexRecognition: m_recognitionOn = variant.toBool(); break;
case IndexWing: m_wingOn = variant.toBool(); break;
default: CValueObject::setPropertyByIndex(index, variant); break;
}
}
@@ -101,6 +110,7 @@ namespace swift::misc::aviation
case IndexTaxi: return Compare::compare(m_taxiOn, compareValue.isTaxiOn());
case IndexCabin: return Compare::compare(m_cabinOn, compareValue.isCabinOn());
case IndexRecognition: return Compare::compare(m_recognitionOn, compareValue.isRecognitionOn());
case IndexWing: return Compare::compare(m_wingOn, compareValue.isWingOn());
default: break;
}
return 0;
@@ -116,6 +126,7 @@ namespace swift::misc::aviation
m_taxiOn = true;
m_cabinOn = true;
m_recognitionOn = true;
m_wingOn = true;
}
void CAircraftLights::setAllOff()
@@ -128,5 +139,6 @@ namespace swift::misc::aviation
m_taxiOn = false;
m_recognitionOn = false;
m_cabinOn = false;
m_wingOn = false;
}
} // namespace swift::misc::aviation

View File

@@ -33,7 +33,8 @@ namespace swift::misc::aviation
IndexNav,
IndexLogo,
IndexRecognition,
IndexCabin
IndexCabin,
IndexWing,
};
//! Default constructor
@@ -49,6 +50,10 @@ namespace swift::misc::aviation
CAircraftLights(bool strobeOn, bool landingOn, bool taxiOn, bool beaconOn, bool navOn, bool logoOn,
bool recognition, bool cabin);
//! Constructor
CAircraftLights(bool strobeOn, bool landingOn, bool taxiOn, bool beaconOn, bool navOn, bool logoOn,
bool recognitionOn, bool cabin, bool wingOn);
//! Strobes lights on?
bool isStrobeOn() const { return m_strobeOn; }
@@ -97,6 +102,12 @@ namespace swift::misc::aviation
//! Set cabin lights
void setCabinOn(bool on) { m_cabinOn = on; }
//! Wing light on?
bool isWingOn() const { return m_wingOn; }
//! Set wing lights
void setWingOn(bool on) { m_wingOn = on; }
//! All on
void setAllOn();
@@ -137,6 +148,7 @@ namespace swift::misc::aviation
bool m_logoOn = false;
bool m_recognitionOn = false; //!< not supported by aircraft config (VATSIM)
bool m_cabinOn = false; //!< not supported by aircraft config (VATSIM)
bool m_wingOn = false; //!< not supported by aircraft config (VATSIM)
SWIFT_METACLASS(
CAircraftLights,
@@ -149,6 +161,7 @@ namespace swift::misc::aviation
SWIFT_METAMEMBER_NAMED(logoOn, "logo_on"),
SWIFT_METAMEMBER(recognitionOn, 0, DisabledForJson), // disable since JSON is used for network
SWIFT_METAMEMBER(cabinOn, 0, DisabledForJson) // disable since JSON is used for network
SWIFT_METAMEMBER(wingOn, 0, DisabledForJson) // disable since JSON is used for network
);
};
} // namespace swift::misc::aviation