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

0001 /* ============================================================
0002  *
0003  * This file is a part of digiKam project
0004  * https://www.digikam.org
0005  *
0006  * Date        : 2009-02-13
0007  * Description : tabbed queue items list.
0008  *
0009  * SPDX-FileCopyrightText: 2009-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_BQM_QUEUE_POOL_H
0016 #define DIGIKAM_BQM_QUEUE_POOL_H
0017 
0018 // Qt includes
0019 
0020 #include <QMap>
0021 #include <QTabBar>
0022 #include <QWidget>
0023 #include <QDragMoveEvent>
0024 #include <QDropEvent>
0025 #include <QTabWidget>
0026 
0027 // Local includes
0028 
0029 #include "iteminfoset.h"
0030 
0031 namespace Digikam
0032 {
0033 
0034 class DRawDecoding;
0035 class AssignedBatchTools;
0036 class QueueSettings;
0037 class QueueListView;
0038 
0039 
0040 class QueuePoolBar : public QTabBar
0041 {
0042     Q_OBJECT
0043 
0044 public:
0045 
0046     explicit QueuePoolBar(QWidget* const parent);
0047     ~QueuePoolBar() override;
0048 
0049 Q_SIGNALS:
0050 
0051     void signalTestCanDecode(const QDragMoveEvent*, bool&);
0052 
0053 private:
0054 
0055     void dragEnterEvent(QDragEnterEvent* e) override;
0056     void dragMoveEvent(QDragMoveEvent* e)   override;
0057 };
0058 
0059 // --------------------------------------------------------------------------------------
0060 
0061 class QueuePool : public QTabWidget
0062 {
0063     Q_OBJECT
0064 
0065 public:
0066 
0067     explicit QueuePool(QWidget* const parent);
0068     ~QueuePool() override;
0069 
0070     QueueListView*     currentQueue()                    const;
0071     QString            currentTitle()                    const;
0072     QueueListView*     findQueueByIndex(int index)       const;
0073     QueuePoolItemsList queueItemsList(int index)         const;
0074     int                totalPendingItems()               const;
0075     int                totalPendingTasks()               const;
0076     QMap<int, QString> queuesMap()                       const;
0077     QString            queueTitle(int index)             const;
0078     bool               customRenamingRulesAreValid()     const;
0079     bool               assignedBatchToolsListsAreValid() const;
0080     bool               saveWorkflow()                    const;
0081 
0082     void setBusy(bool b);
0083     void setItemBusy(qlonglong id);
0084 
0085     /** Apply settings changes to all queues settings container when something have been changed in
0086      *  digiKam setup dialog.
0087      */
0088     void applySettings();
0089 
0090 Q_SIGNALS:
0091 
0092     void signalItemSelectionChanged();
0093     void signalQueuePoolChanged();
0094     void signalQueueSelected(int id, const QueueSettings&, const AssignedBatchTools&);
0095     void signalQueueContentsChanged();
0096 
0097 public Q_SLOTS:
0098 
0099     void removeTab(int index);
0100 
0101     void slotAddQueue();
0102     void slotRemoveCurrentQueue();
0103     void slotClearList();
0104     void slotRemoveSelectedItems();
0105     void slotRemoveItemsDone();
0106     void slotAddItems(const ItemInfoList&, int queueId);
0107     void slotAssignedToolsChanged(const AssignedBatchTools&);
0108     void slotSettingsChanged(const QueueSettings&);
0109     void slotQueueSelected(int);
0110 
0111 protected:
0112 
0113     void keyPressEvent(QKeyEvent* event) override;
0114 
0115 private :
0116 
0117     QueueListView* findQueueByItemId(qlonglong id) const;
0118 
0119 private Q_SLOTS:
0120 
0121     void slotFileChanged(const QString&);
0122     void slotCloseQueueRequest(int);
0123     void slotTestCanDecode(const QDragMoveEvent*, bool&);
0124 };
0125 
0126 } // namespace Digikam
0127 
0128 #endif // DIGIKAM_BQM_QUEUE_POOL_H