Dive pictures: index local file name by canonical filname

The connection canonical filename to local filename was done via
two maps:
  1) canonical filename -> hash
  2) hash -> local filename
But the local filename was always queried from the canonical filename.
Therefore, directly index the former with the latter.

On startup, convert the old map to the new one.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2018-06-02 18:03:03 +02:00 committed by Dirk Hohndel
parent 5375eee4e6
commit 08962cb38d
5 changed files with 100 additions and 48 deletions

View file

@ -999,7 +999,7 @@ void DiveListView::loadImageFromURL(QUrl url)
stream.writeRawData(imageData.data(), imageData.length());
imageFile.waitForBytesWritten(-1);
imageFile.close();
learnHash(url.toString(), imageFile.fileName(), hash.result());
learnPictureFilename(url.toString(), imageFile.fileName());
matchImagesToDives(QStringList(url.toString()));
}
}