mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-07 11:05:33 +08:00
Issue #77 toIcon returns a simple enum instead of a full object
This commit is contained in:
@@ -122,9 +122,9 @@ namespace BlackMisc
|
||||
return this->hasBulkRole() || this->hasBulkAddRole();
|
||||
}
|
||||
|
||||
CIcon CAuthenticatedUser::toIcon() const
|
||||
CIcons::IconIndex CAuthenticatedUser::toIcon() const
|
||||
{
|
||||
return CIcon::iconByIndex(CIcons::StandardIconUser16);
|
||||
return CIcons::StandardIconUser16;
|
||||
}
|
||||
|
||||
CVariant CAuthenticatedUser::propertyByIndex(const BlackMisc::CPropertyIndex &index) const
|
||||
|
||||
@@ -155,7 +155,7 @@ namespace BlackMisc
|
||||
bool canDirectlyWriteModels() const;
|
||||
|
||||
//! \copydoc BlackMisc::Mixin::Icon::toIcon()
|
||||
BlackMisc::CIcon toIcon() const;
|
||||
BlackMisc::CIcons::IconIndex toIcon() const;
|
||||
|
||||
//! \copydoc BlackMisc::Mixin::Index::propertyByIndex
|
||||
CVariant propertyByIndex(const BlackMisc::CPropertyIndex &index) const;
|
||||
|
||||
@@ -96,12 +96,11 @@ namespace BlackMisc
|
||||
if (!modelString.isEmpty()) { this->addCapability(CClient::FsdModelString); }
|
||||
}
|
||||
|
||||
CIcon CClient::toIcon() const
|
||||
CIcons::IconIndex CClient::toIcon() const
|
||||
{
|
||||
if (!m_swift) { return m_user.toIcon(); }
|
||||
|
||||
static const CIcon swift = CIconList::allIcons().findByIndex(CIcons::Swift16);
|
||||
return swift;
|
||||
return CIcons::Swift16;
|
||||
}
|
||||
|
||||
CVariant CClient::propertyByIndex(const CPropertyIndex &index) const
|
||||
@@ -117,8 +116,8 @@ namespace BlackMisc
|
||||
case IndexModelString: return CVariant(m_modelString);
|
||||
case IndexServer: return CVariant(m_server);
|
||||
case IndexVoiceCapabilities: return m_voiceCapabilities.propertyByIndex(index.copyFrontRemoved());
|
||||
case IndexVoiceCapabilitiesPixmap: return CVariant::from(m_voiceCapabilities.toPixmap());
|
||||
case IndexVoiceCapabilitiesIcon: return CVariant::fromValue(m_voiceCapabilities.toIcon());
|
||||
case IndexVoiceCapabilitiesPixmap: return CVariant::from(CIcon(m_voiceCapabilities.toIcon()).toPixmap());
|
||||
case IndexVoiceCapabilitiesIcon: return CVariant::from(CIcon(m_voiceCapabilities.toIcon()));
|
||||
case IndexVoiceCapabilitiesString: return CVariant(m_voiceCapabilities.toQString(true));
|
||||
default: break;
|
||||
}
|
||||
|
||||
@@ -145,7 +145,7 @@ namespace BlackMisc
|
||||
void setQueriedModelString(const QString &modelString);
|
||||
|
||||
//! \copydoc BlackMisc::Mixin::Icon::toIcon()
|
||||
CIcon toIcon() const;
|
||||
CIcons::IconIndex toIcon() const;
|
||||
|
||||
//! \copydoc BlackMisc::Mixin::Index::propertyByIndex
|
||||
CVariant propertyByIndex(const BlackMisc::CPropertyIndex &index) const;
|
||||
|
||||
@@ -72,17 +72,17 @@ namespace BlackMisc
|
||||
}
|
||||
}
|
||||
|
||||
CIcon CEcosystem::toIcon() const
|
||||
CIcons::IconIndex CEcosystem::toIcon() const
|
||||
{
|
||||
switch (this->getSystem())
|
||||
{
|
||||
case VATSIM: return CIconList::allIcons().findByIndex(CIcons::NetworkVatsimLogo);
|
||||
case Swift: return CIconList::allIcons().findByIndex(CIcons::Swift24);
|
||||
case SwiftTest: return CIconList::allIcons().findByIndex(CIcons::Swift24);
|
||||
case PrivateFSD: return CIconList::allIcons().findByIndex(CIcons::StandardIconAppAircraft16);
|
||||
case NoSystem: return CIconList::allIcons().findByIndex(CIcons::StandardIconCrossCircle16);
|
||||
case VATSIM: return CIcons::NetworkVatsimLogo;
|
||||
case Swift: return CIcons::Swift24;
|
||||
case SwiftTest: return CIcons::Swift24;
|
||||
case PrivateFSD: return CIcons::StandardIconAppAircraft16;
|
||||
case NoSystem: return CIcons::StandardIconCrossCircle16;
|
||||
case Unspecified:
|
||||
default: return CIconList::allIcons().findByIndex(CIcons::StandardIconUnknown16);
|
||||
default: return CIcons::StandardIconUnknown16;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ namespace BlackMisc
|
||||
const QString &getSystemString() const;
|
||||
|
||||
//! \copydoc BlackMisc::Mixin::Icon::toIcon()
|
||||
CIcon toIcon() const;
|
||||
CIcons::IconIndex toIcon() const;
|
||||
|
||||
//! \copydoc BlackMisc::Mixin::Index::propertyByIndex
|
||||
CVariant propertyByIndex(const BlackMisc::CPropertyIndex &index) const;
|
||||
|
||||
@@ -292,14 +292,14 @@ namespace BlackMisc
|
||||
return std::move(candidate).right(4).toUpper();
|
||||
}
|
||||
|
||||
CIcon CTextMessage::toIcon() const
|
||||
CIcons::IconIndex CTextMessage::toIcon() const
|
||||
{
|
||||
return m_senderCallsign.toIcon();
|
||||
}
|
||||
|
||||
QPixmap CTextMessage::toPixmap() const
|
||||
{
|
||||
return m_senderCallsign.toPixmap();
|
||||
return CIcon(toIcon()).toPixmap();
|
||||
}
|
||||
|
||||
CVariant CTextMessage::propertyByIndex(const BlackMisc::CPropertyIndex &index) const
|
||||
|
||||
@@ -181,7 +181,7 @@ namespace BlackMisc
|
||||
QString getSelcalCode() const;
|
||||
|
||||
//! As icon, not implement by all classes
|
||||
CIcon toIcon() const;
|
||||
CIcons::IconIndex toIcon() const;
|
||||
|
||||
//! As pixmap, required for most GUI views
|
||||
QPixmap toPixmap() const;
|
||||
|
||||
@@ -152,7 +152,7 @@ namespace BlackMisc
|
||||
bool setCallsign(const Aviation::CCallsign &callsign);
|
||||
|
||||
//! \copydoc BlackMisc::Mixin::Icon::toIcon()
|
||||
CIcon toIcon() const { return this->getCallsign().toIcon(); }
|
||||
CIcons::IconIndex toIcon() const { return this->getCallsign().toIcon(); }
|
||||
|
||||
//! \copydoc BlackMisc::Mixin::Index::propertyByIndex
|
||||
CVariant propertyByIndex(const CPropertyIndex &index) const;
|
||||
|
||||
@@ -80,18 +80,18 @@ namespace BlackMisc
|
||||
this->setCapabilities(Unknown);
|
||||
}
|
||||
|
||||
CIcon CVoiceCapabilities::toIcon() const
|
||||
CIcons::IconIndex CVoiceCapabilities::toIcon() const
|
||||
{
|
||||
switch (m_voiceCapabilities)
|
||||
{
|
||||
case Voice: return CIcon::iconByIndex(CIcons::NetworkCapabilityVoiceBackground);
|
||||
case TextOnly: return CIcon::iconByIndex(CIcons::NetworkCapabilityTextOnly);
|
||||
case VoiceReceivingOnly: return CIcon::iconByIndex(CIcons::NetworkCapabilityVoiceReceiveOnlyBackground);
|
||||
case Unknown: return CIcon::iconByIndex(CIcons::NetworkCapabilityUnknown);
|
||||
case Voice: return CIcons::NetworkCapabilityVoiceBackground;
|
||||
case TextOnly: return CIcons::NetworkCapabilityTextOnly;
|
||||
case VoiceReceivingOnly: return CIcons::NetworkCapabilityVoiceReceiveOnlyBackground;
|
||||
case Unknown: return CIcons::NetworkCapabilityUnknown;
|
||||
default: break;
|
||||
}
|
||||
Q_ASSERT_X(false, Q_FUNC_INFO, "Illegal mode");
|
||||
return CIcon::iconByIndex(CIcons::NetworkCapabilityUnknown); // never reached
|
||||
return CIcons::NetworkCapabilityUnknown; // never reached
|
||||
}
|
||||
|
||||
const CVoiceCapabilities &CVoiceCapabilities::fromVoiceCapabilities(CVoiceCapabilities::VoiceCapabilities capabilities)
|
||||
|
||||
@@ -65,7 +65,7 @@ namespace BlackMisc
|
||||
static const QList<CVoiceCapabilities> &allCapabilities();
|
||||
|
||||
//! \copydoc BlackMisc::Mixin::Icon::toIcon()
|
||||
CIcon toIcon() const;
|
||||
CIcons::IconIndex toIcon() const;
|
||||
|
||||
//! \copydoc BlackMisc::Mixin::String::toQString
|
||||
QString convertToQString(bool i18n = false) const;
|
||||
|
||||
Reference in New Issue
Block a user