| 263 | } |
| 264 | |
| 265 | void Application::run() { |
| 266 | EnhancedSettings::Start(); |
| 267 | // Depends on OpenSSL on macOS, so on ThirdParty::start(). |
| 268 | // Depends on notifications settings. |
| 269 | _notifications = std::make_unique<Window::Notifications::System>(); |
| 270 | |
| 271 | startLocalStorage(); |
| 272 | |
| 273 | style::SetCustomFont(settings().customFontFamily()); |
| 274 | style::internal::StartFonts(); |
| 275 | |
| 276 | ValidateScale(); |
| 277 | |
| 278 | refreshGlobalProxy(); // Depends on app settings being read. |
| 279 | |
| 280 | if (const auto old = Local::oldSettingsVersion(); old < AppVersion) { |
| 281 | autoRegisterUrlScheme(); |
| 282 | Platform::NewVersionLaunched(old); |
| 283 | } |
| 284 | |
| 285 | if (cAutoStart() && !Platform::AutostartSupported()) { |
| 286 | cSetAutoStart(false); |
| 287 | } |
| 288 | |
| 289 | if (cLaunchMode() == LaunchModeAutoStart && Platform::AutostartSkip()) { |
| 290 | Platform::AutostartToggle(false); |
| 291 | Quit(); |
| 292 | return; |
| 293 | } |
| 294 | |
| 295 | _translator = std::make_unique<Lang::Translator>(); |
| 296 | QCoreApplication::instance()->installTranslator(_translator.get()); |
| 297 | |
| 298 | style::StartManager(cScale()); |
| 299 | Ui::Accessible::Init(); |
| 300 | Ui::InitTextOptions(); |
| 301 | Ui::StartCachedCorners(); |
| 302 | Ui::Emoji::Init(); |
| 303 | Ui::PreloadTextSpoilerMask(); |
| 304 | startShortcuts(); |
| 305 | startEmojiImageLoader(); |
| 306 | startSystemDarkModeViewer(); |
| 307 | Media::Player::start(_audio.get()); |
| 308 | |
| 309 | if (MediaControlsManager::Supported()) { |
| 310 | _mediaControlsManager = std::make_unique<MediaControlsManager>(); |
| 311 | } |
| 312 | |
| 313 | rpl::combine( |
| 314 | _batterySaving->value(), |
| 315 | settings().ignoreBatterySavingValue() |
| 316 | ) | rpl::on_next([=](bool saving, bool ignore) { |
| 317 | PowerSaving::SetForceAll(saving && !ignore); |
| 318 | }, _lifetime); |
| 319 | |
| 320 | style::ShortAnimationPlaying( |
| 321 | ) | rpl::on_next([=](bool playing) { |
| 322 | if (playing) { |
no test coverage detected