Removed deprecated funtions and changed code to use new functions

This commit is contained in:
Klaus Basan
2017-01-05 04:18:37 +01:00
committed by Mathew Sutcliffe
parent bac77e233d
commit 9eff387207
16 changed files with 43 additions and 79 deletions

View File

@@ -19,7 +19,6 @@
#include "blackmisc/aviation/heading.h" #include "blackmisc/aviation/heading.h"
#include "blackmisc/geo/latitude.h" #include "blackmisc/geo/latitude.h"
#include "blackmisc/geo/longitude.h" #include "blackmisc/geo/longitude.h"
#include "blackmisc/iconlist.h"
#include "blackmisc/pq/angle.h" #include "blackmisc/pq/angle.h"
#include "blackmisc/pq/frequency.h" #include "blackmisc/pq/frequency.h"
#include "blackmisc/pq/speed.h" #include "blackmisc/pq/speed.h"
@@ -65,7 +64,7 @@ namespace BlackGui
void CSimulatorComponent::addOrUpdateLiveDataByName(const QString &name, const QString &value, CIcons::IconIndex iconIndex) void CSimulatorComponent::addOrUpdateLiveDataByName(const QString &name, const QString &value, CIcons::IconIndex iconIndex)
{ {
this->addOrUpdateLiveDataByName(name, value, CIconList::iconByIndex(iconIndex)); this->addOrUpdateLiveDataByName(name, value, CIcon::iconByIndex(iconIndex));
} }
int CSimulatorComponent::rowCount() const int CSimulatorComponent::rowCount() const
@@ -112,8 +111,8 @@ namespace BlackGui
const CComSystem c2 = ownAircraft.getCom2System(); const CComSystem c2 = ownAircraft.getCom2System();
static const CIcon iconAlt(s.getAltitude().toIcon()); // minor performance improvement static const CIcon iconAlt(s.getAltitude().toIcon()); // minor performance improvement
static const CIcon iconLatLng(s.latitude().toIcon()); static const CIcon iconLatLng(s.latitude().toIcon());
static const CIcon iconRadio(CIconList::iconByIndex(CIcons::StandardIconRadio16)); static const CIcon iconRadio(CIcon::iconByIndex(CIcons::StandardIconRadio16));
static const CIcon iconAttitude(CIconList::iconByIndex(CIcons::AviationAttitudeIndicator)); static const CIcon iconAttitude(CIcon::iconByIndex(CIcons::AviationAttitudeIndicator));
this->addOrUpdateLiveDataByName("latitude", s.latitude().toFormattedQString(), iconLatLng); this->addOrUpdateLiveDataByName("latitude", s.latitude().toFormattedQString(), iconLatLng);
this->addOrUpdateLiveDataByName("longitude", s.longitude().toFormattedQString(), iconLatLng); this->addOrUpdateLiveDataByName("longitude", s.longitude().toFormattedQString(), iconLatLng);

View File

@@ -344,7 +344,7 @@ namespace BlackGui
{ } { }
CBoolIconFormatter::CBoolIconFormatter(CIcons::IconIndex onIcon, CIcons::IconIndex offIcon, const QString &onName, const QString &offName, int alignment) : CBoolIconFormatter::CBoolIconFormatter(CIcons::IconIndex onIcon, CIcons::IconIndex offIcon, const QString &onName, const QString &offName, int alignment) :
CBoolIconFormatter(CIconList::iconByIndex(onIcon), CIconList::iconByIndex(offIcon), onName, offName, alignment) CBoolIconFormatter(CIcon::iconByIndex(onIcon), CIcon::iconByIndex(offIcon), onName, offName, alignment)
{ } { }
CBoolIconFormatter::CBoolIconFormatter(const CIcon &onIcon, const CIcon &offIcon, const QString &onName, const QString &offName, int alignment) : CBoolIconFormatter::CBoolIconFormatter(const CIcon &onIcon, const CIcon &offIcon, const QString &onName, const QString &offName, int alignment) :

View File

