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

0001 /* ============================================================
0002  *
0003  * This file is a part of digiKam project
0004  * https://www.digikam.org
0005  *
0006  * Date        : 2022-05-13
0007  * Description : ExifTool thread for the ExifTool process
0008  *
0009  * SPDX-FileCopyrightText: 2021-2024 by Gilles Caulier <caulier dot gilles at gmail dot com>
0010  * SPDX-FileCopyrightText: 2022      by Maik Qualmann <metzpinguin at gmail dot com>
0011  *
0012  * SPDX-License-Identifier: GPL-2.0-or-later
0013  *
0014  * ============================================================ */
0015 
0016 #include "exiftoolthread.h"
0017 
0018 // Local includes
0019 
0020 #include "digikam_debug.h"
0021 #include "exiftoolprocess.h"
0022 
0023 namespace Digikam
0024 {
0025 
0026 ExifToolThread::ExifToolThread(QObject* const parent)
0027     : QThread(parent)
0028 {
0029 }
0030 
0031 ExifToolThread::~ExifToolThread()
0032 {
0033     quit();
0034     wait();
0035 }
0036 
0037 void ExifToolThread::run()
0038 {
0039     ExifToolProcess* const proc = ExifToolProcess::instance();
0040     proc->moveToThread(this);
0041     proc->initExifTool();
0042 
0043     Q_EMIT exifToolProcessStarted();
0044 
0045     exec();
0046 
0047     if (ExifToolProcess::isCreated())
0048     {
0049         delete ExifToolProcess::internalPtr;
0050     }
0051 }
0052 
0053 } // namespace Digikam
0054 
0055 #include "moc_exiftoolthread.cpp"