Tweak in icon / callsign

* conversion to Icon in callsign
* toQIcon function
This commit is contained in:
Klaus Basan
2015-01-22 11:05:25 +01:00
parent 65957c0ebe
commit b629a9325b
4 changed files with 36 additions and 14 deletions

View File

@@ -41,17 +41,7 @@ namespace BlackMisc
{
if (callsign.hasSuffix())
{
QString t = callsign.getSuffix();
if (t.length() < 3) { return CIconList::iconByIndex(CIcons::NetworkRoleUnknown); }
if ("APP" == t) { return CIconList::iconByIndex(CIcons::NetworkRoleApproach); }
if ("GND" == t) { return CIconList::iconByIndex(CIcons::NetworkRoleGround); }
if ("TWR" == t) { return CIconList::iconByIndex(CIcons::NetworkRoleTower); }
if ("DEL" == t) { return CIconList::iconByIndex(CIcons::NetworkRoleDelivery); }
if ("CTR" == t) { return CIconList::iconByIndex(CIcons::NetworkRoleCenter); }
if ("SUP" == t) { return CIconList::iconByIndex(CIcons::NetworkRoleSup); }
if ("OBS" == t) { return CIconList::iconByIndex(CIcons::NetworkRoleObs); }
if ("ATIS" == t) { return CIconList::iconByIndex(CIcons::AviationAtis); }
return CIconList::iconByIndex(CIcons::NetworkRoleUnknown);
return suffixToIcon(callsign.getSuffix());
}
else
{
@@ -59,6 +49,22 @@ namespace BlackMisc
}
}
const CIcon &CCallsign::suffixToIcon(const QString &suffix)
{
if (suffix.length() < 3) { return CIconList::iconByIndex(CIcons::NetworkRoleUnknown); }
QString sfx = suffix.toUpper();
if ("APP" == sfx) { return CIconList::iconByIndex(CIcons::NetworkRoleApproach); }
if ("GND" == sfx) { return CIconList::iconByIndex(CIcons::NetworkRoleGround); }
if ("TWR" == sfx) { return CIconList::iconByIndex(CIcons::NetworkRoleTower); }
if ("DEL" == sfx) { return CIconList::iconByIndex(CIcons::NetworkRoleDelivery); }
if ("CTR" == sfx) { return CIconList::iconByIndex(CIcons::NetworkRoleCenter); }
if ("SUP" == sfx) { return CIconList::iconByIndex(CIcons::NetworkRoleSup); }
if ("OBS" == sfx) { return CIconList::iconByIndex(CIcons::NetworkRoleObs); }
if ("ATIS" == sfx) { return CIconList::iconByIndex(CIcons::AviationAtis); }
if ("VATSIM" == sfx) { return CIconList::iconByIndex(CIcons::NetworkRoleMnt); }
return CIconList::iconByIndex(CIcons::NetworkRoleUnknown);
}
/*
* ATC callsign?
*/
@@ -195,5 +201,6 @@ namespace BlackMisc
return a;
}
} // namespace
} // namespace