It was not a flyout and it did not read the persisted value, which together
made normalization impossible to turn off.
- `shell/AudioSettingsMenu.qml` (new) ports the `audio-menu` PopupWindow both
bars mount (PlayerBar.slint:686-705, PlayerBarSmall.slint:635-712): 252 wide,
two 44px ToggleRows with 12px side padding and a 12px gap to the switch,
label text-primary 13px over hint text-muted 10px at spacing 1 — the numbers
are PlayerBar.slint's file-private ToggleRow (:80-115).
- `PlayerBar.qml` had `normTouched` / `normLocal` and toggled normalization on
click. `NowPlayingBarSmall.qml` was worse: `property bool normOn: false`,
local state that started at false no matter what was persisted, so the FIRST
click on that button always sent `normalization = true`. Both now just open
the flyout. `active` mirrors normalization on the full bar and is neutral on
the Small one, which is the reference's own asymmetry
(PlayerBarSmall.slint:628-630 states it out loud).
- Gapless had no now-playing control at all.
The local shadow state existed because the document never carried the truth:
`publish_settings()` ran ONLY on `navigate_to("settings")` and on a language
change, and no handler in `settings_qt` ever republished. So until the user
opened Settings the shell read an empty document, the control drew OFF while
the backend had it ON, and the first interaction wrote the wrong value back.
Slint has no equivalent hole — `SettingsState` is a global seeded at startup.
So: seed the document at shell entry, and republish after every audio apply.
Verified by effect, not by diff — the boot log now reports the snapshot as
5006 bytes carrying the persisted `normalization` and `gapless`, before any
view is opened.
Seeding at shell entry also seeds the now-playing stamp's two output LEDs,
which `publish_snapshot` derives from the same audio settings.
cc
229 lines
11 KiB
Rust
229 lines
11 KiB
Rust
use std::path::Path;
|
|
|
|
use cxx_qt_build::{CxxQtBuilder, QmlModule};
|
|
|
|
/// Collect every file under `dir` (recursive), crate-root-relative — the
|
|
/// baked icon variants (qml/assets/icons/<tint>/<name>.svg) are too many to
|
|
/// list by hand.
|
|
fn collect_qrc_files(dir: &Path, out: &mut Vec<String>) {
|
|
for entry in std::fs::read_dir(dir).unwrap_or_else(|e| panic!("read_dir {}: {e}", dir.display())) {
|
|
let path = entry.expect("dir entry").path();
|
|
if path.is_dir() {
|
|
collect_qrc_files(&path, out);
|
|
} else {
|
|
out.push(path.to_string_lossy().into_owned());
|
|
}
|
|
}
|
|
}
|
|
|
|
fn main() {
|
|
// The WHOLE asset tree, recursively. This used to name the root-level
|
|
// files by hand with only icons/ and fonts/ collected, so dropping a new
|
|
// asset next to hi-res.svg compiled fine and then failed at runtime with
|
|
// "QQuickImage: Cannot open" — invisible to cargo check and to the tests.
|
|
let mut qrc_files: Vec<String> = Vec::new();
|
|
collect_qrc_files(Path::new("qml/assets"), &mut qrc_files);
|
|
// Non-QML resources land at qrc:/qt/qml/com/blitzfc/qbz/<path> — QML
|
|
// files in qml/ reference them relatively (e.g.
|
|
// "assets/icons/primary/plus.svg").
|
|
let qrc_refs: Vec<&str> = qrc_files.iter().map(String::as_str).collect();
|
|
// Cargo's default is to rerun build.rs only when a source file changes, so
|
|
// dropping a new icon into qml/assets/ produced a binary whose qrc did not
|
|
// contain it — the file was on disk and the app logged "Cannot open".
|
|
// Watch the whole tree instead.
|
|
println!("cargo:rerun-if-changed=qml");
|
|
for f in &qrc_files {
|
|
println!("cargo:rerun-if-changed={f}");
|
|
}
|
|
|
|
CxxQtBuilder::new()
|
|
// Qt modules the bridge links against (Qt6 CMake in /usr/lib64/cmake).
|
|
.qt_module("Qml")
|
|
.qt_module("Quick")
|
|
.qt_module("QuickControls2")
|
|
.qml_module(QmlModule {
|
|
uri: "com.blitzfc.qbz",
|
|
// EVERY #[cxx_qt::bridge] file. A bridge missing here does not
|
|
// fail the build: its QML singleton simply does not exist, and
|
|
// every `QbzFoo.bar()` in QML becomes a runtime ReferenceError
|
|
// that `cargo check` cannot see. The four MyQBZ/Blacklist
|
|
// singletons are the newest arrivals; the domain CONTROLLERS
|
|
// (myqbz_qt.rs, blacklist_qt.rs, toast_qt.rs, …) are plain
|
|
// modules and must NOT be listed — only files that declare a
|
|
// #[cxx_qt::bridge] mod belong in this array.
|
|
rust_files: &["src/bridge.rs", "src/session_bridge.rs", "src/shell_bridge.rs", "src/player_bridge.rs", "src/queue_bridge.rs", "src/home_bridge.rs", "src/viz_bridge.rs", "src/local_bridge.rs", "src/library_bridge.rs", "src/album_bridge.rs", "src/artist_bridge.rs", "src/lyrics_qt.rs", "src/icon_tint_qt.rs", "src/cast_bridge.rs", "src/myqbz_bridge.rs", "src/myqbz_add_bridge.rs", "src/disco_bridge.rs", "src/blacklist_bridge.rs"],
|
|
qml_files: &[
|
|
"qml/LoginScreen.qml",
|
|
"qml/Main.qml",
|
|
"qml/cards/AlbumCard.qml",
|
|
"qml/cards/ArtistCard.qml",
|
|
"qml/cards/CollectionMosaic.qml",
|
|
"qml/cards/LabelCard.qml",
|
|
"qml/cards/MixArtwork.qml",
|
|
"qml/cards/PlaylistCard.qml",
|
|
"qml/cards/PlaylistCollage.qml",
|
|
"qml/cards/RadioCard.qml",
|
|
"qml/cards/SlimCard.qml",
|
|
"qml/cards/TrackCard.qml",
|
|
"qml/controls/AddToMixtapeModal.qml",
|
|
"qml/controls/CardMenu.qml",
|
|
"qml/controls/CardOverlayButton.qml",
|
|
"qml/controls/CardOverlayRow.qml",
|
|
"qml/controls/GroupHeader.qml",
|
|
"qml/controls/MyQbzModals.qml",
|
|
"qml/controls/QbzCircleAction.qml",
|
|
"qml/controls/QbzConfirmModal.qml",
|
|
"qml/controls/QbzContextMenu.qml",
|
|
"qml/controls/QbzEmptyState.qml",
|
|
"qml/controls/QbzIconButton.qml",
|
|
"qml/controls/QbzLineEdit.qml",
|
|
"qml/controls/QbzLoadingDots.qml",
|
|
"qml/controls/QbzMultiSelectBar.qml",
|
|
"qml/controls/QbzNavButton.qml",
|
|
"qml/controls/QbzOfflinePlaceholder.qml",
|
|
"qml/controls/QbzPrimaryButton.qml",
|
|
"qml/controls/QbzRadioOption.qml",
|
|
"qml/controls/QbzSectionHeader.qml",
|
|
"qml/controls/QbzSegToggle.qml",
|
|
"qml/controls/QbzSelect.qml",
|
|
"qml/controls/QbzSlider.qml",
|
|
"qml/controls/QbzTabBar.qml",
|
|
"qml/controls/QbzTextArea.qml",
|
|
"qml/controls/QbzToast.qml",
|
|
"qml/controls/QbzToggle.qml",
|
|
"qml/controls/QbzToolButton.qml",
|
|
"qml/controls/QbzTooltip.qml",
|
|
"qml/controls/QualityBadge.qml",
|
|
"qml/controls/QualityMini.qml",
|
|
"qml/controls/SettingRow.qml",
|
|
"qml/controls/SettingsButton.qml",
|
|
"qml/controls/SettingsDivider.qml",
|
|
"qml/controls/SettingsSpacer.qml",
|
|
"qml/rows/BlacklistRow.qml",
|
|
"qml/rows/TrackCols.qml",
|
|
"qml/rows/TrackListHeader.qml",
|
|
"qml/rows/TrackRow.qml",
|
|
"qml/settings/AppearanceSettings.qml",
|
|
"qml/settings/IntegrationsSettings.qml",
|
|
"qml/settings/SettingsView.qml",
|
|
"qml/shell/AmbientField.qml",
|
|
"qml/shell/AppShell.qml",
|
|
"qml/shell/ArtPreviewOverlay.qml",
|
|
"qml/shell/Cortinilla.qml",
|
|
"qml/shell/HeaderBar.qml",
|
|
"qml/shell/LyricsPanel.qml",
|
|
"qml/shell/NowPlayingBar.qml",
|
|
"qml/shell/NowPlayingBarSmall.qml",
|
|
"qml/shell/PlayerBar.qml",
|
|
"qml/shell/QueuePanel.qml",
|
|
"qml/shell/Sidebar.qml",
|
|
"qml/shell/SidebarNowPlayingDock.qml",
|
|
"qml/shell/AudioSettingsMenu.qml",
|
|
"qml/shell/ViewModeMenu.qml",
|
|
"qml/theme/QbzIcon.qml",
|
|
"qml/theme/QbzScrollBar.qml",
|
|
"qml/theme/QbzSpinner.qml",
|
|
"qml/theme/QbzTheme.qml",
|
|
"qml/theme/RoundedImage.qml",
|
|
"qml/views/AlbumView.qml",
|
|
"qml/views/ArtistView.qml",
|
|
"qml/views/BlacklistManagerView.qml",
|
|
"qml/views/HomeView.qml",
|
|
"qml/views/LibraryView.qml",
|
|
"qml/views/LocalLibraryView.qml",
|
|
"qml/views/PlaylistView.qml",
|
|
"qml/views/SearchView.qml",
|
|
"qml/views/SectionRail.qml",
|
|
"qml/shell/CastPicker.qml",
|
|
"qml/controls/BrowseGenreButton.qml",
|
|
"qml/controls/QbzToggleButton.qml",
|
|
"qml/controls/ViewModeToggle.qml",
|
|
"qml/views/AlbumCollection.qml",
|
|
"qml/views/AlbumListHeader.qml",
|
|
"qml/views/AlbumListRow.qml",
|
|
"qml/views/DiscoverBrowseView.qml",
|
|
"qml/views/LabelReleasesView.qml",
|
|
"qml/views/LabelView.qml",
|
|
"qml/views/MixView.qml",
|
|
"qml/views/PlayHistoryView.qml",
|
|
"qml/views/PlaylistBrowseView.qml",
|
|
"qml/views/PlaylistListRow.qml",
|
|
"qml/controls/DiscoverConfigModal.qml",
|
|
"qml/controls/GenreFilterPopup.qml",
|
|
"qml/shell/NavFlyout.qml",
|
|
"qml/shell/NavSectionGlyph.qml",
|
|
"qml/controls/HeaderGradient.qml",
|
|
"qml/controls/QbzJumpNavBar.qml",
|
|
"qml/shell/LyricsControlsFlyout.qml",
|
|
"qml/shell/LyricsLineRow.qml",
|
|
"qml/shell/LyricsLinesView.qml",
|
|
"qml/shell/LyricsSyncEngine.qml",
|
|
"qml/shell/NavGestureLayer.qml",
|
|
"qml/controls/QbzCheckbox.qml",
|
|
"qml/controls/WarningBanner.qml",
|
|
"qml/settings/AudioSettings.qml",
|
|
"qml/settings/BlacklistSettings.qml",
|
|
"qml/settings/DeveloperSettings.qml",
|
|
"qml/settings/LibraryFolderTable.qml",
|
|
"qml/settings/LocalLibrarySettings.qml",
|
|
"qml/settings/OfflineSettings.qml",
|
|
"qml/settings/PlaybackSettings.qml",
|
|
"qml/settings/PlexSettings.qml",
|
|
"qml/settings/SandboxSettings.qml",
|
|
"qml/controls/QbzSkeleton.qml",
|
|
"qml/shell/FavToggle.qml",
|
|
"qml/shell/InfoCreditCell.qml",
|
|
"qml/shell/InfoMetaCell.qml",
|
|
"qml/shell/SongCard.qml",
|
|
"qml/shell/TrackInfoBody.qml",
|
|
"qml/shell/TrackInfoModal.qml",
|
|
"qml/shell/TransportControls.qml",
|
|
"qml/views/local/LocalIconSelect.qml",
|
|
"qml/views/local/LocalTip.qml",
|
|
"qml/controls/QualityBadgeFull.qml",
|
|
"qml/shell/AudioStamp.qml",
|
|
"qml/shell/SongCardStamp.qml",
|
|
"qml/shell/SpectrumBand.qml",
|
|
"qml/shell/VizSettle.qml",
|
|
"qml/views/LocalAlbumView.qml",
|
|
"qml/views/local/AlphaStrip.qml",
|
|
"qml/views/local/FilterChip.qml",
|
|
"qml/views/local/FolderSubcard.qml",
|
|
"qml/views/local/LocalAlbumCollection.qml",
|
|
"qml/views/local/LocalAlbumHeader.qml",
|
|
"qml/views/local/LocalAlbumRow.qml",
|
|
"qml/views/local/LocalAlbumsTab.qml",
|
|
"qml/views/local/LocalArtistRow.qml",
|
|
"qml/views/local/LocalArtistsTab.qml",
|
|
"qml/views/local/LocalChrome.qml",
|
|
"qml/views/local/LocalEphemeralPane.qml",
|
|
"qml/views/local/LocalFilterPopup.qml",
|
|
"qml/views/local/LocalFolderDetail.qml",
|
|
"qml/views/local/LocalFoldersTab.qml",
|
|
"qml/views/local/LocalNote.qml",
|
|
"qml/views/local/LocalSearchBox.qml",
|
|
"qml/views/local/LocalToolbar.qml",
|
|
"qml/views/local/LocalTrackRow.qml",
|
|
"qml/views/local/LocalTracksTab.qml",
|
|
"qml/views/local/LocalTreeRail.qml",
|
|
"qml/views/local/SelectCheck.qml",
|
|
"qml/views/local/SourceIcon.qml",
|
|
"qml/views/local/TreeRow.qml",
|
|
"qml/views/local/VersionPicker.qml",
|
|
// MyQBZ (Mixtapes / Collections / Artist-Collection builder).
|
|
// Its own subdirectory, like views/local/, because the five
|
|
// files only ever mount each other.
|
|
"qml/views/myqbz/DiscoBuilderView.qml",
|
|
"qml/views/myqbz/DiscoCandidateRow.qml",
|
|
"qml/views/myqbz/MyQbzCard.qml",
|
|
"qml/views/myqbz/MyQbzDetailCard.qml",
|
|
"qml/views/myqbz/MyQbzDetailRow.qml",
|
|
"qml/views/myqbz/MyQbzDetailView.qml",
|
|
"qml/views/myqbz/MyQbzGridView.qml",
|
|
],
|
|
qrc_files: &qrc_refs,
|
|
..Default::default()
|
|
})
|
|
.build();
|
|
}
|