digiKam
showfotostackviewlist.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 : List-view for the Showfoto stack view.
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_LIST_H
25 #define SHOWFOTO_STACK_VIEW_LIST_H
26 
27 // QT includes
28 
29 #include <QList>
30 #include <QPixmap>
31 #include <QTreeWidget>
32 #include <QMouseEvent>
33 #include <QContextMenuEvent>
34 #include <QModelIndex>
35 
36 // Local includes
37 
39 
40 namespace ShowFoto
41 {
42 
43 class ShowfotoThumbnailBar;
44 
45 class ShowfotoStackViewList : public QTreeWidget
46 {
47  Q_OBJECT
48 
49 public:
50 
52  {
53  FileName = 0,
56  FileDate
57  };
58 
60  {
61  SizeSmall = 32,
62  SizeMedium = 48,
63  SizeLarge = 64,
64  SizeHuge = 96
65  };
66 
67 public:
68 
69  explicit ShowfotoStackViewList(ShowfotoStackViewSideBar* const view);
70  ~ShowfotoStackViewList() override;
71 
72  void setThumbbar(ShowfotoThumbnailBar* const thumbbar);
73 
74  ShowfotoItemInfo infoFromIndex(const QModelIndex& index) const;
75  QList<QUrl> urls();
76  QUrl currentUrl() const;
77 
78  int sortOrder() const;
79  int sortRole() const;
80 
81 public Q_SLOTS:
82 
83  void slotIconSizeChanged(int);
84 
85 Q_SIGNALS:
86 
87  void signalItemListChanged(int nbitems);
92 
93 private:
94 
95  void contextMenuEvent(QContextMenuEvent*) override;
96  void mouseMoveEvent(QMouseEvent*) override;
97  void wheelEvent(QWheelEvent*) override;
98  void keyPressEvent(QKeyEvent*) override;
99  void focusOutEvent(QFocusEvent*) override;
100  void leaveEvent(QEvent*) override;
101 
102  void hideToolTip();
103  bool acceptToolTip(const QModelIndex& index) const;
104 
105  void drawRow(QPainter* p,
106  const QStyleOptionViewItem& opt,
107  const QModelIndex& index) const override;
108 
109 private Q_SLOTS:
110 
111  void slotToolTip();
112  void slotOpenInFileManager();
113  void slotItemsAdded(const QList<ShowfotoItemInfo>& items);
114  void slotItemsRemoved(const QList<ShowfotoItemInfo>& items);
115  void slotItemThumbnail(const ShowfotoItemInfo& info, const QPixmap& pix);
116  void slotItemsSelected(const QList<ShowfotoItemInfo>& items);
117  void slotItemsDeselected(const QList<ShowfotoItemInfo>& items);
118  void slotSelectionChanged(QTreeWidgetItem*);
119  void slotItemDoubleClicked(QTreeWidgetItem*);
120  void slotItemsListChanged();
121  void slotRemoveItems();
122 
123 private:
124 
125  class Private;
126  Private* const d;
127 };
128 
129 } // namespace ShowFoto
130 
131 #endif // SHOWFOTO_STACK_VIEW_LIST_H
Definition: showfotoiteminfo.h:48
Definition: showfotostackviewlist.h:46
ThumbnailSize
Definition: showfotostackviewlist.h:60
@ SizeHuge
Definition: showfotostackviewlist.h:64
@ SizeLarge
Definition: showfotostackviewlist.h:63
@ SizeMedium
Definition: showfotostackviewlist.h:62
@ SizeSmall
Definition: showfotostackviewlist.h:61
void slotIconSizeChanged(int)
Definition: showfotostackviewlist.cpp:346
StackViewRole
Definition: showfotostackviewlist.h:52
@ FileName
Definition: showfotostackviewlist.h:53
@ FileType
Definition: showfotostackviewlist.h:55
@ FileSize
Definition: showfotostackviewlist.h:54
@ FileDate
Metadata date if exists, else Modifier date.
Definition: showfotostackviewlist.h:56
ShowfotoItemInfo infoFromIndex(const QModelIndex &index) const
Definition: showfotostackviewlist.cpp:311
void setThumbbar(ShowfotoThumbnailBar *const thumbbar)
Definition: showfotostackviewlist.cpp:136
int sortRole() const
Definition: showfotostackviewlist.cpp:131
void signalShowfotoItemInfoActivated(const ShowfotoItemInfo &info)
QList< QUrl > urls()
Definition: showfotostackviewlist.cpp:577
int sortOrder() const
Definition: showfotostackviewlist.cpp:126
void signalRemoveItemInfos(const QList< ShowfotoItemInfo > &infos)
ShowfotoStackViewList(ShowfotoStackViewSideBar *const view)
Definition: showfotostackviewlist.cpp:80
~ShowfotoStackViewList() override
Definition: showfotostackviewlist.cpp:120
QUrl currentUrl() const
Definition: showfotostackviewlist.cpp:598
void signalItemListChanged(int nbitems)
Definition: showfotostackviewsidebar.h:55
Definition: showfotothumbnailbar.h:38
Definition: showfotofolderviewbar.cpp:52