File indexing completed on 2025-01-05 03:58:32

0001 /* ============================================================
0002  *
0003  * This file is a part of digiKam project
0004  * https://www.digikam.org
0005  *
0006  * Date        : 2009-05-07
0007  * Description : Context menu for GPS list view.
0008  *
0009  * SPDX-FileCopyrightText: 2010-2024 by Gilles Caulier <caulier dot gilles at gmail dot com>
0010  * SPDX-FileCopyrightText: 2009-2014 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_ITEM_LIST_CONTEXT_MENU_H
0017 #define DIGIKAM_GPS_ITEM_LIST_CONTEXT_MENU_H
0018 
0019 // Qt includes:
0020 
0021 #include <QObject>
0022 
0023 // Local includes
0024 
0025 #include "digikam_config.h"
0026 #include "lookupaltitude.h"
0027 #include "gpsdatacontainer.h"
0028 #include "gpsitemlist.h"
0029 #include "digikam_export.h"
0030 
0031 class QUrl;
0032 
0033 namespace Digikam
0034 {
0035 
0036 class GPSUndoCommand;
0037 class GPSBookmarkOwner;
0038 
0039 class DIGIKAM_EXPORT GPSItemListContextMenu : public QObject
0040 {
0041     Q_OBJECT
0042 
0043 public:
0044 
0045     explicit GPSItemListContextMenu(GPSItemList* const imagesList,
0046                                     GPSBookmarkOwner* const bookmarkOwner = nullptr);
0047     ~GPSItemListContextMenu()                           override;
0048 
0049     void setEnabled(const bool state);
0050 
0051 protected:
0052 
0053     void setGPSDataForSelectedItems(const GPSDataContainer& gpsData, const QString& undoDescription);
0054     bool getCurrentItemPositionAndUrl(GPSDataContainer* const gpsInfo, QUrl* const itemUrl);
0055     void removeInformationFromSelectedImages(const GPSDataContainer::HasFlags flagsToClear, const QString& undoDescription);
0056 
0057     bool eventFilter(QObject* watched, QEvent* event)   override;
0058 
0059     static bool getCurrentPosition(GPSDataContainer* position, void* mydata);
0060 
0061 private Q_SLOTS:
0062 
0063     void copyActionTriggered();
0064     void pasteSwapActionTriggered();
0065     void pasteActionTriggered(bool swap = false);
0066     void slotBookmarkSelected(const GPSDataContainer& position);
0067     void slotRemoveCoordinates();
0068     void slotRemoveAltitude();
0069     void slotRemoveUncertainty();
0070     void slotRemoveSpeed();
0071     void slotLookupMissingAltitudes();
0072     void slotAltitudeLookupReady(const QList<int>& readyRequests);
0073     void slotAltitudeLookupDone();
0074     void slotAltitudeLookupCancel();
0075 
0076 Q_SIGNALS:
0077 
0078     void signalSetUIEnabled(const bool enabledState);
0079     void signalSetUIEnabled(const bool enabledState, QObject* const cancelObject, const QString& cancelSlot);
0080     void signalProgressSetup(const int maxProgress, const QString& progressText);
0081     void signalProgressChanged(const int currentProgress);
0082     void signalUndoCommand(GPSUndoCommand* undoCommand);
0083 
0084 private:
0085 
0086     class Private;
0087     Private* const d;
0088 };
0089 
0090 } // namespace Digikam
0091 
0092 #endif // DIGIKAM_GPS_ITEM_LIST_CONTEXT_MENU_H