aboutsummaryrefslogtreecommitdiffstats
path: root/qthelper.h
diff options
context:
space:
mode:
authorGravatar Robert C. Helling <helling@atdotde.de>2015-02-26 14:39:42 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-02-27 06:29:44 +0100
commitb02bf002a677e45dbaa4d28edadbaafc89a7badc (patch)
tree86f26c0dc8edbf66999e602277a15bb6a09dc38e /qthelper.h
parentea00fdb36ab727b2f403a9feed5e8d96fb6659fc (diff)
downloadsubsurface-b02bf002a677e45dbaa4d28edadbaafc89a7badc.tar.gz
Add hashes to images
Upon successfull reading an image file, this computes a SHA1 hash of the image and saves it with the picture tag in the log file. When a file is not successfully loaded (for example because the log was created on a different computer) we look up the hash in a dictionary that maps hashes to local file names. That dictionary (actually two for both directions), is loaded on startup and saved upon destruction of the main window. Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qthelper.h')
-rw-r--r--qthelper.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/qthelper.h b/qthelper.h
index a367a9dac..e164a41b6 100644
--- a/qthelper.h
+++ b/qthelper.h
@@ -7,6 +7,7 @@
#include "dive.h"
#include "divelist.h"
#include <QTranslator>
+#include <QDir>
// global pointers for our translation
extern QTranslator *qtTranslator, *ssrfTranslator;
@@ -16,5 +17,11 @@ bool gpsHasChanged(struct dive *dive, struct dive *master, const QString &gps_te
extern "C" const char *printGPSCoords(int lat, int lon);
QList<int> getDivesInTrip(dive_trip_t *trip);
QString gasToStr(struct gasmix gas);
-
+void read_hashes();
+void write_hashes();
+void updateHash(struct picture *picture);
+QByteArray hashFile(const QString filename);
+void add_hash(const QString filename, QByteArray &hash);
+QString localFilePath(const QString originalFilename);
+QString fileFromHash(char *hash);
#endif // QTHELPER_H