1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00
qTox/src/translator.h

28 lines
660 B
C
Raw Normal View History

2015-06-05 18:26:04 +08:00
#ifndef TRANSLATOR_H
#define TRANSLATOR_H
#include <QVector>
#include <QPair>
#include <QMutex>
#include <functional>
2015-06-05 18:26:04 +08:00
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);
2015-06-05 18:26:04 +08:00
private:
static QTranslator* translator;
static QVector<QPair<void*, std::function<void()>>> callbacks;
static QMutex lock;
2015-06-05 18:26:04 +08:00
};
#endif // TRANSLATOR_H