Compare commits

..

2 commits

Author SHA1 Message Date
marwy
5c6a8557b3 chore(release): v0.1.7 2026-11-27 19:55:53 +03:00
marwy
b315b212a4 fix: 1-to-1 official equalizer, settings, animations, and click-outside dismissal 2026-11-27 19:54:12 +03:00
12 changed files with 934 additions and 563 deletions

2
Cargo.lock generated
View file

@ -6550,7 +6550,7 @@ checksum = "ec7a2a501ed189703dba8b08142f057e887dfc4b2cc4db2d343ac6376ba3e0b9"
[[package]]
name = "yandex-music-rs"
version = "0.1.6"
version = "0.1.7"
dependencies = [
"aes",
"anyhow",

View file

@ -1,6 +1,6 @@
[package]
name = "yandex-music-rs"
version = "0.1.6"
version = "0.1.7"
edition = "2021"
description = "Native high-performance, ultra-low-RAM Yandex Music desktop client in Rust + ash Vulkan SDF + taffy + cosmic-text"

View file

@ -10,12 +10,12 @@
Готовые сборки доступны на странице [Releases](https://git.tatar/marwy/yandex-music-rs/releases):
- **Windows (x64)**: скачайте `yandex-music-rs-v0.1.6-windows-x86_64.exe` и запустите (переносной файл, установка не требуется).
- **Linux (Debian / Ubuntu x64)**: скачайте `yandex-music-rs_0.1.6-1_amd64.deb` и установите:
- **Windows (x64)**: скачайте `yandex-music-rs-v0.1.7-windows-x86_64.exe` и запустите (переносной файл, установка не требуется).
- **Linux (Debian / Ubuntu x64)**: скачайте `yandex-music-rs_0.1.7-1_amd64.deb` и установите:
```bash
sudo apt install ./yandex-music-rs_0.1.6-1_amd64.deb
sudo apt install ./yandex-music-rs_0.1.7-1_amd64.deb
```
- **Linux (generic x64)**: архив `yandex-music-rs-v0.1.6-linux-x86_64.tar.gz` с готовыми бинарниками (`yandex-music-rs` + `yandex-music-auth`).
- **Linux (generic x64)**: архив `yandex-music-rs-v0.1.7-linux-x86_64.tar.gz` с готовыми бинарниками (`yandex-music-rs` + `yandex-music-auth`).
## Стек и возможности

View file

@ -380,6 +380,7 @@ pub enum AppAction {
SetCloseToTray(bool),
UpdateEq {
enabled: bool,
preamp: f32,
bands: [f32; 10],
},
SetMaxCoverCache(usize),
@ -629,6 +630,7 @@ impl AppState {
config.volume,
config.muted,
config.eq_enabled,
config.eq_preamp,
config.eq_bands_db,
config.normalize_loudness,
config.crossfade_enabled,
@ -803,6 +805,7 @@ impl AppState {
config.volume,
config.muted,
config.eq_enabled,
config.eq_preamp,
config.eq_bands_db,
);
audio.state.position_ms.store(position_ms, Ordering::SeqCst);
@ -3127,10 +3130,16 @@ impl AppState {
self.config.close_to_tray = v;
self.save_config();
}
AppAction::UpdateEq { enabled, bands } => {
AppAction::UpdateEq {
enabled,
preamp,
bands,
} => {
let preamp = preamp.clamp(0.5, 1.5);
self.config.eq_enabled = enabled;
self.config.eq_preamp = preamp;
self.config.eq_bands_db = bands;
self.audio.set_eq(enabled, bands);
self.audio.set_eq(enabled, preamp, bands);
self.save_config();
}
AppAction::SetMaxCoverCache(cap) => {

View file

@ -38,12 +38,12 @@ pub const EQ_PRESETS: &[EqPreset] = &[
},
EqPreset {
name_ru: "Клубная музыка",
name_en: "Club Music",
name_en: "Club music",
gains: [-0.5, -0.5, 4.0, 2.5, 2.5, 2.5, 1.5, -0.5, -0.5, -0.5],
},
EqPreset {
name_ru: "Танцевальная музыка",
name_en: "Dance Music",
name_en: "Dance music",
gains: [4.5, 3.5, 1.0, -0.5, -0.5, -2.5, -3.5, -3.5, -0.5, -0.5],
},
EqPreset {
@ -62,8 +62,8 @@ pub const EQ_PRESETS: &[EqPreset] = &[
gains: [-4.5, -4.5, -4.5, -2.0, 1.0, 5.5, 8.0, 8.0, 8.0, 8.0],
},
EqPreset {
name_ru: "Колонки",
name_en: "Speakers",
name_ru: "Колонки ноутбука",
name_en: "Laptop speakers",
gains: [2.0, 5.5, 2.5, -1.5, -1.0, 0.5, 2.0, 4.5, 6.0, 7.0],
},
EqPreset {
@ -73,12 +73,12 @@ pub const EQ_PRESETS: &[EqPreset] = &[
},
EqPreset {
name_ru: "Концерт",
name_en: "Concert",
name_en: "Live",
gains: [-2.0, -0.5, 2.0, 2.5, 2.5, 2.5, 2.0, 1.0, 1.0, 1.0],
},
EqPreset {
name_ru: "Вечеринка",
name_en: "Party",
name_en: "Partying",
gains: [3.5, 3.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, 3.5, 3.5],
},
EqPreset {
@ -102,13 +102,13 @@ pub const EQ_PRESETS: &[EqPreset] = &[
gains: [-1.0, -2.0, -2.0, -0.5, 2.0, 2.5, 4.0, 4.5, 5.5, 4.5],
},
EqPreset {
name_ru: "Мягкая музыка",
name_en: "Soft Music",
name_ru: "Мягкое звучание",
name_en: "Soft",
gains: [2.0, 0.5, -0.5, -1.0, -0.5, 2.0, 4.0, 4.5, 5.5, 6.0],
},
EqPreset {
name_ru: "Софт-рок",
name_en: "Soft Rock",
name_en: "Soft rock",
gains: [2.0, 2.0, 1.0, -0.5, -2.0, -2.5, -1.5, -0.5, 1.0, 4.0],
},
EqPreset {
@ -129,9 +129,9 @@ pub fn active_eq_preset_name(bands: &[f32; 10], ru: bool) -> &'static str {
}
}
if ru {
"Свой"
"Своя настройка"
} else {
"Custom"
"Custom settings"
}
}
@ -264,6 +264,7 @@ impl Biquad {
pub struct Equalizer10Band {
bands: [Biquad; 10],
enabled: bool,
preamp: f32,
sample_rate: f32,
gains_db: [f32; 10],
}
@ -273,13 +274,15 @@ impl Equalizer10Band {
Self {
bands: [Biquad::identity(); 10],
enabled: false,
preamp: 1.0,
sample_rate,
gains_db: [0.0; 10],
}
}
pub fn update(&mut self, enabled: bool, gains_db: [f32; 10]) {
pub fn update(&mut self, enabled: bool, preamp: f32, gains_db: [f32; 10]) {
self.enabled = enabled;
self.preamp = preamp.clamp(0.5, 1.5);
if self.gains_db != gains_db {
self.gains_db = gains_db;
for i in 0..10 {
@ -299,6 +302,8 @@ impl Equalizer10Band {
if !self.enabled {
return (l, r);
}
l *= self.preamp;
r *= self.preamp;
for band in &mut self.bands {
(l, r) = band.process_stereo(l, r);
}
@ -364,14 +369,19 @@ mod tests {
assert_eq!(EQ_FREQS[9], 16000.0);
assert_eq!(active_eq_preset_name(&EQ_PRESETS[0].gains, true), "По умолчанию");
assert_eq!(active_eq_preset_name(&EQ_PRESETS[13].gains, false), "Rock");
assert_eq!(active_eq_preset_name(&[1.2; 10], true), "Свой");
assert_eq!(active_eq_preset_name(&[1.2; 10], true), "Своя настройка");
assert_eq!(active_eq_preset_name(&[1.2; 10], false), "Custom settings");
let mut eq = Equalizer10Band::new(48_000.0);
eq.update(true, EQ_PRESETS[5].gains);
eq.update(true, 1.25, EQ_PRESETS[5].gains);
for i in 0..1024 {
let s = (i as f32 * 0.1).sin() * 0.5;
let (l, r) = eq.process(s, -s);
assert!(l.is_finite() && r.is_finite());
}
let mut eq_pre = Equalizer10Band::new(48_000.0);
eq_pre.update(true, 0.5, [0.0; 10]);
let (pl, pr) = eq_pre.process(0.4, -0.4);
assert!((pl - 0.2).abs() < 1e-4 && (pr + 0.2).abs() < 1e-4);
}
}

View file

@ -71,6 +71,7 @@ pub struct SharedAudioState {
pub energy_bits: AtomicU32,
pub bass_bits: AtomicU32,
pub eq_enabled: AtomicBool,
pub eq_preamp_bits: AtomicU32,
pub eq_bands: Mutex<[f32; 10]>,
pub active_codec: Mutex<String>,
pub output_device_name: Mutex<String>,
@ -83,6 +84,7 @@ impl SharedAudioState {
volume: f32,
muted: bool,
eq_enabled: bool,
eq_preamp: f32,
eq_bands: [f32; 10],
normalize_loudness: bool,
crossfade_enabled: bool,
@ -105,6 +107,7 @@ impl SharedAudioState {
energy_bits: AtomicU32::new(0.0f32.to_bits()),
bass_bits: AtomicU32::new(0.0f32.to_bits()),
eq_enabled: AtomicBool::new(eq_enabled),
eq_preamp_bits: AtomicU32::new(eq_preamp.clamp(0.5, 1.5).to_bits()),
eq_bands: Mutex::new(eq_bands),
active_codec: Mutex::new("FLAC / WASAPI".into()),
output_device_name: Mutex::new("Системное устройство (WASAPI)".into()),
@ -170,6 +173,7 @@ impl AudioEngine {
volume: f32,
muted: bool,
eq_enabled: bool,
eq_preamp: f32,
eq_bands: [f32; 10],
normalize_loudness: bool,
crossfade_enabled: bool,
@ -179,6 +183,7 @@ impl AudioEngine {
volume,
muted,
eq_enabled,
eq_preamp,
eq_bands,
normalize_loudness,
crossfade_enabled,
@ -200,9 +205,15 @@ impl AudioEngine {
}
/// Silent, thread-free audio engine for deterministic headless visual tests.
pub fn new_headless(volume: f32, muted: bool, eq_enabled: bool, eq_bands: [f32; 10]) -> Self {
pub fn new_headless(
volume: f32,
muted: bool,
eq_enabled: bool,
eq_preamp: f32,
eq_bands: [f32; 10],
) -> Self {
let state = Arc::new(SharedAudioState::new(
volume, muted, eq_enabled, eq_bands, true, false, 0.0,
volume, muted, eq_enabled, eq_preamp, eq_bands, true, false, 0.0,
));
let (tx_cmd, _rx_cmd) = unbounded();
Self {
@ -358,8 +369,11 @@ impl AudioEngine {
.store(secs.clamp(0.0, 12.0).to_bits(), Ordering::Relaxed);
}
pub fn set_eq(&self, enabled: bool, bands: [f32; 10]) {
pub fn set_eq(&self, enabled: bool, preamp: f32, bands: [f32; 10]) {
self.state.eq_enabled.store(enabled, Ordering::Relaxed);
self.state
.eq_preamp_bits
.store(preamp.clamp(0.5, 1.5).to_bits(), Ordering::Relaxed);
*self.state.eq_bands.lock() = bands;
}
@ -1025,8 +1039,10 @@ fn run_audio_worker(rx_cmd: Receiver<AudioCommand>, state: Arc<SharedAudioState>
let gain = vol;
let eq_on = state_cb.eq_enabled.load(Ordering::Relaxed);
let preamp = f32::from_bits(state_cb.eq_preamp_bits.load(Ordering::Relaxed))
.clamp(0.5, 1.5);
if let Some(bands) = state_cb.eq_bands.try_lock() {
eq.update(eq_on, *bands);
eq.update(eq_on, preamp, *bands);
}
if !playing {
@ -1465,7 +1481,7 @@ mod tests {
#[test]
fn seek_seq_prevents_stale_decoder_position_overwrite() {
let engine = AudioEngine::new_headless(0.8, false, false, [0.0; 10]);
let engine = AudioEngine::new_headless(0.8, false, false, 1.0, [0.0; 10]);
// Initial playback at seq 0 publishes normally.
assert!(publish_decoder_position_ms(&engine.state, 0, 30_000));
@ -1524,7 +1540,7 @@ mod tests {
#[test]
fn stop_bumps_seek_seq_preventing_old_decoder_overwrite() {
let engine = AudioEngine::new_headless(0.8, false, false, [0.0; 10]);
let engine = AudioEngine::new_headless(0.8, false, false, 1.0, [0.0; 10]);
assert!(publish_decoder_position_ms(&engine.state, 0, 45_000));
engine.stop();
assert_eq!(engine.state.position_ms.load(Ordering::Acquire), 0);

View file

@ -152,7 +152,9 @@ pub struct AppConfig {
pub muted: bool,
pub sidebar_collapsed: bool,
pub eq_enabled: bool,
pub eq_bands_db: [f32; 10], // 32, 64, 125, 250, 500, 1k, 2k, 4k, 8k, 16k Hz
#[serde(default = "default_eq_preamp")]
pub eq_preamp: f32,
pub eq_bands_db: [f32; 10], // 60, 170, 310, 600, 1k, 3k, 6k, 12k, 14k, 16k Hz
pub normalize_loudness: bool,
#[serde(default = "default_true")]
pub crossfade_enabled: bool,
@ -195,6 +197,10 @@ fn default_true() -> bool {
true
}
fn default_eq_preamp() -> f32 {
1.0
}
impl Default for AppConfig {
fn default() -> Self {
Self {
@ -206,6 +212,7 @@ impl Default for AppConfig {
muted: false,
sidebar_collapsed: false,
eq_enabled: false,
eq_preamp: 1.0,
eq_bands_db: [0.0; 10],
normalize_loudness: true,
crossfade_enabled: true,

View file

@ -554,6 +554,36 @@ impl InputState {
}
}
/// Consume the current pointer press (`active_id = None`, `left_pressed = false`,
/// `right_pressed = false`) so releasing over an underlying widget cannot trigger a click/drag.
pub fn consume_pointer_press(&mut self) {
self.active_id = None;
self.left_pressed = false;
self.right_pressed = false;
}
/// Like `clicked_outside`, but also consumes the dismissing press (`active_id = None`,
/// `left_pressed = false`, `right_pressed = false`) so releasing over an underlying
/// toggle trigger button (e.g. PlayerBar EQ button) can NEVER re-open the overlay.
pub fn consume_clicked_outside(&mut self, rect: Rect) -> bool {
if self.clicked_outside(rect) {
self.consume_pointer_press();
true
} else {
false
}
}
/// Multi-rect variant of `consume_clicked_outside`.
pub fn consume_clicked_outside_any(&mut self, rects: &[Rect]) -> bool {
if self.clicked_outside_any(rects) {
self.consume_pointer_press();
true
} else {
false
}
}
pub fn key_pressed(&self, key: Key) -> bool {
self.key_events.iter().any(|e| e.key == key)
}
@ -694,3 +724,47 @@ impl Animator {
self.values.clear();
}
}
#[cfg(test)]
mod tests {
use super::*;
use winit::dpi::PhysicalPosition;
#[test]
fn test_consume_clicked_outside_prevents_trigger_reopen_on_release() {
let mut input = InputState::new();
let screen = Vec2::new(1280.0, 800.0);
let trigger_id = WidgetId::new("pb_r_eq");
let trigger_r = Rect::from_xywh(1000.0, 740.0, 36.0, 36.0);
let pop_r = Rect::from_xywh(800.0, 400.0, 430.0, 300.0);
// Frame 1: Mouse down on the underlying trigger button while popover is open.
input.begin_frame(screen, 1.0, 1.0);
input.handle_winit_event(&WindowEvent::CursorMoved {
device_id: unsafe { std::mem::zeroed() },
position: PhysicalPosition::new(1018.0, 758.0),
});
input.handle_winit_event(&WindowEvent::MouseInput {
device_id: unsafe { std::mem::zeroed() },
state: ElementState::Pressed,
button: MouseButton::Left,
});
let press_resp = input.interact(trigger_id, ZLayer::Base, trigger_r, None);
assert!(!press_resp.clicked);
assert!(input.consume_clicked_outside(pop_r));
assert!(input.active_id.is_none());
input.end_frame();
// Frame 2: Mouse up over the same trigger button — MUST NOT fire clicked!
input.begin_frame(screen, 1.0, 1.05);
input.handle_winit_event(&WindowEvent::MouseInput {
device_id: unsafe { std::mem::zeroed() },
state: ElementState::Released,
button: MouseButton::Left,
});
let rel_resp = input.interact(trigger_id, ZLayer::Base, trigger_r, None);
assert!(!rel_resp.clicked);
input.end_frame();
}
}

View file

@ -539,8 +539,38 @@ impl YandexMusicShell {
}
// 6. Floating Popovers & Context Menus (ZLayer::Popover)
if self.app.eq_popover_open {
render_eq_popover(&mut self.ui, &pal, &self.app, &mut self.shell, &mut actions);
let ease_out = |t: f32| -> f32 {
let u = 1.0 - t.clamp(0.0, 1.0);
1.0 - u * u * u
};
let eq_pop_t = if self.app.fixed_vibe_time.is_some() {
if self.app.eq_popover_open { 1.0 } else { 0.0 }
} else {
ease_out(self.ui.animate_bool(
WidgetId::new("ym_quality_popover_anim"),
self.app.eq_popover_open,
0.18,
))
};
let eq_expand_t = if self.app.fixed_vibe_time.is_some() {
if self.app.config.eq_enabled { 1.0 } else { 0.0 }
} else {
ease_out(self.ui.animate_bool(
WidgetId::new("ym_quality_eq_expand"),
self.app.config.eq_enabled,
0.20,
))
};
if eq_pop_t > 0.01 {
render_eq_popover(
&mut self.ui,
&pal,
&self.app,
&mut self.shell,
eq_pop_t,
eq_expand_t,
&mut actions,
);
}
render_track_context_menu(&mut self.ui, &pal, &self.app, &mut self.shell, &mut actions);
render_entity_context_menu(&mut self.ui, &pal, &self.app, &mut self.shell, &mut actions);
@ -563,14 +593,48 @@ impl YandexMusicShell {
if self.app.track_detail_modal.is_some() {
render_track_detail_modal(&mut self.ui, &pal, &mut self.covers, &self.app, &mut actions);
}
if self.app.release_notes_modal_open {
render_release_notes_modal(&mut self.ui, &pal, &self.app, &mut actions);
let rn_mod_t = if self.app.fixed_vibe_time.is_some() {
if self.app.release_notes_modal_open { 1.0 } else { 0.0 }
} else {
ease_out(self.ui.animate_bool(
WidgetId::new("ym_release_notes_modal_anim"),
self.app.release_notes_modal_open,
0.18,
))
};
if rn_mod_t > 0.01 {
render_release_notes_modal(&mut self.ui, &pal, &self.app, rn_mod_t, &mut actions);
}
if self.app.equalizer_modal_open {
render_equalizer_modal(&mut self.ui, &pal, &self.app, &mut self.shell, &mut actions);
let eq_mod_t = if self.app.fixed_vibe_time.is_some() {
if self.app.equalizer_modal_open { 1.0 } else { 0.0 }
} else {
ease_out(self.ui.animate_bool(
WidgetId::new("ym_eq_modal_anim"),
self.app.equalizer_modal_open,
0.18,
))
};
if eq_mod_t > 0.01 {
render_equalizer_modal(
&mut self.ui,
&pal,
&self.app,
&mut self.shell,
eq_mod_t,
&mut actions,
);
}
if self.app.shortcuts_modal_open {
render_shortcuts_modal(&mut self.ui, &pal, &self.app, &mut actions);
let sc_mod_t = if self.app.fixed_vibe_time.is_some() {
if self.app.shortcuts_modal_open { 1.0 } else { 0.0 }
} else {
ease_out(self.ui.animate_bool(
WidgetId::new("ym_shortcuts_modal_anim"),
self.app.shortcuts_modal_open,
0.18,
))
};
if sc_mod_t > 0.01 {
render_shortcuts_modal(&mut self.ui, &pal, &self.app, sc_mod_t, &mut actions);
}
// 8. Transparent 32px Floating TitleBar (ZLayer::Titlebar)

File diff suppressed because it is too large Load diff

View file

@ -1,6 +1,5 @@
use crate::app::i18n::APP_VERSION;
use crate::app::state::{AppAction, AppState};
use crate::audio::dsp::active_eq_preset_name;
use crate::config::{AudioQuality, Language, ThemeMode};
use crate::covers::CoverCache;
use crate::engine::input::WidgetId;
@ -34,7 +33,7 @@ pub fn render_settings(
// `views/mod.rs` already insets `inner_r` by (25, 12, 25, 0)
let x = rect.left();
let col_w = (rect.width() - 12.0).clamp(320.0, 520.0);
let col_w = (rect.width() - 12.0).clamp(320.0, 482.0);
let mut y = rect.top() + 8.0 - scroll_y;
// Page Heading
@ -176,31 +175,53 @@ pub fn render_settings(
y += 18.0;
// -------------------------------------------------------------------------
// 2. Official Settings List (`Settings_root`, 24px vertical spacing)
// 2. Official Settings List (`Settings_root`, 32px vertical spacing)
// -------------------------------------------------------------------------
// 2a. Sound quality (`QualitySettingsModal` trigger)
// 2a. Clear memory (`offline.clear-memory`)
if settings_button_item(
ctx,
pal,
WidgetId::new("set_clear_cache"),
x,
&mut y,
col_w,
if ru { "Очистить память" } else { "Clear cache" },
Some(if ru {
"Удалим только скачанное и кэш. Это не повлияет на ваши рекомендации и лайки"
} else {
"We'll only delete downloaded content and cache. This won't affect your recommendations or likes"
}),
None,
) {
actions.push(AppAction::ClearCoverCache);
}
// 2b. Equalizer (`EqualizerModal` trigger — clean row, no status subtitle)
if settings_button_item(
ctx,
pal,
WidgetId::new("set_eq_btn"),
x,
&mut y,
col_w,
if ru { "Эквалайзер" } else { "Equalizer" },
None,
None,
) {
actions.push(AppAction::SetEqualizerModalOpen(true));
}
// 2c. Sound settings (`QualitySettingsModal` trigger)
let qual_sub = match app.config.audio_quality {
AudioQuality::Lossless => {
if ru {
"Максимальное · FLAC без потерь"
} else {
"Maximum · Lossless FLAC"
}
if ru { "Превосходное" } else { "Superb" }
}
AudioQuality::High => {
if ru {
"Оптимальное · 320 кбит/с"
} else {
"Optimal · 320 kbps"
}
if ru { "Оптимальное" } else { "Balanced" }
}
AudioQuality::Standard => {
if ru {
"Экономичное"
} else {
"Efficient"
}
if ru { "Экономичное" } else { "Efficient" }
}
};
if settings_button_item(
@ -217,34 +238,7 @@ pub fn render_settings(
actions.push(AppAction::SetEqPopoverOpen(true));
}
// 2b. Equalizer (`EqualizerModal` trigger)
let eq_sub = if app.config.eq_enabled {
let preset_name = active_eq_preset_name(&app.config.eq_bands_db, ru);
if ru {
format!("Включён · {}", preset_name)
} else {
format!("Enabled · {}", preset_name)
}
} else if ru {
"Выключен".to_string()
} else {
"Disabled".to_string()
};
if settings_button_item(
ctx,
pal,
WidgetId::new("set_eq_btn"),
x,
&mut y,
col_w,
if ru { "Эквалайзер" } else { "Equalizer" },
Some(&eq_sub),
None,
) {
actions.push(AppAction::SetEqualizerModalOpen(true));
}
// 2c. Crossfade between tracks (toggle + optional duration override)
// 2d. Crossfade between tracks (toggle + optional duration override)
let cf_sub = if app.config.crossfade_enabled {
if app.config.crossfade_secs < 0.1 {
if ru {
@ -392,30 +386,6 @@ pub fn render_settings(
actions.push(AppAction::SetCloseToTray(next));
}
// 2h. Clear cover cache
let cache_sub = if ru {
format!("В кэше: {} обложек", covers.len())
} else {
format!("Cached items: {}", covers.len())
};
if settings_button_item(
ctx,
pal,
WidgetId::new("set_clear_cache"),
x,
&mut y,
col_w,
if ru {
"Очистить кэш обложек"
} else {
"Clear cover cache"
},
Some(&cache_sub),
None,
) {
actions.push(AppAction::ClearCoverCache);
}
// 2i. Keyboard shortcuts (`ShortcutsModal` trigger)
if settings_button_item(
ctx,
@ -424,17 +394,38 @@ pub fn render_settings(
x,
&mut y,
col_w,
if ru {
"Горячие клавиши"
} else {
"Keyboard shortcuts"
},
if ru { "Горячие клавиши" } else { "Hot keys" },
None,
None,
) {
actions.push(AppAction::SetShortcutsModalOpen(true));
}
// 2j. About (`ReleaseNotesModal` trigger)
let about_sub = if let Some(ref upd) = app.available_update {
format!("v{} · {}", APP_VERSION, t.update_available_banner(&upd.version))
} else {
format!("v{}", APP_VERSION)
};
let about_badge_col = if app.available_update.is_some() {
Some(pal.yellow)
} else {
None
};
if settings_button_item(
ctx,
pal,
WidgetId::new("set_about_btn"),
x,
&mut y,
col_w,
if ru { "О приложении" } else { "About the app" },
Some(&about_sub),
about_badge_col,
) {
actions.push(AppAction::OpenReleaseNotesModal);
}
// 2j. Appearance & Language (compact official pill selectors)
ctx.draw_text_ellipsis(
t.appearance(),
@ -496,34 +487,9 @@ pub fn render_settings(
.push_rect(Rect::from_xywh(x, y, col_w, 1.0), 0.0, pal.border_subtle);
y += 18.0;
// -------------------------------------------------------------------------
// 3. About & Updates (`ReleaseNotesModal` + Update CTA)
// -------------------------------------------------------------------------
let about_sub = if let Some(ref upd) = app.available_update {
format!("v{} · {}", APP_VERSION, t.update_available_banner(&upd.version))
} else if ru {
format!("Версия {} · {}", APP_VERSION, t.up_to_date_badge())
} else {
format!("Version {} · {}", APP_VERSION, t.up_to_date_badge())
};
let about_badge_col = if app.available_update.is_some() {
Some(pal.yellow)
} else {
None
};
if settings_button_item(
ctx,
pal,
WidgetId::new("set_about_btn"),
x,
&mut y,
col_w,
if ru { "О приложении" } else { "About" },
Some(&about_sub),
about_badge_col,
) {
actions.push(AppAction::OpenReleaseNotesModal);
}
ctx.dl()
.push_rect(Rect::from_xywh(x, y, col_w, 1.0), 0.0, pal.border_subtle);
y += 18.0;
if let Some(ref upd) = app.available_update {
let banner_r = Rect::from_xywh(x, y - 6.0, col_w, 54.0);
@ -638,8 +604,8 @@ pub fn render_settings(
}
/// Official `SettingsListButtonItem` (`29c95960ed6ac633.css:74-119`):
/// Borderless row with bold 16px title, optional 13px subtitle, and right-aligned `arrowRight` chevron
/// that glides +4px right on hover.
/// Borderless row with NO hover background fill — 16px title, optional wrapped 14px description,
/// and right-aligned `arrowRight` chevron that glides +6px right on hover.
#[allow(clippy::too_many_arguments)]
fn settings_button_item(
ctx: &mut UiContext,
@ -652,44 +618,47 @@ fn settings_button_item(
description: Option<&str>,
dot_color: Option<Color>,
) -> bool {
let row_h = if description.is_some() { 44.0 } else { 28.0 };
let hit_r = Rect::from_xywh(x - 8.0, *y - 4.0, w + 16.0, row_h + 8.0);
let text_w = (w - 36.0).max(100.0);
let desc_h = description.map_or(0.0, |d| {
ctx.measure_text(d, TextStyle::regular(14.0, pal.text_secondary), Some(text_w))
.y
.max(18.0)
+ 4.0
});
let row_h = (22.0 + desc_h).max(26.0);
let hit_r = Rect::from_xywh(x, *y - 2.0, w, row_h + 4.0);
let resp = ctx.interact(id, hit_r);
let hover_t = ctx.animate_bool(id.with("hov"), resp.hovered, 0.14);
let hover_t = ctx.animate_bool(id.with("hov"), resp.hovered, 0.16);
if resp.hovered {
ctx.set_cursor(CursorKind::Pointer);
}
if hover_t > 0.01 {
ctx.dl()
.push_rect(hit_r, 10.0, pal.surface_hover.with_alpha_f32(hover_t * 0.5));
}
let text_w = (w - 32.0).max(80.0);
ctx.draw_text_ellipsis(
title,
TextStyle::bold(16.0, pal.text_bright),
TextStyle::medium(16.0, pal.text_bright),
Rect::from_xywh(x, *y, text_w, 22.0),
TextAlign::Left,
);
if let Some(desc) = description {
ctx.draw_text_ellipsis(
ctx.draw_text_wrapped(
desc,
TextStyle::medium(13.0, pal.text_secondary),
Rect::from_xywh(x, *y + 23.0, text_w, 18.0),
TextStyle::regular(14.0, pal.text_secondary),
Rect::from_xywh(x, *y + 24.0, text_w, desc_h),
None,
TextAlign::Left,
);
}
if let Some(dc) = dot_color {
ctx.dl()
.push_circle(Pos2::new(x + w - 34.0, *y + row_h * 0.5), 4.0, dc);
.push_circle(Pos2::new(x + w - 34.0, *y + 11.0), 4.0, dc);
}
let chev_x = x + w - 12.0 + hover_t * 4.0;
let chev_x = x + w - 12.0 + hover_t * 6.0;
ctx.draw_icon(
Icon::MenuArrowXxs,
Rect::from_center_size(Pos2::new(chev_x, *y + row_h * 0.5), Vec2::splat(16.0)),
Rect::from_center_size(Pos2::new(chev_x, *y + 11.0), Vec2::splat(16.0)),
if resp.hovered {
pal.text_bright
} else {
@ -697,12 +666,12 @@ fn settings_button_item(
},
);
*y += row_h + 20.0;
*y += row_h + 28.0;
resp.clicked
}
/// Official `SettingsListToggleItem` (`29c95960ed6ac633.css:120-136`):
/// Borderless row with bold 16px title, optional wrapped 13px subtitle, and right-aligned pill toggle.
/// Borderless row with 16px title, optional wrapped 14px description, and right-aligned pill toggle.
#[allow(clippy::too_many_arguments)]
fn settings_toggle_item(
ctx: &mut UiContext,
@ -717,37 +686,37 @@ fn settings_toggle_item(
) -> Option<bool> {
let text_w = (w - 60.0).max(100.0);
let desc_h = description.map_or(0.0, |d| {
ctx.measure_text(d, TextStyle::medium(13.0, pal.text_secondary), Some(text_w))
ctx.measure_text(d, TextStyle::regular(14.0, pal.text_secondary), Some(text_w))
.y
.max(18.0)
+ 4.0
});
let row_h = (22.0 + desc_h).max(28.0);
let hit_r = Rect::from_xywh(x - 8.0, *y - 4.0, w + 16.0, row_h + 8.0);
let row_h = (22.0 + desc_h).max(26.0);
let hit_r = Rect::from_xywh(x, *y - 2.0, w, row_h + 4.0);
let resp = ctx.interact(id, hit_r);
let anim = ctx.animate_bool(id.with("tog"), checked, 0.18);
let anim = ctx.animate_bool(id.with("tog"), checked, 0.16);
ctx.draw_text_ellipsis(
title,
TextStyle::bold(16.0, pal.text_bright),
TextStyle::medium(16.0, pal.text_bright),
Rect::from_xywh(x, *y, text_w, 22.0),
TextAlign::Left,
);
if let Some(desc) = description {
ctx.draw_text_wrapped(
desc,
TextStyle::medium(13.0, pal.text_secondary),
TextStyle::regular(14.0, pal.text_secondary),
Rect::from_xywh(x, *y + 24.0, text_w, desc_h),
None,
TextAlign::Left,
);
}
let sw_w = 42.0;
let sw_w = 44.0;
let sw_h = 24.0;
let sw_r = Rect::from_xywh(
x + w - sw_w,
*y + 11.0 - sw_h * 0.5,
*y + (row_h - sw_h) * 0.5,
sw_w,
sw_h,
);
@ -761,12 +730,12 @@ fn settings_toggle_item(
pal.text_bright
};
ctx.dl()
.push_circle(Pos2::new(knob_x, sw_r.center_y()), 8.5, knob_col);
.push_circle(Pos2::new(knob_x, sw_r.center_y()), 9.0, knob_col);
if resp.hovered {
ctx.set_cursor(CursorKind::Pointer);
}
*y += row_h + 20.0;
*y += row_h + 28.0;
if resp.clicked {
Some(!checked)
} else {

View file

@ -2568,11 +2568,13 @@ fn test_ext_19_official_settings_sound_quality_equalizer_and_shortcuts_modals()
0.0,
);
shell.app.config.eq_enabled = true;
shell.app.config.eq_preamp = 1.15;
shell.app.eq_popover_open = true;
let _ = render_single_frame(&mut vk, &mut shell, 0.0);
let img_qs = render_single_frame(&mut vk, &mut shell, 0.016);
assert!(img_qs.width() == NATIVE_W && img_qs.height() == NATIVE_H);
shell.app.config.eq_enabled = false;
shell.app.eq_popover_open = false;
shell.app.equalizer_modal_open = true;
let img_eq = render_single_frame(&mut vk, &mut shell, 0.032);