File indexing completed on 2025-01-05 03:53:35

0001 /* ============================================================
0002  *
0003  * This file is a part of digiKam project
0004  * https://www.digikam.org
0005  *
0006  * Date        : 2012-02-12
0007  * Description : a tool to export images to IPFS web service
0008  *
0009  * SPDX-FileCopyrightText: 2018      by Amar Lakshya <amar dot lakshya at xaviers dot edu dot in>
0010  * SPDX-FileCopyrightText: 2018-2020 by Caulier Gilles <caulier dot gilles at gmail dot com>
0011  *
0012  * SPDX-License-Identifier: GPL-2.0-or-later
0013  *
0014  * ============================================================ */
0015 
0016 #ifndef DIGIKAM_IPFS_IMAGES_LIST_H
0017 #define DIGIKAM_IPFS_IMAGES_LIST_H
0018 
0019 // Qt includes
0020 
0021 #include <QWidget>
0022 
0023 // Local includes
0024 
0025 #include "ditemslist.h"
0026 #include "ipfstalker.h"
0027 
0028 using namespace Digikam;
0029 
0030 namespace DigikamGenericIpfsPlugin
0031 {
0032 
0033 class IpfsImagesListViewItem;
0034 
0035 class IpfsImagesList : public DItemsList
0036 {
0037     Q_OBJECT
0038 
0039 public:
0040 
0041     /* The different columns in a list.
0042      */
0043     enum FieldType
0044     {
0045         Title       = DItemsListView::User1,
0046         Description = DItemsListView::User2,
0047         Url         = DItemsListView::User3,
0048     };
0049 
0050 public:
0051 
0052     explicit IpfsImagesList(QWidget* const parent = nullptr);
0053     ~IpfsImagesList()                                            override = default;
0054 
0055     QList<const IpfsImagesListViewItem*> getPendingItems() const;
0056 
0057 public Q_SLOTS:
0058 
0059     void slotAddImages(const QList<QUrl>& list) override;
0060     void slotSuccess(const IpfsTalkerResult& result);
0061     void slotDoubleClick(QTreeWidgetItem* element, int i);
0062 };
0063 
0064 // -------------------------------------------------------------------------
0065 
0066 class IpfsImagesListViewItem : public DItemsListViewItem
0067 {
0068 public:
0069 
0070     explicit IpfsImagesListViewItem(DItemsListView* const view, const QUrl& url);
0071     ~IpfsImagesListViewItem()         override = default;
0072 
0073     void setTitle(const QString& str);
0074     QString Title()             const;
0075 
0076     void setDescription(const QString& str);
0077     QString Description()       const;
0078 
0079     void setIpfsUrl(const QString& str);
0080     QString IpfsUrl()           const;
0081 };
0082 
0083 } // namespace DigikamGenericIpfsPlugin
0084 
0085 #endif // DIGIKAM_IPFS_IMAGES_LIST_H