File indexing completed on 2025-01-05 03:59:34
0001 // SPDX-License-Identifier: LGPL-2.1-or-later 0002 // 0003 // SPDX-FileCopyrightText: 2008 Henry de Valence <hdevalence@gmail.com> 0004 // SPDX-FileCopyrightText: 2010 Dennis Nienhüser <nienhueser@kde.org> 0005 // SPDX-FileCopyrightText: 2010-2013 Bernhard Beschow <bbeschow@cs.tu-berlin.de> 0006 // SPDX-FileCopyrightText: 2011 Thibaut Gridel <tgridel@free.fr> 0007 0008 #ifndef MARBLE_SEARCHRUNNERMANAGER_H 0009 #define MARBLE_SEARCHRUNNERMANAGER_H 0010 0011 #include "GeoDataLatLonBox.h" 0012 0013 #include "digikam_export.h" 0014 0015 #include <QObject> 0016 #include <QVector> 0017 0018 class QAbstractItemModel; 0019 class QString; 0020 0021 namespace Marble 0022 { 0023 0024 class GeoDataPlacemark; 0025 class MarbleModel; 0026 class SearchTask; 0027 0028 class DIGIKAM_EXPORT SearchRunnerManager : public QObject 0029 { 0030 Q_OBJECT 0031 0032 public: 0033 /** 0034 * Constructor. 0035 * @param pluginManager The plugin manager that gives access to RunnerPlugins 0036 * @param parent Optional parent object 0037 */ 0038 explicit SearchRunnerManager( const MarbleModel *marbleModel, QObject *parent = nullptr ); 0039 0040 ~SearchRunnerManager() override; 0041 0042 /** 0043 * Search for placemarks matching the given search term. 0044 * @see findPlacemark is asynchronous with results returned using the 0045 * @see searchResultChanged signal. 0046 * @see searchPlacemark is blocking. 0047 * @see searchFinished signal indicates all runners are finished. 0048 */ 0049 void findPlacemarks( const QString &searchTerm, const GeoDataLatLonBox &preferred = GeoDataLatLonBox() ); 0050 QVector<GeoDataPlacemark *> searchPlacemarks( const QString &searchTerm, const GeoDataLatLonBox &preferred = GeoDataLatLonBox(), int timeout = 30000 ); 0051 0052 Q_SIGNALS: 0053 /** 0054 * Placemarks were added to or removed from the model 0055 * @todo FIXME: this sounds like a duplication of QAbstractItemModel signals 0056 */ 0057 void searchResultChanged( QAbstractItemModel *model ); 0058 void searchResultChanged( const QVector<GeoDataPlacemark *> &result ); 0059 0060 /** 0061 * The search request for the given search term has finished, i.e. all 0062 * runners are finished and reported their results via the 0063 * @see searchResultChanged signal 0064 */ 0065 void searchFinished( const QString &searchTerm ); 0066 0067 /** 0068 * Emitted whenever all runners are finished for the query 0069 */ 0070 void placemarkSearchFinished(); 0071 0072 private: 0073 Q_PRIVATE_SLOT( d, void addSearchResult( const QVector<GeoDataPlacemark *> &result ) ) 0074 Q_PRIVATE_SLOT( d, void cleanupSearchTask( SearchTask *task ) ) 0075 0076 class Private; 0077 friend class Private; 0078 Private *const d; 0079 }; 0080 0081 } 0082 0083 #endif