mirror of
https://gitlab.com/asus-linux/asusctl.git
synced 2026-02-06 00:15:04 +01:00
Temporary fix of old keyboard+lightbar
This commit is contained in:
@@ -3,7 +3,7 @@ import { Palette, Button, ComboBox, VerticalBox, GroupBox } from "std-widgets.sl
|
||||
import { StyleMetrics, Slider, HorizontalBox, TextEdit, SpinBox, LineEdit, ScrollView } from "std-widgets.slint";
|
||||
import { ColourSlider } from "../widgets/colour_picker.slint";
|
||||
import { AuraPageData, AuraDevType, PowerZones, LaptopAuraPower, AuraEffect } from "../types/aura_types.slint";
|
||||
import { AuraPowerGroup } from "../widgets/aura_power.slint";
|
||||
import { AuraPowerGroup, AuraPowerGroupOld } from "../widgets/aura_power.slint";
|
||||
|
||||
export component PageAura inherits Rectangle {
|
||||
property <bool> show_fade_cover: false;
|
||||
@@ -192,8 +192,6 @@ export component PageAura inherits Rectangle {
|
||||
}
|
||||
|
||||
if root.show_fade_cover: Rectangle {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: Palette.background;
|
||||
opacity: 0.8;
|
||||
TouchArea {
|
||||
@@ -203,7 +201,7 @@ export component PageAura inherits Rectangle {
|
||||
}
|
||||
}
|
||||
|
||||
if root.show_aura_power && AuraPageData.aura_type == AuraDevType.New: Rectangle {
|
||||
if root.show_aura_power && AuraPageData.device_type == AuraDevType.New: Rectangle {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
opacity: 1;
|
||||
@@ -217,7 +215,7 @@ export component PageAura inherits Rectangle {
|
||||
for state[idx] in AuraPageData.led_power.states: zone := AuraPowerGroup {
|
||||
group-title: AuraPageData.power_zone_names[state.zone_name_idx];
|
||||
// TODO: use the zone name
|
||||
boot_checked: state.boot;
|
||||
boot_checked: state.boot;
|
||||
boot_toggled => {
|
||||
AuraPageData.led_power.states[idx].boot = zone.boot_checked;
|
||||
AuraPageData.set_led_power(AuraPageData.led_power);
|
||||
@@ -252,4 +250,57 @@ export component PageAura inherits Rectangle {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if root.show_aura_power && AuraPageData.device_type == AuraDevType.Old: Rectangle {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
opacity: 1;
|
||||
ScrollView {
|
||||
VerticalLayout {
|
||||
padding: 30px;
|
||||
padding-top: 10px;
|
||||
spacing: 10px;
|
||||
alignment: LayoutAlignment.start;
|
||||
|
||||
Text {
|
||||
text: "TODO: In progress";
|
||||
}
|
||||
|
||||
for state[idx] in AuraPageData.led_power.states: old_zone := AuraPowerGroupOld {
|
||||
group-title: @tr("Power Zones");
|
||||
zone_strings <=> AuraPageData.power_zone_names;
|
||||
selected_zone => {
|
||||
AuraPageData.led_power.states[idx].zone = AuraPageData.supported_power_zones[old_zone.current_zone];
|
||||
AuraPageData.set_led_power(AuraPageData.led_power);
|
||||
}
|
||||
boot_checked: state.boot;
|
||||
boot_toggled => {
|
||||
AuraPageData.led_power.states[idx].boot = old_zone.boot_checked;
|
||||
AuraPageData.set_led_power(AuraPageData.led_power);
|
||||
}
|
||||
awake_checked: state.awake;
|
||||
awake_toggled => {
|
||||
AuraPageData.led_power.states[idx].awake = old_zone.awake_checked;
|
||||
AuraPageData.set_led_power(AuraPageData.led_power);
|
||||
}
|
||||
sleep_checked: state.sleep;
|
||||
sleep_toggled => {
|
||||
AuraPageData.led_power.states[idx].sleep = old_zone.sleep_checked;
|
||||
AuraPageData.set_led_power(AuraPageData.led_power);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Button {
|
||||
x: root.width - self.width - 6px;
|
||||
y: 6px;
|
||||
text: "X";
|
||||
height: 40px;
|
||||
clicked => {
|
||||
root.show_aura_power = false;
|
||||
root.show_fade_cover = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,8 @@ export enum AuraDevType {
|
||||
New,
|
||||
Old,
|
||||
Tuf,
|
||||
ScsiExtDisk,
|
||||
Unknown,
|
||||
}
|
||||
|
||||
export struct AuraEffect {
|
||||
@@ -25,6 +27,7 @@ export enum PowerZones {
|
||||
Lightbar,
|
||||
Lid,
|
||||
RearGlow,
|
||||
KeyboardAndLightbar,
|
||||
}
|
||||
|
||||
export struct AuraPowerState {
|
||||
@@ -41,6 +44,7 @@ export struct LaptopAuraPower {
|
||||
}
|
||||
|
||||
export global AuraPageData {
|
||||
// The ordering must match the rog-aura crate
|
||||
in-out property <[string]> power_zone_names: [
|
||||
@tr("Aura power zone" => "Logo"),
|
||||
@tr("Aura power zone" => "Keyboard"),
|
||||
@@ -134,13 +138,15 @@ export global AuraPageData {
|
||||
}
|
||||
callback set_hex_from_colour(color) -> string;
|
||||
callback set_hex_to_colour(string) -> color;
|
||||
in-out property <AuraDevType> aura_type: AuraDevType.New;
|
||||
in-out property <AuraDevType> device_type: AuraDevType.New;
|
||||
// List of indexes to power_zone_names. Must correspond to rog-aura crate
|
||||
in-out property <[PowerZones]> supported_power_zones: [
|
||||
PowerZones.Keyboard,
|
||||
PowerZones.RearGlow,
|
||||
PowerZones.Lid,
|
||||
PowerZones.Lightbar,
|
||||
PowerZones.Logo
|
||||
PowerZones.Logo,
|
||||
PowerZones.KeyboardAndLightbar,
|
||||
];
|
||||
in-out property <LaptopAuraPower> led_power: {
|
||||
states: [{
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { Palette, VerticalBox, HorizontalBox, GroupBox } from "std-widgets.slint";
|
||||
import { SystemToggleVert } from "common.slint";
|
||||
import { SystemToggleVert, SystemDropdown } from "common.slint";
|
||||
import { PowerZones } from "../types/aura_types.slint";
|
||||
|
||||
export component AuraPowerGroup inherits Rectangle {
|
||||
min-width: row.min-width;
|
||||
@@ -68,3 +69,74 @@ export component AuraPowerGroup inherits Rectangle {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export component AuraPowerGroupOld inherits Rectangle {
|
||||
min-width: row.min-width;
|
||||
border-radius: 20px;
|
||||
background: Palette.alternate-background;
|
||||
opacity: 0.9;
|
||||
in-out property <int> current_zone;
|
||||
in-out property <[int]> zones;
|
||||
in-out property <[string]> zone_strings;
|
||||
in-out property <string> group-title;
|
||||
in-out property <bool> boot_checked;
|
||||
in-out property <bool> awake_checked;
|
||||
in-out property <bool> sleep_checked;
|
||||
callback boot_toggled(bool);
|
||||
callback awake_toggled(bool);
|
||||
callback sleep_toggled(bool);
|
||||
callback selected_zone(int);
|
||||
VerticalBox {
|
||||
spacing: 10px;
|
||||
Text {
|
||||
font-size: 18px;
|
||||
color: Palette.alternate-foreground;
|
||||
horizontal-alignment: TextHorizontalAlignment.center;
|
||||
text <=> root.group-title;
|
||||
}
|
||||
|
||||
row := HorizontalBox {
|
||||
alignment: LayoutAlignment.center;
|
||||
|
||||
SystemDropdown {
|
||||
text: @tr("Zone Selection");
|
||||
current_index <=> root.current_zone;
|
||||
current_value: root.zone_strings[root.current_zone];
|
||||
model <=> root.zone_strings;
|
||||
selected => {
|
||||
root.selected_zone(root.current_zone);
|
||||
}
|
||||
}
|
||||
|
||||
SystemToggleVert {
|
||||
min-width: 96px;
|
||||
max-height: 42px;
|
||||
text: @tr("Boot");
|
||||
checked <=> root.boot_checked;
|
||||
toggled => {
|
||||
root.boot_toggled(self.checked);
|
||||
}
|
||||
}
|
||||
|
||||
SystemToggleVert {
|
||||
min-width: 96px;
|
||||
max-height: 42px;
|
||||
text: @tr("Awake");
|
||||
checked <=> root.awake_checked;
|
||||
toggled => {
|
||||
root.awake_toggled(self.checked);
|
||||
}
|
||||
}
|
||||
|
||||
SystemToggleVert {
|
||||
min-width: 96px;
|
||||
max-height: 42px;
|
||||
text: @tr("Sleep");
|
||||
checked <=> root.sleep_checked;
|
||||
toggled => {
|
||||
root.sleep_toggled(self.checked);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user