digiKam
itemmarkertiler.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 : 2010-07-17
7  * Description : A marker tiler operating on item models
8  *
9  * Copyright (C) 2010-2022 by Gilles Caulier <caulier dot gilles at gmail dot com>
10  * Copyright (C) 2010-2011 by Michael G. Hansen <mike at mghansen dot de>
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 ITEM_MARKER_TILER_H
26 #define ITEM_MARKER_TILER_H
27 
28 // Qt includes
29 
30 #include <QItemSelection>
31 
32 // Local includes
33 
34 #include "digikam_export.h"
35 #include "abstractmarkertiler.h"
36 
37 namespace Digikam
38 {
39 class GeoModelHelper;
40 
41 class DIGIKAM_EXPORT ItemMarkerTiler : public AbstractMarkerTiler
42 {
43  Q_OBJECT
44 
45 private:
46 
47  class MyTile;
48 
49 public:
50 
51  explicit ItemMarkerTiler(GeoModelHelper* const modelHelper, QObject* const parent = nullptr);
52  ~ItemMarkerTiler() override;
53 
54  TilerFlags tilerFlags() const override;
55  Tile* tileNew() override;
56  void prepareTiles(const GeoCoordinates& upperLeft, const GeoCoordinates& lowerRight, int level) override;
57  void regenerateTiles() override;
58  Tile* getTile(const TileIndex& tileIndex, const bool stopIfEmpty) override;
59  int getTileMarkerCount(const TileIndex& tileIndex) override;
60  int getTileSelectedCount(const TileIndex& tileIndex) override;
61 
62  QVariant getTileRepresentativeMarker(const TileIndex& tileIndex, const int sortKey) override;
63  QVariant bestRepresentativeIndexFromList(const QList<QVariant>& indices, const int sortKey) override;
64  QPixmap pixmapFromRepresentativeIndex(const QVariant& index, const QSize& size) override;
65  bool indicesEqual(const QVariant& a, const QVariant& b) const override;
66  GeoGroupState getTileGroupState(const TileIndex& tileIndex) override;
67  GeoGroupState getGlobalGroupState() override;
68 
69  void onIndicesClicked(const ClickInfo& clickInfo) override;
70  void onIndicesMoved(const TileIndex::List& tileIndicesList,
71  const GeoCoordinates& targetCoordinates,
72  const QPersistentModelIndex& targetSnapIndex) override;
73 
74  void setMarkerGeoModelHelper(GeoModelHelper* const modelHelper);
75  void removeMarkerIndexFromGrid(const QModelIndex& markerIndex, const bool ignoreSelection = false);
76  void addMarkerIndexToGrid(const QPersistentModelIndex& markerIndex);
77 
78  void setActive(const bool state) override;
79 
80 private Q_SLOTS:
81 
82  void slotSourceModelRowsInserted(const QModelIndex& parentIndex, int start, int end);
83  void slotSourceModelRowsAboutToBeRemoved(const QModelIndex& parentIndex, int start, int end);
84  void slotSourceModelDataChanged(const QModelIndex& topLeft, const QModelIndex& bottomRight);
85  void slotSourceModelReset();
86  void slotSelectionChanged(const QItemSelection& selected, const QItemSelection& deselected);
87  void slotThumbnailAvailableForIndex(const QPersistentModelIndex& index, const QPixmap& pixmap);
88  void slotSourceModelLayoutChanged();
89 
90 private:
91 
92  QList<QPersistentModelIndex> getTileMarkerIndices(const TileIndex& tileIndex);
93 
94 private:
95 
96  class Private;
97  Private* const d;
98 };
99 
100 } // namespace Digikam
101 
102 #endif // ITEM_MARKER_TILER_H
Definition: abstractmarkertiler.h:61
Definition: abstractmarkertiler.h:73
Definition: abstractmarkertiler.h:45
Definition: geocoordinates.h:49
Helper class to access data in models.
Definition: geomodelhelper.h:47
Definition: itemmarkertiler.h:42
Definition: tileindex.h:45
Definition: datefolderview.cpp:43