1 /* ============================================================
2  *
3  * This file is a part of digiKam project
4  * https://www.digikam.org
5  *
6  * Date        : 2010-02-06
7  * Description : Thumbnail bar for items
8  *
9  * Copyright (C) 2009-2011 by Marcel Wiesweg <marcel dot wiesweg at gmx dot de>
10  * Copyright (C) 2009-2021 by Gilles Caulier <caulier dot gilles at gmail dot com>
11  *
12  * This program is free software; you can redistribute it
13  * and/or modify it under the terms of the GNU General
14  * Public License as published by the Free Software Foundation;
15  * either version 2, or (at your option)
16  * 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_ITEM_THUMBNAIL_BAR_H
26 #define DIGIKAM_ITEM_THUMBNAIL_BAR_H
27 
28 // Local includes
29 
30 #include "itemcategorizedview.h"
31 
32 namespace Digikam
33 {
34 
35 class ItemThumbnailBar : public ItemCategorizedView
36 {
37     Q_OBJECT
38 
39 public:
40 
41     explicit ItemThumbnailBar(QWidget* const parent = nullptr);
42     ~ItemThumbnailBar() override;
43 
44     /// Sets the policy always for the one scroll bar which is relevant, depending on orientation
45     void setScrollBarPolicy(Qt::ScrollBarPolicy policy);
46     void setFlow(QListView::Flow newFlow);
47 
48     void installOverlays();
49 
50     /**
51      * This installs a duplicate filter model, if the ItemModel may contain duplicates.
52      * Otherwise, just use setModels().
53      */
54     void setModelsFiltered(ItemModel* model, ImageSortFilterModel* filterModel);
55 
56     QModelIndex nextIndex(const QModelIndex& index)     const;
57     QModelIndex previousIndex(const QModelIndex& index) const;
58     QModelIndex firstIndex()                            const;
59     QModelIndex lastIndex()                             const;
60 
61 public Q_SLOTS:
62 
63     void assignRating(const QList<QModelIndex>& index, int rating);
64     void slotDockLocationChanged(Qt::DockWidgetArea area);
65 
66 protected:
67 
68     void slotSetupChanged() override;
69     bool event(QEvent*)     override;
70 
71 private:
72 
73     class Private;
74     Private* const d;
75 };
76 
77 } // namespace Digikam
78 
79 #endif // DIGIKAM_ITEM_THUMBNAIL_BAR_H
80