Skip to content

Commit

Permalink
Minor UI tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
shartrec committed Jul 9, 2024
1 parent 66d3e5d commit 47971cb
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 11 deletions.
4 changes: 2 additions & 2 deletions src/history.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,10 @@ impl History {
match self.entries.write() {
Ok(mut vec) => {
if vec.len() == self.max_size {
vec.pop_front();
vec.pop_back();
}
let new_entry = (entry.0.to_string(), entry.1.clone());
vec.push_back(new_entry);
vec.push_front(new_entry);
}
Err(_) => {
warn!("Failed to write history.")
Expand Down
11 changes: 8 additions & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,22 @@ pub(crate) mod conversions;
/// Calculate.
fn main() -> iced::Result {

// Todo Get rid of this when we can
// Force tiny-skia backend
// std::env::set_var("ICED_BACKEND", "tiny-skia");

init_logger();
info!("Calculator started");

let window_settings = iced::window::Settings {
let window_settings = window::Settings {
size: load_window_size().unwrap_or(Size::new(330.0, 450.0)),
min_size: Some(Size::new(330.0, 450.0)),
..iced::window::Settings::default()
..window::Settings::default()
};

let settings: Settings = Settings {
id: Some(String::from("RustyCalc")),
antialiasing: true,
.. Settings::default()
};

Expand Down Expand Up @@ -106,7 +111,7 @@ fn init_logger() {

fn load_window_size() -> Option<Size> {
// Get the window state from `settings`
let pref = crate::ui::preferences::manager();
let pref = ui::preferences::manager();

// Set the size of the window
if let Some(w) = pref.get::<f32>("window-width") {
Expand Down
12 changes: 6 additions & 6 deletions src/ui/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,13 @@ lazy_static! {
weak: Pair::new(Color::from_rgb8(0x00,0x50,0x60), palette.text), // Grey Blue
.. Background::new(palette.background, palette.text)
},
primary: Primary::generate (
palette.primary,
Color::BLACK,
Color::WHITE,
),
primary: Primary{
base: Pair::new(palette.primary, palette.text),
weak: Pair::new(Color::from_rgb8(0x74,0x8d,0x7e), palette.text),
strong: Pair::new(palette.primary, palette.text)
},
secondary: Secondary{
strong: Pair::new(Color::from_rgb8(0x04,0x04,0x04,), Color::WHITE),
strong: Pair::new(Color::from_rgb8(0x04,0x04,0x04,), palette.text),
.. Secondary::generate(Color::BLACK, Color::WHITE)
},
success: Success::generate(
Expand Down

0 comments on commit 47971cb

Please sign in to comment.