Files
asusctl/rog-control-center/ui/pages/fans.slint
2024-03-13 18:57:38 +13:00

155 lines
3.9 KiB
Plaintext

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";
component FanTab inherits Rectangle {
in-out property <bool> enabled: false;
in-out property <bool> tab_enabled: false;
in property <Profile> profile;
in property <FanType> fan_type;
callback apply();
callback cancel();
callback default();
callback toggled();
in property <string> title;
in-out property <[Node]> nodes;
if !root.tab_enabled: VerticalLayout {
alignment: center;
HorizontalLayout {
alignment: center;
Text {
font-size: 24px;
text: "WIP: Not enabled yet";
}
}
}
VerticalLayout {
HorizontalLayout {
Graph {
nodes <=> root.nodes;
}
}
HorizontalLayout {
alignment: LayoutAlignment.end;
CheckBox {
text: @tr("Enabled");
checked <=> root.enabled;
enabled <=> root.tab_enabled;
toggled => {
root.toggled();
}
}
Button {
text: @tr("Apply");
enabled <=> root.tab_enabled;
clicked => {
root.apply();
}
}
Button {
text: @tr("Cancel");
enabled <=> root.tab_enabled;
clicked => {
root.cancel()
}
}
Button {
text: @tr("Factory Default");
enabled <=> root.tab_enabled;
clicked => {
root.default();
}
}
}
}
}
export component PageFans inherits VerticalLayout {
TabWidget {
Tab {
title: @tr("Balanced");
TabWidget {
Tab {
title: @tr("CPU");
FanTab {
nodes <=> FanPageData.balanced_cpu;
}
}
Tab {
title: @tr("Mid");
FanTab {
nodes <=> FanPageData.balanced_mid;
}
}
Tab {
title: @tr("GPU");
FanTab {
nodes <=> FanPageData.balanced_gpu;
}
}
}
}
Tab {
title: @tr("Performance");
TabWidget {
Tab {
title: @tr("CPU");
FanTab {
nodes <=> FanPageData.performance_cpu;
}
}
Tab {
title: @tr("Mid");
FanTab {
nodes <=> FanPageData.performance_mid;
}
}
Tab {
title: @tr("GPU");
FanTab {
nodes <=> FanPageData.performance_gpu;
}
}
}
}
Tab {
title: @tr("Quiet");
TabWidget {
Tab {
title: @tr("CPU");
FanTab {
nodes <=> FanPageData.quiet_cpu;
}
}
Tab {
title: @tr("Mid");
FanTab {
nodes <=> FanPageData.quiet_mid;
}
}
Tab {
title: @tr("GPU");
FanTab {
nodes <=> FanPageData.quiet_gpu;
}
}
}
}
}
}