mirror of
https://gitlab.com/asus-linux/asusctl.git
synced 2026-01-22 09:23:19 +01:00
feat: GUI rework
This commit is contained in:
@@ -102,8 +102,9 @@ pub fn setup_window(config: Arc<Mutex<Config>>) -> MainWindow {
|
|||||||
available.contains(&"xyz.ljones.Aura".to_string()),
|
available.contains(&"xyz.ljones.Aura".to_string()),
|
||||||
available.contains(&"xyz.ljones.Anime".to_string()),
|
available.contains(&"xyz.ljones.Anime".to_string()),
|
||||||
available.contains(&"xyz.ljones.FanCurves".to_string()),
|
available.contains(&"xyz.ljones.FanCurves".to_string()),
|
||||||
true,
|
true, // GPU Configuration
|
||||||
true,
|
true, // App Settings
|
||||||
|
true, // About
|
||||||
]
|
]
|
||||||
.into(),
|
.into(),
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import { PageFans } from "pages/fans.slint";
|
|||||||
import { PageAnime, AnimePageData } from "pages/anime.slint";
|
import { PageAnime, AnimePageData } from "pages/anime.slint";
|
||||||
import { RogItem } from "widgets/common.slint";
|
import { RogItem } from "widgets/common.slint";
|
||||||
import { PageAura } from "pages/aura.slint";
|
import { PageAura } from "pages/aura.slint";
|
||||||
|
import { PageGPU } from "pages/gpu.slint";
|
||||||
import { Node } from "widgets/graph.slint";
|
import { Node } from "widgets/graph.slint";
|
||||||
export { Node }
|
export { Node }
|
||||||
import { FanPageData, FanType, Profile } from "types/fan_types.slint";
|
import { FanPageData, FanType, Profile } from "types/fan_types.slint";
|
||||||
@@ -24,7 +25,15 @@ export component MainWindow inherits Window {
|
|||||||
default-font-size: 14px;
|
default-font-size: 14px;
|
||||||
default-font-weight: 400;
|
default-font-weight: 400;
|
||||||
icon: @image-url("../data/rog-control-center.png");
|
icon: @image-url("../data/rog-control-center.png");
|
||||||
in property <[bool]> sidebar_items_avilable: [true, true, true, true, true, true];
|
in property <[bool]> sidebar_items_avilable: [
|
||||||
|
true,
|
||||||
|
true,
|
||||||
|
true,
|
||||||
|
true,
|
||||||
|
true, // GPU Configuration
|
||||||
|
true, // App Settings
|
||||||
|
true, // About
|
||||||
|
];
|
||||||
private property <bool> show_notif;
|
private property <bool> show_notif;
|
||||||
private property <bool> fade_cover;
|
private property <bool> fade_cover;
|
||||||
private property <bool> toast: false;
|
private property <bool> toast: false;
|
||||||
@@ -58,8 +67,9 @@ export component MainWindow inherits Window {
|
|||||||
@tr("Menu2" => "Keyboard Aura"),
|
@tr("Menu2" => "Keyboard Aura"),
|
||||||
@tr("Menu3" => "AniMe Matrix"),
|
@tr("Menu3" => "AniMe Matrix"),
|
||||||
@tr("Menu4" => "Fan Curves"),
|
@tr("Menu4" => "Fan Curves"),
|
||||||
@tr("Menu5" => "App Settings"),
|
@tr("Menu5" => "GPU Configuration"),
|
||||||
@tr("Menu6" => "About"),
|
@tr("Menu6" => "App Settings"),
|
||||||
|
@tr("Menu7" => "About"),
|
||||||
];
|
];
|
||||||
available: root.sidebar_items_avilable;
|
available: root.sidebar_items_avilable;
|
||||||
}
|
}
|
||||||
@@ -89,26 +99,34 @@ export component MainWindow inherits Window {
|
|||||||
height: root.height + 12px;
|
height: root.height + 12px;
|
||||||
}
|
}
|
||||||
|
|
||||||
aura := PageAura {
|
/*if(side-bar.current-item == 1):*/ aura := PageAura {
|
||||||
width: root.width - side-bar.width;
|
width: root.width - side-bar.width;
|
||||||
visible: side-bar.current-item == 1;
|
visible: side-bar.current-item == 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(side-bar.current-item == 2): PageAnime {
|
if(side-bar.current-item == 2): PageAnime {
|
||||||
width: root.width - side-bar.width;
|
width: root.width - side-bar.width;
|
||||||
|
visible: side-bar.current-item == 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
fans := PageFans {
|
if(side-bar.current-item == 3): fans := PageFans {
|
||||||
width: root.width - side-bar.width;
|
width: root.width - side-bar.width;
|
||||||
visible: side-bar.current-item == 3;
|
visible: side-bar.current-item == 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(side-bar.current-item == 4): PageAppSettings {
|
if(side-bar.current-item == 4): PageGPU {
|
||||||
width: root.width - side-bar.width;
|
width: root.width - side-bar.width;
|
||||||
|
visible: side-bar.current-item == 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(side-bar.current-item == 5): PageAbout {
|
if(side-bar.current-item == 5): PageAppSettings {
|
||||||
width: root.width - side-bar.width;
|
width: root.width - side-bar.width;
|
||||||
|
visible: side-bar.current-item == 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(side-bar.current-item == 6): PageAbout {
|
||||||
|
width: root.width - side-bar.width;
|
||||||
|
visible: side-bar.current-item == 6;
|
||||||
}
|
}
|
||||||
|
|
||||||
if toast: Rectangle {
|
if toast: Rectangle {
|
||||||
|
|||||||
102
rog-control-center/ui/pages/gpu.slint
Normal file
102
rog-control-center/ui/pages/gpu.slint
Normal file
@@ -0,0 +1,102 @@
|
|||||||
|
import { Palette, TabWidget, Button, CheckBox } from "std-widgets.slint";
|
||||||
|
import { Graph, Node } from "../widgets/graph.slint";
|
||||||
|
import { SystemToggle } from "../widgets/common.slint";
|
||||||
|
import { Profile, FanType, FanPageData } from "../types/fan_types.slint";
|
||||||
|
import { Palette, HorizontalBox , VerticalBox, ScrollView, Slider, Button, Switch, ComboBox, GroupBox, StandardButton} from "std-widgets.slint";
|
||||||
|
|
||||||
|
export global GPUPageData {
|
||||||
|
// GPU mode and device state
|
||||||
|
in-out property <int> gpu_mux_mode: 1; // 0 = Ultra/Discreet, 1 = Integrated/Optimus
|
||||||
|
in-out property <int> dgpu_disabled: 0; // 1 == dGPU disabled
|
||||||
|
in-out property <int> egpu_enabled: 0; // 1 == eGPU (XGMobile) enabled
|
||||||
|
callback cb_gpu_mux_mode(int);
|
||||||
|
callback cb_dgpu_disabled(int);
|
||||||
|
callback cb_egpu_enabled(int);
|
||||||
|
}
|
||||||
|
|
||||||
|
export component PageGPU inherits Rectangle {
|
||||||
|
|
||||||
|
clip: true;
|
||||||
|
ScrollView {
|
||||||
|
VerticalLayout {
|
||||||
|
padding: 10px;
|
||||||
|
spacing: 10px;
|
||||||
|
alignment: LayoutAlignment.start;
|
||||||
|
Rectangle {
|
||||||
|
background: Palette.alternate-background;
|
||||||
|
border-color: Palette.accent-background;
|
||||||
|
border-width: 3px;
|
||||||
|
border-radius: 10px;
|
||||||
|
height: 40px;
|
||||||
|
Text {
|
||||||
|
font-size: 18px;
|
||||||
|
color: Palette.control-foreground;
|
||||||
|
horizontal-alignment: TextHorizontalAlignment.center;
|
||||||
|
text: @tr("GPU Configuration");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
GroupBox {
|
||||||
|
HorizontalLayout {
|
||||||
|
spacing: 10px;
|
||||||
|
|
||||||
|
// Ultra (discreet) mode button - disabled if dGPU is marked disabled
|
||||||
|
Rectangle {
|
||||||
|
width: 120px;
|
||||||
|
height: 36px;
|
||||||
|
border-radius: 6px;
|
||||||
|
border-color: Palette.border;
|
||||||
|
border-width: 2px;
|
||||||
|
background: GPUPageData.gpu_mux_mode == 0 ? Palette.accent-background : Palette.control-background;
|
||||||
|
opacity: GPUPageData.dgpu_disabled == 1 ? 0.5 : 1.0;
|
||||||
|
|
||||||
|
Text {
|
||||||
|
color: Palette.control-foreground;
|
||||||
|
horizontal-alignment: TextHorizontalAlignment.center;
|
||||||
|
vertical-alignment: TextVerticalAlignment.center;
|
||||||
|
text: @tr("Ultra");
|
||||||
|
}
|
||||||
|
|
||||||
|
TouchArea {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
clicked => {
|
||||||
|
if (GPUPageData.dgpu_disabled != 1 && GPUPageData.gpu_mux_mode != 0) {
|
||||||
|
GPUPageData.cb_gpu_mux_mode(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Integrated (Optimus) mode button
|
||||||
|
Rectangle {
|
||||||
|
width: 120px;
|
||||||
|
height: 36px;
|
||||||
|
border-radius: 6px;
|
||||||
|
border-color: Palette.border;
|
||||||
|
border-width: 2px;
|
||||||
|
background: GPUPageData.gpu_mux_mode == 1 ? Palette.accent-background : Palette.control-background;
|
||||||
|
|
||||||
|
Text {
|
||||||
|
color: Palette.control-foreground;
|
||||||
|
horizontal-alignment: TextHorizontalAlignment.center;
|
||||||
|
vertical-alignment: TextVerticalAlignment.center;
|
||||||
|
text: @tr("Integrated");
|
||||||
|
}
|
||||||
|
|
||||||
|
TouchArea {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
clicked => {
|
||||||
|
if (GPUPageData.gpu_mux_mode != 1) {
|
||||||
|
GPUPageData.cb_gpu_mux_mode(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -253,6 +253,66 @@ export component PageSystem inherits Rectangle {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if SystemPageData.kbd_leds_awake != -1 ||
|
||||||
|
SystemPageData.kbd_leds_sleep != -1 ||
|
||||||
|
SystemPageData.kbd_leds_boot != -1 ||
|
||||||
|
SystemPageData.kbd_leds_shutdown != -1: VerticalLayout {
|
||||||
|
padding: 0px;
|
||||||
|
spacing: 0px;
|
||||||
|
alignment: LayoutAlignment.start;
|
||||||
|
Rectangle {
|
||||||
|
background: Palette.alternate-background;
|
||||||
|
border-color: Palette.accent-background;
|
||||||
|
border-width: 3px;
|
||||||
|
border-radius: 10px;
|
||||||
|
height: 40px;
|
||||||
|
Text {
|
||||||
|
font-size: 18px;
|
||||||
|
color: Palette.control-foreground;
|
||||||
|
horizontal-alignment: TextHorizontalAlignment.center;
|
||||||
|
text: @tr("Keyboard Power Management");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
GroupBox {
|
||||||
|
|
||||||
|
HorizontalLayout {
|
||||||
|
spacing: 10px;
|
||||||
|
if SystemPageData.kbd_leds_awake != -1: SystemToggleInt {
|
||||||
|
text: @tr("Keyboard Awake Effect");
|
||||||
|
checked_int <=> SystemPageData.kbd_leds_awake;
|
||||||
|
toggled => {
|
||||||
|
SystemPageData.cb_kbd_leds_awake(SystemPageData.kbd_leds_awake)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if SystemPageData.kbd_leds_sleep != -1: SystemToggleInt {
|
||||||
|
text: @tr("Keyboard Sleep Effect");
|
||||||
|
checked_int <=> SystemPageData.kbd_leds_sleep;
|
||||||
|
toggled => {
|
||||||
|
SystemPageData.cb_kbd_leds_sleep(SystemPageData.kbd_leds_sleep)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if SystemPageData.kbd_leds_boot != -1: SystemToggleInt {
|
||||||
|
text: @tr("Keyboard Boot Effect");
|
||||||
|
checked_int <=> SystemPageData.kbd_leds_boot;
|
||||||
|
toggled => {
|
||||||
|
SystemPageData.cb_kbd_leds_boot(SystemPageData.kbd_leds_boot)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if SystemPageData.kbd_leds_shutdown != -1: SystemToggleInt {
|
||||||
|
text: @tr("Keyboard Shutdown Effect");
|
||||||
|
checked_int <=> SystemPageData.kbd_leds_shutdown;
|
||||||
|
toggled => {
|
||||||
|
SystemPageData.cb_kbd_leds_shutdown(SystemPageData.kbd_leds_shutdown)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
background: Palette.alternate-background;
|
background: Palette.alternate-background;
|
||||||
border-color: Palette.accent-background;
|
border-color: Palette.accent-background;
|
||||||
@@ -286,44 +346,6 @@ export component PageSystem inherits Rectangle {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
GroupBox {
|
|
||||||
title: @tr("Keyboard Power Management");
|
|
||||||
HorizontalLayout {
|
|
||||||
spacing: 10px;
|
|
||||||
if SystemPageData.kbd_leds_awake != -1: SystemToggleInt {
|
|
||||||
text: @tr("Keyboard Awake Effect");
|
|
||||||
checked_int <=> SystemPageData.kbd_leds_awake;
|
|
||||||
toggled => {
|
|
||||||
SystemPageData.cb_kbd_leds_awake(SystemPageData.kbd_leds_awake)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if SystemPageData.kbd_leds_sleep != -1: SystemToggleInt {
|
|
||||||
text: @tr("Keyboard Sleep Effect");
|
|
||||||
checked_int <=> SystemPageData.kbd_leds_sleep;
|
|
||||||
toggled => {
|
|
||||||
SystemPageData.cb_kbd_leds_sleep(SystemPageData.kbd_leds_sleep)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if SystemPageData.kbd_leds_boot != -1: SystemToggleInt {
|
|
||||||
text: @tr("Keyboard Boot Effect");
|
|
||||||
checked_int <=> SystemPageData.kbd_leds_boot;
|
|
||||||
toggled => {
|
|
||||||
SystemPageData.cb_kbd_leds_boot(SystemPageData.kbd_leds_boot)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if SystemPageData.kbd_leds_shutdown != -1: SystemToggleInt {
|
|
||||||
text: @tr("Keyboard Shutdown Effect");
|
|
||||||
checked_int <=> SystemPageData.kbd_leds_shutdown;
|
|
||||||
toggled => {
|
|
||||||
SystemPageData.cb_kbd_leds_shutdown(SystemPageData.kbd_leds_shutdown)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
HorizontalBox {
|
HorizontalBox {
|
||||||
padding: 0px;
|
padding: 0px;
|
||||||
spacing: 10px;
|
spacing: 10px;
|
||||||
|
|||||||
Reference in New Issue
Block a user