[KPhotoAlbum] Breaking changes in file layout
Martin Höller
martin at xss.co.at
Mon Apr 6 14:45:05 BST 2020
Am 06. Apr. 2020 schrieb Martin Höller:
> Am 06. Apr. 2020 schrieb Tobias Leupold:
>
> > What about this one:
> >
> > QString Whatever::dbIdentifier(const QString &indexXml) const
> > {
> > const QFileInfo fileInfo(indexXml);
> > const QByteArray bytes(fileInfo.canonicalPath().toUtf8());
> > return QStringLiteral("%1-%2").arg(
> > QString::number(qChecksum(bytes.data(), bytes.size(),
> > Qt::ChecksumIso3309)),
> > fileInfo.dir().dirName());
> > }
> >
> > Gives me e. g. "60243-Fotoalbum" for my "/home/tobias/Fotoalbum/index.xml".
>
> That's what I was thinking about.
>
> I don't know ISO-3309 but this would also be possible with MD5/SHA/etc.:
> https://stackoverflow.com/questions/16383392/how-to-get-the-sha-1-md5-checksum-of-a-file-with-qt
>
> BTW, this link also uses an ID and a title like suggested.
We don't need the hash of a file but only of a string, so this
code-snippet is more relevant and much shorter:
https://stackoverflow.com/questions/5495281/generating-a-md5-hash-with-qt
hth,
- martin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: Digitale Signatur von OpenPGP
URL: <http://mail.kde.org/pipermail/kphotoalbum/attachments/20200406/7aadc80e/attachment.sig>
More information about the Kphotoalbum
mailing list