From f7833fa6b364e01395a2310fd38dfd947b233347 Mon Sep 17 00:00:00 2001 From: armored-dragon Date: Sat, 23 Nov 2024 09:28:34 -0600 Subject: [PATCH] Added missing fullscreen monitor selection. --- .../settings/qml_widgets/SettingComboBox.qml | 19 ++++++++++++++++ scripts/system/settings/settings.qml | 22 +++++++++++++++++++ 2 files changed, 41 insertions(+) diff --git a/scripts/system/settings/qml_widgets/SettingComboBox.qml b/scripts/system/settings/qml_widgets/SettingComboBox.qml index baa8bd18ae..9fbc3852b1 100644 --- a/scripts/system/settings/qml_widgets/SettingComboBox.qml +++ b/scripts/system/settings/qml_widgets/SettingComboBox.qml @@ -6,6 +6,8 @@ Item { id: root; property string settingText: ""; property int optionIndex: 0; + property var _optionText: "" + readonly property string optionText: _optionText property var options: []; signal valueChanged(int index); @@ -37,6 +39,7 @@ Item { onCurrentIndexChanged: { valueChanged(currentIndex); + _optionText = options[currentIndex]; } delegate: ItemDelegate { @@ -118,4 +121,20 @@ Item { } } } + + // Updates the contents of a combobox. + // This is only required if the desired contents needs to be gathered from a javascript function and then set after the fact. + // Ideally, this would not be used, but sometimes you gotta do what you gotta do. + function setOptions(newOptions) { + // Clear the model + options = []; + + // Add the new options to the model + for (var opt of newOptions){ + options.push(opt); + } + + // Whack it with a hammer + control.model = options; + } } \ No newline at end of file diff --git a/scripts/system/settings/settings.qml b/scripts/system/settings/settings.qml index 19898055f9..64633f0b6f 100644 --- a/scripts/system/settings/settings.qml +++ b/scripts/system/settings/settings.qml @@ -257,6 +257,28 @@ Rectangle { } } + // Fullscreen Display + SettingComboBox { + settingText: "Fullscreen Display"; + + Component.onCompleted: { + var screens = Render.getScreens(); + var selected = Render.getFullScreenScreen(); + setOptions(screens); + + for (let i = 0; screens.length > i; i++) { + if (screens[i] == selected) { + optionIndex = i; + return; + } + } + } + + onValueChanged: { + Render.setFullScreenScreen(optionText); + } + } + // FOV SettingSlider { settingText: "Field of View";