Skip to content
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
b37653f
Tweak frame corner radius
Iemand005 Aug 25, 2025
30446c3
Adjust settings panel corner radius
Iemand005 Aug 26, 2025
a64f33a
Square reset buttons
Iemand005 Aug 26, 2025
33a7e09
Switch scale fix
Iemand005 Aug 27, 2025
d54ad3f
Fixed slider value misalignment
Iemand005 Aug 27, 2025
fc600b9
Formatting and cleanup
Iemand005 Aug 27, 2025
2407488
Variable rename
Iemand005 Aug 27, 2025
05896ba
Formatting
Iemand005 Aug 27, 2025
83d18b0
Formatting and small rename
Iemand005 Aug 27, 2025
23734b7
Undo automatic clang formatting
Iemand005 Aug 27, 2025
d8372d4
Undo more automatic clang formatting
Iemand005 Aug 27, 2025
b1ae160
Undo header formatting
Iemand005 Aug 27, 2025
81b4781
Theme scrollbar and toggle constants and removed unnecessary scope.
Iemand005 Aug 28, 2025
0850b08
Set switch dot diameter to scrollbar dot diameter
Iemand005 Aug 28, 2025
30c07d7
Move corner radius inline
Iemand005 Aug 28, 2025
a51dcf5
Remove redundant clone and extract settings tab frame margin to theme.rs
Iemand005 Aug 28, 2025
b3fcefd
Formatting
Iemand005 Aug 28, 2025
fc9299a
Move tab margin constant and remove comment
Iemand005 Aug 28, 2025
6387e07
Extract frame padding to a constant in `theme.rs` instead of hard cod…
Iemand005 Aug 28, 2025
9cbfa39
Add back text spacing
Iemand005 Aug 28, 2025
dcb9d1c
Make settings tabs padding and radius match that of other frames. Set…
Iemand005 Aug 28, 2025
06c4b91
Formatting
Iemand005 Aug 28, 2025
90be8cb
Setting display name updates
Iemand005 Sep 1, 2025
31afe73
UI tweaks
zmerp Oct 12, 2025
136e3fd
Refactor number.rs and fix textbox handling
zmerp Oct 12, 2025
b864cce
Fix wrong presets names
zmerp Oct 12, 2025
8c5cb5e
Merge branch 'ui-tweaks' of https://github.com/Iemand005/ALVR into ui…
Iemand005 Oct 14, 2025
20588f0
7Remove duplicate import
Iemand005 Oct 14, 2025
345ad06
Fix number.rs
Iemand005 Oct 14, 2025
6276869
Formatting
Iemand005 Oct 14, 2025
64000b1
Address comments
zmerp Oct 21, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions alvr/dashboard/src/dashboard/components/devices.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,7 @@ impl DevicesTab {
ui.horizontal(|ui| {
ui.add_space(10.0);
ui.heading(
RichText::new(format!(
"ALVR requires running SteamVR! {}",
"Devices will not be discovered or connected"
))
RichText::new("ALVR requires running SteamVR! Devices will not be discovered or connected.")
.color(Color32::BLACK)
.size(16.0),
);
Expand Down Expand Up @@ -203,6 +200,7 @@ fn wired_client_section(
ui.heading("Wired Connection");
ui.with_layout(Layout::right_to_left(Align::Center), |ui| {
let mut wired = maybe_client.is_some();

if alvr_gui_common::switch(ui, &mut wired).changed() {
if wired {
request = Some(ServerRequest::UpdateClientList {
Expand Down
14 changes: 12 additions & 2 deletions alvr/dashboard/src/dashboard/components/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ use super::{
presets::{PresetControl, builtin_schema},
};
use crate::dashboard::ServerRequest;
use alvr_gui_common::{DisplayString, theme};
use alvr_gui_common::{
DisplayString,
theme::{self, SETTINGS_TAB_FRAME_MARGIN},
};
use alvr_session::{SessionSettings, Settings};
use eframe::egui::{self, Align, Frame, Grid, Layout, RichText, ScrollArea, Ui};
#[cfg(target_arch = "wasm32")]
Expand Down Expand Up @@ -123,9 +126,16 @@ impl SettingsTab {

let mut path_value_pairs = vec![];
ui.with_layout(Layout::left_to_right(Align::Min), |ui| {
let corner_radius =
ui.style().visuals.widgets.open.corner_radius.average() + SETTINGS_TAB_FRAME_MARGIN;

Frame::group(ui.style())
.fill(theme::DARKER_BG)
.inner_margin(egui::vec2(15.0, 12.0))
.inner_margin(egui::vec2(
SETTINGS_TAB_FRAME_MARGIN,
SETTINGS_TAB_FRAME_MARGIN,
))
.corner_radius(corner_radius)
.show(ui, |ui| {
ui.horizontal_wrapped(|ui| {
ui.selectable_value(
Expand Down
79 changes: 44 additions & 35 deletions alvr/dashboard/src/dashboard/components/settings_controls/number.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use super::{NestingInfo, reset};
use crate::dashboard::components::f64_eq;
use alvr_gui_common::theme::SCROLLBAR_DOT_DIAMETER;
use alvr_packets::PathValuePair;
use alvr_session::settings_schema::{NumberType, NumericGuiType};
use eframe::{
Expand Down Expand Up @@ -78,45 +79,53 @@ impl Control {
&mut session_value
};

let response = match &self.gui_type {
NumericGuiType::Slider {
range,
step,
logarithmic,
} => {
let mut slider =
Slider::new(editing_value_mut, range.clone()).logarithmic(*logarithmic);

if let Some(step) = step {
slider = slider.step_by(*step);
}
if !matches!(self.ty, NumberType::Float) {
slider = slider.integer();
}
if let Some(suffix) = &self.suffix {
slider = slider.suffix(suffix);
}

// todo: investigate why the slider does not get centered vertically
ui.with_layout(Layout::left_to_right(Align::Center), |ui| ui.add(slider))
.inner
}
NumericGuiType::TextBox => {
let mut textbox = DragValue::new(editing_value_mut);
let mut is_editing = false;
let mut finished_editing = false;

if !matches!(self.ty, NumberType::Float) {
textbox = textbox.fixed_decimals(0);
}
if let Some(suffix) = &self.suffix {
textbox = textbox.suffix(suffix);
}
if let NumericGuiType::Slider {
range,
step,
logarithmic,
} = &self.gui_type
{
let mut slider = Slider::new(editing_value_mut, range.clone())
.logarithmic(*logarithmic)
.show_value(false);

ui.add(textbox)
if let Some(step) = step {
slider = slider.step_by(*step);
}
};
if response.drag_started() || response.gained_focus() {
if !matches!(self.ty, NumberType::Float) {
slider = slider.integer();
}
if let Some(suffix) = &self.suffix {
slider = slider.suffix(suffix);
}

ui.scope(|ui| {
ui.style_mut().spacing.interact_size.y = SCROLLBAR_DOT_DIAMETER;
let slider_response = ui.add(slider);

is_editing = slider_response.drag_started() || slider_response.gained_focus();
finished_editing =
slider_response.drag_stopped() || slider_response.lost_focus();
});
}

let mut drag_value = DragValue::new(editing_value_mut);

if !matches!(self.ty, NumberType::Float) {
drag_value = drag_value.fixed_decimals(0);
}
if let Some(suffix) = &self.suffix {
drag_value = drag_value.suffix(suffix);
}

let response = ui.add(drag_value);

if is_editing || response.drag_started() || response.gained_focus() {
self.editing_value_f64 = Some(session_value)
} else if response.drag_stopped() || response.lost_focus() {
} else if finished_editing || response.drag_stopped() || response.lost_focus() {
request = get_request(&self.nesting_info, *editing_value_mut, self.ty);
*session_fragment = to_json_value(*editing_value_mut, self.ty);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
use eframe::{
egui::{Button, Layout, Response, Ui},
egui::{self, Button, Layout, Response, Ui},
emath::Align,
};

pub fn reset_button(ui: &mut Ui, enabled: bool, default_str: &str) -> Response {
ui.with_layout(Layout::right_to_left(Align::Center), |ui| {
ui.add_space(5.0);

ui.add_enabled(enabled, Button::new("⟲"))
.on_hover_text(format!("Reset to {default_str}"))
let height = ui.spacing().interact_size.y;
ui.add_enabled(
enabled,
Button::new("⟲").min_size(egui::vec2(height, height)),
)
.on_hover_text(format!("Reset to {default_str}"))
})
.inner
}
4 changes: 3 additions & 1 deletion alvr/gui_common/src/basic_components/switch.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
use egui::{self, Response, Sense, StrokeKind, Ui, WidgetInfo, WidgetType};

use crate::theme::SWITCH_DOT_DIAMETER;

pub fn switch(ui: &mut Ui, on: &mut bool) -> Response {
let desired_size = ui.spacing().interact_size.y * egui::vec2(2.0, 1.0);
let desired_size = SWITCH_DOT_DIAMETER * egui::vec2(2.0, 1.0);
let (rect, mut response) = ui.allocate_exact_size(desired_size, Sense::click());
if response.clicked() {
*on = !*on;
Expand Down
13 changes: 10 additions & 3 deletions alvr/gui_common/src/theme.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ pub const SECTION_BG: Color32 = Color32::from_rgb(36, 36, 36);
pub const DARKER_BG: Color32 = Color32::from_rgb(26, 26, 26);
pub const SEPARATOR_BG: Color32 = Color32::from_rgb(69, 69, 69);
pub const FG: Color32 = Color32::from_rgb(250, 250, 250);
pub const SCROLLBAR_DOT_DIAMETER: f32 = 20.0;
pub const SWITCH_DOT_DIAMETER: f32 = SCROLLBAR_DOT_DIAMETER;
pub const SETTINGS_TAB_FRAME_MARGIN: f32 = 12.0;

pub const OK_GREEN: Color32 = Color32::GREEN;
pub const KO_RED: Color32 = Color32::RED;
Expand Down Expand Up @@ -49,7 +52,10 @@ pub fn set_theme(ctx: &Context) {
ctx.set_theme(ThemePreference::Dark);

let mut style = (*ctx.style()).clone();
style.spacing.slider_width = 200_f32; // slider width can only be set globally
style.spacing.slider_width = 200_f32; // slider width can only be set globally, but you can use ui.scope to override it locally
style.spacing.interact_size.x = 35.0;
style.spacing.interact_size.y = 35.0;

style.spacing.item_spacing = egui::vec2(15.0, 15.0);
style.spacing.button_padding = egui::vec2(10.0, 10.0);
style.text_styles.get_mut(&TextStyle::Body).unwrap().size = 14.0;
Expand All @@ -75,11 +81,12 @@ pub fn set_theme(ctx: &Context) {
visuals.selection.bg_fill = ACCENT;
visuals.selection.stroke = Stroke::new(1.0, FG);

visuals.widgets.noninteractive.bg_fill = BG;
visuals.faint_bg_color = DARKER_BG;

visuals.widgets.noninteractive.bg_fill = BG;
visuals.widgets.noninteractive.fg_stroke = Stroke::new(1.0, FG);
visuals.widgets.noninteractive.bg_stroke = Stroke::new(0.5, SEPARATOR_BG);
visuals.widgets.noninteractive.corner_radius = corner_radius;
visuals.widgets.noninteractive.corner_radius = CornerRadius::same(15); // Frame corner radius

ctx.set_visuals(visuals);
}
Loading