File indexing completed on 2025-01-19 03:58:03

0001 /* ============================================================
0002  *
0003  * This file is a part of digiKam project
0004  * https://www.digikam.org
0005  *
0006  * Date        : 2009-11-21
0007  * Description : Central object for managing bookmarks
0008  *
0009  * SPDX-FileCopyrightText: 2010-2024 by Gilles Caulier <caulier dot gilles at gmail dot com>
0010  * SPDX-FileCopyrightText: 2009-2010 by Michael G. Hansen <mike at mghansen dot de>
0011  *
0012  * SPDX-License-Identifier: GPL-2.0-or-later
0013  *
0014  * ============================================================ */
0015 
0016 #ifndef DIGIKAM_GPS_BOOKMARK_MODEL_HELPER_H
0017 #define DIGIKAM_GPS_BOOKMARK_MODEL_HELPER_H
0018 
0019 // Qt includes
0020 
0021 #include <QObject>
0022 
0023 // Local includes
0024 
0025 #include "geomodelhelper.h"
0026 #include "gpsdatacontainer.h"
0027 #include "bookmarksmngr.h"
0028 #include "digikam_export.h"
0029 
0030 namespace Digikam
0031 {
0032 
0033 class GPSItemModel;
0034 class GPSUndoCommand;
0035 
0036 class DIGIKAM_EXPORT GPSBookmarkModelHelper : public GeoModelHelper
0037 {
0038     Q_OBJECT
0039 
0040 public:
0041 
0042     enum Constants
0043     {
0044         CoordinatesRole = Qt::UserRole + 1
0045     };
0046 
0047 public:
0048 
0049     GPSBookmarkModelHelper(BookmarksManager* const bookmarkManager,
0050                            GPSItemModel* const imageModel,
0051                            QObject* const parent = nullptr);
0052     ~GPSBookmarkModelHelper()                                     override;
0053 
0054     void setVisible(const bool state);
0055 
0056     QAbstractItemModel* model()                             const override;
0057     QItemSelectionModel* selectionModel()                   const override;
0058     bool itemCoordinates(const QModelIndex& index,
0059                          GeoCoordinates* const coordinates) const override;
0060     bool itemIcon(const QModelIndex& index, QPoint* const offset,
0061                   QSize* const size, QPixmap* const pixmap,
0062                   QUrl* const url)                          const override;
0063     PropertyFlags modelFlags() const override;
0064     PropertyFlags itemFlags(const QModelIndex& index)       const override;
0065     void snapItemsTo(const QModelIndex& targetIndex,
0066                      const QList<QModelIndex>& snappedIndices)    override;
0067 
0068 private Q_SLOTS:
0069 
0070     void slotUpdateBookmarksModel();
0071 
0072 Q_SIGNALS:
0073 
0074     void signalUndoCommand(GPSUndoCommand* undoCommand);
0075 
0076 private:
0077 
0078     class Private;
0079     Private* const d;
0080 };
0081 
0082 } // namespace Digikam
0083 
0084 #endif // DIGIKAM_GPS_BOOKMARK_MODEL_HELPER_H