digiKam
tableview.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 : 2013-02-11
7  * Description : Table view
8  *
9  * Copyright (C) 2013 by Michael G. Hansen <mike at mghansen dot de>
10  * Copyright (C) 2017 by Simon Frei <freisim93 at gmail dot com>
11  * Copyright (C) 2017-2022 by Gilles Caulier <caulier dot gilles at gmail dot com>
12  *
13  * This program is free software; you can redistribute it
14  * and/or modify it under the terms of the GNU General
15  * Public License as published by the Free Software Foundation;
16  * either version 2, or (at your option) any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU General Public License for more details.
22  *
23  * ============================================================ */
24 
25 #ifndef DIGIKAM_TABLE_VIEW_H
26 #define DIGIKAM_TABLE_VIEW_H
27 
28 // Qt includes
29 
30 #include <QWidget>
31 
32 // Local includes
33 
34 #include "applicationsettings.h"
36 #include "digikam_export.h"
37 #include "itemviewutilities.h"
38 #include "iteminfo.h"
39 #include "statesavingobject.h"
40 
41 class QMenu;
42 class QContextMenuEvent;
43 class QItemDelegate;
44 class QItemSelectionModel;
45 class QTreeView;
46 
47 namespace Digikam
48 {
49 
50 class Album;
51 class ItemFilterModel;
52 class ThumbnailSize;
53 class TableViewShared;
54 
55 class TableView : public QWidget, public StateSavingObject
56 {
57  Q_OBJECT
58 
59 public:
60 
61  explicit TableView(QItemSelectionModel* const selectionModel,
62  DCategorizedSortFilterProxyModel* const imageFilterModel,
63  QWidget* const parent);
64 
65  ~TableView() override;
66 
67  void setThumbnailSize(const ThumbnailSize& size);
69  ItemInfo currentInfo() const;
70  Album* currentAlbum() const;
71  int numberOfSelectedItems() const;
72  ItemInfo nextInfo() const;
73  ItemInfo previousInfo() const;
74  ItemInfo deepRowItemInfo(const int rowNumber, const bool relative) const;
75 
76  void selectAll();
77  void clearSelection();
78  void invertSelection();
79 
80  ItemInfoList allItemInfos(bool grouping = false) const;
81  ItemInfoList selectedItemInfos(bool grouping = false) const;
82  ItemInfoList selectedItemInfosCurrentFirst(bool grouping = false) const;
85 
86 protected:
87 
88  void doLoadState() override;
89  void doSaveState() override;
90 
91  bool eventFilter(QObject* watched, QEvent* event) override;
93 
94 public Q_SLOTS:
95 
96  void slotGoToRow(const int rowNumber, const bool relativeMove);
97  void slotSetCurrentUrlWhenAvailable(const QUrl& url);
98  void slotSetCurrentWhenAvailable(const qlonglong id);
99  void slotAwayFromSelection();
102  void slotSetActive(const bool isActive);
103  void slotPaste();
104  void rename();
105 
106 protected Q_SLOTS:
107 
108  void slotItemActivated(const QModelIndex& tableViewIndex);
110 
111 Q_SIGNALS:
112 
113  void signalPreviewRequested(const ItemInfo& info);
119  void signalShowContextMenu(QContextMenuEvent* event,
120  const QList<QAction*>& actions);
121  void signalShowContextMenuOnInfo(QContextMenuEvent* event, const ItemInfo& info,
122  const QList<QAction*>& actions,
123  ItemFilterModel* filterModel = nullptr);
124 
125 private:
126 
127  class Private;
128 
129  const QScopedPointer<Private> d;
130  const QScopedPointer<TableViewShared> s;
131 };
132 
133 } // namespace Digikam
134 
135 #endif // DIGIKAM_TABLE_VIEW_H
Abstract base class for all album types.
Definition: album.h:67
OperationType
Definition: applicationsettings.h:99
Definition: dcategorizedsortfilterproxymodel.h:53
Definition: itemfiltermodel.h:125
Definition: iteminfolist.h:47
Definition: iteminfo.h:78
DeleteMode
Definition: itemviewutilities.h:50
@ DeleteUseTrash
Definition: itemviewutilities.h:52
Definition: statesavingobject.h:76
Definition: tableview.h:56
void slotGroupingModeActionTriggered()
Definition: tableview.cpp:368
void slotSetCurrentWhenAvailable(const qlonglong id)
Definition: tableview.cpp:473
void signalPreviewRequested(const ItemInfo &info)
void signalShowContextMenu(QContextMenuEvent *event, const QList< QAction * > &actions)
void slotGoToRow(const int rowNumber, const bool relativeMove)
Definition: tableview.cpp:386
bool allNeedGroupResolving(const ApplicationSettings::OperationType type) const
Definition: tableview.cpp:297
void slotPaste()
Definition: tableview.cpp:276
void doLoadState() override
Definition: tableview.cpp:147
void setThumbnailSize(const ThumbnailSize &size)
Definition: tableview.cpp:243
void slotSetActive(const bool isActive)
Definition: tableview.cpp:598
void slotDeleteSelectedWithoutConfirmation(const ItemViewUtilities::DeleteMode deleteMode=ItemViewUtilities::DeleteUseTrash)
Definition: tableview.cpp:320
ItemInfo previousInfo() const
Definition: tableview.cpp:445
void signalShowContextMenuOnInfo(QContextMenuEvent *event, const ItemInfo &info, const QList< QAction * > &actions, ItemFilterModel *filterModel=nullptr)
ThumbnailSize getThumbnailSize() const
Definition: tableview.cpp:254
void invertSelection()
Definition: tableview.cpp:547
int numberOfSelectedItems() const
Definition: tableview.cpp:381
QList< QAction * > getExtraGroupingActions()
Definition: tableview.cpp:329
void signalInsertSelectedToExistingQueue(int queue)
ItemInfo currentInfo() const
Definition: tableview.cpp:282
void slotItemActivated(const QModelIndex &tableViewIndex)
Definition: tableview.cpp:177
~TableView() override
Definition: tableview.cpp:143
void doSaveState() override
Definition: tableview.cpp:166
ItemInfoList allItemInfos(bool grouping=false) const
Definition: tableview.cpp:287
void clearSelection()
Definition: tableview.cpp:542
void selectAll()
Definition: tableview.cpp:591
void slotSetCurrentUrlWhenAvailable(const QUrl &url)
Definition: tableview.cpp:461
void rename()
Definition: tableview.cpp:644
Album * currentAlbum() const
Definition: tableview.cpp:259
void slotAwayFromSelection()
Unselects the current selection and changes the current item.
Definition: tableview.cpp:492
bool eventFilter(QObject *watched, QEvent *event) override
Definition: tableview.cpp:213
ItemInfo deepRowItemInfo(const int rowNumber, const bool relative) const
Definition: tableview.cpp:407
void signalPopupTagsView()
TableView(QItemSelectionModel *const selectionModel, DCategorizedSortFilterProxyModel *const imageFilterModel, QWidget *const parent)
Definition: tableview.cpp:82
ItemInfoList selectedItemInfosCurrentFirst(bool grouping=false) const
Definition: tableview.cpp:620
ItemInfo nextInfo() const
Definition: tableview.cpp:429
bool selectedNeedGroupResolving(const ApplicationSettings::OperationType type) const
Definition: tableview.cpp:302
ItemInfoList selectedItemInfos(bool grouping=false) const
Definition: tableview.cpp:608
void slotDeleteSelected(const ItemViewUtilities::DeleteMode deleteMode=ItemViewUtilities::DeleteUseTrash)
Definition: tableview.cpp:307
Definition: thumbnailsize.h:42
@ Album
Definition: coredbfields.h:58
Definition: datefolderview.cpp:43