MCPcopy Create free account
hub / github.com/Project-LemonLime/Project_LemonLime / Initialize

Method Initialize

src/base/LemonBaseApplication.cpp:22–53  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

20using namespace Lemon;
21
22auto LemonBaseApplication::Initialize() -> bool {
23 QString errorMessage;
24 bool canContinue;
25 const auto hasError = parseCommandLine(&canContinue, &errorMessage);
26 if (hasError) {
27 LOG("Command line: " GEN_PAIR(errorMessage));
28 if (! canContinue) {
29 LOG("Fatal Error, LemonLime cannot continue.");
30 return false;
31 } else {
32 LOG("Non-fatal error, LemonLime will continue starting up.");
33 }
34 }
35
36 // Load Translations
37 Settings *settings = new Settings;
38 settings->loadSettings();
39 LemonLimeTranslator = std::make_unique<LemonTranslator>();
40 const auto allTranslations = LemonLimeTranslator->GetAvailableLanguages();
41 const auto osLanguage = QLocale::system().name();
42 if (! allTranslations.contains(settings->getUiLanguage())) {
43 // If we need to reset the language.
44 if (allTranslations.contains(osLanguage)) {
45 settings->setUiLanguage(osLanguage);
46 } else if (! allTranslations.isEmpty()) {
47 settings->setUiLanguage(allTranslations.first());
48 }
49 }
50 LemonLimeTranslator->InstallTranslation(settings->getUiLanguage());
51
52 return true;
53}
54
55auto LemonBaseApplication::parseCommandLine(bool *canContinue, QString *errorMessage) -> bool {
56 *canContinue = true;

Callers 1

mainFunction · 0.80

Calls 5

loadSettingsMethod · 0.80
GetAvailableLanguagesMethod · 0.80
getUiLanguageMethod · 0.80
setUiLanguageMethod · 0.80
InstallTranslationMethod · 0.80

Tested by

no test coverage detected