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

@@ -90,7 +90,7 @@
#include "core/networkproxyfactory.h"
#include "core/scangiomodulepath.h"
#ifdef HAVE_TRANSLATIONS
# include "core/potranslator.h"
# include "core/translations.h"
#endif
#include "settings/behavioursettingspage.h"
@@ -228,12 +228,18 @@ int main(int argc, char* argv[]) {
s.endGroup();
}
const QString language = override_language.isEmpty() ? Utilities::SystemLanguageName() : override_language;
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("-", "_");
Utilities::LoadTranslation("qt", QLibraryInfo::location(QLibraryInfo::TranslationsPath), language);
Utilities::LoadTranslation("strawberry", ":/translations", language);
Utilities::LoadTranslation("strawberry", a.applicationDirPath(), language);
Utilities::LoadTranslation("strawberry", QDir::currentPath(), language);
const QString language = override_language.isEmpty() ? system_language : override_language;
std::unique_ptr<Translations> translations(new Translations);
translations->LoadTranslation("qt", QLibraryInfo::location(QLibraryInfo::TranslationsPath), language);
translations->LoadTranslation("strawberry", ":/translations", language);
translations->LoadTranslation("strawberry", a.applicationDirPath(), language);
translations->LoadTranslation("strawberry", QDir::currentPath(), language);
#endif
Application app;