mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-03-31 16:45:27 +00:00
use single setter, make values selectable, add comments
This commit is contained in:
parent
c6a8175685
commit
907661e49b
1 changed files with 31 additions and 17 deletions
|
|
@ -28,7 +28,9 @@ impl Dialog for PreferencesDialog {
|
||||||
g.add(
|
g.add(
|
||||||
&ActionRow::builder()
|
&ActionRow::builder()
|
||||||
.css_classes(["property"])
|
.css_classes(["property"])
|
||||||
|
.subtitle_selectable(true)
|
||||||
.subtitle(mime)
|
.subtitle(mime)
|
||||||
|
.title_selectable(true)
|
||||||
.title("Content type")
|
.title("Content type")
|
||||||
.build(),
|
.build(),
|
||||||
)
|
)
|
||||||
|
|
@ -44,7 +46,9 @@ impl Dialog for PreferencesDialog {
|
||||||
use crate::tool::Format;
|
use crate::tool::Format;
|
||||||
ActionRow::builder()
|
ActionRow::builder()
|
||||||
.css_classes(["property"])
|
.css_classes(["property"])
|
||||||
|
.subtitle_selectable(true)
|
||||||
.subtitle(size.bytes())
|
.subtitle(size.bytes())
|
||||||
|
.title_selectable(true)
|
||||||
.title("Content")
|
.title("Content")
|
||||||
.build()
|
.build()
|
||||||
})
|
})
|
||||||
|
|
@ -76,23 +80,15 @@ impl Dialog for PreferencesDialog {
|
||||||
chain(&mut b, info);
|
chain(&mut b, info);
|
||||||
b.reverse();
|
b.reverse();
|
||||||
let l = b.len(); // calculate once
|
let l = b.len(); // calculate once
|
||||||
let t = b[0].event[0].time();
|
let t = b[0].event[0].time(); // first event time to count from
|
||||||
for (i, r) in b.iter().enumerate() {
|
for (i, r) in b.iter().enumerate() {
|
||||||
g.add(&{
|
g.add(&{
|
||||||
let a = ActionRow::builder().title(r.request().unwrap()).build();
|
let a = ActionRow::builder()
|
||||||
if i == 0 {
|
.subtitle_selectable(true)
|
||||||
a.set_subtitle(&t.format_iso8601().unwrap())
|
.title_selectable(true)
|
||||||
} else {
|
.title(r.request().unwrap())
|
||||||
a.set_subtitle(&gformat!(
|
.build();
|
||||||
"{} ms",
|
// show redirections counter
|
||||||
r.event
|
|
||||||
.last()
|
|
||||||
.unwrap()
|
|
||||||
.time()
|
|
||||||
.difference(t)
|
|
||||||
.as_milliseconds()
|
|
||||||
))
|
|
||||||
}
|
|
||||||
a.add_prefix(&{
|
a.add_prefix(&{
|
||||||
let c = i + 1;
|
let c = i + 1;
|
||||||
gtk::Button::builder()
|
gtk::Button::builder()
|
||||||
|
|
@ -100,18 +96,32 @@ impl Dialog for PreferencesDialog {
|
||||||
"circular",
|
"circular",
|
||||||
if c == l { "success" } else { "accent" },
|
if c == l { "success" } else { "accent" },
|
||||||
])
|
])
|
||||||
.label(&c.to_string())
|
.label(c.to_string())
|
||||||
.sensitive(false)
|
.sensitive(false)
|
||||||
.valign(gtk::Align::Center)
|
.valign(gtk::Align::Center)
|
||||||
.build()
|
.build()
|
||||||
});
|
});
|
||||||
|
// show total redirection time in ms
|
||||||
|
a.set_subtitle(&if i == 0 {
|
||||||
|
t.format_iso8601().unwrap()
|
||||||
|
} else {
|
||||||
|
gformat!(
|
||||||
|
"{} ms",
|
||||||
|
r.event
|
||||||
|
.last()
|
||||||
|
.unwrap()
|
||||||
|
.time()
|
||||||
|
.difference(t)
|
||||||
|
.as_milliseconds()
|
||||||
|
)
|
||||||
|
});
|
||||||
a
|
a
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
g
|
g
|
||||||
});
|
});
|
||||||
p
|
p
|
||||||
}) // @TODO reverse, time total
|
}) // @TODO clickable navigation, copy
|
||||||
}
|
}
|
||||||
if !info.event.is_empty() {
|
if !info.event.is_empty() {
|
||||||
d.add(&{
|
d.add(&{
|
||||||
|
|
@ -126,7 +136,9 @@ impl Dialog for PreferencesDialog {
|
||||||
let n = e.name();
|
let n = e.name();
|
||||||
g.add(
|
g.add(
|
||||||
&ActionRow::builder()
|
&ActionRow::builder()
|
||||||
|
.subtitle_selectable(true)
|
||||||
.subtitle(t.format_iso8601().unwrap())
|
.subtitle(t.format_iso8601().unwrap())
|
||||||
|
.title_selectable(true)
|
||||||
.title(n)
|
.title(n)
|
||||||
.build(),
|
.build(),
|
||||||
);
|
);
|
||||||
|
|
@ -137,6 +149,8 @@ impl Dialog for PreferencesDialog {
|
||||||
"{} ms",
|
"{} ms",
|
||||||
e.time().difference(t).as_milliseconds()
|
e.time().difference(t).as_milliseconds()
|
||||||
))
|
))
|
||||||
|
.subtitle_selectable(true)
|
||||||
|
.title_selectable(true)
|
||||||
.title(e.name())
|
.title(e.name())
|
||||||
.build(),
|
.build(),
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue