qTox  Version: nightly | Commit: bc751c8e1cac455f9690654fcfe0f560d2d7dfdd
Static Public Member Functions | Private Types | Static Private Attributes | List of all members
Translator Class Reference

#include <translator.h>

Collaboration diagram for Translator:
Collaboration graph

Static Public Member Functions

static void translate (const QString &localeName)
 Loads the translations according to the settings or locale. More...
 
static void registerHandler (const std::function< void()> &, void *owner)
 Register a function to be called when the UI needs to be retranslated. More...
 
static void unregister (void *owner)
 Unregisters all handlers of an owner. More...
 

Private Types

using Callback = QPair< void *, std::function< void()> >
 

Static Private Attributes

static QVector< Callbackcallbacks
 
static QMutex lock
 
static QTranslator * core_translator {nullptr}
 
static QTranslator * app_translator {nullptr}
 

Detailed Description

Definition at line 30 of file translator.h.

Member Typedef Documentation

◆ Callback

using Translator::Callback = QPair<void*, std::function<void()> >
private

Definition at line 38 of file translator.h.

Member Function Documentation

◆ registerHandler()

void Translator::registerHandler ( const std::function< void()> &  f,
void *  owner 
)
static

Register a function to be called when the UI needs to be retranslated.

Parameters
fFunction, wich will called.
ownerWidget to retanslate.

Definition at line 93 of file translator.cpp.

Here is the caller graph for this function:

◆ translate()

void Translator::translate ( const QString &  localeName)
static

Loads the translations according to the settings or locale.

Definition at line 39 of file translator.cpp.

Here is the caller graph for this function:

◆ unregister()

void Translator::unregister ( void *  owner)
static

Unregisters all handlers of an owner.

Parameters
ownerOwner to unregister.

Definition at line 103 of file translator.cpp.

Here is the caller graph for this function:

Member Data Documentation

◆ app_translator

QTranslator * Translator::app_translator {nullptr}
staticprivate

Definition at line 42 of file translator.h.

◆ callbacks

QVector< Translator::Callback > Translator::callbacks
staticprivate

Definition at line 39 of file translator.h.

◆ core_translator

QTranslator * Translator::core_translator {nullptr}
staticprivate

Definition at line 41 of file translator.h.

◆ lock

QMutex Translator::lock
staticprivate

Definition at line 40 of file translator.h.


The documentation for this class was generated from the following files: