refs #380, use CWorker instead of QConcurrent for threaded reader (bookings/VATSIM file)

This commit is contained in:
Klaus Basan
2015-02-13 02:06:33 +01:00
parent 1da3f58fec
commit 5d491b9456
8 changed files with 189 additions and 157 deletions

View File

@@ -30,7 +30,7 @@ namespace BlackCore
/*!
* Read bookings from VATSIM
*/
class CVatsimDataFileReader : public BlackMisc::CThreadedReader<void>
class CVatsimDataFileReader : public BlackMisc::CThreadedReader
{
Q_OBJECT
@@ -38,9 +38,6 @@ namespace BlackCore
//! Constructor
explicit CVatsimDataFileReader(QObject *owner, const QStringList &urls);
//! Read / re-read data file
void read();
//! Get aircrafts
//! \threadsafe
BlackMisc::Aviation::CAircraftList getAircraft() const;
@@ -93,14 +90,20 @@ namespace BlackCore
//! \threadsafe
void updateWithVatsimDataFileData(BlackMisc::Aviation::CAircraft &aircraftToBeUdpated) const;
//! Start reading in own thread
void readInBackgroundThread();
private slots:
//! Data have been read
void ps_loadFinished(QNetworkReply *nwReply);
//! Data have been read, parse VATSIM file
void ps_parseVatsimFile(QNetworkReply *nwReply);
//! Read / re-read data file
void ps_read();
private:
QNetworkAccessManager *m_networkManager = nullptr;
QStringList m_serviceUrls; /*!< URL of the service */
int m_currentUrlIndex;
QNetworkAccessManager *m_networkManager;
BlackMisc::Network::CServerList m_voiceServers;
BlackMisc::Network::CServerList m_fsdServers;
BlackMisc::Aviation::CAtcStationList m_atcStations;
@@ -123,9 +126,6 @@ namespace BlackCore
//! Get current section
static Section currentLineToSection(const QString &currentLine);
//! Parse the VATSIM data file in backgroun
void parseVatsimFileInBackground(QNetworkReply *nwReplyPtr);
signals:
//! Data have been read
void dataRead();