ViewModel managing menu options UI state and accessibility strings. More...
Public Member Functions | |
| MenuOptionsViewModel (AudioService audioService, AsyncFileProcessorService asyncFileProcessorService, PlayerStateHolder playerStateHolder, OptionsService optionsService, ToasterService toasterService) | |
| Initializes the MenuOptionsViewModel with necessary infrastructure and reactive bindings. | |
| void | applyAndPersistIfNeededBackgroundImage (File selectedFile, GridPane sudokuFX, boolean shouldPersist) |
Applies a background image to the specified GridPane. | |
| void | applyAndPersistIfNeededOptionsColor (GridPane sudokuFX, Color color, boolean shouldPersist) |
Applies the given color as the background of the specified GridPane. | |
| ReadOnlyBooleanProperty | gridOpacityProperty () |
| Returns the read-only boolean property for the grid opacity state. | |
| void | init (GridPane sudokuFX) |
| Initializes the menu options UI state for the current player, including: | |
| StringBinding | optionsAccessibleTextProperty () |
| Returns the reactive binding for the options accessible text property. | |
| StringBinding | optionsClearSongAccessibleTextProperty () |
| Returns the reactive binding for the options clear song accessible text property. | |
| StringBinding | optionsClearSongRoleDescriptionProperty () |
| Returns the reactive binding for the options clear song role description property. | |
| StringBinding | optionsClearSongTooltipProperty () |
| Returns the reactive binding for the options clear song tooltip property. | |
| StringBinding | optionsColorAccessibleTextProperty () |
| Returns the reactive binding for the options color accessible text property. | |
| ObjectProperty< Color > | optionsColorProperty () |
| Returns the options color property, allowing UI components to bind to or observe changes in the selected color. | |
| StringBinding | optionsColorRoleDescriptionProperty () |
| Returns the reactive binding for the options color role description property. | |
| StringBinding | optionsColorTooltipProperty () |
| Returns the reactive binding for the options color tooltip property. | |
| StringBinding | optionsImageAccessibleTextProperty () |
| Returns the reactive binding for the options image accessible text property. | |
| StringBinding | optionsImageRoleDescriptionProperty () |
| Returns the reactive binding for the options image role description property. | |
| StringBinding | optionsImageTextProperty () |
| Returns the reactive binding for the options image text property. | |
| StringBinding | optionsImageTooltipProperty () |
| Returns the reactive binding for the options image tooltip property. | |
| StringBinding | optionsMenuMaxiAccessibleTextProperty () |
| Returns the reactive binding for the menu maxi accessible text property. | |
| StringBinding | optionsMenuMaxiRoleDescriptionProperty () |
| Returns the reactive binding for the menu maxi role description property. | |
| StringBinding | optionsMenuMaxiTextProperty () |
| Returns the reactive binding for the menu maxi text property. | |
| StringBinding | optionsMenuMaxiTooltipProperty () |
| Returns the reactive binding for the menu maxi tooltip property. | |
| StringBinding | optionsMuteAccessibleTextProperty () |
| Returns the reactive binding for the options mute accessible text property. | |
| StringBinding | optionsMuteIconProperty () |
| Returns the reactive binding for the options mute icon property. | |
| StringBinding | optionsMuteRoleDescriptionProperty () |
| Returns the reactive binding for the options mute role description property. | |
| StringBinding | optionsMuteTextProperty () |
| Returns the reactive binding for the options mute role description property. | |
| StringBinding | optionsMuteTooltipProperty () |
| Returns the reactive binding for the options mute tooltip property. | |
| StringBinding | optionsOpacityAccessibleTextProperty () |
| Returns the reactive binding for the options color role description property. | |
| StringBinding | optionsOpacityIconProperty () |
| Returns the reactive binding for the options opacity icon property. | |
| StringBinding | optionsOpacityRoleDescriptionProperty () |
| Returns the reactive binding for the options opacity role description property. | |
| StringBinding | optionsOpacityTextProperty () |
| Returns the reactive binding for the options opacity text property. | |
| StringBinding | optionsOpacityTooltipProperty () |
| Returns the reactive binding for the options opacity tooltip property. | |
| StringBinding | optionsReduceAccessibleTextProperty () |
| Returns the reactive binding for the options reduce accessible text property. | |
| StringBinding | optionsReduceTextProperty () |
| Returns the reactive binding for the options reduce text property. | |
| StringBinding | optionsReduceTooltipProperty () |
| Returns the reactive binding for the options reduce tooltip property. | |
| StringBinding | optionsRoleDescriptionProperty () |
| Returns the reactive binding for the options role description property. | |
| StringBinding | optionsSongAccessibleTextProperty () |
| Returns the reactive binding for the options song accessible text property. | |
| StringBinding | optionsSongRoleDescriptionProperty () |
| Returns the reactive binding for the options song role description property. | |
| StringBinding | optionsSongTextProperty () |
| Returns the reactive binding for the options song text property. | |
| StringBinding | optionsSongTooltipProperty () |
| Returns the reactive binding for the options song tooltip property. | |
| StringBinding | optionsTextProperty () |
| Returns the reactive binding for the options text property. | |
| StringBinding | optionsTooltipProperty () |
| Returns the reactive binding for the options tooltip property. | |
| void | resetSongPath () |
| Resets the song path by clearing the current selection, persisting the change, and showing a toast notification. | |
| void | restoreCurrentOptions (GridPane sudokuFX) |
| Restores the current options from the player state holder and applies them to the provided GridPane. | |
| void | saveSong (File file) |
| Saves the provided song file path to the database and shows a confirmation toast. | |
| ReadOnlyBooleanProperty | songIsBlankProperty () |
| Returns the read-only boolean property for the song blank state. | |
| boolean | toggleGridOpacityAndPersist () |
Toggles the grid opacity mode, persists the new state in the database, updates , and returns the actual updated value. | |
| void | toggleMuteAndPersist () |
Toggles the audio mute state, persists the new value in OptionsDto, updates the AudioService, and reflects the change in muteProperty. | |
Static Public Attributes | |
| static final int | HEXCOLOR_BEGIN_INDEX = 2 |
| static final int | HEXCOLOR_END_INDEX = 10 |
| static final String | SUDOKU_FX_MUST_NOT_BE_NULL = "sudokuFX must not be null" |
Private Member Functions | |
| void | applyOptionsToUI (OptionsDto options, GridPane sudokuFX) |
| Applies visual options to the sudokuFX component. | |
| void | checkInitialized () |
Checks whether the MenuOptionsViewModel has been initialized via init(GridPane). | |
| Observable[] | concatDependencies (Observable... dependencies) |
| Utility: always observe the locale in addition to custom dependencies. | |
| StringBinding | createFormattedAndConcatenatedBinding (Supplier< String > keySupplier, Supplier< String > argSupplier, String suffixKey, Observable... dependencies) |
| Creates a localized binding combining a formatted message and a suffix. | |
| StringBinding | createFormattedBinding (String key, String suffixKey) |
| Creates a StringBinding that returns the concatenation of two localized strings (main key and suffix key), updating automatically when the locale changes. | |
| StringBinding | createFormattedBinding (Supplier< String > keySupplier, Supplier< String > argSupplier, Observable... dependencies) |
| Creates a formatted localized binding with one dynamic argument. | |
| StringBinding | createStringBinding (String key) |
| Creates a StringBinding that returns the localized string for the given key, updating automatically when the locale changes. | |
| String | gridOpacityText (boolean isOpaque) |
| Returns the localized text corresponding to the grid opacity state. | |
| StringBinding | initMuteAccessibleText () |
| Creates the accessibility label for the mute button, based on the current mute state. | |
| StringBinding | initMuteIcon () |
| Creates the icon name for the mute button, depending on whether mute is active or not. | |
| StringBinding | initMuteText () |
| Creates the visible label for the mute button, reflecting the current mute state. | |
| StringBinding | initMuteTooltip () |
| Creates the tooltip for the mute button, combining dynamic mute info and submenu role. | |
| StringBinding | initOpacityAccessibleText () |
| Creates the accessibility label for the opacity button, based on the inverse of the current grid opacity state. | |
| StringBinding | initOpacityIcon () |
| Creates the icon name for the opacity button, depending on whether opacity is enabled or not. | |
| StringBinding | initOpacityText () |
| Creates the visible label for the opacity button, reflecting the current grid opacity value. | |
| StringBinding | initOpacityTooltip () |
| Creates the tooltip for the opacity button, combining dynamic label and submenu role. | |
| StringBinding | initSongAccessibleText () |
| Creates the accessibility label for the song button, depending on whether the song field is empty. | |
| StringBinding | initSongText () |
| Creates the visible label for the song button, adapting to whether a song is present or not. | |
| StringBinding | initSongTooltip () |
| Creates the tooltip for the song button, combining dynamic song info and submenu role. | |
| String | muteInfo (boolean isMuted) |
| Returns the localized information about the current mute state. | |
| String | muteText (boolean isMuted) |
| Returns the localized text corresponding to the mute state. | |
| void | persistImagePath (String imagePath) |
Persists the given image path in the current player's OptionsDto if it differs from the existing path, then refreshes the player. | |
| void | persistSongPath (String absolutePath, String name) |
| Persists the audio file path (songPath) in the current player's options. | |
| void | updateSongNameFromPath (String rawPath) |
| Updates the song display name by extracting the filename from the provided path. | |
Private Attributes | |
| final AsyncFileProcessorService | asyncFileProcessorService |
| final AudioService | audioService |
| final AudioUtils | audioUtils |
| Task<?> | currentTask |
| final ReadOnlyBooleanWrapper | gridOpacityProperty = new ReadOnlyBooleanWrapper(false) |
| final ImageUtils | imageUtils |
| boolean | initialized = false |
| final ReadOnlyBooleanWrapper | muteProperty = new ReadOnlyBooleanWrapper(true) |
| final StringBinding | optionsAccessibleText |
| final StringBinding | optionsClearSongAccessibleText |
| final StringBinding | optionsClearSongRoleDescription |
| final StringBinding | optionsClearSongTooltip |
| final StringBinding | optionsColorAccessibleText |
| final ObjectProperty< Color > | optionsColorProperty |
| final StringBinding | optionsColorRoleDescription |
| final StringBinding | optionsColorTooltip |
| final StringBinding | optionsImageAccessibleText |
| final StringBinding | optionsImageRoleDescription |
| final StringBinding | optionsImageText |
| final StringBinding | optionsImageTooltip |
| final StringBinding | optionsMenuMaxiAccessibleText |
| final StringBinding | optionsMenuMaxiRoleDescription |
| final StringBinding | optionsMenuMaxiText |
| final StringBinding | optionsMenuMaxiTooltip |
| final StringBinding | optionsMuteAccessibleText |
| final StringBinding | optionsMuteIcon |
| final StringBinding | optionsMuteRoleDescription |
| final StringBinding | optionsMuteText |
| final StringBinding | optionsMuteTooltip |
| final StringBinding | optionsOpacityAccessibleText |
| final StringBinding | optionsOpacityIcon |
| final StringBinding | optionsOpacityRoleDescription |
| final StringBinding | optionsOpacityText |
| final StringBinding | optionsOpacityTooltip |
| final StringBinding | optionsReduceAccessibleText |
| final StringBinding | optionsReduceText |
| final StringBinding | optionsReduceTooltip |
| final StringBinding | optionsRoleDescription |
| final OptionsService | optionsService |
| final StringBinding | optionsSongAccessibleText |
| final StringBinding | optionsSongRoleDescription |
| final StringBinding | optionsSongText |
| final StringBinding | optionsSongTooltip |
| final StringBinding | optionsText |
| final StringBinding | optionsTooltip |
| final PlayerStateHolder | playerStateHolder |
| final ReadOnlyBooleanWrapper | songIsBlankProperty = new ReadOnlyBooleanWrapper(true) |
| final ReadOnlyStringWrapper | songProperty = new ReadOnlyStringWrapper("") |
| final ToasterService | toasterService |
Static Private Attributes | |
| static final String | ICON_MUTE_OFF = "\ue04f" |
| static final String | ICON_MUTE_ON = "\ue050" |
| static final String | ICON_OPACITY_OFF = "\ue0c4" |
| static final String | ICON_OPACITY_ON = "\ue891" |
| static final Logger | LOG = LoggerFactory.getLogger(MenuOptionsViewModel.class) |
| static final String | ROLE_CLOSED = "menu.accessibility.role.description.closed" |
| static final String | ROLE_OPENED = "menu.accessibility.role.description.opened" |
| static final String | ROLE_SUBMENU_OPTION |
ViewModel managing menu options UI state and accessibility strings.
Provides localized StringBindings for button labels, tooltips, and roles, updating automatically on locale changes. Supports options color and image initialization and updates, including asynchronous image loading with user feedback.
| fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.MenuOptionsViewModel | ( | AudioService | audioService, |
| AsyncFileProcessorService | asyncFileProcessorService, | ||
| PlayerStateHolder | playerStateHolder, | ||
| OptionsService | optionsService, | ||
| ToasterService | toasterService ) |
Initializes the MenuOptionsViewModel with necessary infrastructure and reactive bindings.
Configures i18n-aware StringBindings for UI labels, tooltips, and accessibility roles.
| audioService | service for audio playback control |
| asyncFileProcessorService | service for background file and image processing |
| playerStateHolder | holder for persistent player preferences |
| optionsService | service for loading and saving user options |
| toasterService | service for displaying transient UI notifications |
| void fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.applyAndPersistIfNeededBackgroundImage | ( | File | selectedFile, |
| GridPane | sudokuFX, | ||
| boolean | shouldPersist ) |
Applies a background image to the specified GridPane.
Validates the file before starting an asynchronous task. On success, updates the background. Persistence of the image path occurs only if shouldPersist is true. All UI feedback and persistence are managed through thread-safe services.
| selectedFile | the image file to load; may be null |
| sudokuFX | the GridPane to update; must not be null |
| shouldPersist | true to save the file path to the player's options, false to update UI only |
| void fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.applyAndPersistIfNeededOptionsColor | ( | GridPane | sudokuFX, |
| Color | color, | ||
| boolean | shouldPersist ) |
Applies the given color as the background of the specified GridPane.
Optionally persists the color in the current player's options.
The color is converted to a hex string (RRGGBBAA). If persistence is enabled, the update only occurs if the color differs from the currently stored value.
| sudokuFX | the GridPane to update; must not be null |
| color | the color to apply; must not be null |
| shouldPersist | true to save to database, false for UI update only |
| NullPointerException | if sudokuFX or color is null |
|
private |
Applies visual options to the sudokuFX component.
This is a refactored utility method that contains NO persistence logic.
| options | the visual options DTO containing colors, background, and UI settings |
| sudokuFX | the target grid component to which the styles are applied |
|
private |
Checks whether the MenuOptionsViewModel has been initialized via init(GridPane).
If the menu options have not been initialized, this method throws an exception to prevent operations on an uninitialized state.
| IllegalStateException | if init(GridPane) has not been called |
|
private |
Utility: always observe the locale in addition to custom dependencies.
|
private |
Creates a localized binding combining a formatted message and a suffix.
Updates when locale or any of the given dependencies change.
|
private |
Creates a StringBinding that returns the concatenation of two localized strings (main key and suffix key), updating automatically when the locale changes.
| key | the main i18n translation key |
| suffixKey | the suffix i18n translation key to append |
|
private |
Creates a formatted localized binding with one dynamic argument.
Updates when locale or any of the given dependencies change.
|
private |
Creates a StringBinding that returns the localized string for the given key, updating automatically when the locale changes.
| key | the i18n translation key |
| ReadOnlyBooleanProperty fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.gridOpacityProperty | ( | ) |
Returns the read-only boolean property for the grid opacity state.
|
private |
Returns the localized text corresponding to the grid opacity state.
| isOpaque | true for "opaque" text, false for "transparent" text |
| void fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.init | ( | GridPane | sudokuFX | ) |
Initializes the menu options UI state for the current player, including:
This method synchronizes the UI components with the current player's options and prepares the necessary properties for bindings. The ViewModel is marked as initialized at the start of this method to allow called methods (like applyAndPersistBackgroundImage) to safely check the initialization state.
| sudokuFX | the GridPane to apply background settings; must not be null |
| NullPointerException | if sudokuFX is null |
|
private |
Creates the accessibility label for the mute button, based on the current mute state.
|
private |
Creates the icon name for the mute button, depending on whether mute is active or not.
|
private |
Creates the visible label for the mute button, reflecting the current mute state.
|
private |
Creates the tooltip for the mute button, combining dynamic mute info and submenu role.
|
private |
Creates the accessibility label for the opacity button, based on the inverse of the current grid opacity state.
|
private |
Creates the icon name for the opacity button, depending on whether opacity is enabled or not.
|
private |
Creates the visible label for the opacity button, reflecting the current grid opacity value.
|
private |
Creates the tooltip for the opacity button, combining dynamic label and submenu role.
|
private |
Creates the accessibility label for the song button, depending on whether the song field is empty.
|
private |
Creates the visible label for the song button, adapting to whether a song is present or not.
|
private |
Creates the tooltip for the song button, combining dynamic song info and submenu role.
|
private |
Returns the localized information about the current mute state.
This text is intended for tooltips or accessibility purposes, indicating whether the audio is currently muted or unmuted.
| isMuted | true if audio is currently muted, false if unmuted |
|
private |
Returns the localized text corresponding to the mute state.
| isMuted | true for "muted" audio, false for "unmuted" audio |
| StringBinding fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.optionsAccessibleTextProperty | ( | ) |
Returns the reactive binding for the options accessible text property.
| StringBinding fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.optionsClearSongAccessibleTextProperty | ( | ) |
Returns the reactive binding for the options clear song accessible text property.
| StringBinding fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.optionsClearSongRoleDescriptionProperty | ( | ) |
Returns the reactive binding for the options clear song role description property.
| StringBinding fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.optionsClearSongTooltipProperty | ( | ) |
Returns the reactive binding for the options clear song tooltip property.
| StringBinding fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.optionsColorAccessibleTextProperty | ( | ) |
Returns the reactive binding for the options color accessible text property.
| ObjectProperty< Color > fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.optionsColorProperty | ( | ) |
Returns the options color property, allowing UI components to bind to or observe changes in the selected color.
| StringBinding fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.optionsColorRoleDescriptionProperty | ( | ) |
Returns the reactive binding for the options color role description property.
| StringBinding fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.optionsColorTooltipProperty | ( | ) |
Returns the reactive binding for the options color tooltip property.
| StringBinding fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.optionsImageAccessibleTextProperty | ( | ) |
Returns the reactive binding for the options image accessible text property.
| StringBinding fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.optionsImageRoleDescriptionProperty | ( | ) |
Returns the reactive binding for the options image role description property.
| StringBinding fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.optionsImageTextProperty | ( | ) |
Returns the reactive binding for the options image text property.
| StringBinding fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.optionsImageTooltipProperty | ( | ) |
Returns the reactive binding for the options image tooltip property.
| StringBinding fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.optionsMenuMaxiAccessibleTextProperty | ( | ) |
Returns the reactive binding for the menu maxi accessible text property.
| StringBinding fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.optionsMenuMaxiRoleDescriptionProperty | ( | ) |
Returns the reactive binding for the menu maxi role description property.
| StringBinding fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.optionsMenuMaxiTextProperty | ( | ) |
Returns the reactive binding for the menu maxi text property.
| StringBinding fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.optionsMenuMaxiTooltipProperty | ( | ) |
Returns the reactive binding for the menu maxi tooltip property.
| StringBinding fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.optionsMuteAccessibleTextProperty | ( | ) |
Returns the reactive binding for the options mute accessible text property.
| StringBinding fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.optionsMuteIconProperty | ( | ) |
Returns the reactive binding for the options mute icon property.
| StringBinding fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.optionsMuteRoleDescriptionProperty | ( | ) |
Returns the reactive binding for the options mute role description property.
| StringBinding fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.optionsMuteTextProperty | ( | ) |
Returns the reactive binding for the options mute role description property.
| StringBinding fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.optionsMuteTooltipProperty | ( | ) |
Returns the reactive binding for the options mute tooltip property.
| StringBinding fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.optionsOpacityAccessibleTextProperty | ( | ) |
Returns the reactive binding for the options color role description property.
| StringBinding fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.optionsOpacityIconProperty | ( | ) |
Returns the reactive binding for the options opacity icon property.
| StringBinding fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.optionsOpacityRoleDescriptionProperty | ( | ) |
Returns the reactive binding for the options opacity role description property.
| StringBinding fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.optionsOpacityTextProperty | ( | ) |
Returns the reactive binding for the options opacity text property.
| StringBinding fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.optionsOpacityTooltipProperty | ( | ) |
Returns the reactive binding for the options opacity tooltip property.
| StringBinding fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.optionsReduceAccessibleTextProperty | ( | ) |
Returns the reactive binding for the options reduce accessible text property.
| StringBinding fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.optionsReduceTextProperty | ( | ) |
Returns the reactive binding for the options reduce text property.
| StringBinding fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.optionsReduceTooltipProperty | ( | ) |
Returns the reactive binding for the options reduce tooltip property.
| StringBinding fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.optionsRoleDescriptionProperty | ( | ) |
Returns the reactive binding for the options role description property.
| StringBinding fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.optionsSongAccessibleTextProperty | ( | ) |
Returns the reactive binding for the options song accessible text property.
| StringBinding fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.optionsSongRoleDescriptionProperty | ( | ) |
Returns the reactive binding for the options song role description property.
| StringBinding fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.optionsSongTextProperty | ( | ) |
Returns the reactive binding for the options song text property.
| StringBinding fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.optionsSongTooltipProperty | ( | ) |
Returns the reactive binding for the options song tooltip property.
| StringBinding fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.optionsTextProperty | ( | ) |
Returns the reactive binding for the options text property.
| StringBinding fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.optionsTooltipProperty | ( | ) |
Returns the reactive binding for the options tooltip property.
|
private |
Persists the given image path in the current player's OptionsDto if it differs from the existing path, then refreshes the player.
If persisting the path succeeds, the current player is refreshed. If an exception occurs, the error is logged and an error toast is displayed to the user.
| imagePath | the image path to persist; may be empty to indicate no background image |
|
private |
Persists the audio file path (songPath) in the current player's options.
A copy of the current OptionsDto is created with the new path and persisted via OptionsService#updateOptions(OptionsDto). On success, the current player is refreshed, songProperty is updated, and an info toast is shown. On failure, the exception is logged and an error toast with details is displayed.
| absolutePath | the new audio file absolute path |
| name | the file name, used in toast messages |
| void fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.resetSongPath | ( | ) |
Resets the song path by clearing the current selection, persisting the change, and showing a toast notification.
| void fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.restoreCurrentOptions | ( | GridPane | sudokuFX | ) |
Restores the current options from the player state holder and applies them to the provided GridPane.
| sudokuFX | the GridPane to which the options are applied |
| void fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.saveSong | ( | File | file | ) |
Saves the provided song file path to the database and shows a confirmation toast.
The method validates that the file is non-null, exists, and has a supported audio format (MP3, WAV, AAC, M4A, AIF, AIFF). If valid, it updates the database and songProperty; otherwise, it logs an error and shows an error toast via ToasterVBox.
| file | the audio file to save; must not be null, must exist, and be a valid audio file |
| ReadOnlyBooleanProperty fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.songIsBlankProperty | ( | ) |
Returns the read-only boolean property for the song blank state.
| boolean fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.toggleGridOpacityAndPersist | ( | ) |
Toggles the grid opacity mode, persists the new state in the database, updates , and returns the actual updated value.
gridOpacityProperty
On success, an info toast indicates the new state. On failure, the exception is logged, an error toast is shown, and the property is restored to its previous value.
true if opaque mode is now active, false if transparent | void fr.softsf.sudokufx.viewmodel.MenuOptionsViewModel.toggleMuteAndPersist | ( | ) |
Toggles the audio mute state, persists the new value in OptionsDto, updates the AudioService, and reflects the change in muteProperty.
On success, a user-friendly toast indicates the new mute state. On failure, the exception is logged and an error toast with details is displayed.
|
private |
Updates the song display name by extracting the filename from the provided path.
| rawPath | the full file path string; may be blank or null |
|
private |
|
private |
|
private |
|
private |
|
private |
|
static |
|
static |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
private |
|
private |
|
staticprivate |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
private |
|
private |
|
static |
|
private |