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

0001 /*
0002  *  SPDX-FileCopyrightText: 2023 Srirupa Datta <srirupa.sps@gmail.com>
0003  */
0004 #ifndef KOBUNDLECREATIONWIDGET_H
0005 #define KOBUNDLECREATIONWIDGET_H
0006 
0007 #include "page_bundle_saver.h"
0008 #include "page_metadata_info.h"
0009 #include "page_resource_chooser.h"
0010 #include "page_tag_chooser.h"
0011 #include "wdg_side.h"
0012 
0013 #include <QWidget>
0014 #include <QWizard>
0015 
0016 #include <KoDialog.h>
0017 #include <KoResourceBundle.h>
0018 #include "KisBundleStorage.h"
0019 #include <KisResourceStorage.h>
0020 
0021 
0022 namespace Ui
0023 {
0024 class WdgDlgCreateBundle;
0025 }
0026 
0027 class DlgCreateBundle : public QWizard
0028 {
0029     Q_OBJECT
0030 
0031 public:
0032     explicit DlgCreateBundle(KoResourceBundleSP bundle = nullptr, QWidget *parent = 0);
0033     ~DlgCreateBundle() override;
0034 
0035     QMap<QString, int> m_count;
0036     QSet<QString> m_tags;
0037 
0038 private Q_SLOTS:
0039 
0040     void accept() override;
0041     void reject() override;
0042 
0043     void saveToConfiguration(bool full);
0044     QVector<KisTagSP> getTagsForEmbeddingInResource(QVector<KisTagSP> resourceTags, QString resourceType) const;
0045 
0046 public Q_SLOTS:
0047 
0048     void updateTitle(int id);
0049 
0050 private:
0051 
0052     Ui::WdgDlgCreateBundle *m_ui;
0053 
0054     bool putResourcesInTheBundle(KoResourceBundleSP bundle);
0055     void putMetaDataInTheBundle(KoResourceBundleSP bundle) const;
0056     QString createPrettyFilenameFromName(KoResourceSP resource) const;
0057 
0058     QList<int> m_selectedResourcesIds;
0059     QList<int> m_selectedTagIds;
0060 
0061     QString m_previewImage;
0062     KoResourceBundleSP m_bundle;
0063 
0064     PageResourceChooser *m_pageResourceChooser;
0065     PageTagChooser *m_pageTagChooser;
0066     PageMetadataInfo *m_pageMetadataInfo;
0067     PageBundleSaver *m_pageBundleSaver;
0068 
0069     KisBundleStorage *m_bundleStorage;
0070     KisResourceStorageSP m_resourceStorage;
0071     QString m_storageID;
0072     bool m_storageAdded;
0073     QString m_bundleCreaterMode;
0074 };
0075 
0076 #endif // KOBUNDLECREATIONWIDGET_H