File indexing completed on 2025-01-19 03:51:20

0001 /* ============================================================
0002  *
0003  * This file is a part of digiKam project
0004  * https://www.digikam.org
0005  *
0006  * Date        : 2010-06-01
0007  * Description : A widget to search for places.
0008  *
0009  * SPDX-FileCopyrightText: 2010-2024 by Gilles Caulier <caulier dot gilles at gmail dot com>
0010  * SPDX-FileCopyrightText: 2010-2011 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_SEARCH_RESULT_WIDGET_H
0017 #define DIGIKAM_SEARCH_RESULT_WIDGET_H
0018 
0019 // Qt includes
0020 
0021 #include <QAbstractItemModel>
0022 #include <QWidget>
0023 
0024 // Local includes
0025 
0026 #include "digikam_config.h"
0027 #include "geomodelhelper.h"
0028 #include "mapwidget.h"
0029 #include "searchresultbackend.h"
0030 #include "gpsundocommand.h"
0031 #include "gpsbookmarkowner.h"
0032 
0033 class QEvent;
0034 
0035 class KConfigGroup;
0036 
0037 using namespace Digikam;
0038 
0039 namespace DigikamGenericGeolocationEditPlugin
0040 {
0041 
0042 class SearchResultWidget : public QWidget
0043 {
0044     Q_OBJECT
0045 
0046 public:
0047 
0048     explicit SearchResultWidget(GPSBookmarkOwner* const gpsBookmarkOwner,
0049                           GPSItemModel* const gpsItemModel,
0050                           QItemSelectionModel* const gpsImageSelectionModel,
0051                           QWidget* const parent);
0052     ~SearchResultWidget()                                                               override;
0053 
0054     GeoModelHelper* getModelHelper()                                        const;
0055 
0056     void saveSettingsToGroup(KConfigGroup* const group);
0057     void readSettingsFromGroup(const KConfigGroup* const group);
0058     void setPrimaryMapWidget(MapWidget* const mapWidget);
0059 
0060 private Q_SLOTS:
0061 
0062     void slotSearchCompleted();
0063     void slotTriggerSearch();
0064     void slotCurrentlySelectedResultChanged(const QModelIndex& current,
0065                                             const QModelIndex& previous);
0066     void slotClearSearchResults();
0067     void slotVisibilityChanged(bool state);
0068     void slotCopyCoordinates();
0069     void slotMoveSelectedImagesToThisResult();
0070     void slotUpdateActionAvailability();
0071     void slotRemoveSelectedFromResultsList();
0072 
0073 protected:
0074 
0075     bool eventFilter(QObject* watched, QEvent* event)                             override;
0076 
0077 Q_SIGNALS:
0078 
0079     void signalUndoCommand(GPSUndoCommand* undoCommand);
0080 
0081 private:
0082 
0083     class Private;
0084     Private* const d;
0085 };
0086 
0087 } // namespace DigikamGenericGeolocationEditPlugin
0088 
0089 #endif // DIGIKAM_SEARCH_RESULT_WIDGET_H