File indexing completed on 2025-01-05 03:58:34
0001 /* ============================================================ 0002 * 0003 * This file is a part of digiKam project 0004 * https://www.digikam.org 0005 * 0006 * Date : 2010-05-12 0007 * Description : A widget to apply Reverse Geocoding 0008 * 0009 * SPDX-FileCopyrightText: 2010 by Michael G. Hansen <mike at mghansen dot de> 0010 * SPDX-FileCopyrightText: 2010 by Gabriel Voicu <ping dot gabi at gmail dot com> 0011 * 0012 * SPDX-License-Identifier: GPL-2.0-or-later 0013 * 0014 * ============================================================ */ 0015 0016 #ifndef DIGIKAM_RG_WIDGET_H 0017 #define DIGIKAM_RG_WIDGET_H 0018 0019 // Qt includes 0020 0021 #include <QUrl> 0022 #include <QWidget> 0023 0024 // Local includes 0025 0026 #include "geoifacetypes.h" 0027 0028 // Local includes 0029 0030 #include "gpsitemcontainer.h" 0031 #include "digikam_export.h" 0032 0033 class QItemSelectionModel; 0034 class QAbstractItemModel; 0035 class KConfigGroup; 0036 0037 namespace Digikam 0038 { 0039 0040 class GPSItemModel; 0041 class GPSUndoCommand; 0042 0043 class DIGIKAM_EXPORT RGWidget : public QWidget 0044 { 0045 Q_OBJECT 0046 0047 public: 0048 0049 explicit RGWidget(GPSItemModel* const imageModel, 0050 QItemSelectionModel* const selectionModel, 0051 QAbstractItemModel* externTagModel, 0052 QWidget* const parent = nullptr); 0053 ~RGWidget() override; 0054 0055 void setUIEnabled(const bool state); 0056 void readSettingsFromGroup(const KConfigGroup* const group); 0057 void saveSettingsToGroup(KConfigGroup* const group); 0058 0059 private Q_SLOTS: 0060 0061 void slotButtonRGSelected(); 0062 void slotRGReady(QList<RGInfo>& returnedRGList); 0063 void slotHideOptions(); 0064 void updateUIState(); 0065 void slotAddCustomizedSpacer(); 0066 void slotRemoveTag(); 0067 void slotRemoveAllSpacers(); 0068 void slotReaddNewTags(); 0069 void slotRegenerateNewTags(); 0070 void slotAddAllAddressElementsToTag(); 0071 void slotAddSingleSpacer(); 0072 void slotRGCanceled(); 0073 0074 Q_SIGNALS: 0075 0076 /** 0077 * This signal emits when containing widgets need to be enabled or disabled. 0078 * @param enabledState If true, the containing widgets will be enabled. Else, they will be disabled. 0079 */ 0080 void signalSetUIEnabled(const bool enabledState); 0081 void signalSetUIEnabled(const bool enabledState, 0082 QObject* const cancelObject, 0083 const QString& cancelSlot); 0084 0085 /** 0086 * Update the progress bar. 0087 */ 0088 void signalProgressSetup(const int maxProgress, const QString& progressText); 0089 0090 /** 0091 * Counts how many images were processed. 0092 * @param currentProgress The number of processed images. 0093 */ 0094 void signalProgressChanged(const int currentProgress); 0095 0096 /** 0097 * Sends the needed data to Undo/Redo Widget. 0098 * @param undoCommand Holds the data that will be used for undo or redo actions 0099 */ 0100 void signalUndoCommand(GPSUndoCommand* undoCommand); 0101 0102 protected: 0103 0104 bool eventFilter(QObject* watched, QEvent* event) override; 0105 0106 private: 0107 0108 void createCountryCodeMap(); 0109 0110 private: 0111 0112 class Private; 0113 Private* const d; 0114 }; 0115 0116 } // namespace Digikam 0117 0118 #endif // DIGIKAM_RG_WIDGET_H