Ports the three sections the tab was missing, against the Slint implementation rather than invented: the section rails, the cards, and the mix landing page with its navigation seam so back/forward behave. The mixes reuse the shared crates for their requests -- the Slint app already makes them, so nothing new talks to Qobuz here. Also carries the qt-run.sh portability work needed for the Mac mini: `free`, `nproc`, `pgrep` and `timeout` all differ or are simply absent on BSD/macOS. Two of those bit during the first Mac build. `pgrep` exits 1 when it matches nothing -- the normal case -- and under `pipefail` that killed the script before a single line of output, which reads exactly like a build that did nothing. And `timeout` does not exist on macOS at all, so the smoke produced a one-line log over which the grep cheerfully reported "0 QML complaints": a test that never ran, rendering as a pass. The smoke now fails outright on a log that short. cc
197 lines
9.2 KiB
Rust
197 lines
9.2 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",
|
|
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"],
|
|
qml_files: &[
|
|
"qml/LoginScreen.qml",
|
|
"qml/Main.qml",
|
|
"qml/cards/AlbumCard.qml",
|
|
"qml/cards/ArtistCard.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/CardMenu.qml",
|
|
"qml/controls/CardOverlayButton.qml",
|
|
"qml/controls/CardOverlayRow.qml",
|
|
"qml/controls/GroupHeader.qml",
|
|
"qml/controls/QbzCircleAction.qml",
|
|
"qml/controls/QbzContextMenu.qml",
|
|
"qml/controls/QbzEmptyState.qml",
|
|
"qml/controls/QbzIconButton.qml",
|
|
"qml/controls/QbzLineEdit.qml",
|
|
"qml/controls/QbzNavButton.qml",
|
|
"qml/controls/QbzOfflinePlaceholder.qml",
|
|
"qml/controls/QbzSectionHeader.qml",
|
|
"qml/controls/QbzSelect.qml",
|
|
"qml/controls/QbzSlider.qml",
|
|
"qml/controls/QbzTabBar.qml",
|
|
"qml/controls/QbzToggle.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/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/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/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/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/LocalMultiSelectBar.qml",
|
|
"qml/views/local/LocalNote.qml",
|
|
"qml/views/local/LocalSearchBox.qml",
|
|
"qml/views/local/LocalSegToggle.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",
|
|
],
|
|
qrc_files: &qrc_refs,
|
|
..Default::default()
|
|
})
|
|
.build();
|
|
}
|