use of org.libresonic.player.command.GeneralSettingsCommand in project libresonic by Libresonic.
the class GeneralSettingsController method formBackingObject.
@ModelAttribute
protected void formBackingObject(Model model) throws Exception {
GeneralSettingsCommand command = new GeneralSettingsCommand();
command.setCoverArtFileTypes(settingsService.getCoverArtFileTypes());
command.setIgnoredArticles(settingsService.getIgnoredArticles());
command.setShortcuts(settingsService.getShortcuts());
command.setIndex(settingsService.getIndexString());
command.setPlaylistFolder(settingsService.getPlaylistFolder());
command.setMusicFileTypes(settingsService.getMusicFileTypes());
command.setVideoFileTypes(settingsService.getVideoFileTypes());
command.setSortAlbumsByYear(settingsService.isSortAlbumsByYear());
command.setGettingStartedEnabled(settingsService.isGettingStartedEnabled());
command.setWelcomeTitle(settingsService.getWelcomeTitle());
command.setWelcomeSubtitle(settingsService.getWelcomeSubtitle());
command.setWelcomeMessage(settingsService.getWelcomeMessage());
command.setLoginMessage(settingsService.getLoginMessage());
Theme[] themes = settingsService.getAvailableThemes();
command.setThemes(themes);
String currentThemeId = settingsService.getThemeId();
for (int i = 0; i < themes.length; i++) {
if (currentThemeId.equals(themes[i].getId())) {
command.setThemeIndex(String.valueOf(i));
break;
}
}
Locale currentLocale = settingsService.getLocale();
Locale[] locales = settingsService.getAvailableLocales();
String[] localeStrings = new String[locales.length];
for (int i = 0; i < locales.length; i++) {
localeStrings[i] = locales[i].getDisplayName(locales[i]);
if (currentLocale.equals(locales[i])) {
command.setLocaleIndex(String.valueOf(i));
}
}
command.setLocales(localeStrings);
model.addAttribute("command", command);
}
Aggregations