import { Theme, Sizing, Motion } from "theme.slint"; import { ScrollAction, ManualState, ManualFit, RowKind } from "state_types.slint"; import { TagNames } from "tag_names.slint"; import { GlyphSource, SectionHeader, ScrollCue, ModalShell, WaitCue } from "chrome.slint"; import { Labels } from "labels.slint"; import { FocusTarget, SelectionCursor, SelectionClip } from "focus.slint"; // One row of the details table: a section heading (`key` "details" or // "technical"), or a fact whose label is `TagNames.label(key)`. export struct InfoRow { kind: RowKind, key: string, value: string, stop: int, } export global GameInfoView { in-out property modal-open: false; in-out property modal-name: ""; in-out property modal-system: ""; in-out property modal-path: ""; in-out property modal-description: ""; // The details table (`game_info_data::info_rows`): headings, and // rows whose `stop` is the focus index A acts on, or -1. in-out property <[InfoRow]> info-rows: []; // Where focus rests, by stop; each item says which stop it is, or -1. in-out property focus: 0; in-out property image-stop: -1; in-out property manual-stop: -1; in-out property description-stop: -1; // A row with several values lists them in the panel's place. in-out property values-open: false; in-out property values-kind: ""; in-out property <[string]> values: []; in-out property values-index: 0; // The focused image, full screen (`ManualReader`'s image mode). in-out property viewer-open: false; in-out property viewer-image; in-out property viewer-has-image: false; // Core has no image at that size: nothing is coming. in-out property viewer-absent: false; in-out property loading: false; in-out property failed: false; in-out property media-missing: false; in-out property modal-cover; in-out property modal-has-cover: false; // Core has no image for the one selected: nothing is coming. in-out property modal-cover-absent: false; in-out property image-index: 0; in-out property image-count: 0; // The type of the image on show (`boxart`, ...), named under it. in-out property image-kind: ""; // Screen-height units keep mirrored windows independent of pixel density. in-out property scroll-position: 0; // True while the panel opens: scrolling to its focus cuts. A move the // user makes clears it, so the scroll glides. in-out property scroll-snap: true; // The painted art box, in pixels, so a cover can be resized to it. callback art-box(int, int); // The game has a manual Core can serve; the action row offers it. in-out property has-manual: false; // The manual, read in the details' place (`ManualReader`); `closed` // shows the details. in-out property manual-state: ManualState.closed; in-out property manual-image; in-out property manual-has-image: false; in-out property manual-page: 0; in-out property manual-pages: 0; in-out property manual-fit: ManualFit.page; // Screen-height units, as `scroll-position` is. in-out property manual-scroll: 0; // The whole-page box, in pixels, and the room the arrows take from // each side of it zoomed in, so a page is rendered to fit either. callback manual-box(int, int, int); } // A details row's label and value. A row is drawn twice, resting and // inverted under the travelling fill, so the two copies share this. component InfoRowText inherits Rectangle { in property entry; in property label-w; in property pad; in property bold: false; in property ink: Theme.text-primary; in property ink-muted: Theme.text-label; out property value-h: value.preferred-height; Text { x: root.pad; y: root.pad; width: Math.min(root.label-w, root.width); text: TagNames.label(root.entry.key); font-size: Sizing.font-body; color: root.ink-muted; overflow: elide; } value := Text { x: root.pad + root.label-w + Sizing.pct-w(1.4); y: root.pad; width: Math.max(0px, root.width - self.x - root.pad); text: root.entry.value; font-size: Sizing.font-body; font-weight: root.bold ? FontWeight.medium : FontWeight.normal; color: root.ink; wrap: word-wrap; } } // One value on a row's values page, drawn twice as a details row is. component ValueText inherits Rectangle { in property text; in property pad; in property bold: false; in property ink: Theme.text-primary; Text { x: root.pad; width: root.width - 2 * root.pad; text: root.text; font-size: Sizing.font-body; font-weight: root.bold ? FontWeight.medium : FontWeight.normal; color: root.ink; overflow: elide; } } export component GameInfoModal inherits ModalShell { visible: GameInfoView.modal-open && GameInfoView.manual-state == ManualState.closed && !GameInfoView.viewer-open; property paging: GameInfoView.values-open; property line-h: Math.ceil(Sizing.font-body * 1.362 / 1px) * 1px; property body-h: GameInfoView.loading ? loading-label.height : GameInfoView.failed ? error-label.preferred-height : root.paging ? values-list.preferred-height : contents.preferred-height; // Lip, title, gap, rule, gap, scroll cue, body, scroll cue, lip. The // cues sit in a reserved band outside the viewport rather than in the // lip, the same shape the list panel uses, so the panel does not // resize as the body scrolls past either end. property arrow: GlyphSource.cue-side(); property arrow-band: root.arrow + Sizing.pct-h(0.5); // The tallest body this panel may show, from the screen down rather // than from the panel: taking it off the panel's own height would // close a loop through `content-height`. property body-budget: Math.max(0px, root.height - Sizing.pct-h(16) - root.content-y - root.pad - 2 * root.arrow-band); out property viewport-height: Math.min(root.body-budget, root.body-h); out property maximum-scroll: Math.max(0px, root.body-h - root.viewport-height); out property scrollable: !GameInfoView.loading && !GameInfoView.failed && root.maximum-scroll > 0px; // The values page names the row it lists, as a picker page names its // field. title: root.paging ? TagNames.label(GameInfoView.values-kind) : GameInfoView.modal-name; panel-width: Sizing.crt ? root.width - 12px : Math.min(Math.min(root.width * 0.92, Sizing.pct-h(150)), root.width - Sizing.pct-w(6)); content-height: root.viewport-height + 2 * root.arrow-band; property scroll-y: Math.min(root.maximum-scroll, Math.max(0px, GameInfoView.scroll-position * Sizing.screen-height)); // What the body is drawn at: it glides to a stepped position, and // tracks a drag exactly so the text stays under the finger. property shown-y: root.scroll-y; animate shown-y { duration: body-touch.pressed || GameInfoView.scroll-snap ? 0ms : Motion.dur(Motion.page-ms); easing: ease-out; } property step: Sizing.pct-h(8); property reveal-margin: Sizing.pct-h(2); public function move-scroll(delta: length) { if (!GameInfoView.loading && !GameInfoView.failed) { GameInfoView.scroll-position = Math.max(0px, Math.min(root.maximum-scroll, root.scroll-y + delta)) / Math.max(1px, Sizing.screen-height); } } public function scroll(action: ScrollAction) { if (action == ScrollAction.up) { root.move-scroll(-root.step); } if (action == ScrollAction.down) { root.move-scroll(root.step); } if (action == ScrollAction.page-prev) { root.move-scroll(-Math.max(Sizing.pct-h(12), root.viewport-height - root.step)); } if (action == ScrollAction.page-next) { root.move-scroll(Math.max(Sizing.pct-h(12), root.viewport-height - root.step)); } } // Brings a focused item from `top` to `top + span` (body coordinates) // into view, with a margin so its neighbours show it is not the end. function reveal(top: length, span: length) { if (top - root.reveal-margin < root.scroll-y) { root.move-scroll(top - root.reveal-margin - root.scroll-y); } else if (top + span + root.reveal-margin > root.scroll-y + root.viewport-height) { root.move-scroll(Math.min(top - root.reveal-margin, top + span + root.reveal-margin - root.viewport-height) - root.scroll-y); } } // The focused item's band in body coordinates, set by the item itself // as it gains focus or moves. Valid only for a row, which the // selection fill travels to as it does in Settings; the art and the // description carry a ring instead. property focus-box; changed focus-box => { root.reveal(root.focus-box.y, root.focus-box.h); } function seat(top: length, span: length, fill: bool) { root.focus-box = { x: 0px, y: top, w: contents.width, h: span, column: 0, row: GameInfoView.focus, // Opening cuts to the focus; only the user's moves glide. scope: GameInfoView.scroll-snap ? "open:" + top / 1px : "info", valid: fill, }; } // Up or Down on the focused description reads through it before focus // moves on. True when the press scrolled. public function step-within(down: bool) -> bool { if (GameInfoView.focus != GameInfoView.description-stop || GameInfoView.description-stop < 0) { return false; } if (down && description.y + description.height > root.scroll-y + root.viewport-height) { root.move-scroll(Math.min(root.step, description.y + description.height - root.scroll-y - root.viewport-height + root.reveal-margin)); return true; } if (!down && description.y < root.scroll-y) { root.move-scroll(-Math.min(root.step, root.scroll-y - description.y + root.reveal-margin)); return true; } false } label-measure := VerticalLayout { visible: false; for row in GameInfoView.info-rows: Text { text: row.kind == RowKind.header ? "" : TagNames.label(row.key); font-size: Sizing.font-body; } } property label-w: Math.min(Math.ceil(label-measure.preferred-width / 1px) * 1px + Sizing.stroke(2), root.content-width * 0.4); property row-pad: Sizing.pct-w(0.8); property value-row-h: root.line-h + 2 * root.row-pad; property value-gap: Sizing.pct-h(0.4); loading-label := WaitCue { x: root.pad; y: root.content-y + root.arrow-band; width: root.content-width; height: Math.ceil(self.glyph * 1.362 / 1px) * 1px; glyph: Sizing.font-body; waiting: GameInfoView.loading; text: @tr("Loading details…"); } error-label := Text { x: root.pad; y: root.content-y + root.arrow-band; width: root.content-width; text: @tr("Could not load details. Check Zaparoo Core and try again."); font-size: Sizing.font-body; color: Theme.text-primary; wrap: word-wrap; visible: !GameInfoView.loading && GameInfoView.failed; } viewport := Rectangle { x: root.pad; y: root.content-y + root.arrow-band; width: root.content-width; height: root.viewport-height; clip: true; visible: !GameInfoView.loading && !GameInfoView.failed; Rectangle { y: -root.shown-y; height: contents.preferred-height; visible: !root.paging; sel := SelectionCursor { radius: Sizing.radius-sm; target: root.focus-box; } contents := VerticalLayout { height: self.preferred-height; spacing: Sizing.pct-h(1.6); if GameInfoView.image-count > 0: Rectangle { property focused: GameInfoView.focus == GameInfoView.image-stop && GameInfoView.image-stop >= 0; init => { if (self.focused) { root.seat(self.y, self.height, false); } } changed focused => { if (self.focused) { root.seat(self.y, self.height, false); } } changed y => { if (self.focused) { root.seat(self.y, self.height, false); } } height: Sizing.pct-h(32); border-radius: Sizing.radius-sm; border-width: self.focused ? Sizing.focus-ring-width : 0px; border-color: Theme.selection-fill; property inset: Sizing.focus-ring-width + Sizing.pct-h(0.5); property gutter: GameInfoView.image-count > 1 ? Sizing.pct-w(4) : self.inset; // The count gets its own strip rather than sitting over // the art, where it lands on whatever the picture has // at that spot. property count-band: GameInfoView.image-count > 1 ? Math.ceil(Sizing.font-small * 1.362 / 1px) * 1px : 0px; // `self`, not `parent`: this property is declared on the // row, so `parent` here is the layout around it. property art-h: self.height - self.count-band - 2 * self.inset; Image { x: parent.gutter; // Pinned to the top: an element with no `y` is // centred in its parent. y: parent.inset; width: parent.width - 2 * parent.gutter; height: parent.art-h; source: GameInfoView.modal-cover; image-fit: contain; image-rendering: Sizing.crt ? ImageRendering.pixelated : ImageRendering.smooth; visible: GameInfoView.modal-has-cover; init => { GameInfoView.art-box(Math.round(self.width / 1px), Math.round(self.height / 1px)); } changed width => { GameInfoView.art-box(Math.round(self.width / 1px), Math.round(self.height / 1px)); } changed height => { GameInfoView.art-box(Math.round(self.width / 1px), Math.round(self.height / 1px)); } } // Gone the moment the art lands: the cue's minimum // hold would otherwise leave it over the picture. WaitCue { y: parent.inset; height: parent.art-h; visible: !GameInfoView.modal-has-cover; glyph: Sizing.font-caption; waiting: !GameInfoView.modal-has-cover && !GameInfoView.modal-cover-absent; text: @tr("Loading image…"); } for next in [false, true]: ScrollCue { x: next ? parent.width - self.width - parent.inset : parent.inset; y: parent.inset + (parent.art-h - self.height) / 2; width: root.arrow; glyph: next ? "icons/NavRight" : "icons/NavLeft"; live: next ? GameInfoView.image-index + 1 < GameInfoView.image-count : GameInfoView.image-index > 0; visible: GameInfoView.image-count > 1; } // Direction alone never said how many there were, and // the type names what the picture is. // Centered by hand: the layout's own centering puts the // bitmap face on a half pixel (docs/style.md, // "Integer-pixel drawing"). if GameInfoView.image-count > 1: HorizontalLayout { property band-w: parent.width - 2 * parent.inset; x: parent.inset + Sizing.snap((self.band-w - self.width) / 2); y: parent.height - parent.inset - self.height; width: Math.min(self.preferred-width, self.band-w); height: parent.count-band; spacing: Labels.image-type(GameInfoView.image-kind) == "" ? 0px : Sizing.pct-w(0.8); Text { text: Labels.image-type(GameInfoView.image-kind); color: Theme.text-primary; font-size: Sizing.font-small; overflow: elide; } Text { text: @tr("{}/{}", GameInfoView.image-index + 1, GameInfoView.image-count); color: Theme.text-label; font-size: Sizing.font-small; } } } // Its own fill, not the travelling one: the button is as // wide as its word. if GameInfoView.has-manual: manual-row := HorizontalLayout { property focused: GameInfoView.focus == GameInfoView.manual-stop && GameInfoView.manual-stop >= 0; init => { if (self.focused) { root.seat(self.y, self.height, false); } } changed focused => { if (self.focused) { root.seat(self.y, self.height, false); } } changed y => { if (self.focused) { root.seat(self.y, self.height, false); } } alignment: start; Rectangle { width: manual-label.preferred-width + 2 * Sizing.pct-w(2); height: root.line-h + Sizing.pct-h(1.6); border-radius: Sizing.radius-sm; background: parent.focused ? Theme.selection-fill : Theme.surface-card; border-width: parent.focused ? 0px : Sizing.stroke(1); border-color: Theme.border-mid; manual-label := Text { text: @tr("game-document" => "Manual"); font-size: Sizing.font-body; font-weight: manual-row.focused ? FontWeight.medium : FontWeight.normal; color: manual-row.focused ? Theme.on-accent : Theme.text-primary; } } } if GameInfoView.media-missing: Text { text: @tr("This game's file is missing."); color: Theme.error; font-size: Sizing.font-body; wrap: word-wrap; } description := Rectangle { property focused: GameInfoView.focus == GameInfoView.description-stop && GameInfoView.description-stop >= 0; init => { if (self.focused) { root.seat(self.y, Math.min(self.height, root.viewport-height - 2 * root.reveal-margin), false); } } changed focused => { if (self.focused) { root.seat(self.y, Math.min(self.height, root.viewport-height - 2 * root.reveal-margin), false); } } changed y => { if (self.focused) { root.seat(self.y, Math.min(self.height, root.viewport-height - 2 * root.reveal-margin), false); } } visible: GameInfoView.modal-description != ""; height: self.visible ? description-text.preferred-height + 2 * root.row-pad : 0px; border-radius: Sizing.radius-sm; border-width: self.focused ? Sizing.focus-ring-width : 0px; border-color: Theme.selection-fill; description-text := Text { x: root.row-pad; y: root.row-pad; width: parent.width - 2 * root.row-pad; text: GameInfoView.modal-description; font-size: Sizing.font-body; color: Theme.text-primary; wrap: word-wrap; } } for row in GameInfoView.info-rows: Rectangle { property focused: row.stop >= 0 && GameInfoView.focus == row.stop; property is-field: row.kind != RowKind.header; // Only while the fill is on a row: focus on the art, the // Manual button or the description hides it, and the // inverted copy must go with it, so one item reads as // focused. property lit: root.focus-box.valid && sel.fill-bottom > self.y && sel.fill-top < self.y + self.height; init => { if (self.focused) { root.seat(self.y, self.height, self.is-field); } } changed focused => { if (self.focused) { root.seat(self.y, self.height, self.is-field); } } changed y => { if (self.focused) { root.seat(self.y, self.height, self.is-field); } } changed height => { if (self.focused) { root.seat(self.y, self.height, self.is-field); } } height: self.is-field ? Math.max(root.line-h, body.value-h) + 2 * root.row-pad : header.height; header := SectionHeader { visible: !parent.is-field; label-inset: 0px; label: row.key == "technical" ? @tr("Technical details") : @tr("Details"); } body := InfoRowText { visible: parent.is-field; entry: row; label-w: root.label-w; pad: root.row-pad; } // The same row again, colored as selected and clipped to // the travelling fill, as a settings row is. if is-field && lit: SelectionClip { row-top: parent.y; row-height: parent.height; fill-top: sel.fill-top; fill-bottom: sel.fill-bottom; fill: sel.fill; InfoRowText { entry: row; label-w: root.label-w; pad: root.row-pad; bold: true; ink: sel.content; ink-muted: sel.content-muted; } } } } } // A row with more than one value lists them here, in the // panel's place, for A to search by one. Rectangle { y: -root.shown-y; height: values-list.preferred-height; visible: root.paging; value-sel := SelectionCursor { radius: Sizing.radius-sm; target: { x: 0px, y: GameInfoView.values-index * (root.value-row-h + root.value-gap), w: values-list.width, h: root.value-row-h, column: 0, row: GameInfoView.values-index, scope: "values:" + GameInfoView.values-kind, valid: root.paging && GameInfoView.values-index < GameInfoView.values.length, }; } values-list := VerticalLayout { height: self.preferred-height; spacing: root.value-gap; for value[i] in GameInfoView.values: Rectangle { property focused: i == GameInfoView.values-index; changed focused => { if (self.focused) { root.reveal(self.y, self.height); } } height: root.value-row-h; property lit: value-sel.fill-bottom > self.y && value-sel.fill-top < self.y + self.height; ValueText { text: value; pad: root.row-pad; } if lit: SelectionClip { row-top: parent.y; row-height: parent.height; fill-top: value-sel.fill-top; fill-bottom: value-sel.fill-bottom; fill: value-sel.fill; ValueText { text: value; pad: root.row-pad; bold: true; ink: value-sel.content; } } } } } body-touch := TouchArea { property drag-y; property drag-scroll; pointer-event(event) => { if (event.kind == PointerEventKind.down && event.button == PointerEventButton.left) { self.drag-y = self.mouse-y; self.drag-scroll = GameInfoView.scroll-position; } } changed mouse-y => { if (self.pressed) { root.move-scroll(self.drag-scroll * Sizing.screen-height - (self.mouse-y - self.drag-y) - root.scroll-y); } } scroll-event(event) => { root.move-scroll(-event.delta-y); return accept; } } } for down in [false, true]: ScrollCue { x: (root.panel-width - self.width) / 2; y: down ? viewport.y + viewport.height + Sizing.pct-h(0.5) : viewport.y - self.height - Sizing.pct-h(0.5); width: root.arrow; glyph: down ? "icons/ScrollDown" : "icons/ScrollUp"; live: down ? root.scroll-y < root.maximum-scroll : root.scroll-y > 0px; visible: root.scrollable; } } // One of the reader's arrows on its black plate. A spent direction dims // rather than going away, as `ScrollCue` does. component ReaderCue inherits Rectangle { in property glyph; in property live: true; in property side; in property pad; width: root.side + 2 * root.pad; height: self.width; background: #000000; border-radius: Sizing.radius-sm; Image { width: root.side; height: root.side; image-rendering: Sizing.crt ? ImageRendering.pixelated : ImageRendering.smooth; source: GlyphSource.glyph(root.glyph, Math.max(1px, root.side), root.live ? #ffffff : #ffffff59); } } // A game's manual, in the details' place: the page alone on the scrim, // as large as the screen allows with an even margin, and its number under // it. Fit width scrolls a page down; the arrows say which ways still go. // The whole page needs none. Pages arrive rendered for the page box, one // image pixel per screen pixel; only a mirror on a smaller screen gets one // larger than its box, and scales it down rather than cropping it. export component ManualReader inherits Rectangle { // The same view shows the game's images full screen. property images: GameInfoView.viewer-open; out property reading: GameInfoView.modal-open && (GameInfoView.manual-state != ManualState.closed || root.images); visible: root.reading; background: Theme.scrim; property ready: root.images || GameInfoView.manual-state == ManualState.ready; property zoomed: !root.images && GameInfoView.manual-fit == ManualFit.width; property index: root.images ? GameInfoView.image-index : GameInfoView.manual-page; property count: root.images ? GameInfoView.image-count : GameInfoView.manual-pages; property source: root.images ? GameInfoView.viewer-image : GameInfoView.manual-image; property has-image: root.images ? GameInfoView.viewer-has-image : GameInfoView.manual-has-image; // Images step left and right; a manual's pages only show which ways // go when zoomed in. property side-arrows: root.ready && root.count > 1 && (root.zoomed || root.images); property margin: Sizing.pct-h(4); property arrow: GlyphSource.cue-side(); property arrow-gap: Sizing.pct-h(1); // The page number and the arrows sit on black plates, whatever the // scrim lets through behind them. property plate-pad: Sizing.pct-h(0.6); property cue: root.arrow + 2 * root.plate-pad; property count-h: Math.ceil(Sizing.font-small * 1.362 / 1px) * 1px + 2 * root.plate-pad; // The arrows only show zoomed in, or between images; otherwise the // page takes their room. property arrow-room: root.cue + root.arrow-gap; property cue-room: root.zoomed || (root.images && root.count > 1) ? root.arrow-room : 0px; // Everything above the help bar, which stays readable over the scrim. property bottom: root.height - Sizing.help-bar-height; property whole-w: Math.max(0px, root.width - 2 * root.margin); property whole-h: Math.max(0px, root.bottom - 2 * root.margin - root.arrow-gap - root.count-h); property box-x: root.margin + root.cue-room; property box-y: root.margin + root.cue-room; property box-w: Math.max(0px, root.whole-w - 2 * root.cue-room); property box-h: Math.max(0px, root.whole-h - 2 * root.cue-room); // Reported once for both fits, so a turn between them renders once. function report-box() { GameInfoView.manual-box(Math.round(root.whole-w / 1phx), Math.round(root.whole-h / 1phx), Math.round(root.arrow-room / 1phx)); } init => { root.report-box(); } changed whole-w => { root.report-box(); } changed whole-h => { root.report-box(); } property raw-w: root.source.width * 1phx; property raw-h: root.source.height * 1phx; // A page is never enlarged: it was rendered for this box. An image // fills the box, whatever size Core had it at. property fit: Math.min(root.box-w / Math.max(1phx, root.raw-w), root.box-h / Math.max(1phx, root.raw-h)); property scale: root.images ? root.fit : Math.min(1, root.raw-w > root.box-w ? root.box-w / root.raw-w : 1, !root.zoomed && root.raw-h > root.box-h ? root.box-h / root.raw-h : 1); property image-w: root.raw-w * root.scale; property image-h: root.raw-h * root.scale; property max-scroll: root.has-image ? Math.max(0px, root.image-h - root.box-h) : 0px; out property scrollable: root.ready && root.max-scroll > 0px; // Not animated: a glide repaints the whole page every frame, which the // software renderer cannot afford at this size. property scroll-y: Math.min(root.max-scroll, Math.max(0px, GameInfoView.manual-scroll * Sizing.screen-height)); public function scroll(action: ScrollAction) { if (action == ScrollAction.up || action == ScrollAction.down) { GameInfoView.manual-scroll = Math.max(0px, Math.min(root.max-scroll, root.scroll-y + (action == ScrollAction.up ? -1 : 1) * Math.max(Sizing.pct-h(12), root.box-h / 2))) / Math.max(1px, Sizing.screen-height); } } // Swallows pointer input meant for the screen underneath. TouchArea {} page-box := Rectangle { x: root.box-x; y: root.box-y; width: root.box-w; height: root.box-h; clip: true; Image { x: (parent.width - self.width) / 2; y: root.max-scroll > 0px ? -root.scroll-y : (parent.height - self.height) / 2; width: root.image-w; height: root.image-h; source: root.source; visible: root.has-image; image-rendering: root.images && Sizing.crt ? ImageRendering.pixelated : ImageRendering.smooth; } WaitCue { height: Math.ceil(Sizing.font-body * 1.362 / 1px) * 1px; visible: !root.has-image; glyph: Sizing.font-body; waiting: GameInfoView.manual-state == ManualState.loading || (root.ready && !root.has-image && !(root.images && GameInfoView.viewer-absent)); text: root.images ? @tr("Loading image…") : GameInfoView.manual-state == ManualState.loading ? @tr("Loading manual…") : @tr("Loading page…"); } Text { width: Math.min(self.preferred-width, parent.width); text: GameInfoView.manual-state == ManualState.too-large ? @tr("This manual is too large to open.") : @tr("Could not open the manual. Check Zaparoo Core and try again."); font-size: Sizing.font-body; color: Theme.text-primary; wrap: word-wrap; horizontal-alignment: center; visible: !root.images && (GameInfoView.manual-state == ManualState.too-large || GameInfoView.manual-state == ManualState.failed); } } // Zoomed in, the arrows say which ways still go: up and down through // the page, left and right to the pages either side. for down in [false, true]: ReaderCue { x: (root.width - self.width) / 2; y: down ? page-box.y + page-box.height + root.arrow-gap : page-box.y - root.arrow-gap - self.height; side: root.arrow; pad: root.plate-pad; glyph: down ? "icons/ScrollDown" : "icons/ScrollUp"; live: down ? root.scroll-y < root.max-scroll : root.scroll-y > 0px; visible: root.zoomed && root.scrollable; } for next in [false, true]: ReaderCue { x: next ? page-box.x + page-box.width + root.arrow-gap : page-box.x - root.arrow-gap - self.width; y: page-box.y + (page-box.height - self.height) / 2; side: root.arrow; pad: root.plate-pad; glyph: next ? "icons/NavRight" : "icons/NavLeft"; live: next ? root.index + 1 < root.count : root.index > 0; visible: root.side-arrows; } // In the image viewer the plate names the image's type too, as the // carousel under the art does. property kind: root.images ? Labels.image-type(GameInfoView.image-kind) : ""; if root.ready && (root.count > 1 || root.kind != ""): Rectangle { property gap: root.kind != "" && root.count > 1 ? Sizing.pct-w(0.8) : 0px; property count-w: root.count > 1 ? count-text.preferred-width : 0px; x: Sizing.snap((root.width - self.width) / 2); y: root.bottom - root.margin - self.height; width: Math.min(root.width - 2 * root.margin, kind-text.preferred-width + self.gap + self.count-w + 4 * root.plate-pad); height: root.count-h; background: #000000; border-radius: Sizing.radius-sm; kind-text := Text { x: 2 * root.plate-pad; width: Math.max(0px, parent.width - 4 * root.plate-pad - parent.gap - parent.count-w); text: root.kind; color: #ffffff; font-size: Sizing.font-small; overflow: elide; } count-text := Text { x: parent.width - 2 * root.plate-pad - self.width; width: self.preferred-width; visible: root.count > 1; text: @tr("{}/{}", root.index + 1, root.count); color: root.kind != "" ? #c8c8c8 : #ffffff; font-size: Sizing.font-small; } } }