multi flutter ui sessions, refact 'Show displays as individual windows'

Signed-off-by: dignow <linlong1265@gmail.com>
This commit is contained in:
dignow
2023-10-09 17:22:22 +08:00
parent e363cd9813
commit b52cf070f5
46 changed files with 140 additions and 118 deletions

View File

@@ -1207,6 +1207,17 @@ impl LoginConfigHandler {
self.save_config(config);
}
/// Save reverse mouse wheel ("", "Y") to the current config.
///
/// # Arguments
///
/// * `value` - The "displays_as_individual_windows" value ("", "Y").
pub fn save_displays_as_individual_windows(&mut self, value: String) {
let mut config = self.load_config();
config.displays_as_individual_windows = value;
self.save_config(config);
}
/// Save scroll style to the current config.
///
/// # Arguments

View File

@@ -339,6 +339,20 @@ pub fn session_set_reverse_mouse_wheel(session_id: SessionID, value: String) {
}
}
pub fn session_get_displays_as_individual_windows(session_id: SessionID) -> SyncReturn<Option<String>> {
if let Some(session) = sessions::get_session_by_session_id(&session_id) {
SyncReturn(Some(session.get_displays_as_individual_windows()))
} else {
SyncReturn(None)
}
}
pub fn session_set_displays_as_individual_windows(session_id: SessionID, value: String) {
if let Some(session) = sessions::get_session_by_session_id(&session_id) {
session.save_displays_as_individual_windows(value);
}
}
pub fn session_get_custom_image_quality(session_id: SessionID) -> Option<Vec<i32>> {
if let Some(session) = sessions::get_session_by_session_id(&session_id) {
Some(session.get_custom_image_quality())

View File

@@ -562,8 +562,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("display_is_plugged_out_msg", ""),
("No displays", ""),
("elevated_switch_display_msg", ""),
("Choose display behavior", ""),
("Switch display", ""),
("Open in new window", ""),
("Show displays as individual windows", ""),
].iter().cloned().collect();
}

View File

@@ -562,8 +562,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("display_is_plugged_out_msg", ""),
("No displays", ""),
("elevated_switch_display_msg", ""),
("Choose display behavior", ""),
("Switch display", ""),
("Open in new window", ""),
("Show displays as individual windows", ""),
].iter().cloned().collect();
}

View File

@@ -562,8 +562,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("display_is_plugged_out_msg", "显示器被拔出,切换到第一个显示器。"),
("No displays", "没有显示器。"),
("elevated_switch_display_msg", "切换到主显示器,因为提权后,不支持多显示器画面。"),
("Choose display behavior", "选择显示器的行为"),
("Switch display", "切换显示器"),
("Open in new window", "在新的窗口中打开"),
("Show displays as individual windows", "在单个窗口中打开显示器"),
].iter().cloned().collect();
}

View File

@@ -562,8 +562,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("display_is_plugged_out_msg", ""),
("No displays", ""),
("elevated_switch_display_msg", ""),
("Choose display behavior", ""),
("Switch display", ""),
("Open in new window", ""),
("Show displays as individual windows", ""),
].iter().cloned().collect();
}

View File

@@ -562,8 +562,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("display_is_plugged_out_msg", ""),
("No displays", ""),
("elevated_switch_display_msg", ""),
("Choose display behavior", ""),
("Switch display", ""),
("Open in new window", ""),
("Show displays as individual windows", ""),
].iter().cloned().collect();
}

View File

@@ -562,8 +562,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("display_is_plugged_out_msg", ""),
("No displays", ""),
("elevated_switch_display_msg", ""),
("Choose display behavior", ""),
("Switch display", ""),
("Open in new window", ""),
("Show displays as individual windows", ""),
].iter().cloned().collect();
}

View File

@@ -562,8 +562,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("display_is_plugged_out_msg", ""),
("No displays", ""),
("elevated_switch_display_msg", ""),
("Choose display behavior", ""),
("Switch display", ""),
("Open in new window", ""),
("Show displays as individual windows", ""),
].iter().cloned().collect();
}

View File

@@ -562,8 +562,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("display_is_plugged_out_msg", ""),
("No displays", ""),
("elevated_switch_display_msg", ""),
("Choose display behavior", ""),
("Switch display", ""),
("Open in new window", ""),
("Show displays as individual windows", ""),
].iter().cloned().collect();
}

View File

@@ -562,8 +562,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("display_is_plugged_out_msg", ""),
("No displays", ""),
("elevated_switch_display_msg", ""),
("Choose display behavior", ""),
("Switch display", ""),
("Open in new window", ""),
("Show displays as individual windows", ""),
].iter().cloned().collect();
}

