refs #314, new icons for formatters

* Moved methods to cpp file (less recompilation)
* Background of icons can be changed
* refs #322, changed to index based approach for retrieving icons (faster)
* therfore: sorted icons per name, easier to keep in sync
This commit is contained in:
Klaus Basan
2014-09-01 13:24:17 +02:00
parent a6ebfc0e0b
commit c54fa0fd43
7 changed files with 451 additions and 250 deletions

View File

@@ -29,4 +29,110 @@ namespace BlackMisc
qRegisterMetaType<CIconList>();
qDBusRegisterMetaType<CIconList>();
}
const CIconList &CIconList::allIcons()
{
static const CIconList icons(
{
// keep indexes alphabetically sorted and in sync with CIcons
CIcon(CIcons::AviationAttitudeIndicator, "attitude indicator"),
CIcon(CIcons::GeoPosition, "geo position"),
CIcon(CIcons::NetworkCapabilityTextOnly, "text only"),
CIcon(CIcons::NetworkCapabilityUnknown, "unknown"),
CIcon(CIcons::NetworkCapabilityVoice, "voice"),
CIcon(CIcons::NetworkCapabilityVoiceBackground, "voice"),
CIcon(CIcons::NetworkCapabilityVoiceReceiveOnly, "voice receive"),
CIcon(CIcons::NetworkCapabilityVoiceReceiveOnlyBackground, "voice receive"),
CIcon(CIcons::NetworkRoleApproach, "ATC approach"),
CIcon(CIcons::NetworkRoleC1, "C1"),
CIcon(CIcons::NetworkRoleC3, "C3"),
CIcon(CIcons::NetworkRoleCenter, "ATC center"),
CIcon(CIcons::NetworkRoleDelivery, "ATC delivery"),
CIcon(CIcons::NetworkRoleGround, "ATC ground"),
CIcon(CIcons::NetworkRoleI1, "I1 (instructor)"),
CIcon(CIcons::NetworkRoleI3, "I3 (instructor)"),
CIcon(CIcons::NetworkRoleMnt, "Mentor"),
CIcon(CIcons::NetworkRoleObs, "observer"),
CIcon(CIcons::NetworkRolePilot, "pilot"),
CIcon(CIcons::NetworkRoleS1, "S1"),
CIcon(CIcons::NetworkRoleS2, "S2"),
CIcon(CIcons::NetworkRoleS3, "S3"),
CIcon(CIcons::NetworkRoleSup, "supervisor"),
CIcon(CIcons::NetworkRoleTower, "ATC tower"),
CIcon(CIcons::NetworkRoleUnknown, "unknown"),
CIcon(CIcons::NotSet, "?"),
CIcon(CIcons::StandardIconAppAircrafts16, "aircrafts"),
CIcon(CIcons::StandardIconAppAtc16, "ATC"),
CIcon(CIcons::StandardIconAppFlightPlan16, "flight plan"),
CIcon(CIcons::StandardIconAppLog16, "log"),
CIcon(CIcons::StandardIconAppMappings16, "mappings"),
CIcon(CIcons::StandardIconAppSettings16, "settings"),
CIcon(CIcons::StandardIconAppSimulator16, "simulator"),
CIcon(CIcons::StandardIconAppTextMessages16, "text messages"),
CIcon(CIcons::StandardIconAppUsers16, "users"),
CIcon(CIcons::StandardIconAppWeather16, "weather"),
CIcon(CIcons::StandardIconArrowMediumEast16, "arrow east"),
CIcon(CIcons::StandardIconArrowMediumNorth16, "arrow north"),
CIcon(CIcons::StandardIconArrowMediumSouth16, "arrow south"),
CIcon(CIcons::StandardIconArrowMediumWest16, "arrow west"),
CIcon(CIcons::StandardIconClose16, "close"),
CIcon(CIcons::StandardIconCross, "cross"),
CIcon(CIcons::StandardIconCrossCircle, "cross circle"),
CIcon(CIcons::StandardIconCrossSmall, "cross (small)"),
CIcon(CIcons::StandardIconCrossWhite, "cross white"),
CIcon(CIcons::StandardIconDelete16, "delete"),
CIcon(CIcons::StandardIconDockBottom16, "dock bottom"),
CIcon(CIcons::StandardIconDockTop16, "dock top"),
CIcon(CIcons::StandardIconEmpty, "empty"),
CIcon(CIcons::StandardIconEmpty16, "empty"),
CIcon(CIcons::StandardIconError16, "error"),
CIcon(CIcons::StandardIconFloatAll16, "float all"),
CIcon(CIcons::StandardIconFloatOne16, "floast one"),
CIcon(CIcons::StandardIconGlobe16, "globe"),
CIcon(CIcons::StandardIconHeadingOne16, "heading"),
CIcon(CIcons::StandardIconInfo16, "info"),
CIcon(CIcons::StandardIconJoystick16, "joystick"),
CIcon(CIcons::StandardIconMonitorError16, "monitor error"),
CIcon(CIcons::StandardIconPaperPlane16, "plane"),
CIcon(CIcons::StandardIconPlugin16, "plugin"),
CIcon(CIcons::StandardIconRadar16, "radar"),
CIcon(CIcons::StandardIconRefresh16, "refresh"),
CIcon(CIcons::StandardIconResize16, "resize"),
CIcon(CIcons::StandardIconStatusBar16, "status bar"),
CIcon(CIcons::StandardIconSwift24, "swift"),
CIcon(CIcons::StandardIconSwift48, "swift"),
CIcon(CIcons::StandardIconSwiftNova24, "swift"),
CIcon(CIcons::StandardIconSwiftNova48, "swift"),
CIcon(CIcons::StandardIconTableRelationship16, "relationship"),
CIcon(CIcons::StandardIconTableSheet16, "table sheet"),
CIcon(CIcons::StandardIconText16, "text"),
CIcon(CIcons::StandardIconTick, "tick"),
CIcon(CIcons::StandardIconTickRed, "tick red"),
CIcon(CIcons::StandardIconTickSmall, "tick (small)"),
CIcon(CIcons::StandardIconTickWhite, "tick white"),
CIcon(CIcons::StandardIconUnknown16, "unknwon"),
CIcon(CIcons::StandardIconUser16, "user"),
CIcon(CIcons::StandardIconUsers16, "users"),
CIcon(CIcons::StandardIconVolumeHigh16, "volume hight"),
CIcon(CIcons::StandardIconVolumeLow16, "volume low"),
CIcon(CIcons::StandardIconVolumeMuted16, "muted"),
CIcon(CIcons::StandardIconWarning16, "warning"),
CIcon(CIcons::StandardIconWeatherCloudy16, "cloudy"),
CIcon(CIcons::StandardIconWrench16, "wrench")
});
return icons;
}
const CIcon &CIconList::iconForIndex(CIcons::IconIndex index)
{
return iconForIndex(static_cast<int>(index));
}
const CIcon &CIconList::iconForIndex(int index)
{
// changed to index / at based approach during #322 (after Sleepy profiling)
// this seems to be faster as the findBy approach previously used, but required synced indexes
Q_ASSERT_X(index >= 0 && index < allIcons().size(), "iconForIndex", "wrong index");
return allIcons()[index];
}
}