mirror of
https://github.com/veeso/termscp.git
synced 2026-06-08 22:28:37 +02:00
feat: simplify progress bar layout to single component
This commit is contained in:
@@ -175,7 +175,7 @@ impl FileTransferActivity {
|
|||||||
Id::SaveAsPopup,
|
Id::SaveAsPopup,
|
||||||
Id::SymlinkPopup,
|
Id::SymlinkPopup,
|
||||||
Id::FileInfoPopup,
|
Id::FileInfoPopup,
|
||||||
Id::ProgressBarPartial,
|
Id::TransferProgressBar,
|
||||||
Id::DeletePopup,
|
Id::DeletePopup,
|
||||||
Id::ReplacePopup,
|
Id::ReplacePopup,
|
||||||
Id::DisconnectPopup,
|
Id::DisconnectPopup,
|
||||||
@@ -204,19 +204,11 @@ impl FileTransferActivity {
|
|||||||
f.render_widget(Clear, popup);
|
f.render_widget(Clear, popup);
|
||||||
self.app.view(popup_id, f, popup);
|
self.app.view(popup_id, f, popup);
|
||||||
}
|
}
|
||||||
// Dual-component progress bar
|
Id::TransferProgressBar => {
|
||||||
Id::ProgressBarPartial => {
|
|
||||||
let popup =
|
let popup =
|
||||||
Popup(Size::Percentage(50), Size::Percentage(20)).draw_in(f.area());
|
Popup(Size::Percentage(50), Size::Percentage(15)).draw_in(f.area());
|
||||||
f.render_widget(Clear, popup);
|
f.render_widget(Clear, popup);
|
||||||
let popup_chunks = Layout::default()
|
self.app.view(&Id::TransferProgressBar, f, popup);
|
||||||
.direction(Direction::Vertical)
|
|
||||||
.constraints(
|
|
||||||
[Constraint::Percentage(50), Constraint::Percentage(50)].as_ref(),
|
|
||||||
)
|
|
||||||
.split(popup);
|
|
||||||
self.app.view(&Id::ProgressBarFull, f, popup_chunks[0]);
|
|
||||||
self.app.view(&Id::ProgressBarPartial, f, popup_chunks[1]);
|
|
||||||
}
|
}
|
||||||
// Wait popup with dynamic line count
|
// Wait popup with dynamic line count
|
||||||
Id::WaitPopup => {
|
Id::WaitPopup => {
|
||||||
@@ -368,8 +360,7 @@ impl FileTransferActivity {
|
|||||||
Id::MkdirPopup,
|
Id::MkdirPopup,
|
||||||
Id::NewfilePopup,
|
Id::NewfilePopup,
|
||||||
Id::OpenWithPopup,
|
Id::OpenWithPopup,
|
||||||
Id::ProgressBarFull,
|
Id::TransferProgressBar,
|
||||||
Id::ProgressBarPartial,
|
|
||||||
Id::ExplorerFind,
|
Id::ExplorerFind,
|
||||||
Id::QuitPopup,
|
Id::QuitPopup,
|
||||||
Id::RenamePopup,
|
Id::RenamePopup,
|
||||||
|
|||||||
@@ -426,34 +426,19 @@ impl FileTransferActivity {
|
|||||||
&mut self,
|
&mut self,
|
||||||
root_name: String,
|
root_name: String,
|
||||||
) {
|
) {
|
||||||
let prog_color_full = self.theme().transfer_progress_bar_full;
|
let prog_color = self.theme().transfer_progress_bar_full;
|
||||||
let prog_color_partial = self.theme().transfer_progress_bar_partial;
|
|
||||||
ui_result(self.app.remount(
|
ui_result(self.app.remount(
|
||||||
Id::ProgressBarFull,
|
Id::TransferProgressBar,
|
||||||
Box::new(components::ProgressBarFull::new(
|
Box::new(components::TransferProgressBar::new(
|
||||||
0.0,
|
0.0, "", &root_name, prog_color,
|
||||||
"",
|
|
||||||
&root_name,
|
|
||||||
prog_color_full,
|
|
||||||
)),
|
)),
|
||||||
vec![],
|
vec![],
|
||||||
));
|
));
|
||||||
ui_result(self.app.remount(
|
ui_result(self.app.active(&Id::TransferProgressBar));
|
||||||
Id::ProgressBarPartial,
|
|
||||||
Box::new(components::ProgressBarPartial::new(
|
|
||||||
0.0,
|
|
||||||
"",
|
|
||||||
"Please wait",
|
|
||||||
prog_color_partial,
|
|
||||||
)),
|
|
||||||
vec![],
|
|
||||||
));
|
|
||||||
ui_result(self.app.active(&Id::ProgressBarPartial));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(in crate::ui::activities::filetransfer) fn umount_progress_bar(&mut self) {
|
pub(in crate::ui::activities::filetransfer) fn umount_progress_bar(&mut self) {
|
||||||
let _ = self.app.umount(&Id::ProgressBarPartial);
|
let _ = self.app.umount(&Id::TransferProgressBar);
|
||||||
let _ = self.app.umount(&Id::ProgressBarFull);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(in crate::ui::activities::filetransfer) fn mount_file_sorting(&mut self) {
|
pub(in crate::ui::activities::filetransfer) fn mount_file_sorting(&mut self) {
|
||||||
|
|||||||
Reference in New Issue
Block a user