generated from PlexSheep/rs-base
feat(player): somewhat of a grid
This commit is contained in:
parent
a744147355
commit
d727b22c0f
|
@ -21,6 +21,7 @@ anyhow = "1.0.86"
|
||||||
clap = { version = "4.5.16", features = ["derive"] }
|
clap = { version = "4.5.16", features = ["derive"] }
|
||||||
eframe = { version = "0.28.1", optional = false }
|
eframe = { version = "0.28.1", optional = false }
|
||||||
egui = { version = "0.28.1", optional = false }
|
egui = { version = "0.28.1", optional = false }
|
||||||
|
egui_extras = { version = "0.28.1", features = ["image"] }
|
||||||
human-panic = "2.0.1"
|
human-panic = "2.0.1"
|
||||||
image = "0.25.2"
|
image = "0.25.2"
|
||||||
libpt = { version = "0.6.0", features = ["cli", "full"] }
|
libpt = { version = "0.6.0", features = ["cli", "full"] }
|
||||||
|
|
|
@ -5,6 +5,8 @@ use libpt::log::{debug, info, trace};
|
||||||
|
|
||||||
use crate::error::Error;
|
use crate::error::Error;
|
||||||
|
|
||||||
|
use self::ui::entry::Entry;
|
||||||
|
|
||||||
pub mod ui;
|
pub mod ui;
|
||||||
|
|
||||||
pub const TITLE: &str = "Beatbär";
|
pub const TITLE: &str = "Beatbär";
|
||||||
|
@ -56,4 +58,13 @@ impl Player {
|
||||||
pub fn init(&mut self, _cc: &CreationContext) {
|
pub fn init(&mut self, _cc: &CreationContext) {
|
||||||
// we can use the creation context to do some customizing, but idc right now
|
// we can use the creation context to do some customizing, but idc right now
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn entries(&self) -> Vec<Entry> {
|
||||||
|
let e = Entry::new(ui::entry::Kind::Album, "boom boom boom.", None);
|
||||||
|
let mut v = vec![e.clone()];
|
||||||
|
for _ in 0..100 {
|
||||||
|
v.push(e.clone());
|
||||||
|
}
|
||||||
|
v
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
#[derive(Hash, Clone, PartialEq, Eq)]
|
||||||
|
pub enum Kind {
|
||||||
|
Playlist,
|
||||||
|
Album,
|
||||||
|
Song,
|
||||||
|
Artist,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Hash, Clone, PartialEq, Eq)]
|
||||||
|
pub struct Entry {
|
||||||
|
kind: Kind,
|
||||||
|
title: String,
|
||||||
|
image: Option<()>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Entry {
|
||||||
|
pub fn new(kind: Kind, title: &str, img: Option<()>) -> Self {
|
||||||
|
Self {
|
||||||
|
kind,
|
||||||
|
title: title.to_owned(),
|
||||||
|
image: img,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,9 +1,15 @@
|
||||||
use egui::IconData;
|
use egui::{IconData, ScrollArea};
|
||||||
|
use egui_extras::{Column, Table, TableBuilder};
|
||||||
use libpt::log::trace;
|
use libpt::log::trace;
|
||||||
|
|
||||||
|
pub mod entry;
|
||||||
|
pub mod showbox;
|
||||||
|
|
||||||
|
use self::showbox::ShowBox;
|
||||||
|
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
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 {
|
||||||
fn top_panel(&mut self, ui: &mut egui::Ui, ctx: &egui::Context) {
|
fn top_panel(&mut self, ui: &mut egui::Ui, ctx: &egui::Context) {
|
||||||
|
@ -95,11 +101,23 @@ impl Player {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main_panel(&mut self, ui: &mut egui::Ui, ctx: &egui::Context) {
|
fn main_panel(&mut self, ui: &mut egui::Ui, ctx: &egui::Context) {
|
||||||
ui.vertical_centered(|ui| {
|
let mut tb = TableBuilder::new(ui)
|
||||||
for i in 0..100 {
|
.column(Column::remainder())
|
||||||
ui.horizontal_wrapped(|ui| {
|
.column(Column::remainder())
|
||||||
for j in 0..10 {
|
.column(Column::remainder())
|
||||||
ui.label(format!("foo-{i}-{j}"));
|
.column(Column::remainder())
|
||||||
|
.column(Column::remainder())
|
||||||
|
.column(Column::remainder())
|
||||||
|
.column(Column::remainder())
|
||||||
|
.column(Column::remainder());
|
||||||
|
|
||||||
|
tb.body(|mut body| {
|
||||||
|
for line in self.entries().chunks(8) {
|
||||||
|
body.row(30.0, |mut row| {
|
||||||
|
for e in line {
|
||||||
|
row.col(|ui| {
|
||||||
|
ui.add(ShowBox::new(e));
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
|
@ -0,0 +1,25 @@
|
||||||
|
use egui::Color32;
|
||||||
|
|
||||||
|
use super::Entry;
|
||||||
|
|
||||||
|
pub struct ShowBox {
|
||||||
|
entry: Entry,
|
||||||
|
frame: egui::Frame,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl ShowBox {
|
||||||
|
pub fn new(entry: &Entry) -> Self {
|
||||||
|
let frame = egui::Frame::none();
|
||||||
|
Self {
|
||||||
|
entry: entry.to_owned(),
|
||||||
|
frame,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl egui::Widget for ShowBox {
|
||||||
|
fn ui(mut self, ui: &mut egui::Ui) -> egui::Response {
|
||||||
|
ui.vertical_centered(|ui| ui.button("i dont get it").union(ui.label("caption")))
|
||||||
|
.response
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue