Add manual input elements to the app an ui #216
11
src/external/database/json/mod.rs
vendored
11
src/external/database/json/mod.rs
vendored
@ -5,13 +5,14 @@ pub mod backend;
|
||||
#[cfg(test)]
|
||||
use mockall::automock;
|
||||
|
||||
use crate::core::{
|
||||
collection::Collection,
|
||||
interface::database::{IDatabase, LoadError, SaveError},
|
||||
use crate::{
|
||||
core::{
|
||||
collection::Collection,
|
||||
interface::database::{IDatabase, LoadError, SaveError},
|
||||
},
|
||||
external::database::serde::{deserialize::DeserializeDatabase, serialize::SerializeDatabase},
|
||||
};
|
||||
|
||||
use super::serde::{deserialize::DeserializeDatabase, serialize::SerializeDatabase};
|
||||
|
||||
impl From<serde_json::Error> for LoadError {
|
||||
fn from(err: serde_json::Error) -> LoadError {
|
||||
LoadError::SerDeError(err.to_string())
|
||||
|
@ -4,11 +4,12 @@ use serde::Deserialize;
|
||||
|
||||
use crate::{
|
||||
collection::{artist::ArtistId, musicbrainz::Mbid},
|
||||
external::musicbrainz::api::SerdeMbid,
|
||||
external::musicbrainz::api::{
|
||||
search::query::{impl_term, EmptyQuery, EmptyQueryJoin, Query, QueryJoin},
|
||||
SerdeMbid,
|
||||
},
|
||||
};
|
||||
|
||||
use super::query::{impl_term, EmptyQuery, EmptyQueryJoin, Query, QueryJoin};
|
||||
|
||||
pub enum SearchArtist<'a> {
|
||||
String(&'a str),
|
||||
}
|
||||
|
@ -8,12 +8,11 @@ use crate::{
|
||||
musicbrainz::Mbid,
|
||||
},
|
||||
external::musicbrainz::api::{
|
||||
search::query::{impl_term, EmptyQuery, EmptyQueryJoin, Query, QueryJoin},
|
||||
ApiDisplay, SerdeAlbumDate, SerdeAlbumPrimaryType, SerdeAlbumSecondaryType, SerdeMbid,
|
||||
},
|
||||
};
|
||||
|
||||
use super::query::{impl_term, EmptyQuery, EmptyQueryJoin, Query, QueryJoin};
|
||||
|
||||
pub enum SearchReleaseGroup<'a> {
|
||||
String(&'a str),
|
||||
Arid(&'a Mbid),
|
||||
|
@ -14,15 +14,13 @@ use musichoard::collection::{
|
||||
|
||||
use crate::tui::{
|
||||
app::{
|
||||
machine::{App, AppInner, AppMachine},
|
||||
machine::{match_state::MatchState, App, AppInner, AppMachine},
|
||||
AppPublicState, AppState, IAppEventFetch, IAppInteractFetch, MatchStateInfo,
|
||||
},
|
||||
event::{Event, EventSender},
|
||||
lib::interface::musicbrainz::{self, Error as MbError, IMusicBrainz},
|
||||
};
|
||||
|
||||
use super::match_state::MatchState;
|
||||
|
||||
pub struct FetchState {
|
||||
fetch_rx: FetchReceiver,
|
||||
}
|
||||
|
@ -1,13 +1,11 @@
|
||||
use std::cmp;
|
||||
|
||||
use crate::tui::app::{
|
||||
machine::{App, AppInner, AppMachine},
|
||||
machine::{fetch_state::FetchState, input::Input, App, AppInner, AppMachine},
|
||||
AlbumMatches, AppPublicState, AppState, ArtistMatches, IAppInteractMatch, MatchOption,
|
||||
MatchStateInfo, MatchStatePublic, WidgetState,
|
||||
};
|
||||
|
||||
use super::{fetch_state::FetchState, input::Input};
|
||||
|
||||
impl ArtistMatches {
|
||||
fn len(&self) -> usize {
|
||||
self.list.len()
|
||||
|
@ -11,7 +11,10 @@ mod search_state;
|
||||
use std::sync::{Arc, Mutex};
|
||||
|
||||
use crate::tui::{
|
||||
app::{selection::Selection, AppPublic, AppPublicInner, AppState, IApp, IAppAccess},
|
||||
app::{
|
||||
selection::Selection, AppMode, AppPublic, AppPublicInner, AppPublicState, AppState, IApp,
|
||||
IAppAccess, IAppBase, IAppState,
|
||||
},
|
||||
event::EventSender,
|
||||
lib::{interface::musicbrainz::IMusicBrainz, IMusicHoard},
|
||||
};
|
||||
@ -26,8 +29,6 @@ use match_state::MatchState;
|
||||
use reload_state::ReloadState;
|
||||
use search_state::SearchState;
|
||||
|
||||
use super::{AppMode, AppPublicState, IAppBase, IAppState};
|
||||
|
||||
pub type App = AppState<
|
||||
AppMachine<BrowseState>,
|
||||
AppMachine<InfoState>,
|
||||
|
@ -5,14 +5,13 @@ use mockall::automock;
|
||||
|
||||
use crate::tui::{
|
||||
app::{
|
||||
AppState, Delta, IApp, IAppInteractBrowse, IAppInteractError, IAppInteractFetch,
|
||||
IAppInteractInfo, IAppInteractMatch, IAppInteractReload, IAppInteractSearch,
|
||||
AppMode, AppState, Delta, IApp, IAppBase, IAppEventFetch, IAppInput, IAppInteractBrowse,
|
||||
IAppInteractError, IAppInteractFetch, IAppInteractInfo, IAppInteractMatch,
|
||||
IAppInteractReload, IAppInteractSearch,
|
||||
},
|
||||
event::{Event, EventError, EventReceiver},
|
||||
};
|
||||
|
||||
use super::app::{AppMode, IAppBase, IAppEventFetch, IAppInput};
|
||||
|
||||
#[cfg_attr(test, automock)]
|
||||
pub trait IEventHandler<APP: IApp> {
|
||||
fn handle_next_event(&self, app: APP) -> Result<APP, EventError>;
|
||||
|
@ -4,7 +4,7 @@ use std::thread;
|
||||
#[cfg(test)]
|
||||
use mockall::automock;
|
||||
|
||||
use super::event::{Event, EventError, EventSender};
|
||||
use crate::tui::event::{Event, EventError, EventSender};
|
||||
|
||||
#[cfg_attr(test, automock)]
|
||||
pub trait IEventListener {
|
||||
|
@ -17,7 +17,10 @@ use ratatui::{layout::Rect, widgets::Paragraph, Frame};
|
||||
use musichoard::collection::{album::Album, Collection};
|
||||
|
||||
use crate::tui::{
|
||||
app::{AppPublicState, AppState, Category, IAppAccess, MatchStateInfo, Selection, WidgetState},
|
||||
app::{
|
||||
AppPublicState, AppState, Category, IAppAccess, InputPublic, MatchStateInfo, Selection,
|
||||
WidgetState,
|
||||
},
|
||||
ui::{
|
||||
browse_state::{
|
||||
AlbumArea, AlbumState, ArtistArea, ArtistState, FrameArea, TrackArea, TrackState,
|
||||
@ -35,8 +38,6 @@ use crate::tui::{
|
||||
},
|
||||
};
|
||||
|
||||
use super::app::InputPublic;
|
||||
|
||||
pub trait IUi {
|
||||
fn render<APP: IAppAccess>(app: &mut APP, frame: &mut Frame);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user