refactor: Data and METAR are not triggered externally

This commit is contained in:
Lars Toenning
2025-06-09 13:13:34 +02:00
parent 1fcf13c326
commit fe74a12517
5 changed files with 5 additions and 41 deletions

View File

@@ -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()

View File

@@ -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);

View File

@@ -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);

View File

@@ -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;

View File

@@ -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)
{ {