mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-20 04:25:42 +08:00
refactor: Data and METAR are not triggered externally
This commit is contained in:
@@ -151,15 +151,6 @@ namespace swift::core::vatsim
|
|||||||
return users;
|
return users;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CVatsimDataFileReader::readInBackgroundThread()
|
|
||||||
{
|
|
||||||
QPointer<CVatsimDataFileReader> myself(this);
|
|
||||||
QTimer::singleShot(0, this, [=] {
|
|
||||||
if (!myself) { return; }
|
|
||||||
myself->read();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
void CVatsimDataFileReader::doWorkImpl() { this->read(); }
|
void CVatsimDataFileReader::doWorkImpl() { this->read(); }
|
||||||
|
|
||||||
void CVatsimDataFileReader::read()
|
void CVatsimDataFileReader::read()
|
||||||
|
|||||||
@@ -112,9 +112,6 @@ namespace swift::core::vatsim
|
|||||||
//! \threadsafe
|
//! \threadsafe
|
||||||
void updateWithVatsimDataFileData(swift::misc::simulation::CSimulatedAircraft &aircraftToBeUdpated) const;
|
void updateWithVatsimDataFileData(swift::misc::simulation::CSimulatedAircraft &aircraftToBeUdpated) const;
|
||||||
|
|
||||||
//! Start reading in own thread
|
|
||||||
void readInBackgroundThread();
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
//! Data have been read
|
//! Data have been read
|
||||||
void dataFileRead(int kB);
|
void dataFileRead(int kB);
|
||||||
|
|||||||
@@ -35,15 +35,6 @@ namespace swift::core::vatsim
|
|||||||
this->reloadSettings();
|
this->reloadSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CVatsimMetarReader::readInBackgroundThread()
|
|
||||||
{
|
|
||||||
QPointer<CVatsimMetarReader> myself(this);
|
|
||||||
QTimer::singleShot(0, this, [=] {
|
|
||||||
if (!myself) { return; }
|
|
||||||
myself->read();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
CMetarList CVatsimMetarReader::getMetars() const
|
CMetarList CVatsimMetarReader::getMetars() const
|
||||||
{
|
{
|
||||||
QReadLocker l(&m_lock);
|
QReadLocker l(&m_lock);
|
||||||
|
|||||||
@@ -29,9 +29,6 @@ namespace swift::core::vatsim
|
|||||||
//! Constructor
|
//! Constructor
|
||||||
explicit CVatsimMetarReader(QObject *owner);
|
explicit CVatsimMetarReader(QObject *owner);
|
||||||
|
|
||||||
//! Read / re-read metars
|
|
||||||
void readInBackgroundThread();
|
|
||||||
|
|
||||||
//! Get METARs
|
//! Get METARs
|
||||||
//! \threadsafe
|
//! \threadsafe
|
||||||
virtual swift::misc::weather::CMetarList getMetars() const;
|
virtual swift::misc::weather::CMetarList getMetars() const;
|
||||||
|
|||||||
@@ -217,24 +217,12 @@ namespace swift::core
|
|||||||
|
|
||||||
Q_ASSERT_X(!whatToRead.testFlag(CEntityFlags::DbInfoObjectEntity), Q_FUNC_INFO,
|
Q_ASSERT_X(!whatToRead.testFlag(CEntityFlags::DbInfoObjectEntity), Q_FUNC_INFO,
|
||||||
"Info object must be read upfront");
|
"Info object must be read upfront");
|
||||||
CEntityFlags::Entity triggeredRead = CEntityFlags::NoEntity;
|
Q_ASSERT_X(!whatToRead.testFlag(CEntityFlags::VatsimDataFile), Q_FUNC_INFO,
|
||||||
if (m_vatsimDataFileReader)
|
"Datafile is read periodically and should not be triggered manually!");
|
||||||
{
|
Q_ASSERT_X(!whatToRead.testFlag(CEntityFlags::MetarEntity), Q_FUNC_INFO,
|
||||||
if (whatToRead.testFlag(CEntityFlags::VatsimDataFile))
|
"METAR file is read periodically and should not be triggered manually!");
|
||||||
{
|
|
||||||
m_vatsimDataFileReader->readInBackgroundThread();
|
|
||||||
triggeredRead |= CEntityFlags::VatsimDataFile;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (m_vatsimMetarReader)
|
CEntityFlags::Entity triggeredRead = CEntityFlags::NoEntity;
|
||||||
{
|
|
||||||
if (whatToRead.testFlag(CEntityFlags::MetarEntity))
|
|
||||||
{
|
|
||||||
m_vatsimMetarReader->readInBackgroundThread();
|
|
||||||
triggeredRead |= CEntityFlags::MetarEntity;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (m_airportDataReader)
|
if (m_airportDataReader)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user