353 lines
11 KiB
Plaintext
353 lines
11 KiB
Plaintext
using Gtk 4.0;
|
|
using Gdk 4.0;
|
|
using Adw 1;
|
|
|
|
template $GameDetails: Adw.NavigationPage {
|
|
name: "details";
|
|
tag: "details";
|
|
title: bind $_or(template.game as <$Game>.name, _("Add Game")) as <string>;
|
|
hidden => $_cancel();
|
|
|
|
ShortcutController {
|
|
Shortcut {
|
|
trigger: "Escape";
|
|
action: "action(details.cancel)";
|
|
}
|
|
|
|
Shortcut {
|
|
trigger: "Delete|KP_Delete";
|
|
action: "action(game.remove)";
|
|
}
|
|
}
|
|
|
|
child: Adw.BreakpointBin {
|
|
width-request: bind template.root as <Widget>.width-request;
|
|
height-request: bind template.root as <Widget>.height-request;
|
|
|
|
Adw.Breakpoint {
|
|
condition ("max-width: 700px")
|
|
|
|
setters {
|
|
box.orientation: vertical;
|
|
name_label.halign: center;
|
|
name_label.justify: center;
|
|
developer_label.halign: center;
|
|
developer_label.justify: center;
|
|
date_labels.orientation: vertical;
|
|
date_labels.halign: center;
|
|
last_played_label.halign: center;
|
|
last_played_label.justify: center;
|
|
added_label.halign: center;
|
|
added_label.justify: center;
|
|
actions.orientation: vertical;
|
|
actions.halign: center;
|
|
actions.spacing: 24;
|
|
}
|
|
}
|
|
|
|
child: Overlay {
|
|
child: Picture {
|
|
name: "background";
|
|
paintable: bind $_downscale_image(template.game as <$Game>.cover) as <Gdk.Texture>;
|
|
content-fit: cover;
|
|
};
|
|
|
|
[overlay]
|
|
Adw.ToolbarView {
|
|
[top]
|
|
Adw.HeaderBar {
|
|
show-title: false;
|
|
}
|
|
|
|
content: ScrolledWindow {
|
|
hscrollbar-policy: never;
|
|
|
|
child: Box box {
|
|
halign: center;
|
|
valign: center;
|
|
margin-top: 12;
|
|
margin-bottom: 48;
|
|
margin-start: 24;
|
|
margin-end: 24;
|
|
spacing: 36;
|
|
|
|
$Cover {
|
|
paintable: bind template.game as <$Game>.cover;
|
|
}
|
|
|
|
Adw.ViewStack stack {
|
|
vhomogeneous: false;
|
|
enable-transitions: true;
|
|
|
|
Adw.ViewStackPage {
|
|
name: "details";
|
|
|
|
child: Box {
|
|
orientation: vertical;
|
|
valign: center;
|
|
spacing: 6;
|
|
|
|
Label name_label {
|
|
label: bind template.game as <$Game>.name;
|
|
halign: start;
|
|
max-width-chars: 24;
|
|
wrap: true;
|
|
wrap-mode: word_char;
|
|
|
|
styles [
|
|
"title-1",
|
|
]
|
|
}
|
|
|
|
Label developer_label {
|
|
label: bind template.game as <$Game>.developer;
|
|
visible: bind $_bool(template.game as <$Game>.developer) as <bool>;
|
|
halign: start;
|
|
max-width-chars: 36;
|
|
wrap: true;
|
|
wrap-mode: word_char;
|
|
|
|
styles [
|
|
"heading",
|
|
]
|
|
}
|
|
|
|
Box date_labels {
|
|
halign: start;
|
|
valign: start;
|
|
margin-top: 9;
|
|
spacing: 9;
|
|
|
|
Label last_played_label {
|
|
label: bind $_date_label(_("Last played: {}"), template.game as <$Game>.last_played) as <string>;
|
|
halign: start;
|
|
wrap: true;
|
|
wrap-mode: word_char;
|
|
}
|
|
|
|
Label added_label {
|
|
label: bind $_date_label(_("Added: {}"), template.game as <$Game>.added) as <string>;
|
|
halign: start;
|
|
wrap: true;
|
|
wrap-mode: word_char;
|
|
}
|
|
}
|
|
|
|
Box actions {
|
|
spacing: 12;
|
|
margin-top: 15;
|
|
|
|
Button {
|
|
action-name: "game.play";
|
|
label: _("Play");
|
|
valign: center;
|
|
halign: center;
|
|
|
|
styles [
|
|
"pill",
|
|
"suggested-action",
|
|
]
|
|
}
|
|
|
|
Box {
|
|
spacing: 6;
|
|
halign: center;
|
|
|
|
Button {
|
|
action-name: "details.edit";
|
|
icon-name: "document-edit-symbolic";
|
|
tooltip-text: _("Edit");
|
|
valign: center;
|
|
|
|
styles [
|
|
"circular",
|
|
]
|
|
}
|
|
|
|
Button hide_button {
|
|
visible: bind hide_button.sensitive;
|
|
action-name: "game.hide";
|
|
icon-name: "view-conceal-symbolic";
|
|
tooltip-text: _("Hide");
|
|
valign: center;
|
|
|
|
styles [
|
|
"circular",
|
|
]
|
|
}
|
|
|
|
Button unhide_button {
|
|
visible: bind unhide_button.sensitive;
|
|
action-name: "game.unhide";
|
|
icon-name: "view-reveal-symbolic";
|
|
tooltip-text: _("Unhide");
|
|
valign: center;
|
|
|
|
styles [
|
|
"circular",
|
|
]
|
|
}
|
|
|
|
Button {
|
|
action-name: "game.remove";
|
|
icon-name: "user-trash-symbolic";
|
|
tooltip-text: _("Remove");
|
|
valign: center;
|
|
|
|
styles [
|
|
"circular",
|
|
]
|
|
}
|
|
|
|
MenuButton {
|
|
icon-name: "edit-find-symbolic";
|
|
tooltip-text: _("Search On");
|
|
valign: center;
|
|
|
|
menu-model: menu {
|
|
section {
|
|
label: _("Search On");
|
|
|
|
item {
|
|
label: _("HowLongToBeat");
|
|
action: "details.search-on";
|
|
target: "https://howlongtobeat.com/?q={}";
|
|
}
|
|
|
|
item {
|
|
label: _("IGDB");
|
|
action: "details.search-on";
|
|
target: "https://www.igdb.com/search?type=1&q={}";
|
|
}
|
|
|
|
item {
|
|
label: _("Lutris");
|
|
action: "details.search-on";
|
|
target: "https://lutris.net/games?q={}";
|
|
}
|
|
|
|
item {
|
|
label: _("PCGamingWiki");
|
|
action: "details.search-on";
|
|
target: "https://www.pcgamingwiki.com/w/index.php?search={}";
|
|
}
|
|
|
|
item {
|
|
label: _("ProtonDB");
|
|
action: "details.search-on";
|
|
target: "https://www.protondb.com/search?q={}";
|
|
}
|
|
|
|
item {
|
|
label: _("SteamGridDB");
|
|
action: "details.search-on";
|
|
target: "https://www.steamgriddb.com/search/grids?term={}";
|
|
}
|
|
}
|
|
};
|
|
|
|
styles [
|
|
"circular",
|
|
]
|
|
}
|
|
}
|
|
}
|
|
};
|
|
}
|
|
|
|
Adw.ViewStackPage {
|
|
name: "edit";
|
|
|
|
child: Box {
|
|
orientation: vertical;
|
|
valign: center;
|
|
width-request: 300;
|
|
spacing: 24;
|
|
|
|
Adw.PreferencesGroup {
|
|
Adw.EntryRow name_entry {
|
|
title: _("Title");
|
|
entry-activated => $_activate_apply();
|
|
}
|
|
|
|
Adw.EntryRow developer_entry {
|
|
title: _("Developer (optional)");
|
|
entry-activated => $_activate_apply();
|
|
}
|
|
}
|
|
|
|
Adw.PreferencesGroup {
|
|
Adw.EntryRow executable_entry {
|
|
title: _("Executable");
|
|
entry-activated => $_activate_apply();
|
|
|
|
[suffix]
|
|
MenuButton {
|
|
valign: center;
|
|
tooltip-text: _("More Info");
|
|
icon-name: "info-outline-symbolic";
|
|
|
|
popover: Popover {
|
|
child: Label {
|
|
label: bind $_format_more_info(_("To launch the executable \"{}\", use the command:\n\n<tt>\"{}\"</tt>\n\nTo open the file \"{}\" with the default application, use:\n\n<tt>{} \"{}\"</tt>\n\nIf the path contains spaces, make sure to wrap it in double quotes!")) as <string>;
|
|
use-markup: true;
|
|
wrap: true;
|
|
wrap-mode: word_char;
|
|
margin-top: 12;
|
|
margin-bottom: 12;
|
|
margin-start: 12;
|
|
margin-end: 12;
|
|
};
|
|
};
|
|
|
|
styles [
|
|
"flat",
|
|
]
|
|
}
|
|
}
|
|
}
|
|
|
|
Adw.WrapBox {
|
|
halign: center;
|
|
wrap-reverse: true;
|
|
justify: fill;
|
|
justify-last-line: true;
|
|
child-spacing: 12;
|
|
line-spacing: 12;
|
|
|
|
Button cancel_button {
|
|
action-name: "details.cancel";
|
|
label: _("Cancel");
|
|
|
|
styles [
|
|
"pill",
|
|
]
|
|
}
|
|
|
|
Button apply_button {
|
|
action-name: "details.apply";
|
|
label: bind $_if_else(template.game as <$Game>.added, _("Apply"), _("Add")) as <string>;
|
|
|
|
styles [
|
|
"pill",
|
|
"suggested-action",
|
|
]
|
|
}
|
|
}
|
|
};
|
|
}
|
|
}
|
|
};
|
|
};
|
|
}
|
|
};
|
|
};
|
|
}
|
|
|
|
SizeGroup {
|
|
widgets [
|
|
cancel_button,
|
|
apply_button,
|
|
]
|
|
}
|