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:
Klaus Basan
2014-10-24 23:55:36 +02:00
committed by Roland Winklmeier
parent a9768566e6
commit 43ecc238ed
36 changed files with 186 additions and 124 deletions

View File

@@ -115,7 +115,7 @@ namespace BlackMisc
*/
CIcon CAltitude::toIcon() const
{
return BlackMisc::CIconList::iconForIndex(CIcons::GeoPosition);
return BlackMisc::CIconList::iconByIndex(CIcons::GeoPosition);
}
} // namespace

View File

@@ -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);
}
}

View File

@@ -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;

View File

@@ -42,7 +42,7 @@ namespace BlackMisc
BlackMisc::CIcon CFlightPlan::toIcon() const
{
return BlackMisc::CIconList::iconForIndex(CIcons::StandardIconAppFlightPlan16);
return BlackMisc::CIconList::iconByIndex(CIcons::StandardIconAppFlightPlan16);
}
} // namespace

View File

@@ -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; }

View File

@@ -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

View File

@@ -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

View File

@@ -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);
};
}

View File

@@ -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();

View File

@@ -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

View File

@@ -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
{

View File

@@ -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
}
/*

View File

@@ -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;
}

View File

@@ -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);
}
}

View File

@@ -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;

View File

@@ -185,7 +185,7 @@ namespace BlackMisc
*/
CIcon CValueObject::toIcon() const
{
return CIconList::iconForIndex(CIcons::StandardIconUnknown16);
return CIconList::iconByIndex(CIcons::StandardIconUnknown16);
}
/*