mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-31 12:55:33 +08:00
refs #335, Minor tweaks:
* Formatting * renaming * fixed some issues of cppcheck * new icons * smooth scrolling in views, stretching for few columns * fixed start timer in updatetimer * background colors of some LEDs
This commit is contained in:
committed by
Roland Winklmeier
parent
a9768566e6
commit
43ecc238ed
@@ -115,7 +115,7 @@ namespace BlackMisc
|
||||
*/
|
||||
CIcon CAltitude::toIcon() const
|
||||
{
|
||||
return BlackMisc::CIconList::iconForIndex(CIcons::GeoPosition);
|
||||
return BlackMisc::CIconList::iconByIndex(CIcons::GeoPosition);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
@@ -38,23 +38,23 @@ namespace BlackMisc
|
||||
const CIcon &CCallsign::convertToIcon(const CCallsign &callsign)
|
||||
{
|
||||
QString t = callsign.asString().toUpper();
|
||||
if (t.length() < 3) return CIconList::iconForIndex(CIcons::NetworkRoleUnknown);
|
||||
if (t.length() < 3) return CIconList::iconByIndex(CIcons::NetworkRoleUnknown);
|
||||
t = t.right(3);
|
||||
|
||||
if (callsign.getStringAsSet().contains("_"))
|
||||
{
|
||||
if ("APP" == t) return CIconList::iconForIndex(CIcons::NetworkRoleApproach);
|
||||
if ("GND" == t) return CIconList::iconForIndex(CIcons::NetworkRoleGround);
|
||||
if ("TWR" == t) return CIconList::iconForIndex(CIcons::NetworkRoleTower);
|
||||
if ("DEL" == t) return CIconList::iconForIndex(CIcons::NetworkRoleDelivery);
|
||||
if ("CTR" == t) return CIconList::iconForIndex(CIcons::NetworkRoleCenter);
|
||||
if ("SUP" == t) return CIconList::iconForIndex(CIcons::NetworkRoleSup);
|
||||
if ("OBS" == t) return CIconList::iconForIndex(CIcons::NetworkRoleApproach);
|
||||
return CIconList::iconForIndex(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::NetworkRoleApproach);
|
||||
return CIconList::iconByIndex(CIcons::NetworkRoleUnknown);
|
||||
}
|
||||
else
|
||||
{
|
||||
return CIconList::iconForIndex(CIcons::NetworkRolePilot);
|
||||
return CIconList::iconByIndex(CIcons::NetworkRolePilot);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ namespace BlackMisc
|
||||
bool equalsString(const QString &callsignString) const;
|
||||
|
||||
//! \copydoc CValueObject::toIcon()
|
||||
virtual BlackMisc::CIcon toIcon() const override { return CCallsign::convertToIcon(*this); }
|
||||
virtual BlackMisc::CIcon toIcon() const override { return convertToIcon(*this); }
|
||||
|
||||
//! \copydoc CValueObject::propertyByIndex
|
||||
virtual QVariant propertyByIndex(const BlackMisc::CPropertyIndex &index) const override;
|
||||
|
||||
@@ -42,7 +42,7 @@ namespace BlackMisc
|
||||
|
||||
BlackMisc::CIcon CFlightPlan::toIcon() const
|
||||
{
|
||||
return BlackMisc::CIconList::iconForIndex(CIcons::StandardIconAppFlightPlan16);
|
||||
return BlackMisc::CIconList::iconByIndex(CIcons::StandardIconAppFlightPlan16);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
@@ -40,7 +40,7 @@ namespace BlackMisc
|
||||
CSelcal(const char *code) : m_code(code) {}
|
||||
|
||||
//! Is valid?
|
||||
bool isValid() const { return CSelcal::isValidCode(this->m_code); }
|
||||
bool isValid() const { return isValidCode(this->m_code); }
|
||||
|
||||
//! Get SELCAL code
|
||||
const QString &getCode() const { return this->m_code; }
|
||||
|
||||
@@ -73,7 +73,7 @@ namespace BlackMisc
|
||||
*/
|
||||
template <class LATorLON> CIcon CEarthAngle<LATorLON>::toIcon() const
|
||||
{
|
||||
return BlackMisc::CIconList::iconForIndex(CIcons::GeoPosition);
|
||||
return BlackMisc::CIconList::iconByIndex(CIcons::GeoPosition);
|
||||
}
|
||||
|
||||
// see here for the reason of thess forward instantiations
|
||||
|
||||
@@ -35,6 +35,17 @@ namespace BlackMisc
|
||||
static const CIconList icons(
|
||||
{
|
||||
// keep indexes alphabetically sorted and in sync with CIcons
|
||||
CIcon(CIcons::ApplicationIconAircrafts, "aircrafts"),
|
||||
CIcon(CIcons::ApplicationIconAtc, "ATC"),
|
||||
CIcon(CIcons::ApplicationIconAudio, "audio"),
|
||||
CIcon(CIcons::ApplicationIconCockpit, "cockpit"),
|
||||
CIcon(CIcons::ApplicationIconFlightPlan, "flightplan"),
|
||||
CIcon(CIcons::ApplicationIconLog, "log"),
|
||||
CIcon(CIcons::ApplicationIconMappings, "mappings"),
|
||||
CIcon(CIcons::ApplicationIconSettings, "settings"),
|
||||
CIcon(CIcons::ApplicationIconSimulator, "simulator"),
|
||||
CIcon(CIcons::ApplicationIconTextMessages, "text messages"),
|
||||
CIcon(CIcons::ApplicationIconWeather, "weather"),
|
||||
CIcon(CIcons::AviationAtis, "ATIS"),
|
||||
CIcon(CIcons::AviationAttitudeIndicator, "attitude indicator"),
|
||||
CIcon(CIcons::AviationMetar, "METAR"),
|
||||
@@ -133,12 +144,12 @@ namespace BlackMisc
|
||||
return icons;
|
||||
}
|
||||
|
||||
const CIcon &CIconList::iconForIndex(CIcons::IconIndex index)
|
||||
const CIcon &CIconList::iconByIndex(CIcons::IconIndex index)
|
||||
{
|
||||
return iconForIndex(static_cast<int>(index));
|
||||
return iconByIndex(static_cast<int>(index));
|
||||
}
|
||||
|
||||
const CIcon &CIconList::iconForIndex(int index)
|
||||
const CIcon &CIconList::iconByIndex(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
|
||||
|
||||
@@ -46,10 +46,10 @@ namespace BlackMisc
|
||||
static const CIconList &allIcons();
|
||||
|
||||
//! Icon for given index
|
||||
static const CIcon &iconForIndex(CIcons::IconIndex index);
|
||||
static const CIcon &iconByIndex(CIcons::IconIndex index);
|
||||
|
||||
//! Icon for given index
|
||||
static const CIcon &iconForIndex(int index);
|
||||
static const CIcon &iconByIndex(int index);
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
@@ -30,6 +30,17 @@ namespace BlackMisc
|
||||
{
|
||||
switch (index)
|
||||
{
|
||||
case ApplicationIconAircrafts: return appAircrafts16();
|
||||
case ApplicationIconAtc: return appAtc16();
|
||||
case ApplicationIconAudio: return appAudio16();
|
||||
case ApplicationIconCockpit: return appCockpit16();
|
||||
case ApplicationIconFlightPlan: return appFlightPlan16();
|
||||
case ApplicationIconLog: return appLog16();
|
||||
case ApplicationIconMappings: return appMappings16();
|
||||
case ApplicationIconSettings: return appSettings16();
|
||||
case ApplicationIconSimulator: return appSimulator16();
|
||||
case ApplicationIconTextMessages: return appTextMessages16();
|
||||
case ApplicationIconWeather: return appWeather16();
|
||||
case AviationAtis: return atis();
|
||||
case AviationAttitudeIndicator: return attitudeIndicator16();
|
||||
case AviationMetar: return metar();
|
||||
@@ -93,6 +104,7 @@ namespace BlackMisc
|
||||
case StandardIconPaperPlane16: return paperPlane16();
|
||||
case StandardIconPlugin16: return plugin16();
|
||||
case StandardIconRadar16: return radar16();
|
||||
case StandardIconRadio16: return radio16();
|
||||
case StandardIconRefresh16: return refresh16();
|
||||
case StandardIconResize16: return resize16();
|
||||
case StandardIconResizeHorizontal16: return resizeHorizontal16();
|
||||
|
||||
@@ -28,6 +28,17 @@ namespace BlackMisc
|
||||
enum IconIndex
|
||||
{
|
||||
// !! keep indexes alphabetically sorted and in sync with CIconList
|
||||
ApplicationIconAircrafts,
|
||||
ApplicationIconAtc,
|
||||
ApplicationIconAudio,
|
||||
ApplicationIconCockpit,
|
||||
ApplicationIconFlightPlan,
|
||||
ApplicationIconLog,
|
||||
ApplicationIconMappings,
|
||||
ApplicationIconSettings,
|
||||
ApplicationIconSimulator,
|
||||
ApplicationIconTextMessages,
|
||||
ApplicationIconWeather,
|
||||
AviationAttitudeIndicator,
|
||||
AviationAtis,
|
||||
AviationMetar,
|
||||
@@ -751,13 +762,13 @@ namespace BlackMisc
|
||||
//! Text only
|
||||
static const QPixmap &capabilityTextOnly()
|
||||
{
|
||||
return CIcons::appTextMessages16();
|
||||
return appTextMessages16();
|
||||
}
|
||||
|
||||
//! Text only
|
||||
static const QPixmap &capabilityUnknown()
|
||||
{
|
||||
return CIcons::unknown16();
|
||||
return unknown16();
|
||||
}
|
||||
|
||||
//! Attitude indicator
|
||||
|
||||
@@ -92,7 +92,7 @@ namespace BlackMisc
|
||||
if (static_cast<QMetaType::Type>(variant.type()) == QMetaType::Int)
|
||||
{
|
||||
CIcons::IconIndex index = static_cast<CIcons::IconIndex>(variant.toInt());
|
||||
this->m_icon = CIconList::iconForIndex(index);
|
||||
this->m_icon = CIconList::iconByIndex(index);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -100,18 +100,18 @@ namespace BlackMisc
|
||||
switch (this->m_voiceCapabilities)
|
||||
{
|
||||
case Voice:
|
||||
return CIconList::iconForIndex(CIcons::NetworkCapabilityVoiceBackground);
|
||||
return CIconList::iconByIndex(CIcons::NetworkCapabilityVoiceBackground);
|
||||
case TextOnly:
|
||||
return CIconList::iconForIndex(CIcons::NetworkCapabilityTextOnly);
|
||||
return CIconList::iconByIndex(CIcons::NetworkCapabilityTextOnly);
|
||||
case Unknown:
|
||||
return CIconList::iconForIndex(CIcons::NetworkCapabilityUnknown);
|
||||
return CIconList::iconByIndex(CIcons::NetworkCapabilityUnknown);
|
||||
case VoiceReceivingOnly:
|
||||
return CIconList::iconForIndex(CIcons::NetworkCapabilityVoiceReceiveOnlyBackground);
|
||||
return CIconList::iconByIndex(CIcons::NetworkCapabilityVoiceReceiveOnlyBackground);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
Q_ASSERT(false);
|
||||
return CIconList::iconForIndex(CIcons::NetworkCapabilityUnknown); // never reached
|
||||
return CIconList::iconByIndex(CIcons::NetworkCapabilityUnknown); // never reached
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace BlackMisc
|
||||
{
|
||||
BlackMisc::CIcon CAngle::toIcon() const
|
||||
{
|
||||
BlackMisc::CIcon i = CIconList::iconForIndex(CIcons::StandardIconArrowMediumNorth16);
|
||||
BlackMisc::CIcon i = CIconList::iconByIndex(CIcons::StandardIconArrowMediumNorth16);
|
||||
i.setRotation(*this);
|
||||
return i;
|
||||
}
|
||||
|
||||
@@ -132,11 +132,11 @@ namespace BlackMisc
|
||||
{
|
||||
switch (statusMessage.getSeverity())
|
||||
{
|
||||
case SeverityDebug: return CIconList::iconForIndex(CIcons::StandardIconUnknown16); // TODO
|
||||
case SeverityInfo: return CIconList::iconForIndex(CIcons::StandardIconInfo16);
|
||||
case SeverityWarning: return CIconList::iconForIndex(CIcons::StandardIconWarning16);
|
||||
case SeverityError: return CIconList::iconForIndex(CIcons::StandardIconError16);
|
||||
default: return CIconList::iconForIndex(CIcons::StandardIconInfo16);
|
||||
case SeverityDebug: return CIconList::iconByIndex(CIcons::StandardIconUnknown16); // TODO
|
||||
case SeverityInfo: return CIconList::iconByIndex(CIcons::StandardIconInfo16);
|
||||
case SeverityWarning: return CIconList::iconByIndex(CIcons::StandardIconWarning16);
|
||||
case SeverityError: return CIconList::iconByIndex(CIcons::StandardIconError16);
|
||||
default: return CIconList::iconByIndex(CIcons::StandardIconInfo16);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -91,7 +91,7 @@ namespace BlackMisc
|
||||
void setSeverity(StatusSeverity severity) { this->m_severity = severity; }
|
||||
|
||||
//! Representing icon
|
||||
virtual CIcon toIcon() const override { return CStatusMessage::convertToIcon(*this); }
|
||||
virtual CIcon toIcon() const override { return convertToIcon(*this); }
|
||||
|
||||
//! Severity as string
|
||||
const QString &getSeverityAsString() const;
|
||||
|
||||
@@ -185,7 +185,7 @@ namespace BlackMisc
|
||||
*/
|
||||
CIcon CValueObject::toIcon() const
|
||||
{
|
||||
return CIconList::iconForIndex(CIcons::StandardIconUnknown16);
|
||||
return CIconList::iconByIndex(CIcons::StandardIconUnknown16);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user