File indexing completed on 2024-04-21 03:49:55

0001 // SPDX-License-Identifier: LGPL-2.1-or-later
0002 //
0003 // SPDX-FileCopyrightText: 2010 Dennis Nienhüser <nienhueser@kde.org>
0004 // SPDX-FileCopyrightText: 2011 Thibaut Gridel <tgridel@free.fr>
0005 // SPDX-FileCopyrightText: 2012, 2013 Bernhard Beschow <bbeschow@cs.tu-berlin.de>
0006 
0007 #ifndef MARBLE_SEARCHRUNNER_H
0008 #define MARBLE_SEARCHRUNNER_H
0009 
0010 #include "marble_export.h"
0011 
0012 #include <QObject>
0013 #include <QVector>
0014 
0015 namespace Marble
0016 {
0017 
0018 class GeoDataLatLonBox;
0019 class GeoDataPlacemark;
0020 class MarbleModel;
0021 
0022 class MARBLE_EXPORT SearchRunner : public QObject
0023 {
0024     Q_OBJECT
0025 
0026 public:
0027     explicit SearchRunner( QObject *parent = nullptr );
0028 
0029     /**
0030      * Stores a pointer to the currently used model
0031      */
0032     void setModel( const MarbleModel *model );
0033 
0034     /**
0035      * Start a placemark search. Called by MarbleRunnerManager, runners
0036      * are expected to return the result via the searchFinished signal.
0037      * If implemented in a plugin, make sure to include Search in the
0038      * plugin capabilities, otherwise MarbleRunnerManager will ignore the plugin
0039      */
0040     virtual void search( const QString &searchTerm, const GeoDataLatLonBox &preferred ) = 0;
0041 
0042 Q_SIGNALS:
0043     /**
0044      * This is emitted to indicate that the runner has finished the placemark search.
0045      * @param result the result of the search.
0046      */
0047     void searchFinished( const QVector<GeoDataPlacemark*>& result );
0048 
0049 protected:
0050     /**
0051      * Access to the currently used model, or null if no was set with @see setModel
0052      */
0053     const MarbleModel *model() const;
0054 
0055 private:
0056     const MarbleModel *m_model;
0057 };
0058 
0059 }
0060 
0061 #endif