From 61ce25f2ddf1fc4f2f9e8d08719d2a9dfce2a996 Mon Sep 17 00:00:00 2001 From: Michael Kamensky Date: Wed, 3 Nov 2021 09:33:01 +0300 Subject: [PATCH] - Change the name "sound profile" to "sound set", which makes more sense. - Reset to Default profile in absence of custom sound sets. --- .../home/settings/CSubmenuPreferences.java | 10 +++++----- .../home/settings/VSubmenuPreferences.java | 10 +++++----- .../forge/screens/settings/SettingsPage.java | 8 ++++---- forge-gui/res/languages/de-DE.properties | 4 ++-- forge-gui/res/languages/en-US.properties | 4 ++-- forge-gui/res/languages/es-ES.properties | 4 ++-- forge-gui/res/languages/it-IT.properties | 4 ++-- forge-gui/res/languages/ja-JP.properties | 4 ++-- forge-gui/res/languages/zh-CN.properties | 4 ++-- .../properties/ForgePreferences.java | 2 +- .../main/java/forge/sound/SoundSystem.java | 19 ++++++++++++------- 11 files changed, 39 insertions(+), 34 deletions(-) diff --git a/forge-gui-desktop/src/main/java/forge/screens/home/settings/CSubmenuPreferences.java b/forge-gui-desktop/src/main/java/forge/screens/home/settings/CSubmenuPreferences.java index a547ab5c2cf..326734bf455 100644 --- a/forge-gui-desktop/src/main/java/forge/screens/home/settings/CSubmenuPreferences.java +++ b/forge-gui-desktop/src/main/java/forge/screens/home/settings/CSubmenuPreferences.java @@ -262,7 +262,7 @@ public enum CSubmenuPreferences implements ICDoc { initializeAutoUpdaterComboBox(); initializeMulliganRuleComboBox(); initializeAiProfilesComboBox(); - initializeSoundProfilesComboBox(); + initializeSoundSetsComboBox(); initializeStackAdditionsComboBox(); initializeLandPlayedComboBox(); initializeColorIdentityCombobox(); @@ -467,10 +467,10 @@ public enum CSubmenuPreferences implements ICDoc { panel.setComboBox(comboBox, selectedItem); } - private void initializeSoundProfilesComboBox() { - final FPref userSetting = FPref.UI_CURRENT_SOUND_PROFILE; - final FComboBoxPanel panel = this.view.getSoundProfilesComboBoxPanel(); - final FComboBox comboBox = createComboBox(SoundSystem.getAvailableSoundProfiles(), userSetting); + private void initializeSoundSetsComboBox() { + final FPref userSetting = FPref.UI_CURRENT_SOUND_SET; + final FComboBoxPanel panel = this.view.getSoundSetsComboBoxPanel(); + final FComboBox comboBox = createComboBox(SoundSystem.getAvailableSoundSets(), userSetting); final String selectedItem = this.prefs.getPref(userSetting); panel.setComboBox(comboBox, selectedItem); } diff --git a/forge-gui-desktop/src/main/java/forge/screens/home/settings/VSubmenuPreferences.java b/forge-gui-desktop/src/main/java/forge/screens/home/settings/VSubmenuPreferences.java index 2a542284e1c..fdcd35780b7 100644 --- a/forge-gui-desktop/src/main/java/forge/screens/home/settings/VSubmenuPreferences.java +++ b/forge-gui-desktop/src/main/java/forge/screens/home/settings/VSubmenuPreferences.java @@ -128,7 +128,7 @@ public enum VSubmenuPreferences implements IVSubmenu { private final FComboBoxPanel cbpCardArtFormat = new FComboBoxPanel<>(localizer.getMessage("cbpCardArtFormat")+":"); private final FComboBoxPanel cbpCardArtPreference = new FComboBoxPanel<>(localizer.getMessage("lblPreferredArt")+":"); private final FComboBoxPanel cbpMulliganRule = new FComboBoxPanel<>(localizer.getMessage("cbpMulliganRule")+":"); - private final FComboBoxPanel cbpSoundProfiles = new FComboBoxPanel<>(localizer.getMessage("cbpSoundProfiles")+":"); + private final FComboBoxPanel cbpSoundSets = new FComboBoxPanel<>(localizer.getMessage("cbpSoundSets")+":"); private final FComboBoxPanel cbpAiProfiles = new FComboBoxPanel<>(localizer.getMessage("cbpAiProfiles")+":"); private final FComboBoxPanel cbpStackAdditions = new FComboBoxPanel<>(localizer.getMessage("cbpStackAdditions")+":"); private final FComboBoxPanel cbpLandPlayed = new FComboBoxPanel<>(localizer.getMessage("cbpLandPlayed")+":"); @@ -415,8 +415,8 @@ public enum VSubmenuPreferences implements IVSubmenu { pnlPrefs.add(cbEnableSounds, titleConstraints); pnlPrefs.add(new NoteLabel(localizer.getMessage("nlEnableSounds")), descriptionConstraints); - pnlPrefs.add(cbpSoundProfiles, comboBoxConstraints); - pnlPrefs.add(new NoteLabel(localizer.getMessage("nlpSoundProfiles")), descriptionConstraints); + pnlPrefs.add(cbpSoundSets, comboBoxConstraints); + pnlPrefs.add(new NoteLabel(localizer.getMessage("nlpSoundSets")), descriptionConstraints); pnlPrefs.add(cbEnableMusic, titleConstraints); pnlPrefs.add(new NoteLabel(localizer.getMessage("nlEnableMusic")), descriptionConstraints); @@ -744,8 +744,8 @@ public enum VSubmenuPreferences implements IVSubmenu { return cbpMulliganRule; } - public FComboBoxPanel getSoundProfilesComboBoxPanel() { - return cbpSoundProfiles; + public FComboBoxPanel getSoundSetsComboBoxPanel() { + return cbpSoundSets; } public FComboBoxPanel getAiProfilesComboBoxPanel() { diff --git a/forge-gui-mobile/src/forge/screens/settings/SettingsPage.java b/forge-gui-mobile/src/forge/screens/settings/SettingsPage.java index 207f14fcef7..0ee51464882 100644 --- a/forge-gui-mobile/src/forge/screens/settings/SettingsPage.java +++ b/forge-gui-mobile/src/forge/screens/settings/SettingsPage.java @@ -612,10 +612,10 @@ public class SettingsPage extends TabPage { localizer.getMessage("nlVibrateAfterLongPress")), 6); //Sound Options - lstSettings.addItem(new CustomSelectSetting(FPref.UI_CURRENT_SOUND_PROFILE, - localizer.getMessage("cbpSoundProfiles"), - localizer.getMessage("nlpSoundProfiles"), - SoundSystem.getAvailableSoundProfiles()), + lstSettings.addItem(new CustomSelectSetting(FPref.UI_CURRENT_SOUND_SET, + localizer.getMessage("cbpSoundSets"), + localizer.getMessage("nlpSoundSets"), + SoundSystem.getAvailableSoundSets()), 7); lstSettings.addItem(new CustomSelectSetting(FPref.UI_VOL_SOUNDS, localizer.getMessage("cbAdjustSoundsVolume"), diff --git a/forge-gui/res/languages/de-DE.properties b/forge-gui/res/languages/de-DE.properties index 6f5226c42f3..521024167ed 100644 --- a/forge-gui/res/languages/de-DE.properties +++ b/forge-gui/res/languages/de-DE.properties @@ -111,7 +111,7 @@ cbpGameLogEntryType=Spielberichtsumfang cbpCloseAction=Beenden cbpDefaultFontSize=Standard Schriftgröße cbpCardArtFormat=Kartenbildformat -cbpSoundProfiles=Sound Profile +cbpSoundSets=Sound Set cbpAiProfiles=KI Persönlichkeit cbpStackAdditions=Nachricht bei Stapeländerung cbpDisplayCurrentCardColors=Zeige detaillierte Kartenfarben @@ -142,7 +142,7 @@ nlCompactMainMenu=Aktiviere, um im Seitenmenü platzsparend immer nur eine Menü nlUseSentry=Aktiviere, um automatische Fehlerberichte an die Entwickler zu senden. GamePlay=Spiel nlpMulliganRule=Wähle die Version der Mulligan Regel -nlpSoundProfiles=Choose the sound profile from the ones present in the "sound" folder in your Forge cache directory (REQUIRES RESTART) +nlpSoundSets=Choose the sound set from the ones present in the "sound" folder in your Forge cache directory (REQUIRES RESTART) nlpAiProfiles=Wähle die Spielweise deines KI-Gegners. nlpStackAdditions=Wähle, wann du über Änderungen am Stapel benachrichtigt werden möchtest: Niemals, immer oder nur für durch andere Spieler ausgelöste Effekte und Fähigkeiten nlAnte=Entscheidet, ob um einen Einsatz (Ante) gespielt wird. diff --git a/forge-gui/res/languages/en-US.properties b/forge-gui/res/languages/en-US.properties index a36347c8601..e411e11e178 100644 --- a/forge-gui/res/languages/en-US.properties +++ b/forge-gui/res/languages/en-US.properties @@ -113,7 +113,7 @@ cbpCloseAction=Close Action cbpDefaultFontSize=Default Font Size cbpCardArtFormat=Card Art Format cbpAiProfiles=AI Personality -cbpSoundProfiles=Sound Profile +cbpSoundSets=Sound Set cbpStackAdditions=Stack effect notifications cbpDisplayCurrentCardColors=Show Detailed Card Color cbpAutoYieldMode=Auto-Yield @@ -143,7 +143,7 @@ nlCompactMainMenu=Enable for a space efficient sidebar that displays only one me nlUseSentry=When enabled, automatically submits bug reports to developers. GamePlay=Gameplay nlpMulliganRule=Choose the version of the Mulligan rule -nlpSoundProfiles=Choose the sound profile from the ones present in the "sound" folder in your Forge cache directory (REQUIRES RESTART) +nlpSoundSets=Choose the sound set from the ones present in the "sound" folder in your Forge cache directory (REQUIRES RESTART) nlpAiProfiles=Choose your AI opponent nlpStackAdditions=Choose when you want to get visual notifications for an effect added to the stack: Never, always, or only for the effects cast/activated by a AI player or triggered by any player nlAnte=Determines whether or not the game is played for ante. diff --git a/forge-gui/res/languages/es-ES.properties b/forge-gui/res/languages/es-ES.properties index b72fc2cf7d0..3219c9a111b 100644 --- a/forge-gui/res/languages/es-ES.properties +++ b/forge-gui/res/languages/es-ES.properties @@ -112,7 +112,7 @@ cbpGameLogEntryType=Registro del juego cbpCloseAction=Acción al cerrar cbpDefaultFontSize=Tamaño de fuente predeterminado cbpCardArtFormat=Card Art Format -cbpSoundProfiles=Sound Profile +cbpSoundSets=Sound Set cbpAiProfiles=Personalidad de la IA cbpStackAdditions=Efecto de la pila de notificaciones cbpDisplayCurrentCardColors=Mostrar color de la carta @@ -143,7 +143,7 @@ nlCompactMainMenu=Habilitar para una barra lateral eficiente en espacio que mues nlUseSentry=Cuando está habilitado, envía automáticamente informes de errores a los desarrolladores. GamePlay=Juego nlpMulliganRule=Elige versión de reglas de mulligan -nlpSoundProfiles=Choose the sound profile from the ones present in the "sound" folder in your Forge cache directory (REQUIRES RESTART) +nlpSoundSets=Choose the sound set from the ones present in the "sound" folder in your Forge cache directory (REQUIRES RESTART) nlpAiProfiles=Elige tu oponente de la IA nlpStackAdditions=Elige cuándo quieres recibir notificaciones visuales para un efecto añadido a la pila: Nunca, siempre o sólo para los efectos lanzados/activados por un jugador IA o activados por cualquier jugador nlAnte=Determina si el juego se juega con apuesta o no. diff --git a/forge-gui/res/languages/it-IT.properties b/forge-gui/res/languages/it-IT.properties index bbe9422b146..eb05fc1b8ff 100644 --- a/forge-gui/res/languages/it-IT.properties +++ b/forge-gui/res/languages/it-IT.properties @@ -111,7 +111,7 @@ cbpGameLogEntryType=Verbosità del registro di gioco cbpCloseAction=Chiudi cbpDefaultFontSize=Dimensione carattere predefinita cbpCardArtFormat=Formato dell'Illustrazione delle carte -cbpSoundProfiles=Sound Profile +cbpSoundSets=Sound Set cbpAiProfiles=Personalità dell''IA cbpStackAdditions=Notifiche degli effetti in pila cbpDisplayCurrentCardColors=Mostra colore scheda dettagliato @@ -142,7 +142,7 @@ nlCompactMainMenu=Abilitare per una barra laterale efficiente in termini di spaz nlUseSentry=Se abilitato, invia automaticamente segnalazioni di bug agli sviluppatori. GamePlay=Gameplay nlpMulliganRule=Scegli il tipo di Mulligan -nlpSoundProfiles=Choose the sound profile from the ones present in the "sound" folder in your Forge cache directory (REQUIRES RESTART) +nlpSoundSets=Choose the sound set from the ones present in the "sound" folder in your Forge cache directory (REQUIRES RESTART) nlpAiProfiles=Scegli il tuo avversario (IA) nlpStackAdditions=Scegli quando vuoi ricevere una notifica visiva di un effetto aggiunto alla pila: Mai, sempre, o solo per gli effetti lanciati/attivati da un giocatore IA o innescati da un qualsiasi giocatore nlAnte=Determina se l''incontro è giocato o meno con la posta. diff --git a/forge-gui/res/languages/ja-JP.properties b/forge-gui/res/languages/ja-JP.properties index 1709332021a..943836a7f70 100644 --- a/forge-gui/res/languages/ja-JP.properties +++ b/forge-gui/res/languages/ja-JP.properties @@ -112,7 +112,7 @@ cbpGameLogEntryType=ゲームログの詳細レベル cbpCloseAction=閉じる時の動作 cbpDefaultFontSize=デフォルトのフォントサイズ cbpCardArtFormat=カードのアートフォーマット -cbpSoundProfiles=Sound Profile +cbpSoundSets=Sound Set cbpAiProfiles=AI の性格 cbpStackAdditions=スタック効果通知 cbpDisplayCurrentCardColors=詳細なカードの色を表示 @@ -143,7 +143,7 @@ nlCompactMainMenu=サイドバーに同時に一つのメニューグループ nlUseSentry=有効にすると、バグレポートが開発者に自動的に送信されます。 GamePlay=ゲーム設定 nlpMulliganRule=マリガンルールを選択する。 -nlpSoundProfiles=Choose the sound profile from the ones present in the "sound" folder in your Forge cache directory (REQUIRES RESTART) +nlpSoundSets=Choose the sound set from the ones present in the "sound" folder in your Forge cache directory (REQUIRES RESTART) nlpAiProfiles=対戦相手 AI の性格を選択する。 nlpStackAdditions=スタックに追加された能力の視覚通知をいつ取得するかを選択します:(Never[しない]、Always[常時]、またはAIプレーヤーによってキャスト/起動された能力、または任意のプレーヤーによって誘発された能力に対してのみ nlAnte=ゲームでアンティ(賭け)ルールを適用するか選択する。 diff --git a/forge-gui/res/languages/zh-CN.properties b/forge-gui/res/languages/zh-CN.properties index bdb471160b7..675871a723a 100644 --- a/forge-gui/res/languages/zh-CN.properties +++ b/forge-gui/res/languages/zh-CN.properties @@ -112,7 +112,7 @@ cbpGameLogEntryType=游戏日志详细程度 cbpCloseAction=关闭动作 cbpDefaultFontSize=默认字体大小 cbpCardArtFormat=牌张插画格式 -cbpSoundProfiles=Sound Profile +cbpSoundSets=Sound Set cbpAiProfiles=AI强度 cbpStackAdditions=堆叠效应通知 cbpDisplayCurrentCardColors=显示卡牌颜色详情 @@ -143,7 +143,7 @@ nlCompactMainMenu=启用节省空间的侧边栏,一次只显示一个菜单 nlUseSentry=启用后,会自动向开发人员提交错误报告。 GamePlay=游戏 nlpMulliganRule=选择调度规则 -nlpSoundProfiles=Choose the sound profile from the ones present in the "sound" folder in your Forge cache directory (REQUIRES RESTART) +nlpSoundSets=Choose the sound set from the ones present in the "sound" folder in your Forge cache directory (REQUIRES RESTART) nlpAiProfiles=选择你的AI对手 nlpStackAdditions=选择何时因效应进入堆叠而提供视觉提醒:从不,总是,任何由AI释放或起动以及由任何玩家触发的效应。 nlAnte=确定游戏是否使用赌注 diff --git a/forge-gui/src/main/java/forge/localinstance/properties/ForgePreferences.java b/forge-gui/src/main/java/forge/localinstance/properties/ForgePreferences.java index 348c1e795c4..354458da64b 100644 --- a/forge-gui/src/main/java/forge/localinstance/properties/ForgePreferences.java +++ b/forge-gui/src/main/java/forge/localinstance/properties/ForgePreferences.java @@ -121,7 +121,7 @@ public class ForgePreferences extends PreferencesStore { UI_VOL_SOUNDS ("100"), UI_VOL_MUSIC ("100"), UI_ALT_SOUND_SYSTEM ("false"), - UI_CURRENT_SOUND_PROFILE ("Default"), + UI_CURRENT_SOUND_SET("Default"), UI_CURRENT_AI_PROFILE ("Default"), UI_CLONE_MODE_SOURCE ("false"), UI_MATCH_IMAGE_VISIBLE ("true"), diff --git a/forge-gui/src/main/java/forge/sound/SoundSystem.java b/forge-gui/src/main/java/forge/sound/SoundSystem.java index ba18121a3ab..f4988021435 100644 --- a/forge-gui/src/main/java/forge/sound/SoundSystem.java +++ b/forge-gui/src/main/java/forge/sound/SoundSystem.java @@ -245,9 +245,9 @@ public class SoundSystem { } } - public static String[] getAvailableSoundProfiles() + public static String[] getAvailableSoundSets() { - final List availableProfiles = new ArrayList<>(); + final List availableSets = new ArrayList<>(); final File dir = new File(ForgeConstants.CACHE_SOUND_DIR); if (dir != null && dir.exists()) { @@ -255,19 +255,24 @@ public class SoundSystem { for (String fileName : files) { String fullPath = ForgeConstants.CACHE_SOUND_DIR + fileName; if (!fileName.equals("Default") && new File(fullPath).isDirectory()) { - availableProfiles.add(fileName); + availableSets.add(fileName); } } } - Collections.sort(availableProfiles); - availableProfiles.add(0, "Default"); + Collections.sort(availableSets); + availableSets.add(0, "Default"); - return availableProfiles.toArray(new String[availableProfiles.size()]); + if (availableSets.size() == 1) { + // Default profile only - ensure that the preference is set accordingly + FModel.getPreferences().setPref(FPref.UI_CURRENT_SOUND_SET, "Default"); + } + + return availableSets.toArray(new String[availableSets.size()]); } public static String getSoundDirectory() { - String profileName = FModel.getPreferences().getPref(FPref.UI_CURRENT_SOUND_PROFILE); + String profileName = FModel.getPreferences().getPref(FPref.UI_CURRENT_SOUND_SET); if (profileName.equals("Default")) { return ForgeConstants.SOUND_DIR; } else {