Bump dependencies #133
754
Cargo.lock
generated
754
Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
22
Cargo.toml
22
Cargo.toml
@ -6,20 +6,20 @@ edition = "2021"
|
|||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
crossterm = { version = "0.26.1", optional = true}
|
crossterm = { version = "0.27.0", optional = true}
|
||||||
openssh = { version = "0.9.9", features = ["native-mux"], default-features = false, optional = true}
|
openssh = { version = "0.10.3", features = ["native-mux"], default-features = false, optional = true}
|
||||||
ratatui = { version = "0.20.1", optional = true}
|
ratatui = { version = "0.26.0", optional = true}
|
||||||
serde = { version = "1.0.159", features = ["derive"], optional = true }
|
serde = { version = "1.0.196", features = ["derive"], optional = true }
|
||||||
serde_json = { version = "1.0.95", optional = true}
|
serde_json = { version = "1.0.113", optional = true}
|
||||||
structopt = { version = "0.3.26", optional = true}
|
structopt = { version = "0.3.26", optional = true}
|
||||||
tokio = { version = "1.27.0", features = ["rt"], optional = true}
|
tokio = { version = "1.36.0", features = ["rt"], optional = true}
|
||||||
url = { version = "2.3.1" }
|
url = { version = "2.5.0" }
|
||||||
uuid = { version = "1.3.0" }
|
uuid = { version = "1.7.0" }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
mockall = "0.11.4"
|
mockall = "0.12.1"
|
||||||
once_cell = "1.17.1"
|
once_cell = "1.19.0"
|
||||||
tempfile = "3.5.0"
|
tempfile = "3.10.0"
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["database-json", "library-beets"]
|
default = ["database-json", "library-beets"]
|
||||||
|
@ -151,9 +151,9 @@ mod tests {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn save_errors() {
|
fn save_errors() {
|
||||||
// serde_json will raise an error as it requires keys to be strings.
|
// serde_json will raise an error as it has certain requirements on keys.
|
||||||
let mut object = HashMap::<Option<String>, String>::new();
|
let mut object = HashMap::<Result<(), ()>, String>::new();
|
||||||
object.insert(Some(String::from("artist")), String::from("string"));
|
object.insert(Ok(()), String::from("string"));
|
||||||
let serde_err = serde_json::to_string(&object);
|
let serde_err = serde_json::to_string(&object);
|
||||||
assert!(serde_err.is_err());
|
assert!(serde_err.is_err());
|
||||||
|
|
||||||
|
@ -7,7 +7,6 @@ use musichoard::collection::{
|
|||||||
Collection,
|
Collection,
|
||||||
};
|
};
|
||||||
use ratatui::{
|
use ratatui::{
|
||||||
backend::Backend,
|
|
||||||
layout::{Alignment, Rect},
|
layout::{Alignment, Rect},
|
||||||
style::{Color, Style},
|
style::{Color, Style},
|
||||||
widgets::{Block, BorderType, Borders, Clear, List, ListItem, ListState, Paragraph, Wrap},
|
widgets::{Block, BorderType, Borders, Clear, List, ListItem, ListState, Paragraph, Wrap},
|
||||||
@ -20,7 +19,7 @@ use crate::tui::app::{
|
|||||||
};
|
};
|
||||||
|
|
||||||
pub trait IUi {
|
pub trait IUi {
|
||||||
fn render<APP: IAppAccess, B: Backend>(app: &mut APP, frame: &mut Frame<'_, B>);
|
fn render<APP: IAppAccess>(app: &mut APP, frame: &mut Frame);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct ArtistArea {
|
struct ArtistArea {
|
||||||
@ -445,13 +444,13 @@ impl Ui {
|
|||||||
.title(format!(" {title} "))
|
.title(format!(" {title} "))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render_list_widget<B: Backend>(
|
fn render_list_widget(
|
||||||
title: &str,
|
title: &str,
|
||||||
list: List,
|
list: List,
|
||||||
state: &mut WidgetState,
|
state: &mut WidgetState,
|
||||||
active: bool,
|
active: bool,
|
||||||
area: Rect,
|
area: Rect,
|
||||||
frame: &mut Frame<'_, B>,
|
frame: &mut Frame,
|
||||||
) {
|
) {
|
||||||
frame.render_stateful_widget(
|
frame.render_stateful_widget(
|
||||||
list.highlight_style(Self::highlight_style(active))
|
list.highlight_style(Self::highlight_style(active))
|
||||||
@ -464,12 +463,12 @@ impl Ui {
|
|||||||
state.height = area.height.saturating_sub(2) as usize;
|
state.height = area.height.saturating_sub(2) as usize;
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render_info_widget<B: Backend>(
|
fn render_info_widget(
|
||||||
title: &str,
|
title: &str,
|
||||||
paragraph: Paragraph,
|
paragraph: Paragraph,
|
||||||
active: bool,
|
active: bool,
|
||||||
area: Rect,
|
area: Rect,
|
||||||
frame: &mut Frame<'_, B>,
|
frame: &mut Frame,
|
||||||
) {
|
) {
|
||||||
frame.render_widget(
|
frame.render_widget(
|
||||||
paragraph
|
paragraph
|
||||||
@ -479,12 +478,12 @@ impl Ui {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render_overlay_widget<B: Backend>(
|
fn render_overlay_widget(
|
||||||
title: &str,
|
title: &str,
|
||||||
paragraph: Paragraph,
|
paragraph: Paragraph,
|
||||||
area: Rect,
|
area: Rect,
|
||||||
error: bool,
|
error: bool,
|
||||||
frame: &mut Frame<'_, B>,
|
frame: &mut Frame,
|
||||||
) {
|
) {
|
||||||
frame.render_widget(Clear, area);
|
frame.render_widget(Clear, area);
|
||||||
frame.render_widget(
|
frame.render_widget(
|
||||||
@ -525,12 +524,12 @@ impl Ui {
|
|||||||
blocks
|
blocks
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render_columns<B: Backend>(
|
fn render_columns(
|
||||||
paragraphs: Vec<Paragraph>,
|
paragraphs: Vec<Paragraph>,
|
||||||
min: u16,
|
min: u16,
|
||||||
active: bool,
|
active: bool,
|
||||||
area: Rect,
|
area: Rect,
|
||||||
frame: &mut Frame<'_, B>,
|
frame: &mut Frame,
|
||||||
) {
|
) {
|
||||||
for column in Self::columns(paragraphs, min, area).into_iter() {
|
for column in Self::columns(paragraphs, min, area).into_iter() {
|
||||||
frame.render_widget(
|
frame.render_widget(
|
||||||
@ -543,21 +542,21 @@ impl Ui {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render_artist_column<B: Backend>(st: ArtistState, ar: ArtistArea, fr: &mut Frame<'_, B>) {
|
fn render_artist_column(st: ArtistState, ar: ArtistArea, fr: &mut Frame) {
|
||||||
Self::render_list_widget("Artists", st.list, st.state, st.active, ar.list, fr);
|
Self::render_list_widget("Artists", st.list, st.state, st.active, ar.list, fr);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render_album_column<B: Backend>(st: AlbumState, ar: AlbumArea, fr: &mut Frame<'_, B>) {
|
fn render_album_column(st: AlbumState, ar: AlbumArea, fr: &mut Frame) {
|
||||||
Self::render_list_widget("Albums", st.list, st.state, st.active, ar.list, fr);
|
Self::render_list_widget("Albums", st.list, st.state, st.active, ar.list, fr);
|
||||||
Self::render_info_widget("Album info", st.info, st.active, ar.info, fr);
|
Self::render_info_widget("Album info", st.info, st.active, ar.info, fr);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render_track_column<B: Backend>(st: TrackState, ar: TrackArea, fr: &mut Frame<'_, B>) {
|
fn render_track_column(st: TrackState, ar: TrackArea, fr: &mut Frame) {
|
||||||
Self::render_list_widget("Tracks", st.list, st.state, st.active, ar.list, fr);
|
Self::render_list_widget("Tracks", st.list, st.state, st.active, ar.list, fr);
|
||||||
Self::render_info_widget("Track info", st.info, st.active, ar.info, fr);
|
Self::render_info_widget("Track info", st.info, st.active, ar.info, fr);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render_minibuffer<B: Backend>(state: &AppPublicState, ar: Rect, fr: &mut Frame<'_, B>) {
|
fn render_minibuffer(state: &AppPublicState, ar: Rect, fr: &mut Frame) {
|
||||||
let mut mb = Minibuffer::paragraphs(state);
|
let mut mb = Minibuffer::paragraphs(state);
|
||||||
mb.paragraphs = mb
|
mb.paragraphs = mb
|
||||||
.paragraphs
|
.paragraphs
|
||||||
@ -576,11 +575,11 @@ impl Ui {
|
|||||||
Self::render_columns(mb.paragraphs, mb.columns, false, area, fr);
|
Self::render_columns(mb.paragraphs, mb.columns, false, area, fr);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render_main_frame<B: Backend>(
|
fn render_main_frame(
|
||||||
artists: &Collection,
|
artists: &Collection,
|
||||||
selection: &mut Selection,
|
selection: &mut Selection,
|
||||||
state: &AppPublicState,
|
state: &AppPublicState,
|
||||||
frame: &mut Frame<'_, B>,
|
frame: &mut Frame,
|
||||||
) {
|
) {
|
||||||
let active = selection.active;
|
let active = selection.active;
|
||||||
let areas = FrameArea::new(frame.size());
|
let areas = FrameArea::new(frame.size());
|
||||||
@ -629,11 +628,7 @@ impl Ui {
|
|||||||
Self::render_minibuffer(state, areas.minibuffer, frame);
|
Self::render_minibuffer(state, areas.minibuffer, frame);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render_info_overlay<B: Backend>(
|
fn render_info_overlay(artists: &Collection, selection: &mut Selection, frame: &mut Frame) {
|
||||||
artists: &Collection,
|
|
||||||
selection: &mut Selection,
|
|
||||||
frame: &mut Frame<'_, B>,
|
|
||||||
) {
|
|
||||||
let area = OverlayBuilder::default().build(frame.size());
|
let area = OverlayBuilder::default().build(frame.size());
|
||||||
|
|
||||||
let artist_selection = &mut selection.artist;
|
let artist_selection = &mut selection.artist;
|
||||||
@ -642,7 +637,7 @@ impl Ui {
|
|||||||
Self::render_overlay_widget("Artist", artist_overlay.properties, area, false, frame);
|
Self::render_overlay_widget("Artist", artist_overlay.properties, area, false, frame);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render_reload_overlay<B: Backend>(frame: &mut Frame<'_, B>) {
|
fn render_reload_overlay(frame: &mut Frame) {
|
||||||
let area = OverlayBuilder::default()
|
let area = OverlayBuilder::default()
|
||||||
.with_width(OverlaySize::Value(39))
|
.with_width(OverlaySize::Value(39))
|
||||||
.with_height(OverlaySize::Value(4))
|
.with_height(OverlaySize::Value(4))
|
||||||
@ -653,7 +648,7 @@ impl Ui {
|
|||||||
Self::render_overlay_widget("Reload", reload_text, area, false, frame);
|
Self::render_overlay_widget("Reload", reload_text, area, false, frame);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render_error_overlay<S: AsRef<str>, B: Backend>(title: S, msg: S, frame: &mut Frame<'_, B>) {
|
fn render_error_overlay<S: AsRef<str>>(title: S, msg: S, frame: &mut Frame) {
|
||||||
let area = OverlayBuilder::default()
|
let area = OverlayBuilder::default()
|
||||||
.with_height(OverlaySize::Value(4))
|
.with_height(OverlaySize::Value(4))
|
||||||
.build(frame.size());
|
.build(frame.size());
|
||||||
@ -667,7 +662,7 @@ impl Ui {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl IUi for Ui {
|
impl IUi for Ui {
|
||||||
fn render<APP: IAppAccess, B: Backend>(app: &mut APP, frame: &mut Frame<'_, B>) {
|
fn render<APP: IAppAccess>(app: &mut APP, frame: &mut Frame) {
|
||||||
let app = app.get();
|
let app = app.get();
|
||||||
|
|
||||||
let collection = app.collection;
|
let collection = app.collection;
|
||||||
|
Loading…
Reference in New Issue
Block a user