Optimize build
This commit is contained in:
parent
7f2d18c36d
commit
12fff7408e
33 changed files with 243 additions and 232 deletions
39
src/main.cpp
39
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()));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue