Formatting

This commit is contained in:
Klaus Basan
2018-03-19 20:26:06 +01:00
parent 28b270a4cf
commit 011f31ad2b
7 changed files with 30 additions and 23 deletions

View File

@@ -484,6 +484,8 @@ namespace BlackCore
/*! /*!
* We received a reply to one of our queries. * We received a reply to one of our queries.
* \sa sendCapabilitiesQuery * \sa sendCapabilitiesQuery
* @param callsign
* @param capabilitiesFlags as in BlackMisc::Network::CClient
*/ */
void capabilitiesReplyReceived(const BlackMisc::Aviation::CCallsign &callsign, int capabilitiesFlags); void capabilitiesReplyReceived(const BlackMisc::Aviation::CCallsign &callsign, int capabilitiesFlags);

View File

@@ -50,14 +50,14 @@ namespace BlackCore
QDateTime CThreadedReader::getUpdateTimestamp() const QDateTime CThreadedReader::getUpdateTimestamp() const
{ {
QReadLocker lock(&this->m_lock); QReadLocker lock(&m_lock);
return this->m_updateTimestamp; return m_updateTimestamp;
} }
void CThreadedReader::setUpdateTimestamp(const QDateTime &updateTimestamp) void CThreadedReader::setUpdateTimestamp(const QDateTime &updateTimestamp)
{ {
QWriteLocker lock(&this->m_lock); QWriteLocker lock(&m_lock);
this->m_updateTimestamp = updateTimestamp; m_updateTimestamp = updateTimestamp;
} }
bool CThreadedReader::updatedWithinLastMs(qint64 timeLastMs) bool CThreadedReader::updatedWithinLastMs(qint64 timeLastMs)
@@ -105,31 +105,31 @@ namespace BlackCore
{ {
uint oldHash = 0; uint oldHash = 0;
{ {
QReadLocker rl(&this->m_lock); QReadLocker rl(&m_lock);
oldHash = this->m_contentHash; oldHash = m_contentHash;
} }
uint newHash = qHash(startPosition < 0 ? content : content.mid(startPosition)); uint newHash = qHash(startPosition < 0 ? content : content.mid(startPosition));
if (oldHash == newHash) { return false; } if (oldHash == newHash) { return false; }
{ {
QWriteLocker wl(&this->m_lock); QWriteLocker wl(&m_lock);
this->m_contentHash = newHash; m_contentHash = newHash;
} }
return true; return true;
} }
bool CThreadedReader::isMarkedAsFailed() const bool CThreadedReader::isMarkedAsFailed() const
{ {
return this->m_markedAsFailed; return m_markedAsFailed;
} }
void CThreadedReader::setMarkedAsFailed(bool failed) void CThreadedReader::setMarkedAsFailed(bool failed)
{ {
this->m_markedAsFailed = failed; m_markedAsFailed = failed;
} }
CUrlLogList CThreadedReader::getReadLog() const CUrlLogList CThreadedReader::getReadLog() const
{ {
QReadLocker rl(&this->m_lock); QReadLocker rl(&m_lock);
return m_urlReadLog; return m_urlReadLog;
} }
@@ -165,15 +165,14 @@ namespace BlackCore
bool CThreadedReader::doWorkCheck() const bool CThreadedReader::doWorkCheck() const
{ {
// sApp->hasWebDataServices() cannot be used, as some readers are already used during init phase // sApp->hasWebDataServices() cannot be used, as some readers are already used during init phase
if (!m_unitTest && (!sApp || sApp->isShuttingDown())) { return false; }
if (!isEnabled()) { return false; } if (!isEnabled()) { return false; }
if (isAbandoned()) { return false; } if (isAbandoned()) { return false; }
if (!m_unitTest && (!sApp || sApp->isShuttingDown())) { return false; }
return true; return true;
} }
QNetworkReply *CThreadedReader::getFromNetworkAndLog(const CUrl &url, const BlackMisc::CSlot<void (QNetworkReply *)> &callback) QNetworkReply *CThreadedReader::getFromNetworkAndLog(const CUrl &url, const BlackMisc::CSlot<void (QNetworkReply *)> &callback)
{ {
// returned QNetworkReply normally nullptr since QAM is in different thread
QWriteLocker wl(&m_lock); QWriteLocker wl(&m_lock);
const CUrlLogList outdatedPendingUrls = m_urlReadLog.findOutdatedPending(OutdatedPendingCallMs); const CUrlLogList outdatedPendingUrls = m_urlReadLog.findOutdatedPending(OutdatedPendingCallMs);
if (!outdatedPendingUrls.isEmpty()) if (!outdatedPendingUrls.isEmpty())
@@ -184,6 +183,8 @@ namespace BlackCore
const int id = m_urlReadLog.addPendingUrl(url); const int id = m_urlReadLog.addPendingUrl(url);
wl.unlock(); wl.unlock();
// returned QNetworkReply normally nullptr since QAM is in different thread
return sApp->getFromNetwork(url, id, callback); return sApp->getFromNetwork(url, id, callback);
} }

View File

