Marble

SearchRunnerManager.h
1 // SPDX-License-Identifier: LGPL-2.1-or-later
2 //
3 // SPDX-FileCopyrightText: 2008 Henry de Valence <[email protected]>
4 // SPDX-FileCopyrightText: 2010 Dennis Nienhüser <[email protected]>
5 // SPDX-FileCopyrightText: 2010-2013 Bernhard Beschow <[email protected]>
6 // SPDX-FileCopyrightText: 2011 Thibaut Gridel <[email protected]>
7 
8 #ifndef MARBLE_SEARCHRUNNERMANAGER_H
9 #define MARBLE_SEARCHRUNNERMANAGER_H
10 
11 #include "GeoDataLatLonBox.h"
12 
13 #include "marble_export.h"
14 
15 #include <QObject>
16 #include <QVector>
17 
18 class QAbstractItemModel;
19 class QString;
20 
21 namespace Marble
22 {
23 
24 class GeoDataPlacemark;
25 class MarbleModel;
26 class SearchTask;
27 
28 class MARBLE_EXPORT SearchRunnerManager : public QObject
29 {
30  Q_OBJECT
31 
32 public:
33  /**
34  * Constructor.
35  * @param pluginManager The plugin manager that gives access to RunnerPlugins
36  * @param parent Optional parent object
37  */
38  explicit SearchRunnerManager( const MarbleModel *marbleModel, QObject *parent = nullptr );
39 
40  ~SearchRunnerManager() override;
41 
42  /**
43  * Search for placemarks matching the given search term.
44  * @see findPlacemark is asynchronous with results returned using the
45  * @see searchResultChanged signal.
46  * @see searchPlacemark is blocking.
47  * @see searchFinished signal indicates all runners are finished.
48  */
49  void findPlacemarks( const QString &searchTerm, const GeoDataLatLonBox &preferred = GeoDataLatLonBox() );
50  QVector<GeoDataPlacemark *> searchPlacemarks( const QString &searchTerm, const GeoDataLatLonBox &preferred = GeoDataLatLonBox(), int timeout = 30000 );
51 
52 Q_SIGNALS:
53  /**
54  * Placemarks were added to or removed from the model
55  * @todo FIXME: this sounds like a duplication of QAbstractItemModel signals
56  */
57  void searchResultChanged( QAbstractItemModel *model );
58  void searchResultChanged( const QVector<GeoDataPlacemark *> &result );
59 
60  /**
61  * The search request for the given search term has finished, i.e. all
62  * runners are finished and reported their results via the
63  * @see searchResultChanged signal
64  */
65  void searchFinished( const QString &searchTerm );
66 
67  /**
68  * Emitted whenever all runners are finished for the query
69  */
70  void placemarkSearchFinished();
71 
72 private:
73  Q_PRIVATE_SLOT( d, void addSearchResult( const QVector<GeoDataPlacemark *> &result ) )
74  Q_PRIVATE_SLOT( d, void cleanupSearchTask( SearchTask *task ) )
75 
76  class Private;
77  friend class Private;
78  Private *const d;
79 };
80 
81 }
82 
83 #endif
Binds a QML item to a specific geodetic location in screen coordinates.
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Sep 25 2023 03:50:20 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.