use crate::ManagerSorts;
use crate::*;
use ambassador::delegatable_trait;
use std::path::{Path, PathBuf};
#[delegatable_trait]
pub trait QueueCatalogAlg: ManagerSorts {
fn queue_ids(&self) -> impl Iterator<Item = Self::Id>;
fn selected_queue_id(&self) -> Option<Self::Id>;
fn set_selected_queue_id(&mut self, selected: Option<Self::Id>);
fn queue_entry(&self, id: Self::Id) -> Option<&Self::Entry>;
}
pub trait QueueEntryAlg {
fn label(&self) -> &str;
fn source(&self) -> &str;
fn phase(&self) -> TransferPhase;
fn dry_run(&self) -> Option<bool>;
fn stated_command(&self) -> Option<String>;
fn output(&self) -> Option<&Path>;
fn output_naming(&self) -> OutputNaming;
fn is_editable(&self) -> bool;
fn detail_controls(&self) -> Vec<DetailControl>;
fn space_action(&self) -> Option<SpaceAction>;
fn download_log(&self) -> impl Iterator<Item = &str>;
}
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum OutputNaming {
Portable,
Stated,
}
#[delegatable_trait]
pub trait QueueAppendAlg: ManagerSorts {
fn append_sources(&mut self, requests: Vec<Self::Source>) -> Vec<Self::Id>;
}
#[delegatable_trait]
pub trait QueueRemoveAlg: ManagerSorts {
fn remove_queue_entry(&mut self, id: Self::Id);
}
#[delegatable_trait]
pub trait QueuePauseAlg: ManagerSorts {
fn toggle_queue_pause(&mut self, id: Self::Id);
}
#[delegatable_trait]
pub trait QueueDuplicateAlg: ManagerSorts {
fn duplicate_queue_entry(&mut self, id: Self::Id) -> Option<Self::Id>;
}
#[delegatable_trait]
pub trait QueueFormatEditAlg: ManagerSorts {
fn cycle_queue_format(&mut self, id: Self::Id, forward: bool);
}
#[delegatable_trait]
pub trait QueueOutputAlg: ManagerSorts {
fn set_queue_output(&mut self, id: Self::Id, output: PathBuf);
}
#[delegatable_trait]
pub trait QueueSourceAlg: ManagerSorts {
fn set_queue_source(&mut self, id: Self::Id, source: String);
}
#[delegatable_trait]
pub trait FormatCatalogStateAlg: ManagerSorts {
fn request_format_catalog(&mut self, id: Self::Id);
fn apply_format_catalog_event(&mut self, id: Self::Id, event: FormatDiscoveryOp<Self::Format>);
}
#[delegatable_trait]
pub trait SourceMetadataAlg: ManagerSorts {
fn apply_source_metadata(&mut self, id: Self::Id, media_id: String, title: Option<String>);
}
#[delegatable_trait]
pub trait TransferStateAlg: ManagerSorts {
fn set_waiting(&mut self, id: Self::Id);
fn restart_waiting(&mut self, id: Self::Id);
fn apply_transfer_event(&mut self, id: Self::Id, event: TransferObservationOp);
}