* @brief Application entry-point: bootstraps Qt, parses CLI flags, and runs the event loop. */
| 99 | * @brief Application entry-point: bootstraps Qt, parses CLI flags, and runs the event loop. |
| 100 | */ |
| 101 | int 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 | { |
nothing calls this directly
no test coverage detected