This commit is contained in:
Luke D. Jones
2024-02-27 14:39:46 +13:00
parent 7b0f037cba
commit a88c33c201
64 changed files with 3424 additions and 7019 deletions

View File

@@ -3,16 +3,18 @@ import { Theme } from "../globals.slint";
import { AboutSlint } from "std-widgets.slint";
export component PageAbout inherits VerticalLayout {
Rectangle {
clip: true;
// TODO: slow with border-radius
padding: 8px;
// height: parent.height - infobar.height - mainview.padding - self.padding * 2;
// TODO: border-radius: 8px;
mainview := VerticalLayout {
padding: 10px;
spacing: 10px;
AboutSlint {}
}
padding: 10px;
spacing: 10px;
Text {
vertical-alignment: TextVerticalAlignment.center;
horizontal-alignment: TextHorizontalAlignment.center;
text: "A UI for asusctl made with slint";
font-size: 22px;
}
Text {
vertical-alignment: TextVerticalAlignment.center;
horizontal-alignment: TextHorizontalAlignment.center;
text: "Work in progress";
font-size: 22px;
}
}

View File

@@ -1,49 +1,273 @@
import { ValueBar } from "../common_widgets.slint";
import { Theme } from "../globals.slint";
import { SystemDropdown, SystemToggle } from "../common_widgets.slint";
import { GroupBox, VerticalBox, Button, HorizontalBox } from "std-widgets.slint";
export component PageAnime inherits VerticalLayout {
Rectangle {
clip: true;
// TODO: slow with border-radius
export global AnimePageData {
in-out property <[string]> brightness_names: [
@tr("Anime Brightness" => "Off"),
@tr("Anime Brightness" => "Low"),
@tr("Anime Brightness" => "Med"),
@tr("Anime Brightness" => "High"),
];
in-out property <int> brightness;
callback set_brightness(int);
in-out property <bool> builtins_enabled;
callback set_builtins_enabled(bool);
in-out property <bool> enable_display;
callback set_enable_display(bool);
in-out property <bool> off_when_lid_closed;
callback set_off_when_lid_closed(bool);
in-out property <bool> off_when_suspended;
callback set_off_when_suspended(bool);
in-out property <bool> off_when_unplugged;
callback set_off_when_unplugged(bool);
in-out property <[string]> boot_anim_choices: [@tr("Glitch Construction"), @tr("Static Emergence")];
in property <int> boot_anim: 0;
in-out property <[string]> awake_anim_choices: [@tr("Binary Banner Scroll"), @tr("Rog Logo Glitch")];
in property <int> awake_anim: 0;
in-out property <[string]> sleep_anim_choices: [@tr("Banner Swipe"), @tr("Starfield")];
in property <int> sleep_anim: 0;
in-out property <[string]> shutdown_anim_choices: [@tr("Glitch Out"), @tr("See Ya")];
in property <int> shutdown_anim: 0;
callback set_builtin_animations(int, int, int, int);
}
export component PageAnime inherits Rectangle {
property <bool> show_fade_cover: false;
property <bool> show_display_advanced: false;
property <bool> show_builtin_advanced: false;
clip: true;
// TODO: slow with border-radius
padding: 8px;
// height: parent.height - infobar.height - mainview.padding - self.padding * 2;
// height: parent.height - infobar.height - mainview.padding - self.padding * 2;
// TODO: border-radius: 8px;
mainview := VerticalLayout {
padding: 10px;
VerticalLayout {
padding: 10px;
spacing: 10px;
HorizontalLayout {
spacing: 10px;
ValueBar {
height: 40px;
value: 10.5;
min: 0.0;
max: 100.0;
max-height: 32px;
SystemDropdown {
text: @tr("Anime Brightness" => "Brightness");
current_index <=> AnimePageData.brightness;
current_value: AnimePageData.brightness_names[AnimePageData.brightness];
model <=> AnimePageData.brightness_names;
selected => {
self.current_value = AnimePageData.brightness_names[AnimePageData.brightness];
AnimePageData.set_brightness(AnimePageData.brightness)
}
}
}
HorizontalLayout {
spacing: 10px;
max-height: 32px;
alignment: LayoutAlignment.stretch;
SystemToggle {
text: @tr("Enable display");
checked <=> AnimePageData.enable_display;
toggled => {
AnimePageData.set_enable_display(AnimePageData.enable_display)
}
}
ValueBar {
height: 40px;
value: -70;
min: -100;
max: 0;
Button {
text: @tr("Advanced");
width: 20%;
enabled <=> AnimePageData.enable_display;
clicked => {
root.show_fade_cover = true;
root.show_display_advanced = true;
}
}
}
HorizontalLayout {
spacing: 10px;
max-height: 32px;
alignment: LayoutAlignment.stretch;
SystemToggle {
text: @tr("Use built-in animations");
checked <=> AnimePageData.builtins_enabled;
toggled => {
AnimePageData.set_builtins_enabled(AnimePageData.builtins_enabled)
}
}
ValueBar {
height: 80px;
value: 40;
min: -50;
max: 50;
Button {
text: @tr("Advanced");
width: 20%;
enabled <=> AnimePageData.builtins_enabled;
clicked => {
root.show_fade_cover = true;
root.show_builtin_advanced = true;
}
}
}
}
ValueBar {
height: 80px;
value: -40;
min: -50;
max: 50;
if root.show_fade_cover: Rectangle {
width: 100%;
height: 100%;
background: Theme.background-color;
opacity: 0.8;
TouchArea {
height: 100%;
width: 100%;
// clicked => {
// // toolbar-dropdown.close();
// if (root.show_display_advanced) {
// root.show_display_advanced = false;
// }
// if (root.show_builtin_advanced) {
// root.show_builtin_advanced = false;
// }
// root.show_fade_cover = false;
// }
}
}
if root.show_builtin_advanced: Rectangle {
x: 0;
width: 100%;
height: 100%;
opacity: 1;
VerticalLayout {
padding: 50px;
spacing: 10px;
GroupBox {
height: 100px;
VerticalBox {
spacing: 10px;
alignment: LayoutAlignment.start;
Text {
font-size: 18px;
color: Theme.text-foreground-color;
horizontal-alignment: TextHorizontalAlignment.center;
text: @tr("Advanced Anime Display : TODO!");
}
SystemDropdown {
text: @tr("Anime built-in selection" => "Boot Animation");
current_index <=> AnimePageData.boot_anim;
current_value: AnimePageData.boot_anim_choices[AnimePageData.boot_anim];
model <=> AnimePageData.boot_anim_choices;
selected => {
AnimePageData.set_builtin_animations(AnimePageData.boot_anim, AnimePageData.awake_anim, AnimePageData.sleep_anim, AnimePageData.shutdown_anim)
}
}
SystemDropdown {
text: @tr("Anime built-in selection" => "Running Animation");
current_index <=> AnimePageData.awake_anim;
current_value: AnimePageData.awake_anim_choices[AnimePageData.awake_anim];
model <=> AnimePageData.awake_anim_choices;
selected => {
AnimePageData.set_builtin_animations(AnimePageData.boot_anim, AnimePageData.awake_anim, AnimePageData.sleep_anim, AnimePageData.shutdown_anim)
}
}
SystemDropdown {
text: @tr("Anime built-in selection" => "Sleep Animation");
current_index <=> AnimePageData.sleep_anim;
current_value: AnimePageData.sleep_anim_choices[AnimePageData.sleep_anim];
model <=> AnimePageData.sleep_anim_choices;
selected => {
AnimePageData.set_builtin_animations(AnimePageData.boot_anim, AnimePageData.awake_anim, AnimePageData.sleep_anim, AnimePageData.shutdown_anim)
}
}
SystemDropdown {
text: @tr("Anime built-in selection" => "Shutdown Animation");
current_index <=> AnimePageData.shutdown_anim;
current_value: AnimePageData.shutdown_anim_choices[AnimePageData.shutdown_anim];
model <=> AnimePageData.shutdown_anim_choices;
selected => {
AnimePageData.set_builtin_animations(AnimePageData.boot_anim, AnimePageData.awake_anim, AnimePageData.sleep_anim, AnimePageData.shutdown_anim)
}
}
}
}
}
ValueBar {
height: 80px;
value: -40;
min: -50;
max: 50;
Button {
x: root.width - self.width - 6px;
y: 6px;
text: "X";
height: 40px;
clicked => {
root.show_builtin_advanced = false;
root.show_fade_cover = false;
}
}
}
if root.show_display_advanced: Rectangle {
width: 100%;
height: 100%;
opacity: 1;
VerticalLayout {
padding: 50px;
spacing: 10px;
GroupBox {
height: 100px;
VerticalBox {
spacing: 10px;
alignment: LayoutAlignment.start;
Text {
font-size: 18px;
color: Theme.text-foreground-color;
horizontal-alignment: TextHorizontalAlignment.center;
text: @tr("Advanced Display Settings");
}
SystemToggle {
max-height: 42px;
text: @tr("Off when lid closed");
checked <=> AnimePageData.off_when_lid_closed;
toggled => {
AnimePageData.set_off_when_lid_closed(AnimePageData.off_when_lid_closed)
}
}
SystemToggle {
max-height: 42px;
text: @tr("Off when suspended");
checked <=> AnimePageData.off_when_suspended;
toggled => {
AnimePageData.set_off_when_suspended(AnimePageData.off_when_suspended)
}
}
SystemToggle {
max-height: 42px;
text: @tr("Off when on battery");
checked <=> AnimePageData.off_when_unplugged;
toggled => {
AnimePageData.set_off_when_unplugged(AnimePageData.off_when_unplugged)
}
}
}
}
}
Button {
x: root.width - self.width - 6px;
y: 6px;
text: "X";
height: 40px;
clicked => {
root.show_display_advanced = false;
root.show_fade_cover = false;
}
}
}

View File

@@ -0,0 +1,75 @@
import { Theme } from "../globals.slint";
import { SystemToggle } from "../common_widgets.slint";
export global AppSettingsPageData {
in-out property <bool> run_in_background;
callback set_run_in_background(bool);
in-out property <bool> startup_in_background;
callback set_startup_in_background(bool);
in-out property <bool> enable_tray_icon;
callback set_enable_tray_icon(bool);
in-out property <bool> enable_notifications;
callback set_enable_notifications(bool);
}
export component PageAppSettings inherits VerticalLayout {
Rectangle {
clip: true;
// TODO: slow with border-radius
padding: 8px;
// height: parent.height - infobar.height - mainview.padding - self.padding * 2;
// TODO: border-radius: 8px;
mainview := VerticalLayout {
padding: 10px;
spacing: 10px;
HorizontalLayout {
spacing: 10px;
max-height: 32px;
SystemToggle {
text: @tr("Run in background after closing");
checked <=> AppSettingsPageData.run_in_background;
toggled => {
AppSettingsPageData.set_run_in_background(AppSettingsPageData.run_in_background)
}
}
SystemToggle {
width: parent.width * 1px / 2px;
text: @tr("Start app in background (UI closed)");
checked <=> AppSettingsPageData.startup_in_background;
toggled => {
AppSettingsPageData.set_run_in_background(AppSettingsPageData.startup_in_background)
}
}
}
HorizontalLayout {
max-height: 32px;
spacing: 10px;
SystemToggle {
text: @tr("Enable system tray icon");
checked <=> AppSettingsPageData.enable_tray_icon;
toggled => {
AppSettingsPageData.set_enable_tray_icon(AppSettingsPageData.enable_tray_icon)
}
}
SystemToggle {
width: parent.width * 1px / 2px;
text: @tr("Enable change notifications");
checked <=> AppSettingsPageData.enable_notifications;
toggled => {
AppSettingsPageData.set_enable_notifications(AppSettingsPageData.enable_notifications)
}
}
}
Text {
text: "TODO";
}
}
}
}

View File

@@ -1,50 +1,290 @@
import { ValueBar } from "../common_widgets.slint";
import { SystemDropdown, RogItem } from "../common_widgets.slint";
import { Button, ComboBox, VerticalBox, GroupBox } from "std-widgets.slint";
import { StyleMetrics, Slider, HorizontalBox, TextEdit, SpinBox, LineEdit } from "std-widgets.slint";
import { ColorPicker, ColourSlider } from "../widgets/colour_picker.slint";
import { Theme } from "../globals.slint";
export struct AuraEffect {
/// The effect type
mode: int,
/// `AuraZone::None` for no zone or zoneless keyboards
zone: int,
/// Primary colour for all modes
colour1: color,
/// Secondary colour in some modes like Breathing or Stars
colour2: color,
/// One of three speeds for modes that support speed (most that animate)
speed: int,
/// Up, down, left, right. Only Rainbow mode seems to use this
direction: int,
}
export global AuraPageData {
in-out property <[string]> brightness_names: [
@tr("Aura brightness" => "Off"),
@tr("Aura brightness" => "Low"),
@tr("Aura brightness" => "Med"),
@tr("Aura brightness" => "High"),
];
in-out property <int> brightness;
callback set_brightness(int);
in-out property <[string]> mode_names: [
@tr("Basic aura mode" => "Static"),
@tr("Basic aura mode" => "Breathe"),
@tr("Basic aura mode" => "Strobe"),
@tr("Basic aura mode" => "Rainbow"),
@tr("Basic aura mode" => "Star"),
@tr("Basic aura mode" => "Rain"),
@tr("Basic aura mode" => "Highlight"),
@tr("Basic aura mode" => "Laser"),
@tr("Basic aura mode" => "Ripple"),
@tr("Basic aura mode" => "Nothing"),
@tr("Basic aura mode" => "Pulse"),
@tr("Basic aura mode" => "Comet"),
@tr("Basic aura mode" => "Flash"),
];
in-out property <[string]> available_mode_names: [
@tr("Basic aura mode" => "Static"),
@tr("Basic aura mode" => "Breathe"),
@tr("Basic aura mode" => "Strobe"),
];
in-out property <int> current_available_mode: 0;
in-out property <[int]> supported_basic_modes: [0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 11, 12];
in-out property <int> led_mode;
callback set_led_mode(int);
in-out property <[string]> zone_names: [
@tr("Aura zone" => "None"),
@tr("Aura zone" => "Key1"),
@tr("Aura zone" => "Key2"),
@tr("Aura zone" => "Key3"),
@tr("Aura zone" => "Key4"),
@tr("Aura zone" => "Logo"),
@tr("Aura zone" => "Lightbar Left"),
@tr("Aura zone" => "Lightbar Right"),
];
in-out property <int> zone;
in-out property <[string]> direction_names: [
@tr("Aura direction" => "Right"),
@tr("Aura direction" => "Left"),
@tr("Aura direction" => "Up"),
@tr("Aura direction" => "Down"),
];
in-out property <int> direction;
in-out property <[string]> speed_names: [
@tr("Aura speed" => "Low"),
@tr("Aura speed" => "Medium"),
@tr("Aura speed" => "High"),
];
in-out property <int> speed;
in-out property <AuraEffect> led_mode_data: {
mode: 0,
zone: 0,
colour1: Colors.aquamarine,
colourbox1: Colors.aquamarine,
colour2: Colors.hotpink,
colourbox2: Colors.hotpink,
speed: 0,
direction: 0,
};
callback set_led_mode_data(AuraEffect);
in-out property <color> color1;
in-out property <brush> colorbox1;
in-out property <color> color2;
in-out property <brush> colorbox2;
callback update_led_mode_data(AuraEffect);
update_led_mode_data(data) => {
led_mode_data = data;
current_available_mode = data.mode;
zone = data.zone;
speed = data.speed;
direction = data.direction;
color1 = data.colour1;
color2 = data.colour2;
colorbox1 = data.colour1;
colorbox2 = data.colour2;
}
callback blend_colour(color, color, float) -> color;
callback blend_lightness(color, float) -> color;
callback set_hex_from_colour(color) -> string;
callback set_hex_to_colour(string) -> color;
}
export component PageAura inherits VerticalLayout {
Rectangle {
clip: true;
// TODO: slow with border-radius
padding: 8px;
// height: parent.height - infobar.height - mainview.padding - self.padding * 2;
// TODO: border-radius: 8px;
mainview := VerticalLayout {
padding: 10px;
spacing: 10px;
ValueBar {
height: 40px;
value: 10.5;
min: 0.0;
max: 100.0;
padding: 10px;
spacing: 10px;
alignment: LayoutAlignment.start;
HorizontalLayout {
spacing: 10px;
SystemDropdown {
text: @tr("Brightness");
current_index <=> AuraPageData.brightness;
current_value: AuraPageData.brightness_names[self.current-index];
model <=> AuraPageData.brightness_names;
selected => {
AuraPageData.set_brightness(AuraPageData.brightness)
}
}
ValueBar {
height: 40px;
value: -70;
min: -100;
max: 0;
}
ValueBar {
height: 80px;
value: 40;
min: -50;
max: 50;
}
ValueBar {
height: 80px;
value: -40;
min: -50;
max: 50;
}
ValueBar {
height: 80px;
value: -40;
min: -50;
max: 50;
SystemDropdown {
width: parent.width * 1px / 2px;
text: @tr("Aura mode");
current_index <=> AuraPageData.current_available_mode;
current_value: AuraPageData.available_mode_names[self.current-index];
model <=> AuraPageData.available_mode_names;
selected => {
AuraPageData.led_mode_data.mode = AuraPageData.current_available_mode;
self.current_value = AuraPageData.available_mode_names[self.current-index];
AuraPageData.set_led_mode(AuraPageData.current_available_mode);
}
}
}
RogItem {
HorizontalLayout {
spacing: 10px;
VerticalBox {
Text {
text: @tr("Colour 1");
vertical-alignment: TextVerticalAlignment.center;
horizontal-alignment: TextHorizontalAlignment.center;
}
HorizontalBox {
ColourSlider {
final_colour <=> AuraPageData.color1;
colourbox <=> AuraPageData.colorbox1;
set_hex_from_colour(c1) => {
return AuraPageData.set_hex_from_colour(c1);
}
blend_colour(c1, c2, f) => {
return AuraPageData.blend_colour(c1, c2, f);
}
blend_lightness(c1, f) => {
return AuraPageData.blend_lightness(c1, f);
}
hex_to_colour(s) => {
return AuraPageData.set_hex_to_colour(s);
}
init => {
self.colourbox = AuraPageData.led_mode_data.colour1;
self.final_colour = AuraPageData.led_mode_data.colour1;
}
}
}
}
VerticalBox {
Text {
text: @tr("Colour 2");
vertical-alignment: TextVerticalAlignment.center;
horizontal-alignment: TextHorizontalAlignment.center;
}
HorizontalBox {
ColourSlider {
final_colour <=> AuraPageData.color2;
colourbox <=> AuraPageData.colorbox2;
set_hex_from_colour(c1) => {
return AuraPageData.set_hex_from_colour(c1);
}
blend_colour(c1, c2, f) => {
return AuraPageData.blend_colour(c1, c2, f);
}
blend_lightness(c1, f) => {
return AuraPageData.blend_lightness(c1, f);
}
hex_to_colour(s) => {
return AuraPageData.set_hex_to_colour(s);
}
init => {
self.colourbox = AuraPageData.led_mode_data.colour2;
self.final_colour = AuraPageData.led_mode_data.colour2;
}
}
}
}
}
}
HorizontalLayout {
spacing: 10px;
RogItem {
padding: 0px;
VerticalBox {
Text {
text: @tr("Zone");
vertical-alignment: TextVerticalAlignment.center;
horizontal-alignment: TextHorizontalAlignment.center;
}
ComboBox {
current_index <=> AuraPageData.zone;
current_value: AuraPageData.zone_names[self.current-index];
model <=> AuraPageData.zone_names;
selected => {
AuraPageData.led_mode_data.zone = self.current-index;
}
}
}
}
RogItem {
padding: 0px;
VerticalBox {
Text {
text: @tr("Direction");
vertical-alignment: TextVerticalAlignment.center;
horizontal-alignment: TextHorizontalAlignment.center;
}
ComboBox {
current_index <=> AuraPageData.direction;
current_value: AuraPageData.direction_names[self.current-index];
model <=> AuraPageData.direction_names;
selected => {
AuraPageData.led_mode_data.direction = self.current-index;
}
}
}
}
RogItem {
padding: 0px;
VerticalBox {
Text {
text: @tr("Speed");
vertical-alignment: TextVerticalAlignment.center;
horizontal-alignment: TextHorizontalAlignment.center;
}
ComboBox {
current_index <=> AuraPageData.speed;
current_value: AuraPageData.speed_names[self.current-index];
model <=> AuraPageData.speed_names;
selected => {
AuraPageData.led_mode_data.speed = self.current-index;
}
}
}
}
}
Button {
text: @tr("Apply");
clicked => {
AuraPageData.led_mode_data.mode = AuraPageData.led_mode;
AuraPageData.led_mode_data.colour1 = AuraPageData.color1;
AuraPageData.led_mode_data.colour2 = AuraPageData.color2;
AuraPageData.set_led_mode_data(AuraPageData.led_mode_data);
}
}
}

View File

@@ -1,4 +1,3 @@
import { ValueBar } from "../common_widgets.slint";
import { Theme } from "../globals.slint";
export component PageFans inherits VerticalLayout {
@@ -11,39 +10,8 @@ export component PageFans inherits VerticalLayout {
mainview := VerticalLayout {
padding: 10px;
spacing: 10px;
ValueBar {
height: 40px;
value: 10.5;
min: 0.0;
max: 100.0;
}
ValueBar {
height: 40px;
value: -70;
min: -100;
max: 0;
}
ValueBar {
height: 80px;
value: 40;
min: -50;
max: 50;
}
ValueBar {
height: 80px;
value: -40;
min: -50;
max: 50;
}
ValueBar {
height: 80px;
value: -40;
min: -50;
max: 50;
Text {
text: "TODO";
}
}
}

View File

@@ -1,50 +0,0 @@
import { ValueBar } from "../common_widgets.slint";
import { Theme } from "../globals.slint";
export component PageGpu inherits VerticalLayout {
Rectangle {
clip: true;
// TODO: slow with border-radius
padding: 8px;
// height: parent.height - infobar.height - mainview.padding - self.padding * 2;
// TODO: border-radius: 8px;
mainview := VerticalLayout {
padding: 10px;
spacing: 10px;
ValueBar {
height: 40px;
value: 10.5;
min: 0.0;
max: 100.0;
}
ValueBar {
height: 40px;
value: -70;
min: -100;
max: 0;
}
ValueBar {
height: 80px;
value: 40;
min: -50;
max: 50;
}
ValueBar {
height: 80px;
value: -40;
min: -50;
max: 50;
}
ValueBar {
height: 80px;
value: -40;
min: -50;
max: 50;
}
}
}
}

View File

@@ -1,15 +1,15 @@
import { ValueBar, SquareCharButton } from "../common_widgets.slint";
import { SystemSlider, SystemDropdown, SystemToggle } from "../common_widgets.slint";
import { Theme } from "../globals.slint";
import { HorizontalBox , VerticalBox, ScrollView, Slider, Button, Switch} from "std-widgets.slint";
import { HorizontalBox , VerticalBox, ScrollView, Slider, Button, Switch, ComboBox, GroupBox} from "std-widgets.slint";
export struct AvailableSystemProperties {
charge_limit: bool,
charge_control_end_threshold: bool,
panel_od: bool,
mini_led_mode: bool,
disable_nvidia_powerd_on_battery: bool,
ac_command: bool,
bat_command: bool,
throttle_policy: bool,
throttle_thermal_policy: bool,
ppt_pl1_spl: bool,
ppt_pl2_sppt: bool,
ppt_fppt: bool,
@@ -19,186 +19,360 @@ export struct AvailableSystemProperties {
nv_temp_target: bool,
}
export struct SystemValues {
charge_limit: int,
last_charge_limit: int,
panel_od: bool,
mini_led_mode: bool,
disable_nvidia_powerd_on_battery: bool,
}
export global SystemPageData {
in-out property <float> charge_control_end_threshold: 30;
callback set_charge_control_end_threshold(/* charge limit */ int);
export global SystemPage {
in-out property <float> charge_limit;
in-out property <int> last_charge_limit;
callback set_charge_limit(/* charge limit */ int);
in-out property <int> throttle_thermal_policy: 0;
in-out property <[string]> throttle_policy_choices: [@tr("Balanced"), @tr("Performance"), @tr("Quiet")];
callback set_throttle_thermal_policy(int);
in-out property <[string]> energy_performance_choices: [
@tr("Default"),
@tr("Performance"),
@tr("BalancePerformance"),
@tr("BalancePower"),
@tr("Power")
];
in-out property <int> throttle_balanced_epp: 0;
callback set_throttle_balanced_epp(int);
in-out property <int> throttle_performance_epp: 0;
callback set_throttle_performance_epp(int);
in-out property <int> throttle_quiet_epp: 0;
callback set_throttle_quiet_epp(int);
// if the EPP should change with throttle
in-out property <bool> throttle_policy_linked_epp: true;
callback set_throttle_policy_linked_epp(bool);
in-out property <int> throttle_policy_on_ac: 0;
callback set_throttle_policy_on_ac(int);
in-out property <int> throttle_policy_on_battery: 0;
callback set_throttle_policy_on_battery(int);
in-out property <bool> panel_od;
in-out property <bool> last_panel_od;
callback set_panel_od(/* panel_od */ bool);
callback set_panel_od(bool);
callback applied();
callback cancelled();
in-out property <bool> mini_led_mode;
callback set_mini_led_mode(bool);
in-out property <AvailableSystemProperties> available;
in-out property <float> ppt_pl1_spl: 5;
callback set_ppt_pl1_spl(int);
in-out property <float> ppt_pl2_sppt: 5;
callback set_ppt_pl2_sppt(int);
in-out property <float> ppt_fppt: 5;
callback set_ppt_fppt(int);
in-out property <float> ppt_apu_sppt: 5;
callback set_ppt_apu_sppt(int);
in-out property <float> ppt_platform_sppt: 5;
callback set_ppt_platform_sppt(int);
in-out property <float> nv_dynamic_boost: 5;
callback set_nv_dynamic_boost(int);
in-out property <float> nv_temp_target: 75;
callback set_nv_temp_target(int);
in-out property <AvailableSystemProperties> available: {
charge_control_end_threshold: true,
panel_od: true,
mini_led_mode: true,
disable_nvidia_powerd_on_battery: true,
ac_command: true,
bat_command: true,
throttle_thermal_policy: true,
ppt_pl1_spl: true,
ppt_pl2_sppt: true,
ppt_fppt: true,
ppt_apu_sppt: true,
ppt_platform_sppt: true,
nv_dynamic_boost: true,
nv_temp_target: true,
};
}
export component PageSystem inherits Rectangle {
background: Theme.background-color;
VerticalLayout {
ScrollView {
VerticalLayout {
// padding: 10px;
property <bool> show_fade_cover: false;
property <bool> show_throttle_advanced: false;
clip: true;
padding: 8px;
ScrollView {
VerticalLayout {
padding: 10px;
spacing: 10px;
min-height: root.height;
if SystemPage.available.charge-limit: Rectangle {
background: Theme.background-color;
VerticalBox {
Rectangle {
background: Theme.background-color;
border-color: Colors.black;
border-width: 6px;
border-radius: 10px;
height: 40px;
Text {
font-size: 18px;
color: Theme.text-foreground-color;
horizontal-alignment: TextHorizontalAlignment.center;
text: @tr("Base system settings");
}
}
HorizontalBox {
alignment: LayoutAlignment.start;
Text {
color: Theme.text-foreground-color;
text: @tr("ChargeLimit" => "Charge limit");
}
Text {
color: Theme.text-foreground-color;
text: "\{Math.floor(SystemPage.charge_limit)}";
}
}
HorizontalBox {
TouchArea { }
charge_slider := Slider {
maximum: 100;
minimum: 20;
value <=> SystemPage.charge_limit;
if SystemPageData.available.charge-control-end-threshold: SystemSlider {
text: @tr("Charge limit");
minimum: 20;
maximum: 100;
value <=> SystemPageData.charge_control_end_threshold;
released => {
SystemPage.set_charge_limit(SystemPage.charge_limit)
}
}
}
}
}
if SystemPage.available.panel-od: Rectangle {
background: Theme.background-color;
VerticalBox {
HorizontalBox {
alignment: LayoutAlignment.start;
Text {
color: Theme.text-foreground-color;
text: @tr("PanelOverdrive" => "Panel Overdrive");
}
Switch {
checked <=> SystemPage.panel_od;
toggled => {
SystemPage.set_panel_od(SystemPage.panel_od)
}
}
}
Text {
color: Theme.text-foreground-color;
text: @tr("PerformanceProfile" => "Performance Profile");
}
}
}
Rectangle {
background: Theme.background-color;
VerticalBox {
Text {
color: Theme.text-foreground-color;
text: @tr("nv_dynamic_boost" => "nv_dynamic_boost");
}
Text {
color: Theme.text-foreground-color;
text: @tr("nv_temp_target" => "nv_temp_target");
}
Text {
color: Theme.text-foreground-color;
text: @tr("ppt_pl1_spl" => "ppt_pl1_spl");
}
Text {
color: Theme.text-foreground-color;
text: @tr("ppt_pl2_sppt" => "ppt_pl2_sppt");
}
}
}
Rectangle {
background: Theme.background-color;
VerticalBox {
Text {
color: Theme.text-foreground-color;
text: @tr("PanelOverdrive" => "Panel Overdrive");
}
Text {
color: Theme.text-foreground-color;
text: @tr("PerformanceProfile" => "Performance Profile");
}
}
}
Rectangle {
background: Theme.background-color;
VerticalBox {
Text {
color: Theme.text-foreground-color;
text: @tr("PanelOverdrive" => "Panel Overdrive");
}
Text {
color: Theme.text-foreground-color;
text: @tr("PerformanceProfile" => "Performance Profile");
}
}
}
Rectangle {
background: Theme.background-color;
VerticalBox {
Text {
color: Theme.text-foreground-color;
text: @tr("PanelOverdrive" => "Panel Overdrive");
}
Text {
color: Theme.text-foreground-color;
text: @tr("PerformanceProfile" => "Performance Profile");
}
}
}
}
}
HorizontalLayout {
Button {
text: "Apply";
clicked => {
if SystemPage.last_charge_limit != Math.floor(SystemPage.charge_limit) {
SystemPage.set_charge_limit(SystemPage.charge_limit);
SystemPage.last_charge_limit = Math.floor(SystemPage.charge_limit);
}
SystemPage.applied();
SystemPageData.set_charge_control_end_threshold(Math.round(SystemPageData.charge_control_end_threshold))
}
}
Button {
text: "Cancel";
clicked => {
SystemPage.charge_limit = SystemPage.last_charge_limit;
SystemPage.cancelled();
if SystemPageData.available.throttle-thermal-policy: HorizontalLayout {
spacing: 10px;
SystemDropdown {
text: @tr("Throttle Policy");
current_index <=> SystemPageData.throttle_thermal_policy;
current_value: SystemPageData.throttle_policy_choices[SystemPageData.throttle_thermal_policy];
model <=> SystemPageData.throttle_policy_choices;
selected => {
SystemPageData.set_throttle_thermal_policy(SystemPageData.throttle_thermal_policy)
}
}
Button {
text: @tr("Advanced");
clicked => {
root.show_fade_cover = true;
root.show_throttle_advanced = true;
}
}
}
HorizontalBox {
padding: 0px;
spacing: 10px;
if SystemPageData.available.panel-od: SystemToggle {
text: @tr("Panel Overdrive");
checked <=> SystemPageData.panel_od;
toggled => {
SystemPageData.set_panel_od(SystemPageData.panel_od)
}
}
if SystemPageData.available.mini-led-mode: SystemToggle {
text: @tr("MiniLED Mode");
checked <=> SystemPageData.mini_led_mode;
toggled => {
SystemPageData.set_mini_led_mode(SystemPageData.mini_led_mode)
}
}
}
Rectangle {
background: Theme.background-color;
border-color: Colors.black;
border-width: 6px;
border-radius: 10px;
height: 40px;
Text {
font-size: 18px;
color: Theme.text-foreground-color;
horizontal-alignment: TextHorizontalAlignment.center;
text: @tr("System performance settings");
}
}
if SystemPageData.available.ppt-pl1-spl: SystemSlider {
text: @tr("ppt_pl1_spl" => "ppt_pl1_spl");
minimum: 5;
maximum: 250;
value <=> SystemPageData.ppt_pl1_spl;
released => {
SystemPageData.set_ppt_pl1_spl(Math.round(SystemPageData.ppt_pl1_spl))
}
}
if SystemPageData.available.ppt-pl2-sppt: SystemSlider {
text: @tr("ppt_pl2_sppt" => "ppt_pl2_sppt");
minimum: 5;
maximum: 250;
value <=> SystemPageData.ppt_pl2_sppt;
released => {
SystemPageData.set_ppt_pl2_sppt(Math.round(SystemPageData.ppt_pl2_sppt))
}
}
if SystemPageData.available.ppt-fppt: SystemSlider {
text: @tr("ppt_fppt" => "ppt_fppt");
minimum: 5;
maximum: 250;
value <=> SystemPageData.ppt_fppt;
released => {
SystemPageData.set_ppt_fppt(Math.round(SystemPageData.ppt_fppt))
}
}
if SystemPageData.available.ppt-apu-sppt: SystemSlider {
text: @tr("ppt_apu_sppt" => "ppt_apu_sppt");
minimum: 5;
maximum: 130;
value <=> SystemPageData.ppt_apu_sppt;
released => {
SystemPageData.set_ppt_apu_sppt(Math.round(SystemPageData.ppt_apu_sppt))
}
}
if SystemPageData.available.ppt-platform-sppt: SystemSlider {
text: @tr("ppt_platform_sppt" => "ppt_platform_sppt");
maximum: 130;
minimum: 5;
value <=> SystemPageData.ppt_platform_sppt;
released => {
SystemPageData.set_ppt_platform_sppt(Math.round(SystemPageData.ppt_platform_sppt))
}
}
if SystemPageData.available.nv-dynamic-boost: SystemSlider {
text: @tr("nv_dynamic_boost" => "nv_dynamic_boost");
minimum: 5;
maximum: 25;
value <=> SystemPageData.nv_dynamic_boost;
released => {
SystemPageData.set_nv_dynamic_boost(Math.round(SystemPageData.nv_dynamic_boost))
}
}
if SystemPageData.available.nv-temp-target: SystemSlider {
text: @tr("nv_temp_target" => "nv_temp_target");
minimum: 75;
maximum: 87;
value <=> SystemPageData.nv_temp_target;
released => {
SystemPageData.set_nv_temp_target(Math.round(SystemPageData.nv_temp_target))
}
}
}
}
if root.show_fade_cover: Rectangle {
width: 100%;
height: 100%;
background: Theme.background-color;
opacity: 0.8;
TouchArea {
height: 100%;
width: 100%;
clicked => {
// toolbar-dropdown.close();
if (root.show_throttle_advanced) {
root.show_throttle_advanced = false;
}
root.show_fade_cover = false;
}
}
}
if root.show_throttle_advanced: Rectangle {
width: 100%;
height: 100%;
opacity: 1;
ScrollView {
VerticalLayout {
padding: 50px;
padding-top: 5px;
spacing: 10px;
GroupBox {
VerticalBox {
spacing: 10px;
Text {
font-size: 18px;
horizontal-alignment: TextHorizontalAlignment.center;
vertical-alignment: TextVerticalAlignment.center;
text: @tr("Energy Performance Preference linked to Throttle Policy");
}
SystemToggle {
text: @tr("Change EPP based on Throttle Policy");
checked <=> SystemPageData.throttle_policy_linked_epp;
toggled => {
SystemPageData.set_throttle_policy_linked_epp(SystemPageData.throttle_policy_linked_epp)
}
}
SystemDropdown {
text: @tr("EPP for Balanced Policy");
current_index <=> SystemPageData.throttle_balanced_epp;
current_value: SystemPageData.energy_performance_choices[SystemPageData.throttle_balanced_epp];
model <=> SystemPageData.energy_performance_choices;
selected => {
SystemPageData.set_throttle_balanced_epp(SystemPageData.throttle_balanced_epp)
}
}
SystemDropdown {
text: @tr("EPP for Performance Policy");
current_index <=> SystemPageData.throttle_performance_epp;
current_value: SystemPageData.energy_performance_choices[SystemPageData.throttle_performance_epp];
model <=> SystemPageData.energy_performance_choices;
selected => {
SystemPageData.set_throttle_performance_epp(SystemPageData.throttle_performance_epp)
}
}
SystemDropdown {
text: @tr("EPP for Quiet Policy");
current_index <=> SystemPageData.throttle_quiet_epp;
current_value: SystemPageData.energy_performance_choices[SystemPageData.throttle_quiet_epp];
model <=> SystemPageData.energy_performance_choices;
selected => {
SystemPageData.set_throttle_quiet_epp(SystemPageData.throttle_quiet_epp)
}
}
}
}
GroupBox {
VerticalBox {
spacing: 10px;
Text {
font-size: 18px;
horizontal-alignment: TextHorizontalAlignment.center;
vertical-alignment: TextVerticalAlignment.center;
text: @tr("Throttle Policy for power state");
}
SystemDropdown {
text: @tr("Throttle Policy on Battery");
current_index <=> SystemPageData.throttle_policy_on_battery;
current_value: SystemPageData.throttle_policy_choices[SystemPageData.throttle_policy_on_battery];
model <=> SystemPageData.throttle_policy_choices;
selected => {
SystemPageData.set_throttle_policy_on_battery(SystemPageData.throttle_policy_on_battery)
}
}
SystemDropdown {
text: @tr("Throttle Policy on AC");
current_index <=> SystemPageData.throttle_policy_on_ac;
current_value: SystemPageData.throttle_policy_choices[SystemPageData.throttle_policy_on_ac];
model <=> SystemPageData.throttle_policy_choices;
selected => {
SystemPageData.set_throttle_policy_on_ac(SystemPageData.throttle_policy_on_ac)
}
}
}
}
}
}
Button {
x: root.width - self.width - 6px;
y: 6px;
text: "X";
height: 40px;
clicked => {
root.show_throttle_advanced = false;
root.show_fade_cover = false;
}
}
}
}