parent
4792304d8b
commit
d6b4cc6297
3 changed files with 63 additions and 17 deletions
|
@ -460,14 +460,45 @@ impl<'a> Library {
|
||||||
}))
|
}))
|
||||||
.center_y(20)
|
.center_y(20)
|
||||||
.center_x(Length::Fill);
|
.center_x(Length::Fill);
|
||||||
let subtext = container(responsive(|size| {
|
let subtext = container(responsive(move |size| {
|
||||||
let color: Color = if item.background().is_some() {
|
let color: Color = if item.background().is_some() {
|
||||||
theme::active().cosmic().accent_text_color().into()
|
if let Some((library, selected)) = self.selected_item
|
||||||
|
{
|
||||||
|
if model.kind == library
|
||||||
|
&& selected == index as i32
|
||||||
|
{
|
||||||
|
theme::active().cosmic().control_0().into()
|
||||||
|
} else {
|
||||||
|
theme::active()
|
||||||
|
.cosmic()
|
||||||
|
.accent_text_color()
|
||||||
|
.into()
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
theme::active()
|
||||||
|
.cosmic()
|
||||||
|
.accent_text_color()
|
||||||
|
.into()
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
theme::active()
|
if let Some((library, selected)) = self.selected_item
|
||||||
.cosmic()
|
{
|
||||||
.destructive_text_color()
|
if model.kind == library
|
||||||
.into()
|
&& selected == index as i32
|
||||||
|
{
|
||||||
|
theme::active().cosmic().control_0().into()
|
||||||
|
} else {
|
||||||
|
theme::active()
|
||||||
|
.cosmic()
|
||||||
|
.destructive_text_color()
|
||||||
|
.into()
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
theme::active()
|
||||||
|
.cosmic()
|
||||||
|
.destructive_text_color()
|
||||||
|
.into()
|
||||||
|
}
|
||||||
};
|
};
|
||||||
text::body(elide_text(item.subtext(), size.width))
|
text::body(elide_text(item.subtext(), size.width))
|
||||||
.center()
|
.center()
|
||||||
|
@ -498,7 +529,19 @@ impl<'a> Library {
|
||||||
{
|
{
|
||||||
t.cosmic().accent.selected.into()
|
t.cosmic().accent.selected.into()
|
||||||
} else {
|
} else {
|
||||||
t.cosmic().button.base.into()
|
if let Some((library, hovered)) =
|
||||||
|
self.hovered_item
|
||||||
|
{
|
||||||
|
if model.kind == library
|
||||||
|
&& hovered == index as i32
|
||||||
|
{
|
||||||
|
t.cosmic().button.hover.into()
|
||||||
|
} else {
|
||||||
|
t.cosmic().button.base.into()
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
t.cosmic().button.base.into()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else if let Some((library, hovered)) =
|
} else if let Some((library, hovered)) =
|
||||||
self.hovered_item
|
self.hovered_item
|
||||||
|
@ -519,6 +562,7 @@ impl<'a> Library {
|
||||||
.rounded(t.cosmic().corner_radii.radius_m),
|
.rounded(t.cosmic().corner_radii.radius_m),
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
.padding([3, 0])
|
||||||
.into()
|
.into()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,36 +2,36 @@ use miette::{IntoDiagnostic, Result};
|
||||||
use std::{fs::File, io::BufReader, path::PathBuf, sync::Arc};
|
use std::{fs::File, io::BufReader, path::PathBuf, sync::Arc};
|
||||||
|
|
||||||
use cosmic::{
|
use cosmic::{
|
||||||
Task,
|
|
||||||
iced::{
|
iced::{
|
||||||
Background, Border, Color, ContentFit, Font, Length, Shadow,
|
|
||||||
Vector,
|
|
||||||
alignment::Horizontal,
|
alignment::Horizontal,
|
||||||
border,
|
border,
|
||||||
font::{Family, Stretch, Style, Weight},
|
font::{Family, Stretch, Style, Weight},
|
||||||
|
Background, Border, Color, ContentFit, Font, Length, Shadow,
|
||||||
|
Vector,
|
||||||
},
|
},
|
||||||
iced_widget::{
|
iced_widget::{
|
||||||
rich_text,
|
rich_text,
|
||||||
scrollable::{
|
scrollable::{
|
||||||
AbsoluteOffset, Direction, Scrollbar, scroll_to,
|
scroll_to, AbsoluteOffset, Direction, Scrollbar,
|
||||||
},
|
},
|
||||||
span, stack, vertical_rule,
|
span, stack, vertical_rule,
|
||||||
},
|
},
|
||||||
prelude::*,
|
prelude::*,
|
||||||
widget::{
|
widget::{
|
||||||
Column, Container, Id, Row, Space, container, image,
|
container, image, mouse_area, responsive, scrollable, text,
|
||||||
mouse_area, responsive, scrollable, text,
|
Column, Container, Id, Row, Space,
|
||||||
},
|
},
|
||||||
|
Task,
|
||||||
};
|
};
|
||||||
use iced_video_player::{Position, Video, VideoPlayer, gst_pbutils};
|
use iced_video_player::{gst_pbutils, Position, Video, VideoPlayer};
|
||||||
use rodio::{Decoder, OutputStream, Sink};
|
use rodio::{Decoder, OutputStream, Sink};
|
||||||
use tracing::{debug, error, info, warn};
|
use tracing::{debug, error, info, warn};
|
||||||
use url::Url;
|
use url::Url;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
BackgroundKind,
|
|
||||||
core::{service_items::ServiceItem, slide::Slide},
|
core::{service_items::ServiceItem, slide::Slide},
|
||||||
ui::text_svg,
|
ui::text_svg,
|
||||||
|
BackgroundKind,
|
||||||
};
|
};
|
||||||
|
|
||||||
const REFERENCE_WIDTH: f32 = 1920.0;
|
const REFERENCE_WIDTH: f32 = 1920.0;
|
||||||
|
|
|
@ -290,7 +290,7 @@ impl TextSvg {
|
||||||
self.font.name,
|
self.font.name,
|
||||||
self.font.size,
|
self.font.size,
|
||||||
self.fill, stroke, text);
|
self.fill, stroke, text);
|
||||||
// debug!(?final_svg);
|
debug!("starting...");
|
||||||
let resvg_tree = Tree::from_str(
|
let resvg_tree = Tree::from_str(
|
||||||
&final_svg,
|
&final_svg,
|
||||||
&resvg::usvg::Options {
|
&resvg::usvg::Options {
|
||||||
|
@ -299,15 +299,17 @@ impl TextSvg {
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
.expect("Woops mama");
|
.expect("Woops mama");
|
||||||
// debug!(?resvg_tree);
|
debug!("parsed");
|
||||||
let transform = tiny_skia::Transform::default();
|
let transform = tiny_skia::Transform::default();
|
||||||
let mut pixmap =
|
let mut pixmap =
|
||||||
Pixmap::new(size.width as u32, size.height as u32)
|
Pixmap::new(size.width as u32, size.height as u32)
|
||||||
.expect("opops");
|
.expect("opops");
|
||||||
resvg::render(&resvg_tree, transform, &mut pixmap.as_mut());
|
resvg::render(&resvg_tree, transform, &mut pixmap.as_mut());
|
||||||
// debug!(?pixmap);
|
// debug!(?pixmap);
|
||||||
|
debug!("rendered");
|
||||||
let handle = Handle::from_bytes(pixmap.take());
|
let handle = Handle::from_bytes(pixmap.take());
|
||||||
self.handle = Some(handle);
|
self.handle = Some(handle);
|
||||||
|
debug!("stored");
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue