try to implement timeouts support to quotes (ref to #54)

This commit is contained in:
arcan1s
2015-05-29 18:29:13 +03:00
parent b51c97abbb
commit f534a6854a
2 changed files with 21 additions and 3 deletions

View File

@ -20,11 +20,29 @@
#include <QDialog>
#include <QMap>
#include <QNetworkReply>
#include <QTimer>
#define YAHOO_URL "https://query.yahooapis.com/v1/public/yql?q=select * from yahoo.finance.quotes where symbol=\"$TICKER\"&env=store://datatables.org/alltableswithkeys&format=json"
class QNetworkReply;
class QReplyTimeout : public QObject
{
Q_OBJECT
public:
QReplyTimeout(QNetworkReply *reply, const int timeout) : QObject(reply)
{
QTimer::singleShot(timeout, this, SLOT(timeout()));
}
private slots:
void timeout()
{
QNetworkReply *reply = static_cast<QNetworkReply *>(parent());
if (reply->isRunning()) reply->close();
}
};
namespace Ui {
class ExtQuotes;