mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-24 06:25:37 +08:00
[Weather] Weather data printer
* removed slots * typo
This commit is contained in:
committed by
Mat Sutcliffe
parent
4e45249142
commit
926684fb87
@@ -37,7 +37,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
CLineReader lineReader(&a);
|
CLineReader lineReader(&a);
|
||||||
CWeatherDataPrinter printer(&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::wantsToQuit, &lineReader, &CLineReader::terminate);
|
||||||
QObject::connect(&lineReader, &CLineReader::finished, &a, &QCoreApplication::quit);
|
QObject::connect(&lineReader, &CLineReader::finished, &a, &QCoreApplication::quit);
|
||||||
|
|
||||||
|
|||||||
@@ -45,16 +45,16 @@ using namespace BlackCore;
|
|||||||
CWeatherDataPrinter::CWeatherDataPrinter(QObject *parent) : QObject(parent)
|
CWeatherDataPrinter::CWeatherDataPrinter(QObject *parent) : QObject(parent)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
void CWeatherDataPrinter::fetchAndPrintWetherData(const CCoordinateGeodetic &position)
|
void CWeatherDataPrinter::fetchAndPrintWeatherData(const CCoordinateGeodetic &position)
|
||||||
{
|
{
|
||||||
QTextStream qtout(stdout);
|
QTextStream qtout(stdout);
|
||||||
qtout << "Fetching weather data. This may take a while..." << endl;
|
qtout << "Fetching weather data. This may take a while..." << endl;
|
||||||
|
|
||||||
CWeatherGrid weatherGrid { { "", position } };
|
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);
|
QTextStream qtout(stdout);
|
||||||
qtout << "... finished." << endl;
|
qtout << "... finished." << endl;
|
||||||
|
|||||||
@@ -29,15 +29,13 @@ public:
|
|||||||
//! Constructor
|
//! Constructor
|
||||||
CWeatherDataPrinter(QObject *parent = nullptr);
|
CWeatherDataPrinter(QObject *parent = nullptr);
|
||||||
|
|
||||||
public slots:
|
|
||||||
//! Fetch new weather data for given position and print it once received
|
//! Fetch new weather data for given position and print it once received
|
||||||
void fetchAndPrintWetherData(const BlackMisc::Geo::CCoordinateGeodetic &position);
|
void fetchAndPrintWeatherData(const BlackMisc::Geo::CCoordinateGeodetic &position);
|
||||||
|
|
||||||
private slots:
|
|
||||||
//! Print weather data to stdout
|
|
||||||
void ps_printWeatherData(const BlackMisc::Weather::CWeatherGrid &weatherGrid);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
//! Print weather data to stdout
|
||||||
|
void printWeatherData(const BlackMisc::Weather::CWeatherGrid &weatherGrid);
|
||||||
|
|
||||||
BlackCore::CWeatherManager m_weatherManger { this };
|
BlackCore::CWeatherManager m_weatherManger { this };
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user