File indexing completed on 2024-04-28 04:42:42
0001 /* 0002 * SPDX-FileCopyrightText: 2020-2021 Han Young <hanyoung@protonmail.com> 0003 * SPDX-FileCopyrightText: 2020-2021 Devin Lin <espidev@gmail.com> 0004 * 0005 * SPDX-License-Identifier: LGPL-2.0-or-later 0006 */ 0007 0008 #pragma once 0009 0010 #include <KLocalizedString> 0011 0012 #include <QDir> 0013 #include <QString> 0014 0015 #include "capalertinfo.h" 0016 #include "caparea.h" 0017 0018 namespace KWeatherCore 0019 { 0020 0021 // weather description 0022 struct ResolvedWeatherDesc { 0023 QString icon = QStringLiteral("weather-none-available"), desc = i18n("Unknown"); 0024 ResolvedWeatherDesc() = default; 0025 ResolvedWeatherDesc(QString icon, QString desc) 0026 { 0027 this->icon = icon; 0028 this->desc = desc; 0029 } 0030 }; 0031 0032 class KWeatherCorePrivate 0033 { 0034 public: 0035 static CAPPolygon stringToPolygon(const QString &str); 0036 static QString toFixedString(double num); 0037 static QDir getCacheDirectory(double latitude, double longitude); 0038 0039 static CAPAlertInfo::Urgency urgencyStringToEnum(const QString &str); 0040 static CAPAlertInfo::Severity severityStringToEnum(const QString &str); 0041 static CAPAlertInfo::Certainty certaintyStringToEnum(const QString &str); 0042 static QString urgencyToString(CAPAlertInfo::Urgency urgency); 0043 static QString severityToString(CAPAlertInfo::Severity severity); 0044 static QString certaintyToString(CAPAlertInfo::Certainty certainty); 0045 0046 static int weatherIconPriorityRank(const QString &icon); 0047 static ResolvedWeatherDesc resolveAPIWeatherDesc(const QString &desc); 0048 }; 0049 }