mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-21 04:45:31 +08:00
Formatting
This commit is contained in:
committed by
Mathew Sutcliffe
parent
eab22e86b0
commit
a22cd134f8
@@ -8,7 +8,6 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "blackcore/data/vatsimsetup.h"
|
#include "blackcore/data/vatsimsetup.h"
|
||||||
|
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
|
|
||||||
using namespace BlackMisc;
|
using namespace BlackMisc;
|
||||||
@@ -66,15 +65,12 @@ namespace BlackCore
|
|||||||
if (index.isMyself()) { return CVariant::from(*this); }
|
if (index.isMyself()) { return CVariant::from(*this); }
|
||||||
if (ITimestampBased::canHandleIndex(index)) { return ITimestampBased::propertyByIndex(index); }
|
if (ITimestampBased::canHandleIndex(index)) { return ITimestampBased::propertyByIndex(index); }
|
||||||
|
|
||||||
ColumnIndex i = index.frontCasted<ColumnIndex>();
|
const ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||||
switch (i)
|
switch (i)
|
||||||
{
|
{
|
||||||
case IndexFsdServers:
|
case IndexFsdServers: return CVariant::fromValue(this->m_fsdServers);
|
||||||
return CVariant::fromValue(this->m_fsdServers);
|
case IndexDataFiles: return CVariant::fromValue(this->m_dataFileUrls);
|
||||||
case IndexDataFiles:
|
default: return CValueObject::propertyByIndex(index);
|
||||||
return CVariant::fromValue(this->m_dataFileUrls);
|
|
||||||
default:
|
|
||||||
return CValueObject::propertyByIndex(index);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -87,18 +83,12 @@ namespace BlackCore
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ColumnIndex i = index.frontCasted<ColumnIndex>();
|
const ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||||
switch (i)
|
switch (i)
|
||||||
{
|
{
|
||||||
case IndexFsdServers:
|
case IndexFsdServers: this->m_fsdServers = variant.value<CServerList>(); break;
|
||||||
this->m_fsdServers = variant.value<CServerList>();
|
case IndexDataFiles: this->m_dataFileUrls = variant.value<CUrlList>(); break;
|
||||||
break;
|
default: CValueObject::setPropertyByIndex(index, variant); break;
|
||||||
case IndexDataFiles:
|
|
||||||
this->m_dataFileUrls = variant.value<CUrlList>();
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
CValueObject::setPropertyByIndex(index, variant);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} // ns
|
} // ns
|
||||||
|
|||||||
@@ -89,8 +89,8 @@ namespace BlackCore
|
|||||||
|
|
||||||
QString query = params.toString();
|
QString query = params.toString();
|
||||||
const QNetworkRequest request(CNetworkUtils::getNetworkRequest(url, CNetworkUtils::PostUrlEncoded));
|
const QNetworkRequest request(CNetworkUtils::getNetworkRequest(url, CNetworkUtils::PostUrlEncoded));
|
||||||
sApp->postToNetwork(request, query.toUtf8(), { this, &CDatabaseAuthenticationService::parseServerResponse});
|
sApp->postToNetwork(request, CApplication::NoLogRequestId, query.toUtf8(), { this, &CDatabaseAuthenticationService::parseServerResponse});
|
||||||
QString rm("Sent request to authentication server %1");
|
static const QString rm("Sent request to authentication server '%1'");
|
||||||
msgs.push_back(CStatusMessage(cats, CStatusMessage::SeverityInfo, rm.arg(url.toQString())));
|
msgs.push_back(CStatusMessage(cats, CStatusMessage::SeverityInfo, rm.arg(url.toQString())));
|
||||||
return msgs;
|
return msgs;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -601,10 +601,8 @@ namespace BlackCore
|
|||||||
Q_ASSERT_X(CEntityFlags::isSingleEntity(entity), Q_FUNC_INFO, "needs single entity");
|
Q_ASSERT_X(CEntityFlags::isSingleEntity(entity), Q_FUNC_INFO, "needs single entity");
|
||||||
switch (mode)
|
switch (mode)
|
||||||
{
|
{
|
||||||
case CDbFlags::Shared:
|
case CDbFlags::Shared: return CDbInfo::entityToSharedName(entity);
|
||||||
return CDbInfo::entityToSharedName(entity);
|
case CDbFlags::SharedInfoOnly: return CDbInfo::sharedInfoFileName();
|
||||||
case CDbFlags::SharedInfoOnly:
|
|
||||||
return CDbInfo::sharedInfoFileName();
|
|
||||||
default:
|
default:
|
||||||
case CDbFlags::DbReading:
|
case CDbFlags::DbReading:
|
||||||
return CDbInfo::entityToServiceName(entity);
|
return CDbInfo::entityToServiceName(entity);
|
||||||
@@ -613,7 +611,7 @@ namespace BlackCore
|
|||||||
|
|
||||||
QString CDatabaseReader::dateTimeToDbLatestTs(const QDateTime &ts)
|
QString CDatabaseReader::dateTimeToDbLatestTs(const QDateTime &ts)
|
||||||
{
|
{
|
||||||
if (!ts.isValid()) return "";
|
if (!ts.isValid()) { return ""; }
|
||||||
return ts.toUTC().toString(Qt::ISODate);
|
return ts.toUTC().toString(Qt::ISODate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -73,10 +73,11 @@ namespace BlackCore
|
|||||||
void pauseReader();
|
void pauseReader();
|
||||||
|
|
||||||
//! Used in unit test
|
//! Used in unit test
|
||||||
|
//! \remark needs to be done before started in different thread
|
||||||
void markAsUsedInUnitTest() { m_unitTest = true; }
|
void markAsUsedInUnitTest() { m_unitTest = true; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
mutable QReadWriteLock m_lock {QReadWriteLock::Recursive}; //!< lock which can be used from the derived classes
|
mutable QReadWriteLock m_lock { QReadWriteLock::Recursive }; //!< lock which can be used from the derived classes
|
||||||
|
|
||||||
//! Constructor
|
//! Constructor
|
||||||
CThreadedReader(QObject *owner, const QString &name);
|
CThreadedReader(QObject *owner, const QString &name);
|
||||||
@@ -97,7 +98,7 @@ namespace BlackCore
|
|||||||
//! This method does the actual work in the derived class
|
//! This method does the actual work in the derived class
|
||||||
virtual void doWorkImpl() {}
|
virtual void doWorkImpl() {}
|
||||||
|
|
||||||
//! Still enabled etc.
|
//! Still enabled etc.?
|
||||||
bool doWorkCheck() const;
|
bool doWorkCheck() const;
|
||||||
|
|
||||||
//! Use this to log inconsistent data
|
//! Use this to log inconsistent data
|
||||||
|
|||||||
@@ -625,8 +625,10 @@ namespace BlackGui
|
|||||||
{
|
{
|
||||||
if (CBuildConfig::isRunningOnWindowsNtPlatform())
|
if (CBuildConfig::isRunningOnWindowsNtPlatform())
|
||||||
{
|
{
|
||||||
QMessageBox::information(nullptr, QGuiApplication::applicationDisplayName(),
|
QMessageBox::information(nullptr,
|
||||||
QGuiApplication::applicationDisplayName() + ' ' + QCoreApplication::applicationVersion());
|
QGuiApplication::applicationDisplayName(),
|
||||||
|
QGuiApplication::applicationDisplayName() + ' ' +
|
||||||
|
QCoreApplication::applicationVersion());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -227,6 +227,5 @@ namespace BlackMisc
|
|||||||
template class BLACKMISC_EXPORT_DEFINE_TEMPLATE IDatastoreObjectList<BlackMisc::CCountry, BlackMisc::CCountryList, QString>;
|
template class BLACKMISC_EXPORT_DEFINE_TEMPLATE IDatastoreObjectList<BlackMisc::CCountry, BlackMisc::CCountryList, QString>;
|
||||||
template class BLACKMISC_EXPORT_DEFINE_TEMPLATE IDatastoreObjectList<BlackMisc::Aviation::CAirport, BlackMisc::Aviation::CAirportList, int>;
|
template class BLACKMISC_EXPORT_DEFINE_TEMPLATE IDatastoreObjectList<BlackMisc::Aviation::CAirport, BlackMisc::Aviation::CAirportList, int>;
|
||||||
//! \endcond
|
//! \endcond
|
||||||
|
|
||||||
} // ns
|
} // ns
|
||||||
} // ns
|
} // ns
|
||||||
|
|||||||
@@ -82,14 +82,13 @@ namespace BlackMisc
|
|||||||
extern template class BLACKMISC_EXPORT_DECLARE_TEMPLATE IDatastoreObjectList<BlackMisc::Aviation::CLivery, BlackMisc::Aviation::CLiveryList, int>;
|
extern template class BLACKMISC_EXPORT_DECLARE_TEMPLATE IDatastoreObjectList<BlackMisc::Aviation::CLivery, BlackMisc::Aviation::CLiveryList, int>;
|
||||||
extern template class BLACKMISC_EXPORT_DECLARE_TEMPLATE IDatastoreObjectList<BlackMisc::Aviation::CAircraftIcaoCode, BlackMisc::Aviation::CAircraftIcaoCodeList, int>;
|
extern template class BLACKMISC_EXPORT_DECLARE_TEMPLATE IDatastoreObjectList<BlackMisc::Aviation::CAircraftIcaoCode, BlackMisc::Aviation::CAircraftIcaoCodeList, int>;
|
||||||
extern template class BLACKMISC_EXPORT_DECLARE_TEMPLATE IDatastoreObjectList<BlackMisc::Aviation::CAirlineIcaoCode, BlackMisc::Aviation::CAirlineIcaoCodeList, int>;
|
extern template class BLACKMISC_EXPORT_DECLARE_TEMPLATE IDatastoreObjectList<BlackMisc::Aviation::CAirlineIcaoCode, BlackMisc::Aviation::CAirlineIcaoCodeList, int>;
|
||||||
|
extern template class BLACKMISC_EXPORT_DECLARE_TEMPLATE IDatastoreObjectList<BlackMisc::Aviation::CAirport, BlackMisc::Aviation::CAirportList, int>;
|
||||||
extern template class BLACKMISC_EXPORT_DECLARE_TEMPLATE IDatastoreObjectList<BlackMisc::Db::CDbInfo, BlackMisc::Db::CDbInfoList, int>;
|
extern template class BLACKMISC_EXPORT_DECLARE_TEMPLATE IDatastoreObjectList<BlackMisc::Db::CDbInfo, BlackMisc::Db::CDbInfoList, int>;
|
||||||
extern template class BLACKMISC_EXPORT_DECLARE_TEMPLATE IDatastoreObjectList<BlackMisc::Db::CDistribution, BlackMisc::Db::CDistributionList, int>;
|
extern template class BLACKMISC_EXPORT_DECLARE_TEMPLATE IDatastoreObjectList<BlackMisc::Db::CDistribution, BlackMisc::Db::CDistributionList, int>;
|
||||||
extern template class BLACKMISC_EXPORT_DECLARE_TEMPLATE IDatastoreObjectList<BlackMisc::Simulation::CAircraftModel, BlackMisc::Simulation::CAircraftModelList, int>;
|
extern template class BLACKMISC_EXPORT_DECLARE_TEMPLATE IDatastoreObjectList<BlackMisc::Simulation::CAircraftModel, BlackMisc::Simulation::CAircraftModelList, int>;
|
||||||
extern template class BLACKMISC_EXPORT_DECLARE_TEMPLATE IDatastoreObjectList<BlackMisc::Simulation::CDistributor, BlackMisc::Simulation::CDistributorList, QString>;
|
extern template class BLACKMISC_EXPORT_DECLARE_TEMPLATE IDatastoreObjectList<BlackMisc::Simulation::CDistributor, BlackMisc::Simulation::CDistributorList, QString>;
|
||||||
extern template class BLACKMISC_EXPORT_DECLARE_TEMPLATE IDatastoreObjectList<BlackMisc::CCountry, BlackMisc::CCountryList, QString>;
|
extern template class BLACKMISC_EXPORT_DECLARE_TEMPLATE IDatastoreObjectList<BlackMisc::CCountry, BlackMisc::CCountryList, QString>;
|
||||||
extern template class BLACKMISC_EXPORT_DECLARE_TEMPLATE IDatastoreObjectList<BlackMisc::Aviation::CAirport, BlackMisc::Aviation::CAirportList, int>;
|
|
||||||
//! \endcond
|
//! \endcond
|
||||||
|
|
||||||
} // ns
|
} // ns
|
||||||
} //ns
|
} //ns
|
||||||
|
|
||||||
|
|||||||
@@ -7,23 +7,15 @@
|
|||||||
* contained in the LICENSE file.
|
* contained in the LICENSE file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "blackmisc/network/clientlist.h"
|
#include "clientlist.h"
|
||||||
#include "blackmisc/metaclassprivate.h"
|
|
||||||
|
|
||||||
#include <QString>
|
|
||||||
#include <tuple>
|
|
||||||
|
|
||||||
using namespace BlackMisc::Aviation;
|
|
||||||
|
|
||||||
namespace BlackMisc
|
namespace BlackMisc
|
||||||
{
|
{
|
||||||
namespace Network
|
namespace Network
|
||||||
{
|
{
|
||||||
|
|
||||||
CClientList::CClientList() { }
|
CClientList::CClientList() { }
|
||||||
|
|
||||||
CClientList::CClientList(const CSequence &other) : CSequence<CClient>(other)
|
CClientList::CClientList(const CSequence &other) : CSequence<CClient>(other)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|||||||
@@ -18,7 +18,6 @@
|
|||||||
#include "blackmisc/network/client.h"
|
#include "blackmisc/network/client.h"
|
||||||
#include "blackmisc/sequence.h"
|
#include "blackmisc/sequence.h"
|
||||||
#include "blackmisc/variant.h"
|
#include "blackmisc/variant.h"
|
||||||
|
|
||||||
#include <QMetaType>
|
#include <QMetaType>
|
||||||
|
|
||||||
namespace BlackMisc
|
namespace BlackMisc
|
||||||
@@ -39,7 +38,6 @@ namespace BlackMisc
|
|||||||
|
|
||||||
//! Construct from a base class object.
|
//! Construct from a base class object.
|
||||||
CClientList(const CSequence &other);
|
CClientList(const CSequence &other);
|
||||||
|
|
||||||
};
|
};
|
||||||
} //namespace
|
} //namespace
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|||||||
@@ -58,7 +58,6 @@ namespace BlackMisc
|
|||||||
//! From our database JSON format
|
//! From our database JSON format
|
||||||
static CRoleList fromDatabaseJson(const QJsonArray &array);
|
static CRoleList fromDatabaseJson(const QJsonArray &array);
|
||||||
};
|
};
|
||||||
|
|
||||||
} //namespace
|
} //namespace
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
|
|||||||
@@ -234,48 +234,32 @@ namespace BlackMisc
|
|||||||
return q;
|
return q;
|
||||||
}
|
}
|
||||||
|
|
||||||
CVariant CUrl::propertyByIndex(const BlackMisc::CPropertyIndex &index) const
|
CVariant CUrl::propertyByIndex(const CPropertyIndex &index) const
|
||||||
{
|
{
|
||||||
if (index.isMyself()) { return CVariant::from(*this); }
|
if (index.isMyself()) { return CVariant::from(*this); }
|
||||||
ColumnIndex i = index.frontCasted<ColumnIndex>();
|
const ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||||
switch (i)
|
switch (i)
|
||||||
{
|
{
|
||||||
case IndexHost:
|
case IndexHost: return CVariant::fromValue(this->m_host);
|
||||||
return CVariant::fromValue(this->m_host);
|
case IndexPort: return CVariant::fromValue(this->m_port);
|
||||||
case IndexPort:
|
case IndexScheme: return CVariant::fromValue(this->m_scheme);
|
||||||
return CVariant::fromValue(this->m_port);
|
case IndexPath: return CVariant::fromValue(this->m_path);
|
||||||
case IndexScheme:
|
default: return CValueObject::propertyByIndex(index);
|
||||||
return CVariant::fromValue(this->m_scheme);
|
|
||||||
case IndexPath:
|
|
||||||
return CVariant::fromValue(this->m_path);
|
|
||||||
default:
|
|
||||||
return CValueObject::propertyByIndex(index);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CUrl::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant)
|
void CUrl::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant)
|
||||||
{
|
{
|
||||||
if (index.isMyself()) { (*this) = variant.to<CUrl>(); return; }
|
if (index.isMyself()) { (*this) = variant.to<CUrl>(); return; }
|
||||||
ColumnIndex i = index.frontCasted<ColumnIndex>();
|
const ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||||
switch (i)
|
switch (i)
|
||||||
{
|
{
|
||||||
case IndexHost:
|
case IndexHost: this->setHost(variant.value<QString>()); break;
|
||||||
this->setHost(variant.value<QString>());
|
case IndexPort: this->setPort(variant.value<qint32>()); break;
|
||||||
break;
|
case IndexPath: this->setPath(variant.value<QString>()); break;
|
||||||
case IndexPort:
|
case IndexScheme: this->setScheme(variant.value<QString>()); break;
|
||||||
this->setPort(variant.value<qint32>());
|
default: CValueObject::setPropertyByIndex(index, variant); break;
|
||||||
break;
|
|
||||||
case IndexPath:
|
|
||||||
this->setPath(variant.value<QString>());
|
|
||||||
break;
|
|
||||||
case IndexScheme:
|
|
||||||
this->setScheme(variant.value<QString>());
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
CValueObject::setPropertyByIndex(index, variant);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|||||||
@@ -9,8 +9,8 @@
|
|||||||
|
|
||||||
//! \file
|
//! \file
|
||||||
|
|
||||||
#ifndef BLACKMISC_NETWORK_NETWORKLOCATION_H
|
#ifndef BLACKMISC_NETWORK_URL_H
|
||||||
#define BLACKMISC_NETWORK_NETWORKLOCATION_H
|
#define BLACKMISC_NETWORK_URL_H
|
||||||
|
|
||||||
#include "blackmisc/blackmiscexport.h"
|
#include "blackmisc/blackmiscexport.h"
|
||||||
#include "blackmisc/metaclass.h"
|
#include "blackmisc/metaclass.h"
|
||||||
|
|||||||
@@ -9,8 +9,8 @@
|
|||||||
|
|
||||||
//! \file
|
//! \file
|
||||||
|
|
||||||
#ifndef BLACKMISC_NETWORK_NETWORKLOCATIONLIST_H
|
#ifndef BLACKMISC_NETWORK_URLLIST_H
|
||||||
#define BLACKMISC_NETWORK_NETWORKLOCATIONLIST_H
|
#define BLACKMISC_NETWORK_URLLIST_H
|
||||||
|
|
||||||
#include "blackmisc/blackmiscexport.h"
|
#include "blackmisc/blackmiscexport.h"
|
||||||
#include "blackmisc/collection.h"
|
#include "blackmisc/collection.h"
|
||||||
@@ -26,7 +26,7 @@ namespace BlackMisc
|
|||||||
{
|
{
|
||||||
namespace Network
|
namespace Network
|
||||||
{
|
{
|
||||||
//! Value object encapsulating a list of servers.
|
//! Value object encapsulating a list of URLs.
|
||||||
class BLACKMISC_EXPORT CUrlList :
|
class BLACKMISC_EXPORT CUrlList :
|
||||||
public CSequence<CUrl>,
|
public CSequence<CUrl>,
|
||||||
public BlackMisc::Mixin::MetaType<CUrlList>
|
public BlackMisc::Mixin::MetaType<CUrlList>
|
||||||
|
|||||||
@@ -174,7 +174,7 @@ namespace BlackMisc
|
|||||||
bool ITimestampBased::canHandleIndex(const CPropertyIndex &index)
|
bool ITimestampBased::canHandleIndex(const CPropertyIndex &index)
|
||||||
{
|
{
|
||||||
if (index.isEmpty()) { return false; }
|
if (index.isEmpty()) { return false; }
|
||||||
int i = index.frontCasted<int>();
|
const int i = index.frontCasted<int>();
|
||||||
return (i >= static_cast<int>(IndexUtcTimestamp)) && (i <= static_cast<int>(IndexMSecsSinceEpoch));
|
return (i >= static_cast<int>(IndexUtcTimestamp)) && (i <= static_cast<int>(IndexMSecsSinceEpoch));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -182,7 +182,7 @@ namespace BlackMisc
|
|||||||
{
|
{
|
||||||
if (!index.isEmpty())
|
if (!index.isEmpty())
|
||||||
{
|
{
|
||||||
ColumnIndex i = index.frontCasted<ColumnIndex>();
|
const ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||||
switch (i)
|
switch (i)
|
||||||
{
|
{
|
||||||
case IndexUtcTimestamp:
|
case IndexUtcTimestamp:
|
||||||
@@ -212,7 +212,7 @@ namespace BlackMisc
|
|||||||
{
|
{
|
||||||
if (!index.isEmpty())
|
if (!index.isEmpty())
|
||||||
{
|
{
|
||||||
ColumnIndex i = index.frontCasted<ColumnIndex>();
|
const ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||||
switch (i)
|
switch (i)
|
||||||
{
|
{
|
||||||
case IndexUtcTimestamp:
|
case IndexUtcTimestamp:
|
||||||
|
|||||||
Reference in New Issue
Block a user