File indexing completed on 2024-12-22 04:15:11

0001 /*
0002  * SPDX-FileCopyrightText: 2021 Mathias Wein <lynx.mw+kde@gmail.com>
0003  *  SPDX-FileCopyrightText: 2023 Srirupa Datta <srirupa.sps@gmail.com>
0004  *
0005  * SPDX-License-Identifier: LGPL-2.0-or-later
0006  */
0007 
0008 #ifndef DLGRESOURCEMANAGER_H
0009 #define DLGRESOURCEMANAGER_H
0010 
0011 #include <KoDialog.h>
0012 #include <QScopedPointer>
0013 #include <QSortFilterProxyModel>
0014 #include <QSharedPointer>
0015 #include <QItemSelection>
0016 #include <KisResourceThumbnailPainter.h>
0017 #include "wdg_resource_preview.h"
0018 
0019 
0020 class KisActionManager;
0021 class KisResourceTypeModel;
0022 class KisStorageModel;
0023 class KisTagModel;
0024 class KisResourceModel;
0025 class KisTagFilterResourceProxyModel;
0026 class KisTag;
0027 class KisWdgTagSelectionControllerOneResource;
0028 
0029 namespace Ui
0030 {
0031 class WdgDlgResourceManager;
0032 } // namespace Ui
0033 
0034 class DlgResourceManager : public KoDialog
0035 {
0036     Q_OBJECT
0037 public:
0038     DlgResourceManager(KisActionManager* actionMgr, QWidget *parent = 0);
0039     ~DlgResourceManager() override;
0040 
0041 private Q_SLOTS:
0042     void slotResourcesSelectionChanged(QModelIndex selected);
0043 
0044     void slotDeleteResources();
0045     void slotImportResources();
0046     void slotOpenResourceFolder();
0047     void slotCreateBundle();
0048     void slotSaveTags();
0049 private:
0050     void updateDeleteButtonState(const QModelIndexList &list);
0051 
0052     static QString constructMetadata(const QMap<QString, QVariant> &metadata, const QString &resourceType);
0053 
0054 private:
0055     QWidget *m_page {nullptr};
0056     QScopedPointer<Ui::WdgDlgResourceManager> m_ui;
0057     KisActionManager *m_actionManager {nullptr};
0058 
0059     QScopedPointer<KisWdgTagSelectionControllerOneResource> m_tagsController;
0060 
0061     KisResourceThumbnailPainter m_thumbnailPainter;
0062 
0063     bool m_undeleteMode {false};
0064 
0065     WdgResourcePreview *m_wdgResourcePreview;
0066 };
0067 
0068 #endif // DLGRESOURCEMANAGER_H