Wrap message box texts; renamed ctext to msgbox

This commit is contained in:
veeso
2021-03-21 12:53:11 +01:00
parent 9b00feb286
commit 41360bb2c5
7 changed files with 78 additions and 56 deletions

View File

@@ -26,7 +26,7 @@
// Locals
use super::{AuthActivity, Context, FileTransferProtocol};
use crate::ui::layout::components::{
bookmark_list::BookmarkList, ctext::CText, input::Input, radio_group::RadioGroup, table::Table,
bookmark_list::BookmarkList, msgbox::MsgBox, input::Input, radio_group::RadioGroup, table::Table,
text::Text, title::Title,
};
use crate::ui::layout::props::{
@@ -436,7 +436,7 @@ impl AuthActivity {
// Mount
self.view.mount(
super::COMPONENT_TEXT_ERROR,
Box::new(CText::new(
Box::new(MsgBox::new(
PropsBuilder::default()
.with_foreground(Color::Red)
.bold()

View File

@@ -331,7 +331,7 @@ impl FileTransferActivity {
pub(super) fn action_remote_saveas(&mut self, input: String) {
if let Some(idx) = self.get_remote_file_idx() {
// Get pwd
let wrkdir: PathBuf = self.remote.wrkdir.clone();
let wrkdir: PathBuf = self.local.wrkdir.clone();
if self.remote.get(idx).is_some() {
let file: FsEntry = self.remote.get(idx).unwrap().clone();
// Call upload; pass realfile, keep link name

View File

@@ -37,7 +37,7 @@ use super::{
use crate::fs::explorer::FileSorting;
use crate::fs::FsEntry;
use crate::ui::activities::keymap::*;
use crate::ui::layout::props::{TableBuilder, TextParts, TextSpan, TextSpanBuilder};
use crate::ui::layout::props::{PropValue, TableBuilder, TextParts, TextSpan, TextSpanBuilder};
use crate::ui::layout::{Msg, Payload};
// externals
use bytesize::ByteSize;
@@ -470,9 +470,9 @@ impl FileTransferActivity {
}
self.umount_saveas();
// Reload files
match self.tab {
FileExplorerTab::Local => self.update_local_filelist(),
FileExplorerTab::Remote => self.update_remote_filelist(),
match self.tab { // NOTE: Swapped is intentional
FileExplorerTab::Local => self.update_remote_filelist(),
FileExplorerTab::Remote => self.update_local_filelist(),
}
}
// -- fileinfo
@@ -769,6 +769,7 @@ impl FileTransferActivity {
Some(text),
Some(vec![TextSpan::from(label)]),
))
.with_value(PropValue::Float(self.transfer.progress / 100.0))
.build();
self.view.update(COMPONENT_PROGRESS_BAR, props)
}

View File

@@ -33,7 +33,7 @@ use super::{Context, FileExplorerTab, FileTransferActivity};
use crate::fs::explorer::FileSorting;
use crate::fs::FsEntry;
use crate::ui::layout::components::{
ctext::CText, file_list::FileList, input::Input, logbox::LogBox, progress_bar::ProgressBar,
msgbox::MsgBox, file_list::FileList, input::Input, logbox::LogBox, progress_bar::ProgressBar,
radio_group::RadioGroup, table::Table,
};
use crate::ui::layout::props::{
@@ -280,7 +280,7 @@ impl FileTransferActivity {
// Mount
self.view.mount(
super::COMPONENT_TEXT_ERROR,
Box::new(CText::new(
Box::new(MsgBox::new(
PropsBuilder::default()
.with_foreground(Color::Red)
.bold()
@@ -303,7 +303,7 @@ impl FileTransferActivity {
// Mount
self.view.mount(
super::COMPONENT_TEXT_FATAL,
Box::new(CText::new(
Box::new(MsgBox::new(
PropsBuilder::default()
.with_foreground(Color::Red)
.bold()
@@ -319,7 +319,7 @@ impl FileTransferActivity {
// Mount
self.view.mount(
super::COMPONENT_TEXT_WAIT,
Box::new(CText::new(
Box::new(MsgBox::new(
PropsBuilder::default()
.with_foreground(Color::White)
.bold()
@@ -501,8 +501,8 @@ impl FileTransferActivity {
super::COMPONENT_PROGRESS_BAR,
Box::new(ProgressBar::new(
PropsBuilder::default()
.with_foreground(Color::Black)
.with_background(Color::LightGreen)
.with_foreground(Color::LightGreen)
.with_background(Color::Black)
.with_texts(TextParts::new(Some(String::from("Please wait")), None))
.build(),
)),

View File

@@ -29,7 +29,7 @@ use super::{Context, SetupActivity, ViewLayout};
use crate::filetransfer::FileTransferProtocol;
use crate::fs::explorer::GroupDirs;
use crate::ui::layout::components::{
bookmark_list::BookmarkList, ctext::CText, input::Input, radio_group::RadioGroup, table::Table,
bookmark_list::BookmarkList, msgbox::MsgBox, input::Input, radio_group::RadioGroup, table::Table,
text::Text,
};
use crate::ui::layout::props::{
@@ -386,7 +386,7 @@ impl SetupActivity {
// Mount
self.view.mount(
super::COMPONENT_TEXT_ERROR,
Box::new(CText::new(
Box::new(MsgBox::new(
PropsBuilder::default()
.with_foreground(Color::Red)
.bold()