refs #497, new functions for global setup

This commit is contained in:
Klaus Basan
2015-10-21 18:57:29 +02:00
committed by Mathew Sutcliffe
parent a0a03d230c
commit cef3a7f1cb
2 changed files with 47 additions and 0 deletions

View File

@@ -31,6 +31,21 @@ namespace BlackCore
m_fsdTestServers({ CServer("swift", "swift Testserver", "vatsim-germany.org", 6809, CUser("1234567", "swift Test User", "", "123456"), true) })
{ }
CUrl CGlobalSetup::dbHomePage() const
{
return dbModelReader().withAppendedPath("/page/index.php");
}
CUrl CGlobalSetup::dbLoginService() const
{
return dbModelReader().withAppendedPath("/service/index.php");
}
bool CGlobalSetup::hasSameType(const QString &type) const
{
return getType() == type.trimmed().toUpper();
}
CUrl CGlobalSetup::vatsimMetars() const
{
return this->m_vatsimMetars.withAppendedQuery("id=all");
@@ -52,6 +67,12 @@ namespace BlackCore
s.append("Model DB reader: ");
s.append(dbModelReader().convertToQString(i18n));
s.append(separator);
s.append("DB home page: ");
s.append(dbHomePage().convertToQString(i18n));
s.append(separator);
s.append("DB login service: ");
s.append(dbLoginService().convertToQString(i18n));
s.append(separator);
s.append("VATSIM bookings: ");
s.append(vatsimBookings().convertToQString(i18n));
s.append(separator);
@@ -84,6 +105,10 @@ namespace BlackCore
return CVariant::fromValue(this->m_dbIcaoReader);
case IndexDbModelReader:
return CVariant::fromValue(this->m_dbModelReader);
case IndexDbHomePage:
return CVariant::fromValue(this->dbHomePage());
case IndexDbLoginService:
return CVariant::fromValue(this->dbLoginService());
case IndexVatsimData:
return CVariant::fromValue(this->m_vatsimDataFile);
case IndexVatsimBookings:
@@ -117,6 +142,9 @@ namespace BlackCore
case IndexDbModelReader:
this->m_dbModelReader.setPropertyByIndex(variant, index.copyFrontRemoved());
break;
case IndexDbHomePage:
case IndexDbLoginService:
break;
case IndexVatsimData:
this->m_vatsimDataFile = variant.value<CUrlList>();
break;

View File

@@ -35,6 +35,8 @@ namespace BlackCore
{
IndexDbIcaoReader = BlackMisc::CPropertyIndex::GlobalIndexCGlobalSetup,
IndexDbModelReader,
IndexDbHomePage,
IndexDbLoginService,
IndexVatsimBookings,
IndexVatsimMetars,
IndexVatsimData,
@@ -54,9 +56,24 @@ namespace BlackCore
//! Model Reader protocol
const BlackMisc::Network::CUrl &dbModelReader() const { return m_dbModelReader; }
//! Home page url
BlackMisc::Network::CUrl dbHomePage() const;
//! Login service
BlackMisc::Network::CUrl dbLoginService() const;
//! URL to read VATSIM bookings
const BlackMisc::Network::CUrl &vatsimBookings() const { return m_vatsimBookings; }
//! Type (development, productive)?
const QString &getType() const { return m_type; }
//! Set type
void setType(const QString &type) { m_type = type.trimmed().toUpper(); }
//! Same type?
bool hasSameType(const QString &type) const;
//! VATSIM METAR URL
BlackMisc::Network::CUrl vatsimMetars() const;
@@ -87,6 +104,7 @@ namespace BlackCore
private:
BLACK_ENABLE_TUPLE_CONVERSION(BlackCore::Data::CGlobalSetup)
QString m_type; //!< dev./productive?
BlackMisc::Network::CUrl m_dbIcaoReader; //!< direct DB ICAO reader
BlackMisc::Network::CUrl m_dbModelReader; //!< direct DB model reader
BlackMisc::Network::CUrl m_vatsimBookings; //!< ATC bookings
@@ -117,6 +135,7 @@ namespace BlackCore
Q_DECLARE_METATYPE(BlackCore::Data::CGlobalSetup)
BLACK_DECLARE_TUPLE_CONVERSION(BlackCore::Data::CGlobalSetup, (
attr(o.m_timestampMSecsSinceEpoch),
attr(o.m_type),
attr(o.m_dbIcaoReader),
attr(o.m_dbModelReader),
attr(o.m_vatsimBookings),