digiKam
mapwidgetview.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-15
7  * Description : central Map view
8  *
9  * Copyright (C) 2010 by Gabriel Voicu <ping dot gabi at gmail dot com>
10  * Copyright (C) 2010 by Michael G. Hansen <mike at mghansen dot de>
11  * Copyright (C) 2014-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_MAP_WIDGET_VIEW_H
26 #define DIGIKAM_MAP_WIDGET_VIEW_H
27 
28 // Qt includes
29 
30 #include <QWidget>
31 
32 // Local includes
33 
34 #include "geomodelhelper.h"
35 #include "digikam_export.h"
37 #include "statesavingobject.h"
38 #include "itemalbummodel.h"
39 #include "thumbnailloadthread.h"
40 #include "itemfiltermodel.h"
41 #include "camiteminfo.h"
42 
43 namespace Digikam
44 {
45 
46 class AlbumWidgetStack;
47 class ImageChangeset;
48 
49 class DIGIKAM_GUI_EXPORT MapWidgetView : public QWidget,
50  public StateSavingObject
51 {
52  Q_OBJECT
53 
54 public:
55 
57  {
58  ApplicationDigikam = 1,
59  ApplicationImportUI = 2
60  };
61 
62 public:
63 
64  explicit MapWidgetView(QItemSelectionModel* const selectionModel,
65  DCategorizedSortFilterProxyModel* const imageFilterModel,
66  QWidget* const parent,
67  const Application application);
68  ~MapWidgetView() override;
69 
70  void setActive(const bool state);
71  bool getActiveState() const;
72 
73  ItemInfo currentItemInfo() const;
74  CamItemInfo currentCamItemInfo() const;
75 
76 private Q_SLOTS:
77 
78  void slotModelChanged();
79 
80 protected:
81 
82  void doLoadState() override;
83  void doSaveState() override;
84 
85 private:
86 
87  class Private;
88  const QScopedPointer<Private> d;
89 };
90 
91 // ----------------------------------------------------------------------------------------------
92 
94 {
95  Q_OBJECT
96 
97 public:
98 
99  explicit MapViewModelHelper(QItemSelectionModel* const selection,
100  DCategorizedSortFilterProxyModel* const filterModel,
101  QObject* const parent,
102  const MapWidgetView::Application application);
103  ~MapViewModelHelper() override;
104 
105  QAbstractItemModel* model() const override;
106  QItemSelectionModel* selectionModel() const override;
107  bool itemCoordinates(const QModelIndex& index,
108  GeoCoordinates* const coordinates) const override;
109 
110  QPixmap pixmapFromRepresentativeIndex(const QPersistentModelIndex& index,
111  const QSize& size) override;
112  QPersistentModelIndex bestRepresentativeIndexFromList(const QList<QPersistentModelIndex>& list,
113  const int sortKey) override;
114 
115  void onIndicesClicked(const QList<QPersistentModelIndex>& clickedIndices) override;
116 
117 Q_SIGNALS:
118 
120 
121 private Q_SLOTS:
122 
123  void slotThumbnailLoaded(const LoadingDescription&, const QPixmap&);
124  void slotThumbnailLoaded(const CamItemInfo& info);
125  void slotImageChange(const ImageChangeset& changeset);
126 
127 private:
128 
129  class Private;
130  const QScopedPointer<Private> d;
131 };
132 
133 } // namespace Digikam
134 
135 #endif // DIGIKAM_MAP_WIDGET_VIEW_H
Definition: camiteminfo.h:48
Definition: dcategorizedsortfilterproxymodel.h:53
Definition: geocoordinates.h:49
Helper class to access data in models.
Definition: geomodelhelper.h:47
Definition: coredbchangesets.h:48
Definition: iteminfo.h:78
Definition: loadingdescription.h:45
Definition: mapwidgetview.h:94
bool itemCoordinates(const QModelIndex &index, GeoCoordinates *const coordinates) const override
Gets the coordinates of a marker found at current model index.
Definition: mapwidgetview.cpp:440
QPersistentModelIndex bestRepresentativeIndexFromList(const QList< QPersistentModelIndex > &list, const int sortKey) override
This function finds the best representative marker from a group of markers. This is needed to display...
Definition: mapwidgetview.cpp:547
QAbstractItemModel * model() const override
Definition: mapwidgetview.cpp:408
void onIndicesClicked(const QList< QPersistentModelIndex > &clickedIndices) override
Definition: mapwidgetview.cpp:736
void signalFilteredImages(const QList< qlonglong > &idList)
QPixmap pixmapFromRepresentativeIndex(const QPersistentModelIndex &index, const QSize &size) override
This function retrieves the thumbnail for an index.
Definition: mapwidgetview.cpp:500
~MapViewModelHelper() override
Destructor.
Definition: mapwidgetview.cpp:401
QItemSelectionModel * selectionModel() const override
Definition: mapwidgetview.cpp:429
MapViewModelHelper(QItemSelectionModel *const selection, DCategorizedSortFilterProxyModel *const filterModel, QObject *const parent, const MapWidgetView::Application application)
Definition: mapwidgetview.cpp:356
Class containing digiKam's central map view.
Definition: mapwidgetview.h:51
Application
Definition: mapwidgetview.h:57
Definition: statesavingobject.h:76
Definition: datefolderview.cpp:43