annotate include/gui/locale.h @ 261:3ec7804abf17

include: make header guards more sane The C++ standard[1] says: Each identifier that contains a double underscore __ or begins with an underscore followed by an uppercase letter is reserved to the implementation for any use. [1]: https://timsong-cpp.github.io/cppwp/n4659/lex.name#3.1
author Paper <paper@paper.us.eu.org>
date Wed, 03 Apr 2024 20:04:28 -0400
parents 862d0d8619f6
children b1f625b0227c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
261
3ec7804abf17 include: make header guards more sane
Paper <paper@paper.us.eu.org>
parents: 258
diff changeset
1 #ifndef MINORI_GUI_LOCALE_H_
3ec7804abf17 include: make header guards more sane
Paper <paper@paper.us.eu.org>
parents: 258
diff changeset
2 #define MINORI_GUI_LOCALE_H_
109
79714c95a145 *: add translation files and locale files
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
3
79714c95a145 *: add translation files and locale files
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
4 #include <QLocale>
79714c95a145 *: add translation files and locale files
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
5 #include <QTranslator>
258
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 118
diff changeset
6 #include <memory>
109
79714c95a145 *: add translation files and locale files
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
7 #include <string>
258
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 118
diff changeset
8 #include <vector>
109
79714c95a145 *: add translation files and locale files
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
9
79714c95a145 *: add translation files and locale files
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
10 namespace Locale {
79714c95a145 *: add translation files and locale files
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
11
79714c95a145 *: add translation files and locale files
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
12 std::string GetLocaleFullName(const QLocale& locale);
79714c95a145 *: add translation files and locale files
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
13
79714c95a145 *: add translation files and locale files
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
14 class Locale {
79714c95a145 *: add translation files and locale files
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
15 public:
79714c95a145 *: add translation files and locale files
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
16 Locale();
79714c95a145 *: add translation files and locale files
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
17 Locale(const std::string& name);
118
39521c47c7a3 *: another huge megacommit, SORRY
Paper <mrpapersonic@gmail.com>
parents: 109
diff changeset
18 QLocale GetLocale() const;
39521c47c7a3 *: another huge megacommit, SORRY
Paper <mrpapersonic@gmail.com>
parents: 109
diff changeset
19 std::vector<QLocale> GetAvailableLocales() const;
109
79714c95a145 *: add translation files and locale files
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
20 void RefreshAvailableLocales(); // why would this ever be called?
118
39521c47c7a3 *: another huge megacommit, SORRY
Paper <mrpapersonic@gmail.com>
parents: 109
diff changeset
21 bool IsLocaleAvailable(const QLocale& locale) const;
109
79714c95a145 *: add translation files and locale files
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
22 bool SetActiveLocale(const QLocale& locale);
79714c95a145 *: add translation files and locale files
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
23
79714c95a145 *: add translation files and locale files
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
24 private:
79714c95a145 *: add translation files and locale files
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
25 bool SwitchTranslator(QTranslator& translator, const QString& name);
79714c95a145 *: add translation files and locale files
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
26
79714c95a145 *: add translation files and locale files
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
27 QTranslator _translator;
79714c95a145 *: add translation files and locale files
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
28 QTranslator _translator_qt;
79714c95a145 *: add translation files and locale files
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
29 QLocale _locale;
79714c95a145 *: add translation files and locale files
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
30 std::vector<QLocale> _available_translations = {};
79714c95a145 *: add translation files and locale files
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
31 };
79714c95a145 *: add translation files and locale files
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
32
258
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 118
diff changeset
33 } // namespace Locale
109
79714c95a145 *: add translation files and locale files
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
34
261
3ec7804abf17 include: make header guards more sane
Paper <paper@paper.us.eu.org>
parents: 258
diff changeset
35 #endif // MINORI_GUI_LOCALE_H_