- Settings: every engine setting as a row in its own section (the engine's group and sub headings), a section list, a search box, presets and the quick settings on top, a detail panel with the whole help text, what it costs and every choice; greyed with the reason when not used; a dot and Delete (pad: Y) for changed rows - the rows write the real files: the engine's settings.json, ui.toml, the profile's TOML, and are read back - a game's profile is the same pane for that game: Global by default, its own per row, presets per game - a game's Statistics view: playtime, and the session summaries the engine wrote, shown as the files have them - Compare on a game's page (Experimental): starts it with --compare when the engine has it - the hard-coded copy of the engine's choices in the profile editor is gone
36 lines
2.2 KiB
Plaintext
36 lines
2.2 KiB
Plaintext
// A game's profile, over its page: the same settings pane as the Settings page (pane.slint), for this game. The
|
|
// first section is what belongs to the launch itself (monitor, window, arguments); the others are the engine's
|
|
// settings, each following the global one until the game sets its own. Every change is saved at once.
|
|
import { Theme } from "theme.slint";
|
|
import { Lib, Icons, Btn } from "widgets.slint";
|
|
import { SettingsPane, Sx } from "pane.slint";
|
|
|
|
export component ProfileEditor inherits Rectangle {
|
|
callback close();
|
|
callback refocus(); // give the keyboard back to the window (after editing text)
|
|
public function key(e: KeyEvent) -> bool {
|
|
if (pane.key(e)) { return true; }
|
|
if (e.text == Key.Escape || e.text == Key.Backspace) { root.close(); return true; }
|
|
return e.text == Key.LeftArrow || e.text == Key.RightArrow || e.text == Key.UpArrow || e.text == Key.DownArrow || e.text == Key.Return || e.text == " ";
|
|
}
|
|
|
|
background: Theme.p.bg.with-alpha(0.82);
|
|
TouchArea { clicked => { root.close(); } }
|
|
Rectangle {
|
|
property <length> w: Math.min(root.width - 32px, 1800px);
|
|
x: (root.width - self.w) / 2; width: self.w; y: 16px; height: root.height - 32px;
|
|
border-radius: Theme.r-lg; background: Theme.p.bg2; border-width: Theme.p.border-w; border-color: Theme.p.border;
|
|
drop-shadow-blur: 40px; drop-shadow-color: #00000090;
|
|
TouchArea { }
|
|
pane := SettingsPane {
|
|
x: 0; y: 12px; width: parent.width; height: parent.height - 12px - 32px;
|
|
active: root.visible; overlay: true; head-right: 112px;
|
|
exit-up => { }
|
|
refocus => { root.refocus(); }
|
|
}
|
|
Btn { x: parent.width - self.width - 24px; y: 24px; h: 40px; text: "Done"; clicked => { root.close(); } }
|
|
Text { x: 24px; y: parent.height - 28px; width: parent.width - 48px; horizontal-alignment: center; color: Theme.p.faint; font-size: Theme.t-xs; overflow: elide;
|
|
text: "Up / Down: move · Left / Right: change · Enter: next value, type, press · Delete: use global · LB / RB, Page Up / Down: section · / : search · Esc: back, done"; }
|
|
}
|
|
}
|