Use switch instead of checkbox (#785)

This commit is contained in:
Logan McNaughton 2026-04-20 04:27:44 -06:00 committed by GitHub
parent b8c3556df6
commit cf3a27cecf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 22 additions and 23 deletions

View File

@ -1,7 +1,7 @@
// Copyright © SixtyFPS GmbH <info@slint.dev>
// SPDX-License-Identifier: MIT
import { ListView, HorizontalBox, VerticalBox, Button, GroupBox, CheckBox } from "std-widgets.slint";
import { ListView, HorizontalBox, VerticalBox, Button, GroupBox, Switch, CheckBox } from "std-widgets.slint";
import { Page } from "page.slint";
import { SettingsData } from "settings_page.slint";
@ -62,8 +62,7 @@ export component Cheats inherits Page {
wrap: word-wrap;
}
if data.options.length == 0: CheckBox {
text: @tr("Enabled");
if data.options.length == 0: Switch {
checked: data.enabled;
toggled => {
data.enabled = self.checked;

View File

@ -1,7 +1,7 @@
// Copyright © SixtyFPS GmbH <info@slint.dev>
// SPDX-License-Identifier: MIT
import { CheckBox, ComboBox, Button, HorizontalBox, VerticalBox, GroupBox } from "std-widgets.slint";
import { Switch, ComboBox, Button, HorizontalBox, VerticalBox, GroupBox } from "std-widgets.slint";
import { Page } from "page.slint";
import { State } from "localgame_page.slint";
@ -55,7 +55,7 @@ export component ControllerConfig inherits Page {
title: @tr("Enabled");
VerticalLayout {
alignment: space-between;
for player in [0, 1, 2, 3]: CheckBox {
for player in [0, 1, 2, 3]: Switch {
checked: ControllerData.controller_enabled[player];
toggled => {
ControllerData.controller_enabled[player] = self.checked;
@ -68,7 +68,7 @@ export component ControllerConfig inherits Page {
title: @tr("Emulate VRU");
VerticalLayout {
alignment: space-between;
for valid in [false, false, false, true]: CheckBox {
for valid in [false, false, false, true]: Switch {
enabled: valid;
checked: valid && ControllerData.emulate_vru;
toggled => {
@ -82,7 +82,7 @@ export component ControllerConfig inherits Page {
title: @tr("Transfer Pak");
VerticalLayout {
alignment: space-between;
for player in [0, 1, 2, 3]: CheckBox {
for player in [0, 1, 2, 3]: Switch {
checked: ControllerData.transferpak[player];
toggled => {
ControllerData.transferpak[player] = self.checked;

View File

@ -1,4 +1,4 @@
import { StandardButton, HorizontalBox, VerticalBox, Button, LineEdit, CheckBox, Slider } from "std-widgets.slint";
import { StandardButton, HorizontalBox, VerticalBox, Button, LineEdit, Switch, Slider } from "std-widgets.slint";
export global InputProfileData {
in-out property <bool> dinput;
@ -47,7 +47,7 @@ export component InputProfileDialog inherits Window {
HorizontalBox {
alignment: center;
CheckBox {
Switch {
text: @tr("Use DirectInput");
checked: InputProfileData.dinput;
toggled => {

View File

@ -1,7 +1,7 @@
// Copyright © SixtyFPS GmbH <info@slint.dev>
// SPDX-License-Identifier: MIT
import { LineEdit, CheckBox, Button, HorizontalBox, VerticalBox } from "std-widgets.slint";
import { LineEdit, Switch, Button, HorizontalBox, VerticalBox } from "std-widgets.slint";
import { Page } from "page.slint";
export global RAData {
@ -27,7 +27,7 @@ export component RetroAchievements inherits Page {
alignment: start;
HorizontalBox {
alignment: start;
CheckBox {
Switch {
text: @tr("Enabled");
checked: RAData.enabled;
toggled => {
@ -45,7 +45,7 @@ export component RetroAchievements inherits Page {
}
HorizontalBox {
alignment: start;
CheckBox {
Switch {
text: @tr("Hardcore mode");
checked: RAData.hardcore;
enabled: RAData.enabled;
@ -57,7 +57,7 @@ export component RetroAchievements inherits Page {
}
HorizontalBox {
alignment: start;
CheckBox {
Switch {
text: @tr("Challenge Indicators");
checked: RAData.challenge;
enabled: RAData.enabled;
@ -69,7 +69,7 @@ export component RetroAchievements inherits Page {
}
HorizontalBox {
alignment: start;
CheckBox {
Switch {
text: @tr("Leaderboard Trackers");
checked: RAData.leaderboard;
enabled: RAData.enabled;

View File

@ -1,7 +1,7 @@
// Copyright © SixtyFPS GmbH <info@slint.dev>
// SPDX-License-Identifier: MIT
import { ComboBox, HorizontalBox, VerticalBox, CheckBox } from "std-widgets.slint";
import { ComboBox, HorizontalBox, VerticalBox, Switch } from "std-widgets.slint";
import { Page } from "page.slint";
export global SettingsData {
@ -40,7 +40,7 @@ export component Settings inherits Page {
HorizontalBox {
alignment: start;
CheckBox {
Switch {
text: @tr("Integer Scaling");
checked: SettingsData.integer_scaling;
toggled => {
@ -51,7 +51,7 @@ export component Settings inherits Page {
HorizontalBox {
alignment: start;
CheckBox {
Switch {
text: @tr("Fullscreen (Esc closes game)");
checked: SettingsData.fullscreen;
toggled => {
@ -62,7 +62,7 @@ export component Settings inherits Page {
HorizontalBox {
alignment: start;
CheckBox {
Switch {
text: @tr("Widescreen (stretch)");
checked: SettingsData.widescreen;
toggled => {
@ -73,7 +73,7 @@ export component Settings inherits Page {
HorizontalBox {
alignment: start;
CheckBox {
Switch {
text: @tr("VSync");
checked: SettingsData.vsync;
toggled => {
@ -84,7 +84,7 @@ export component Settings inherits Page {
HorizontalBox {
alignment: start;
CheckBox {
Switch {
text: @tr("Apply CRT shader");
checked: SettingsData.apply_crt_shader;
toggled => {
@ -99,7 +99,7 @@ export component Settings inherits Page {
HorizontalBox {
alignment: start;
CheckBox {
Switch {
text: @tr("Overclock N64 CPU (may cause bugs)");
checked: SettingsData.overclock_n64_cpu;
toggled => {
@ -110,7 +110,7 @@ export component Settings inherits Page {
HorizontalBox {
alignment: start;
CheckBox {
Switch {
text: @tr("Disable Expansion Pak");
checked: SettingsData.disable_expansion_pak;
toggled => {
@ -121,7 +121,7 @@ export component Settings inherits Page {
HorizontalBox {
alignment: start;
CheckBox {
Switch {
text: @tr("Emulate UNFLoader");
checked: SettingsData.emulate_usb;
toggled => {