Main: Move option into options

Change-Id: Ibcba302ce959347588c1f1d0d4d9fcff8f99ec25
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
Marcus Tillmanns
2024-08-01 07:09:07 +02:00
parent 523b4045cc
commit 54333873f4

View File

@@ -84,6 +84,7 @@ const char CLIENT_OPTION[] = "-client";
const char SETTINGS_OPTION[] = "-settingspath";
const char INSTALL_SETTINGS_OPTION[] = "-installsettingspath";
const char TEST_OPTION[] = "-test";
const char STYLE_OPTION[] = "-style";
const char TEMPORARY_CLEAN_SETTINGS1[] = "-temporarycleansettings";
const char TEMPORARY_CLEAN_SETTINGS2[] = "-tcs";
const char PID_OPTION[] = "-pid";
@@ -317,6 +318,7 @@ struct Options
std::optional<QString> userLibraryPath;
bool hasTestOption = false;
bool wantsCleanSettings = false;
bool hasStyleOption = false;
};
Options parseCommandLine(int argc, char *argv[])
@@ -353,12 +355,15 @@ Options parseCommandLine(int argc, char *argv[])
options.wantsCleanSettings = true;
options.preAppArguments << arg;
} else { // arguments that are still passed on to the application
if (arg == STYLE_OPTION)
options.hasStyleOption = true;
if (arg == TEST_OPTION)
options.hasTestOption = true;
options.appArguments.push_back(*it);
}
++it;
}
return options;
}
@@ -697,11 +702,7 @@ int main(int argc, char **argv)
setPixmapCacheLimit();
loadFonts();
if (HostOsInfo::isWindowsHost()) {
const bool hasStyleOption = Utils::findOrDefault(options.appArguments, [](char *arg) {
return arg && strcmp(arg, "-style") == 0;
});
if (!hasStyleOption) {
if (Utils::HostOsInfo::isWindowsHost() && !options.hasStyleOption) {
// The Windows 11 default style (Qt 6.7) has major issues, therefore
// set the previous default style: "windowsvista"
// FIXME: check newer Qt Versions
@@ -713,7 +714,6 @@ int main(int argc, char **argv)
if (fractionalDpi)
QApplication::setStyle(QLatin1String("fusion"));
}
}
const int threadCount = QThreadPool::globalInstance()->maxThreadCount();
QThreadPool::globalInstance()->setMaxThreadCount(qMax(4, 2 * threadCount));