File indexing completed on 2025-01-05 03:51:11

0001 /* ============================================================
0002  *
0003  * This file is a part of digiKam project
0004  * https://www.digikam.org
0005  *
0006  * Date        : 2010-02-06
0007  * Description : Thumbnail bar for items
0008  *
0009  * SPDX-FileCopyrightText: 2009-2011 by Marcel Wiesweg <marcel dot wiesweg at gmx dot de>
0010  * SPDX-FileCopyrightText: 2009-2024 by Gilles Caulier <caulier dot gilles at gmail dot com>
0011  *
0012  * SPDX-License-Identifier: GPL-2.0-or-later
0013  *
0014  * ============================================================ */
0015 
0016 #ifndef DIGIKAM_ITEM_THUMBNAIL_BAR_H
0017 #define DIGIKAM_ITEM_THUMBNAIL_BAR_H
0018 
0019 // Local includes
0020 
0021 #include "itemcategorizedview.h"
0022 #include "groupingviewimplementation.h"
0023 
0024 namespace Digikam
0025 {
0026 
0027 class ItemThumbnailBar : public ItemCategorizedView,
0028                          public GroupingViewImplementation
0029 {
0030     Q_OBJECT
0031 
0032 public:
0033 
0034     explicit ItemThumbnailBar(QWidget* const parent = nullptr);
0035     ~ItemThumbnailBar() override;
0036 
0037     /// Sets the policy always for the one scroll bar which is relevant, depending on orientation
0038     void setScrollBarPolicy(Qt::ScrollBarPolicy policy);
0039     void setFlow(QListView::Flow newFlow);
0040 
0041     void installOverlays();
0042 
0043     /**
0044      * This installs a duplicate filter model, if the ItemModel may contain duplicates.
0045      * Otherwise, just use setModels().
0046      */
0047     void setModelsFiltered(ItemModel* model, ImageSortFilterModel* filterModel);
0048 
0049     QModelIndex nextIndex(const QModelIndex& index)     const;
0050     QModelIndex previousIndex(const QModelIndex& index) const;
0051     QModelIndex firstIndex()                            const;
0052     QModelIndex lastIndex()                             const;
0053 
0054 public Q_SLOTS:
0055 
0056     void assignRating(const QList<QModelIndex>& index, int rating);
0057     void slotDockLocationChanged(Qt::DockWidgetArea area);
0058 
0059 protected:
0060 
0061     bool event(QEvent*)                                       override;
0062     void slotSetupChanged()                                   override;
0063     bool hasHiddenGroupedImages(const ItemInfo& info)   const override;
0064 
0065 private:
0066 
0067     class Private;
0068     Private* const d;
0069 };
0070 
0071 } // namespace Digikam
0072 
0073 #endif // DIGIKAM_ITEM_THUMBNAIL_BAR_H