added a timeout for the download of icons
This commit is contained in:
parent
a93839fab8
commit
523c2ca18c
|
@ -110,10 +110,14 @@ void IconData::download()
|
||||||
request.setRawHeader("User-Agent", "SnoreNotify");
|
request.setRawHeader("User-Agent", "SnoreNotify");
|
||||||
QNetworkReply *reply = manager.get(request);
|
QNetworkReply *reply = manager.get(request);
|
||||||
QObject::connect(reply, SIGNAL(finished()), &loop, SLOT(quit()));
|
QObject::connect(reply, SIGNAL(finished()), &loop, SLOT(quit()));
|
||||||
|
QTimer::singleShot(1000,&loop, SLOT(quit()));//timeout
|
||||||
loop.exec();
|
loop.exec();
|
||||||
m_data = reply->readAll();
|
if(reply->isFinished())
|
||||||
m_img = QImage::fromData(m_data, "PNG");
|
{
|
||||||
m_img.save(m_localUrl,"PNG");
|
m_data = reply->readAll();
|
||||||
|
m_img = QImage::fromData(m_data, "PNG");
|
||||||
|
m_img.save(m_localUrl,"PNG");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue