digiKam
showfotocategorizedview.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 : 2012-07-13
7  * Description : Qt categorized item view for showfoto items
8  *
9  * Copyright (C) 2013 by Mohamed_Anwer <m_dot_anwer at gmx 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 SHOW_FOTO_CATEGORIZED_VIEW_H
25 #define SHOW_FOTO_CATEGORIZED_VIEW_H
26 
27 // Local includes
28 
29 #include "itemviewcategorized.h"
30 #include "showfotoitemmodel.h"
31 #include "showfotofiltermodel.h"
32 #include "showfotothumbnailmodel.h"
33 #include "showfotoiteminfo.h"
34 #include "itemdelegateoverlay.h"
35 
36 namespace ShowFoto
37 {
38 
39 class ShowfotoDelegate;
40 
42 {
43 public:
44 
45  Q_OBJECT
46 
47 public:
48 
49  explicit ShowfotoCategorizedView(QWidget* const parent = nullptr);
50  ~ShowfotoCategorizedView() override;
51 
53 
56 
57  QItemSelectionModel* getSelectionModel() const;
58 
61 
64 
65  ShowfotoDelegate* delegate() const;
66 
68  QUrl currentUrl() const;
69 
72  QList<QUrl> selectedUrls() const;
73 
75  QList<QUrl> urls() const;
76 
80  void toIndex(const QUrl& url);
81 
89  ShowfotoItemInfo nextInOrder(const ShowfotoItemInfo& startingPoint, int nth);
90 
93 
98  void addOverlay(ItemDelegateOverlay* overlay, ShowfotoDelegate* delegate = nullptr);
99  void removeOverlay(ItemDelegateOverlay* overlay);
100 
101  // TODO: Implement This
102 /*
103  void addSelectionOverlay(ShowfotoDelegate* delegate = 0);
104 */
106 
107  virtual void setThumbnailSize(const ThumbnailSize& size);
108 
109 public Q_SLOTS:
110 
111  void setThumbnailSize(int size);
112 
116  void setCurrentWhenAvailable(qlonglong ShowfotoItemId);
117 
121  void setCurrentUrl(const QUrl& url);
122 
126  void setCurrentInfo(const ShowfotoItemInfo& info);
127 
131  void setSelectedUrls(const QList<QUrl>& urlList);
132 
137 
141  void hintAt(const ShowfotoItemInfo& info);
142 
143 Q_SIGNALS:
144 
145  void currentChanged(const ShowfotoItemInfo& info);
146 
151  void selected(const QList<ShowfotoItemInfo>& newSelectedInfos);
152 
157  void deselected(const QList<ShowfotoItemInfo>& nowDeselectedInfos);
158 
163 
167  void modelChanged();
168 
169 protected:
170 
172  QSortFilterProxyModel* filterModel() const override;
174  QModelIndex nextIndexHint(const QModelIndex& indexToAnchor, const QItemSelectionRange& removed) const override;
175 
177  void indexActivated(const QModelIndex& index, Qt::KeyboardModifiers modifiers) override;
178  void currentChanged(const QModelIndex& index, const QModelIndex& previous) override;
179  void paintEvent(QPaintEvent* e) override;
180  void selectionChanged(const QItemSelection&, const QItemSelection&) override;
181  void updateGeometries() override;
182 
184  virtual void activated(const ShowfotoItemInfo& info, Qt::KeyboardModifiers modifiers);
185  virtual void showContextMenuOnInfo(QContextMenuEvent* event, const ShowfotoItemInfo& info);
186  void showContextMenuOnIndex(QContextMenuEvent* event, const QModelIndex& index) override;
187 
188 private Q_SLOTS:
189 
190  void slotFileChanged(const QString& filePath);
191  void slotDelayedEnter();
192 
193 private:
194 
195  void scrollToStoredItem();
196 
197 private:
198 
199  // Disable
201  ShowfotoCategorizedView& operator=(const ShowfotoCategorizedView&) = delete;
202 
203 private:
204 
205  class Private;
206  Private* const d;
207 };
208 
209 } // namespace Showfoto
210 
211 #endif // SHOW_FOTO_CATEGORIZED_VIEW_H
Definition: abstractitemdragdrophandler.h:42
Definition: itemdelegateoverlay.h:41
Definition: itemviewcategorized.h:44
Definition: thumbnailsize.h:42
Definition: showfotocategorizedview.h:42
void toIndex(const QUrl &url)
Definition: showfotocategorizedview.cpp:295
void currentChanged(const ShowfotoItemInfo &info)
ShowfotoSortFilterModel * showfotoSortFilterModel() const
Definition: showfotocategorizedview.cpp:160
ShowfotoItemInfo currentInfo() const
Definition: showfotocategorizedview.cpp:226
ShowfotoItemModel * showfotoItemModel() const
Definition: showfotocategorizedview.cpp:155
void indexActivated(const QModelIndex &index, Qt::KeyboardModifiers modifiers) override
Definition: showfotocategorizedview.cpp:530
AbstractItemDragDropHandler * dragDropHandler() const override
Definition: showfotocategorizedview.cpp:589
QList< ShowfotoItemInfo > selectedShowfotoItemInfos() const
Definition: showfotocategorizedview.cpp:236
ShowfotoDelegate * delegate() const
Definition: showfotocategorizedview.cpp:180
void addOverlay(ItemDelegateOverlay *overlay, ShowfotoDelegate *delegate=nullptr)
Definition: showfotocategorizedview.cpp:474
ShowfotoItemInfo nextInfo(const ShowfotoItemInfo &info)
Definition: showfotocategorizedview.cpp:599
void hintAt(const ShowfotoItemInfo &info)
Definition: showfotocategorizedview.cpp:456
QList< QUrl > urls() const
Definition: showfotocategorizedview.cpp:269
QModelIndex nextIndexHint(const QModelIndex &indexToAnchor, const QItemSelectionRange &removed) const override
Definition: showfotocategorizedview.cpp:312
virtual void setThumbnailSize(const ThumbnailSize &size)
Definition: showfotocategorizedview.cpp:377
ShowfotoItemInfo nextInOrder(const ShowfotoItemInfo &startingPoint, int nth)
Definition: showfotocategorizedview.cpp:300
void updateGeometries() override
Definition: showfotocategorizedview.cpp:502
QList< ShowfotoItemInfo > showfotoItemInfos() const
Definition: showfotocategorizedview.cpp:264
void setSelectedUrls(const QList< QUrl > &urlList)
Definition: showfotocategorizedview.cpp:419
void setCurrentWhenAvailable(qlonglong ShowfotoItemId)
Definition: showfotocategorizedview.cpp:386
QSortFilterProxyModel * filterModel() const override
reimplemented from parent class
Definition: showfotocategorizedview.cpp:175
virtual void showContextMenuOnInfo(QContextMenuEvent *event, const ShowfotoItemInfo &info)
Definition: showfotocategorizedview.cpp:574
void setCurrentUrl(const QUrl &url)
Definition: showfotocategorizedview.cpp:391
ShowfotoFilterModel * showfotoFilterModel() const
Returns any ShowfotoFilterModel in chain. May not be sourceModel()
Definition: showfotocategorizedview.cpp:165
void paintEvent(QPaintEvent *e) override
Definition: showfotocategorizedview.cpp:579
ThumbnailSize thumbnailSize() const
Definition: showfotocategorizedview.cpp:354
void showContextMenuOnIndex(QContextMenuEvent *event, const QModelIndex &index) override
Reimplement these in a subclass.
Definition: showfotocategorizedview.cpp:568
void setSelectedShowfotoItemInfos(const QList< ShowfotoItemInfo > &infos)
Definition: showfotocategorizedview.cpp:443
ShowfotoItemInfo previousInfo(const ShowfotoItemInfo &info)
Definition: showfotocategorizedview.cpp:594
void setModels(ShowfotoItemModel *model, ShowfotoSortFilterModel *filterModel)
Definition: showfotocategorizedview.cpp:120
QList< QUrl > selectedUrls() const
Definition: showfotocategorizedview.cpp:282
void setItemDelegate(ShowfotoDelegate *delegate)
Definition: showfotocategorizedview.cpp:185
QItemSelectionModel * getSelectionModel() const
Definition: showfotocategorizedview.cpp:584
void showfotoItemInfoActivated(const ShowfotoItemInfo &info)
void setCurrentInfo(const ShowfotoItemInfo &info)
Definition: showfotocategorizedview.cpp:412
ShowfotoThumbnailModel * showfotoThumbnailModel() const
Returns 0 if the ShowfotoItemModel is not an ShowfotoThumbnailModel.
Definition: showfotocategorizedview.cpp:170
virtual void activated(const ShowfotoItemInfo &info, Qt::KeyboardModifiers modifiers)
Reimplement these in a subclass.
Definition: showfotocategorizedview.cpp:563
QUrl currentUrl() const
Definition: showfotocategorizedview.cpp:231
void deselected(const QList< ShowfotoItemInfo > &nowDeselectedInfos)
void selected(const QList< ShowfotoItemInfo > &newSelectedInfos)
~ShowfotoCategorizedView() override
Definition: showfotocategorizedview.cpp:114
ShowfotoCategorizedView(QWidget *const parent=nullptr)
Definition: showfotocategorizedview.cpp:97
QList< ShowfotoItemInfo > selectedShowfotoItemInfosCurrentFirst() const
Definition: showfotocategorizedview.cpp:241
void removeOverlay(ItemDelegateOverlay *overlay)
Definition: showfotocategorizedview.cpp:490
Definition: showfotodelegate.h:46
Definition: showfotofiltermodel.h:102
Definition: showfotoiteminfo.h:48
Definition: showfotoitemmodel.h:47
Definition: showfotofiltermodel.h:44
Definition: showfotothumbnailmodel.h:42
Definition: showfotofolderviewbar.cpp:52