digiKam
assignedlist.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 : 2008-11-27
7  * Description : batch tools list assigned to an queued item.
8  *
9  * Copyright (C) 2008-2022 by Gilles Caulier <caulier dot gilles at gmail dot com>
10  *
11  * This program is free software; you can redistribute it
12  * and/or modify it under the terms of the GNU General
13  * Public License as published by the Free Software Foundation;
14  * either version 2, or (at your option)
15  * any later version.
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  * GNU General Public License for more details.
21  *
22  * ============================================================ */
23 
24 #ifndef DIGIKAM_BQM_ASSIGNED_LIST_H
25 #define DIGIKAM_BQM_ASSIGNED_LIST_H
26 
27 // Qt includes
28 
29 #include <QTreeWidget>
30 #include <QWidget>
31 #include <QIcon>
32 
33 // Local includes
34 
35 #include "batchtool.h"
36 #include "batchtoolutils.h"
37 
38 namespace Digikam
39 {
40 
41 class QueueSettings;
42 
43 class AssignedListViewItem : public QTreeWidgetItem
44 {
45 
46 public:
47 
48  explicit AssignedListViewItem(QTreeWidget* const parent);
49  AssignedListViewItem(QTreeWidget* const parent, QTreeWidgetItem* const preceding);
50  ~AssignedListViewItem() override;
51 
52  void setIndex(int index);
53 
54  void setToolSet(const BatchToolSet& set);
56 
57 private:
58 
59  BatchToolSet m_set;
60 
61 private:
62 
63  Q_DISABLE_COPY(AssignedListViewItem)
64 };
65 
66 // -------------------------------------------------------------------------
67 
68 class AssignedListView : public QTreeWidget
69 {
70  Q_OBJECT
71 
72 public:
73 
74  explicit AssignedListView(QWidget* const parent);
75  ~AssignedListView() override;
76 
77  int assignedCount();
79 
81  AssignedListViewItem* moveTool(AssignedListViewItem* const preceding, const BatchToolSet& set);
83 
84  bool removeTool(const BatchToolSet& set);
85 
86  void setBusy(bool b);
87 
88 Q_SIGNALS:
89 
92 
93 public Q_SLOTS:
94 
95  void slotMoveCurrentToolUp();
97  void slotRemoveCurrentTool();
98  void slotClearToolsList();
99  void slotQueueSelected(int, const QueueSettings&, const AssignedBatchTools&);
100  void slotSettingsChanged(const BatchToolSet&);
101  void slotAssignTools(const QMultiMap<int, QString>&);
102 
103 protected:
104 
105  void keyPressEvent(QKeyEvent*) override;
106 
107 private Q_SLOTS:
108 
109  void slotSelectionChanged();
110  void slotContextMenu();
111 
112 private:
113 
114  AssignedListViewItem* findTool(const BatchToolSet& set);
115  void assignTools(const QMultiMap<int, QString>& map, AssignedListViewItem* const preceding);
116  void refreshIndex();
117 
118  Qt::DropActions supportedDropActions() const override;
119  QStringList mimeTypes() const override;
120 
121 #if (QT_VERSION > QT_VERSION_CHECK(5, 99, 0))
122  QMimeData* mimeData(const QList<QTreeWidgetItem*>& items) const override;
123 #else
124  // cppcheck-suppress passedByValue
125  QMimeData* mimeData(const QList<QTreeWidgetItem*> items) const override; // clazy:exclude=function-args-by-ref
126 #endif
127 
128  void dragEnterEvent(QDragEnterEvent*) override;
129  void dragMoveEvent(QDragMoveEvent*) override;
130  void dropEvent(QDropEvent*) override;
131 };
132 
133 } // namespace Digikam
134 
135 #endif // DIGIKAM_BQM_ASSIGNED_LIST_H
Definition: batchtoolutils.h:91
Definition: assignedlist.h:44
BatchToolSet toolSet()
Definition: assignedlist.cpp:104
void setIndex(int index)
Definition: assignedlist.cpp:109
AssignedListViewItem(QTreeWidget *const parent)
Definition: assignedlist.cpp:74
~AssignedListViewItem() override
Definition: assignedlist.cpp:86
void setToolSet(const BatchToolSet &set)
Definition: assignedlist.cpp:90
Definition: assignedlist.h:69
void setBusy(bool b)
Definition: assignedlist.cpp:161
void slotClearToolsList()
Definition: assignedlist.cpp:211
void slotAssignTools(const QMultiMap< int, QString > &)
Definition: assignedlist.cpp:530
AssignedListViewItem * moveTool(AssignedListViewItem *const preceding, const BatchToolSet &set)
Definition: assignedlist.cpp:250
AssignedListViewItem * addTool(const BatchToolSet &set)
Definition: assignedlist.cpp:298
void keyPressEvent(QKeyEvent *) override
Definition: assignedlist.cpp:149
~AssignedListView() override
Definition: assignedlist.cpp:145
bool removeTool(const BatchToolSet &set)
Definition: assignedlist.cpp:303
void signalAssignedToolsChanged(const AssignedBatchTools &)
void slotRemoveCurrentTool()
Definition: assignedlist.cpp:194
void slotSettingsChanged(const BatchToolSet &)
Definition: assignedlist.cpp:519
void slotQueueSelected(int, const QueueSettings &, const AssignedBatchTools &)
Definition: assignedlist.cpp:499
int assignedCount()
Definition: assignedlist.cpp:189
AssignedBatchTools assignedList()
Definition: assignedlist.cpp:166
AssignedListViewItem * insertTool(AssignedListViewItem *const preceding, const BatchToolSet &set)
Definition: assignedlist.cpp:268
void slotMoveCurrentToolDown()
Definition: assignedlist.cpp:234
AssignedListView(QWidget *const parent)
Definition: assignedlist.cpp:117
void signalToolSelected(const BatchToolSet &)
void slotMoveCurrentToolUp()
Definition: assignedlist.cpp:218
Definition: batchtoolutils.h:53
Definition: queuesettings.h:44
Definition: piwigotalker.h:48
Definition: datefolderview.cpp:43