File indexing completed on 2024-12-01 13:08:57
0001 /* 0002 SPDX-FileCopyrightText: 2020-2024 Laurent Montel <montel@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #pragma once 0008 0009 #include "downloadappslanguagesinfo.h" 0010 #include "libruqolacore_export.h" 0011 #include <QMap> 0012 #include <QObject> 0013 0014 class LIBRUQOLACORE_EXPORT DownloadAppsLanguagesManager : public QObject 0015 { 0016 Q_OBJECT 0017 public: 0018 explicit DownloadAppsLanguagesManager(QObject *parent = nullptr); 0019 ~DownloadAppsLanguagesManager() override; 0020 0021 [[nodiscard]] QString translatedString(const QString &language, const QString &id); 0022 void parse(const QString &serverUrl); 0023 0024 [[nodiscard]] bool fileParsed() const; 0025 0026 [[nodiscard]] QString accountName() const; 0027 void setAccountName(const QString &accountName); 0028 0029 [[nodiscard]] QString serverVersion() const; 0030 void setServerVersion(const QString &serverVersion); 0031 0032 Q_SIGNALS: 0033 void fileLanguagesParseSuccess(); 0034 void fileLanguagesParseFailed(); 0035 0036 private: 0037 [[nodiscard]] LIBRUQOLACORE_NO_EXPORT QString storedFileName() const; 0038 LIBRUQOLACORE_NO_EXPORT void slotFileDownloaded(const QByteArray &data); 0039 LIBRUQOLACORE_NO_EXPORT void parseLanguageFile(); 0040 QString mAccountName; 0041 QString mServerVersion; 0042 //<id, DownloadAppsLanguagesInfo> 0043 QMap<QString, DownloadAppsLanguagesInfo> mLanguageMap; 0044 bool mFileParsed = false; 0045 };