@@ -11,9 +11,6 @@
#include "blackgui/stylesheetutility.h" #include "blackgui/stylesheetutility.h"
#include "blackgui/textmessagetextedit.h" #include "blackgui/textmessagetextedit.h"
#include "blackmisc/aviation/callsign.h" #include "blackmisc/aviation/callsign.h"
#include "blackmisc/icon.h"
#include "blackmisc/iconlist.h"
#include "blackmisc/icons.h"
#include "blackmisc/network/textmessage.h" #include "blackmisc/network/textmessage.h"
#include <QAction> #include <QAction>
@@ -38,7 +35,7 @@ namespace BlackGui
// menu // menu
this->setContextMenuPolicy(Qt::CustomContextMenu); this->setContextMenuPolicy(Qt::CustomContextMenu);
m_actionClearTextEdit = new QAction(CIconList::iconByIndex(CIcons::StandardIconDelete16).toQIcon(), "Clear", this); m_actionClearTextEdit = new QAction(CIcon::iconByIndex(CIcons::StandardIconDelete16).toQIcon(), "Clear", this);
m_actionLast10 = new QAction("Keep last 10 messages", this); m_actionLast10 = new QAction("Keep last 10 messages", this);
m_actionLast25 = new QAction("Keep last 25 messages", this); m_actionLast25 = new QAction("Keep last 25 messages", this);
m_actionAll = new QAction("Keep all messages", this); m_actionAll = new QAction("Keep all messages", this);

View File

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

View File

