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

Function main

app/src/main.cpp:101–186  ·  view source on GitHub ↗

* @brief Application entry-point: bootstraps Qt, parses CLI flags, and runs the event loop. */

Source from the content-addressed store, hash-verified

99 * @brief Application entry-point: bootstraps Qt, parses CLI flags, and runs the event loop.
100 */
101int main(int argc, char** argv)
102{
103 setupQtApplicationMetadata();
104
105 const bool cliEarlyExit = Misc::CLI::isCliEarlyExit(argc, argv);
106 if (!cliEarlyExit)
107 Misc::CrashTracker::instance().markStartup();
108
109 const bool benchmark = Misc::CLI::isBenchmarkRequested(argc, argv);
110 const bool headless = Misc::CLI::argvHasFlag(argc, argv, "--headless");
111 if (headless || benchmark)
112 argv = Platform::AppPlatform::injectPlatformArg(argc, argv, "offscreen");
113
114 const QString shortcutPath = Misc::CLI::argvValueFor(argc, argv, "--shortcut-path");
115 Platform::AppPlatform::prepareEnvironment(argc, argv, shortcutPath);
116
117 Misc::CrashTracker::instance().setCheckpoint(QStringLiteral("graphics-backend-apply"));
118 Misc::GraphicsBackend::applyConfiguredBackend();
119
120 Misc::CrashTracker::instance().setCheckpoint(QStringLiteral("qapplication-construct"));
121 QApplication app(argc, argv);
122
123 Platform::FileOpenEventFilter fileOpenFilter;
124 app.installEventFilter(&fileOpenFilter);
125
126 Platform::TrackpadScrollFilter trackpadScrollFilter;
127 app.installEventFilter(&trackpadScrollFilter);
128
129 Platform::AppPlatform::registerFileAssociation();
130 configureApplicationStyle(app);
131
132 Misc::CLI cli;
133 switch (cli.process(app)) {
134 case Misc::CLI::ProcessResult::ExitSuccess:
135 return EXIT_SUCCESS;
136 case Misc::CLI::ProcessResult::ExitFailure:
137 return EXIT_FAILURE;
138 case Misc::CLI::ProcessResult::Continue:
139 break;
140 }
141
142 Platform::AppPlatform::inhibitIdleSleep();
143
144 Q_INIT_RESOURCE(rcc);
145 Q_INIT_RESOURCE(translations);
146
147 if (!cli.verifyShortcutProject())
148 return EXIT_SUCCESS;
149
150#ifdef BUILD_COMMERCIAL
151 cli.applyThemeOverride();
152 if (cli.runtimeMode())
153 AppState::instance().setEphemeralSession(true);
154#endif
155
156 Misc::CrashTracker::instance().setCheckpoint(QStringLiteral("module-manager-bootstrap"));
157 int status = EXIT_SUCCESS;
158 {

Callers

nothing calls this directly

Calls 15

injectPlatformArgFunction · 0.85
prepareEnvironmentFunction · 0.85
registerFileAssociationFunction · 0.85
inhibitIdleSleepFunction · 0.85
bootstrapModuleManagerFunction · 0.85
releaseAdjustedArgvFunction · 0.85
markStartupMethod · 0.80
setCheckpointMethod · 0.80
verifyShortcutProjectMethod · 0.80
applyThemeOverrideMethod · 0.80

Tested by

no test coverage detected