| 1385 | } |
| 1386 | |
| 1387 | UIMenu* SettingsMenu::createWindowMenu() { |
| 1388 | mWindowMenu = UIPopUpMenu::New(); |
| 1389 | auto shouldCloseCb = []( UIMenuItem* ) -> bool { return false; }; |
| 1390 | UIPopUpMenu* colorsMenu = UIPopUpMenu::New(); |
| 1391 | colorsMenu |
| 1392 | ->addRadioButton( i18n( "system", "System" ), |
| 1393 | mApp->getUIColorScheme() == ColorSchemeExtPreference::System ) |
| 1394 | ->setOnShouldCloseCb( shouldCloseCb ) |
| 1395 | ->setTooltipText( i18n( |
| 1396 | "prefers_color_scheme_system_tooltip", |
| 1397 | "System options will try to pick the system-wide currently preferred color scheme." ) ) |
| 1398 | ->setId( "system" ); |
| 1399 | colorsMenu |
| 1400 | ->addRadioButton( i18n( "light", "Light" ), |
| 1401 | mApp->getUIColorScheme() == ColorSchemeExtPreference::Light ) |
| 1402 | ->setOnShouldCloseCb( shouldCloseCb ) |
| 1403 | ->setId( "light" ); |
| 1404 | colorsMenu |
| 1405 | ->addRadioButton( i18n( "dark", "Dark" ), |
| 1406 | mApp->getUIColorScheme() == ColorSchemeExtPreference::Dark ) |
| 1407 | ->setOnShouldCloseCb( shouldCloseCb ) |
| 1408 | ->setId( "dark" ); |
| 1409 | colorsMenu->on( Event::OnItemClicked, [this]( const Event* event ) { |
| 1410 | if ( !event->getNode()->isType( UI_TYPE_MENUITEM ) ) |
| 1411 | return; |
| 1412 | UIMenuItem* item = event->getNode()->asType<UIMenuItem>(); |
| 1413 | auto colorSchemeExt = ColorSchemePreferences::fromStringExt( item->getId() ); |
| 1414 | mApp->setUIColorSchemeFromUserInteraction( colorSchemeExt ); |
| 1415 | } ); |
| 1416 | mWindowMenu->addSubMenu( i18n( "fonts_configuration", "Fonts Configuration" ), |
| 1417 | findIcon( "font-size" ), createFontsMenu() ); |
| 1418 | mWindowMenu->addSubMenu( i18n( "ui_prefes_color_scheme", "UI Prefers Color Scheme" ), |
| 1419 | findIcon( "color-scheme" ), colorsMenu ); |
| 1420 | mWindowMenu->addSubMenu( i18n( "ui_thene", "UI Theme" ), findIcon( "palette" ), |
| 1421 | createThemesMenu() ); |
| 1422 | mWindowMenu->addSubMenu( i18n( "ui_language", "UI Language" ), findIcon( "globe" ), |
| 1423 | createLanguagesMenu() ); |
| 1424 | mWindowMenu->addSubMenu( i18n( "ui_renderer", "Renderer" ), findIcon( "package" ), |
| 1425 | createRendererMenu() ); |
| 1426 | |
| 1427 | mWindowMenu |
| 1428 | ->add( i18n( "ui_scale_factor", "UI Scale Factor (Pixel Density)" ), |
| 1429 | findIcon( "pixel-density" ) ) |
| 1430 | ->setId( "ui-scale-factor" ); |
| 1431 | |
| 1432 | mWindowMenu->addSeparator(); |
| 1433 | mWindowMenu |
| 1434 | ->add( i18n( "key_bindings", "Key Bindings" ), findIcon( "keybindings" ), |
| 1435 | getKeybind( "keybindings" ) ) |
| 1436 | ->setId( "keybindings" ); |
| 1437 | |
| 1438 | mWindowMenu->addSeparator(); |
| 1439 | |
| 1440 | UIPopUpMenu* splitMenu = UIPopUpMenu::New(); |
| 1441 | |
| 1442 | splitMenu |
| 1443 | ->add( i18n( "split_left", "Split Left" ), findIcon( "split-horizontal" ), |
| 1444 | getKeybind( "split-left" ) ) |
nothing calls this directly
no test coverage detected