Replace yahoo finance to stooq (#131)

Old code is dropped to separated provider
This commit is contained in:
2017-12-15 02:01:34 +03:00
parent eb911551eb
commit e5a9e99438
134 changed files with 1213 additions and 1597 deletions

View File

@ -77,8 +77,7 @@ ExtWeather *ExtWeather::copy(const QString &_fileName, const int _number)
{
qCDebug(LOG_LIB) << "File" << _fileName << "number" << _number;
ExtWeather *item
= new ExtWeather(static_cast<QWidget *>(parent()), _fileName);
ExtWeather *item = new ExtWeather(static_cast<QWidget *>(parent()), _fileName);
copyDefaults(item);
item->setCity(city());
item->setCountry(country());
@ -93,9 +92,9 @@ ExtWeather *ExtWeather::copy(const QString &_fileName, const int _number)
QString ExtWeather::jsonMapFile() const
{
QString fileName = QStandardPaths::locate(
QStandardPaths::GenericDataLocation,
"awesomewidgets/weather/awesomewidgets-extweather-ids.json");
QString fileName
= QStandardPaths::locate(QStandardPaths::GenericDataLocation,
"awesomewidgets/weather/awesomewidgets-extweather-ids.json");
qCInfo(LOG_LIB) << "Map file" << fileName;
return fileName;
@ -283,8 +282,7 @@ int ExtWeather::showConfiguration(const QVariant &_args)
ui->lineEdit_country->setText(country());
ui->spinBox_timestamp->setValue(ts());
ui->checkBox_image->setCheckState(image() ? Qt::Checked : Qt::Unchecked);
ui->checkBox_active->setCheckState(isActive() ? Qt::Checked
: Qt::Unchecked);
ui->checkBox_active->setCheckState(isActive() ? Qt::Checked : Qt::Unchecked);
ui->lineEdit_schedule->setText(cron());
ui->lineEdit_socket->setText(socket());
ui->spinBox_interval->setValue(interval());
@ -333,8 +331,7 @@ void ExtWeather::writeConfiguration() const
void ExtWeather::sendRequest()
{
m_isRunning = true;
QNetworkReply *reply
= m_manager->get(QNetworkRequest(m_providerObject->url()));
QNetworkReply *reply = m_manager->get(QNetworkRequest(m_providerObject->url()));
new QReplyTimeout(reply, REQUEST_TIMEOUT);
}
@ -342,8 +339,8 @@ void ExtWeather::sendRequest()
void ExtWeather::weatherReplyReceived(QNetworkReply *_reply)
{
if (_reply->error() != QNetworkReply::NoError) {
qCWarning(LOG_AW) << "An error occurs" << _reply->error()
<< "with message" << _reply->errorString();
qCWarning(LOG_AW) << "An error occurs" << _reply->error() << "with message"
<< _reply->errorString();
return;
}
@ -360,8 +357,7 @@ void ExtWeather::weatherReplyReceived(QNetworkReply *_reply)
if (data.isEmpty())
return;
m_values = data;
m_values[tag("weather")]
= weatherFromInt(m_values[tag("weatherId")].toInt());
m_values[tag("weather")] = weatherFromInt(m_values[tag("weatherId")].toInt());
emit(dataReceived(m_values));
}
@ -373,10 +369,10 @@ void ExtWeather::initProvider()
switch (m_provider) {
case Provider::OWM:
m_providerObject = new OWMWeatherProvider(this, number());
m_providerObject = new OWMWeatherProvider(this);
break;
case Provider::Yahoo:
m_providerObject = new YahooWeatherProvider(this, number());
m_providerObject = new YahooWeatherProvider(this);
break;
}