From 2c0918fc06a30b13b9b982ec5159624a1bce16e6 Mon Sep 17 00:00:00 2001 From: dignow Date: Thu, 29 Jun 2023 22:25:01 +0800 Subject: [PATCH] debug done Signed-off-by: dignow --- flutter/lib/common.dart | 20 +++++++++++++++----- libs/clipboard/src/lib.rs | 2 +- src/server/video_service.rs | 2 +- src/ui/msgbox.tis | 9 +++++++++ 4 files changed, 26 insertions(+), 7 deletions(-) diff --git a/flutter/lib/common.dart b/flutter/lib/common.dart index 3a4f1f638..d294cb573 100644 --- a/flutter/lib/common.dart +++ b/flutter/lib/common.dart @@ -999,13 +999,23 @@ Widget msgboxIcon(String type) { // title should be null Widget msgboxContent(String type, String title, String text) { String translateText(String text) { - List words = text.split(' '); - if (words.isNotEmpty && words[0].endsWith('_tip')) { - words[0] = translate(words[0]); - return words.join(' '); + if (text.indexOf('Failed') == 0 && text.contains(': ')) { + List words = text.split(': '); + for (var i = 0; i < words.length; ++i) { + words[i] = translate(words[i]); + } + text = words.join(': '); } else { - return translate(text); + List words = text.split(' '); + if (words.length > 1 && words[0].endsWith('_tip')) { + words[0] = translate(words[0]); + final rest = text.substring(words[0].length + 1); + text = '${words[0]} ${translate(rest)}'; + } else { + text = translate(text); + } } + return text; } return Row( diff --git a/libs/clipboard/src/lib.rs b/libs/clipboard/src/lib.rs index 63f8df165..84179621d 100644 --- a/libs/clipboard/src/lib.rs +++ b/libs/clipboard/src/lib.rs @@ -478,7 +478,7 @@ extern "C" fn notify_callback(conn_id: UINT32, msg: *const NOTIFICATION_MESSAGE) match (CStr::from_ptr(msg.msg as _).to_str(), details) { (Ok(m), Ok(d)) => { let msgtype = format!( - "{}-nocancel-nook-hasclose", + "custom-{}-nocancel-nook-hasclose", if msg.r#type == 0 { "info" } else if msg.r#type == 1 { diff --git a/src/server/video_service.rs b/src/server/video_service.rs index 90c262cc9..ada41e266 100644 --- a/src/server/video_service.rs +++ b/src/server/video_service.rs @@ -987,7 +987,7 @@ fn try_get_displays() -> ResultType> { } #[inline] -#[cfg(windows)] +#[cfg(all(windows, feature = "virtual_display_driver"))] fn no_displays(displays: &Vec) -> bool { let display_len = displays.len(); if display_len == 0 { diff --git a/src/ui/msgbox.tis b/src/ui/msgbox.tis index 8d54bf22c..d54b22c8e 100644 --- a/src/ui/msgbox.tis +++ b/src/ui/msgbox.tis @@ -5,6 +5,15 @@ function translate_text(text) { fds[i] = translate(fds[i]); } text = fds.join(': '); + } else { + var fds = text.split(' '); + if (fds.length > 1 && fds[0].slice(-4) === '_tip') { + fds[0] = translate(fds[0]); + var rest = text.substring(fds[0].length + 1); + text = fds[0] + ' ' + translate(rest); + } else { + text = translate(text); + } } return text; }