2025-12-07 06:33:33 +08:00
# User Handbook - Adding Boolean Settings Toggles
> [!WARNING]
> This guide is intended for developers ONLY. If you are not a developer, this likely irrelevant to yourself.
2025-12-08 03:33:14 +08:00
>
> If you want to add temporary toggles, please refer to **[Adding Debug Knobs](AddingDebugKnobs.md)**
2025-12-07 06:33:33 +08:00
This guide will walk you through adding a new boolean toggle setting to Eden's configuration across both Qt's (PC) and Kotlin's (Android) UIs.
2025-12-08 03:33:14 +08:00
## Index
2026-01-13 11:22:46 +08:00
1. [Step 1 - Common Setting ](#step-1-common-setting )
2. [Step 2 - Qt Toggle ](#step-2-qt-toggle )
3. [Step 3 - Kotlin (Android) ](#step-3-kotlin-android )
* [Step 3.1 - BooleanSetting.kt ](#step-3-1-booleansetting-kt )
* [Step 3.2 - SettingsItem.kt ](#step-3-2-settingsitem-kt )
* [Step 3.3 - SettingsFragmentPresenter.kt ](#step-3-3-settingsfragmentpresenter-kt )
* [Step 3.4 - Localization ](#step-3-4-localization )
4. [Step 4 - Use Your Toggle ](#step-4-use-your-toggle )
2025-12-08 03:33:14 +08:00
5. [Best Practices ](#best-practices )
---
2026-01-13 11:22:46 +08:00
## Step 1 - Common Setting
2025-12-08 03:33:14 +08:00
2026-01-13 11:22:46 +08:00
Firstly add your desired toggle:
2025-12-08 03:33:14 +08:00
2026-01-13 11:22:46 +08:00
Example: `src/common/setting.h`
```cpp
2025-12-07 06:33:33 +08:00
SwitchableSetting< bool > your_setting_name{linkage, false, "your_setting_name", Category::RendererExtensions};
```
2025-12-08 03:33:14 +08:00
2025-12-07 06:33:33 +08:00
### Remember to add your toggle to the appropriate category, for example:
2025-12-08 03:33:14 +08:00
2025-12-07 06:33:33 +08:00
Common Categories:
2025-12-08 03:33:14 +08:00
* Category::Renderer
* Category::RendererAdvanced
* Category::RendererExtensions
* Category::System
* Category::Core
2026-01-13 11:22:46 +08:00
> [!WARNING]
> If you wish for your toggle to be `on by default` then change `false` to `true` after `linkage,`.
2025-12-08 03:33:14 +08:00
---
2026-01-13 11:22:46 +08:00
## Step 2 - Qt Toggle
2025-12-08 03:33:14 +08:00
2026-01-13 11:22:46 +08:00
Add the toggle to the Qt UI, where you wish for it to appear and place it there.
2025-12-08 03:33:14 +08:00
2026-01-13 11:22:46 +08:00
Example: `src/qt_common/config/shared_translation.cpp`
```cpp
2025-12-07 06:33:33 +08:00
INSERT(Settings,
your_setting_name,
tr("Your Setting Display Name"),
tr("Detailed description of what this setting does.\n"
"You can use multiple lines.\n"
"Explain any caveats or requirements."));
```
2025-12-08 03:33:14 +08:00
2025-12-07 06:33:33 +08:00
### Make sure to:
2025-12-08 03:33:14 +08:00
* Keep display naming consistant
* Put detailed info in the description
* Use `\n` for line breaks in descriptions
---
2026-01-13 11:22:46 +08:00
## Step 3 - Kotlin (Android)
2025-12-08 03:33:14 +08:00
2026-01-13 11:22:46 +08:00
### Step 3.1 - BooleanSetting.kt
2025-12-08 03:33:14 +08:00
2026-01-13 11:22:46 +08:00
Add where it should be in the settings.
2025-12-08 03:33:14 +08:00
2026-01-13 11:22:46 +08:00
Example: `src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/BooleanSetting.kt`
```kts
2025-12-07 06:33:33 +08:00
RENDERER_YOUR_SETTING_NAME("your_setting_name"),
```
2025-12-08 03:33:14 +08:00
2026-01-13 11:22:46 +08:00
### Make sure to:
2025-12-07 06:33:33 +08:00
2026-01-13 11:22:46 +08:00
* Ensure the prefix naming matches the intended category.
2025-12-08 03:33:14 +08:00
2026-01-13 11:22:46 +08:00
---
2025-12-08 03:33:14 +08:00
2026-01-13 11:22:46 +08:00
### Step 3.2 - SettingsItem.kt
Add the toggle to the Kotlin (Android) UI
Example: `src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/view/SettingsItem.kt`
```kts
2025-12-07 06:33:33 +08:00
put(
SwitchSetting(
BooleanSetting.RENDERER_YOUR_SETTING_NAME,
titleId = R.string.your_setting_name,
descriptionId = R.string.your_setting_name_description
)
)
```
2026-01-13 11:22:46 +08:00
---
### Step 3.3 - SettingsFragmentPresenter.kt
2025-12-08 03:33:14 +08:00
2026-01-13 11:22:46 +08:00
Add your setting within the right category.
2025-12-08 03:33:14 +08:00
2026-01-13 11:22:46 +08:00
Example: `src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/ui/SettingsFragmentPresenter.kt`
```kts
2025-12-07 06:33:33 +08:00
add(BooleanSetting.RENDERER_YOUR_SETTING_NAME.key)
```
2025-12-08 03:33:14 +08:00
2026-01-13 11:22:46 +08:00
> [!WARNING]
> Remember, placing matters! Settings appear in the order of where you add them.
2025-12-07 06:33:33 +08:00
2026-01-13 11:22:46 +08:00
---
2025-12-08 03:33:14 +08:00
2026-01-13 11:22:46 +08:00
### Step 3.4 - Localization
2025-12-08 03:33:14 +08:00
2026-01-13 11:22:46 +08:00
Add your setting and description in the appropriate place.
Example: `src/android/app/src/main/res/values/strings.xml`
```xml
2025-12-07 06:33:33 +08:00
< string name = "your_setting_name" > Your Setting Display Name< / string >
< string name = "your_setting_name_description" > Detailed description of what this setting does. Explain any caveats, requirements, or warnings here.< / string >
```
2025-12-08 03:33:14 +08:00
---
2026-01-13 11:22:46 +08:00
## Step 4 - Use Your Toggle!
2025-12-08 03:33:14 +08:00
2025-12-07 06:33:33 +08:00
Now the UI part is done find a place in the code for the toggle,
And use it to your heart's desire!
2025-12-08 03:33:14 +08:00
2026-01-13 11:22:46 +08:00
Example:
```cpp
2025-12-07 06:33:33 +08:00
const bool your_value = Settings::values.your_setting_name.GetValue();
if (your_value) {
// Do something when enabled
}
```
2025-12-08 03:33:14 +08:00
2025-12-07 06:33:33 +08:00
If you wish to do something only when the toggle is disabled,
Use `if (!your_value) {` instead of `if (your_value) {` .
2025-12-08 03:33:14 +08:00
---
2025-12-07 06:33:33 +08:00
## Best Practices
2025-12-08 03:33:14 +08:00
* Naming - Use clear, descriptive names. Something for both the devs and the users.
* Defaults - Choose safe default values (usually false for new features).
* Documentation - Write clear descriptions explaining when and why to use the setting.
* Categories - Put settings in the appropriate category.
* Order - Place related settings near each other.
* Testing - Always test on both PC and Android before committing when possible.
### Thank you for reading, I hope this guide helped you making your toggle!