summary refs log tree commit diff
path: root/src/main.cpp
diff options
context:
space:
mode:
authorDeepBlueV7.X <nicolas.werner@hotmail.de>2020-10-28 14:50:00 +0100
committerGitHub <noreply@github.com>2020-10-28 14:50:00 +0100
commitfd4f173966e1d7d4d6c40d07da2f2efa270afc82 (patch)
tree2770e82ae26157d69c5158e76de39129ddc57864 /src/main.cpp
parentTranslated using Weblate (Russian) (diff)
parentDon't pass around empty timeline (diff)
downloadnheko-fd4f173966e1d7d4d6c40d07da2f2efa270afc82.tar.xz
Merge pull request #308 from Nheko-Reborn/build-opt
Optimize build
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp39
1 files changed, 19 insertions, 20 deletions
diff --git a/src/main.cpp b/src/main.cpp

index 61cb4fbe..6fbccf5c 100644 --- a/src/main.cpp +++ b/src/main.cpp
@@ -107,33 +107,28 @@ main(int argc, char *argv[]) // needed for settings so need to register before any settings are read to prevent warnings qRegisterMetaType<UserSettings::Presence>(); - // This is some hacky programming, but it's necessary (AFAIK?) to get the unique config name parsed - // before the app name is set. + // This is some hacky programming, but it's necessary (AFAIK?) to get the unique config name + // parsed before the app name is set. QString appName{"nheko"}; - for (int i = 0; i < argc; ++i) - { - if (QString{argv[i]}.startsWith("--profile=")) - { + for (int i = 0; i < argc; ++i) { + if (QString{argv[i]}.startsWith("--profile=")) { QString q{argv[i]}; q.remove("--profile="); appName += "-" + q; - } - else if (QString{argv[i]}.startsWith("--p=")) - { + } else if (QString{argv[i]}.startsWith("--p=")) { QString q{argv[i]}; q.remove("-p="); appName += "-" + q; - } - else if (QString{argv[i]} == "--profile" || QString{argv[i]} == "-p") - { - if (i < argc -1) // if i is less than argc - 1, we still have a parameter left to process as the name + } else if (QString{argv[i]} == "--profile" || QString{argv[i]} == "-p") { + if (i < argc - 1) // if i is less than argc - 1, we still have a parameter + // left to process as the name { ++i; // the next arg is the name, so increment - appName += "-" + QString {argv[i]}; + appName += "-" + QString{argv[i]}; } } } - + QCoreApplication::setApplicationName(appName); QCoreApplication::setApplicationVersion(nheko::version); QCoreApplication::setOrganizationName("nheko"); @@ -168,11 +163,15 @@ main(int argc, char *argv[]) // This option is not actually parsed via Qt due to the need to parse it before the app // name is set. It only exists to keep Qt from complaining about the --profile/-p // option and thereby crashing the app. - QCommandLineOption configName(QStringList() << "p" << "profile", - QCoreApplication::tr("Create a unique profile, which allows you to log into several accounts at the same time and start multiple instances of nheko."), - QCoreApplication::tr("profile"), QCoreApplication::tr("profile name")); + QCommandLineOption configName( + QStringList() << "p" + << "profile", + QCoreApplication::tr("Create a unique profile, which allows you to log into several " + "accounts at the same time and start multiple instances of nheko."), + QCoreApplication::tr("profile"), + QCoreApplication::tr("profile name")); parser.addOption(configName); - + parser.process(app); app.setWindowIcon(QIcon(":/logos/nheko.png")); @@ -217,7 +216,7 @@ main(int argc, char *argv[]) appTranslator.load(QLocale(), "nheko", "_", ":/translations"); app.installTranslator(&appTranslator); - MainWindow w{ (appName == "nheko" ? "" : appName.remove("nheko-")) }; + MainWindow w{(appName == "nheko" ? "" : appName.remove("nheko-"))}; // Move the MainWindow to the center w.move(screenCenter(w.width(), w.height()));