feat: pc restart

Signed-off-by: 21pages <pages21@163.com>
This commit is contained in:
21pages
2022-07-25 19:35:15 +08:00
parent 4d1d90a090
commit 461a87bce9
30 changed files with 198 additions and 11 deletions

View File

@@ -234,6 +234,7 @@ impl sciter::EventHandler for Handler {
fn has_hwcodec();
fn supported_hwcodec();
fn change_prefer_codec();
fn restart_remote_device();
}
}
@@ -634,6 +635,16 @@ impl Handler {
self.send(Data::Message(msg));
}
fn restart_remote_device(&mut self) {
self.lc.write().unwrap().restarting_remote_device = true;
let msg = self.lc.write().unwrap().restart_remote_device();
self.send(Data::Message(msg));
}
pub fn is_restarting_remote_device(&self) -> bool {
self.lc.read().unwrap().restarting_remote_device
}
fn t(&self, name: String) -> String {
crate::client::translate(name)
}
@@ -1487,8 +1498,13 @@ impl Remote {
}
}
} else {
log::info!("Reset by the peer");
self.handler.msgbox("error", "Connection Error", "Reset by the peer");
if self.handler.is_restarting_remote_device() {
log::info!("Restart remote device");
self.handler.msgbox("restarting", "Restarting Remote Device", "Remote device is restarting, please close this message box and reconnect with permanent password after a while");
} else {
log::info!("Reset by the peer");
self.handler.msgbox("error", "Connection Error", "Reset by the peer");
}
break;
}
}
@@ -2319,6 +2335,10 @@ impl Remote {
self.handler
.call2("setPermission", &make_args!("file", p.enabled));
}
Permission::Restart => {
self.handler
.call2("setPermission", &make_args!("restart", p.enabled));
}
}
}
Some(misc::Union::SwitchDisplay(s)) => {