refactor(ui): move gapless toggle from player bar to settings
Remove gapless button from NowPlayingBar and place it in SettingsView under Playback section. The toggle is now sensitive to blocking settings: auto-disables when ALSA Direct backend or streaming-only mode is activated. Gapless itself never blocks other settings. Added inline experimental label and descriptive tooltips with proper i18n for all 4 locales.
This commit is contained in:
1 parent
71bfb8dc17
commit
d2531ea700
7 files changed
+64
-84
No files matched your search
@@ -7,7 +7,6 @@
|
||||
SkipForward,
|
||||
Repeat,
|
||||
Repeat1,
|
||||
Disc3,
|
||||
Heart,
|
||||
Plus,
|
||||
Volume2,
|
||||
@@ -73,8 +72,6 @@
|
||||
normalizationEnabled?: boolean;
|
||||
normalizationGain?: number | null;
|
||||
onToggleNormalization?: () => void;
|
||||
gaplessEnabled?: boolean;
|
||||
onToggleGapless?: () => void;
|
||||
}
|
||||
|
||||
let {
|
||||
@@ -120,8 +117,6 @@
|
||||
normalizationEnabled = false,
|
||||
normalizationGain = null,
|
||||
onToggleNormalization,
|
||||
gaplessEnabled = false,
|
||||
onToggleGapless
|
||||
}: Props = $props();
|
||||
|
||||
let progressRef: HTMLDivElement;
|
||||
@@ -279,15 +274,6 @@
|
||||
{/if}
|
||||
</button>
|
||||
|
||||
<button
|
||||
class="control-btn"
|
||||
class:active={gaplessEnabled}
|
||||
onclick={onToggleGapless}
|
||||
title={gaplessEnabled ? $t('player.gaplessOn') : $t('player.gaplessOff')}
|
||||
>
|
||||
<Disc3 size={16} />
|
||||
</button>
|
||||
|
||||
<button class="control-btn" onclick={onAddToPlaylist} title={$t('actions.addToPlaylist')}>
|
||||
<Plus size={16} />
|
||||
</button>
|
||||
|
||||
@@ -590,11 +590,15 @@
|
||||
? 'settings.audio.dacPassthroughDisabledDesc'
|
||||
: null
|
||||
);
|
||||
let gaplessDisabled = $derived(dacPassthrough);
|
||||
let gaplessTooltipOverride = $derived(
|
||||
gaplessDisabled
|
||||
? 'Gapless playback is disabled when DAC Passthrough is enabled. Bit-perfect audio requires recreating streams for each sample rate change.'
|
||||
: null
|
||||
let gaplessDisabled = $derived(
|
||||
selectedBackend === 'ALSA Direct' || streamingOnly
|
||||
);
|
||||
let gaplessDisabledReasonKey = $derived(
|
||||
selectedBackend === 'ALSA Direct'
|
||||
? 'settings.playback.gaplessDisabledAlsa'
|
||||
: streamingOnly
|
||||
? 'settings.playback.gaplessDisabledStreaming'
|
||||
: null
|
||||
);
|
||||
|
||||
// Playback settings
|
||||
@@ -1523,18 +1527,7 @@
|
||||
streamBufferSeconds = settings.stream_buffer_seconds ?? 3;
|
||||
streamingOnly = settings.streaming_only ?? false;
|
||||
limitQualityToDevice = settings.limit_quality_to_device ?? true;
|
||||
|
||||
// Validate mutual exclusion: DAC Passthrough disables Gapless + Crossfade
|
||||
if (dacPassthrough) {
|
||||
if (gaplessPlayback) {
|
||||
console.warn('DAC Passthrough and Gapless both enabled - disabling Gapless');
|
||||
gaplessPlayback = false;
|
||||
}
|
||||
if (crossfade > 0) {
|
||||
console.warn('DAC Passthrough and Crossfade both enabled - disabling Crossfade');
|
||||
crossfade = 0;
|
||||
}
|
||||
}
|
||||
gaplessPlayback = settings.gapless_enabled ?? true;
|
||||
} catch (err) {
|
||||
console.error('Failed to load audio settings:', err);
|
||||
}
|
||||
@@ -1588,13 +1581,6 @@
|
||||
async function handleDacPassthroughChange(enabled: boolean) {
|
||||
dacPassthrough = enabled;
|
||||
|
||||
// Auto-disable incompatible playback settings
|
||||
if (enabled) {
|
||||
gaplessPlayback = false;
|
||||
crossfade = 0;
|
||||
console.log('[Audio] DAC passthrough enabled: disabled gapless playback and crossfade');
|
||||
}
|
||||
|
||||
try {
|
||||
await invoke('set_audio_dac_passthrough', { enabled });
|
||||
|
||||
@@ -1633,6 +1619,15 @@
|
||||
}
|
||||
}
|
||||
|
||||
// Gapless not compatible with ALSA Direct
|
||||
if (backendName === 'ALSA Direct') {
|
||||
if (gaplessPlayback) {
|
||||
gaplessPlayback = false;
|
||||
await invoke('set_audio_gapless_enabled', { enabled: false });
|
||||
console.log('[Audio] Disabled gapless playback (not compatible with ALSA Direct)');
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
// Save backend preference
|
||||
await invoke('set_audio_backend_type', { backendType });
|
||||
@@ -1714,6 +1709,14 @@
|
||||
|
||||
async function handleStreamingOnlyChange(enabled: boolean) {
|
||||
streamingOnly = enabled;
|
||||
|
||||
// Gapless not compatible with streaming-only
|
||||
if (enabled && gaplessPlayback) {
|
||||
gaplessPlayback = false;
|
||||
await invoke('set_audio_gapless_enabled', { enabled: false });
|
||||
console.log('[Audio] Disabled gapless playback (not compatible with streaming-only)');
|
||||
}
|
||||
|
||||
try {
|
||||
await invoke('set_audio_streaming_only', { enabled });
|
||||
console.log('[Audio] Streaming-only mode changed:', enabled);
|
||||
@@ -1759,20 +1762,11 @@
|
||||
|
||||
async function handleGaplessPlaybackChange(enabled: boolean) {
|
||||
gaplessPlayback = enabled;
|
||||
|
||||
// Auto-disable DAC passthrough if incompatible
|
||||
if (enabled && dacPassthrough) {
|
||||
dacPassthrough = false;
|
||||
console.log('[Audio] Gapless playback enabled: disabled DAC passthrough');
|
||||
try {
|
||||
await invoke('set_audio_dac_passthrough', { enabled: false });
|
||||
|
||||
// Reinitialize audio with currently selected device
|
||||
const deviceName = getCurrentDeviceSinkName();
|
||||
await reinitAndResume(deviceName);
|
||||
} catch (err) {
|
||||
console.error('[Audio] Failed to disable DAC passthrough:', err);
|
||||
}
|
||||
try {
|
||||
await invoke('set_audio_gapless_enabled', { enabled });
|
||||
console.log('[Audio] Gapless playback changed:', enabled);
|
||||
} catch (err) {
|
||||
console.error('[Audio] Failed to change gapless playback:', err);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2419,17 +2413,15 @@
|
||||
</div>
|
||||
<Toggle enabled={showContextIcon} onchange={handleShowContextIconChange} />
|
||||
</div>
|
||||
<!-- Gapless, Crossfade, Normalize Volume hidden until properly implemented (see issue #29) -->
|
||||
<!-- <div class="setting-row">
|
||||
<div class="setting-row">
|
||||
<div class="setting-info">
|
||||
<span class="setting-label">{$t('settings.playback.gapless')}</span>
|
||||
{#if gaplessTooltipOverride}
|
||||
<span class="setting-desc">{gaplessTooltipOverride}</span>
|
||||
{/if}
|
||||
<span class="setting-label">{$t('settings.playback.gapless')} <span class="experimental-inline">{$t('settings.playback.experimental')}</span></span>
|
||||
<span class="setting-desc">{gaplessDisabledReasonKey ? $t(gaplessDisabledReasonKey) : $t('settings.playback.gaplessDesc')}</span>
|
||||
</div>
|
||||
<Toggle enabled={gaplessPlayback} onchange={handleGaplessPlaybackChange} disabled={gaplessDisabled} />
|
||||
</div>
|
||||
<div class="setting-row">
|
||||
<!-- Crossfade, Normalize Volume hidden until properly implemented (see issue #29) -->
|
||||
<!-- <div class="setting-row">
|
||||
<span class="setting-label">{$t('settings.playback.crossfade')}</span>
|
||||
<div class="slider-container">
|
||||
<VolumeSlider value={crossfade} onchange={handleCrossfadeChange} max={12} showValue />
|
||||
@@ -3613,6 +3605,15 @@ flatpak override --user --filesystem=/home/USUARIO/Música com.blitzfc.qbz</pre>
|
||||
border: 1px solid rgba(239, 68, 68, 0.3);
|
||||
}
|
||||
|
||||
.experimental-inline {
|
||||
font-size: 10px;
|
||||
font-weight: 600;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.3px;
|
||||
color: var(--text-muted);
|
||||
opacity: 0.7;
|
||||
}
|
||||
|
||||
.setup-guide-btn {
|
||||
margin-left: auto;
|
||||
padding: 6px 12px;
|
||||
|
||||
@@ -369,8 +369,6 @@
|
||||
"repeatAll": "Alles wiederholen",
|
||||
"repeatOne": "Einen wiederholen",
|
||||
"repeatOff": "Wiederholung aus",
|
||||
"gaplessOn": "Lückenlos: Ein",
|
||||
"gaplessOff": "Lückenlos: Aus",
|
||||
"previous": "Vorherige",
|
||||
"next": "Nächste",
|
||||
"play": "Abspielen",
|
||||
@@ -543,6 +541,10 @@
|
||||
"playback": {
|
||||
"title": "Wiedergabe",
|
||||
"gapless": "Lückenlose Wiedergabe",
|
||||
"gaplessDesc": "Nahtlose Übergänge zwischen gecachten Titeln mit gleichem Format",
|
||||
"gaplessDisabledAlsa": "Nicht verfügbar mit ALSA Direct-Backend",
|
||||
"gaplessDisabledStreaming": "Nicht verfügbar im Nur-Streaming-Modus",
|
||||
"experimental": "experimentell",
|
||||
"crossfade": "Überblenden",
|
||||
"crossfadeSeconds": "{seconds}s",
|
||||
"normalizeVolume": "Lautstärke normalisieren",
|
||||
|
||||
@@ -383,8 +383,6 @@
|
||||
"repeatAll": "Repeat All",
|
||||
"repeatOne": "Repeat One",
|
||||
"repeatOff": "Repeat Off",
|
||||
"gaplessOn": "Gapless: On",
|
||||
"gaplessOff": "Gapless: Off",
|
||||
"previous": "Previous",
|
||||
"next": "Next",
|
||||
"play": "Play",
|
||||
@@ -561,6 +559,10 @@
|
||||
"playback": {
|
||||
"title": "Playback",
|
||||
"gapless": "Gapless Playback",
|
||||
"gaplessDesc": "Seamless transitions between cached tracks with matching format",
|
||||
"gaplessDisabledAlsa": "Not available with ALSA Direct backend",
|
||||
"gaplessDisabledStreaming": "Not available in streaming-only mode",
|
||||
"experimental": "experimental",
|
||||
"crossfade": "Crossfade",
|
||||
"crossfadeSeconds": "{seconds}s",
|
||||
"normalizeVolume": "Normalize Volume",
|
||||
|
||||
@@ -383,8 +383,6 @@
|
||||
"repeatAll": "Repetir Todo",
|
||||
"repeatOne": "Repetir Una",
|
||||
"repeatOff": "No Repetir",
|
||||
"gaplessOn": "Sin pausas: Activado",
|
||||
"gaplessOff": "Sin pausas: Desactivado",
|
||||
"previous": "Anterior",
|
||||
"next": "Siguiente",
|
||||
"play": "Reproducir",
|
||||
@@ -561,6 +559,10 @@
|
||||
"playback": {
|
||||
"title": "Reproducción",
|
||||
"gapless": "Reproducción Sin Pausas",
|
||||
"gaplessDesc": "Transiciones sin cortes entre pistas en caché con formato compatible",
|
||||
"gaplessDisabledAlsa": "No disponible con el backend ALSA Direct",
|
||||
"gaplessDisabledStreaming": "No disponible en modo solo streaming",
|
||||
"experimental": "experimental",
|
||||
"crossfade": "Crossfade",
|
||||
"crossfadeSeconds": "{seconds}s",
|
||||
"normalizeVolume": "Normalizar Volumen",
|
||||
|
||||
@@ -369,8 +369,6 @@
|
||||
"repeatAll": "Répéter tout",
|
||||
"repeatOne": "Répéter un",
|
||||
"repeatOff": "Répéter désactivé",
|
||||
"gaplessOn": "Sans coupure : Activé",
|
||||
"gaplessOff": "Sans coupure : Désactivé",
|
||||
"previous": "Précédent",
|
||||
"next": "Suivant",
|
||||
"play": "Lecture",
|
||||
@@ -543,6 +541,10 @@
|
||||
"playback": {
|
||||
"title": "Lecture",
|
||||
"gapless": "Lecture sans interruption",
|
||||
"gaplessDesc": "Transitions fluides entre les pistes en cache avec un format compatible",
|
||||
"gaplessDisabledAlsa": "Non disponible avec le backend ALSA Direct",
|
||||
"gaplessDisabledStreaming": "Non disponible en mode streaming uniquement",
|
||||
"experimental": "expérimental",
|
||||
"crossfade": "Fondu enchaîné",
|
||||
"crossfadeSeconds": "{seconds}s",
|
||||
"normalizeVolume": "Normaliser le volume",
|
||||
|
||||
+2
-17
@@ -535,8 +535,6 @@
|
||||
let isFavorite = $state(false);
|
||||
let normalizationEnabled = $state(false);
|
||||
let normalizationGain = $state<number | null>(null);
|
||||
let gaplessEnabled = $state(true);
|
||||
|
||||
// Queue/Shuffle State (from queueStore subscription)
|
||||
let isShuffle = $state(false);
|
||||
let repeatMode = $state<RepeatMode>('off');
|
||||
@@ -1397,16 +1395,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
async function toggleGapless() {
|
||||
const newState = !gaplessEnabled;
|
||||
try {
|
||||
await invoke('set_audio_gapless_enabled', { enabled: newState });
|
||||
gaplessEnabled = newState;
|
||||
} catch (err) {
|
||||
console.error('Failed to toggle gapless:', err);
|
||||
}
|
||||
}
|
||||
|
||||
// Add to Playlist handler for Now Playing track
|
||||
function openAddToPlaylistModal() {
|
||||
if (!currentTrack) return;
|
||||
@@ -2555,10 +2543,9 @@
|
||||
// Ignore storage errors
|
||||
}
|
||||
|
||||
// Load normalization + gapless enabled state from audio settings
|
||||
invoke<{ normalization_enabled: boolean; gapless_enabled: boolean }>('get_audio_settings').then((settings) => {
|
||||
// Load normalization enabled state from audio settings
|
||||
invoke<{ normalization_enabled: boolean }>('get_audio_settings').then((settings) => {
|
||||
normalizationEnabled = settings.normalization_enabled;
|
||||
gaplessEnabled = settings.gapless_enabled;
|
||||
}).catch((err) => {
|
||||
console.error('Failed to load audio settings:', err);
|
||||
});
|
||||
@@ -3418,8 +3405,6 @@
|
||||
{normalizationEnabled}
|
||||
{normalizationGain}
|
||||
onToggleNormalization={toggleNormalization}
|
||||
{gaplessEnabled}
|
||||
onToggleGapless={toggleGapless}
|
||||
onTrackClick={() => {
|
||||
if (currentTrack && !currentTrack.isLocal) {
|
||||
trackInfoTrackId = currentTrack.id;
|
||||
|
||||
Reference in new issue
Block a user