File indexing completed on 2025-01-19 03:53:04

0001 /* ============================================================
0002  *
0003  * This file is a part of digiKam project
0004  * https://www.digikam.org
0005  *
0006  * Date        : 2021-03-20
0007  * Description : a tool to export images to iNaturalist web service
0008  *
0009  * SPDX-FileCopyrightText: 2021      by Joerg Lohse <joergmlpts at gmail dot com>
0010  *
0011  * SPDX-License-Identifier: GPL-2.0-or-later
0012  *
0013  * ============================================================ */
0014 
0015 #ifndef DIGIKAM_INAT_UTILS_H
0016 #define DIGIKAM_INAT_UTILS_H
0017 
0018 // Qt includes
0019 
0020 #include <QString>
0021 #include <QLocale>
0022 #include <QPair>
0023 #include <QHttpMultiPart>
0024 
0025 namespace DigikamGenericINatPlugin
0026 {
0027 
0028 extern const QLocale locale;
0029 extern const bool    isEnglish;
0030 
0031 /**
0032  * conversion factors for the US, one meter in feet and miles
0033  */
0034 extern const double  meterInFeet;
0035 extern const double  meterInMiles;
0036 
0037 /**
0038  * multi-part message, used to upload pictures
0039  */
0040 typedef QPair<QString, QString> Parameter;
0041 extern QHttpMultiPart* getMultiPart(const QList<Parameter>& parameters,
0042                                     const QString& imageName,
0043                                     const QString& imageNameArg,
0044                                     const QString& imagePath);
0045 
0046 /**
0047  * distance in meters between two geolocations
0048  */
0049 extern double  distanceBetween(double latitude1, double longitude1,
0050                                double latitude2, double longitude2);
0051 
0052 /**
0053  * geolocation in local language
0054  */
0055 extern QString localizedLocation(double latitude, double longitude,
0056                                  int precision);
0057 
0058 /**
0059  * taxonomic rank (e.g. kingdom, order, genus, species) in local language
0060  */
0061 extern QString localizedTaxonomicRank(const QString& rank);
0062 
0063 /**
0064  * distance in local language; for US returns feet or miles instead of meters
0065  */
0066 extern QString localizedDistance(double distMeters, char format, int precision);
0067 
0068 /**
0069  * time difference (e.g. "5 hours, 7 minutes") in local language
0070  */
0071 extern QString localizedTimeDifference(quint64 diffSeconds);
0072 
0073 } // namespace DigikamGenericINatPlugin
0074 
0075 #endif // DIGIKAM_INAT_UTILS_H