Search in sources :

Example 1 with LocalizationPrefs

use of com.faforever.client.preferences.LocalizationPrefs in project downlords-faf-client by FAForever.

the class SettingsController method onLanguageSelected.

public void onLanguageSelected() {
    LocalizationPrefs localizationPrefs = preferencesService.getPreferences().getLocalization();
    if (Objects.equals(languageComboBox.getValue(), localizationPrefs.getLanguage())) {
        return;
    }
    log.debug("A new language was selected: {}", languageComboBox.getValue());
    localizationPrefs.setLanguage(languageComboBox.getValue());
    preferencesService.storeInBackground();
    notificationService.addNotification(new PersistentNotification(i18n.get("settings.languages.restart.message"), Severity.WARN, Collections.singletonList(new Action(i18n.get("settings.languages.restart"), event -> {
        Platform.exit();
    // FIXME reload application (stage & application context)
    }))));
}
Also used : UiService(com.faforever.client.theme.UiService) ChatColorMode(com.faforever.client.chat.ChatColorMode) ComboBox(javafx.scene.control.ComboBox) TextField(javafx.scene.control.TextField) UnitDataBaseType(com.faforever.client.preferences.Preferences.UnitDataBaseType) Theme(com.faforever.client.theme.Theme) Screen(javafx.stage.Screen) Platform(javafx.application.Platform) Objects(java.util.Objects) NumberStringConverter(javafx.util.converter.NumberStringConverter) Slf4j(lombok.extern.slf4j.Slf4j) Region(javafx.scene.layout.Region) ToggleButton(javafx.scene.control.ToggleButton) GameDirectoryChooseEvent(com.faforever.client.ui.preferences.event.GameDirectoryChooseEvent) Toggle(javafx.scene.control.Toggle) ToastPosition(com.faforever.client.preferences.ToastPosition) TimeInfo(com.faforever.client.preferences.TimeInfo) PreferencesService(com.faforever.client.preferences.PreferencesService) WeakChangeListener(javafx.beans.value.WeakChangeListener) FXCollections(javafx.collections.FXCollections) UserService(com.faforever.client.user.UserService) Bindings(javafx.beans.binding.Bindings) Scope(org.springframework.context.annotation.Scope) NumberFormat(java.text.NumberFormat) EventBus(com.google.common.eventbus.EventBus) Inject(javax.inject.Inject) NotificationService(com.faforever.client.notification.NotificationService) Preferences(com.faforever.client.preferences.Preferences) DEFAULT_THEME(com.faforever.client.theme.UiService.DEFAULT_THEME) StringListCell(com.faforever.client.fx.StringListCell) PasswordField(javafx.scene.control.PasswordField) Label(javafx.scene.control.Label) Controller(com.faforever.client.fx.Controller) Node(javafx.scene.Node) CheckBox(javafx.scene.control.CheckBox) Action(com.faforever.client.notification.Action) NotificationsPrefs(com.faforever.client.preferences.NotificationsPrefs) PersistentNotification(com.faforever.client.notification.PersistentNotification) PATH_STRING_CONVERTER(com.faforever.client.fx.JavaFxUtil.PATH_STRING_CONVERTER) ActionEvent(javafx.event.ActionEvent) ToggleGroup(javafx.scene.control.ToggleGroup) Component(org.springframework.stereotype.Component) LanguageInfo(com.faforever.client.preferences.LanguageInfo) Severity(com.faforever.client.notification.Severity) I18n(com.faforever.client.i18n.I18n) LocalizationPrefs(com.faforever.client.preferences.LocalizationPrefs) ChangeListener(javafx.beans.value.ChangeListener) ConfigurableBeanFactory(org.springframework.beans.factory.config.ConfigurableBeanFactory) Collections(java.util.Collections) Action(com.faforever.client.notification.Action) LocalizationPrefs(com.faforever.client.preferences.LocalizationPrefs) PersistentNotification(com.faforever.client.notification.PersistentNotification)

Aggregations

ChatColorMode (com.faforever.client.chat.ChatColorMode)1 Controller (com.faforever.client.fx.Controller)1 PATH_STRING_CONVERTER (com.faforever.client.fx.JavaFxUtil.PATH_STRING_CONVERTER)1 StringListCell (com.faforever.client.fx.StringListCell)1 I18n (com.faforever.client.i18n.I18n)1 Action (com.faforever.client.notification.Action)1 NotificationService (com.faforever.client.notification.NotificationService)1 PersistentNotification (com.faforever.client.notification.PersistentNotification)1 Severity (com.faforever.client.notification.Severity)1 LanguageInfo (com.faforever.client.preferences.LanguageInfo)1 LocalizationPrefs (com.faforever.client.preferences.LocalizationPrefs)1 NotificationsPrefs (com.faforever.client.preferences.NotificationsPrefs)1 Preferences (com.faforever.client.preferences.Preferences)1 UnitDataBaseType (com.faforever.client.preferences.Preferences.UnitDataBaseType)1 PreferencesService (com.faforever.client.preferences.PreferencesService)1 TimeInfo (com.faforever.client.preferences.TimeInfo)1 ToastPosition (com.faforever.client.preferences.ToastPosition)1 Theme (com.faforever.client.theme.Theme)1 UiService (com.faforever.client.theme.UiService)1 DEFAULT_THEME (com.faforever.client.theme.UiService.DEFAULT_THEME)1