mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-15 01:05:35 +08:00
Ref T786, weather manager
* adjusted to new requestWeatherGrid * use fetchNextWeatherDataDeferred to make sure follow up calls are decoupled * for callbacks use weatherRequest.callback.singleShot so it is called in correct thread
This commit is contained in:
committed by
Mat Sutcliffe
parent
cc77183b05
commit
7304013eea
@@ -11,12 +11,13 @@
|
||||
#ifndef BLACKCORE_WEATHERMANAGER_H
|
||||
#define BLACKCORE_WEATHERMANAGER_H
|
||||
|
||||
#include "blackcore/blackcoreexport.h"
|
||||
#include "blackcore/pluginmanagerweatherdata.h"
|
||||
#include "blackmisc/identifier.h"
|
||||
#include "blackmisc/slot.h"
|
||||
#include "blackcore/blackcoreexport.h"
|
||||
#include "blackmisc/weather/weathergrid.h"
|
||||
#include "blackmisc/weather/weathergridprovider.h"
|
||||
#include "blackmisc/geo/coordinategeodetic.h"
|
||||
#include "blackmisc/identifier.h"
|
||||
#include "blackmisc/slot.h"
|
||||
|
||||
#include <QObject>
|
||||
#include <QVector>
|
||||
@@ -29,8 +30,8 @@ namespace BlackCore
|
||||
* CWeatherManager
|
||||
*/
|
||||
class BLACKCORE_EXPORT CWeatherManager :
|
||||
public QObject,
|
||||
public BlackMisc::Weather::IWeatherGridProvider
|
||||
public QObject,
|
||||
public BlackMisc::Weather::IWeatherGridProvider
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_INTERFACES(BlackMisc::Weather::IWeatherGridProvider)
|
||||
@@ -45,19 +46,18 @@ namespace BlackCore
|
||||
//! Is weather overwritten to clear?
|
||||
bool isWeatherClear() const { return m_isWeatherClear; }
|
||||
|
||||
//! Request weather grid
|
||||
void requestWeatherGrid(const BlackMisc::Weather::CWeatherGrid &weatherGrid, const BlackMisc::CIdentifier &identifier);
|
||||
//! \copydoc BlackMisc::Weather::IWeatherGridProvider::requestWeatherGrid
|
||||
virtual void requestWeatherGrid(const BlackMisc::Geo::ICoordinateGeodetic &position, const BlackMisc::CIdentifier &identifier) override;
|
||||
|
||||
//! \copydoc BlackMisc::Weather::IWeatherGridProvider::requestWeatherGrid
|
||||
virtual void requestWeatherGrid(const BlackMisc::Weather::CWeatherGrid &weatherGrid,
|
||||
virtual void requestWeatherGrid(const BlackMisc::Weather::CWeatherGrid &initialWeatherGrid,
|
||||
const BlackMisc::CSlot<void(const BlackMisc::Weather::CWeatherGrid &)> &callback) override;
|
||||
|
||||
//! \copydoc BlackMisc::Weather::IWeatherGridProvider::requestWeatherGrid
|
||||
virtual void requestWeatherGridFromFile(const QString &filePath,
|
||||
const BlackMisc::Weather::CWeatherGrid &weatherGrid,
|
||||
const BlackMisc::Weather::CWeatherGrid &initialWeatherGrid,
|
||||
const BlackMisc::CSlot<void(const BlackMisc::Weather::CWeatherGrid &)> &callback) override;
|
||||
|
||||
|
||||
signals:
|
||||
//! The weather grid, requested from identified, is available
|
||||
void weatherGridReceived(const BlackMisc::Weather::CWeatherGrid &weatherGrid, const BlackMisc::CIdentifier &identifier);
|
||||
@@ -72,8 +72,10 @@ namespace BlackCore
|
||||
BlackMisc::CSlot<void(const BlackMisc::Weather::CWeatherGrid &)> callback;
|
||||
};
|
||||
|
||||
void requestWeatherGrid(const BlackMisc::Weather::CWeatherGrid &initialWeatherGrid, const BlackMisc::CIdentifier &identifier);
|
||||
bool loadWeatherDataPlugins();
|
||||
void fetchNextWeatherData();
|
||||
void fetchNextWeatherDataDeferred();
|
||||
void handleNextRequest();
|
||||
|
||||
CPluginManagerWeatherData m_pluginManagerWeatherData { this };
|
||||
|
||||
Reference in New Issue
Block a user