Fix memory leaks
This commit is contained in:
@@ -60,9 +60,6 @@
|
||||
#include <QtEvents>
|
||||
#include <QMessageBox>
|
||||
#include <QtDebug>
|
||||
#ifdef HAVE_TRANSLATIONS
|
||||
# include <QTranslator>
|
||||
#endif
|
||||
|
||||
#ifdef Q_OS_LINUX
|
||||
# include <unistd.h>
|
||||
@@ -101,10 +98,6 @@
|
||||
# include "scoped_cftyperef.h"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_TRANSLATIONS
|
||||
# include "potranslator.h"
|
||||
#endif
|
||||
|
||||
namespace Utilities {
|
||||
|
||||
static QString tr(const char *str) {
|
||||
@@ -821,29 +814,6 @@ QString UnicodeToAscii(const QString &unicode) {
|
||||
|
||||
}
|
||||
|
||||
#ifdef HAVE_TRANSLATIONS
|
||||
|
||||
QString SystemLanguageName() {
|
||||
|
||||
QString system_language = QLocale::system().uiLanguages().empty() ? QLocale::system().name() : QLocale::system().uiLanguages().first();
|
||||
// uiLanguages returns strings with "-" as separators for language/region; however QTranslator needs "_" separators
|
||||
system_language.replace("-", "_");
|
||||
|
||||
return system_language;
|
||||
|
||||
}
|
||||
|
||||
void LoadTranslation(const QString &prefix, const QString &path, const QString &language) {
|
||||
|
||||
QTranslator *t = new PoTranslator;
|
||||
if (t->load(prefix + "_" + language, path))
|
||||
QCoreApplication::installTranslator(t);
|
||||
else
|
||||
delete t;
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
} // namespace Utilities
|
||||
|
||||
ScopedWCharArray::ScopedWCharArray(const QString &str)
|
||||
|
||||
Reference in New Issue
Block a user