Compare commits
No commits in common. "311d78bcc86d1a5e409bbeac804ca538a357cc1c" and "ebf777a73becbee856d6bac320a9711d2ed3ef51" have entirely different histories.
311d78bcc8
...
ebf777a73b
2 changed files with 9 additions and 22 deletions
|
|
@ -4,7 +4,7 @@ use relm4::factory::FactoryVecDeque;
|
||||||
use relm4::{Component, ComponentParts, ComponentSender, component};
|
use relm4::{Component, ComponentParts, ComponentSender, component};
|
||||||
|
|
||||||
use crate::persist::data_manager::{DataManager, DataManagerError};
|
use crate::persist::data_manager::{DataManager, DataManagerError};
|
||||||
use crate::ui::components::media_grid_item::{FilmGridItem, FilmGridItemInput};
|
use crate::ui::components::media_grid_item::FilmGridItem;
|
||||||
use crate::ui::factory_sorting::sort_factory_vec;
|
use crate::ui::factory_sorting::sort_factory_vec;
|
||||||
use crate::ui::filtering::WatchedFilter;
|
use crate::ui::filtering::WatchedFilter;
|
||||||
use crate::ui::sorting::{
|
use crate::ui::sorting::{
|
||||||
|
|
@ -98,11 +98,7 @@ impl Component for FilmGrid {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
FilmGridInput::ApplyWatchedFilter(watched_filter) => {
|
FilmGridInput::ApplyWatchedFilter(_watched_filter) => {}
|
||||||
self
|
|
||||||
.items
|
|
||||||
.broadcast(FilmGridItemInput::ApplyWatchedFilter(watched_filter));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,6 @@ use relm4::{Component, ComponentController, Controller, FactorySender, RelmWidge
|
||||||
|
|
||||||
use crate::persist::data_manager::{DataManager, DataManagerError};
|
use crate::persist::data_manager::{DataManager, DataManagerError};
|
||||||
use crate::ui::components::media_details::{FilmDetails, FilmDetailsOutput};
|
use crate::ui::components::media_details::{FilmDetails, FilmDetailsOutput};
|
||||||
use crate::ui::filtering::WatchedFilter;
|
|
||||||
use crate::ui::widget_extensions::{AttrListExt, CondDialogExt, CondLabelExt};
|
use crate::ui::widget_extensions::{AttrListExt, CondDialogExt, CondLabelExt};
|
||||||
use crate::views::overview::FilmOverview;
|
use crate::views::overview::FilmOverview;
|
||||||
|
|
||||||
|
|
@ -20,7 +19,6 @@ pub struct FilmGridItem {
|
||||||
film: FilmOverview,
|
film: FilmOverview,
|
||||||
poster: Option<Texture>,
|
poster: Option<Texture>,
|
||||||
details: Option<Controller<FilmDetails>>,
|
details: Option<Controller<FilmDetails>>,
|
||||||
watched_filter: Option<WatchedFilter>,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl FilmGridItem {
|
impl FilmGridItem {
|
||||||
|
|
@ -36,19 +34,23 @@ pub enum FilmGridItemCmdOutput {
|
||||||
PosterFailed(DataManagerError),
|
PosterFailed(DataManagerError),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug)]
|
#[derive(Debug)]
|
||||||
pub enum FilmGridItemInput {
|
pub enum FilmGridItemInput {
|
||||||
ItemClicked,
|
ItemClicked,
|
||||||
DetailsClosed,
|
DetailsClosed,
|
||||||
WatchedStatusChanged(bool),
|
WatchedStatusChanged(bool),
|
||||||
ApplyWatchedFilter(Option<WatchedFilter>),
|
}
|
||||||
|
|
||||||
|
#[derive(Debug)]
|
||||||
|
pub enum FilmGridItemOutput {
|
||||||
|
WatchedStatusChanged(String, bool),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[factory(pub)]
|
#[factory(pub)]
|
||||||
impl FactoryComponent for FilmGridItem {
|
impl FactoryComponent for FilmGridItem {
|
||||||
type Init = FilmOverview;
|
type Init = FilmOverview;
|
||||||
type Input = FilmGridItemInput;
|
type Input = FilmGridItemInput;
|
||||||
type Output = ();
|
type Output = FilmGridItemOutput;
|
||||||
type CommandOutput = FilmGridItemCmdOutput;
|
type CommandOutput = FilmGridItemCmdOutput;
|
||||||
type ParentWidget = FlowBox;
|
type ParentWidget = FlowBox;
|
||||||
|
|
||||||
|
|
@ -56,13 +58,6 @@ impl FactoryComponent for FilmGridItem {
|
||||||
#[root]
|
#[root]
|
||||||
root = FlowBoxChild {
|
root = FlowBoxChild {
|
||||||
set_focusable: false,
|
set_focusable: false,
|
||||||
#[watch]
|
|
||||||
set_visible: match self.watched_filter {
|
|
||||||
Some(WatchedFilter::OnlyWatched) => self.film.watched,
|
|
||||||
Some(WatchedFilter::OnlyUnwatched) => !self.film.watched,
|
|
||||||
None => true,
|
|
||||||
},
|
|
||||||
|
|
||||||
Button {
|
Button {
|
||||||
connect_clicked => FilmGridItemInput::ItemClicked,
|
connect_clicked => FilmGridItemInput::ItemClicked,
|
||||||
set_css_classes: &["flat", "media-grid-item"],
|
set_css_classes: &["flat", "media-grid-item"],
|
||||||
|
|
@ -169,7 +164,6 @@ impl FactoryComponent for FilmGridItem {
|
||||||
film,
|
film,
|
||||||
poster: None,
|
poster: None,
|
||||||
details: None,
|
details: None,
|
||||||
watched_filter: None,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -195,9 +189,6 @@ impl FactoryComponent for FilmGridItem {
|
||||||
FilmGridItemInput::WatchedStatusChanged(watched) => {
|
FilmGridItemInput::WatchedStatusChanged(watched) => {
|
||||||
self.film.watched = watched;
|
self.film.watched = watched;
|
||||||
}
|
}
|
||||||
FilmGridItemInput::ApplyWatchedFilter(watched_filter) => {
|
|
||||||
self.watched_filter = watched_filter;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue