Improve style of properties
This commit is contained in:
parent
b8239ce608
commit
5806c420a8
2 changed files with 41 additions and 34 deletions
|
|
@ -242,7 +242,7 @@ impl App {
|
||||||
if let Some(ref items) = tab.items_opt {
|
if let Some(ref items) = tab.items_opt {
|
||||||
for item in items.iter() {
|
for item in items.iter() {
|
||||||
if item.select_time.is_some() {
|
if item.select_time.is_some() {
|
||||||
children.push(item.property_view());
|
children.push(item.property_view(&self.core));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -359,6 +359,10 @@ impl Application for App {
|
||||||
if let Some(ref mut items) = tab.items_opt {
|
if let Some(ref mut items) = tab.items_opt {
|
||||||
let select_time = Instant::now();
|
let select_time = Instant::now();
|
||||||
for item in items.iter_mut() {
|
for item in items.iter_mut() {
|
||||||
|
if item.hidden {
|
||||||
|
//TODO: option to show hidden files
|
||||||
|
continue;
|
||||||
|
}
|
||||||
item.select_time = Some(select_time);
|
item.select_time = Some(select_time);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
69
src/tab.rs
69
src/tab.rs
|
|
@ -231,14 +231,14 @@ pub struct Item {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Item {
|
impl Item {
|
||||||
pub fn property_view(&self) -> Element<crate::Message> {
|
pub fn property_view(&self, core: &Core) -> Element<crate::Message> {
|
||||||
let mut children = Vec::new();
|
let mut section = widget::settings::view_section("");
|
||||||
children.push(
|
section = section.add(widget::settings::item::item_row(vec![
|
||||||
widget::icon::icon(self.icon_handle_grid.clone())
|
widget::icon::icon(self.icon_handle_list.clone())
|
||||||
.size(ICON_SIZE_GRID)
|
.size(ICON_SIZE_LIST)
|
||||||
.into(),
|
.into(),
|
||||||
);
|
widget::text(self.name.clone()).into(),
|
||||||
children.push(widget::text(self.name.clone()).into());
|
]));
|
||||||
|
|
||||||
//TODO: translate!
|
//TODO: translate!
|
||||||
//TODO: correct display of folder size?
|
//TODO: correct display of folder size?
|
||||||
|
|
@ -262,43 +262,46 @@ impl Item {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
children
|
section = section.add(widget::settings::item::item(
|
||||||
.push(widget::text(format!("Size: {}", format_size(self.metadata.len()))).into());
|
"Size",
|
||||||
|
widget::text(format_size(self.metadata.len())),
|
||||||
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Ok(time) = self.metadata.accessed() {
|
if let Ok(time) = self.metadata.accessed() {
|
||||||
children.push(
|
section = section.add(widget::settings::item(
|
||||||
widget::text(format!(
|
"Accessed",
|
||||||
"Accessed: {}",
|
widget::text(
|
||||||
chrono::DateTime::<chrono::Local>::from(time).format("%c")
|
chrono::DateTime::<chrono::Local>::from(time)
|
||||||
))
|
.format("%c")
|
||||||
.into(),
|
.to_string(),
|
||||||
);
|
),
|
||||||
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Ok(time) = self.metadata.modified() {
|
if let Ok(time) = self.metadata.modified() {
|
||||||
children.push(
|
section = section.add(widget::settings::item(
|
||||||
widget::text(format!(
|
"Modified",
|
||||||
"Modified: {}",
|
widget::text(
|
||||||
chrono::DateTime::<chrono::Local>::from(time).format("%c")
|
chrono::DateTime::<chrono::Local>::from(time)
|
||||||
))
|
.format("%c")
|
||||||
.into(),
|
.to_string(),
|
||||||
);
|
),
|
||||||
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Ok(time) = self.metadata.created() {
|
if let Ok(time) = self.metadata.created() {
|
||||||
children.push(
|
section = section.add(widget::settings::item(
|
||||||
widget::text(format!(
|
"Created",
|
||||||
"Created: {}",
|
widget::text(
|
||||||
chrono::DateTime::<chrono::Local>::from(time).format("%c")
|
chrono::DateTime::<chrono::Local>::from(time)
|
||||||
))
|
.format("%c")
|
||||||
.into(),
|
.to_string(),
|
||||||
);
|
),
|
||||||
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
widget::column::with_children(children)
|
section.into()
|
||||||
.width(Length::Fill)
|
|
||||||
.into()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue