mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-06 10:15:38 +08:00
Ref T272, skip VATSIM readers if (for sure) connected to an other eco system
Remark: This requires the server (=> ecosystem) to be connected, otherwise VATSIM data (before that connection) are still read as default
This commit is contained in:
@@ -31,6 +31,11 @@ namespace BlackMisc
|
||||
return this->getCurrentEcosystem() == system;
|
||||
}
|
||||
|
||||
bool IEcosystemProvider::isCurrentEcosystemVATSIM() const
|
||||
{
|
||||
return this->isCurrentEcosystem(CEcosystem::vatsim());
|
||||
}
|
||||
|
||||
bool IEcosystemProvider::isLastEcosystem(const CEcosystem &system) const
|
||||
{
|
||||
return this->getLastEcosystem() == system;
|
||||
@@ -70,10 +75,29 @@ namespace BlackMisc
|
||||
return this->provider()->isCurrentEcosystem(system);
|
||||
}
|
||||
|
||||
bool CEcosystemAware::isCurrentEcosystemVATSIM() const
|
||||
{
|
||||
return this->isCurrentEcosystem(CEcosystem::vatsim());
|
||||
}
|
||||
|
||||
bool CEcosystemAware::isNotVATSIMEcosystem() const
|
||||
{
|
||||
if (!this->hasProvider()) { return false; }
|
||||
if (this->isCurrentEcosystemVATSIM()) { return false; }
|
||||
if (this->isCurrentEcosystem(CEcosystem::swiftTest())) { return false; } // our test server is supposed to be I VATSIM system
|
||||
return !this->getCurrentEcosystem().isUnspecified(); // other know system which is specified
|
||||
}
|
||||
|
||||
bool CEcosystemAware::isLastEcosystem(const CEcosystem &system) const
|
||||
{
|
||||
if (!this->hasProvider()) { return this->getLastEcosystem() == system; }
|
||||
return this->provider()->isLastEcosystem(system);
|
||||
}
|
||||
|
||||
IEcosystemProvider *CEcosystemAware::providerIfPossible(QObject *object)
|
||||
{
|
||||
IEcosystemProvider *p = qobject_cast<IEcosystemProvider *>(object);
|
||||
return p;
|
||||
}
|
||||
} // namespace
|
||||
} // namespace
|
||||
|
||||
@@ -37,6 +37,10 @@ namespace BlackMisc
|
||||
//! \threadsafe
|
||||
bool isCurrentEcosystem(const CEcosystem &system) const;
|
||||
|
||||
//! Current ecosystem VATSIM?
|
||||
//! \threadsafe
|
||||
bool isCurrentEcosystemVATSIM() const;
|
||||
|
||||
//! Last known ecosystem?
|
||||
//! \threadsafe
|
||||
bool isLastEcosystem(const CEcosystem &system) const;
|
||||
@@ -72,9 +76,19 @@ namespace BlackMisc
|
||||
//! \copydoc IEcosystemProvider::isCurrentEcosystem
|
||||
bool isCurrentEcosystem(const CEcosystem &system) const;
|
||||
|
||||
//! \copydoc IEcosystemProvider::isCurrentEcosystemVATSIM
|
||||
bool isCurrentEcosystemVATSIM() const;
|
||||
|
||||
//! Connected with other system than VATSIM?
|
||||
//! \remark use this function to skip VATSIM specific provider tasks etc.
|
||||
bool isNotVATSIMEcosystem() const;
|
||||
|
||||
//! \copydoc IEcosystemProvider::isLastEcosystem
|
||||
bool isLastEcosystem(const CEcosystem &system) const;
|
||||
|
||||
//! Cast as provider if possible
|
||||
static IEcosystemProvider *providerIfPossible(QObject *object);
|
||||
|
||||
protected:
|
||||
//! Constructor
|
||||
CEcosystemAware(IEcosystemProvider *EcosystemProvider) : IProviderAware(EcosystemProvider) { Q_ASSERT(EcosystemProvider); }
|
||||
|
||||
Reference in New Issue
Block a user