summary refs log tree commit diff
path: root/src/main.cpp
diff options
context:
space:
mode:
authorNicolas Werner <nicolas.werner@hotmail.de>2020-10-27 17:45:28 +0100
committerNicolas Werner <nicolas.werner@hotmail.de>2020-10-27 17:45:28 +0100
commit12fff7408ea7539d778a641bbf1746693d30ee2a (patch)
treeaf9ef46791e7f2e5dcd480f4c1cc91a97ee95a71 /src/main.cpp
parentFix small scope issue (diff)
downloadnheko-12fff7408ea7539d778a641bbf1746693d30ee2a.tar.xz
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()));