digiKam
showfotostackviewfavoritelist.h
Go to the documentation of this file.
1 /* ============================================================
2  *
3  * This file is a part of digiKam project
4  * https://www.digikam.org
5  *
6  * Date : 2021-09-27
7  * Description : Showfoto stack view favorites list
8  *
9  * Copyright (C) 2021-2022 by Gilles Caulier <caulier dot gilles at gmail dot com>
10  *
11  * This program is free software; you can redistribute it
12  * and/or modify it under the terms of the GNU General
13  * Public License as published by the Free Software Foundation;
14  * either version 2, or (at your option)
15  * any later version.
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  * GNU General Public License for more details.
21  *
22  * ============================================================ */
23 
24 #ifndef SHOWFOTO_STACK_VIEW_FAVORITE_LIST_H
25 #define SHOWFOTO_STACK_VIEW_FAVORITE_LIST_H
26 
27 // Qt includes
28 
29 #include <QList>
30 #include <QUrl>
31 #include <QString>
32 #include <QStringList>
33 #include <QPoint>
34 #include <QTreeWidget>
35 #include <QTreeWidgetItem>
36 #include <QDragEnterEvent>
37 #include <QDragMoveEvent>
38 #include <QDropEvent>
39 #include <QContextMenuEvent>
40 
41 namespace ShowFoto
42 {
43 
44 class ShowfotoStackViewFavorites;
45 class ShowfotoStackViewFavoriteItem;
46 class ShowfotoStackViewFavoriteItem;
47 class ShowfotoStackViewFavoriteItem;
48 
49 class ShowfotoStackViewFavoriteList : public QTreeWidget
50 {
51  Q_OBJECT
52 
53 public:
54 
57 
58  ShowfotoStackViewFavoriteItem* findFavoriteByHierarchy(const QString& hierarchy);
59 
63  void setFilter(const QString& filter, Qt::CaseSensitivity cs);
64 
68  QString filter() const;
69 
70 Q_SIGNALS:
71 
73  void signalAddFavorite(const QList<QUrl>&, const QUrl& current);
74  void signalLoadContentsFromFiles(const QStringList& files, const QString& current);
75 
80  void signalSearchResult(int);
81 
82 
83 public Q_SLOTS:
84 
85  void slotLoadContents();
86 
87 private Q_SLOTS:
88 
89  void slotContextMenu(const QPoint& pos);
90  void slotOpenInFileManager();
91 
92 private:
93 
94  void dragEnterEvent(QDragEnterEvent*);
95  void dragMoveEvent(QDragMoveEvent*);
96  void dropEvent(QDropEvent*);
97 
98 #if (QT_VERSION > QT_VERSION_CHECK(5, 99, 0))
99  QMimeData* mimeData(const QList<QTreeWidgetItem*>& items) const override;
100 #else
101  // cppcheck-suppress passedByValue
102  QMimeData* mimeData(const QList<QTreeWidgetItem*> items) const override; // clazy:exclude=function-args-by-ref
103 #endif
104 
105  Qt::DropActions supportedDropActions() const override;
106  void startDrag(Qt::DropActions supportedActions) override;
107  QStringList mimeTypes() const override;
108 
109  void rebaseHierarchy(ShowfotoStackViewFavoriteItem* const parent);
110 
111 private:
112 
113  class Private;
114  Private* const d;
115 };
116 
117 } // namespace ShowFoto
118 
119 #endif // SHOWFOTO_STACK_VIEW_FAVORITE_LIST_H
Definition: showfotostackviewfavoriteitem.h:41
Definition: showfotostackviewfavoritelist.h:50
void setFilter(const QString &filter, Qt::CaseSensitivity cs)
Definition: showfotostackviewfavoritelist.cpp:377
void signalAddFavorite(const QList< QUrl > &, const QUrl &current)
ShowfotoStackViewFavoriteItem * findFavoriteByHierarchy(const QString &hierarchy)
Definition: showfotostackviewfavoritelist.cpp:337
QString filter() const
Definition: showfotostackviewfavoritelist.cpp:415
ShowfotoStackViewFavoriteList(ShowfotoStackViewFavorites *const parent)
Definition: showfotostackviewfavoritelist.cpp:72
void signalLoadContentsFromFiles(const QStringList &files, const QString &current)
void slotLoadContents()
Definition: showfotostackviewfavoritelist.cpp:116
~ShowfotoStackViewFavoriteList() override
Definition: showfotostackviewfavoritelist.cpp:101
Definition: showfotostackviewfavorites.h:49
Definition: showfotofolderviewbar.cpp:52