Release v2.5.6: window position and size persistence on launch and close
This commit is contained in:
Generated
+1
-1
@@ -6453,7 +6453,7 @@ checksum = "e13c156562582aa81c60cb29407084cdb54c4164760106ab78e6c5b0858cf64e"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "zerosend"
|
name = "zerosend"
|
||||||
version = "2.5.5"
|
version = "2.5.6"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"arboard",
|
"arboard",
|
||||||
"async-stream",
|
"async-stream",
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "zerosend"
|
name = "zerosend"
|
||||||
version = "2.5.5"
|
version = "2.5.6"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
description = "Fast, peer-to-peer file transfer designed for ZeroTier, Tailscale, Radmin VPN and LAN"
|
description = "Fast, peer-to-peer file transfer designed for ZeroTier, Tailscale, Radmin VPN and LAN"
|
||||||
authors = ["RarDog"]
|
authors = ["RarDog"]
|
||||||
|
|||||||
@@ -41,6 +41,10 @@ pub struct AppConfig {
|
|||||||
pub peer_aliases: HashMap<String, String>,
|
pub peer_aliases: HashMap<String, String>,
|
||||||
pub window_width: f32,
|
pub window_width: f32,
|
||||||
pub window_height: f32,
|
pub window_height: f32,
|
||||||
|
#[serde(default)]
|
||||||
|
pub window_x: Option<f32>,
|
||||||
|
#[serde(default)]
|
||||||
|
pub window_y: Option<f32>,
|
||||||
pub close_to_tray: bool,
|
pub close_to_tray: bool,
|
||||||
pub minimize_to_tray: bool,
|
pub minimize_to_tray: bool,
|
||||||
pub auto_zip_folders: bool,
|
pub auto_zip_folders: bool,
|
||||||
@@ -89,6 +93,8 @@ impl Default for AppConfig {
|
|||||||
peer_aliases: HashMap::new(),
|
peer_aliases: HashMap::new(),
|
||||||
window_width: 940.0,
|
window_width: 940.0,
|
||||||
window_height: 640.0,
|
window_height: 640.0,
|
||||||
|
window_x: None,
|
||||||
|
window_y: None,
|
||||||
close_to_tray: true,
|
close_to_tray: true,
|
||||||
minimize_to_tray: true,
|
minimize_to_tray: true,
|
||||||
auto_zip_folders: true,
|
auto_zip_folders: true,
|
||||||
|
|||||||
+9
-3
@@ -304,12 +304,18 @@ async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let start_minimized = (cli.tray || cli.minimized) && initial_files.is_empty();
|
let start_minimized = (cli.tray || cli.minimized) && initial_files.is_empty();
|
||||||
let options = eframe::NativeOptions {
|
let mut viewport = eframe::egui::ViewportBuilder::default()
|
||||||
viewport: eframe::egui::ViewportBuilder::default()
|
|
||||||
.with_inner_size([config.window_width, config.window_height])
|
.with_inner_size([config.window_width, config.window_height])
|
||||||
.with_min_inner_size([780.0, 500.0])
|
.with_min_inner_size([780.0, 500.0])
|
||||||
.with_visible(!start_minimized)
|
.with_visible(!start_minimized)
|
||||||
.with_title(format!("ZeroSend v{} - P2P Sharing for ZeroTier & VPN", env!("CARGO_PKG_VERSION"))),
|
.with_title(format!("ZeroSend v{} - P2P Sharing for ZeroTier & VPN", env!("CARGO_PKG_VERSION")));
|
||||||
|
|
||||||
|
if let (Some(x), Some(y)) = (config.window_x, config.window_y) {
|
||||||
|
viewport = viewport.with_position([x, y]);
|
||||||
|
}
|
||||||
|
|
||||||
|
let options = eframe::NativeOptions {
|
||||||
|
viewport,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
+38
-6
@@ -414,7 +414,7 @@ impl ZeroSendApp {
|
|||||||
selected_peer_ids: HashSet::new(),
|
selected_peer_ids: HashSet::new(),
|
||||||
queued_files: initial_files,
|
queued_files: initial_files,
|
||||||
transfers: initial_transfers,
|
transfers: initial_transfers,
|
||||||
logs: vec!["⚡ ZeroSend v2.5.5 ready".to_string()],
|
logs: vec!["⚡ ZeroSend v2.5.6 ready".to_string()],
|
||||||
text_input: String::new(),
|
text_input: String::new(),
|
||||||
analyzed_preview: analyze_text(""),
|
analyzed_preview: analyze_text(""),
|
||||||
recipient_pin: String::new(),
|
recipient_pin: String::new(),
|
||||||
@@ -4217,10 +4217,21 @@ impl ZeroSendApp {
|
|||||||
.stroke(theme.stroke_border)
|
.stroke(theme.stroke_border)
|
||||||
.inner_margin(Margin::same(14.0))
|
.inner_margin(Margin::same(14.0))
|
||||||
.show(ui, |ui| {
|
.show(ui, |ui| {
|
||||||
|
// v2.5.6
|
||||||
|
ui.horizontal(|ui| {
|
||||||
|
ui.label(RichText::new("v2.5.6").strong().color(Color32::from_rgb(34, 197, 94)));
|
||||||
|
ui.label(RichText::new("(Текущая версия)").size(11.0).color(Color32::GRAY));
|
||||||
|
});
|
||||||
|
ui.label(" • 🪟 Сохранение положения и размера окна: Позиция окна (X, Y) и его размеры теперь непрерывно отслеживаются и восстанавливаются при каждом запуске приложения.");
|
||||||
|
ui.label(" • 📤 Новый дизайн вкладки «Отправить файлы»: Мульти-выбор друзей карточками с ОС-иконками, бейджами сетей (ZeroTier/Tailscale/LAN), пингом и Drag & Drop.");
|
||||||
|
ui.label(" • 📁 Обновлённый проводник «Сетевые общие папки»: Интерактивные Breadcrumbs, поиск Grep, стриминг и скачивание с мгновенным переходом в историю передач.");
|
||||||
|
ui.add_space(8.0);
|
||||||
|
ui.separator();
|
||||||
|
ui.add_space(8.0);
|
||||||
|
|
||||||
// v2.5.5
|
// v2.5.5
|
||||||
ui.horizontal(|ui| {
|
ui.horizontal(|ui| {
|
||||||
ui.label(RichText::new("v2.5.5").strong().color(Color32::from_rgb(34, 197, 94)));
|
ui.label(RichText::new("v2.5.5").strong().color(Color32::from_rgb(56, 189, 248)));
|
||||||
ui.label(RichText::new("(Текущая версия)").size(11.0).color(Color32::GRAY));
|
|
||||||
});
|
});
|
||||||
ui.label(" • 📥 Мгновенное перенаправление в передачу файлов: При начале скачивания из общей папки приложение сразу переключается во вкладку передач и отображает статус загрузки.");
|
ui.label(" • 📥 Мгновенное перенаправление в передачу файлов: При начале скачивания из общей папки приложение сразу переключается во вкладку передач и отображает статус загрузки.");
|
||||||
ui.label(" • ⚡ Отслеживание скорости скачивания общих файлов в реальном времени с выводом прогресса в TransferProgress.");
|
ui.label(" • ⚡ Отслеживание скорости скачивания общих файлов в реальном времени с выводом прогресса в TransferProgress.");
|
||||||
@@ -4825,20 +4836,41 @@ impl eframe::App for ZeroSendApp {
|
|||||||
self.poll_events(ctx);
|
self.poll_events(ctx);
|
||||||
|
|
||||||
if ctx.input(|i| i.viewport().close_requested()) {
|
if ctx.input(|i| i.viewport().close_requested()) {
|
||||||
|
let _ = self.config.save();
|
||||||
if self.close_to_tray {
|
if self.close_to_tray {
|
||||||
ctx.send_viewport_cmd(egui::ViewportCommand::CancelClose);
|
ctx.send_viewport_cmd(egui::ViewportCommand::CancelClose);
|
||||||
ctx.send_viewport_cmd(egui::ViewportCommand::Visible(false));
|
ctx.send_viewport_cmd(egui::ViewportCommand::Visible(false));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Track & persist window position (X, Y)
|
||||||
|
if let Some(pos) = ctx.input(|i| i.viewport().outer_rect.map(|r| r.min)) {
|
||||||
|
// Filter out invalid / minimized off-screen coordinates (e.g. Windows minimized to -32000)
|
||||||
|
if pos.x > -10000.0 && pos.x < 30000.0 && pos.y > -10000.0 && pos.y < 30000.0 {
|
||||||
|
let pos_changed = match (self.config.window_x, self.config.window_y) {
|
||||||
|
(Some(x), Some(y)) => (x - pos.x).abs() > 4.0 || (y - pos.y).abs() > 4.0,
|
||||||
|
_ => true,
|
||||||
|
};
|
||||||
|
if pos_changed {
|
||||||
|
self.config.window_x = Some(pos.x);
|
||||||
|
self.config.window_y = Some(pos.y);
|
||||||
|
if self.last_window_save.elapsed() > Duration::from_secs(1) {
|
||||||
|
self.last_window_save = Instant::now();
|
||||||
|
let _ = self.config.save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Track & persist window size (Width, Height)
|
||||||
let cur_size = ctx.screen_rect().size();
|
let cur_size = ctx.screen_rect().size();
|
||||||
if cur_size.x >= 700.0 && cur_size.y >= 450.0 {
|
if cur_size.x >= 700.0 && cur_size.y >= 450.0 {
|
||||||
if (self.config.window_width - cur_size.x).abs() > 10.0
|
if (self.config.window_width - cur_size.x).abs() > 4.0
|
||||||
|| (self.config.window_height - cur_size.y).abs() > 10.0
|
|| (self.config.window_height - cur_size.y).abs() > 4.0
|
||||||
{
|
{
|
||||||
self.config.window_width = cur_size.x;
|
self.config.window_width = cur_size.x;
|
||||||
self.config.window_height = cur_size.y;
|
self.config.window_height = cur_size.y;
|
||||||
if self.last_window_save.elapsed() > Duration::from_secs(2) {
|
if self.last_window_save.elapsed() > Duration::from_secs(1) {
|
||||||
self.last_window_save = Instant::now();
|
self.last_window_save = Instant::now();
|
||||||
let _ = self.config.save();
|
let _ = self.config.save();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user