From 851be76a04a8d4a3814b4ff58e1e856e6d32482b Mon Sep 17 00:00:00 2001 From: Yorhel Date: Sat, 11 Jul 2020 10:40:24 +0200 Subject: VN::Edit: Add screenshot resolution warning if inconsistent for same release This way we can throw a warning even when no resolution is known for the selected release. --- elm/VNEdit.elm | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'elm') diff --git a/elm/VNEdit.elm b/elm/VNEdit.elm index daee7120..94020dfb 100644 --- a/elm/VNEdit.elm +++ b/elm/VNEdit.elm @@ -476,7 +476,8 @@ view model = showrel r = "[" ++ (RDate.format (RDate.expand r.released)) ++ " " ++ (String.join "," r.lang) ++ "] " ++ r.title ++ " (r" ++ String.fromInt r.id ++ ")" rellist = List.map (\r -> (Just r.id, showrel r)) model.releases scr n (id, i, rel) = tr [] <| - let imgdim = Maybe.map (\nfo -> (nfo.width, nfo.height)) i.img |> Maybe.withDefault (0,0) + let getdim img = Maybe.map (\nfo -> (nfo.width, nfo.height)) img |> Maybe.withDefault (0,0) + imgdim = getdim i.img relnfo = List.filter (\r -> Just r.id == rel) model.releases |> List.head reldim = relnfo |> Maybe.andThen (\r -> if r.reso_x == 0 then Nothing else Just (r.reso_x, r.reso_y)) dimstr (x,y) = String.fromInt x ++ "x" ++ String.fromInt y @@ -491,12 +492,17 @@ view model = , br [] [] , text <| Maybe.withDefault "" <| Maybe.map (\dim -> "Release resolution: " ++ dimstr dim) reldim , span [] <| - if reldim == Nothing then [ br [] [] ] - else if reldim == Just imgdim then [ text " ✔", br [] [] ] - else [ text " ❌" + if reldim == Just imgdim then [ text " ✔", br [] [] ] + else if reldim /= Nothing + then [ text " ❌" , br [] [] , b [ class "standout" ] [ text "WARNING: Resolutions do not match, please take screenshots with the correct resolution and make sure to crop them correctly!" ] ] + else if i.img /= Nothing && rel /= Nothing && List.any (\(_,si,sr) -> sr == rel && si.img /= Nothing && imgdim /= getdim si.img) model.screenshots + then [ b [ class "standout" ] [ text "WARNING: Inconsistent image resolutions for the same release, please take screenshots with the correct resolution and make sure to crop them correctly!" ] + , br [] [] + ] + else [ br [] [] ] , br [] [] , inputSelect "" rel (ScrRel id) [style "width" "500px"] <| rellist ++ case (relnfo, rel) of -- cgit v1.2.3