From 926684fb873d9455bdb272282ab4c79fab4a1a8a Mon Sep 17 00:00:00 2001 From: Klaus Basan Date: Wed, 15 Apr 2020 20:19:40 +0200 Subject: [PATCH] [Weather] Weather data printer * removed slots * typo --- samples/weatherdata/main.cpp | 2 +- samples/weatherdata/weatherdataprinter.cpp | 12 ++++++------ samples/weatherdata/weatherdataprinter.h | 10 ++++------ 3 files changed, 11 insertions(+), 13 deletions(-) diff --git a/samples/weatherdata/main.cpp b/samples/weatherdata/main.cpp index a21bab219..55ab94ace 100644 --- a/samples/weatherdata/main.cpp +++ b/samples/weatherdata/main.cpp @@ -37,7 +37,7 @@ int main(int argc, char *argv[]) CLineReader lineReader(&a); CWeatherDataPrinter printer(&a); - QObject::connect(&lineReader, &CLineReader::weatherDataRequest, &printer, &CWeatherDataPrinter::fetchAndPrintWetherData); + QObject::connect(&lineReader, &CLineReader::weatherDataRequest, &printer, &CWeatherDataPrinter::fetchAndPrintWeatherData); QObject::connect(&lineReader, &CLineReader::wantsToQuit, &lineReader, &CLineReader::terminate); QObject::connect(&lineReader, &CLineReader::finished, &a, &QCoreApplication::quit); diff --git a/samples/weatherdata/weatherdataprinter.cpp b/samples/weatherdata/weatherdataprinter.cpp index 0261608c8..46ee24e75 100644 --- a/samples/weatherdata/weatherdataprinter.cpp +++ b/samples/weatherdata/weatherdataprinter.cpp @@ -45,16 +45,16 @@ using namespace BlackCore; CWeatherDataPrinter::CWeatherDataPrinter(QObject *parent) : QObject(parent) { } -void CWeatherDataPrinter::fetchAndPrintWetherData(const CCoordinateGeodetic &position) +void CWeatherDataPrinter::fetchAndPrintWeatherData(const CCoordinateGeodetic &position) { QTextStream qtout(stdout); qtout << "Fetching weather data. This may take a while..." << endl; CWeatherGrid weatherGrid { { "", position } }; - m_weatherManger.requestWeatherGrid(weatherGrid, { this, &CWeatherDataPrinter::ps_printWeatherData }); + m_weatherManger.requestWeatherGrid(weatherGrid, { this, &CWeatherDataPrinter::printWeatherData }); } -void CWeatherDataPrinter::ps_printWeatherData(const BlackMisc::Weather::CWeatherGrid &weatherGrid) +void CWeatherDataPrinter::printWeatherData(const BlackMisc::Weather::CWeatherGrid &weatherGrid) { QTextStream qtout(stdout); qtout << "... finished." << endl; @@ -65,7 +65,7 @@ void CWeatherDataPrinter::ps_printWeatherData(const BlackMisc::Weather::CWeather qtout << " MSL Pressure: " << gridPoint.getPressureAtMsl().toQString() << endl; CTemperatureLayerList temperatureLayers = gridPoint.getTemperatureLayers(); - temperatureLayers.sort([](const CTemperatureLayer &a, const CTemperatureLayer &b) { return a.getLevel() < b.getLevel(); }); + temperatureLayers.sort([](const CTemperatureLayer & a, const CTemperatureLayer & b) { return a.getLevel() < b.getLevel(); }); qtout << " Temperature Layers: " << endl; for (const auto &temperatureLayer : as_const(temperatureLayers)) { @@ -76,7 +76,7 @@ void CWeatherDataPrinter::ps_printWeatherData(const BlackMisc::Weather::CWeather qtout << endl; CWindLayerList windLayers = gridPoint.getWindLayers(); - windLayers.sort([](const CWindLayer &a, const CWindLayer &b) { return a.getLevel() < b.getLevel(); }); + windLayers.sort([](const CWindLayer & a, const CWindLayer & b) { return a.getLevel() < b.getLevel(); }); qtout << " Wind Layers: " << endl; for (const auto &windLayer : as_const(windLayers)) { @@ -87,7 +87,7 @@ void CWeatherDataPrinter::ps_printWeatherData(const BlackMisc::Weather::CWeather qtout << " Cloud Layers: " << endl; CCloudLayerList cloudLayers = gridPoint.getCloudLayers(); - cloudLayers.sort([](const CCloudLayer &a, const CCloudLayer &b) { return a.getBase() < b.getBase(); }); + cloudLayers.sort([](const CCloudLayer & a, const CCloudLayer & b) { return a.getBase() < b.getBase(); }); for (int i = 0; i < cloudLayers.size(); i++) { const CCloudLayer &cloudLayer = cloudLayers[i]; diff --git a/samples/weatherdata/weatherdataprinter.h b/samples/weatherdata/weatherdataprinter.h index 507d05f1a..01dd780d6 100644 --- a/samples/weatherdata/weatherdataprinter.h +++ b/samples/weatherdata/weatherdataprinter.h @@ -29,15 +29,13 @@ public: //! Constructor CWeatherDataPrinter(QObject *parent = nullptr); -public slots: //! Fetch new weather data for given position and print it once received - void fetchAndPrintWetherData(const BlackMisc::Geo::CCoordinateGeodetic &position); - -private slots: - //! Print weather data to stdout - void ps_printWeatherData(const BlackMisc::Weather::CWeatherGrid &weatherGrid); + void fetchAndPrintWeatherData(const BlackMisc::Geo::CCoordinateGeodetic &position); private: + //! Print weather data to stdout + void printWeatherData(const BlackMisc::Weather::CWeatherGrid &weatherGrid); + BlackCore::CWeatherManager m_weatherManger { this }; };