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        : 2008-11-21
0007  * Description : Batch Queue Manager GUI
0008  *
0009  * SPDX-FileCopyrightText: 2008-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_MGR_WINDOW_H
0016 #define DIGIKAM_BQM_QUEUE_MGR_WINDOW_H
0017 
0018 // Qt includes
0019 
0020 #include <QMap>
0021 #include <QString>
0022 #include <QCloseEvent>
0023 #include <QUrl>
0024 
0025 // Local includes
0026 
0027 #include "iteminfo.h"
0028 #include "setup.h"
0029 #include "dhistoryview.h"
0030 #include "dxmlguiwindow.h"
0031 
0032 class QAction;
0033 
0034 namespace Digikam
0035 {
0036 
0037 class ActionData;
0038 class BatchToolsFactory;
0039 class AssignedBatchTools;
0040 class QueueListViewItem;
0041 
0042 class QueueMgrWindow : public DXmlGuiWindow
0043 {
0044     Q_OBJECT
0045 
0046 public:
0047 
0048     ~QueueMgrWindow()                                   override;
0049 
0050     static QueueMgrWindow* queueManagerWindow();
0051     static bool            queueManagerWindowCreated();
0052 
0053     void addNewQueue();
0054     void loadItemInfos(const ItemInfoList& list, int queueId);
0055     void loadItemInfosToCurrentQueue(const ItemInfoList& list);
0056     void loadItemInfosToNewQueue(const ItemInfoList& list);
0057     void refreshView();
0058     void applySettings();
0059 
0060     /**
0061      * Return a map of all queues available from pool (index and title).
0062      */
0063     QMap<int, QString> queuesMap()         const;
0064 
0065     bool isBusy()                          const;
0066     int  currentQueueId()                  const;
0067 
0068     bool queryClose()                                   override;
0069 
0070 public:
0071 
0072     DInfoInterface* infoIface(DPluginAction* const)     override
0073     {
0074         // Reimplemented in BatchToolsFactory
0075         return nullptr;
0076     };
0077 
0078 Q_SIGNALS:
0079 
0080     void signalWindowHasMoved();
0081     void signalBqmIsBusy(bool);
0082 
0083 protected:
0084 
0085     void moveEvent(QMoveEvent* e)                       override;
0086 
0087 public Q_SLOTS:
0088 
0089     void slotRun();
0090     void slotRunAll();
0091     void slotStop();
0092     void slotAssignQueueSettings(const QString&);
0093     void slotUpdateQueueSettings(const QString&);
0094 
0095 private:
0096 
0097     void customizedFullScreenMode(bool set)             override;
0098     void closeEvent(QCloseEvent* e)                     override;
0099     void setupActions();
0100     void setupConnections();
0101     void setupUserArea();
0102     void setupStatusBar();
0103     void readSettings();
0104     void writeSettings();
0105     void refreshStatusBar();
0106     void populateToolsList();
0107     void setup(Setup::Page page);
0108     void addHistoryMessage(QueueListViewItem* const cItem,
0109                            const QString& msg,
0110                            DHistoryView::EntryType type);
0111 
0112     bool checkTargetAlbum(int queueId);
0113     void busy(bool busy);
0114     void processOneQueue();
0115     void processingAborted();
0116 
0117     QueueMgrWindow();
0118 
0119 private Q_SLOTS:
0120 
0121     void slotSetup()                                    override;
0122     void slotComponentsInfo()                           override;
0123     void slotDBStat()                                   override;
0124     void slotOnlineVersionCheck()                       override;
0125     void slotAction(const Digikam::ActionData&);
0126     void slotHistoryEntryClicked(int, qlonglong);
0127     void slotAssignedToolsChanged(const AssignedBatchTools&);
0128     void slotQueueContentsChanged();
0129     void slotItemSelectionChanged();
0130     void slotQueueProcessed();
0131     void slotSaveWorkflow();
0132 
0133 private:
0134 
0135     // Disable
0136     QueueMgrWindow(QWidget*) = delete;
0137 
0138 private:
0139 
0140     class Private;
0141     Private* const d;
0142 
0143     static QueueMgrWindow* m_instance;
0144 };
0145 
0146 } // namespace Digikam
0147 
0148 #endif // DIGIKAM_BQM_QUEUE_MGR_WINDOW_H