mirror of
https://github.com/kunkundi/crossdesk.git
synced 2026-07-25 00:38:41 +08:00
fix: gray out unavailable hardware codec setting
This commit is contained in:
@@ -1782,9 +1782,9 @@ void GuiApplication::SyncMainWindow() {
|
||||
#if (((defined(_WIN32) || defined(__linux__)) && !defined(__aarch64__) && \
|
||||
!defined(__arm__) && USE_CUDA) || \
|
||||
defined(__APPLE__))
|
||||
ui_->main->set_hardware_codec_visible(true);
|
||||
ui_->main->set_hardware_codec_available(true);
|
||||
#else
|
||||
ui_->main->set_hardware_codec_visible(false);
|
||||
ui_->main->set_hardware_codec_available(false);
|
||||
#endif
|
||||
|
||||
if (show_offline_warning_window_) {
|
||||
|
||||
@@ -295,7 +295,7 @@ export component ImGuiCheckBox inherits Rectangle {
|
||||
border-radius: 4px;
|
||||
if root.checked: Text {
|
||||
text: FontAwesomeIcons.check;
|
||||
color: #2e86de;
|
||||
color: root.enabled ? #2e86de : #8b8f95;
|
||||
font-family: "Font Awesome 6 Free";
|
||||
font-weight: 900;
|
||||
font-size: 16px;
|
||||
|
||||
@@ -242,7 +242,9 @@ export component MainWindow inherits Window {
|
||||
in-out property <string> server-port: "";
|
||||
in-out property <string> coturn-port: "";
|
||||
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 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; }
|
||||
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; }
|
||||
if root.hardware-codec-visible: ImGuiCheckBox { x: root.compact-language ? 171px : 238px; y: 151px; checked <=> root.hardware-codec-enabled; enabled: !root.settings-session-active; }
|
||||
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; }
|
||||
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; }
|
||||
|
||||
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; }
|
||||
|
||||
@@ -14,11 +14,13 @@ int main() {
|
||||
window->set_connection_dialog_open(true);
|
||||
window->set_connection_password_required(true);
|
||||
window->set_settings_session_active(true);
|
||||
window->set_hardware_codec_available(false);
|
||||
window->set_portable_service_settings_visible(true);
|
||||
assert(std::string(window->get_local_id()) == "123 456 789");
|
||||
assert(window->get_connection_dialog_open());
|
||||
assert(window->get_connection_password_required());
|
||||
assert(window->get_settings_session_active());
|
||||
assert(!window->get_hardware_codec_available());
|
||||
assert(window->get_portable_service_settings_visible());
|
||||
window->set_settings_open(true);
|
||||
window->set_about_open(true);
|
||||
|
||||
@@ -87,6 +87,9 @@ function setup_targets()
|
||||
set_kind("binary")
|
||||
set_languages("c++20")
|
||||
set_default(false)
|
||||
if is_os("windows") then
|
||||
add_cxxflags("/bigobj")
|
||||
end
|
||||
add_packages("slint")
|
||||
add_rules("slint")
|
||||
add_files("src/gui/ui/crossdesk_ui.slint")
|
||||
|
||||
Reference in New Issue
Block a user