fix: add xr device index to sort index to try and keep the order consistent
Some checks are pending
/ cargo-fmtcheck (push) Waiting to run
/ cargo-clippy (push) Waiting to run
/ cargo-test (push) Waiting to run
/ appimage (push) Waiting to run

This commit is contained in:
Gabriele Musco 2024-08-26 19:07:48 +02:00
parent aa7f3ec0c4
commit 76d71cb0c2
2 changed files with 8 additions and 4 deletions

View file

@ -45,7 +45,7 @@ pub struct DeviceRowModel {
battery_status: Option<EnvisionBatteryStatus>,
}
#[derive(Debug, Default)]
#[derive(Debug, Default, Clone)]
pub struct DeviceRowModelInit {
pub title: Option<String>,
pub subtitle: Option<String>,
@ -74,7 +74,9 @@ impl From<&XRDevice> for DeviceRowModelInit {
.iter()
.min()
.unwrap_or(&XRDeviceRole::GenericTracker)
.as_number(),
.as_number()
* 1000
+ d.index,
..Default::default()
}
}

View file

@ -237,7 +237,8 @@ impl From<DeviceRole> for XRDeviceRole {
pub struct XRDevice {
pub roles: Vec<XRDeviceRole>,
pub name: String,
pub id: String,
pub id: u32,
pub index: u32,
pub serial: Option<String>,
pub battery: Option<BatteryStatus>,
}
@ -251,7 +252,8 @@ impl XRDevice {
(
dev.index,
Self {
id: dev.id.to_string(),
id: dev.id,
index: dev.index,
serial: dev.serial().ok(),
battery: dev.battery_status().ok().and_then(|bs| {
if bs.present {