File indexing completed on 2025-01-19 03:58:07

0001 /* ============================================================
0002  *
0003  * This file is a part of digiKam project
0004  * https://www.digikam.org
0005  *
0006  * Date        : 2011-04-30
0007  * Description : Base class for altitude lookup jobs
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_LOOKUP_ALTITUDE_H
0017 #define DIGIKAM_LOOKUP_ALTITUDE_H
0018 
0019 // Qt includes
0020 
0021 #include <QObject>
0022 #include <QVariant>
0023 
0024 // local includes
0025 
0026 #include "digikam_export.h"
0027 #include "geocoordinates.h"
0028 
0029 namespace Digikam
0030 {
0031 
0032 class DIGIKAM_EXPORT LookupAltitude : public QObject
0033 {
0034     Q_OBJECT
0035 
0036 public:
0037 
0038     enum StatusEnum
0039     {
0040         StatusInProgress = 0,
0041         StatusSuccess    = 1,
0042         StatusCanceled   = 2,
0043         StatusError      = 3
0044     };
0045     Q_DECLARE_FLAGS(StatusAltitude, StatusEnum)
0046 
0047 public:
0048 
0049     class  Request
0050     {
0051     public:
0052 
0053         explicit Request()
0054           : coordinates(),
0055             success    (false),
0056             data       ()
0057         {
0058         }
0059 
0060     public:
0061 
0062         GeoCoordinates         coordinates;
0063         bool                   success;
0064         QVariant               data;
0065 
0066         typedef QList<Request> List;
0067     };
0068 
0069 public:
0070 
0071     explicit LookupAltitude(QObject* const parent);
0072     ~LookupAltitude() override;
0073 
0074     virtual QString backendName()                           const = 0;
0075     virtual QString backendHumanName()                      const = 0;
0076 
0077     virtual void addRequests(const Request::List& requests)       = 0;
0078     virtual Request::List getRequests()                     const = 0;
0079     virtual Request getRequest(const int index)             const = 0;
0080 
0081     virtual void startLookup()                                    = 0;
0082     virtual StatusAltitude getStatus()                      const = 0;
0083     virtual QString errorMessage()                          const = 0;
0084     virtual void cancel()                                         = 0;
0085 
0086 Q_SIGNALS:
0087 
0088     void signalRequestsReady(const QList<int>& readyRequests);
0089     void signalDone();
0090 };
0091 
0092 } // namespace Digikam
0093 
0094 Q_DECLARE_OPERATORS_FOR_FLAGS(Digikam::LookupAltitude::StatusAltitude)
0095 
0096 #endif // DIGIKAM_LOOKUP_ALTITUDE_H