Rounded borders; collapsed bookmarks borders

This commit is contained in:
ChristianVisintin 2020-12-18 20:54:34 +01:00
parent 2a52a19552
commit 9c2e751e11
3 changed files with 64 additions and 14 deletions

View file

@ -13,7 +13,7 @@
Released on ??
*The Bookmarks Update*
> The Bookmarks Update
- **Bookmarks**
- Bookmarks and recent connections are now displayed in the home page
@ -22,9 +22,12 @@ Released on ??
- Windows: `C:\Users\Alice\AppData\Roaming\termscp\bookmarks.toml`
- MacOS: `/Users/Alice/Library/Application Support/termscp/bookmarks.toml`
- Enhancements:
- File explorer:
- Log how long it took to upload/download a file and the transfer speed
- Display in progress bar the transfer speed (bytes/seconds)
- User interface
- Collpased borders to make everything more *aesthetic*
- Rounded input field boards
- File explorer:
- Log how long it took to upload/download a file and the transfer speed
- Display in progress bar the transfer speed (bytes/seconds)
- Bugfix:
- File mode of file on remote is now reported on local file after being downloaded (unix, linux, macos only)
- Scp: when username was not provided, it didn't fallback to current username

View file

@ -33,7 +33,7 @@ use tui::{
layout::{Constraint, Corner, Direction, Layout, Rect},
style::{Color, Modifier, Style},
text::{Span, Spans, Text},
widgets::{Block, Borders, Clear, List, ListItem, ListState, Paragraph, Tabs},
widgets::{Block, BorderType, Borders, Clear, List, ListItem, ListState, Paragraph, Tabs},
};
use unicode_width::UnicodeWidthStr;
@ -179,6 +179,7 @@ impl AuthActivity {
.block(
Block::default()
.borders(Borders::ALL)
.border_type(BorderType::Rounded)
.title("Remote address"),
)
}
@ -192,7 +193,12 @@ impl AuthActivity {
InputField::Port => Style::default().fg(Color::Cyan),
_ => Style::default(),
})
.block(Block::default().borders(Borders::ALL).title("Remote port"))
.block(
Block::default()
.borders(Borders::ALL)
.border_type(BorderType::Rounded)
.title("Remote port"),
)
}
/// ### draw_protocol_select
@ -214,7 +220,12 @@ impl AuthActivity {
},
};
Tabs::new(protocols)
.block(Block::default().borders(Borders::ALL).title("Protocol"))
.block(
Block::default()
.borders(Borders::ALL)
.border_type(BorderType::Rounded)
.title("Protocol"),
)
.select(index)
.style(match self.selected_field {
InputField::Protocol => Style::default().fg(Color::Green),
@ -237,7 +248,12 @@ impl AuthActivity {
InputField::Username => Style::default().fg(Color::Magenta),
_ => Style::default(),
})
.block(Block::default().borders(Borders::ALL).title("Username"))
.block(
Block::default()
.borders(Borders::ALL)
.border_type(BorderType::Rounded)
.title("Username"),
)
}
/// ### draw_protocol_password
@ -251,7 +267,12 @@ impl AuthActivity {
InputField::Password => Style::default().fg(Color::LightBlue),
_ => Style::default(),
})
.block(Block::default().borders(Borders::ALL).title("Password"))
.block(
Block::default()
.borders(Borders::ALL)
.border_type(BorderType::Rounded)
.title("Password"),
)
}
/// ### draw_header
@ -363,7 +384,7 @@ impl AuthActivity {
List::new(hosts)
.block(
Block::default()
.borders(Borders::ALL)
.borders(Borders::TOP | Borders::BOTTOM | Borders::RIGHT)
.border_style(match self.input_form {
InputForm::Recents => Style::default().fg(Color::LightBlue),
_ => Style::default(),
@ -418,6 +439,7 @@ impl AuthActivity {
Block::default()
.borders(Borders::ALL)
.border_style(Style::default().fg(color))
.border_type(BorderType::Rounded)
.title("Alert"),
)
.start_corner(Corner::TopLeft)
@ -433,6 +455,7 @@ impl AuthActivity {
.block(
Block::default()
.borders(Borders::TOP | Borders::RIGHT | Borders::LEFT)
.border_type(BorderType::Rounded)
.title("Save bookmark as..."),
);
let choices: Vec<Spans> = vec![Spans::from("Yes"), Spans::from("No")];
@ -444,6 +467,7 @@ impl AuthActivity {
.block(
Block::default()
.borders(Borders::BOTTOM | Borders::RIGHT | Borders::LEFT)
.border_type(BorderType::Rounded)
.title("Save password?"),
)
.select(index)
@ -466,7 +490,12 @@ impl AuthActivity {
DialogYesNoOption::No => 1,
};
Tabs::new(choices)
.block(Block::default().borders(Borders::ALL).title(text))
.block(
Block::default()
.borders(Borders::ALL)
.border_type(BorderType::Rounded)
.title(text),
)
.select(index)
.style(Style::default())
.highlight_style(
@ -578,6 +607,7 @@ impl AuthActivity {
Block::default()
.borders(Borders::ALL)
.border_style(Style::default())
.border_type(BorderType::Rounded)
.title("Help"),
)
.start_corner(Corner::TopLeft)

View file

@ -36,7 +36,9 @@ use tui::{
layout::{Constraint, Corner, Direction, Layout, Rect},
style::{Color, Modifier, Style},
text::{Span, Spans},
widgets::{Block, Borders, Clear, Gauge, List, ListItem, ListState, Paragraph, Tabs},
widgets::{
Block, BorderType, Borders, Clear, Gauge, List, ListItem, ListState, Paragraph, Tabs,
},
};
use unicode_width::UnicodeWidthStr;
#[cfg(any(target_os = "unix", target_os = "macos", target_os = "linux"))]
@ -341,6 +343,7 @@ impl FileTransferActivity {
Block::default()
.borders(Borders::ALL)
.border_style(Style::default().fg(color))
.border_type(BorderType::Rounded)
.title("Alert"),
)
.start_corner(Corner::TopLeft)
@ -362,6 +365,7 @@ impl FileTransferActivity {
Block::default()
.borders(Borders::ALL)
.border_style(Style::default().fg(Color::Red))
.border_type(BorderType::Rounded)
.title("Fatal error"),
)
.start_corner(Corner::TopLeft)
@ -373,7 +377,12 @@ impl FileTransferActivity {
pub(super) fn draw_popup_input(&self, text: String) -> Paragraph {
Paragraph::new(self.input_txt.as_ref())
.style(Style::default().fg(Color::White))
.block(Block::default().borders(Borders::ALL).title(text))
.block(
Block::default()
.borders(Borders::ALL)
.border_type(BorderType::Rounded)
.title(text),
)
}
/// ### draw_popup_progress
@ -424,6 +433,7 @@ impl FileTransferActivity {
Block::default()
.borders(Borders::ALL)
.border_style(Style::default().fg(Color::White))
.border_type(BorderType::Rounded)
.title("Please wait"),
)
.start_corner(Corner::TopLeft)
@ -440,7 +450,12 @@ impl FileTransferActivity {
DialogYesNoOption::No => 1,
};
Tabs::new(choices)
.block(Block::default().borders(Borders::ALL).title(text))
.block(
Block::default()
.borders(Borders::ALL)
.border_type(BorderType::Rounded)
.title(text),
)
.select(index)
.style(Style::default())
.highlight_style(
@ -605,6 +620,7 @@ impl FileTransferActivity {
Block::default()
.borders(Borders::ALL)
.border_style(Style::default())
.border_type(BorderType::Rounded)
.title(file_name),
)
.start_corner(Corner::TopLeft)
@ -812,6 +828,7 @@ impl FileTransferActivity {
Block::default()
.borders(Borders::ALL)
.border_style(Style::default())
.border_type(BorderType::Rounded)
.title("Help"),
)
.start_corner(Corner::TopLeft)