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 {
|
||||
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 () ,
|
||||
) ) ,
|
||||
|
||||
match media . get_original_name () {
|
||||
Some (original_name) => Some ( label ! (
|
||||
@ justify : Justification :: Center ;
|
||||
@ wrap : true ;
|
||||
@ max_width_chars : 1 ; // Not the actual limit, used instead to wrap more aggressively
|
||||
original_name . as_str () ,
|
||||
) ) ,
|
||||
None => None ,
|
||||
} . as_ref () ,
|
||||
media . get_original_name () . map ( |original_name| label ! (
|
||||
@ justify : Justification :: Center ;
|
||||
@ wrap : true ;
|
||||
@ max_width_chars : 1 ; // Not the actual limit, used instead to wrap more aggressively
|
||||
original_name . as_str () ,
|
||||
) ) . as_ref () ,
|
||||
|
||||
Some ( & g_box ! (
|
||||
@ option_children ;
|
||||
@ orientation : Horizontal ;
|
||||
@ halign : Center ;
|
||||
@ spacing : 20 ;
|
||||
Some ( & label ! ( media . get_release_date () . as_str () ) ) ,
|
||||
match media . get_runtime_minutes () {
|
||||
Some (runtime_minutes) => Some (
|
||||
label ! ( format ! ( "{}m" , runtime_minutes ) . as_str () ) ,
|
||||
) ,
|
||||
None => None ,
|
||||
} . as_ref () ,
|
||||
|
||||
Some ( & label ! (
|
||||
media . get_release_date () . split ('-') . next () . unwrap () ,
|
||||
) ) ,
|
||||
|
||||
media . get_runtime_minutes () . map (
|
||||
|runtime_minutes| label ! ( format ! ( "{}m" , runtime_minutes ) . as_str () ) ,
|
||||
) . as_ref () ,
|
||||
) ) ,
|
||||
) ,
|
||||
)
|
||||
|
|
|
@ -31,7 +31,27 @@ impl UI {
|
|||
) ) ;
|
||||
|
||||
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 (
|
||||
|series| dialog ! () . present ( Some (window) ) ,
|
||||
|
|
|
@ -18,8 +18,13 @@ macro_rules ! button { (
|
|||
button
|
||||
} } }
|
||||
|
||||
macro_rules ! dialog { () => { {
|
||||
macro_rules ! dialog { (
|
||||
$ ( @ css_classes : $ css_classes : expr ; ) ?
|
||||
$ ( $ child : expr $ (,) ? ) ?
|
||||
) => { {
|
||||
let widget = libadwaita :: Dialog :: new () ;
|
||||
$ ( widget . set_css_classes ( $ css_classes ) ; ) ?
|
||||
$ ( widget . set_child ( Some ( $ child ) ) ; ) ?
|
||||
widget
|
||||
} } }
|
||||
|
||||
|
@ -118,6 +123,7 @@ macro_rules ! label { (
|
|||
$ ( @ wrap : $ wrap : expr ; ) ?
|
||||
$ ( @ max_width_chars : $ max_width_chars : expr ; ) ?
|
||||
$ ( @ attributes : $ attributes : expr ; ) ?
|
||||
$ ( @ css_classes : $ css_classes : expr ; ) ?
|
||||
$ ( $ label : expr ) ? $ (,) ?
|
||||
) => { {
|
||||
let label = gtk4 :: Label :: builder () . build () ;
|
||||
|
@ -129,6 +135,7 @@ macro_rules ! label { (
|
|||
$ ( label . set_justify ( $ justify ) ; ) ?
|
||||
$ ( label . set_max_width_chars ( $ max_width_chars ) ; ) ?
|
||||
$ ( label . set_attributes ( Some ( $ attributes ) ) ; ) ?
|
||||
$ ( label . set_css_classes ( $ css_classes ) ; ) ?
|
||||
$ ( label . set_wrap ( $ wrap ) ; ) ?
|
||||
label
|
||||
} } }
|
||||
|
|
Loading…
Add table
Reference in a new issue