Skip to content

Commit

Permalink
refactor: ⬆️ Upgrade egui and other deps
Browse files Browse the repository at this point in the history
  • Loading branch information
zmerp committed Nov 24, 2023
1 parent 2d487b0 commit 131715d
Show file tree
Hide file tree
Showing 10 changed files with 307 additions and 214 deletions.
452 changes: 269 additions & 183 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion alvr/audio/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ serde = "1"

[target.'cfg(windows)'.dependencies]
widestring = "1"
windows = { version = "0.51", features = [
windows = { version = "0.52", features = [
"Win32_Devices_FunctionDiscovery",
"Win32_Foundation",
"Win32_Media_Audio_Endpoints",
Expand Down
2 changes: 1 addition & 1 deletion alvr/client_mock/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ alvr_client_core.workspace = true
alvr_packets.workspace = true
alvr_session.workspace = true

eframe = "0.23"
eframe = "0.24"
env_logger = "0.10"
rand = "0.8"
4 changes: 2 additions & 2 deletions alvr/client_mock/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use alvr_common::{
use alvr_packets::Tracking;
use alvr_session::CodecType;
use eframe::{
egui::{self, CentralPanel, Context, RichText, Slider},
egui::{CentralPanel, Context, RichText, Slider, ViewportBuilder},
Frame, NativeOptions,
};
use std::{
Expand Down Expand Up @@ -308,7 +308,7 @@ fn main() {
eframe::run_native(
"Mock client",
NativeOptions {
initial_window_size: Some(egui::vec2(400.0, 400.0)),
viewport: ViewportBuilder::default().with_inner_size((400.0, 400.0)),
..Default::default()
},
Box::new(|_| Box::new(Window::new(input_sender, output_receiver))),
Expand Down
2 changes: 1 addition & 1 deletion alvr/dashboard/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ alvr_gui_common.workspace = true

bincode = "1"
chrono = "0.4"
eframe = "0.23"
eframe = "0.24"
env_logger = "0.10"
ico = "0.3"
rand = "0.8"
Expand Down
19 changes: 10 additions & 9 deletions alvr/dashboard/src/dashboard/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -336,22 +336,23 @@ impl eframe::App for Dashboard {
for request in requests {
self.data_sources.request(request);
}
}

#[cfg(not(target_arch = "wasm32"))]
fn on_close_event(&mut self) -> bool {
if crate::data_sources::get_local_data_source()
.settings()
.steamvr_launcher
.open_close_steamvr_with_dashboard
if context.input(|state| state.viewport().close_requested())
&& self
.session
.as_ref()
.map(|s| {
s.to_settings()
.steamvr_launcher
.open_close_steamvr_with_dashboard
})
.unwrap_or(false)
{
self.data_sources.request(ServerRequest::ShutdownSteamvr);

crate::steamvr_launcher::LAUNCHER
.lock()
.ensure_steamvr_shutdown()
}

true
}
}
18 changes: 11 additions & 7 deletions alvr/dashboard/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ use dashboard::Dashboard;
#[cfg(not(target_arch = "wasm32"))]
fn main() {
use alvr_common::ALVR_VERSION;
use eframe::{egui, IconData, NativeOptions};
use eframe::{
egui::{IconData, ViewportBuilder},
NativeOptions,
};
use ico::IconDir;
use std::{env, fs};
use std::{io::Cursor, sync::mpsc};
Expand Down Expand Up @@ -85,12 +88,13 @@ fn main() {
eframe::run_native(
&format!("ALVR Dashboard (streamer v{})", *ALVR_VERSION),
NativeOptions {
icon_data: Some(IconData {
rgba: image.rgba_data().to_owned(),
width: image.width(),
height: image.height(),
}),
initial_window_size: Some(egui::vec2(870.0, 600.0)),
viewport: ViewportBuilder::default()
.with_inner_size((870.0, 600.0))
.with_icon(IconData {
rgba: image.rgba_data().to_owned(),
width: image.width(),
height: image.height(),
}),
centered: true,
..Default::default()
},
Expand Down
2 changes: 1 addition & 1 deletion alvr/gui_common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ license.workspace = true
[dependencies]
alvr_common.workspace = true

egui = "0.23"
egui = "0.24"
2 changes: 1 addition & 1 deletion alvr/launcher/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ alvr_common.workspace = true
alvr_gui_common.workspace = true

anyhow = "1"
eframe = "0.23"
eframe = "0.24"
futures-util = "0.3.28"
open = "5"
reqwest = { version = "0.11", default-features = false, features = ["rustls-tls", "stream", "json"] }
Expand Down
18 changes: 10 additions & 8 deletions alvr/launcher/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ use std::{
};

use eframe::{
egui::{Button, CentralPanel, ComboBox, Context, Frame, Grid, Layout, ProgressBar, Window},
egui::{
Button, CentralPanel, ComboBox, Context, Frame, Grid, Layout, ProgressBar, ViewportCommand,
Window,
},
emath::{Align, Align2},
epaint::Color32,
};
Expand Down Expand Up @@ -423,7 +426,7 @@ impl Launcher {
}

impl eframe::App for Launcher {
fn update(&mut self, ctx: &Context, frame: &mut eframe::Frame) {
fn update(&mut self, ctx: &Context, _: &mut eframe::Frame) {
while let Ok(msg) = self.rx.try_recv() {
match msg {
WorkerMsg::VersionData(data) => self.version_data = Some(data),
Expand Down Expand Up @@ -470,7 +473,7 @@ impl eframe::App for Launcher {
}
}
self.tx.send(GuiMsg::Quit).unwrap();
frame.close();
ctx.send_viewport_cmd(ViewportCommand::Close);
}
if ui
.add_enabled(
Expand Down Expand Up @@ -548,11 +551,10 @@ impl eframe::App for Launcher {
});
}
});
}

fn on_close_event(&mut self) -> bool {
self.tx.send(GuiMsg::Quit).unwrap();
true
if ctx.input(|i| i.viewport().close_requested()) {
self.tx.send(GuiMsg::Quit).unwrap();
}
}
}

Expand Down Expand Up @@ -756,7 +758,7 @@ async fn install(

let buffer = download(tx, "Downloading Streamer", &url, client).await?;

let mut installation_dir = data_dir().extended(VERSIONS_SUBDIR).extended(&release.tag);
let installation_dir = data_dir().extended(VERSIONS_SUBDIR).extended(&release.tag);

fs::create_dir_all(&installation_dir)?;

Expand Down

0 comments on commit 131715d

Please sign in to comment.