mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-30 11:55:35 +08:00
Ref T409, mark client as "swift" client
This commit is contained in:
@@ -495,6 +495,11 @@ namespace BlackCore
|
||||
return m_airspace->setClientGndCapability(callsign, supportGndFlag);
|
||||
}
|
||||
|
||||
void CContextNetwork::markAsSwiftClient(const CCallsign &callsign)
|
||||
{
|
||||
m_airspace->markAsSwiftClient(callsign);
|
||||
}
|
||||
|
||||
CServerList CContextNetwork::getVatsimFsdServers() const
|
||||
{
|
||||
Q_ASSERT_X(sApp->getWebDataServices(), Q_FUNC_INFO, "Missing data reader");
|
||||
|
||||
@@ -131,6 +131,7 @@ namespace BlackCore
|
||||
virtual bool autoAdjustCientGndCapability(const BlackMisc::Aviation::CAircraftSituation &situation) override;
|
||||
virtual bool addClientGndCapability(const BlackMisc::Aviation::CCallsign &callsign) override;
|
||||
virtual bool setClientGndCapability(const BlackMisc::Aviation::CCallsign &callsign, bool supportGndFlag) override;
|
||||
virtual void markAsSwiftClient(const BlackMisc::Aviation::CCallsign &callsign) override;
|
||||
//! @}
|
||||
|
||||
//! \copydoc IContextNetwork::connectRawFsdMessageSignal
|
||||
|
||||
@@ -97,6 +97,14 @@ namespace BlackMisc
|
||||
if (!modelString.isEmpty()) { this->addCapability(CClient::FsdModelString); }
|
||||
}
|
||||
|
||||
CIcon CClient::toIcon() const
|
||||
{
|
||||
if (!m_swift) { return m_user.toIcon(); }
|
||||
|
||||
static const CIcon swift = CIconList::allIcons().findByIndex(CIcons::Swift16);
|
||||
return swift;
|
||||
}
|
||||
|
||||
CVariant CClient::propertyByIndex(const CPropertyIndex &index) const
|
||||
{
|
||||
if (index.isMyself()) { return CVariant::from(*this); }
|
||||
|
||||
@@ -128,7 +128,13 @@ namespace BlackMisc
|
||||
const QString &getServer() const { return m_server; }
|
||||
|
||||
//! Server
|
||||
void setServer(const QString &server) { m_server = server;}
|
||||
void setServer(const QString &server) { m_server = server; }
|
||||
|
||||
//! Another swift client?
|
||||
bool isSwiftClient() const { return m_swift; }
|
||||
|
||||
//! Mark as other swift client
|
||||
void setSwiftClient(bool isSwift) { m_swift = isSwift; }
|
||||
|
||||
//! Model
|
||||
const QString &getQueriedModelString() const { return m_modelString; }
|
||||
@@ -140,7 +146,7 @@ namespace BlackMisc
|
||||
void setQueriedModelString(const QString &modelString);
|
||||
|
||||
//! \copydoc BlackMisc::Mixin::Icon::toIcon()
|
||||
CIcon toIcon() const { return m_user.toIcon(); }
|
||||
CIcon toIcon() const;
|
||||
|
||||
//! \copydoc BlackMisc::Mixin::Index::propertyByIndex
|
||||
CVariant propertyByIndex(const BlackMisc::CPropertyIndex &index) const;
|
||||
@@ -153,7 +159,8 @@ namespace BlackMisc
|
||||
|
||||
private:
|
||||
CUser m_user;
|
||||
int m_capabilities = static_cast<int>(None);
|
||||
int m_capabilities = static_cast<int>(None);
|
||||
bool m_swift = false; // another swift client
|
||||
QString m_modelString;
|
||||
QString m_server;
|
||||
CVoiceCapabilities m_voiceCapabilities;
|
||||
@@ -161,6 +168,7 @@ namespace BlackMisc
|
||||
BLACK_METACLASS(
|
||||
CClient,
|
||||
BLACK_METAMEMBER(user),
|
||||
BLACK_METAMEMBER(swift),
|
||||
BLACK_METAMEMBER(modelString),
|
||||
BLACK_METAMEMBER(capabilities),
|
||||
BLACK_METAMEMBER(server),
|
||||
|
||||
@@ -132,6 +132,13 @@ namespace BlackMisc
|
||||
return true;
|
||||
}
|
||||
|
||||
void CClientProvider::markAsSwiftClient(const CCallsign &callsign)
|
||||
{
|
||||
QWriteLocker l(&m_lockClient);
|
||||
if (!m_clients.contains(callsign)) { return; }
|
||||
return m_clients[callsign].setSwiftClient(true);
|
||||
}
|
||||
|
||||
// Pin the vtable to this file
|
||||
void CClientAware::anchor()
|
||||
{ }
|
||||
@@ -184,6 +191,12 @@ namespace BlackMisc
|
||||
return false;
|
||||
}
|
||||
|
||||
void CClientAware::markAsSwiftClient(const CCallsign &callsign)
|
||||
{
|
||||
if (!this->provider()) { return; }
|
||||
this->provider()->markAsSwiftClient(callsign);
|
||||
}
|
||||
|
||||
CClientProviderDummy *CClientProviderDummy::instance()
|
||||
{
|
||||
static CClientProviderDummy *dummy = new CClientProviderDummy();
|
||||
|
||||
@@ -78,6 +78,10 @@ namespace BlackMisc
|
||||
//! Set gnd.flag capability
|
||||
//! \threadsafe
|
||||
virtual bool setClientGndCapability(const Aviation::CCallsign &callsign, bool supportGndFlag) = 0;
|
||||
|
||||
//! Mark as other swift client
|
||||
//! \threadsafe
|
||||
virtual void markAsSwiftClient(const Aviation::CCallsign &callsign) = 0;
|
||||
};
|
||||
|
||||
//! Direct in memory access to client (network client) data
|
||||
@@ -99,6 +103,7 @@ namespace BlackMisc
|
||||
virtual bool autoAdjustCientGndCapability(const Aviation::CAircraftSituation &situation) override;
|
||||
virtual bool addClientGndCapability(const Aviation::CCallsign &callsign) override;
|
||||
virtual bool setClientGndCapability(const Aviation::CCallsign &callsign, bool supportGndFlag) override;
|
||||
virtual void markAsSwiftClient(const Aviation::CCallsign &callsign) override;
|
||||
//! @}
|
||||
|
||||
private:
|
||||
@@ -145,6 +150,9 @@ namespace BlackMisc
|
||||
//! \copydoc CClientProvider::addClientGndCapability
|
||||
bool addClientGndCapability(const Aviation::CCallsign &callsign);
|
||||
|
||||
//! \copydoc CClientProvider::markAsSwiftClient
|
||||
void markAsSwiftClient(const Aviation::CCallsign &callsign);
|
||||
|
||||
//! Provider
|
||||
void setClientProvider(CClientProvider *provider) { this->setProvider(provider); }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user