digiKam
Loading...
Searching...
No Matches
exiftoolparser.h
Go to the documentation of this file.
1/* ============================================================
2 *
3 * This file is a part of digiKam project
4 * https://www.digikam.org
5 *
6 * Date : 2020-11-28
7 * Description : ExifTool process stream parser.
8 *
9 * SPDX-FileCopyrightText: 2020-2024 by Gilles Caulier <caulier dot gilles at gmail dot com>
10 *
11 * SPDX-License-Identifier: GPL-2.0-or-later
12 *
13 * ============================================================ */
14
15#pragma once
16
17// Qt Core
18
19#include <QHash>
20#include <QObject>
21#include <QString>
22#include <QVariant>
23#include <QProcess>
24#include <QFileInfo>
25#include <QByteArray>
26
27// Local includes
28
29#include "digikam_export.h"
30#include "exiftoolprocess.h"
31#include "metaengine.h"
32
33namespace Digikam
34{
35
36class DIGIKAM_EXPORT ExifToolParser : public QObject
37{
38 Q_OBJECT
39
40public:
41
87 typedef QHash<QString, QVariantList> ExifToolData;
88
89public:
90
91 //---------------------------------------------------------------------------------------------
93
94
95 explicit ExifToolParser(QObject* const parent, bool async = false);
97
98 void setExifToolProgram(const QString& path);
99
100 QString currentPath() const;
101 ExifToolData currentData() const;
102 QString currentErrorString() const;
103
107 bool exifToolAvailable() const;
108
110
111public:
112
113 //---------------------------------------------------------------------------------------------
115
116
121 bool load(const QString& path);
122
127 bool loadChunk(const QString& path, bool copyToAll = false);
128
136 bool applyChanges(const QString& path, const ExifToolData& newTags);
137
145 bool applyChanges(const QString& path,
146 const QString& exvTempFile,
147 bool hasExif = true, bool hasXmp = true, bool hasCSet = false);
148
154 bool applyMetadataFile(const QString& path, const QString& meta);
155
161 bool changeTimestamps(const QString& path, const QDateTime& dateTime);
162
167 bool readableFormats();
168
173 bool writableFormats();
174
179 bool translationsList();
180
186 bool tagsDatabase();
187
192 bool version();
193
201 bool copyTags(const QString& src,
202 const QString& dst,
203 unsigned char copyOps,
204 unsigned char writeModes = ExifToolProcess::ALL_MODES);
205
210 bool translateTags(const QString& path, unsigned char transOps);
211
213
214public:
215
216 //---------------------------------------------------------------------------------------------
218
219
220 void cmdCompleted(const ExifToolProcess::Result& result);
221
222 void errorOccurred(const ExifToolProcess::Result& result,
223 QProcess::ProcessError error,
224 const QString& description);
225
226 void finished();
227
228public Q_SLOTS:
229
230 void slotExifToolResult(int cmdId);
231
233
234Q_SIGNALS:
235
238
239public:
240
244 void setOutputStream(int cmdAction,
245 const QByteArray& cmdOutputChannel,
246 const QByteArray& cmdErrorChannel);
247
251 static MetaEngine::TagsMap tagsDbToOrderedMap(const ExifToolData& tagsDb);
252
253private:
254
255 void printExifToolOutput(const QByteArray& stdOut);
256
258
259private:
260
261 class Private;
262 Private* const d = nullptr;
263};
264
265} // namespace Digikam
Definition exiftoolparser_p.h:54
Definition exiftoolparser.h:37
QHash< QString, QVariantList > ExifToolData
Definition exiftoolparser.h:87
void signalExifToolAsyncData(const ExifToolParser::ExifToolData &map)
Definition exiftoolprocess.h:112
QMap< QString, QStringList > TagsMap
Definition metaengine.h:143
Definition datefolderview.cpp:34