Compare commits

..

No commits in common. "3dd949e9a552a74385dada8e8300c787682c08c0" and "51c6b318b33be5a9749c14fd8c051330f5fa020c" have entirely different histories.

4 changed files with 8 additions and 24 deletions

View file

@ -60,12 +60,7 @@ impl Player {
} }
fn entries(&self) -> Vec<Entry> { fn entries(&self) -> Vec<Entry> {
let e = Entry::new( let e = Entry::new(ui::entry::Kind::Album, "boom boom boom.", None);
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());

View file

@ -12,17 +12,15 @@ 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, subtitle: &str, img: Option<String>) -> Self { pub fn new(kind: Kind, title: &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,
} }
} }

View file

@ -9,6 +9,7 @@ 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 {

View file

@ -1,7 +1,6 @@
use egui::text::LayoutJob; use egui::Color32;
use egui::{Color32, FontFamily, FontId, ImageSource, Label, TextFormat};
use super::{Entry, ICON_RAW}; use super::Entry;
pub struct ShowBox { pub struct ShowBox {
entry: Entry, entry: Entry,
@ -23,25 +22,16 @@ 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| {
let mut r = ui.add( 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),
); );
let mut job = LayoutJob::default(); ui.button("i dont get it").union(ui.label("caption"))
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