File indexing completed on 2024-04-28 04:21:08

0001 // SPDX-FileCopyrightText: 2020 The KPhotoAlbum development team
0002 // SPDX-FileCopyrightText: 2021 Johannes Zarl-Zierl <johannes@zarl-zierl.at>
0003 //
0004 // SPDX-License-Identifier: LicenseRef-KDE-Accepted-GPL
0005 
0006 #ifndef KPA_THUMBNAILTOOL_THUMBNAILCACHECONVERTER_H
0007 #define KPA_THUMBNAILTOOL_THUMBNAILCACHECONVERTER_H
0008 
0009 class QIODevice;
0010 class QString;
0011 class QTextStream;
0012 
0013 namespace KPAThumbnailTool
0014 {
0015 /**
0016  * @brief Convert a version 5 ThumbnailCache index file to version 4.
0017  * The old thumbnailindex file is backed up with a suffic '.bak'.
0018  *
0019  * This function does not use the ThumbnailCache code at all,
0020  * but just reads the file and converts the header accordingly.
0021  *
0022  * This way, code in ThumbnailCache is not bloated by a niche-usecase.
0023  *
0024  * @param indexFilename
0025  * @param err an output stream for error messages
0026  * @return 0 on success, 1 otherwise.
0027  */
0028 int convertV5ToV4Cache(const QString &indexFilename, QTextStream &err);
0029 
0030 /**
0031  * @brief Convert a version 5 ThumbnailCache index file to version 4.
0032  * This function does not use the ThumbnailCache code at all,
0033  * but just reads the file and converts the header accordingly.
0034  *
0035  * This way, code in ThumbnailCache is not bloated by a niche-usecase.
0036  * @param fromFile the (already opened) QIODevice containing the old index data
0037  * @param toFile an open QIODevice to write to
0038  * @param err a stream for error messages.
0039  * @return \c true on success, \c false if the input file is not valid.
0040  */
0041 bool convertV5ToV4Cache(QIODevice &fromFile, QIODevice &toFile, QTextStream &err);
0042 }
0043 
0044 #endif
0045 
0046 // vi:expandtab:tabstop=4 shiftwidth=4: