mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-30 05:51:23 +08:00
#refs 686, used settings in readers
* moved threaded reader to BlackCore (settings are normally BlackCore aware) * created ns/subfolder VATSIM * prepared settings for the VATSIM readers
This commit is contained in:
78
src/blackcore/vatsim/vatsimstatusfilereader.h
Normal file
78
src/blackcore/vatsim/vatsimstatusfilereader.h
Normal file
@@ -0,0 +1,78 @@
|
||||
/* Copyright (C) 2013
|
||||
* swift project Community / Contributors
|
||||
*
|
||||
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
|
||||
* directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
|
||||
* including this file, may be copied, modified, propagated, or distributed except according to the terms
|
||||
* contained in the LICENSE file.
|
||||
*/
|
||||
|
||||
//! \file
|
||||
|
||||
#ifndef BLACKCORE_VATSIM_VATSIMSTATUSFILEREADER_H
|
||||
#define BLACKCORE_VATSIM_VATSIMSTATUSFILEREADER_H
|
||||
|
||||
#include "blackcore/blackcoreexport.h"
|
||||
#include "blackcore/data/vatsimsetup.h"
|
||||
#include "blackmisc/datacache.h"
|
||||
#include "blackmisc/network/entityflags.h"
|
||||
#include "blackmisc/network/urllist.h"
|
||||
#include "blackcore/threadedreader.h"
|
||||
|
||||
#include <QObject>
|
||||
|
||||
class QNetworkReply;
|
||||
|
||||
namespace BlackCore
|
||||
{
|
||||
namespace Vatsim
|
||||
{
|
||||
//! Sole purpose is to read the URLs where VATSIM data can be downloaded
|
||||
//! \sa https://status.vatsim.net/
|
||||
class BLACKCORE_EXPORT CVatsimStatusFileReader : public BlackCore::CThreadedReader
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
//! Constructor
|
||||
explicit CVatsimStatusFileReader(QObject *owner);
|
||||
|
||||
//! METAR URLs
|
||||
//! \threadsafe
|
||||
BlackMisc::Network::CUrlList getMetarFileUrls() const;
|
||||
|
||||
//! Data file URLs
|
||||
//! \threadsafe
|
||||
BlackMisc::Network::CUrlList getDataFileUrls() const;
|
||||
|
||||
public slots:
|
||||
//! Start reading in own thread
|
||||
void readInBackgroundThread();
|
||||
|
||||
signals:
|
||||
//! Data have been read
|
||||
void dataFileRead(int lines);
|
||||
|
||||
//! Data have been read
|
||||
void dataRead(BlackMisc::Network::CEntityFlags::Entity entity, BlackMisc::Network::CEntityFlags::ReadState state, int number);
|
||||
|
||||
protected:
|
||||
//! \name BlackCore::CThreadedReader overrides
|
||||
//! @{
|
||||
virtual void cleanup() override;
|
||||
//! @}
|
||||
|
||||
private slots:
|
||||
//! Data have been read, parse VATSIM file
|
||||
void ps_parseVatsimFile(QNetworkReply *nwReply);
|
||||
|
||||
//! Read / re-read data file
|
||||
void ps_read();
|
||||
|
||||
private:
|
||||
BlackMisc::CData<BlackCore::Data::VatsimSetup> m_lastGoodSetup { this };
|
||||
};
|
||||
} // ns
|
||||
} // ns
|
||||
|
||||
#endif // guard
|
||||
Reference in New Issue
Block a user