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

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 simple backend to search OSM and Geonames.org.
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_BACKEND_H
0017 #define DIGIKAM_SEARCH_RESULT_BACKEND_H
0018 
0019 // Qt includes
0020 
0021 #include <QObject>
0022 #include <QNetworkReply>
0023 
0024 // Local includes
0025 
0026 #include "geoifacetypes.h"
0027 #include "rgwidget.h"
0028 
0029 using namespace Digikam;
0030 
0031 namespace DigikamGenericGeolocationEditPlugin
0032 {
0033 
0034 class SearchResultBackend : public QObject
0035 {
0036     Q_OBJECT
0037 
0038 public:
0039 
0040     class SearchResult
0041     {
0042     public:
0043 
0044         explicit SearchResult()
0045         {
0046         }
0047 
0048         typedef QList<SearchResult> List;
0049         GeoCoordinates              coordinates;
0050         QString                     name;
0051         GeoCoordinates::Pair        boundingBox;
0052         QString                     internalId;
0053     };
0054 
0055 public:
0056 
0057     explicit SearchResultBackend(QObject* const parent);
0058     ~SearchResultBackend()                                      override;
0059 
0060     bool search(const QString& backendName, const QString& searchTerm);
0061     SearchResult::List getResults()                 const;
0062     QString getErrorMessage()                       const;
0063     QList<QPair<QString, QString> >  getBackends()  const;
0064 
0065 Q_SIGNALS:
0066 
0067     void signalSearchCompleted();
0068 
0069 private Q_SLOTS:
0070 
0071     void slotFinished(QNetworkReply* reply);
0072 
0073 private:
0074 
0075     class Private;
0076     Private* const d;
0077 };
0078 
0079 } // namespace DigikamGenericGeolocationEditPlugin
0080 
0081 #endif // DIGIKAM_SEARCH_RESULT_BACKEND_H