Fix memory leaks

This commit is contained in:
Jonas Kvinge
2019-07-22 20:53:05 +02:00
parent 2df21081a1
commit bd78e8c275
33 changed files with 186 additions and 74 deletions

View File

@@ -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)