diff --git a/src/libsnore/notification/icon.cpp b/src/libsnore/notification/icon.cpp index f90c798..27f9cfb 100644 --- a/src/libsnore/notification/icon.cpp +++ b/src/libsnore/notification/icon.cpp @@ -72,7 +72,7 @@ Icon Icon::fromWebUrl(const QUrl &url, int maxTime) } }); - while (!isDownloading.tryLock() && timeout.elapsed() < maxTime) { + while (!isDownloading.tryLock() && (maxTime != -1 && timeout.elapsed() < maxTime)) { qApp->processEvents(); } reply->close(); diff --git a/src/libsnore/notification/icon.h b/src/libsnore/notification/icon.h index 23cfa6e..7016718 100644 --- a/src/libsnore/notification/icon.h +++ b/src/libsnore/notification/icon.h @@ -28,14 +28,23 @@ namespace Snore { /** - * Icon contains an image for Notifications. - * Icon uses a shared datamodel, it's content is never copied and automatically released. - * @author Patrick von Reth \ + * Icon is a convnience wrapper for QIcon. + * @author Patrick von Reth \ */ class SNORE_EXPORT Icon : public QIcon { public: + /** + * Returns the default Snore Icon. + */ static Icon defaultIcon(); + + /** + * Returns an Icon from a web Url. + * This function is blocking until the download is completed, failed or took longer than maxTime. + * In case the function failes it will return the same as defaultIcon(). + * The function caches successful downloads, a Url is only downloaded once. + */ static Icon fromWebUrl(const QUrl &url, int maxTime = 5000); Icon(const QPixmap &pixmap); @@ -43,8 +52,7 @@ public: explicit Icon(const QString &fileName); /** - * - * @return a local url to a file representing the Icon + * Returns a local Url to a file representing the Icon. */ QString localUrl(const QSize &size, Mode mode = Normal, State state = Off) const;