File indexing completed on 2025-03-09 03:58:50

0001 /* ============================================================
0002  *
0003  * This file is a part of digiKam project
0004  * https://www.digikam.org
0005  *
0006  * Date        : 2009-02-06
0007  * Description : Thread actions manager.
0008  *
0009  * SPDX-FileCopyrightText: 2009-2024 by Gilles Caulier <caulier dot gilles at gmail dot com>
0010  * SPDX-FileCopyrightText: 2012      by Pankaj Kumar <me at panks dot me>
0011  *
0012  * SPDX-License-Identifier: GPL-2.0-or-later
0013  *
0014  * ============================================================ */
0015 
0016 #ifndef DIGIKAM_BQM_ACTION_THREAD_H
0017 #define DIGIKAM_BQM_ACTION_THREAD_H
0018 
0019 // Local includes
0020 
0021 #include "batchtool.h"
0022 #include "batchtoolutils.h"
0023 #include "actionthreadbase.h"
0024 
0025 namespace Digikam
0026 {
0027 
0028 class ActionData;
0029 class QueueSettings;
0030 
0031 class ActionThread : public ActionThreadBase
0032 {
0033     Q_OBJECT
0034 
0035 public:
0036 
0037     explicit ActionThread(QObject* const parent);
0038     ~ActionThread() override;
0039 
0040     void setSettings(const QueueSettings& settings);
0041 
0042     void processQueueItems(const QList<AssignedBatchTools>& items);
0043 
0044     void cancel();
0045 
0046 Q_SIGNALS:
0047 
0048     /**
0049      * Emit when an item from a queue start to be processed.
0050      */
0051     void signalStarting(const Digikam::ActionData& ad);
0052 
0053     /**
0054      * Emit when an item from a queue have been processed.
0055      */
0056     void signalFinished(const Digikam::ActionData& ad);
0057 
0058     /**
0059      * Emit when a queue have been fully processed (all items from queue are finished).
0060      */
0061     void signalQueueProcessed();
0062 
0063     /**
0064      * Signal to emit to sub-tasks to cancel processing.
0065      */
0066     void signalCancelTask();
0067 
0068 private Q_SLOTS:
0069 
0070     void slotUpdateItemInfo(const Digikam::ActionData& ad);
0071     void slotThreadFinished();
0072 
0073 private:
0074 
0075     class Private;
0076     Private* const d;
0077 };
0078 
0079 } // namespace Digikam
0080 
0081 #endif // DIGIKAM_BQM_ACTION_THREAD_H