@@ -9,8 +9,6 @@
#include "blackmisc/aviation/callsign.h" #include "blackmisc/aviation/callsign.h"
#include "blackmisc/compare.h" #include "blackmisc/compare.h"
#include "blackmisc/iconlist.h"
#include "blackmisc/icons.h"
#include <QRegExp> #include <QRegExp>
#include <QRegularExpression> #include <QRegularExpression>
@@ -39,7 +37,7 @@ namespace BlackMisc
{ {
if (callsign.getTypeHint() == CCallsign::Aircraft || !callsign.hasSuffix()) if (callsign.getTypeHint() == CCallsign::Aircraft || !callsign.hasSuffix())
{ {
return CIconList::iconByIndex(CIcons::NetworkRolePilot); return CIcon::iconByIndex(CIcons::NetworkRolePilot);
} }
else else
{ {
@@ -49,21 +47,21 @@ namespace BlackMisc
const CIcon &CCallsign::atcSuffixToIcon(const QString &suffix) const CIcon &CCallsign::atcSuffixToIcon(const QString &suffix)
{ {
if (suffix.length() < 3) { return CIconList::iconByIndex(CIcons::NetworkRoleUnknown); } if (suffix.length() < 3) { return CIcon::iconByIndex(CIcons::NetworkRoleUnknown); }
QString sfx = suffix.toUpper(); QString sfx = suffix.toUpper();
if ("APP" == sfx) { return CIconList::iconByIndex(CIcons::NetworkRoleApproach); } if ("APP" == sfx) { return CIcon::iconByIndex(CIcons::NetworkRoleApproach); }
if ("GND" == sfx) { return CIconList::iconByIndex(CIcons::NetworkRoleGround); } if ("GND" == sfx) { return CIcon::iconByIndex(CIcons::NetworkRoleGround); }
if ("TWR" == sfx) { return CIconList::iconByIndex(CIcons::NetworkRoleTower); } if ("TWR" == sfx) { return CIcon::iconByIndex(CIcons::NetworkRoleTower); }
if ("DEL" == sfx) { return CIconList::iconByIndex(CIcons::NetworkRoleDelivery); } if ("DEL" == sfx) { return CIcon::iconByIndex(CIcons::NetworkRoleDelivery); }
if ("CTR" == sfx) { return CIconList::iconByIndex(CIcons::NetworkRoleCenter); } if ("CTR" == sfx) { return CIcon::iconByIndex(CIcons::NetworkRoleCenter); }
if ("SUP" == sfx) { return CIconList::iconByIndex(CIcons::NetworkRoleSup); } if ("SUP" == sfx) { return CIcon::iconByIndex(CIcons::NetworkRoleSup); }
if ("OBS" == sfx) { return CIconList::iconByIndex(CIcons::NetworkRoleObs); } if ("OBS" == sfx) { return CIcon::iconByIndex(CIcons::NetworkRoleObs); }
if ("INS" == sfx) { return CIconList::iconByIndex(CIcons::NetworkRoleMnt); } if ("INS" == sfx) { return CIcon::iconByIndex(CIcons::NetworkRoleMnt); }
if ("FSS" == sfx) { return CIconList::iconByIndex(CIcons::NetworkRoleFss); } if ("FSS" == sfx) { return CIcon::iconByIndex(CIcons::NetworkRoleFss); }
if ("ATIS" == sfx) { return CIconList::iconByIndex(CIcons::AviationAtis); } if ("ATIS" == sfx) { return CIcon::iconByIndex(CIcons::AviationAtis); }
if ("EXAM" == sfx) { return CIconList::iconByIndex(CIcons::NetworkRoleMnt); } if ("EXAM" == sfx) { return CIcon::iconByIndex(CIcons::NetworkRoleMnt); }
if ("VATSIM" == sfx) { return CIconList::iconByIndex(CIcons::NetworkVatsimLogoWhite); } if ("VATSIM" == sfx) { return CIcon::iconByIndex(CIcons::NetworkVatsimLogoWhite); }
return CIconList::iconByIndex(CIcons::NetworkRoleUnknown); return CIcon::iconByIndex(CIcons::NetworkRoleUnknown);
} }
bool CCallsign::isAtcCallsign() const bool CCallsign::isAtcCallsign() const

View File

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

View File

@@ -11,8 +11,6 @@
#include "blackmisc/comparefunctions.h" #include "blackmisc/comparefunctions.h"
#include "blackmisc/db/datastoreutility.h" #include "blackmisc/db/datastoreutility.h"
#include "blackmisc/icon.h" #include "blackmisc/icon.h"
#include "blackmisc/iconlist.h"
#include "blackmisc/icons.h"
#include <QDateTime> #include <QDateTime>
#include <QtGlobal> #include <QtGlobal>
@@ -56,7 +54,7 @@ namespace BlackMisc
const CIcon &IDatastoreObjectWithIntegerKey::toDatabaseIcon() const const CIcon &IDatastoreObjectWithIntegerKey::toDatabaseIcon() const
{ {
static const CIcon empty; static const CIcon empty;
if (this->hasValidDbKey()) { return CIconList::iconByIndex(CIcons::StandardIconDatabaseKey16); } if (this->hasValidDbKey()) { return CIcon::iconByIndex(CIcons::StandardIconDatabaseKey16); }
return empty; return empty;
} }
@@ -153,7 +151,7 @@ namespace BlackMisc
const CIcon &IDatastoreObjectWithStringKey::toDatabaseIcon() const const CIcon &IDatastoreObjectWithStringKey::toDatabaseIcon() const
{ {
static const CIcon empty; static const CIcon empty;
if (this->hasValidDbKey()) { return CIconList::iconByIndex(CIcons::StandardIconDatabaseKey16); } if (this->hasValidDbKey()) { return CIcon::iconByIndex(CIcons::StandardIconDatabaseKey16); }
return empty; return empty;
} }

View File

@@ -8,8 +8,6 @@
*/ */
#include "blackmisc/geo/earthangle.h" #include "blackmisc/geo/earthangle.h"
#include "blackmisc/iconlist.h"
#include "blackmisc/icons.h"
#include "blackmisc/pq/units.h" #include "blackmisc/pq/units.h"
#include "blackmisc/geo/latitude.h" #include "blackmisc/geo/latitude.h"
#include "blackmisc/geo/longitude.h" #include "blackmisc/geo/longitude.h"
@@ -148,7 +146,7 @@ namespace BlackMisc
template <class LATorLON> template <class LATorLON>
CIcon CEarthAngle<LATorLON>::toIcon() const CIcon CEarthAngle<LATorLON>::toIcon() const
{ {
return BlackMisc::CIconList::iconByIndex(CIcons::GeoPosition); return BlackMisc::CIcon::iconByIndex(CIcons::GeoPosition);
} }
// see here for the reason of thess forward instantiations // see here for the reason of thess forward instantiations

View File

@@ -187,14 +187,4 @@ namespace BlackMisc
}); });
return icons; return icons;
} }
const CIcon &CIconList::iconByIndex(CIcons::IconIndex index)
{
return CIcon::iconByIndex(index);
}
const CIcon &CIconList::iconByIndex(int index)
{
return CIcon::iconByIndex(index);
}
} // ns } // ns