@@ -139,7 +139,7 @@ namespace BlackCore
int m_periodicTime = -1; //!< Periodic time after which the task is repeated int m_periodicTime = -1; //!< Periodic time after which the task is repeated
QDateTime m_updateTimestamp; //!< when file/resource was read QDateTime m_updateTimestamp; //!< when file/resource was read
uint m_contentHash = 0; //!< has of the content given uint m_contentHash = 0; //!< has of the content given
std::atomic<bool> m_markedAsFailed { false }; //!< marker if reading failed std::atomic_bool m_markedAsFailed { false }; //!< marker if reading failed
bool m_unitTest { false }; //!< mark as unit test bool m_unitTest { false }; //!< mark as unit test
BlackMisc::Network::CUrlLogList m_urlReadLog; //!< URL based reading can be logged BlackMisc::Network::CUrlLogList m_urlReadLog; //!< URL based reading can be logged
}; };

View File

@@ -41,7 +41,7 @@ namespace BlackCore
{ {
//! Read vatsim data file //! Read vatsim data file
//! \sa http://info.vroute.net/vatsim-data.txt //! \sa http://info.vroute.net/vatsim-data.txt
class BLACKCORE_EXPORT CVatsimDataFileReader : public BlackCore::CThreadedReader class BLACKCORE_EXPORT CVatsimDataFileReader : public CThreadedReader
{ {
Q_OBJECT Q_OBJECT

View File

@@ -32,10 +32,10 @@ namespace BlackMisc
//! Value object encapsulating a list of distributors. //! Value object encapsulating a list of distributors.
class BLACKMISC_EXPORT CDistributorList : class BLACKMISC_EXPORT CDistributorList :
public BlackMisc::CSequence<CDistributor>, public CSequence<CDistributor>,
public BlackMisc::Db::IDatastoreObjectList<CDistributor, CDistributorList, QString>, public Db::IDatastoreObjectList<CDistributor, CDistributorList, QString>,
public BlackMisc::IOrderableList<CDistributor, CDistributorList>, public IOrderableList<CDistributor, CDistributorList>,
public BlackMisc::Mixin::MetaType<CDistributorList> public Mixin::MetaType<CDistributorList>
{ {
public: public:
BLACKMISC_DECLARE_USING_MIXIN_METATYPE(CDistributorList) BLACKMISC_DECLARE_USING_MIXIN_METATYPE(CDistributorList)

View File

@@ -39,9 +39,11 @@ namespace BlackSimPlugin
}; };
//! Constructor //! Constructor
CFs9Client(const BlackMisc::Aviation::CCallsign &callsign, const QString &modelName, CFs9Client(const BlackMisc::Aviation::CCallsign &callsign,
const QString &modelName,
const BlackMisc::PhysicalQuantities::CTime &updateInterval, const BlackMisc::PhysicalQuantities::CTime &updateInterval,
BlackMisc::Simulation::CInterpolationLogger *logger, QObject *owner); BlackMisc::Simulation::CInterpolationLogger *logger,
BlackCore::ISimulator *owner);
//! Destructor //! Destructor
virtual ~CFs9Client(); virtual ~CFs9Client();
@@ -79,11 +81,13 @@ namespace BlackSimPlugin
//! Enumerate all FS9 session hosts //! Enumerate all FS9 session hosts
HRESULT enumDirectPlayHosts(); HRESULT enumDirectPlayHosts();
//! Create host address
HRESULT createHostAddress(); HRESULT createHostAddress();
//! Start hosting session //! Start hosting session
HRESULT connectToSession(const BlackMisc::Aviation::CCallsign &callsign); HRESULT connectToSession(const BlackMisc::Aviation::CCallsign &callsign);
//! Close the connection
HRESULT closeConnection(); HRESULT closeConnection();
void sendMultiplayerPosition(const BlackMisc::Aviation::CAircraftSituation &situation); void sendMultiplayerPosition(const BlackMisc::Aviation::CAircraftSituation &situation);

View File

@@ -16,8 +16,8 @@
#include "fs9client.h" #include "fs9client.h"
#include "lobbyclient.h" #include "lobbyclient.h"
#include "../fscommon/simulatorfscommon.h" #include "../fscommon/simulatorfscommon.h"
#include "blackmisc/simulation/settings/simulatorsettings.h"
#include "blackcore/simulator.h" #include "blackcore/simulator.h"
#include "blackmisc/simulation/settings/simulatorsettings.h"
#include "blackmisc/simulation/interpolator.h" #include "blackmisc/simulation/interpolator.h"
#include "blackmisc/simulation/simulatedaircraft.h" #include "blackmisc/simulation/simulatedaircraft.h"
#include "blackmisc/simulation/simulatorplugininfo.h" #include "blackmisc/simulation/simulatorplugininfo.h"
@@ -33,7 +33,7 @@ namespace BlackSimPlugin
namespace Fs9 namespace Fs9
{ {
//! FS9 Simulator Implementation //! FS9 Simulator Implementation
class CSimulatorFs9 : public BlackSimPlugin::FsCommon::CSimulatorFsCommon class CSimulatorFs9 : public FsCommon::CSimulatorFsCommon
{ {
Q_OBJECT Q_OBJECT