fix: gray out unavailable hardware codec setting

This commit is contained in:
dijunkun
2026-07-23 11:10:02 +08:00
parent 2c20599800
commit 31b8983328
5 changed files with 13 additions and 6 deletions
+2 -2
View File
@@ -1782,9 +1782,9 @@ void GuiApplication::SyncMainWindow() {
#if (((defined(_WIN32) || defined(__linux__)) && !defined(__aarch64__) && \ #if (((defined(_WIN32) || defined(__linux__)) && !defined(__aarch64__) && \
!defined(__arm__) && USE_CUDA) || \ !defined(__arm__) && USE_CUDA) || \
defined(__APPLE__)) defined(__APPLE__))
ui_->main->set_hardware_codec_visible(true); ui_->main->set_hardware_codec_available(true);
#else #else
ui_->main->set_hardware_codec_visible(false); ui_->main->set_hardware_codec_available(false);
#endif #endif
if (show_offline_warning_window_) { if (show_offline_warning_window_) {
+1 -1
View File
@@ -295,7 +295,7 @@ export component ImGuiCheckBox inherits Rectangle {
border-radius: 4px; border-radius: 4px;
if root.checked: Text { if root.checked: Text {
text: FontAwesomeIcons.check; text: FontAwesomeIcons.check;
color: #2e86de; color: root.enabled ? #2e86de : #8b8f95;
font-family: "Font Awesome 6 Free"; font-family: "Font Awesome 6 Free";
font-weight: 900; font-weight: 900;
font-size: 16px; font-size: 16px;
+5 -3
View File
@@ -242,7 +242,9 @@ export component MainWindow inherits Window {
in-out property <string> server-port: ""; in-out property <string> server-port: "";
in-out property <string> coturn-port: ""; in-out property <string> coturn-port: "";
in property <bool> settings-session-active: false; in property <bool> settings-session-active: false;
in property <bool> hardware-codec-visible: true; // Keep the setting visible on every platform. Unsupported builds expose it
// as disabled so the fixed settings layout never turns into a blank row.
in property <bool> hardware-codec-available: true;
callback copy-local-id; callback copy-local-id;
callback toggle-password-visibility; callback toggle-password-visibility;
@@ -1218,8 +1220,8 @@ export component MainWindow inherits Window {
CompactComboBox { x: root.compact-language ? 120px : 188px; y: 120px; enabled: !root.settings-session-active; model: [UiStrings.codec-h264, UiStrings.codec-av1]; current-index <=> root.codec-index; } CompactComboBox { x: root.compact-language ? 120px : 188px; y: 120px; enabled: !root.settings-session-active; model: [UiStrings.codec-h264, UiStrings.codec-av1]; current-index <=> root.codec-index; }
Rectangle { x: 7px; y: 147px; width: parent.width - 14px; height: 1px; background: ImGuiLineStyle.separator; } Rectangle { x: 7px; y: 147px; width: parent.width - 14px; height: 1px; background: ImGuiLineStyle.separator; }
if root.hardware-codec-visible: Text { x: 8px; y: 151px; width: root.compact-language ? 155px : 225px; height: 24px; text: UiStrings.hardware-codec; font-size: ImGuiFontStyle.body; overflow: elide; vertical-alignment: center; } Text { x: 8px; y: 151px; width: root.compact-language ? 155px : 225px; height: 24px; text: UiStrings.hardware-codec; color: root.hardware-codec-available ? #202124 : #8b8f95; font-size: ImGuiFontStyle.body; overflow: elide; vertical-alignment: center; }
if root.hardware-codec-visible: ImGuiCheckBox { x: root.compact-language ? 171px : 238px; y: 151px; checked <=> root.hardware-codec-enabled; enabled: !root.settings-session-active; } ImGuiCheckBox { x: root.compact-language ? 171px : 238px; y: 151px; checked <=> root.hardware-codec-enabled; enabled: root.hardware-codec-available && !root.settings-session-active; }
Rectangle { x: 7px; y: 177px; width: parent.width - 14px; height: 1px; background: ImGuiLineStyle.separator; } Rectangle { x: 7px; y: 177px; width: parent.width - 14px; height: 1px; background: ImGuiLineStyle.separator; }
Text { x: 8px; y: 181px; width: root.compact-language ? 155px : 225px; height: 24px; text: UiStrings.turn-relay; font-size: ImGuiFontStyle.body; overflow: elide; vertical-alignment: center; } Text { x: 8px; y: 181px; width: root.compact-language ? 155px : 225px; height: 24px; text: UiStrings.turn-relay; font-size: ImGuiFontStyle.body; overflow: elide; vertical-alignment: center; }
+2
View File
@@ -14,11 +14,13 @@ int main() {
window->set_connection_dialog_open(true); window->set_connection_dialog_open(true);
window->set_connection_password_required(true); window->set_connection_password_required(true);
window->set_settings_session_active(true); window->set_settings_session_active(true);
window->set_hardware_codec_available(false);
window->set_portable_service_settings_visible(true); window->set_portable_service_settings_visible(true);
assert(std::string(window->get_local_id()) == "123 456 789"); assert(std::string(window->get_local_id()) == "123 456 789");
assert(window->get_connection_dialog_open()); assert(window->get_connection_dialog_open());
assert(window->get_connection_password_required()); assert(window->get_connection_password_required());
assert(window->get_settings_session_active()); assert(window->get_settings_session_active());
assert(!window->get_hardware_codec_available());
assert(window->get_portable_service_settings_visible()); assert(window->get_portable_service_settings_visible());
window->set_settings_open(true); window->set_settings_open(true);
window->set_about_open(true); window->set_about_open(true);
+3
View File
@@ -87,6 +87,9 @@ function setup_targets()
set_kind("binary") set_kind("binary")
set_languages("c++20") set_languages("c++20")
set_default(false) set_default(false)
if is_os("windows") then
add_cxxflags("/bigobj")
end
add_packages("slint") add_packages("slint")
add_rules("slint") add_rules("slint")
add_files("src/gui/ui/crossdesk_ui.slint") add_files("src/gui/ui/crossdesk_ui.slint")