added a timeout for the download of icons

This commit is contained in:
Patrick von Reth 2014-01-15 11:39:59 +01:00
parent a93839fab8
commit 523c2ca18c
1 changed files with 7 additions and 3 deletions

View File

@ -110,11 +110,15 @@ void IconData::download()
request.setRawHeader("User-Agent", "SnoreNotify");
QNetworkReply *reply = manager.get(request);
QObject::connect(reply, SIGNAL(finished()), &loop, SLOT(quit()));
QTimer::singleShot(1000,&loop, SLOT(quit()));//timeout
loop.exec();
if(reply->isFinished())
{
m_data = reply->readAll();
m_img = QImage::fromData(m_data, "PNG");
m_img.save(m_localUrl,"PNG");
}
}
else
{
m_img = QImage(m_localUrl);