digiKam
trashview.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 : 2015-08-07
7  * Description : Trash view
8  *
9  * Copyright (C) 2015 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) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU General Public License for more details.
20  *
21  * ============================================================ */
22 
23 #ifndef DIGIKAM_TRASH_VIEW_H
24 #define DIGIKAM_TRASH_VIEW_H
25 
26 // Qt includes
27 
28 #include <QWidget>
29 #include <QStyledItemDelegate>
30 
31 namespace Digikam
32 {
33 
34 class DTrashItemModel;
35 class ThumbnailSize;
36 
37 class TrashView : public QWidget
38 {
39  Q_OBJECT
40 
41 public:
42 
43  explicit TrashView(QWidget* const parent = nullptr);
44  ~TrashView() override;
45 
49  DTrashItemModel* model() const;
50 
55 
60  void setThumbnailSize(const ThumbnailSize& thumbSize);
61 
65  QUrl lastSelectedItemUrl() const;
66 
70  void selectLastSelected();
71 
75  QString statusBarText() const;
76 
77 private Q_SLOTS:
78 
79  void slotSelectionChanged();
80  void slotUndoLastDeletedItems();
81  void slotRestoreSelectedItems();
82  void slotDeleteSelectedItems();
83  void slotRemoveItemsFromModel();
84  void slotRemoveAllItemsFromModel();
85  void slotDeleteAllItems();
86  void slotDataChanged();
87  void slotChangeLastSelectedItem(const QModelIndex& curr, const QModelIndex& prev);
88 
89 Q_SIGNALS:
90 
92 
93 private:
94 
95  class Private;
96  Private* const d;
97 };
98 
99 // --------------------------------------------------
100 
101 class ThumbnailAligningDelegate : public QStyledItemDelegate
102 {
103  Q_OBJECT
104 
105 public:
106 
107  explicit ThumbnailAligningDelegate(QObject* const parent = nullptr);
108 
109  void paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const override;
110 };
111 
112 } // namespace Digikam
113 
114 #endif // DIGIKAM_TRASH_VIEW_H
Definition: dtrashitemmodel.h:40
Definition: trashview.h:102
ThumbnailAligningDelegate(QObject *const parent=nullptr)
Definition: trashview.cpp:452
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override
Definition: trashview.cpp:457
Definition: thumbnailsize.h:42
Definition: trashview.h:38
ThumbnailSize getThumbnailSize() const
Definition: trashview.cpp:192
void setThumbnailSize(const ThumbnailSize &thumbSize)
set thumbnail size to give to model
Definition: trashview.cpp:393
QString statusBarText() const
Definition: trashview.cpp:426
~TrashView() override
Definition: trashview.cpp:182
void selectLastSelected()
Highlights the last selected item when the view gets focus.
Definition: trashview.cpp:405
QUrl lastSelectedItemUrl() const
Definition: trashview.cpp:400
DTrashItemModel * model() const
Definition: trashview.cpp:187
TrashView(QWidget *const parent=nullptr)
Definition: trashview.cpp:94
Definition: datefolderview.cpp:43