File indexing completed on 2025-01-19 03:56:03

0001 /* ============================================================
0002  *
0003  * This file is a part of digiKam project
0004  * https://www.digikam.org
0005  *
0006  * Date        : 2020-11-28
0007  * Description : ExifTool process stream parser - private container.
0008  *
0009  * SPDX-FileCopyrightText: 2020-2024 by Gilles Caulier <caulier dot gilles at gmail dot com>
0010  *
0011  * SPDX-License-Identifier: GPL-2.0-or-later
0012  *
0013  * ============================================================ */
0014 
0015 #ifndef DIGIKAM_EXIFTOOL_PARSER_P_H
0016 #define DIGIKAM_EXIFTOOL_PARSER_P_H
0017 
0018 #include "exiftoolparser.h"
0019 
0020 // Qt includes
0021 
0022 #include <QDir>
0023 #include <QMutex>
0024 #include <QThread>
0025 #include <QLocale>
0026 #include <QVariant>
0027 #include <QFileInfo>
0028 #include <QEventLoop>
0029 #include <QJsonArray>
0030 #include <QStringList>
0031 #include <QDomElement>
0032 #include <QJsonObject>
0033 #include <QApplication>
0034 #include <QDomDocument>
0035 #include <QJsonDocument>
0036 #include <QMimeDatabase>
0037 #include <QTemporaryFile>
0038 
0039 // KDE includes
0040 
0041 #include <klocalizedstring.h>
0042 
0043 // Local includes
0044 
0045 #include "digikam_config.h"
0046 #include "digikam_debug.h"
0047 #include "exiftoolthread.h"
0048 
0049 namespace Digikam
0050 {
0051 
0052 class Q_DECL_HIDDEN ExifToolParser::Private
0053 {
0054 public:
0055 
0056     explicit Private(ExifToolParser* const q);
0057     ~Private();
0058 
0059     void       prepareProcess();
0060     bool       startProcess(const QByteArrayList& cmdArgs, ExifToolProcess::Action cmdAction);
0061     QByteArray filePathEncoding(const QFileInfo& fi) const;
0062 
0063     void       jumpToResultCommand(const ExifToolProcess::Result& result, int cmdId);
0064 
0065     /**
0066      * Returns a string for an action.
0067      */
0068     QString    actionString(int cmdAction) const;
0069 
0070 public:
0071 
0072     ExifToolParser*                pp;
0073     ExifToolProcess*               proc;            ///< ExifTool process instance.
0074     QString                        currentPath;     ///< Current file path processed by ExifTool.
0075     QString                        errorString;     ///< Current error string from the last started ExifTool process.
0076     ExifToolData                   exifToolData;    ///< Current ExifTool data (input or output depending of the called method.
0077     QTemporaryFile                 argsFile;        ///< Temporary file to store Exiftool arg config file.
0078 
0079     QMutex                         mutex;
0080 
0081     bool                           async;
0082     QList<int>                     asyncRunning;
0083 };
0084 
0085 } // namespace Digikam
0086 
0087 #endif // DIGIKAM_EXIFTOOL_PARSER_P_H