digiKam
exiftoolprocess_p.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 : 2021-02-18
7  * Description : Qt5 and Qt6 interface for exiftool - private container.
8  * Based on ZExifTool Qt interface published at 18 Feb 2021
9  * https://github.com/philvl/ZExifTool
10  *
11  * Copyright (C) 2021-2022 by Gilles Caulier <caulier dot gilles at gmail dot com>
12  * Copyright (c) 2021 by Philippe Vianney Liaud <philvl dot dev at gmail dot com>
13  *
14  * This program is free software; you can redistribute it
15  * and/or modify it under the terms of the GNU General
16  * Public License as published by the Free Software Foundation;
17  * either version 2, or (at your option)
18  * any later version.
19  *
20  * This program is distributed in the hope that it will be useful,
21  * but WITHOUT ANY WARRANTY; without even the implied warranty of
22  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23  * GNU General Public License for more details.
24  *
25  * ============================================================ */
26 
27 #ifndef DIGIKAM_EXIFTOOL_PROCESS_P_H
28 #define DIGIKAM_EXIFTOOL_PROCESS_P_H
29 
30 #include "exiftoolprocess.h"
31 
32 // Qt includes
33 
34 #include <QFile>
35 #include <QFileInfo>
36 #include <QElapsedTimer>
37 #include <QList>
38 #include <QByteArray>
39 
40 // Local includes
41 
42 #include "digikam_debug.h"
43 #include "digikam_globals.h"
44 
45 namespace Digikam
46 {
47 
48 class Q_DECL_HIDDEN ExifToolProcess::Private
49 {
50 public:
51 
52  class Q_DECL_HIDDEN Command
53  {
54  public:
55 
57  : id (0),
58  ac (ExifToolProcess::NO_ACTION)
59  {
60  }
61 
62  int id;
63  QByteArray argsStr;
65  };
66 
67 public:
68 
69  explicit Private(ExifToolProcess* const q);
70 
71  void execNextCmd();
72  void readOutput(const QProcess::ProcessChannel channel);
73  void setProcessErrorAndEmit(QProcess::ProcessError error,
74  const QString& description);
75 
76 public:
77 
79  QString etExePath;
80  QString perlExePath;
81  QProcess* process;
82 
83  QElapsedTimer execTimer;
87 
88  int outAwait[2];
89  bool outReady[2];
90  QByteArray outBuff[2];
91 
93 
94  QProcess::ProcessError processError;
95  QString errorString;
96 
97 public:
98 
99  static const int CMD_ID_MIN = 1;
100  static const int CMD_ID_MAX = 2000000000;
101 
102  static int s_nextCmdId;
103  static QMutex s_cmdIdMutex;
104 };
105 
106 } // namespace Digikam
107 
108 #endif // DIGIKAM_EXIFTOOL_PROCESS_P_H
Definition: exiftoolprocess_p.h:53
int id
Definition: exiftoolprocess_p.h:62
ExifToolProcess::Action ac
Definition: exiftoolprocess_p.h:64
QByteArray argsStr
Definition: exiftoolprocess_p.h:63
Command()
Definition: exiftoolprocess_p.h:56
Definition: exiftoolprocess_p.h:49
QElapsedTimer execTimer
Definition: exiftoolprocess_p.h:83
QList< Command > cmdQueue
Definition: exiftoolprocess_p.h:84
bool writeChannelIsClosed
Definition: exiftoolprocess_p.h:92
ExifToolProcess::Action cmdAction
Definition: exiftoolprocess_p.h:86
QProcess * process
Definition: exiftoolprocess_p.h:81
QString perlExePath
Definition: exiftoolprocess_p.h:80
static int s_nextCmdId
Unique identifier, even in a multi-instances or multi-thread environment.
Definition: exiftoolprocess_p.h:102
QProcess::ProcessError processError
Definition: exiftoolprocess_p.h:94
QString errorString
Definition: exiftoolprocess_p.h:95
int cmdRunning
Definition: exiftoolprocess_p.h:85
ExifToolProcess * pp
Definition: exiftoolprocess_p.h:78
static QMutex s_cmdIdMutex
Definition: exiftoolprocess_p.h:103
QString etExePath
Definition: exiftoolprocess_p.h:79
Definition: exiftoolprocess.h:45
Action
Definition: exiftoolprocess.h:54
Definition: piwigotalker.h:48
Definition: datefolderview.cpp:43