mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-07 02:35:33 +08:00
Use nested namespaces (C++17 feature)
This commit is contained in:
@@ -12,58 +12,55 @@
|
||||
|
||||
using namespace BlackMisc::Network;
|
||||
|
||||
namespace BlackMisc
|
||||
namespace BlackMisc::Aviation
|
||||
{
|
||||
namespace Aviation
|
||||
const QStringList &CSimBriefData::getLogCategories()
|
||||
{
|
||||
const QStringList &CSimBriefData::getLogCategories()
|
||||
static const QStringList cats { CLogCategories::flightPlan() };
|
||||
return cats;
|
||||
}
|
||||
|
||||
CSimBriefData::CSimBriefData() : m_url("https://www.simbrief.com/api/xml.fetcher.php")
|
||||
{ }
|
||||
|
||||
CSimBriefData::CSimBriefData(const QString &url, const QString &username) :
|
||||
m_url(url), m_username(username)
|
||||
{ }
|
||||
|
||||
CUrl CSimBriefData::getUrlAndUsername() const
|
||||
{
|
||||
CUrl url(this->getUrl());
|
||||
if (!m_username.isEmpty()) { url.setQuery("username=" % m_username); }
|
||||
return url;
|
||||
}
|
||||
|
||||
QVariant CSimBriefData::propertyByIndex(CPropertyIndexRef index) const
|
||||
{
|
||||
if (index.isMyself()) { return QVariant::fromValue(*this); }
|
||||
const ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||
switch (i)
|
||||
{
|
||||
static const QStringList cats { CLogCategories::flightPlan() };
|
||||
return cats;
|
||||
case IndexUrl: return QVariant::fromValue(m_url);
|
||||
case IndexUsername: return QVariant::fromValue(m_username);
|
||||
default: return CValueObject::propertyByIndex(index);
|
||||
}
|
||||
}
|
||||
|
||||
CSimBriefData::CSimBriefData() : m_url("https://www.simbrief.com/api/xml.fetcher.php")
|
||||
{ }
|
||||
|
||||
CSimBriefData::CSimBriefData(const QString &url, const QString &username) :
|
||||
m_url(url), m_username(username)
|
||||
{ }
|
||||
|
||||
CUrl CSimBriefData::getUrlAndUsername() const
|
||||
void CSimBriefData::setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant)
|
||||
{
|
||||
if (index.isMyself()) { (*this) = variant.value<CSimBriefData>(); return; }
|
||||
const ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||
switch (i)
|
||||
{
|
||||
CUrl url(this->getUrl());
|
||||
if (!m_username.isEmpty()) { url.setQuery("username=" % m_username); }
|
||||
return url;
|
||||
case IndexUrl: m_url = variant.toString(); break;
|
||||
case IndexUsername: m_username = variant.toString(); break;
|
||||
default: CValueObject::setPropertyByIndex(index, variant); break;
|
||||
}
|
||||
}
|
||||
|
||||
QVariant CSimBriefData::propertyByIndex(CPropertyIndexRef index) const
|
||||
{
|
||||
if (index.isMyself()) { return QVariant::fromValue(*this); }
|
||||
const ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||
switch (i)
|
||||
{
|
||||
case IndexUrl: return QVariant::fromValue(m_url);
|
||||
case IndexUsername: return QVariant::fromValue(m_username);
|
||||
default: return CValueObject::propertyByIndex(index);
|
||||
}
|
||||
}
|
||||
|
||||
void CSimBriefData::setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant)
|
||||
{
|
||||
if (index.isMyself()) { (*this) = variant.value<CSimBriefData>(); return; }
|
||||
const ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||
switch (i)
|
||||
{
|
||||
case IndexUrl: m_url = variant.toString(); break;
|
||||
case IndexUsername: m_username = variant.toString(); break;
|
||||
default: CValueObject::setPropertyByIndex(index, variant); break;
|
||||
}
|
||||
}
|
||||
|
||||
QString CSimBriefData::convertToQString(bool i18n) const
|
||||
{
|
||||
Q_UNUSED(i18n);
|
||||
return m_username % " " % m_url;
|
||||
}
|
||||
} // namespace
|
||||
QString CSimBriefData::convertToQString(bool i18n) const
|
||||
{
|
||||
Q_UNUSED(i18n);
|
||||
return m_username % " " % m_url;
|
||||
}
|
||||
} // namespace
|
||||
|
||||
Reference in New Issue
Block a user