Skip to content

Commit

Permalink
Add src/gui
Browse files Browse the repository at this point in the history
  • Loading branch information
hinto-janai committed Feb 26, 2023
1 parent 700d632 commit e9a57e5
Show file tree
Hide file tree
Showing 10 changed files with 552 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/gui/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
| File | Purpose |
|--------------|---------|
| app.rs | Main data & loop for the GUI
| constants.rs | General constants for the GUI
| tab.rs | (Left) Tab buttons
| album.rs | Album tab
| artist.rs | Artist tab
| queue.rs | Queue tab
| search.rs | Search tab
| settings.rs | Settings tab
55 changes: 55 additions & 0 deletions src/gui/album.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
//---------------------------------------------------------------------------------------------------- Use
//use anyhow::{bail,ensure,Error};
//use log::{info,error,warn,trace,debug};
//use serde::{Serialize,Deserialize};
use egui::{
Rounding,Vec2,Color32,Stroke,
ScrollArea,Frame,
SelectableLabel,Label,
};

//----------------------------------------------------------------------------------------------------
//#[derive(Copy,Clone,Debug,Default,Hash,PartialEq,Eq,PartialOrd,Ord,Serialize,Deserialize)]
impl super::app::App {
#[inline(always)]
pub fn show_tab_album(&mut self, ui: &mut egui::Ui, ctx: &egui::Context, frame: &mut eframe::Frame, width: f32, height: f32) {
ui.vertical_centered(|ui| {
ui.add_space(height/40.0);
ui.set_max_width(height/3.0);
Frame::window(&ctx.style()).rounding(Rounding::none()).inner_margin(1.0).show(ui, |ui| {
self.img.vec[2].1.show_size(ui, Vec2::new(height/3.0, height/3.0));
});

ui.heading("祝祭");
ui.heading("カネコアヤノ");
ui.heading("2021");
ui.heading("10/10");

});

ui.separator();
ui.visuals_mut().selection.bg_fill = Color32::from_rgb(200, 100, 100);
ui.visuals_mut().selection.stroke = Stroke { width: 5.0, color: Color32::from_rgb(255, 255, 255) };
ScrollArea::vertical().max_width(f32::INFINITY).max_height(f32::INFINITY).auto_shrink([false; 2]).show_viewport(ui, |ui, _| {
for (i, time, name) in &self.list {
let mut rect = ui.cursor();
rect.max.y = rect.min.y + 35.0;
if ui.put(rect, SelectableLabel::new(*i == self.s, "")).clicked() { self.s = *i; };
rect.max.x = rect.min.x;
ui.allocate_ui_at_rect(rect, |ui| {
ui.horizontal_centered(|ui| {
ui.add(Label::new(format!("{: >6}{: >10} {}", i, time, name)).wrap(false));
});
});
}
});
}
}

//---------------------------------------------------------------------------------------------------- TESTS
//#[cfg(test)]
//mod test {
// #[test]
// fn _() {
// }
//}
Loading

0 comments on commit e9a57e5

Please sign in to comment.