mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 23:05:36 +08:00
Formatting
This commit is contained in:
committed by
Mathew Sutcliffe
parent
eab22e86b0
commit
a22cd134f8
@@ -506,26 +506,26 @@ namespace BlackCore
|
||||
int maxRedirects,
|
||||
std::function<QNetworkReply *(QNetworkAccessManager &, const QNetworkRequest &)> requestOrPostMethod);
|
||||
|
||||
QNetworkAccessManager *m_accessManager = nullptr; //!< single network access manager
|
||||
QNetworkAccessManager *m_accessManager = nullptr; //!< single network access manager
|
||||
BlackMisc::CApplicationInfo::Application m_application = BlackMisc::CApplicationInfo::Unknown; //!< Application if specified
|
||||
QScopedPointer<CCoreFacade> m_coreFacade; //!< core facade if any
|
||||
QScopedPointer<CSetupReader> m_setupReader; //!< setup reader
|
||||
QScopedPointer<CWebDataServices> m_webDataServices; //!< web data services
|
||||
QScopedPointer<BlackMisc::CFileLogger> m_fileLogger; //!< file logger
|
||||
CCookieManager m_cookieManager; //!< single cookie manager for our access manager
|
||||
QString m_applicationName; //!< application name
|
||||
QReadWriteLock m_accessManagerLock; //!< lock to make access manager access threadsafe
|
||||
CCoreFacadeConfig m_coreFacadeConfig; //!< Core facade config if any
|
||||
CWebReaderFlags::WebReader m_webReadersUsed; //!< Readers to be used
|
||||
BlackCore::Db::CDatabaseReaderConfigList m_dbReaderConfig; //!< Load or used caching?
|
||||
std::atomic<bool> m_shutdown { false }; //!< is being shutdown?
|
||||
QScopedPointer<CCoreFacade> m_coreFacade; //!< core facade if any
|
||||
QScopedPointer<CSetupReader> m_setupReader; //!< setup reader
|
||||
QScopedPointer<CWebDataServices> m_webDataServices; //!< web data services
|
||||
QScopedPointer<BlackMisc::CFileLogger> m_fileLogger; //!< file logger
|
||||
CCookieManager m_cookieManager; //!< single cookie manager for our access manager
|
||||
QString m_applicationName; //!< application name
|
||||
QReadWriteLock m_accessManagerLock; //!< lock to make access manager access threadsafe
|
||||
CCoreFacadeConfig m_coreFacadeConfig; //!< Core facade config if any
|
||||
CWebReaderFlags::WebReader m_webReadersUsed; //!< Readers to be used
|
||||
BlackCore::Db::CDatabaseReaderConfigList m_dbReaderConfig; //!< Load or used caching?
|
||||
std::atomic<bool> m_shutdown { false }; //!< is being shutdown?
|
||||
QTimer m_internetAccessTimer { this };
|
||||
bool m_useContexts = false; //!< use contexts
|
||||
bool m_useWebData = false; //!< use web data
|
||||
bool m_signalStartup = true; //!< signal startup automatically
|
||||
bool m_devEnv = false; //!< dev. environment
|
||||
bool m_unitTest = false; //!< is UNIT test
|
||||
bool m_autoSaveSettings = true; //!< automatically saving all settings
|
||||
bool m_useContexts = false; //!< use contexts
|
||||
bool m_useWebData = false; //!< use web data
|
||||
bool m_signalStartup = true; //!< signal startup automatically
|
||||
bool m_devEnv = false; //!< dev. environment
|
||||
bool m_unitTest = false; //!< is UNIT test
|
||||
bool m_autoSaveSettings = true; //!< automatically saving all settings
|
||||
bool m_internetAccessible = true; //!< Internet accessible
|
||||
|
||||
// -------------- crashpad -----------------
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
*/
|
||||
|
||||
#include "blackcore/data/vatsimsetup.h"
|
||||
|
||||
#include <QStringList>
|
||||
|
||||
using namespace BlackMisc;
|
||||
@@ -66,15 +65,12 @@ namespace BlackCore
|
||||
if (index.isMyself()) { return CVariant::from(*this); }
|
||||
if (ITimestampBased::canHandleIndex(index)) { return ITimestampBased::propertyByIndex(index); }
|
||||
|
||||
ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||
const ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||
switch (i)
|
||||
{
|
||||
case IndexFsdServers:
|
||||
return CVariant::fromValue(this->m_fsdServers);
|
||||
case IndexDataFiles:
|
||||
return CVariant::fromValue(this->m_dataFileUrls);
|
||||
default:
|
||||
return CValueObject::propertyByIndex(index);
|
||||
case IndexFsdServers: return CVariant::fromValue(this->m_fsdServers);
|
||||
case IndexDataFiles: return CVariant::fromValue(this->m_dataFileUrls);
|
||||
default: return CValueObject::propertyByIndex(index);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,18 +83,12 @@ namespace BlackCore
|
||||
return;
|
||||
}
|
||||
|
||||
ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||
const ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||
switch (i)
|
||||
{
|
||||
case IndexFsdServers:
|
||||
this->m_fsdServers = variant.value<CServerList>();
|
||||
break;
|
||||
case IndexDataFiles:
|
||||
this->m_dataFileUrls = variant.value<CUrlList>();
|
||||
break;
|
||||
default:
|
||||
CValueObject::setPropertyByIndex(index, variant);
|
||||
break;
|
||||
case IndexFsdServers: this->m_fsdServers = variant.value<CServerList>(); break;
|
||||
case IndexDataFiles: this->m_dataFileUrls = variant.value<CUrlList>(); break;
|
||||
default: CValueObject::setPropertyByIndex(index, variant); break;
|
||||
}
|
||||
}
|
||||
} // ns
|
||||
|
||||
@@ -89,8 +89,8 @@ namespace BlackCore
|
||||
|
||||
QString query = params.toString();
|
||||
const QNetworkRequest request(CNetworkUtils::getNetworkRequest(url, CNetworkUtils::PostUrlEncoded));
|
||||
sApp->postToNetwork(request, query.toUtf8(), { this, &CDatabaseAuthenticationService::parseServerResponse});
|
||||
QString rm("Sent request to authentication server %1");
|
||||
sApp->postToNetwork(request, CApplication::NoLogRequestId, query.toUtf8(), { this, &CDatabaseAuthenticationService::parseServerResponse});
|
||||
static const QString rm("Sent request to authentication server '%1'");
|
||||
msgs.push_back(CStatusMessage(cats, CStatusMessage::SeverityInfo, rm.arg(url.toQString())));
|
||||
return msgs;
|
||||
}
|
||||
|
||||
@@ -601,10 +601,8 @@ namespace BlackCore
|
||||
Q_ASSERT_X(CEntityFlags::isSingleEntity(entity), Q_FUNC_INFO, "needs single entity");
|
||||
switch (mode)
|
||||
{
|
||||
case CDbFlags::Shared:
|
||||
return CDbInfo::entityToSharedName(entity);
|
||||
case CDbFlags::SharedInfoOnly:
|
||||
return CDbInfo::sharedInfoFileName();
|
||||
case CDbFlags::Shared: return CDbInfo::entityToSharedName(entity);
|
||||
case CDbFlags::SharedInfoOnly: return CDbInfo::sharedInfoFileName();
|
||||
default:
|
||||
case CDbFlags::DbReading:
|
||||
return CDbInfo::entityToServiceName(entity);
|
||||
@@ -613,7 +611,7 @@ namespace BlackCore
|
||||
|
||||
QString CDatabaseReader::dateTimeToDbLatestTs(const QDateTime &ts)
|
||||
{
|
||||
if (!ts.isValid()) return "";
|
||||
if (!ts.isValid()) { return ""; }
|
||||
return ts.toUTC().toString(Qt::ISODate);
|
||||
}
|
||||
|
||||
|
||||
@@ -262,10 +262,10 @@ namespace BlackCore
|
||||
void sharedFileHeaderRead(BlackMisc::Network::CEntityFlags::Entity entity, const QString &fileName, bool success);
|
||||
|
||||
protected:
|
||||
CDatabaseReaderConfigList m_config; //!< DB reder configuration
|
||||
QString m_statusMessage; //!< Returned status message from watchdog
|
||||
bool m_1stReplyReceived = false; //!< Successful connection? Does not mean data / authorizations are correct
|
||||
mutable QReadWriteLock m_statusLock; //!< Lock
|
||||
CDatabaseReaderConfigList m_config; //!< DB reder configuration
|
||||
QString m_statusMessage; //!< Returned status message from watchdog
|
||||
bool m_1stReplyReceived = false; //!< Successful connection? Does not mean data / authorizations are correct
|
||||
mutable QReadWriteLock m_statusLock; //!< Lock
|
||||
QNetworkReply::NetworkError m_1stReplyStatus = QNetworkReply::UnknownServerError; //!< Successful connection?
|
||||
QMap<BlackMisc::Network::CEntityFlags::Entity, HeaderResponse> m_sharedFileResponses; //!< file responses of the shared files
|
||||
BlackMisc::CStatusMessage::StatusSeverity m_severityNoWorkingUrl = BlackMisc::CStatusMessage::SeverityError; //!< severity of message if there is no working URL
|
||||
|
||||
@@ -61,9 +61,9 @@ namespace BlackCore
|
||||
|
||||
private:
|
||||
BlackMisc::Network::CUrl m_modelPublishUrl;
|
||||
QNetworkReply *m_pendingReply = nullptr;
|
||||
qint64 m_replyPendingSince = -1;
|
||||
bool m_shutdown = false;
|
||||
QNetworkReply *m_pendingReply = nullptr;
|
||||
qint64 m_replyPendingSince = -1;
|
||||
bool m_shutdown = false;
|
||||
|
||||
//! Kill the pending reply
|
||||
bool killPendingReply();
|
||||
|
||||
@@ -73,10 +73,11 @@ namespace BlackCore
|
||||
void pauseReader();
|
||||
|
||||
//! Used in unit test
|
||||
//! \remark needs to be done before started in different thread
|
||||
void markAsUsedInUnitTest() { m_unitTest = true; }
|
||||
|
||||
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
|
||||
CThreadedReader(QObject *owner, const QString &name);
|
||||
@@ -97,7 +98,7 @@ namespace BlackCore
|
||||
//! This method does the actual work in the derived class
|
||||
virtual void doWorkImpl() {}
|
||||
|
||||
//! Still enabled etc.
|
||||
//! Still enabled etc.?
|
||||
bool doWorkCheck() const;
|
||||
|
||||
//! Use this to log inconsistent data
|
||||
|
||||
@@ -625,8 +625,10 @@ namespace BlackGui
|
||||
{
|
||||
if (CBuildConfig::isRunningOnWindowsNtPlatform())
|
||||
{
|
||||
QMessageBox::information(nullptr, QGuiApplication::applicationDisplayName(),
|
||||
QGuiApplication::applicationDisplayName() + ' ' + QCoreApplication::applicationVersion());
|
||||
QMessageBox::information(nullptr,
|
||||
QGuiApplication::applicationDisplayName(),
|
||||
QGuiApplication::applicationDisplayName() + ' ' +
|
||||
QCoreApplication::applicationVersion());
|
||||
}
|
||||
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::Aviation::CAirport, BlackMisc::Aviation::CAirportList, int>;
|
||||
//! \endcond
|
||||
|
||||
} // 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::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::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::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::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::Aviation::CAirport, BlackMisc::Aviation::CAirportList, int>;
|
||||
//! \endcond
|
||||
|
||||
} // ns
|
||||
} //ns
|
||||
|
||||
|
||||
@@ -7,23 +7,15 @@
|
||||
* contained in the LICENSE file.
|
||||
*/
|
||||
|
||||
#include "blackmisc/network/clientlist.h"
|
||||
#include "blackmisc/metaclassprivate.h"
|
||||
|
||||
#include <QString>
|
||||
#include <tuple>
|
||||
|
||||
using namespace BlackMisc::Aviation;
|
||||
#include "clientlist.h"
|
||||
|
||||
namespace BlackMisc
|
||||
{
|
||||
namespace Network
|
||||
{
|
||||
|
||||
CClientList::CClientList() { }
|
||||
|
||||
CClientList::CClientList(const CSequence &other) : CSequence<CClient>(other)
|
||||
{ }
|
||||
|
||||
} // namespace
|
||||
} // namespace
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
#include "blackmisc/network/client.h"
|
||||
#include "blackmisc/sequence.h"
|
||||
#include "blackmisc/variant.h"
|
||||
|
||||
#include <QMetaType>
|
||||
|
||||
namespace BlackMisc
|
||||
@@ -39,7 +38,6 @@ namespace BlackMisc
|
||||
|
||||
//! Construct from a base class object.
|
||||
CClientList(const CSequence &other);
|
||||
|
||||
};
|
||||
} //namespace
|
||||
} // namespace
|
||||
|
||||
@@ -58,7 +58,6 @@ namespace BlackMisc
|
||||
//! From our database JSON format
|
||||
static CRoleList fromDatabaseJson(const QJsonArray &array);
|
||||
};
|
||||
|
||||
} //namespace
|
||||
} // namespace
|
||||
|
||||
|
||||
@@ -234,48 +234,32 @@ namespace BlackMisc
|
||||
return q;
|
||||
}
|
||||
|
||||
CVariant CUrl::propertyByIndex(const BlackMisc::CPropertyIndex &index) const
|
||||
CVariant CUrl::propertyByIndex(const CPropertyIndex &index) const
|
||||
{
|
||||
if (index.isMyself()) { return CVariant::from(*this); }
|
||||
ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||
const ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||
switch (i)
|
||||
{
|
||||
case IndexHost:
|
||||
return CVariant::fromValue(this->m_host);
|
||||
case IndexPort:
|
||||
return CVariant::fromValue(this->m_port);
|
||||
case IndexScheme:
|
||||
return CVariant::fromValue(this->m_scheme);
|
||||
case IndexPath:
|
||||
return CVariant::fromValue(this->m_path);
|
||||
default:
|
||||
return CValueObject::propertyByIndex(index);
|
||||
case IndexHost: return CVariant::fromValue(this->m_host);
|
||||
case IndexPort: return CVariant::fromValue(this->m_port);
|
||||
case IndexScheme: 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)
|
||||
{
|
||||
if (index.isMyself()) { (*this) = variant.to<CUrl>(); return; }
|
||||
ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||
const ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||
switch (i)
|
||||
{
|
||||
case IndexHost:
|
||||
this->setHost(variant.value<QString>());
|
||||
break;
|
||||
case IndexPort:
|
||||
this->setPort(variant.value<qint32>());
|
||||
break;
|
||||
case IndexPath:
|
||||
this->setPath(variant.value<QString>());
|
||||
break;
|
||||
case IndexScheme:
|
||||
this->setScheme(variant.value<QString>());
|
||||
break;
|
||||
default:
|
||||
CValueObject::setPropertyByIndex(index, variant);
|
||||
break;
|
||||
case IndexHost: this->setHost(variant.value<QString>()); break;
|
||||
case IndexPort: this->setPort(variant.value<qint32>()); 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
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
|
||||
//! \file
|
||||
|
||||
#ifndef BLACKMISC_NETWORK_NETWORKLOCATION_H
|
||||
#define BLACKMISC_NETWORK_NETWORKLOCATION_H
|
||||
#ifndef BLACKMISC_NETWORK_URL_H
|
||||
#define BLACKMISC_NETWORK_URL_H
|
||||
|
||||
#include "blackmisc/blackmiscexport.h"
|
||||
#include "blackmisc/metaclass.h"
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
|
||||
//! \file
|
||||
|
||||
#ifndef BLACKMISC_NETWORK_NETWORKLOCATIONLIST_H
|
||||
#define BLACKMISC_NETWORK_NETWORKLOCATIONLIST_H
|
||||
#ifndef BLACKMISC_NETWORK_URLLIST_H
|
||||
#define BLACKMISC_NETWORK_URLLIST_H
|
||||
|
||||
#include "blackmisc/blackmiscexport.h"
|
||||
#include "blackmisc/collection.h"
|
||||
@@ -26,7 +26,7 @@ namespace BlackMisc
|
||||
{
|
||||
namespace Network
|
||||
{
|
||||
//! Value object encapsulating a list of servers.
|
||||
//! Value object encapsulating a list of URLs.
|
||||
class BLACKMISC_EXPORT CUrlList :
|
||||
public CSequence<CUrl>,
|
||||
public BlackMisc::Mixin::MetaType<CUrlList>
|
||||
|
||||
@@ -174,7 +174,7 @@ namespace BlackMisc
|
||||
bool ITimestampBased::canHandleIndex(const CPropertyIndex &index)
|
||||
{
|
||||
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));
|
||||
}
|
||||
|
||||
@@ -182,7 +182,7 @@ namespace BlackMisc
|
||||
{
|
||||
if (!index.isEmpty())
|
||||
{
|
||||
ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||
const ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||
switch (i)
|
||||
{
|
||||
case IndexUtcTimestamp:
|
||||
@@ -212,7 +212,7 @@ namespace BlackMisc
|
||||
{
|
||||
if (!index.isEmpty())
|
||||
{
|
||||
ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||
const ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||
switch (i)
|
||||
{
|
||||
case IndexUtcTimestamp:
|
||||
|
||||
Reference in New Issue
Block a user