MCPcopy Index your code
hub / github.com/RustOtomeLab/RustEng / ui

Function ui

src/ui/initialize.rs:5–180  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

3slint::include_modules!();
4
5pub(crate) async fn ui() -> Result<(), EngineError> {
6 let window = MainWindow::new()?;
7 let weak = window.as_weak();
8
9 let mut executor = Executor::new(weak)?;
10
11 let executor_tx = load_data(&mut executor)?;
12
13 let mut is_fullscreen = false;
14 let weak_for_fullscreen = executor.get_weak();
15 window.on_toggle_fullscreen(move || {
16 if let Some(window) = weak_for_fullscreen.upgrade() {
17 is_fullscreen = !is_fullscreen;
18 if is_fullscreen {
19 window.window().set_fullscreen(true);
20 window.set_is_fullscreen(true);
21 } else {
22 window.window().set_fullscreen(false);
23 window.set_is_fullscreen(false);
24 }
25 }
26 });
27
28 window.on_save({
29 let mut executor = executor.clone();
30 move |index| {
31 executor.execute_save(index).expect("Save panicked");
32 }
33 });
34
35 window.on_load({
36 let mut executor = executor.clone();
37 move |name, index| {
38 executor
39 .execute_load(name.to_string(), index)
40 .expect("Load panicked");
41 }
42 });
43
44 window.on_get_ex({
45 let executor = executor.clone();
46 move || {
47 executor.execute_get_ex().expect("Get Ex panicked");
48 }
49 });
50
51 window.on_volume_changed({
52 let mut executor = executor.clone();
53 move || {
54 executor
55 .execute_bgm_volume()
56 .expect("bgm_volume change panicked");
57 executor
58 .execute_voice_volume()
59 .expect("voice_volume change panicked");
60 }
61 });
62

Callers 1

mainFunction · 0.85

Calls 15

load_dataFunction · 0.85
get_weakMethod · 0.80
execute_saveMethod · 0.80
execute_loadMethod · 0.80
execute_get_exMethod · 0.80
execute_bgm_volumeMethod · 0.80
execute_voice_volumeMethod · 0.80
execute_save_configMethod · 0.80
execute_chooseMethod · 0.80
execute_backlogMethod · 0.80
execute_backlog_jumpMethod · 0.80

Tested by

no test coverage detected