Re: Breaking changes in file layout
Martin Höller <martin-RZb/AGe+/[email protected]> Mon, 6 Apr 2020 15:45:05 +0200
| Newsgroups | gmane.comp.kde.kimdaba |
|---|---|
| Message-ID | <20200406154505.0d0c3ba3@linux-du93> |
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
_______________________________________________
KPhotoAlbum mailing list
[email protected]
https://mail.kdab.com/mailman/listinfo/kphotoalbum
signature.asc
(application/pgp-signature, 181 B)
-----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iEYEARECAAYFAl6LMmEACgkQYJf22JPx7tk+ywCgrMshEmpo/OzKPFQpG+fDRJp0 FnQAn22o4FAn+tvp5Oc+gGEGJNlrMe4O =O5ZE -----END PGP SIGNATURE-----