generated from PlexSheep/rs-base
feat(player): imrpove album view
This commit is contained in:
parent
c7b6917af2
commit
8f6c6b594f
|
@ -60,7 +60,12 @@ impl Player {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn entries(&self) -> Vec<Entry> {
|
fn entries(&self) -> Vec<Entry> {
|
||||||
let e = Entry::new(ui::entry::Kind::Album, "boom boom boom.", None);
|
let e = Entry::new(
|
||||||
|
ui::entry::Kind::Album,
|
||||||
|
"boom boom boom.",
|
||||||
|
"boomerboom",
|
||||||
|
None,
|
||||||
|
);
|
||||||
let mut v = vec![e.clone()];
|
let mut v = vec![e.clone()];
|
||||||
for _ in 0..100 {
|
for _ in 0..100 {
|
||||||
v.push(e.clone());
|
v.push(e.clone());
|
||||||
|
|
|
@ -12,15 +12,17 @@ pub enum Kind {
|
||||||
pub struct Entry {
|
pub struct Entry {
|
||||||
pub kind: Kind,
|
pub kind: Kind,
|
||||||
pub title: String,
|
pub title: String,
|
||||||
|
pub subtitle: String,
|
||||||
/// image url because I can't be bothered to use lifetimes everywhere
|
/// image url because I can't be bothered to use lifetimes everywhere
|
||||||
pub img_url: Option<String>,
|
pub img_url: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Entry {
|
impl Entry {
|
||||||
pub fn new(kind: Kind, title: &str, img: Option<String>) -> Self {
|
pub fn new(kind: Kind, title: &str, subtitle: &str, img: Option<String>) -> Self {
|
||||||
Self {
|
Self {
|
||||||
kind,
|
kind,
|
||||||
title: title.to_owned(),
|
title: title.to_owned(),
|
||||||
|
subtitle: subtitle.to_owned(),
|
||||||
img_url: img,
|
img_url: img,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,6 @@ use self::showbox::ShowBox;
|
||||||
|
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
const ICON_RAW_PATH: &str = "file://../../../assets/img/icon-512.jpg";
|
|
||||||
const ICON_RAW: &[u8; 36525] = include_bytes!("../../../assets/img/icon-512.jpg");
|
const ICON_RAW: &[u8; 36525] = include_bytes!("../../../assets/img/icon-512.jpg");
|
||||||
|
|
||||||
impl Player {
|
impl Player {
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
use egui::{Color32, ImageSource};
|
use egui::text::LayoutJob;
|
||||||
|
use egui::{Color32, FontFamily, FontId, ImageSource, Label, TextFormat};
|
||||||
|
|
||||||
use super::{Entry, ICON_RAW};
|
use super::{Entry, ICON_RAW};
|
||||||
|
|
||||||
|
@ -22,16 +23,25 @@ impl egui::Widget for ShowBox {
|
||||||
egui::Frame::none()
|
egui::Frame::none()
|
||||||
// .fill(Color32::DARK_GRAY)
|
// .fill(Color32::DARK_GRAY)
|
||||||
.show(ui, |ui| {
|
.show(ui, |ui| {
|
||||||
ui.label("Label with red background");
|
|
||||||
ui.vertical_centered(|ui| {
|
ui.vertical_centered(|ui| {
|
||||||
ui.add(
|
let mut r = ui.add(
|
||||||
egui::Image::new(self.entry.img())
|
egui::Image::new(self.entry.img())
|
||||||
.rounding(5.0)
|
.rounding(5.0)
|
||||||
.bg_fill(Color32::DARK_GRAY)
|
.bg_fill(Color32::DARK_GRAY)
|
||||||
.shrink_to_fit()
|
.shrink_to_fit()
|
||||||
.maintain_aspect_ratio(true),
|
.maintain_aspect_ratio(true),
|
||||||
);
|
);
|
||||||
ui.button("i dont get it").union(ui.label("caption"))
|
let mut job = LayoutJob::default();
|
||||||
|
job.append(
|
||||||
|
&self.entry.title,
|
||||||
|
0.0,
|
||||||
|
TextFormat {
|
||||||
|
font_id: FontId::new(14.0, FontFamily::Proportional),
|
||||||
|
..Default::default()
|
||||||
|
},
|
||||||
|
);
|
||||||
|
r.union(ui.add(Label::new(job)));
|
||||||
|
r.union(ui.label(&self.entry.subtitle));
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
.response
|
.response
|
||||||
|
|
Loading…
Reference in New Issue