View File

@@ -27,9 +27,8 @@
namespace BlackMisc namespace BlackMisc
{ {
/*! /*!
* Icon * Icon list (swift standard icons)
*/ */
class BLACKMISC_EXPORT CIconList : public CSequence<CIcon> class BLACKMISC_EXPORT CIconList : public CSequence<CIcon>
{ {
@@ -48,14 +47,6 @@ namespace BlackMisc
//! All icons //! All icons
static const CIconList &allIcons(); static const CIconList &allIcons();
//! Icon for given index
//! \deprecated Use CIcon::iconByIndex instead.
static const CIcon &iconByIndex(CIcons::IconIndex index);
//! Icon for given index
//! \deprecated Use CIcon::iconByIndex instead.
static const CIcon &iconByIndex(int index);
}; };
} }

View File

@@ -7,11 +7,8 @@
* contained in the LICENSE file. * contained in the LICENSE file.
*/ */
#include "blackmisc/iconlist.h"
#include "blackmisc/icons.h"
#include "blackmisc/namevariantpair.h" #include "blackmisc/namevariantpair.h"
#include "blackmisc/propertyindexvariantmap.h" #include "blackmisc/propertyindexvariantmap.h"
#include <tuple> #include <tuple>
namespace BlackMisc namespace BlackMisc
@@ -61,7 +58,7 @@ namespace BlackMisc
if (static_cast<QMetaType::Type>(variant.type()) == QMetaType::Int) if (static_cast<QMetaType::Type>(variant.type()) == QMetaType::Int)
{ {
CIcons::IconIndex iconIndex = variant.value<CIcons::IconIndex>(); CIcons::IconIndex iconIndex = variant.value<CIcons::IconIndex>();
this->m_icon = CIconList::iconByIndex(iconIndex); this->m_icon = CIcon::iconByIndex(iconIndex);
} }
else else
{ {

View File

@@ -8,7 +8,6 @@
*/ */
#include "blackmisc/network/authenticateduser.h" #include "blackmisc/network/authenticateduser.h"
#include "blackmisc/iconlist.h"
#include "blackmisc/icons.h" #include "blackmisc/icons.h"
#include "blackmisc/logcategory.h" #include "blackmisc/logcategory.h"
#include "blackmisc/logcategorylist.h" #include "blackmisc/logcategorylist.h"
@@ -120,7 +119,7 @@ namespace BlackMisc
CIcon CAuthenticatedUser::toIcon() const CIcon CAuthenticatedUser::toIcon() const
{ {
return CIconList::iconByIndex(CIcons::StandardIconUser16); return CIcon::iconByIndex(CIcons::StandardIconUser16);
} }
CVariant CAuthenticatedUser::propertyByIndex(const BlackMisc::CPropertyIndex &index) const CVariant CAuthenticatedUser::propertyByIndex(const BlackMisc::CPropertyIndex &index) const

View File

@@ -93,18 +93,18 @@ namespace BlackMisc
switch (this->m_voiceCapabilities) switch (this->m_voiceCapabilities)
{ {
case Voice: case Voice:
return CIconList::iconByIndex(CIcons::NetworkCapabilityVoiceBackground); return CIcon::iconByIndex(CIcons::NetworkCapabilityVoiceBackground);
case TextOnly: case TextOnly:
return CIconList::iconByIndex(CIcons::NetworkCapabilityTextOnly); return CIcon::iconByIndex(CIcons::NetworkCapabilityTextOnly);
case Unknown: case Unknown:
return CIconList::iconByIndex(CIcons::NetworkCapabilityUnknown); return CIcon::iconByIndex(CIcons::NetworkCapabilityUnknown);
case VoiceReceivingOnly: case VoiceReceivingOnly:
return CIconList::iconByIndex(CIcons::NetworkCapabilityVoiceReceiveOnlyBackground); return CIcon::iconByIndex(CIcons::NetworkCapabilityVoiceReceiveOnlyBackground);
default: default:
break; break;
} }
Q_ASSERT(false); Q_ASSERT(false);
return CIconList::iconByIndex(CIcons::NetworkCapabilityUnknown); // never reached return CIcon::iconByIndex(CIcons::NetworkCapabilityUnknown); // never reached
} }
const CVoiceCapabilities &CVoiceCapabilities::fromVoiceCapabilities(CVoiceCapabilities::VoiceCapabilities capabilities) const CVoiceCapabilities &CVoiceCapabilities::fromVoiceCapabilities(CVoiceCapabilities::VoiceCapabilities capabilities)

