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