Show basic film properties in media modal
This commit is contained in:
parent
2c40217497
commit
462a644952
4 changed files with 50 additions and 18 deletions
|
@ -10,3 +10,10 @@
|
||||||
.open-collection-item-button {
|
.open-collection-item-button {
|
||||||
font-weight : normal ; /* No bold text by default for this kind of button */
|
font-weight : normal ; /* No bold text by default for this kind of button */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.media-modal {
|
||||||
|
padding : 100px ;
|
||||||
|
}
|
||||||
|
.media-modal .top-padding {
|
||||||
|
padding-top : 40px ;
|
||||||
|
}
|
||||||
|
|
|
@ -87,28 +87,26 @@ impl < A : MediaAdapter > CollatedMediaGrid <A> {
|
||||||
media . get_name () . as_str () ,
|
media . get_name () . as_str () ,
|
||||||
) ) ,
|
) ) ,
|
||||||
|
|
||||||
match media . get_original_name () {
|
media . get_original_name () . map ( |original_name| label ! (
|
||||||
Some (original_name) => Some ( label ! (
|
@ justify : Justification :: Center ;
|
||||||
@ justify : Justification :: Center ;
|
@ wrap : true ;
|
||||||
@ wrap : true ;
|
@ max_width_chars : 1 ; // Not the actual limit, used instead to wrap more aggressively
|
||||||
@ max_width_chars : 1 ; // Not the actual limit, used instead to wrap more aggressively
|
original_name . as_str () ,
|
||||||
original_name . as_str () ,
|
) ) . as_ref () ,
|
||||||
) ) ,
|
|
||||||
None => None ,
|
|
||||||
} . as_ref () ,
|
|
||||||
|
|
||||||
Some ( & g_box ! (
|
Some ( & g_box ! (
|
||||||
@ option_children ;
|
@ option_children ;
|
||||||
@ orientation : Horizontal ;
|
@ orientation : Horizontal ;
|
||||||
@ halign : Center ;
|
@ halign : Center ;
|
||||||
@ spacing : 20 ;
|
@ spacing : 20 ;
|
||||||
Some ( & label ! ( media . get_release_date () . as_str () ) ) ,
|
|
||||||
match media . get_runtime_minutes () {
|
Some ( & label ! (
|
||||||
Some (runtime_minutes) => Some (
|
media . get_release_date () . split ('-') . next () . unwrap () ,
|
||||||
label ! ( format ! ( "{}m" , runtime_minutes ) . as_str () ) ,
|
) ) ,
|
||||||
) ,
|
|
||||||
None => None ,
|
media . get_runtime_minutes () . map (
|
||||||
} . as_ref () ,
|
|runtime_minutes| label ! ( format ! ( "{}m" , runtime_minutes ) . as_str () ) ,
|
||||||
|
) . as_ref () ,
|
||||||
) ) ,
|
) ) ,
|
||||||
) ,
|
) ,
|
||||||
)
|
)
|
||||||
|
|
|
@ -31,7 +31,27 @@ impl UI {
|
||||||
) ) ;
|
) ) ;
|
||||||
|
|
||||||
let films_component = CollatableMediaContainer :: <FilmsAdapter> :: new (
|
let films_component = CollatableMediaContainer :: <FilmsAdapter> :: new (
|
||||||
|film| dialog ! () . present ( Some (window) ) ,
|
|film| dialog ! (
|
||||||
|
& g_box ! (
|
||||||
|
@ option_children ;
|
||||||
|
@ orientation : Vertical ;
|
||||||
|
@ css_classes : & [ "media-modal" ] ;
|
||||||
|
|
||||||
|
Some ( label ! (
|
||||||
|
@ css_classes : & [ "title-1" ] ;
|
||||||
|
film . name . as_str () ,
|
||||||
|
) ) . as_ref () ,
|
||||||
|
|
||||||
|
film . original_name . map (
|
||||||
|
|original_name| label ! ( original_name . as_str () ) ,
|
||||||
|
) . as_ref () ,
|
||||||
|
|
||||||
|
Some ( label ! (
|
||||||
|
@ css_classes : & [ "top-padding" ] ;
|
||||||
|
& format ! ( "Release date: {}" , film . release_date ) ,
|
||||||
|
) ) . as_ref () ,
|
||||||
|
) ,
|
||||||
|
) . present ( Some (window) ) ,
|
||||||
) ;
|
) ;
|
||||||
let series_component = CollatableMediaContainer :: <SeriesAdapter> :: new (
|
let series_component = CollatableMediaContainer :: <SeriesAdapter> :: new (
|
||||||
|series| dialog ! () . present ( Some (window) ) ,
|
|series| dialog ! () . present ( Some (window) ) ,
|
||||||
|
|
|
@ -18,8 +18,13 @@ macro_rules ! button { (
|
||||||
button
|
button
|
||||||
} } }
|
} } }
|
||||||
|
|
||||||
macro_rules ! dialog { () => { {
|
macro_rules ! dialog { (
|
||||||
|
$ ( @ css_classes : $ css_classes : expr ; ) ?
|
||||||
|
$ ( $ child : expr $ (,) ? ) ?
|
||||||
|
) => { {
|
||||||
let widget = libadwaita :: Dialog :: new () ;
|
let widget = libadwaita :: Dialog :: new () ;
|
||||||
|
$ ( widget . set_css_classes ( $ css_classes ) ; ) ?
|
||||||
|
$ ( widget . set_child ( Some ( $ child ) ) ; ) ?
|
||||||
widget
|
widget
|
||||||
} } }
|
} } }
|
||||||
|
|
||||||
|
@ -118,6 +123,7 @@ macro_rules ! label { (
|
||||||
$ ( @ wrap : $ wrap : expr ; ) ?
|
$ ( @ wrap : $ wrap : expr ; ) ?
|
||||||
$ ( @ max_width_chars : $ max_width_chars : expr ; ) ?
|
$ ( @ max_width_chars : $ max_width_chars : expr ; ) ?
|
||||||
$ ( @ attributes : $ attributes : expr ; ) ?
|
$ ( @ attributes : $ attributes : expr ; ) ?
|
||||||
|
$ ( @ css_classes : $ css_classes : expr ; ) ?
|
||||||
$ ( $ label : expr ) ? $ (,) ?
|
$ ( $ label : expr ) ? $ (,) ?
|
||||||
) => { {
|
) => { {
|
||||||
let label = gtk4 :: Label :: builder () . build () ;
|
let label = gtk4 :: Label :: builder () . build () ;
|
||||||
|
@ -129,6 +135,7 @@ macro_rules ! label { (
|
||||||
$ ( label . set_justify ( $ justify ) ; ) ?
|
$ ( label . set_justify ( $ justify ) ; ) ?
|
||||||
$ ( label . set_max_width_chars ( $ max_width_chars ) ; ) ?
|
$ ( label . set_max_width_chars ( $ max_width_chars ) ; ) ?
|
||||||
$ ( label . set_attributes ( Some ( $ attributes ) ) ; ) ?
|
$ ( label . set_attributes ( Some ( $ attributes ) ) ; ) ?
|
||||||
|
$ ( label . set_css_classes ( $ css_classes ) ; ) ?
|
||||||
$ ( label . set_wrap ( $ wrap ) ; ) ?
|
$ ( label . set_wrap ( $ wrap ) ; ) ?
|
||||||
label
|
label
|
||||||
} } }
|
} } }
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue