Load remote images

When loading an image by filename and by hash fails, try to interpret
the filename as URL and download the image.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Robert C. Helling 2015-03-02 16:18:16 +01:00 committed by Dirk Hohndel
parent 869ddc915d
commit 6b3b50cc2f
5 changed files with 107 additions and 3 deletions

View file

@ -850,6 +850,13 @@ QByteArray hashFile(const QString filename)
return hash.result();
}
void learnHash(struct picture *picture, QByteArray hash)
{
free(picture->hash);
hashOf[QString(picture->filename)] = hash;
picture->hash = strdup(hash.toHex());
}
QString localFilePath(const QString originalFilename)
{
return localFilenameOf[hashOf[originalFilename]];