Upgrade to egui/eframe 0.24.1

This commit is contained in:
Luke Street 2023-12-11 13:36:00 -05:00
parent e1079db93a
commit b74a49ed0c
4 changed files with 404 additions and 247 deletions

624
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -31,14 +31,14 @@ cfg-if = "1.0.0"
const_format = "0.2.32" const_format = "0.2.32"
cwdemangle = "0.1.6" cwdemangle = "0.1.6"
dirs = "5.0.1" dirs = "5.0.1"
eframe = { version = "0.23.0", features = ["persistence"] } eframe = { version = "0.24.1", features = ["persistence"] }
egui = "0.23.0" egui = "0.24.1"
egui_extras = "0.23.0" egui_extras = "0.24.1"
filetime = "0.2.22" filetime = "0.2.22"
flagset = "0.4.4" flagset = "0.4.4"
float-ord = "0.3.2" float-ord = "0.3.2"
font-kit = "0.11.0" font-kit = "0.12.0"
globset = { version = "0.4.13", features = ["serde1"] } globset = { version = "0.4.14", features = ["serde1"] }
log = "0.4.20" log = "0.4.20"
memmap2 = "0.9.0" memmap2 = "0.9.0"
notify = "6.1.1" notify = "6.1.1"

View File

@ -398,7 +398,7 @@ impl eframe::App for App {
/// Put your widgets into a `SidePanel`, `TopPanel`, `CentralPanel`, `Window` or `Area`. /// Put your widgets into a `SidePanel`, `TopPanel`, `CentralPanel`, `Window` or `Area`.
fn update(&mut self, ctx: &egui::Context, frame: &mut eframe::Frame) { fn update(&mut self, ctx: &egui::Context, frame: &mut eframe::Frame) {
if self.should_relaunch { if self.should_relaunch {
frame.close(); ctx.send_viewport_cmd(egui::ViewportCommand::Close);
return; return;
} }
@ -458,7 +458,7 @@ impl eframe::App for App {
ui.close_menu(); ui.close_menu();
} }
if ui.button("Quit").clicked() { if ui.button("Quit").clicked() {
frame.close(); ctx.send_viewport_cmd(egui::ViewportCommand::Close);
} }
}); });
ui.menu_button("Tools", |ui| { ui.menu_button("Tools", |ui| {

View File

@ -1,14 +1,17 @@
#![warn(clippy::all, rust_2018_idioms)] #![warn(clippy::all, rust_2018_idioms)]
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release #![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release
use std::{path::PathBuf, rc::Rc, sync::Mutex}; use std::{
path::PathBuf,
rc::Rc,
sync::{Arc, Mutex},
};
use anyhow::{Error, Result}; use anyhow::{Error, Result};
use cfg_if::cfg_if; use cfg_if::cfg_if;
use eframe::IconData;
use time::UtcOffset; use time::UtcOffset;
fn load_icon() -> Result<IconData> { fn load_icon() -> Result<egui::IconData> {
use bytes::Buf; use bytes::Buf;
let decoder = png::Decoder::new(include_bytes!("../assets/icon_64.png").reader()); let decoder = png::Decoder::new(include_bytes!("../assets/icon_64.png").reader());
let mut reader = decoder.read_info()?; let mut reader = decoder.read_info()?;
@ -21,7 +24,7 @@ fn load_icon() -> Result<IconData> {
return Err(Error::msg("Invalid color type")); return Err(Error::msg("Invalid color type"));
} }
buf.truncate(info.buffer_size()); buf.truncate(info.buffer_size());
Ok(IconData { rgba: buf, width: info.width, height: info.height }) Ok(egui::IconData { rgba: buf, width: info.width, height: info.height })
} }
// When compiling natively: // When compiling natively:
@ -41,7 +44,7 @@ fn main() {
eframe::NativeOptions { follow_system_theme: false, ..Default::default() }; eframe::NativeOptions { follow_system_theme: false, ..Default::default() };
match load_icon() { match load_icon() {
Ok(data) => { Ok(data) => {
native_options.icon_data = Some(data); native_options.viewport.icon = Some(Arc::new(data));
} }
Err(e) => { Err(e) => {
log::warn!("Failed to load application icon: {}", e); log::warn!("Failed to load application icon: {}", e);