Compare commits

..

No commits in common. "3e1bc8c6acece09ca30788275905e9e5f15f115a" and "ab61924e5fcf8f341e9d7efd2aa3338a1f59ac8c" have entirely different histories.

5 changed files with 8 additions and 43 deletions

2
Cargo.lock generated
View file

@ -1813,7 +1813,7 @@ dependencies = [
[[package]]
name = "mpd_info_screen"
version = "0.4.17"
version = "0.4.16"
dependencies = [
"bindgen 0.69.4",
"clap",

View file

@ -1,6 +1,6 @@
[package]
name = "mpd_info_screen"
version = "0.4.17"
version = "0.4.16"
edition = "2021"
description = "Displays info on currently playing music from an MPD daemon"
license = "MIT"

View file

@ -56,8 +56,6 @@ or through crates.io:
disable filename display
--disable-show-percentage
disable percentage display
--force-text-height-scale <FORCE_TEXT_HEIGHT_SCALE>
force-set text height relative to window height as a ratio (default 0.12)
--pprompt
input password via prompt
--pfile <PASSWORD_FILE>

View file

@ -19,16 +19,14 @@ use std::thread;
use std::time::{Duration, Instant};
const POLL_TIME: Duration = Duration::from_millis(333);
const INIT_FONT_SIZE_RATIO: f32 = 1.4167;
const INIT_FONT_SIZE_X: f32 = 36.0;
const INIT_FONT_SIZE_Y: f32 = INIT_FONT_SIZE_X * INIT_FONT_SIZE_RATIO;
const INIT_FONT_SIZE_Y: f32 = 51.0;
const TEXT_X_OFFSET: f32 = 0.3;
const TEXT_OFFSET_Y_SPACING: f32 = 0.4;
const TEXT_HEIGHT_SCALE: f32 = 0.12;
const ARTIST_HEIGHT_SCALE: f32 = 0.12;
const ALBUM_HEIGHT_SCALE: f32 = 0.12;
const TIMER_HEIGHT_SCALE_RATIO: f32 = 0.875;
const TIMER_HEIGHT_SCALE: f32 = TEXT_HEIGHT_SCALE * TIMER_HEIGHT_SCALE_RATIO;
const TIMER_HEIGHT_SCALE: f32 = 0.105;
const MIN_WIDTH_RATIO: f32 = 4.0 / 5.0;
const INCREASE_AMT: f32 = 6.0 / 5.0;
const DECREASE_AMT: f32 = 5.0 / 6.0;
@ -472,27 +470,10 @@ impl MPDDisplay {
fn refresh_text_transforms(&mut self, ctx: &mut Context) -> GameResult<()> {
let drawable_size = ctx.gfx.drawable_size();
let text_height_scale: f32;
let album_height_scale: f32;
let artist_height_scale: f32;
let timer_height_scale: f32;
if let Some(forced_scale) = &self.opts.force_text_height_scale {
text_height_scale = *forced_scale;
album_height_scale = *forced_scale;
artist_height_scale = *forced_scale;
timer_height_scale = *forced_scale * TIMER_HEIGHT_SCALE_RATIO;
} else {
text_height_scale = TEXT_HEIGHT_SCALE;
album_height_scale = ALBUM_HEIGHT_SCALE;
artist_height_scale = ARTIST_HEIGHT_SCALE;
timer_height_scale = TIMER_HEIGHT_SCALE;
}
let text_height_limit = text_height_scale * drawable_size.1.abs();
let album_height_limit = album_height_scale * drawable_size.1.abs();
let artist_height_limit = artist_height_scale * drawable_size.1.abs();
let timer_height = timer_height_scale * drawable_size.1.abs();
let text_height_limit = TEXT_HEIGHT_SCALE * drawable_size.1.abs();
let album_height_limit = ALBUM_HEIGHT_SCALE * drawable_size.1.abs();
let artist_height_limit = ARTIST_HEIGHT_SCALE * drawable_size.1.abs();
let timer_height = TIMER_HEIGHT_SCALE * drawable_size.1.abs();
let mut offset_y: f32 = drawable_size.1;

View file

@ -37,11 +37,6 @@ pub struct Opt {
disable_show_filename: bool,
#[arg(long = "disable-show-percentage", help = "disable percentage display")]
disable_show_percentage: bool,
#[arg(
long = "force-text-height-scale",
help = "force-set text height relative to window height as a ratio (default 0.12)"
)]
force_text_height_scale: Option<f32>,
#[arg(long = "pprompt", help = "input password via prompt")]
enable_prompt_password: bool,
#[arg(long = "pfile", help = "read password from file")]
@ -64,15 +59,6 @@ pub struct Opt {
fn main() -> Result<(), String> {
let mut opt = Opt::parse();
if let Some(forced_scale) = &mut opt.force_text_height_scale {
if *forced_scale < 0.01 {
*forced_scale = 0.01;
println!("WARNING: Clamped \"force-text-height-scale\" to minimum of 0.01!");
} else if *forced_scale > 0.5 {
*forced_scale = 0.5;
println!("WARNING: Clamped \"force-text-height-scale\" to maximum of 0.5!");
}
}
println!("Got host addr == {}, port == {}", opt.host, opt.port);
// Read password from file if exists, error otherwise.