File indexing completed on 2024-05-12 15:59:57
0001 /* 0002 * This file is part of the KDE project 0003 * SPDX-FileCopyrightText: 2002 Patrick Julien <freak@codepimps.org> 0004 * SPDX-FileCopyrightText: 2007 Jan Hambrecht <jaham@gmx.net> 0005 * SPDX-FileCopyrightText: 2007 Sven Langkamp <sven.langkamp@gmail.com> 0006 * SPDX-FileCopyrightText: 2011 Srikanth Tiyyagura <srikanth.tulasiram@gmail.com> 0007 * SPDX-FileCopyrightText: 2011 José Luis Vergara <pentalis@gmail.com> 0008 * SPDX-FileCopyrightText: 2013 Sascha Suelzer <s.suelzer@gmail.com> 0009 * SPDX-FileCopyrightText: 2019 Boudewijn Rempt <boud@valdyas.org> 0010 * SPDX-FileCopyrightText: 2020 Agata Cacko <cacko.azh@gmail.com> 0011 * 0012 * SPDX-License-Identifier: LGPL-2.0-or-later 0013 */ 0014 0015 #ifndef KISRESOURCETAGGINGMANAGER_H 0016 #define KISRESOURCETAGGINGMANAGER_H 0017 0018 #include <QObject> 0019 0020 #include <KoResource.h> 0021 #include <KisTag.h> 0022 #include <KisTagModel.h> 0023 0024 #include <kis_debug.h> 0025 0026 class QWidget; 0027 class QStringList; 0028 class QString; 0029 class QPoint; 0030 0031 class KisTagFilterWidget; 0032 class KisTagChooserWidget; 0033 class KisTagFilterResourceProxyModel; 0034 0035 0036 /** 0037 * @brief The KisResourceTaggingManager class is a helper class for KisResourceItemChooser for tagChooser and tagFilter widgets. 0038 * 0039 * It takes care of exchanging information about tags between KisTagChooserWidget and KisTagFilterWidget. 0040 * It makes sure that the correct tag is put in the resource model proxy that is used in the KisResourceItemChooser. 0041 * Historically it also managed a list of tags; now KisTagModel is taking care of it. 0042 * 0043 */ 0044 class KisResourceTaggingManager : public QObject 0045 { 0046 Q_OBJECT 0047 0048 public: 0049 0050 /// 0051 /// \brief KisResourceTaggingManager standard constructor of the KisResourceTaggingManager class 0052 /// \param resourceType resource type of the resources that will be dealt with 0053 /// \param model proxy model that is used to show only the resources tagged with a specific tag 0054 /// \param parent parent widget 0055 /// 0056 explicit KisResourceTaggingManager(QString resourceType, KisTagFilterResourceProxyModel *model, QWidget *parent); 0057 0058 /// \brief ~KisResourceTaggingManager destructor 0059 ~KisResourceTaggingManager() override; 0060 0061 /// 0062 /// \brief showTaggingBar method to show or hide the tag chooser bar and the tag filter 0063 /// \param show if true, the bars should be shown; if false, they should be hidden 0064 /// 0065 void showTaggingBar(bool show); 0066 /// 0067 /// \brief contextMenuRequested method to get the context menu 0068 /// \param currentResource current selected resource 0069 /// \param pos position of the mouse cursor where the context menu should be created 0070 /// 0071 void contextMenuRequested(KoResourceSP currentResource, QPoint pos); 0072 /// 0073 /// \brief tagFilterWidget method to get the tag filter widget 0074 /// \return tag filter widget 0075 /// 0076 KisTagFilterWidget *tagFilterWidget(); 0077 /// 0078 /// \brief tagChooserWidget method to get the tag chooser widget 0079 /// \return tag chooser widget 0080 /// 0081 KisTagChooserWidget *tagChooserWidget(); 0082 0083 private Q_SLOTS: 0084 /// 0085 /// \brief tagChooserIndexChanged slot for the signal that the tag chosen in the tags combobox changed 0086 /// \param tag the currently chosen tag 0087 /// 0088 /// It puts the current tag in the filter proxy model to get only the resources filtered out by the tag. 0089 /// 0090 void tagChooserIndexChanged(const KisTagSP tag); 0091 /// 0092 /// \brief tagSearchLineEditTextChanged slot for the signal that the text in the filter changed 0093 /// \param lineEditText the current text in the filter box 0094 /// 0095 /// It updates the filter in the filter proxy model. 0096 /// 0097 void tagSearchLineEditTextChanged(const QString &lineEditText); 0098 /// 0099 /// \brief slotFilterByTagChanged slot for the "filter by tag" checkbox being checked or unchecked by the user 0100 /// \param filterByTag current state of the checkbox 0101 /// 0102 /// It updates the filter in the filter proxy model to honor the "filter by tag" setting correctly. 0103 /// 0104 void slotFilterByTagChanged(const bool filterByTag); 0105 0106 private: 0107 0108 class Private; 0109 Private* const d; 0110 }; 0111 0112 0113 #endif // KORESOURCETAGGINGINTERFACE_H