Init with colour sliders in approx position

This commit is contained in:
Luke D. Jones
2024-03-03 12:57:45 +13:00
parent a88c33c201
commit 3da848d131
11 changed files with 198 additions and 217 deletions

View File

@@ -11,6 +11,7 @@ export component PageAbout inherits VerticalLayout {
text: "A UI for asusctl made with slint";
font-size: 22px;
}
Text {
vertical-alignment: TextVerticalAlignment.center;
horizontal-alignment: TextHorizontalAlignment.center;

View File

@@ -11,22 +11,16 @@ export global AnimePageData {
];
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")];
@@ -42,7 +36,6 @@ 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;
@@ -142,7 +135,6 @@ export component PageAnime inherits Rectangle {
VerticalLayout {
padding: 50px;
spacing: 10px;
GroupBox {
height: 100px;
VerticalBox {
@@ -217,7 +209,6 @@ export component PageAnime inherits Rectangle {
VerticalLayout {
padding: 50px;
spacing: 10px;
GroupBox {
height: 100px;
VerticalBox {

View File

@@ -4,13 +4,10 @@ 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);
}

View File

@@ -28,7 +28,6 @@ export global AuraPageData {
];
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"),
@@ -50,11 +49,9 @@ export global AuraPageData {
@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"),
@@ -66,7 +63,6 @@ export global AuraPageData {
@tr("Aura zone" => "Lightbar Right"),
];
in-out property <int> zone;
in-out property <[string]> direction_names: [
@tr("Aura direction" => "Right"),
@tr("Aura direction" => "Left"),
@@ -74,14 +70,12 @@ export global AuraPageData {
@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,
@@ -93,12 +87,10 @@ export global AuraPageData {
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;
@@ -111,11 +103,12 @@ export global AuraPageData {
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;
pure callback set_hue(color) -> float;
pure callback set_bright(color) -> float;
}
export component PageAura inherits VerticalLayout {
@@ -159,10 +152,10 @@ export component PageAura inherits VerticalLayout {
}
HorizontalBox {
ColourSlider {
c1 := ColourSlider {
final_colour <=> AuraPageData.color1;
colourbox <=> AuraPageData.colorbox1;
set_hex_from_colour(c1) => {
colourbox <=> AuraPageData.colorbox1;
set_hex_from_colour(c1) => {
return AuraPageData.set_hex_from_colour(c1);
}
blend_colour(c1, c2, f) => {
@@ -174,6 +167,12 @@ export component PageAura inherits VerticalLayout {
hex_to_colour(s) => {
return AuraPageData.set_hex_to_colour(s);
}
set_hue(color) => {
return AuraPageData.set_hue(color);
}
set_bright(color) => {
return AuraPageData.set_bright(color);
}
init => {
self.colourbox = AuraPageData.led_mode_data.colour1;
self.final_colour = AuraPageData.led_mode_data.colour1;
@@ -190,10 +189,10 @@ export component PageAura inherits VerticalLayout {
}
HorizontalBox {
ColourSlider {
c2 := ColourSlider {
final_colour <=> AuraPageData.color2;
colourbox <=> AuraPageData.colorbox2;
set_hex_from_colour(c1) => {
colourbox <=> AuraPageData.colorbox2;
set_hex_from_colour(c1) => {
return AuraPageData.set_hex_from_colour(c1);
}
blend_colour(c1, c2, f) => {
@@ -205,6 +204,9 @@ export component PageAura inherits VerticalLayout {
hex_to_colour(s) => {
return AuraPageData.set_hex_to_colour(s);
}
set_bright(color) => {
return AuraPageData.set_bright(color);
}
init => {
self.colourbox = AuraPageData.led_mode_data.colour2;
self.final_colour = AuraPageData.led_mode_data.colour2;

View File

@@ -22,11 +22,9 @@ export struct AvailableSystemProperties {
export global SystemPageData {
in-out property <float> charge_control_end_threshold: 30;
callback set_charge_control_end_threshold(/* 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"),
@@ -47,34 +45,24 @@ export global SystemPageData {
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;
callback set_panel_od(bool);
in-out property <bool> mini_led_mode;
callback set_mini_led_mode(bool);
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,
@@ -102,7 +90,6 @@ export component PageSystem inherits Rectangle {
VerticalLayout {
padding: 10px;
spacing: 10px;
Rectangle {
background: Theme.background-color;
border-color: Colors.black;
@@ -221,6 +208,7 @@ export component PageSystem inherits Rectangle {
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;
@@ -240,6 +228,7 @@ export component PageSystem inherits Rectangle {
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;
@@ -279,7 +268,6 @@ export component PageSystem inherits Rectangle {
padding: 50px;
padding-top: 5px;
spacing: 10px;
GroupBox {
VerticalBox {
spacing: 10px;