1 /* ============================================================
2  *
3  * This file is a part of digiKam project
4  * https://www.digikam.org
5  *
6  * Date        : 2012-20-07
7  * Description : Thumbnail bar for import tool
8  *
9  * Copyright (C) 2012      by Islam Wazery <wazery at ubuntu dot com>
10  * Copyright (C) 2012-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_IMPORT_THUMBNAIL_BAR_H
26 #define DIGIKAM_IMPORT_THUMBNAIL_BAR_H
27 
28 // Local includes
29 
30 #include "importcategorizedview.h"
31 
32 namespace Digikam
33 {
34 
35 class ImportThumbnailBar : public ImportCategorizedView
36 {
37     Q_OBJECT
38 
39 public:
40 
41     explicit ImportThumbnailBar(QWidget* const parent = nullptr);
42     ~ImportThumbnailBar() override;
43 
44     /**
45      * This installs a duplicate filter model, if the ImportItemModel may contain duplicates.
46      * Otherwise, just use setModels().
47      */
48     void setModelsFiltered(ImportItemModel* model, ImportSortFilterModel* filterModel);
49 
50     QModelIndex nextIndex(const QModelIndex& index)     const;
51     QModelIndex previousIndex(const QModelIndex& index) const;
52     QModelIndex firstIndex()                            const;
53     QModelIndex lastIndex()                             const;
54 
55     /**
56      * Sets the policy always for the one scroll bar which is relevant, depending on orientation
57      */
58     void setScrollBarPolicy(Qt::ScrollBarPolicy policy);
59     void setFlow(QListView::Flow newFlow);
60 
61     void installOverlays();
62 
63 public Q_SLOTS:
64 
65     void assignRating(const QList<QModelIndex>& index, int rating);
66     void slotDockLocationChanged(Qt::DockWidgetArea area);
67 
68 protected:
69 
70     void slotSetupChanged() override;
71     bool event(QEvent*)     override;
72 
73 private:
74 
75     // Disable
76     ImportThumbnailBar(const ImportThumbnailBar&)            = delete;
77     ImportThumbnailBar& operator=(const ImportThumbnailBar&) = delete;
78 
79 private:
80 
81     class Private;
82     Private* const d;
83 };
84 
85 } // namespace Digikam
86 
87 #endif // DIGIKAM_IMPORT_THUMBNAIL_BAR_H
88