View File

@@ -562,8 +562,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("display_is_plugged_out_msg", ""),
("No displays", ""),
("elevated_switch_display_msg", ""),
("Choose display behavior", ""),
("Switch display", ""),
("Open in new window", ""),
("Show displays as individual windows", ""),
].iter().cloned().collect();
}

View File

@@ -562,8 +562,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("display_is_plugged_out_msg", ""),
("No displays", ""),
("elevated_switch_display_msg", ""),
("Choose display behavior", ""),
("Switch display", ""),
("Open in new window", ""),
("Show displays as individual windows", ""),
].iter().cloned().collect();
}

View File

@@ -562,8 +562,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("display_is_plugged_out_msg", ""),
("No displays", ""),
("elevated_switch_display_msg", ""),
("Choose display behavior", ""),
("Switch display", ""),
("Open in new window", ""),
("Show displays as individual windows", ""),
].iter().cloned().collect();
}

View File

@@ -562,8 +562,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("display_is_plugged_out_msg", ""),
("No displays", ""),
("elevated_switch_display_msg", ""),
("Choose display behavior", ""),
("Switch display", ""),
("Open in new window", ""),
("Show displays as individual windows", ""),
].iter().cloned().collect();
}

View File

@@ -563,8 +563,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("display_is_plugged_out_msg", ""),
("No displays", ""),
("elevated_switch_display_msg", ""),
("Choose display behavior", ""),
("Switch display", ""),
("Open in new window", ""),
("Show displays as individual windows", ""),
].iter().cloned().collect();
}

View File

@@ -562,8 +562,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("display_is_plugged_out_msg", ""),
("No displays", ""),
("elevated_switch_display_msg", ""),
("Choose display behavior", ""),
("Switch display", ""),
("Open in new window", ""),
("Show displays as individual windows", ""),
].iter().cloned().collect();
}

View File

@@ -562,8 +562,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("display_is_plugged_out_msg", ""),
("No displays", ""),
("elevated_switch_display_msg", ""),
("Choose display behavior", ""),
("Switch display", ""),
("Open in new window", ""),
("Show displays as individual windows", ""),
].iter().cloned().collect();
}

View File

@@ -562,8 +562,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("display_is_plugged_out_msg", ""),
("No displays", ""),
("elevated_switch_display_msg", ""),
("Choose display behavior", ""),
("Switch display", ""),
("Open in new window", ""),
("Show displays as individual windows", ""),
].iter().cloned().collect();
}

View File

@@ -562,8 +562,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("display_is_plugged_out_msg", ""),
("No displays", ""),
("elevated_switch_display_msg", ""),
("Choose display behavior", ""),
("Switch display", ""),
("Open in new window", ""),
("Show displays as individual windows", ""),
].iter().cloned().collect();
}

View File

@@ -562,8 +562,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("display_is_plugged_out_msg", ""),
("No displays", ""),
("elevated_switch_display_msg", ""),
("Choose display behavior", ""),
("Switch display", ""),
("Open in new window", ""),
("Show displays as individual windows", ""),
].iter().cloned().collect();
}

View File

@@ -562,8 +562,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("display_is_plugged_out_msg", ""),
("No displays", ""),
("elevated_switch_display_msg", ""),
("Choose Display Behavior", ""),
("Switch display", ""),
("Open in new window", ""),
("Show displays as individual windows", ""),
].iter().cloned().collect();
}

View File

@@ -562,8 +562,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("display_is_plugged_out_msg", ""),
("No displays", ""),
("elevated_switch_display_msg", ""),
("Choose display behavior", ""),
("Switch display", ""),
("Open in new window", ""),
("Show displays as individual windows", ""),
].iter().cloned().collect();
}

View File

@@ -562,8 +562,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("display_is_plugged_out_msg", ""),
("No displays", ""),
("elevated_switch_display_msg", ""),
("Choose display behavior", ""),
("Switch display", ""),
("Open in new window", ""),
("Show displays as individual windows", ""),
].iter().cloned().collect();
}

View File

@@ -562,8 +562,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("display_is_plugged_out_msg", ""),
("No displays", ""),
("elevated_switch_display_msg", ""),
("Choose display behavior", ""),
("Switch display", ""),
("Open in new window", ""),
("Show displays as individual windows", ""),
].iter().cloned().collect();
}

View File

