mirror of
https://gitlab.com/asus-linux/asusctl.git
synced 2026-01-22 17:33:19 +01:00
Fix multiple warnings
This commit is contained in:
@@ -1171,9 +1171,9 @@ fn print_firmware_attr(attr: &AsusArmouryProxyBlocking) -> Result<(), Box<dyn st
|
|||||||
|
|
||||||
fn handle_armoury_command(cmd: &ArmouryCommand) -> Result<(), Box<dyn std::error::Error>> {
|
fn handle_armoury_command(cmd: &ArmouryCommand) -> Result<(), Box<dyn std::error::Error>> {
|
||||||
{
|
{
|
||||||
if cmd.free.is_empty() || cmd.free.len() % 2 != 0 || cmd.help {
|
if cmd.free.is_empty() || !cmd.free.len().is_multiple_of(2) || cmd.help {
|
||||||
const USAGE: &str = "Usage: asusctl platform panel_overdrive 1 nv_dynamic_boost 5";
|
const USAGE: &str = "Usage: asusctl platform panel_overdrive 1 nv_dynamic_boost 5";
|
||||||
if cmd.free.len() % 2 != 0 {
|
if !cmd.free.len().is_multiple_of(2) {
|
||||||
println!(
|
println!(
|
||||||
"Incorrect number of args, each attribute label must be paired with a setting:"
|
"Incorrect number of args, each attribute label must be paired with a setting:"
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ impl Aura {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn lock_config(&self) -> MutexGuard<AuraConfig> {
|
pub async fn lock_config(&self) -> MutexGuard<'_, AuraConfig> {
|
||||||
self.config.lock().await
|
self.config.lock().await
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ impl ScsiAura {
|
|||||||
Self { device, config }
|
Self { device, config }
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn lock_config(&self) -> MutexGuard<ScsiConfig> {
|
pub async fn lock_config(&self) -> MutexGuard<'_, ScsiConfig> {
|
||||||
self.config.lock().await
|
self.config.lock().await
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ impl Slash {
|
|||||||
Self { hid, usb, config }
|
Self { hid, usb, config }
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn lock_config(&self) -> MutexGuard<SlashConfig> {
|
pub async fn lock_config(&self) -> MutexGuard<'_, SlashConfig> {
|
||||||
self.config.lock().await
|
self.config.lock().await
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ use slint::{ComponentHandle, Model, ModelRc, SharedString, VecModel};
|
|||||||
use super::show_toast;
|
use super::show_toast;
|
||||||
use crate::config::Config;
|
use crate::config::Config;
|
||||||
use crate::zbus_proxies::find_iface_async;
|
use crate::zbus_proxies::find_iface_async;
|
||||||
use crate::{set_ui_callbacks, set_ui_props_async, AttrMinMax, MainWindow, SystemPageData};
|
use crate::{set_ui_callbacks, AttrMinMax, MainWindow, SystemPageData};
|
||||||
|
|
||||||
const MINMAX: AttrMinMax = AttrMinMax {
|
const MINMAX: AttrMinMax = AttrMinMax {
|
||||||
min: 0,
|
min: 0,
|
||||||
@@ -572,120 +572,123 @@ pub fn setup_system_page_callbacks(ui: &MainWindow, _states: Arc<Mutex<Config>>)
|
|||||||
|
|
||||||
for attr in armoury_attrs {
|
for attr in armoury_attrs {
|
||||||
if let Ok(value) = attr.current_value().await {
|
if let Ok(value) = attr.current_value().await {
|
||||||
let name = attr.name().await.unwrap();
|
if let Ok(name) = attr.name().await {
|
||||||
debug!("Setting up {} = {value}", <&str>::from(name));
|
debug!("Setting up {} = {value}", <&str>::from(name));
|
||||||
let platform = platform.clone();
|
let platform = platform.clone();
|
||||||
handle
|
handle
|
||||||
.upgrade_in_event_loop(move |handle| match name {
|
.upgrade_in_event_loop(move |handle| match name {
|
||||||
FirmwareAttribute::ApuMem => {}
|
FirmwareAttribute::ApuMem => {}
|
||||||
FirmwareAttribute::CoresPerformance => {}
|
FirmwareAttribute::CoresPerformance => {}
|
||||||
FirmwareAttribute::CoresEfficiency => {}
|
FirmwareAttribute::CoresEfficiency => {}
|
||||||
FirmwareAttribute::PptEnabled => {
|
FirmwareAttribute::PptEnabled => {
|
||||||
init_property!(ppt_enabled, handle, value, bool);
|
init_property!(ppt_enabled, handle, value, bool);
|
||||||
setup_callback!(ppt_enabled, handle, attr, bool);
|
setup_callback!(ppt_enabled, handle, attr, bool);
|
||||||
let handle_copy = handle.as_weak();
|
let handle_copy = handle.as_weak();
|
||||||
let proxy_copy = attr.clone();
|
let proxy_copy = attr.clone();
|
||||||
tokio::spawn(async move {
|
tokio::spawn(async move {
|
||||||
let mut x = proxy_copy.receive_current_value_changed().await;
|
let mut x = proxy_copy.receive_current_value_changed().await;
|
||||||
use futures_util::StreamExt;
|
use futures_util::StreamExt;
|
||||||
while let Some(e) = x.next().await {
|
while let Some(e) = x.next().await {
|
||||||
if let Ok(out) = e.get().await {
|
if let Ok(out) = e.get().await {
|
||||||
handle_copy
|
handle_copy
|
||||||
.upgrade_in_event_loop(move |handle| {
|
.upgrade_in_event_loop(move |handle| {
|
||||||
handle
|
handle
|
||||||
.global::<SystemPageData>()
|
.global::<SystemPageData>()
|
||||||
.set_enable_ppt_group(out == 1);
|
.set_enable_ppt_group(out == 1);
|
||||||
handle
|
handle
|
||||||
.global::<SystemPageData>()
|
.global::<SystemPageData>()
|
||||||
.set_ppt_enabled(out == 1);
|
.set_ppt_enabled(out == 1);
|
||||||
})
|
})
|
||||||
.ok();
|
.ok();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
});
|
handle
|
||||||
handle
|
.global::<SystemPageData>()
|
||||||
.global::<SystemPageData>()
|
.set_ppt_enabled_available(true);
|
||||||
.set_ppt_enabled_available(true);
|
handle
|
||||||
handle
|
.global::<SystemPageData>()
|
||||||
.global::<SystemPageData>()
|
.set_enable_ppt_group(value == 1);
|
||||||
.set_enable_ppt_group(value == 1);
|
}
|
||||||
}
|
FirmwareAttribute::PptPl1Spl => {
|
||||||
FirmwareAttribute::PptPl1Spl => {
|
init_minmax_property!(ppt_pl1_spl, handle, attr);
|
||||||
init_minmax_property!(ppt_pl1_spl, handle, attr);
|
setup_callback!(ppt_pl1_spl, handle, attr, i32);
|
||||||
setup_callback!(ppt_pl1_spl, handle, attr, i32);
|
setup_callback_restore_default!(ppt_pl1_spl, handle, attr);
|
||||||
setup_callback_restore_default!(ppt_pl1_spl, handle, attr);
|
setup_minmax_external!(ppt_pl1_spl, handle, attr, platform);
|
||||||
setup_minmax_external!(ppt_pl1_spl, handle, attr, platform);
|
}
|
||||||
}
|
FirmwareAttribute::PptPl2Sppt => {
|
||||||
FirmwareAttribute::PptPl2Sppt => {
|
init_minmax_property!(ppt_pl2_sppt, handle, attr);
|
||||||
init_minmax_property!(ppt_pl2_sppt, handle, attr);
|
setup_callback!(ppt_pl2_sppt, handle, attr, i32);
|
||||||
setup_callback!(ppt_pl2_sppt, handle, attr, i32);
|
setup_callback_restore_default!(ppt_pl2_sppt, handle, attr);
|
||||||
setup_callback_restore_default!(ppt_pl2_sppt, handle, attr);
|
setup_minmax_external!(ppt_pl2_sppt, handle, attr, platform);
|
||||||
setup_minmax_external!(ppt_pl2_sppt, handle, attr, platform);
|
}
|
||||||
}
|
FirmwareAttribute::PptPl3Fppt => {
|
||||||
FirmwareAttribute::PptPl3Fppt => {
|
init_minmax_property!(ppt_pl3_fppt, handle, attr);
|
||||||
init_minmax_property!(ppt_pl3_fppt, handle, attr);
|
setup_callback!(ppt_pl3_fppt, handle, attr, i32);
|
||||||
setup_callback!(ppt_pl3_fppt, handle, attr, i32);
|
setup_callback_restore_default!(ppt_pl3_fppt, handle, attr);
|
||||||
setup_callback_restore_default!(ppt_pl3_fppt, handle, attr);
|
setup_minmax_external!(ppt_pl3_fppt, handle, attr, platform);
|
||||||
setup_minmax_external!(ppt_pl3_fppt, handle, attr, platform);
|
}
|
||||||
}
|
FirmwareAttribute::PptFppt => {
|
||||||
FirmwareAttribute::PptFppt => {
|
init_minmax_property!(ppt_fppt, handle, attr);
|
||||||
init_minmax_property!(ppt_fppt, handle, attr);
|
setup_callback!(ppt_fppt, handle, attr, i32);
|
||||||
setup_callback!(ppt_fppt, handle, attr, i32);
|
setup_callback_restore_default!(ppt_fppt, handle, attr);
|
||||||
setup_callback_restore_default!(ppt_fppt, handle, attr);
|
setup_minmax_external!(ppt_fppt, handle, attr, platform);
|
||||||
setup_minmax_external!(ppt_fppt, handle, attr, platform);
|
}
|
||||||
}
|
FirmwareAttribute::PptApuSppt => {
|
||||||
FirmwareAttribute::PptApuSppt => {
|
init_minmax_property!(ppt_apu_sppt, handle, attr);
|
||||||
init_minmax_property!(ppt_apu_sppt, handle, attr);
|
setup_callback!(ppt_apu_sppt, handle, attr, i32);
|
||||||
setup_callback!(ppt_apu_sppt, handle, attr, i32);
|
setup_callback_restore_default!(ppt_apu_sppt, handle, attr);
|
||||||
setup_callback_restore_default!(ppt_apu_sppt, handle, attr);
|
setup_minmax_external!(ppt_apu_sppt, handle, attr, platform);
|
||||||
setup_minmax_external!(ppt_apu_sppt, handle, attr, platform);
|
}
|
||||||
}
|
FirmwareAttribute::PptPlatformSppt => {
|
||||||
FirmwareAttribute::PptPlatformSppt => {
|
init_minmax_property!(ppt_platform_sppt, handle, attr);
|
||||||
init_minmax_property!(ppt_platform_sppt, handle, attr);
|
setup_callback!(ppt_platform_sppt, handle, attr, i32);
|
||||||
setup_callback!(ppt_platform_sppt, handle, attr, i32);
|
setup_callback_restore_default!(ppt_platform_sppt, handle, attr);
|
||||||
setup_callback_restore_default!(ppt_platform_sppt, handle, attr);
|
setup_minmax_external!(ppt_platform_sppt, handle, attr, platform);
|
||||||
setup_minmax_external!(ppt_platform_sppt, handle, attr, platform);
|
}
|
||||||
}
|
FirmwareAttribute::NvDynamicBoost => {
|
||||||
FirmwareAttribute::NvDynamicBoost => {
|
init_minmax_property!(nv_dynamic_boost, handle, attr);
|
||||||
init_minmax_property!(nv_dynamic_boost, handle, attr);
|
setup_callback!(nv_dynamic_boost, handle, attr, i32);
|
||||||
setup_callback!(nv_dynamic_boost, handle, attr, i32);
|
setup_callback_restore_default!(nv_dynamic_boost, handle, attr);
|
||||||
setup_callback_restore_default!(nv_dynamic_boost, handle, attr);
|
setup_minmax_external!(nv_dynamic_boost, handle, attr, platform);
|
||||||
setup_minmax_external!(nv_dynamic_boost, handle, attr, platform);
|
}
|
||||||
}
|
FirmwareAttribute::NvTempTarget => {
|
||||||
FirmwareAttribute::NvTempTarget => {
|
init_minmax_property!(nv_temp_target, handle, attr);
|
||||||
init_minmax_property!(nv_temp_target, handle, attr);
|
setup_callback!(nv_temp_target, handle, attr, i32);
|
||||||
setup_callback!(nv_temp_target, handle, attr, i32);
|
setup_callback_restore_default!(nv_temp_target, handle, attr);
|
||||||
setup_callback_restore_default!(nv_temp_target, handle, attr);
|
setup_minmax_external!(nv_temp_target, handle, attr, platform);
|
||||||
setup_minmax_external!(nv_temp_target, handle, attr, platform);
|
}
|
||||||
}
|
FirmwareAttribute::DgpuBaseTgp => {}
|
||||||
FirmwareAttribute::DgpuBaseTgp => {}
|
FirmwareAttribute::DgpuTgp => {}
|
||||||
FirmwareAttribute::DgpuTgp => {}
|
FirmwareAttribute::ChargeMode => {}
|
||||||
FirmwareAttribute::ChargeMode => {}
|
FirmwareAttribute::BootSound => {
|
||||||
FirmwareAttribute::BootSound => {
|
init_property!(boot_sound, handle, value, i32);
|
||||||
init_property!(boot_sound, handle, value, i32);
|
setup_callback!(boot_sound, handle, attr, i32);
|
||||||
setup_callback!(boot_sound, handle, attr, i32);
|
setup_external!(boot_sound, i32, handle, attr, value)
|
||||||
setup_external!(boot_sound, i32, handle, attr, value)
|
}
|
||||||
}
|
FirmwareAttribute::McuPowersave => {}
|
||||||
FirmwareAttribute::McuPowersave => {}
|
FirmwareAttribute::PanelOverdrive => {
|
||||||
FirmwareAttribute::PanelOverdrive => {
|
init_property!(panel_overdrive, handle, value, i32);
|
||||||
init_property!(panel_overdrive, handle, value, i32);
|
setup_callback!(panel_overdrive, handle, attr, i32);
|
||||||
setup_callback!(panel_overdrive, handle, attr, i32);
|
setup_external!(panel_overdrive, i32, handle, attr, value)
|
||||||
setup_external!(panel_overdrive, i32, handle, attr, value)
|
}
|
||||||
}
|
FirmwareAttribute::PanelHdMode => {}
|
||||||
FirmwareAttribute::PanelHdMode => {}
|
FirmwareAttribute::EgpuConnected => {}
|
||||||
FirmwareAttribute::EgpuConnected => {}
|
FirmwareAttribute::EgpuEnable => {}
|
||||||
FirmwareAttribute::EgpuEnable => {}
|
FirmwareAttribute::DgpuDisable => {}
|
||||||
FirmwareAttribute::DgpuDisable => {}
|
FirmwareAttribute::GpuMuxMode => {}
|
||||||
FirmwareAttribute::GpuMuxMode => {}
|
FirmwareAttribute::MiniLedMode => {
|
||||||
FirmwareAttribute::MiniLedMode => {
|
init_property!(mini_led_mode, handle, value, i32);
|
||||||
init_property!(mini_led_mode, handle, value, i32);
|
setup_callback!(mini_led_mode, handle, attr, i32);
|
||||||
setup_callback!(mini_led_mode, handle, attr, i32);
|
setup_external!(mini_led_mode, i32, handle, attr, value);
|
||||||
setup_external!(mini_led_mode, i32, handle, attr, value);
|
}
|
||||||
}
|
FirmwareAttribute::PendingReboot => {}
|
||||||
FirmwareAttribute::PendingReboot => {}
|
FirmwareAttribute::None => {}
|
||||||
FirmwareAttribute::None => {}
|
})
|
||||||
})
|
.ok();
|
||||||
.ok();
|
} else {
|
||||||
|
error!("Attribute with no name, skipping");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
handle
|
handle
|
||||||
|
|||||||
@@ -190,7 +190,9 @@ export component MainWindow inherits Window {
|
|||||||
y: 0px;
|
y: 0px;
|
||||||
width: root.width;
|
width: root.width;
|
||||||
height: root.height;
|
height: root.height;
|
||||||
padding: 10px;
|
|
||||||
|
//padding only has effect on layout elements
|
||||||
|
//padding: 10px;
|
||||||
|
|
||||||
background: Palette.background;
|
background: Palette.background;
|
||||||
border-color: Palette.border;
|
border-color: Palette.border;
|
||||||
|
|||||||
@@ -37,7 +37,8 @@ export component PageAnime inherits Rectangle {
|
|||||||
property <bool> show_builtin_advanced: false;
|
property <bool> show_builtin_advanced: false;
|
||||||
clip: true;
|
clip: true;
|
||||||
// TODO: slow with border-radius
|
// TODO: slow with border-radius
|
||||||
padding: 8px;
|
//padding only has effect on layout elements
|
||||||
|
//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;
|
// TODO: border-radius: 8px;
|
||||||
VerticalLayout {
|
VerticalLayout {
|
||||||
|
|||||||
@@ -16,7 +16,9 @@ export component PageAppSettings inherits VerticalLayout {
|
|||||||
Rectangle {
|
Rectangle {
|
||||||
clip: true;
|
clip: true;
|
||||||
// TODO: slow with border-radius
|
// TODO: slow with border-radius
|
||||||
padding: 8px;
|
//padding only has effect on layout elements
|
||||||
|
//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;
|
// TODO: border-radius: 8px;
|
||||||
mainview := VerticalLayout {
|
mainview := VerticalLayout {
|
||||||
|
|||||||
@@ -113,7 +113,8 @@ export component PageAura inherits Rectangle {
|
|||||||
min-height: 80px;
|
min-height: 80px;
|
||||||
max-height: 90px;
|
max-height: 90px;
|
||||||
RogItem {
|
RogItem {
|
||||||
padding: 0px;
|
//padding only has effect on layout elements
|
||||||
|
//padding: 0px;
|
||||||
VerticalBox {
|
VerticalBox {
|
||||||
Text {
|
Text {
|
||||||
text: @tr("Zone");
|
text: @tr("Zone");
|
||||||
@@ -136,7 +137,8 @@ export component PageAura inherits Rectangle {
|
|||||||
}
|
}
|
||||||
|
|
||||||
RogItem {
|
RogItem {
|
||||||
padding: 0px;
|
//padding only has effect on layout elements
|
||||||
|
//padding: 0px;
|
||||||
VerticalBox {
|
VerticalBox {
|
||||||
Text {
|
Text {
|
||||||
text: @tr("Direction");
|
text: @tr("Direction");
|
||||||
@@ -158,7 +160,8 @@ export component PageAura inherits Rectangle {
|
|||||||
}
|
}
|
||||||
|
|
||||||
RogItem {
|
RogItem {
|
||||||
padding: 0px;
|
//padding only has effect on layout elements
|
||||||
|
//padding: 0px;
|
||||||
VerticalBox {
|
VerticalBox {
|
||||||
Text {
|
Text {
|
||||||
text: @tr("Speed");
|
text: @tr("Speed");
|
||||||
|
|||||||
@@ -140,7 +140,8 @@ export component PageSystem inherits Rectangle {
|
|||||||
property <bool> show_fade_cover: false;
|
property <bool> show_fade_cover: false;
|
||||||
property <bool> show_throttle_advanced: false;
|
property <bool> show_throttle_advanced: false;
|
||||||
clip: true;
|
clip: true;
|
||||||
padding: 8px;
|
//padding only has effect on layout elements
|
||||||
|
//padding: 8px;
|
||||||
ScrollView {
|
ScrollView {
|
||||||
VerticalLayout {
|
VerticalLayout {
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
|
|||||||
@@ -4,7 +4,8 @@
|
|||||||
import { Palette, HorizontalBox, VerticalBox } from "std-widgets.slint";
|
import { Palette, HorizontalBox, VerticalBox } from "std-widgets.slint";
|
||||||
|
|
||||||
component SideBarItem inherits Rectangle {
|
component SideBarItem inherits Rectangle {
|
||||||
padding: 10px;
|
// padding only has effect on layout elements
|
||||||
|
// padding: 10px;
|
||||||
in property <bool> selected;
|
in property <bool> selected;
|
||||||
in property <bool> has-focus;
|
in property <bool> has-focus;
|
||||||
in-out property <string> text <=> label.text;
|
in-out property <string> text <=> label.text;
|
||||||
|
|||||||
Reference in New Issue
Block a user