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 ?? Released on ??
*The Bookmarks Update* > The Bookmarks Update
- **Bookmarks** - **Bookmarks**
- Bookmarks and recent connections are now displayed in the home page - 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` - Windows: `C:\Users\Alice\AppData\Roaming\termscp\bookmarks.toml`
- MacOS: `/Users/Alice/Library/Application Support/termscp/bookmarks.toml` - MacOS: `/Users/Alice/Library/Application Support/termscp/bookmarks.toml`
- Enhancements: - Enhancements:
- File explorer: - User interface
- Log how long it took to upload/download a file and the transfer speed - Collpased borders to make everything more *aesthetic*
- Display in progress bar the transfer speed (bytes/seconds) - 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: - Bugfix:
- File mode of file on remote is now reported on local file after being downloaded (unix, linux, macos only) - 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 - 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}, layout::{Constraint, Corner, Direction, Layout, Rect},
style::{Color, Modifier, Style}, style::{Color, Modifier, Style},
text::{Span, Spans, Text}, 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; use unicode_width::UnicodeWidthStr;
@@ -179,6 +179,7 @@ impl AuthActivity {
.block( .block(
Block::default() Block::default()
.borders(Borders::ALL) .borders(Borders::ALL)
.border_type(BorderType::Rounded)
.title("Remote address"), .title("Remote address"),
) )
} }
@@ -192,7 +193,12 @@ impl AuthActivity {
InputField::Port => Style::default().fg(Color::Cyan), InputField::Port => Style::default().fg(Color::Cyan),
_ => Style::default(), _ => 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 /// ### draw_protocol_select
@@ -214,7 +220,12 @@ impl AuthActivity {
}, },
}; };
Tabs::new(protocols) 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) .select(index)
.style(match self.selected_field { .style(match self.selected_field {
InputField::Protocol => Style::default().fg(Color::Green), InputField::Protocol => Style::default().fg(Color::Green),
@@ -237,7 +248,12 @@ impl AuthActivity {
InputField::Username => Style::default().fg(Color::Magenta), InputField::Username => Style::default().fg(Color::Magenta),
_ => Style::default(), _ => 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 /// ### draw_protocol_password
@@ -251,7 +267,12 @@ impl AuthActivity {
InputField::Password => Style::default().fg(Color::LightBlue), InputField::Password => Style::default().fg(Color::LightBlue),
_ => Style::default(), _ => Style::default(),
}) })
.block(Block::default().borders(Borders::ALL).title("Password")) .block(
Block::default()
.borders(Borders::ALL)
.border_type(BorderType::Rounded)
.title("Password"),
)
} }
/// ### draw_header /// ### draw_header
@@ -363,7 +384,7 @@ impl AuthActivity {
List::new(hosts) List::new(hosts)
.block( .block(
Block::default() Block::default()
.borders(Borders::ALL) .borders(Borders::TOP | Borders::BOTTOM | Borders::RIGHT)
.border_style(match self.input_form { .border_style(match self.input_form {
InputForm::Recents => Style::default().fg(Color::LightBlue), InputForm::Recents => Style::default().fg(Color::LightBlue),
_ => Style::default(), _ => Style::default(),
@@ -418,6 +439,7 @@ impl AuthActivity {
Block::default() Block::default()
.borders(Borders::ALL) .borders(Borders::ALL)
.border_style(Style::default().fg(color)) .border_style(Style::default().fg(color))
.border_type(BorderType::Rounded)
.title("Alert"), .title("Alert"),
) )
.start_corner(Corner::TopLeft) .start_corner(Corner::TopLeft)
@@ -433,6 +455,7 @@ impl AuthActivity {
.block( .block(
Block::default() Block::default()
.borders(Borders::TOP | Borders::RIGHT | Borders::LEFT) .borders(Borders::TOP | Borders::RIGHT | Borders::LEFT)
.border_type(BorderType::Rounded)
.title("Save bookmark as..."), .title("Save bookmark as..."),
); );
let choices: Vec<Spans> = vec![Spans::from("Yes"), Spans::from("No")]; let choices: Vec<Spans> = vec![Spans::from("Yes"), Spans::from("No")];
@@ -444,6 +467,7 @@ impl AuthActivity {
.block( .block(
Block::default() Block::default()
.borders(Borders::BOTTOM | Borders::RIGHT | Borders::LEFT) .borders(Borders::BOTTOM | Borders::RIGHT | Borders::LEFT)
.border_type(BorderType::Rounded)
.title("Save password?"), .title("Save password?"),
) )
.select(index) .select(index)
@@ -466,7 +490,12 @@ impl AuthActivity {
DialogYesNoOption::No => 1, DialogYesNoOption::No => 1,
}; };
Tabs::new(choices) 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) .select(index)
.style(Style::default()) .style(Style::default())
.highlight_style( .highlight_style(
@@ -578,6 +607,7 @@ impl AuthActivity {
Block::default() Block::default()
.borders(Borders::ALL) .borders(Borders::ALL)
.border_style(Style::default()) .border_style(Style::default())
.border_type(BorderType::Rounded)
.title("Help"), .title("Help"),
) )
.start_corner(Corner::TopLeft) .start_corner(Corner::TopLeft)

View File

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