mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-06 10:15:38 +08:00
clang-format src
This commit is contained in:
@@ -20,15 +20,14 @@ BLACK_DEFINE_VALUEOBJECT_MIXINS(BlackMisc::Simulation, CDistributor)
|
||||
|
||||
namespace BlackMisc::Simulation
|
||||
{
|
||||
CDistributor::CDistributor() { }
|
||||
CDistributor::CDistributor() {}
|
||||
|
||||
CDistributor::CDistributor(const QString &key)
|
||||
{
|
||||
this->setDbKey(unifyKeyOrAlias(key));
|
||||
}
|
||||
|
||||
CDistributor::CDistributor(const QString &id, const QString &description, const QString &alias1, const QString &alias2, const CSimulatorInfo &simulator) :
|
||||
m_description(description), m_alias1(alias1), m_alias2(alias2), m_simulator(simulator)
|
||||
CDistributor::CDistributor(const QString &id, const QString &description, const QString &alias1, const QString &alias2, const CSimulatorInfo &simulator) : m_description(description), m_alias1(alias1), m_alias2(alias2), m_simulator(simulator)
|
||||
{
|
||||
this->setDbKey(unifyKeyOrAlias(id));
|
||||
}
|
||||
@@ -53,7 +52,7 @@ namespace BlackMisc::Simulation
|
||||
bool CDistributor::matchesKeyOrAlias(const CDistributor &distributor) const
|
||||
{
|
||||
if (distributor.hasValidDbKey() && this->matchesKeyOrAlias(distributor.getDbKey())) { return true; }
|
||||
if (distributor.hasAlias1() && this->matchesKeyOrAlias(distributor.getAlias1())) { return true; }
|
||||
if (distributor.hasAlias1() && this->matchesKeyOrAlias(distributor.getAlias1())) { return true; }
|
||||
return (distributor.hasAlias2() && this->matchesKeyOrAlias(distributor.getAlias2()));
|
||||
}
|
||||
|
||||
@@ -82,9 +81,21 @@ namespace BlackMisc::Simulation
|
||||
|
||||
void CDistributor::setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant)
|
||||
{
|
||||
if (index.isMyself()) { (*this) = variant.value<CDistributor>(); return; }
|
||||
if (IDatastoreObjectWithStringKey::canHandleIndex(index)) { IDatastoreObjectWithStringKey::setPropertyByIndex(index, variant); return; }
|
||||
if (IOrderable::canHandleIndex(index)) { IOrderable::setPropertyByIndex(index, variant); return; }
|
||||
if (index.isMyself())
|
||||
{
|
||||
(*this) = variant.value<CDistributor>();
|
||||
return;
|
||||
}
|
||||
if (IDatastoreObjectWithStringKey::canHandleIndex(index))
|
||||
{
|
||||
IDatastoreObjectWithStringKey::setPropertyByIndex(index, variant);
|
||||
return;
|
||||
}
|
||||
if (IOrderable::canHandleIndex(index))
|
||||
{
|
||||
IOrderable::setPropertyByIndex(index, variant);
|
||||
return;
|
||||
}
|
||||
|
||||
const ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||
switch (i)
|
||||
@@ -92,7 +103,7 @@ namespace BlackMisc::Simulation
|
||||
case IndexAlias1: m_alias1 = variant.value<QString>(); break;
|
||||
case IndexAlias2: m_alias2 = variant.value<QString>(); break;
|
||||
case IndexDescription: m_description = variant.value<QString>(); break;
|
||||
case IndexSimulator: m_simulator.setPropertyByIndex(index.copyFrontRemoved(), variant); break;
|
||||
case IndexSimulator: m_simulator.setPropertyByIndex(index.copyFrontRemoved(), variant); break;
|
||||
default: CValueObject::setPropertyByIndex(index, variant); break;
|
||||
}
|
||||
}
|
||||
@@ -108,7 +119,7 @@ namespace BlackMisc::Simulation
|
||||
case IndexAlias1: return m_alias1.compare(compareValue.m_alias1, Qt::CaseInsensitive);
|
||||
case IndexAlias2: return m_alias2.compare(compareValue.m_alias2, Qt::CaseInsensitive);
|
||||
case IndexDescription: return m_description.compare(compareValue.getDescription(), Qt::CaseInsensitive);
|
||||
case IndexSimulator: return m_simulator.comparePropertyByIndex(index.copyFrontRemoved(), compareValue.m_simulator);
|
||||
case IndexSimulator: return m_simulator.comparePropertyByIndex(index.copyFrontRemoved(), compareValue.m_simulator);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -134,7 +145,7 @@ namespace BlackMisc::Simulation
|
||||
{
|
||||
static const CLogCategoryList cats(CLogCategoryList(this).withValidation());
|
||||
CStatusMessageList msgs;
|
||||
if (!hasValidDbKey()) { msgs.push_back(CStatusMessage(cats, CStatusMessage::SeverityError, u"Distributor: missing id")); }
|
||||
if (!hasValidDbKey()) { msgs.push_back(CStatusMessage(cats, CStatusMessage::SeverityError, u"Distributor: missing id")); }
|
||||
if (!hasDescription()) { msgs.push_back(CStatusMessage(cats, CStatusMessage::SeverityError, u"Distributor: missing description")); }
|
||||
return msgs;
|
||||
}
|
||||
@@ -215,7 +226,7 @@ namespace BlackMisc::Simulation
|
||||
|
||||
const QSet<QString> &CDistributor::standardAllFsFamily()
|
||||
{
|
||||
static const QSet<QString> fsFamily({standardFS9(), standardFSX(), standardP3D()});
|
||||
static const QSet<QString> fsFamily({ standardFS9(), standardFSX(), standardP3D() });
|
||||
return fsFamily;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user