mirror of
https://gitlab.com/asus-linux/asusctl.git
synced 2026-02-06 00:15:04 +01:00
Add tests, G513L laptop
This commit is contained in:
@@ -2,6 +2,7 @@ use std::sync::{Arc, Mutex};
|
||||
|
||||
use log::{error, info};
|
||||
use rog_aura::keyboard::LaptopAuraPower;
|
||||
use rog_aura::{AuraDeviceType, PowerZones};
|
||||
use rog_dbus::zbus_aura::AuraProxy;
|
||||
use slint::{ComponentHandle, Model, RgbaColor, SharedString};
|
||||
|
||||
@@ -84,24 +85,40 @@ pub fn setup_aura_page(ui: &MainWindow, _states: Arc<Mutex<Config>>) {
|
||||
set_ui_props_async!(handle, aura, AuraPageData, led_power);
|
||||
set_ui_props_async!(handle, aura, AuraPageData, device_type);
|
||||
|
||||
if let Ok(pow3r) = aura.supported_power_zones().await {
|
||||
if let Ok(mut pow3r) = aura.supported_power_zones().await {
|
||||
let dev_type = aura
|
||||
.device_type()
|
||||
.await
|
||||
.unwrap_or(AuraDeviceType::LaptopPost2021);
|
||||
log::debug!("Available LED power modes {pow3r:?}");
|
||||
handle
|
||||
.upgrade_in_event_loop(move |handle| {
|
||||
let power: Vec<SlintPowerZones> = pow3r.iter().map(|p| (*p).into()).collect();
|
||||
let names: Vec<SharedString> = handle
|
||||
.global::<AuraPageData>()
|
||||
.get_power_zone_names()
|
||||
.iter()
|
||||
.collect();
|
||||
let names: Vec<SharedString> =
|
||||
pow3r.iter().map(|n| names[(*n) as usize].clone()).collect();
|
||||
handle
|
||||
.global::<AuraPageData>()
|
||||
.set_supported_power_zones(power.as_slice().into());
|
||||
handle
|
||||
.global::<AuraPageData>()
|
||||
.set_power_zone_names_old(names.as_slice().into());
|
||||
|
||||
if dev_type.is_old_laptop() {
|
||||
// Need to add the specific KeyboardAndLightbar
|
||||
if pow3r.contains(&PowerZones::Keyboard)
|
||||
&& pow3r.contains(&PowerZones::Lightbar)
|
||||
{
|
||||
pow3r.push(PowerZones::KeyboardAndLightbar);
|
||||
}
|
||||
let names: Vec<SharedString> =
|
||||
pow3r.iter().map(|n| names[(*n) as usize].clone()).collect();
|
||||
handle
|
||||
.global::<AuraPageData>()
|
||||
.set_power_zone_names_old(names.as_slice().into());
|
||||
} else {
|
||||
let power: Vec<SlintPowerZones> =
|
||||
pow3r.iter().map(|p| (*p).into()).collect();
|
||||
|
||||
handle
|
||||
.global::<AuraPageData>()
|
||||
.set_supported_power_zones(power.as_slice().into());
|
||||
}
|
||||
})
|
||||
.ok();
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"POT-Creation-Date: 2024-05-14 05:08+0000\n"
|
||||
"POT-Creation-Date: 2024-05-16 21:35+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"
|
||||
@@ -642,42 +642,42 @@ msgctxt "AuraPowerGroupOld"
|
||||
msgid "Sleep"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/main_window.slint:50
|
||||
#: rog-control-center/ui/main_window.slint:51
|
||||
msgctxt "MainWindow"
|
||||
msgid "ROG"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/main_window.slint:52
|
||||
#: rog-control-center/ui/main_window.slint:53
|
||||
msgctxt "Menu1"
|
||||
msgid "System Control"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/main_window.slint:53
|
||||
#: rog-control-center/ui/main_window.slint:54
|
||||
msgctxt "Menu2"
|
||||
msgid "Keyboard Aura"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/main_window.slint:54
|
||||
#: rog-control-center/ui/main_window.slint:55
|
||||
msgctxt "Menu3"
|
||||
msgid "AniMe Matrix"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/main_window.slint:55
|
||||
#: rog-control-center/ui/main_window.slint:56
|
||||
msgctxt "Menu4"
|
||||
msgid "Fan Curves"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/main_window.slint:56
|
||||
#: rog-control-center/ui/main_window.slint:57
|
||||
msgctxt "Menu5"
|
||||
msgid "App Settings"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/main_window.slint:57
|
||||
#: rog-control-center/ui/main_window.slint:58
|
||||
msgctxt "Menu6"
|
||||
msgid "About"
|
||||
msgstr ""
|
||||
|
||||
#: rog-control-center/ui/main_window.slint:69
|
||||
#: rog-control-center/ui/main_window.slint:70
|
||||
msgctxt "MainWindow"
|
||||
msgid "Quit"
|
||||
msgstr ""
|
||||
|
||||
@@ -5,6 +5,7 @@ import { SideBar } from "widgets/sidebar.slint";
|
||||
import { PageAbout } from "pages/about.slint";
|
||||
import { PageFans } from "pages/fans.slint";
|
||||
import { PageAnime, AnimePageData } from "pages/anime.slint";
|
||||
import { RogItem } from "widgets/common.slint";
|
||||
import { PageAura } from "pages/aura.slint";
|
||||
import { Node } from "widgets/graph.slint";
|
||||
export { Node }
|
||||
@@ -178,4 +179,39 @@ export component MainWindow inherits Window {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if SomeError.error_message != "": Rectangle {
|
||||
x: 0px;
|
||||
y: 0px;
|
||||
width: root.width;
|
||||
height: root.height;
|
||||
padding: 10px;
|
||||
|
||||
background: Palette.background;
|
||||
border-color: Palette.border;
|
||||
border-width: 3px;
|
||||
border-radius: 10px;
|
||||
|
||||
VerticalBox {
|
||||
RogItem {
|
||||
min-height: 50px;
|
||||
max-height: 100px;
|
||||
Text {
|
||||
text <=> SomeError.error_message;
|
||||
font-size: 18px;
|
||||
}
|
||||
}
|
||||
|
||||
Text {
|
||||
text <=> SomeError.error_help;
|
||||
horizontal-alignment: TextHorizontalAlignment.center;
|
||||
vertical-alignment: TextVerticalAlignment.center;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export global SomeError {
|
||||
in property <string> error_message: "";
|
||||
in property <string> error_help: "";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user