File indexing completed on 2025-01-05 03:58:37
0001 /* ============================================================ 0002 * 0003 * This file is a part of digiKam project 0004 * https://www.digikam.org 0005 * 0006 * Date : 2011-01-06 0007 * Description : Helper class for geomap interaction 0008 * 0009 * SPDX-FileCopyrightText: 2011 by Michael G. Hansen <mike at mghansen dot de> 0010 * SPDX-FileCopyrightText: 2011-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_GPS_ITEM_INFO_SORTER_H 0017 #define DIGIKAM_GPS_ITEM_INFO_SORTER_H 0018 0019 // Qt includes 0020 0021 #include <QDateTime> 0022 #include <QObject> 0023 #include <QSize> 0024 #include <QUrl> 0025 0026 // Local includes 0027 0028 #include "digikam_export.h" 0029 #include "geocoordinates.h" 0030 #include "geogroupstate.h" 0031 #include "gpsiteminfo.h" 0032 #include "mapwidget.h" 0033 0034 namespace Digikam 0035 { 0036 0037 class DIGIKAM_EXPORT GPSItemInfoSorter : public QObject 0038 { 0039 Q_OBJECT 0040 0041 public: 0042 0043 enum SortOption 0044 { 0045 SortYoungestFirst = 0, 0046 SortOldestFirst = 1, 0047 SortRating = 2 0048 }; 0049 Q_DECLARE_FLAGS(SortOptions, SortOption) 0050 0051 public: 0052 0053 explicit GPSItemInfoSorter(QObject* const parent); 0054 ~GPSItemInfoSorter() override; 0055 0056 void addToMapWidget(MapWidget* const mapWidget); 0057 0058 void setSortOptions(const SortOptions sortOptions); 0059 SortOptions getSortOptions() const; 0060 0061 public: 0062 0063 static bool fitsBetter(const GPSItemInfo& oldInfo, 0064 const GeoGroupState oldState, 0065 const GPSItemInfo& newInfo, 0066 const GeoGroupState newState, 0067 const GeoGroupState globalGroupState, 0068 const SortOptions sortOptions); 0069 0070 private Q_SLOTS: 0071 0072 void slotSortOptionTriggered(); 0073 0074 private: 0075 0076 void initializeSortMenu(); 0077 0078 private: 0079 0080 // Disable 0081 GPSItemInfoSorter() = delete; 0082 0083 private: 0084 0085 class Private; 0086 Private* const d; 0087 }; 0088 0089 } // namespace Digikam 0090 0091 Q_DECLARE_OPERATORS_FOR_FLAGS(Digikam::GPSItemInfoSorter::SortOptions) 0092 0093 #endif // DIGIKAM_GPS_ITEM_INFO_SORTER_H