mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-28 05:00:20 +00:00
2e43769108
Instead use a hash to cache the translations (and allow for the ability to clear the hash so we can even switch translations at runtime...). Now Qt will keep track of the memory and release it for us when we are done with it. This avoids the memory leak introduced in commit 4ecb35bf5ff2 ("Make a copy of the translated text"). Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
18 lines
356 B
C++
18 lines
356 B
C++
#ifndef GETTEXTFROMC_H
|
|
#define GETTEXTFROMC_H
|
|
|
|
#include <QHash>
|
|
|
|
extern "C" const char *gettext(const char *text);
|
|
|
|
class gettextFromC
|
|
{
|
|
Q_DECLARE_TR_FUNCTIONS(gettextFromC)
|
|
public:
|
|
static gettextFromC *instance();
|
|
const char *gettext(const char *text);
|
|
void reset(void);
|
|
QHash <const char *, QByteArray> translationCache;
|
|
};
|
|
|
|
#endif // GETTEXTFROMC_H
|