mirror of
https://gitlab.com/asus-linux/asusctl.git
synced 2026-02-06 00:15:04 +01:00
Many cleanup and fix
This commit is contained in:
@@ -46,14 +46,13 @@ versions.workspace = true
|
||||
nix = "^0.26.1"
|
||||
tempfile = "3.3.0"
|
||||
|
||||
i-slint-backend-selector = { git = "https://github.com/flukejones/sixtyfps.git", branch = "feat/color_hsv" }
|
||||
i-slint-core = { git = "https://github.com/flukejones/sixtyfps.git", branch = "feat/color_hsv" }
|
||||
i-slint-backend-winit = { git = "https://github.com/flukejones/sixtyfps.git", branch = "feat/color_hsv" }
|
||||
i-slint-backend-selector = { git = "https://github.com/slint-ui/slint.git" }
|
||||
i-slint-core = { git = "https://github.com/slint-ui/slint.git" }
|
||||
i-slint-backend-winit = { git = "https://github.com/slint-ui/slint.git" }
|
||||
winit = "*"
|
||||
|
||||
[dependencies.slint]
|
||||
git = "https://github.com/flukejones/sixtyfps.git"
|
||||
branch = "feat/color_hsv"
|
||||
git = "https://github.com/slint-ui/slint.git"
|
||||
default-features = false
|
||||
features = [
|
||||
"std",
|
||||
@@ -65,8 +64,7 @@ features = [
|
||||
]
|
||||
|
||||
[build-dependencies.slint-build]
|
||||
git = "https://github.com/flukejones/sixtyfps.git"
|
||||
branch = "feat/color_hsv"
|
||||
git = "https://github.com/slint-ui/slint.git"
|
||||
|
||||
[dev-dependencies]
|
||||
cargo-husky.workspace = true
|
||||
|
||||
@@ -86,10 +86,10 @@ impl From<SlintAuraPowerState> for AuraPowerState {
|
||||
fn from(value: SlintAuraPowerState) -> Self {
|
||||
Self {
|
||||
zone: value.zone.into(),
|
||||
boot: value.boot.into(),
|
||||
awake: value.awake.into(),
|
||||
sleep: value.sleep.into(),
|
||||
shutdown: value.shutdown.into(),
|
||||
boot: value.boot,
|
||||
awake: value.awake,
|
||||
sleep: value.sleep,
|
||||
shutdown: value.shutdown,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -98,10 +98,10 @@ impl From<AuraPowerState> for SlintAuraPowerState {
|
||||
fn from(value: AuraPowerState) -> Self {
|
||||
let zone = value.zone.into();
|
||||
SlintAuraPowerState {
|
||||
boot: value.boot.into(),
|
||||
awake: value.awake.into(),
|
||||
sleep: value.sleep.into(),
|
||||
shutdown: value.shutdown.into(),
|
||||
boot: value.boot,
|
||||
awake: value.awake,
|
||||
sleep: value.sleep,
|
||||
shutdown: value.shutdown,
|
||||
zone,
|
||||
zone_name_idx: zone as i32,
|
||||
}
|
||||
@@ -112,10 +112,10 @@ impl From<&AuraPowerState> for SlintAuraPowerState {
|
||||
fn from(value: &AuraPowerState) -> Self {
|
||||
let zone = value.zone.into();
|
||||
SlintAuraPowerState {
|
||||
boot: value.boot.into(),
|
||||
awake: value.awake.into(),
|
||||
sleep: value.sleep.into(),
|
||||
shutdown: value.shutdown.into(),
|
||||
boot: value.boot,
|
||||
awake: value.awake,
|
||||
sleep: value.sleep,
|
||||
shutdown: value.shutdown,
|
||||
zone,
|
||||
zone_name_idx: zone as i32,
|
||||
}
|
||||
@@ -134,11 +134,8 @@ impl From<SlintLaptopAuraPower> for rog_aura::keyboard::LaptopAuraPower {
|
||||
|
||||
impl From<LaptopAuraPower> for SlintLaptopAuraPower {
|
||||
fn from(value: LaptopAuraPower) -> Self {
|
||||
let converted: Vec<SlintAuraPowerState> = value
|
||||
.states
|
||||
.iter()
|
||||
.map(|s| SlintAuraPowerState::from(s))
|
||||
.collect();
|
||||
let converted: Vec<SlintAuraPowerState> =
|
||||
value.states.iter().map(SlintAuraPowerState::from).collect();
|
||||
Self {
|
||||
states: ModelRc::from(converted.as_slice()),
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"POT-Creation-Date: 2024-04-10 09:14+0000\n"
|
||||
"POT-Creation-Date: 2024-04-16 23:52+0000\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
|
||||
@@ -68,21 +68,23 @@ export component ColourSlider inherits VerticalLayout {
|
||||
];
|
||||
function blend_lightness(c1: color, f: float) -> color {
|
||||
rgb(c1.red * f, c1.green * f, c1.blue * f)
|
||||
}//
|
||||
}
|
||||
//
|
||||
function set_base_colour() {
|
||||
root.base_colour = base_colours[c1.value].mix(base_colours[c1.value + 1], c1.value - Math.floor(c1.value));
|
||||
root.final_colour = blend_lightness(base_colour, ((base_shade.length - c2.value) / base_shade.length));
|
||||
root.colourbox = root.final_colour;
|
||||
}//
|
||||
}
|
||||
//
|
||||
callback external_colour_change();
|
||||
|
||||
external_colour_change => {
|
||||
if (root.final_colour.hue < 0) {
|
||||
c1.value = (root.base_colours.length - 1) * ((root.final_colour.hue + 360) / 360);
|
||||
if (root.final_colour.to-hsv().hue < 0) {
|
||||
c1.value = (root.base_colours.length - 1) * ((root.final_colour.to-hsv().hue + 360) / 360);
|
||||
} else {
|
||||
c1.value = (root.base_colours.length - 1) * (root.final_colour.hue / 360);
|
||||
c1.value = (root.base_colours.length - 1) * (root.final_colour.to-hsv().hue / 360);
|
||||
}
|
||||
c2.value = root.base_shade.length - (root.base_shade.length * root.final_colour.value);
|
||||
c2.value = root.base_shade.length - (root.base_shade.length * root.final_colour.to-hsv().value);
|
||||
root.set_base_colour();
|
||||
}
|
||||
Rectangle {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Copyright © SixtyFPS GmbH <info@slint.dev>
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
import { StyleMetrics, Palette } from "std-widgets.slint";
|
||||
import { Palette, HorizontalBox, VerticalBox } from "std-widgets.slint";
|
||||
|
||||
component SideBarItem inherits Rectangle {
|
||||
padding: 10px;
|
||||
@@ -24,23 +24,23 @@ component SideBarItem inherits Rectangle {
|
||||
focused when root.has-focus: {
|
||||
state.opacity: 0.8;
|
||||
}
|
||||
]state := Rectangle {
|
||||
]
|
||||
state := Rectangle {
|
||||
opacity: 0;
|
||||
border-width: 2px;
|
||||
border-radius: 10px;
|
||||
border-color: StyleMetrics.default-text-color;
|
||||
background: StyleMetrics.window-background;
|
||||
border-color: Palette.accent-background;
|
||||
background: Palette.alternate-background;
|
||||
animate opacity { duration: 150ms; }
|
||||
animate border-width { duration: 150ms; }
|
||||
height: l.preferred-height;
|
||||
}
|
||||
|
||||
l := HorizontalLayout {
|
||||
l := HorizontalBox {
|
||||
y: (parent.height - self.height) / 2;
|
||||
padding: StyleMetrics.layout-padding;
|
||||
spacing: 0px;
|
||||
label := Text {
|
||||
color: StyleMetrics.default-text-color;
|
||||
color: Palette.foreground;
|
||||
vertical-alignment: center;
|
||||
}
|
||||
}
|
||||
@@ -57,14 +57,17 @@ export component SideBar inherits Rectangle {
|
||||
in property <string> title <=> label.text;
|
||||
out property <int> current-item: 0;
|
||||
out property <int> current-focused: fs.has-focus ? fs.focused-tab : -1;
|
||||
// The currently focused tab
|
||||
|
||||
width: 180px;
|
||||
// The currently focused tab
|
||||
width: 160px;
|
||||
forward-focus: fs;
|
||||
accessible-role: tab;
|
||||
accessible-delegate-focus: root.current-focused >= 0 ? root.current-focused : root.current-item;
|
||||
Rectangle {
|
||||
background: StyleMetrics.window-background.darker(0.2);
|
||||
border-width: 2px;
|
||||
border-color: Palette.accent-background;
|
||||
border-radius: 0px;
|
||||
background: Palette.background.darker(0.2);
|
||||
fs := FocusScope {
|
||||
key-pressed(event) => {
|
||||
if (event.text == "\n") {
|
||||
@@ -95,9 +98,8 @@ export component SideBar inherits Rectangle {
|
||||
}
|
||||
}
|
||||
|
||||
VerticalLayout {
|
||||
padding: StyleMetrics.layout-padding;
|
||||
spacing: StyleMetrics.layout-spacing;
|
||||
VerticalBox {
|
||||
spacing: 4px;
|
||||
alignment: start;
|
||||
label := Text {
|
||||
font-size: 16px;
|
||||
@@ -105,7 +107,7 @@ export component SideBar inherits Rectangle {
|
||||
}
|
||||
|
||||
navigation := VerticalLayout {
|
||||
// spacing: 10px;
|
||||
spacing: -6px;
|
||||
alignment: start;
|
||||
vertical-stretch: 0;
|
||||
for item[index] in root.model: SideBarItem {
|
||||
@@ -120,9 +122,10 @@ export component SideBar inherits Rectangle {
|
||||
}
|
||||
|
||||
VerticalLayout {
|
||||
bottom := VerticalLayout {
|
||||
padding-left: StyleMetrics.layout-padding;
|
||||
padding-right: StyleMetrics.layout-padding;
|
||||
bottom := VerticalBox {
|
||||
padding-left: 0px;
|
||||
padding-top: 0px;
|
||||
padding-bottom: 0px;
|
||||
@children
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user