Ref T577, added dep. icons support (for ATC suffix) and changed string comparison to QStringView as discussed with MS

This commit is contained in:
Klaus Basan
2019-04-10 18:51:37 +02:00
committed by Mat Sutcliffe
parent 79fc8683f9
commit dd37c7b876
4 changed files with 27 additions and 13 deletions

View File

@@ -86,18 +86,19 @@ namespace BlackMisc
{ {
if (suffix.length() < 3) { return CIcon::iconByIndex(CIcons::NetworkRoleUnknown); } if (suffix.length() < 3) { return CIcon::iconByIndex(CIcons::NetworkRoleUnknown); }
const QString sfx = suffix.toUpper(); const QString sfx = suffix.toUpper();
if ("APP" == sfx) { return CIcon::iconByIndex(CIcons::NetworkRoleApproach); } if (QStringView(u"APP") == sfx) { return CIcon::iconByIndex(CIcons::NetworkRoleApproach); }
if ("GND" == sfx) { return CIcon::iconByIndex(CIcons::NetworkRoleGround); } if (QStringView(u"DEP") == sfx) { return CIcon::iconByIndex(CIcons::NetworkRoleDeparture); }
if ("TWR" == sfx) { return CIcon::iconByIndex(CIcons::NetworkRoleTower); } if (QStringView(u"GND") == sfx) { return CIcon::iconByIndex(CIcons::NetworkRoleGround); }
if ("DEL" == sfx) { return CIcon::iconByIndex(CIcons::NetworkRoleDelivery); } if (QStringView(u"TWR") == sfx) { return CIcon::iconByIndex(CIcons::NetworkRoleTower); }
if ("CTR" == sfx) { return CIcon::iconByIndex(CIcons::NetworkRoleCenter); } if (QStringView(u"DEL") == sfx) { return CIcon::iconByIndex(CIcons::NetworkRoleDelivery); }
if ("SUP" == sfx) { return CIcon::iconByIndex(CIcons::NetworkRoleSup); } if (QStringView(u"CTR") == sfx) { return CIcon::iconByIndex(CIcons::NetworkRoleCenter); }
if ("OBS" == sfx) { return CIcon::iconByIndex(CIcons::NetworkRoleObs); } if (QStringView(u"SUP") == sfx) { return CIcon::iconByIndex(CIcons::NetworkRoleSup); }
if ("INS" == sfx) { return CIcon::iconByIndex(CIcons::NetworkRoleMnt); } if (QStringView(u"OBS") == sfx) { return CIcon::iconByIndex(CIcons::NetworkRoleObs); }
if ("FSS" == sfx) { return CIcon::iconByIndex(CIcons::NetworkRoleFss); } if (QStringView(u"INS") == sfx) { return CIcon::iconByIndex(CIcons::NetworkRoleMnt); }
if ("ATIS" == sfx) { return CIcon::iconByIndex(CIcons::AviationAtis); } if (QStringView(u"FSS") == sfx) { return CIcon::iconByIndex(CIcons::NetworkRoleFss); }
if ("EXAM" == sfx) { return CIcon::iconByIndex(CIcons::NetworkRoleMnt); } if (QStringView(u"ATIS") == sfx) { return CIcon::iconByIndex(CIcons::AviationAtis); }
if ("VATSIM" == sfx) { return CIcon::iconByIndex(CIcons::NetworkVatsimLogoWhite); } if (QStringView(u"EXAM") == sfx) { return CIcon::iconByIndex(CIcons::NetworkRoleMnt); }
if (QStringView(u"VATSIM") == sfx) { return CIcon::iconByIndex(CIcons::NetworkVatsimLogoWhite); }
return CIcon::iconByIndex(CIcons::NetworkRoleUnknown); return CIcon::iconByIndex(CIcons::NetworkRoleUnknown);
} }

View File

@@ -79,6 +79,7 @@ namespace BlackMisc
CIcon(CIcons::NetworkRoleC3, "C3"), CIcon(CIcons::NetworkRoleC3, "C3"),
CIcon(CIcons::NetworkRoleCenter, "ATC center"), CIcon(CIcons::NetworkRoleCenter, "ATC center"),
CIcon(CIcons::NetworkRoleDelivery, "ATC delivery"), CIcon(CIcons::NetworkRoleDelivery, "ATC delivery"),
CIcon(CIcons::NetworkRoleDeparture, "ATC departure"),
CIcon(CIcons::NetworkRoleFss, "FSS"), CIcon(CIcons::NetworkRoleFss, "FSS"),
CIcon(CIcons::NetworkRoleGround, "ATC ground"), CIcon(CIcons::NetworkRoleGround, "ATC ground"),
CIcon(CIcons::NetworkRoleI1, "I1 (instructor)"), CIcon(CIcons::NetworkRoleI1, "I1 (instructor)"),

View File

@@ -1010,6 +1010,13 @@ namespace BlackMisc
return pm; return pm;
} }
const QPixmap &CIcons::roleDeparture()
{
// currently same icons as APP
static const QPixmap pm(QPixmap(":/own/icons/own/app.jpg").scaledToWidth(16, Qt::SmoothTransformation));
return pm;
}
const QPixmap &CIcons::roleFss() const QPixmap &CIcons::roleFss()
{ {
return info16(); return info16();
@@ -1172,6 +1179,7 @@ namespace BlackMisc
case NetworkRoleC3: return roleC3(); case NetworkRoleC3: return roleC3();
case NetworkRoleCenter: return roleCenter(); case NetworkRoleCenter: return roleCenter();
case NetworkRoleDelivery: return roleDelivery(); case NetworkRoleDelivery: return roleDelivery();
case NetworkRoleDeparture: return roleDeparture();
case NetworkRoleFss: return roleFss(); case NetworkRoleFss: return roleFss();
case NetworkRoleGround: return roleGround(); case NetworkRoleGround: return roleGround();
case NetworkRoleI1: return roleI1(); case NetworkRoleI1: return roleI1();

View File

@@ -74,6 +74,7 @@ namespace BlackMisc
NetworkRoleC3, NetworkRoleC3,
NetworkRoleCenter, NetworkRoleCenter,
NetworkRoleDelivery, NetworkRoleDelivery,
NetworkRoleDeparture,
NetworkRoleFss, NetworkRoleFss,
NetworkRoleGround, NetworkRoleGround,
NetworkRoleI1, NetworkRoleI1,
@@ -692,6 +693,9 @@ namespace BlackMisc
//! Delivery //! Delivery
static const QPixmap &roleDelivery(); static const QPixmap &roleDelivery();
//! Departure
static const QPixmap &roleDeparture();
//! FSS (flight service staion) //! FSS (flight service staion)
static const QPixmap &roleFss(); static const QPixmap &roleFss();