View File

@@ -20,7 +20,7 @@ namespace BlackMisc
{ {
BlackMisc::CIcon CAngle::toIcon() const BlackMisc::CIcon CAngle::toIcon() const
{ {
BlackMisc::CIcon i = CIconList::iconByIndex(CIcons::StandardIconArrowMediumNorth16); BlackMisc::CIcon i = CIcon::iconByIndex(CIcons::StandardIconArrowMediumNorth16);
i.setRotation(*this); i.setRotation(*this);
return i; return i;
} }

View File

@@ -10,9 +10,6 @@
#include "blackmisc/compare.h" #include "blackmisc/compare.h"
#include "blackmisc/comparefunctions.h" #include "blackmisc/comparefunctions.h"
#include "blackmisc/db/datastoreutility.h" #include "blackmisc/db/datastoreutility.h"
#include "blackmisc/icon.h"
#include "blackmisc/iconlist.h"
#include "blackmisc/icons.h"
#include "blackmisc/fileutils.h" #include "blackmisc/fileutils.h"
#include "blackmisc/logcategory.h" #include "blackmisc/logcategory.h"
#include "blackmisc/logcategorylist.h" #include "blackmisc/logcategorylist.h"
@@ -458,16 +455,16 @@ namespace BlackMisc
switch (this->getModelMode()) switch (this->getModelMode())
{ {
case Include: case Include:
return CIconList::iconByIndex(CIcons::ModelInclude); return CIcon::iconByIndex(CIcons::ModelInclude);
case Exclude: case Exclude:
return CIconList::iconByIndex(CIcons::ModelExclude); return CIcon::iconByIndex(CIcons::ModelExclude);
case Undefined: case Undefined:
return CIconList::iconByIndex(CIcons::StandardIconUnknown16); return CIcon::iconByIndex(CIcons::StandardIconUnknown16);
default: default:
Q_ASSERT_X(false, Q_FUNC_INFO, "wrong mode"); Q_ASSERT_X(false, Q_FUNC_INFO, "wrong mode");
break; break;
} }
return CIconList::iconByIndex(CIcons::ModelInclude); return CIcon::iconByIndex(CIcons::ModelInclude);
} }
void CAircraftModel::setModelModeAsString(const QString &mode) void CAircraftModel::setModelModeAsString(const QString &mode)

View File

@@ -287,11 +287,11 @@ namespace BlackMisc
{ {
switch (severity) switch (severity)
{ {
case SeverityDebug: return CIconList::iconByIndex(CIcons::StandardIconUnknown16); // TODO case SeverityDebug: return CIcon::iconByIndex(CIcons::StandardIconUnknown16); // TODO
case SeverityInfo: return CIconList::iconByIndex(CIcons::StandardIconInfo16); case SeverityInfo: return CIcon::iconByIndex(CIcons::StandardIconInfo16);
case SeverityWarning: return CIconList::iconByIndex(CIcons::StandardIconWarning16); case SeverityWarning: return CIcon::iconByIndex(CIcons::StandardIconWarning16);
case SeverityError: return CIconList::iconByIndex(CIcons::StandardIconError16); case SeverityError: return CIcon::iconByIndex(CIcons::StandardIconError16);
default: return CIconList::iconByIndex(CIcons::StandardIconInfo16); default: return CIcon::iconByIndex(CIcons::StandardIconInfo16);
} }
} }