mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-15 09:15:34 +08:00
refs #873, allow null for lights
This commit is contained in:
committed by
Mathew Sutcliffe
parent
34f3de0dfb
commit
36fb62a6fe
@@ -10,6 +10,7 @@
|
|||||||
#include "blackmisc/aviation/aircraftlights.h"
|
#include "blackmisc/aviation/aircraftlights.h"
|
||||||
#include "blackmisc/stringutils.h"
|
#include "blackmisc/stringutils.h"
|
||||||
#include "blackmisc/variant.h"
|
#include "blackmisc/variant.h"
|
||||||
|
#include <QStringBuilder>
|
||||||
|
|
||||||
using namespace BlackMisc;
|
using namespace BlackMisc;
|
||||||
|
|
||||||
@@ -18,6 +19,11 @@ namespace BlackMisc
|
|||||||
namespace Aviation
|
namespace Aviation
|
||||||
{
|
{
|
||||||
|
|
||||||
|
CAircraftLights::CAircraftLights(std::nullptr_t null) : m_isNull(true)
|
||||||
|
{
|
||||||
|
Q_UNUSED(null);
|
||||||
|
}
|
||||||
|
|
||||||
CAircraftLights::CAircraftLights(bool strobeOn, bool landingOn, bool taxiOn, bool beaconOn, bool navOn, bool logoOn)
|
CAircraftLights::CAircraftLights(bool strobeOn, bool landingOn, bool taxiOn, bool beaconOn, bool navOn, bool logoOn)
|
||||||
: m_strobeOn(strobeOn), m_landingOn(landingOn), m_taxiOn(taxiOn), m_beaconOn(beaconOn), m_navOn(navOn), m_logoOn(logoOn)
|
: m_strobeOn(strobeOn), m_landingOn(landingOn), m_taxiOn(taxiOn), m_beaconOn(beaconOn), m_navOn(navOn), m_logoOn(logoOn)
|
||||||
{ }
|
{ }
|
||||||
@@ -34,19 +40,12 @@ namespace BlackMisc
|
|||||||
|
|
||||||
QString CAircraftLights::convertToQString(bool /** i18n */) const
|
QString CAircraftLights::convertToQString(bool /** i18n */) const
|
||||||
{
|
{
|
||||||
QString s;
|
const QString s = QLatin1Literal("strobe: ") % boolToYesNo(m_strobeOn) %
|
||||||
s += " strobe: ";
|
QLatin1Literal(" landing: ") % boolToYesNo(m_landingOn) %
|
||||||
s += boolToYesNo(m_strobeOn);
|
QLatin1Literal(" taxi: ") % boolToYesNo(m_taxiOn) %
|
||||||
s += " landing: ";
|
QLatin1Literal(" beacon: ") % boolToYesNo(m_beaconOn) %
|
||||||
s += boolToYesNo(m_landingOn);
|
QLatin1Literal(" nav: ") % boolToYesNo(m_navOn) %
|
||||||
s += " taxi: ";
|
QLatin1Literal(" logo: ") % boolToYesNo(m_logoOn);
|
||||||
s += boolToYesNo(m_taxiOn);
|
|
||||||
s += " beacon: ";
|
|
||||||
s += boolToYesNo(m_beaconOn);
|
|
||||||
s += " nav: ";
|
|
||||||
s += boolToYesNo(m_navOn);
|
|
||||||
s += " logo: ";
|
|
||||||
s += boolToYesNo(m_logoOn);
|
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -43,6 +43,9 @@ namespace BlackMisc
|
|||||||
//! Default constructor
|
//! Default constructor
|
||||||
CAircraftLights() = default;
|
CAircraftLights() = default;
|
||||||
|
|
||||||
|
//! Constructor, init to null
|
||||||
|
CAircraftLights(std::nullptr_t null);
|
||||||
|
|
||||||
//! Constructor
|
//! Constructor
|
||||||
CAircraftLights(bool strobeOn, bool landingOn, bool taxiOn, bool beaconOn, bool navOn, bool logoOn);
|
CAircraftLights(bool strobeOn, bool landingOn, bool taxiOn, bool beaconOn, bool navOn, bool logoOn);
|
||||||
|
|
||||||
@@ -94,6 +97,9 @@ namespace BlackMisc
|
|||||||
//! All off
|
//! All off
|
||||||
void setAllOff();
|
void setAllOff();
|
||||||
|
|
||||||
|
//! Is null;
|
||||||
|
bool isNull() const { return m_isNull; }
|
||||||
|
|
||||||
//! Returns object with all lights switched on
|
//! Returns object with all lights switched on
|
||||||
static CAircraftLights allLightsOn();
|
static CAircraftLights allLightsOn();
|
||||||
|
|
||||||
@@ -110,6 +116,7 @@ namespace BlackMisc
|
|||||||
bool m_beaconOn = false;
|
bool m_beaconOn = false;
|
||||||
bool m_navOn = false;
|
bool m_navOn = false;
|
||||||
bool m_logoOn = false;
|
bool m_logoOn = false;
|
||||||
|
bool m_isNull = false; //!< mark as null
|
||||||
|
|
||||||
BLACK_METACLASS(
|
BLACK_METACLASS(
|
||||||
CAircraftLights,
|
CAircraftLights,
|
||||||
|
|||||||
Reference in New Issue
Block a user