mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-30 20:15:35 +08:00
Ref T259, Ref T243 FSD setup gnd flag handling
This commit is contained in:
@@ -24,6 +24,9 @@ namespace BlackMisc
|
||||
{
|
||||
namespace Network
|
||||
{
|
||||
CFsdSetup::CFsdSetup(SendReceiveDetails sendReceive) : m_sendReceive(sendReceive)
|
||||
{ }
|
||||
|
||||
CFsdSetup::CFsdSetup(const QString &codec, SendReceiveDetails sendReceive)
|
||||
: m_textCodec(codec), m_sendReceive(sendReceive) {}
|
||||
|
||||
@@ -41,26 +44,30 @@ namespace BlackMisc
|
||||
|
||||
QString CFsdSetup::sendReceiveDetailsToString(SendReceiveDetails details)
|
||||
{
|
||||
static const QString ds("Send parts; %1 interim: %2 Receive parts: %3 interim: %4");
|
||||
static const QString ds("Send parts; %1 gnd: %2 interim: %3 Receive parts: %4 gnd: %5 interim: %6");
|
||||
return ds.arg(boolToYesNo(details.testFlag(SendAircraftParts)),
|
||||
boolToYesNo(details.testFlag(SendIterimPositions)),
|
||||
boolToYesNo(details.testFlag(SendGndFlag)),
|
||||
boolToYesNo(details.testFlag(SendInterimPositions)),
|
||||
boolToYesNo(details.testFlag(ReceiveAircraftParts)),
|
||||
boolToYesNo(details.testFlag(ReceiveGndFlag)),
|
||||
boolToYesNo(details.testFlag(ReceiveInterimPositions)));
|
||||
}
|
||||
|
||||
void CFsdSetup::setSendReceiveDetails(bool partsSend, bool partsReceive, bool interimSend, bool interimReceive)
|
||||
void CFsdSetup::setSendReceiveDetails(bool partsSend, bool partsReceive, bool gndSend, bool gndReceive, bool interimSend, bool interimReceive)
|
||||
{
|
||||
SendReceiveDetails s = Nothing;
|
||||
if (partsSend) { s |= SendAircraftParts; }
|
||||
if (partsSend) { s |= SendAircraftParts; }
|
||||
if (partsReceive) { s |= ReceiveAircraftParts; }
|
||||
if (interimSend) { s |= SendIterimPositions; }
|
||||
if (gndSend) { s |= SendGndFlag; }
|
||||
if (gndReceive) { s |= ReceiveGndFlag; }
|
||||
if (interimSend) { s |= SendInterimPositions; }
|
||||
if (interimReceive) { s |= ReceiveInterimPositions; }
|
||||
this->setSendReceiveDetails(s);
|
||||
}
|
||||
|
||||
const CFsdSetup &CFsdSetup::vatsimStandard()
|
||||
{
|
||||
static const CFsdSetup s;
|
||||
static const CFsdSetup s(AllWithoutGnd);
|
||||
return s;
|
||||
}
|
||||
|
||||
|
||||
@@ -33,27 +33,35 @@ namespace BlackMisc
|
||||
//! Properties by index
|
||||
enum ColumnIndex
|
||||
{
|
||||
IndexTextCodec = BlackMisc::CPropertyIndex::GlobalIndexCFsdSetup,
|
||||
IndexTextCodec = CPropertyIndex::GlobalIndexCFsdSetup,
|
||||
IndexSendReceiveDetails
|
||||
};
|
||||
|
||||
//! Send/receive details
|
||||
enum SendReceiveDetailsFlag
|
||||
{
|
||||
Nothing = 0, //!< nothing
|
||||
SendAircraftParts = 1 << 0, //!< aircraft parts out
|
||||
SendIterimPositions = 1 << 1, //!< interim positions in
|
||||
ReceiveAircraftParts = 1 << 2, //!< fast position updates out
|
||||
ReceiveInterimPositions = 1 << 3, //!< fast position updates in
|
||||
AllSending = SendAircraftParts | SendIterimPositions, //!< all out
|
||||
AllReceive = ReceiveAircraftParts | ReceiveInterimPositions, //!< all in
|
||||
All = AllReceive | AllSending //!< all
|
||||
Nothing = 0, //!< nothing
|
||||
SendAircraftParts = 1 << 0, //!< aircraft parts out
|
||||
SendInterimPositions = 1 << 1, //!< interim positions out
|
||||
SendGndFlag = 1 << 2, //!< gnd.flag out (position)
|
||||
ReceiveAircraftParts = 1 << 3, //!< aircraft parts in
|
||||
ReceiveInterimPositions = 1 << 4, //!< fast position updates in
|
||||
ReceiveGndFlag = 1 << 5, //!< gnd.flag in (position)
|
||||
AllSending = SendAircraftParts | SendInterimPositions | SendGndFlag, //!< all out
|
||||
AllReceive = ReceiveAircraftParts | ReceiveInterimPositions | ReceiveGndFlag, //!< all in
|
||||
All = AllReceive | AllSending, //!< all
|
||||
AllSendingWithoutGnd = SendAircraftParts | SendInterimPositions, //!< all out, but no gnd.flag
|
||||
AllReceiveWithoutGnd = ReceiveAircraftParts | ReceiveInterimPositions, //!< all in, but no gnd.flag
|
||||
AllWithoutGnd = AllReceiveWithoutGnd | AllSendingWithoutGnd //!< all, but no gnd.flag
|
||||
};
|
||||
Q_DECLARE_FLAGS(SendReceiveDetails, SendReceiveDetailsFlag)
|
||||
|
||||
//! Default constructor.
|
||||
CFsdSetup() {}
|
||||
|
||||
//! Constructor.
|
||||
CFsdSetup(SendReceiveDetails sendReceive);
|
||||
|
||||
//! Constructor.
|
||||
CFsdSetup(const QString &codec, SendReceiveDetails sendReceive = All);
|
||||
|
||||
@@ -70,16 +78,27 @@ namespace BlackMisc
|
||||
void setSendReceiveDetails(SendReceiveDetails sendReceive) { m_sendReceive = sendReceive; }
|
||||
|
||||
//! Set send / receive details
|
||||
void setSendReceiveDetails(bool partsSend, bool partsReceive, bool interimSend, bool interimReceive);
|
||||
void setSendReceiveDetails(bool partsSend, bool partsReceive, bool gndSend, bool gndReceive, bool interimSend, bool interimReceive);
|
||||
|
||||
//! FSD setup flags
|
||||
//! @{
|
||||
bool sendAircraftParts() const { return this->getSendReceiveDetails().testFlag(SendAircraftParts); }
|
||||
bool sendGndFlag() const { return this->getSendReceiveDetails().testFlag(SendGndFlag); }
|
||||
bool sendInterimPositions() const { return this->getSendReceiveDetails().testFlag(SendInterimPositions); }
|
||||
|
||||
bool receiveAircraftParts() const { return this->getSendReceiveDetails().testFlag(ReceiveAircraftParts); }
|
||||
bool receiveGndFlag() const { return this->getSendReceiveDetails().testFlag(ReceiveGndFlag); }
|
||||
bool receiveInterimPositions() const { return this->getSendReceiveDetails().testFlag(ReceiveInterimPositions); }
|
||||
//! @}
|
||||
|
||||
//! Validate, provide details about issues
|
||||
BlackMisc::CStatusMessageList validate() const;
|
||||
CStatusMessageList validate() const;
|
||||
|
||||
//! \copydoc BlackMisc::Mixin::Index::propertyByIndex
|
||||
CVariant propertyByIndex(const BlackMisc::CPropertyIndex &index) const;
|
||||
CVariant propertyByIndex(const CPropertyIndex &index) const;
|
||||
|
||||
//! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex
|
||||
void setPropertyByIndex(const BlackMisc::CPropertyIndex &index, const CVariant &variant);
|
||||
void setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant);
|
||||
|
||||
//! \copydoc BlackMisc::Mixin::String::toQString()
|
||||
QString convertToQString(bool i18n = false) const;
|
||||
|
||||
Reference in New Issue
Block a user