@@ -562,8 +562,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("display_is_plugged_out_msg", ""),
("No displays", ""),
("elevated_switch_display_msg", ""),
("Choose display behavior", ""),
("Switch display", ""),
("Open in new window", ""),
("Show displays as individual windows", ""),
].iter().cloned().collect();
}

View File

@@ -562,8 +562,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("display_is_plugged_out_msg", ""),
("No displays", ""),
("elevated_switch_display_msg", ""),
("Choose display behavior", ""),
("Switch display", ""),
("Open in new window", ""),
("Show displays as individual windows", ""),
].iter().cloned().collect();
}

View File

@@ -562,8 +562,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("display_is_plugged_out_msg", ""),
("No displays", ""),
("elevated_switch_display_msg", ""),
("Choose display behavior", ""),
("Switch display", ""),
("Open in new window", ""),
("Show displays as individual windows", ""),
].iter().cloned().collect();
}

View File

@@ -562,8 +562,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("display_is_plugged_out_msg", ""),
("No displays", ""),
("elevated_switch_display_msg", ""),
("Choose display behavior", ""),
("Switch display", ""),
("Open in new window", ""),
("Show displays as individual windows", ""),
].iter().cloned().collect();
}

View File

@@ -562,8 +562,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("display_is_plugged_out_msg", ""),
("No displays", ""),
("elevated_switch_display_msg", ""),
("Choose display behavior", ""),
("Switch display", ""),
("Open in new window", ""),
("Show displays as individual windows", ""),
].iter().cloned().collect();
}

View File

@@ -562,8 +562,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("display_is_plugged_out_msg", ""),
("No displays", ""),
("elevated_switch_display_msg", ""),
("Choose display behavior", ""),
("Switch display", ""),
("Open in new window", ""),
("Show displays as individual windows", ""),
].iter().cloned().collect();
}

View File

@@ -562,8 +562,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("display_is_plugged_out_msg", ""),
("No displays", ""),
("elevated_switch_display_msg", ""),
("Choose display behavior", ""),
("Switch display", ""),
("Open in new window", ""),
("Show displays as individual windows", ""),
].iter().cloned().collect();
}

View File

@@ -562,8 +562,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("display_is_plugged_out_msg", ""),
("No displays", ""),
("elevated_switch_display_msg", ""),
("Choose display behavior", ""),
("Switch display", ""),
("Open in new window", ""),
("Show displays as individual windows", ""),
].iter().cloned().collect();
}

View File

@@ -562,8 +562,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("display_is_plugged_out_msg", ""),
("No displays", ""),
("elevated_switch_display_msg", ""),
("Choose display behavior", ""),
("Switch display", ""),
("Open in new window", ""),
("Show displays as individual windows", ""),
].iter().cloned().collect();
}

View File

@@ -562,8 +562,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("display_is_plugged_out_msg", ""),
("No displays", ""),
("elevated_switch_display_msg", ""),
("Choose display behavior", ""),
("Switch display", ""),
("Open in new window", ""),
("Show displays as individual windows", ""),
].iter().cloned().collect();
}

View File

@@ -562,8 +562,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("display_is_plugged_out_msg", ""),
("No displays", ""),
("elevated_switch_display_msg", ""),
("Choose display behavior", ""),
("Switch display", ""),
("Open in new window", ""),
("Show displays as individual windows", ""),
].iter().cloned().collect();
}

View File

@@ -562,8 +562,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("display_is_plugged_out_msg", ""),
("No displays", ""),
("elevated_switch_display_msg", ""),
("Choose display behavior", ""),
("Switch display", ""),
("Open in new window", ""),
("Show displays as individual windows", ""),
].iter().cloned().collect();
}

View File

@@ -562,8 +562,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("display_is_plugged_out_msg", ""),
("No displays", ""),
("elevated_switch_display_msg", ""),
("Choose display behavior", ""),
("Switch display", ""),
("Open in new window", ""),
("Show displays as individual windows", ""),
].iter().cloned().collect();
}

View File

@@ -236,10 +236,18 @@ impl<T: InvokeUiSession> Session<T> {
self.lc.read().unwrap().reverse_mouse_wheel.clone()
}
pub fn get_displays_as_individual_windows(&self) -> String {
self.lc.read().unwrap().displays_as_individual_windows.clone()
}
pub fn save_reverse_mouse_wheel(&self, value: String) {
self.lc.write().unwrap().save_reverse_mouse_wheel(value);
}
pub fn save_displays_as_individual_windows(&self, value: String) {
self.lc.write().unwrap().save_displays_as_individual_windows(value);
}
pub fn save_view_style(&self, value: String) {
self.lc.write().unwrap().save_view_style(value);
}