added a timeout for the download of icons
This commit is contained in:
parent
a93839fab8
commit
523c2ca18c
|
@ -110,11 +110,15 @@ 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();
|
||||||
|
if(reply->isFinished())
|
||||||
|
{
|
||||||
m_data = reply->readAll();
|
m_data = reply->readAll();
|
||||||
m_img = QImage::fromData(m_data, "PNG");
|
m_img = QImage::fromData(m_data, "PNG");
|
||||||
m_img.save(m_localUrl,"PNG");
|
m_img.save(m_localUrl,"PNG");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_img = QImage(m_localUrl);
|
m_img = QImage(m_localUrl);
|
||||||
|
|
Loading…
Reference in New Issue