mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 23:05:36 +08:00
Summary: The GFS weather data url so far was hard coded. With this commit, it is moved into the global setup (bootstrap file). Also the url type was changed from QUrl to CUrl, which simplified the generation of the url including its query by using CUrl::appendQuery(). Finally it fixes sampleweatherdata, which did not have a CApplication yet. Reviewers: #swift_pilot_client, msutcliffe Reviewed By: #swift_pilot_client, msutcliffe Subscribers: jenkins Tags: #swift_pilot_client Maniphest Tasks: T151 Differential Revision: https://dev.swift-project.org/D57
53 lines
1.7 KiB
C++
53 lines
1.7 KiB
C++
/* Copyright (C) 2016
|
|
* 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
|
|
//! \ingroup sampleweatherdata
|
|
|
|
#include "blackcore/application.h"
|
|
#include "blackmisc/directoryutils.h"
|
|
#include "blackmisc/loghandler.h"
|
|
#include "blackmisc/registermetadata.h"
|
|
#include "reader.h"
|
|
#include "weatherdataprinter.h"
|
|
|
|
#include <stdio.h>
|
|
#include <QCoreApplication>
|
|
#include <QObject>
|
|
#include <QTextStream>
|
|
|
|
using namespace BlackMisc;
|
|
using namespace BlackMisc::PhysicalQuantities;
|
|
using namespace BlackCore;
|
|
|
|
//! main
|
|
int main(int argc, char *argv[])
|
|
{
|
|
QCoreApplication qa(argc, argv);
|
|
CApplication a(CApplicationInfo::Sample);
|
|
BlackMisc::registerMetadata();
|
|
CLogHandler::instance()->install(true);
|
|
// CLogHandler::instance()->enableConsoleOutput(false); // default disable
|
|
BlackMisc::registerMetadata();
|
|
|
|
CLineReader lineReader(&a);
|
|
CWeatherDataPrinter printer(&a);
|
|
QObject::connect(&lineReader, &CLineReader::weatherDataRequest, &printer, &CWeatherDataPrinter::fetchAndPrintWetherData);
|
|
QObject::connect(&lineReader, &CLineReader::quit, &lineReader, &CLineReader::terminate);
|
|
QObject::connect(&lineReader, &CLineReader::finished, &a, &QCoreApplication::quit);
|
|
|
|
QTextStream qtout(stdout);
|
|
qtout << "Usage: <lat> <lon>" << endl;
|
|
qtout << "Example: 48.5 11.5" << endl;
|
|
qtout << "Type x to quit" << endl;
|
|
|
|
lineReader.start();
|
|
return a.exec();
|
|
}
|