MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / prepareEnvironment

Function prepareEnvironment

app/src/Platform/AppPlatform.cpp:434–469  ·  view source on GitHub ↗

* @brief Performs platform fixups, fractional scaling, and WebEngine init. The performance * hints honor "App/PerformanceMode" (Misc::ModuleManager), read here via raw QSettings * because this runs before QApplication and the singletons exist. */

Source from the content-addressed store, hash-verified

432 * because this runs before QApplication and the singletons exist.
433 */
434void prepareEnvironment(int& argc, char**& argv, const QString& shortcutPath)
435{
436 const bool performanceMode = QSettings().value("App/PerformanceMode", true).toBool();
437
438#if defined(Q_OS_WIN)
439 attachToConsole();
440 setWindowsAppUserModelId(shortcutPath);
441 if (performanceMode)
442 enableWindowsPerformanceMode();
443
444 argv = adjustArgumentsForFreeType(argc, argv);
445#else
446 Q_UNUSED(argc);
447 Q_UNUSED(argv);
448 Q_UNUSED(shortcutPath);
449# if defined(Q_OS_LINUX)
450 if (performanceMode)
451 enableLinuxPerformanceMode();
452# elif defined(Q_OS_MACOS)
453 if (performanceMode)
454 enableMacPerformanceMode();
455# endif
456#endif
457
458 auto policy = Qt::HighDpiScaleFactorRoundingPolicy::PassThrough;
459 QApplication::setHighDpiScaleFactorRoundingPolicy(policy);
460
461#ifdef SERIAL_STUDIO_WITH_WEBENGINE
462# if defined(Q_OS_LINUX)
463 if (!qEnvironmentVariableIsSet("QTWEBENGINE_DISABLE_SANDBOX")
464 && !qEnvironmentVariableIsSet("QTWEBENGINE_CHROMIUM_FLAGS"))
465 qputenv("QTWEBENGINE_CHROMIUM_FLAGS", "--disable-namespace-sandbox");
466# endif
467 QtWebEngineQuick::initialize();
468#endif
469}
470
471/**
472 * @brief Keeps the system and display awake for the process lifetime so long recording

Callers 1

mainFunction · 0.85

Calls 8

QSettingsClass · 0.85
attachToConsoleFunction · 0.85
setWindowsAppUserModelIdFunction · 0.85
enableMacPerformanceModeFunction · 0.85
valueMethod · 0.45

Tested by

no test coverage detected