mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Cleanup: remove code related to picture-storage in git repositories
Saving of pictures to git repositories was disabled. Finally remove this code and the corresponding load code. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
0958592ee6
commit
21ee440e5f
4 changed files with 1 additions and 107 deletions
|
@ -1293,15 +1293,6 @@ extern "C" const char *local_file_path(struct picture *picture)
|
|||
return copy_qstring(localFilePath(picture->filename));
|
||||
}
|
||||
|
||||
extern "C" bool picture_exists(struct picture *picture)
|
||||
{
|
||||
QString localPath = localFilePath(picture->filename);
|
||||
if (localPath.isEmpty())
|
||||
return false;
|
||||
QByteArray hash = hashFile(localPath);
|
||||
return !hash.isEmpty() && getHash(QString(picture->filename)) == hash;
|
||||
}
|
||||
|
||||
const QString picturedir()
|
||||
{
|
||||
return QString(system_default_directory()).append("/picturedata/");
|
||||
|
@ -1312,25 +1303,6 @@ extern "C" char *picturedir_string()
|
|||
return copy_qstring(picturedir());
|
||||
}
|
||||
|
||||
/* when we get a picture from git storage (local or remote) and can't find the picture
|
||||
* based on its hash, we create a local copy with the hash as filename and the appropriate
|
||||
* suffix */
|
||||
extern "C" void savePictureLocal(struct picture *picture, const char *hash, const char *data, int len)
|
||||
{
|
||||
QString dirname = picturedir();
|
||||
QDir localPictureDir(dirname);
|
||||
localPictureDir.mkpath(dirname);
|
||||
QString suffix(picture->filename);
|
||||
suffix.replace(QRegularExpression(".*\\."), "");
|
||||
QString filename(dirname + hash + "." + suffix);
|
||||
QSaveFile out(filename);
|
||||
if (out.open(QIODevice::WriteOnly)) {
|
||||
out.write(data, len);
|
||||
out.commit();
|
||||
add_hash(filename, QByteArray::fromHex(hash));
|
||||
}
|
||||
}
|
||||
|
||||
QString get_gas_string(struct gasmix gas)
|
||||
{
|
||||
uint o2 = (get_o2(&gas) + 5) / 10, he = (get_he(&gas) + 5) / 10;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue