Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mumble-voip/mumble.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/mumble/Translations.h')
-rw-r--r--src/mumble/Translations.h24
1 files changed, 23 insertions, 1 deletions
diff --git a/src/mumble/Translations.h b/src/mumble/Translations.h
index 4e472e635..2a0b8f3d7 100644
--- a/src/mumble/Translations.h
+++ b/src/mumble/Translations.h
@@ -10,15 +10,37 @@
class QApplication;
class QLocale;
+class QTranslator;
namespace Mumble {
namespace Translations {
+ /**
+ * A lifetime guard for translators. Basically a smart-pointer for an ensemble of translators
+ */
+ struct LifetimeGuard {
+ QTranslator *m_bundledTranslator = nullptr;
+ QTranslator *m_overwriteTranslator = nullptr;
+ QTranslator *m_qtTranslator = nullptr;
+
+ LifetimeGuard() = default;
+ LifetimeGuard(LifetimeGuard &&old);
+ LifetimeGuard(const LifetimeGuard &) = delete;
+ ~LifetimeGuard();
+ };
+
QStringList getDefaultTranslationDirectories();
QStringList getTranslationDirectories(const QApplication &app, const QStringList &extraDirectories);
- void installTranslators(const QLocale &locale, QApplication &app, const QStringList &extraDirectories);
+ /**
+ * Installs translators for the given locale to the given application. If extraDirectories are provided,
+ * they will be used for the overwrite translator.
+ *
+ * @returns The lifetime guard of the created translators. This object must not be destroyed before
+ * the given application has terminated.
+ */
+ LifetimeGuard installTranslators(const QLocale &locale, QApplication &app, const QStringList &extraDirectories);
}; // namespace Translations
}; // namespace Mumble