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

0001 /* ============================================================
0002  *
0003  * This file is a part of digiKam project
0004  * https://www.digikam.org
0005  *
0006  * Date        : 2010-02-04
0007  * Description : a tool to export images to Imgur web service
0008  *
0009  * SPDX-FileCopyrightText: 2010-2012 by Marius Orcsik <marius at habarnam dot ro>
0010  * SPDX-FileCopyrightText: 2013-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_IMGUR_IMAGES_LIST_H
0017 #define DIGIKAM_IMGUR_IMAGES_LIST_H
0018 
0019 // Qt includes
0020 
0021 #include <QWidget>
0022 
0023 // Local includes
0024 
0025 #include "ditemslist.h"
0026 #include "imgurtalker.h"
0027 
0028 using namespace Digikam;
0029 
0030 namespace DigikamGenericImgUrPlugin
0031 {
0032 
0033 class ImgurImageListViewItem;
0034 
0035 class ImgurImagesList : public DItemsList
0036 {
0037     Q_OBJECT
0038 
0039 public:
0040 
0041     /// The different columns in a list.
0042     enum FieldType
0043     {
0044         Title           = DItemsListView::User1,
0045         Description     = DItemsListView::User2,
0046         URL             = DItemsListView::User3,
0047         DeleteURL       = DItemsListView::User4
0048     };
0049 
0050 public:
0051 
0052     explicit ImgurImagesList(QWidget* const parent = nullptr);
0053     ~ImgurImagesList() override = default;
0054 
0055     QList<const ImgurImageListViewItem*> getPendingItems();
0056 
0057 public Q_SLOTS:
0058 
0059     void slotAddImages(const QList<QUrl>& list) override;
0060     void slotSuccess(const ImgurTalkerResult& result);
0061     void slotDoubleClick(QTreeWidgetItem* element, int i);
0062     void slotContextMenuRequested();
0063     void slotCopyImurgURL();
0064 };
0065 
0066 // -------------------------------------------------------------------------
0067 
0068 class ImgurImageListViewItem : public DItemsListViewItem
0069 {
0070 public:
0071 
0072     explicit ImgurImageListViewItem(DItemsListView* const view, const QUrl& url);
0073     ~ImgurImageListViewItem() override = default;
0074 
0075     void setTitle(const QString& str);
0076     QString Title()          const;
0077 
0078     void setDescription(const QString& str);
0079     QString Description()    const;
0080 
0081     void setImgurUrl(const QString& str);
0082     QString ImgurUrl()       const;
0083 
0084     void setImgurDeleteUrl(const QString& str);
0085     QString ImgurDeleteUrl() const;
0086 };
0087 
0088 } // namespace DigikamGenericImgUrPlugin
0089 
0090 #endif // DIGIKAM_IMGUR_IMAGES_LIST_H