fix: warnings and icon rendering

- Remove unused imports (HashMap, TextEdit)
- Remove unnecessary mut on fonts
- Replace ✕ (U+2715) with × (U+00D7) for close/cross icons
- Replace + (U+FF0B) with + (U+002B) for New Connection button
- Replace ▲/▼ (U+25B2/U+25BC) with ↑/↓ (U+2191/U+2193) for sort arrows
This commit is contained in:
loki5512344 2026-06-19 16:53:51 +02:00
parent 9cb8e47a97
commit f983f12bec
16 changed files with 1672 additions and 789 deletions

View file

@ -1,4 +1,3 @@
use std::collections::HashMap;
use std::sync::Arc;
use crate::domain::connection::{ConnectionParams, ConnectionStatus};
@ -45,17 +44,18 @@ pub struct HistoryEntry {
pub struct AppState {
pub tabs: Vec<ConnectionTab>,
pub active_tab: usize,
pub local_path: String,
pub local_entries: Vec<FileEntry>,
pub local_selected: Option<String>,
pub show_connect_dialog: bool,
pub show_bookmarks: bool,
pub show_history: bool,
pub bookmarks: Vec<Bookmark>,
pub history: Vec<HistoryEntry>,
pub tree_expanded: HashMap<String, bool>,
pub tree_children: HashMap<String, Vec<FileEntry>>,
pub tree_loading: HashMap<String, bool>,
pub connect_label: String,
pub connect_host: String,
pub connect_port: String,
@ -65,38 +65,50 @@ pub struct AppState {
pub connect_protocol: usize,
pub connect_error: String,
pub connect_loading: bool,
pub show_queue: bool,
pub queue_tasks: Vec<TransferTask>,
pub status_message: String,
pub agg_speed: u64,
pub connected_count: usize,
// action flags — выставляются тулбаром, обрабатываются в app.rs
pub pending_refresh: bool,
pub pending_mkdir: bool,
pub pending_delete: bool,
pub pending_rename: bool,
pub pending_connect: Option<PendingConnect>,
pub pending_remote_list: Vec<PendingRemoteList>,
}
impl Default for AppState {
fn default() -> Self {
let home = dirs::home_dir()
.unwrap_or_default()
.to_string_lossy()
.to_string();
Self {
tabs: Vec::new(),
active_tab: 0,
local_path: dirs::home_dir()
.unwrap_or_default()
.to_string_lossy()
.to_string(),
local_path: home.clone(),
local_entries: Vec::new(),
local_selected: None,
show_connect_dialog: false,
show_bookmarks: false,
show_history: false,
bookmarks: vec![
Bookmark { name: "Home".into(), path: dirs::home_dir().unwrap_or_default().to_string_lossy().to_string() },
Bookmark { name: "Root".into(), path: "/".into() },
Bookmark { name: "Downloads".into(), path: dirs::download_dir().map(|p| p.to_string_lossy().to_string()).unwrap_or_else(|| "/tmp".into()) },
Bookmark { name: "Home".into(), path: home.clone() },
Bookmark { name: "Desktop".into(), path: format!("{}/Desktop", home) },
Bookmark { name: "Documents".into(), path: format!("{}/Documents", home) },
Bookmark { name: "Downloads".into(), path: dirs::download_dir()
.map(|p| p.to_string_lossy().to_string())
.unwrap_or_else(|| format!("{}/Downloads", home)) },
Bookmark { name: "Pictures".into(), path: format!("{}/Pictures", home) },
Bookmark { name: "Music".into(), path: format!("{}/Music", home) },
Bookmark { name: "Videos".into(), path: format!("{}/Videos", home) },
],
history: Vec::new(),
tree_expanded: HashMap::new(),
tree_children: HashMap::new(),
tree_loading: HashMap::new(),
connect_label: String::new(),
connect_host: String::new(),
connect_port: "22".into(),
@ -109,8 +121,11 @@ impl Default for AppState {
show_queue: false,
queue_tasks: Vec::new(),
status_message: "Ready".into(),
agg_speed: 0,
connected_count: 0,
pending_refresh: false,
pending_mkdir: false,
pending_delete: false,
pending_rename: false,
pending_connect: None,
pending_remote_list: Vec::new(),
}
@ -119,34 +134,23 @@ impl Default for AppState {
impl AppState {
pub fn active_tab_mut(&mut self) -> Option<&mut ConnectionTab> {
if self.tabs.is_empty() {
None
} else {
let idx = self.active_tab.min(self.tabs.len() - 1);
Some(&mut self.tabs[idx])
}
if self.tabs.is_empty() { return None; }
let idx = self.active_tab.min(self.tabs.len() - 1);
Some(&mut self.tabs[idx])
}
pub fn active_tab_ref(&self) -> Option<&ConnectionTab> {
if self.tabs.is_empty() {
None
} else {
let idx = self.active_tab.min(self.tabs.len() - 1);
Some(&self.tabs[idx])
}
if self.tabs.is_empty() { return None; }
let idx = self.active_tab.min(self.tabs.len() - 1);
Some(&self.tabs[idx])
}
pub fn add_history(&mut self, host: &str, port: u16, user: &str) {
use chrono::Local;
let now = Local::now().format("%H:%M %d.%m").to_string();
self.history.insert(0, HistoryEntry {
host: host.into(),
port,
user: user.into(),
time: now,
host: host.into(), port, user: user.into(), time: now,
});
if self.history.len() > 20 {
self.history.truncate(20);
}
if self.history.len() > 20 { self.history.truncate(20); }
}
}