1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00
qTox/src/translator.h
tux3 15ca7a587f
Dynamic translation
qTox can now retranslate its GUI dynamically, without needing a restart

Fixes #1671

Closes #1672
2015-06-05 21:37:01 +02:00

28 lines
660 B
C++

#ifndef TRANSLATOR_H
#define TRANSLATOR_H
#include <QVector>
#include <QPair>
#include <QMutex>
#include <functional>
class QTranslator;
class Translator
{
public:
/// Loads the translations according to the settings or locale
static void translate();
/// Register a function to be called when the UI needs to be retranslated
static void registerHandler(std::function<void()>, void* owner);
/// Unregisters all handlers of an owner
static void unregister(void* owner);
private:
static QTranslator* translator;
static QVector<QPair<void*, std::function<void()>>> callbacks;
static QMutex lock;
};
#endif // TRANSLATOR_H