Sayonara Player
Loading...
Searching...
No Matches
LanguagePreferences.h
1/* LanguagePreferences.h */
2/*
3 * Copyright (C) 2011-2024 Michael Lugmair
4 *
5 * This file is part of sayonara player
6 *
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 */
20#ifndef SAYONARA_PLAYER_LANGUAGEPREFERENCES_H
21#define SAYONARA_PLAYER_LANGUAGEPREFERENCES_H
22
23#include "Utils/Pimpl.h"
24
25#include <QObject>
26#include <QLocale>
27#include <QList>
28#include <utility>
29
30class WebClient;
32
33class LanguagePreferences :
34 public QObject
35{
36 Q_OBJECT
37 PIMPL(LanguagePreferences)
38
39 signals:
40 void sigInfo(const QString& info);
41 void sigWarning(const QString& warning);
42
43 public:
45 {
46 QString languageCode;
47 QString languageName;
48 QString iconPath;
49 };
50
51 LanguagePreferences(WebClientFactory* webClientFactory, QObject* parent);
52 ~LanguagePreferences() override;
53
54 void checkForUpdate(const QString& languageCode);
55 QString importLanguage(const QString& filename);
56
57 static std::pair<QList<LanguageData>, int> getAllLanguages();
58
59 private slots:
60 void downloadFinished(WebClient* webClient, const QString& languageCode);
61 void updateCheckFinished(WebClient* webClient, const QString& languageCode);
62
63 private: // NOLINT(readability-redundant-access-specifiers)
64 void downloadUpdate(const QString& languageCode);
65};
66
67#endif //SAYONARA_PLAYER_LANGUAGEPREFERENCES_H
Definition WebClientFactory.h:29
Definition WebClient.h:30
Definition LanguagePreferences.h:45