Skip to content

Commit ababd31

Browse files
committed
persisted_tab: replace usages of the "profile" word with "persisted"
Avoids confusion with auto-attach profiles, since persisted devices are not really profiles.
1 parent 267da8d commit ababd31

File tree

2 files changed

+29
-29
lines changed

2 files changed

+29
-29
lines changed

src/gui/persisted_tab/mod.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
mod profile_info;
1+
mod persisted_info;
22

33
use std::cell::{Cell, RefCell};
44

@@ -10,7 +10,7 @@ use nwg::stretch::{
1010
};
1111
use windows_sys::Win32::UI::{Controls::LVSCW_AUTOSIZE_USEHEADER, Shell::SIID_SHIELD};
1212

13-
use self::profile_info::ProfileInfo;
13+
use self::persisted_info::PersistedInfo;
1414
use crate::gui::{
1515
nwg_ext::{BitmapEx, MenuItemEx},
1616
usbipd_gui::GuiTab,
@@ -42,12 +42,12 @@ pub struct PersistedTab {
4242
ex_flags: nwg::ListViewExFlags::FULL_ROW_SELECT,
4343
)]
4444
#[nwg_events(OnListViewRightClick: [PersistedTab::show_menu],
45-
OnListViewItemChanged: [PersistedTab::update_profile_details]
45+
OnListViewItemChanged: [PersistedTab::update_persisted_details]
4646
)]
4747
#[nwg_layout_item(layout: persisted_tab_layout, flex_grow: 1.0)]
4848
list_view: nwg::ListView,
4949

50-
// Profile info
50+
// Persisted info
5151
#[nwg_control]
5252
#[nwg_layout_item(layout: persisted_tab_layout, margin: PADDING_LEFT,
5353
size: Size { width: D::Points(DETAILS_PANEL_WIDTH), height: D::Auto },
@@ -62,10 +62,10 @@ pub struct PersistedTab {
6262
#[nwg_layout_item(layout: details_layout, flex_grow: 1.0)]
6363
// Multi-line RichLabels send a WM_CLOSE message when the ESC key is pressed
6464
#[nwg_events(OnWindowClose: [PersistedTab::inhibit_close(EVT_DATA)])]
65-
profile_info_frame: nwg::Frame,
65+
persisted_info_frame: nwg::Frame,
6666

67-
#[nwg_partial(parent: profile_info_frame)]
68-
profile_info: ProfileInfo,
67+
#[nwg_partial(parent: persisted_info_frame)]
68+
persisted_info: PersistedInfo,
6969

7070
// Buttons
7171
#[nwg_control(parent: details_frame, flags: "VISIBLE")]
@@ -93,7 +93,7 @@ impl PersistedTab {
9393
fn init_list(&self) {
9494
let dv = &self.list_view;
9595
dv.clear();
96-
dv.insert_column("Profile");
96+
dv.insert_column("Device");
9797
dv.set_headers_enabled(true);
9898

9999
// Auto-size before adding items to ensure we don't overflow the list view
@@ -113,8 +113,8 @@ impl PersistedTab {
113113
}
114114
}
115115

116-
/// Updates the profile details panel with the currently selected device.
117-
fn update_profile_details(&self) {
116+
/// Updates the details panel with the currently selected device.
117+
fn update_persisted_details(&self) {
118118
let devices = self.persisted_devices.borrow();
119119
let device = self.list_view.selected_item().and_then(|i| devices.get(i));
120120

@@ -124,7 +124,7 @@ impl PersistedTab {
124124
self.delete_button.set_enabled(false);
125125
}
126126

127-
self.profile_info.update(device);
127+
self.persisted_info.update(device);
128128
}
129129

130130
fn show_menu(&self) {
@@ -218,6 +218,6 @@ impl GuiTab for PersistedTab {
218218

219219
fn refresh(&self) {
220220
self.refresh_list();
221-
self.update_profile_details();
221+
self.update_persisted_details();
222222
}
223223
}

src/gui/persisted_tab/profile_info.rs renamed to src/gui/persisted_tab/persisted_info.rs

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use nwg::stretch::{
99
use crate::usbipd::UsbDevice;
1010

1111
/// The persisted device info tab.
12-
/// It displays detailed information about a persistent device profile.
12+
/// It displays detailed information about a persisted device.
1313
///
1414
/// Call the `update` method to update the information displayed.
1515
///
@@ -20,62 +20,62 @@ use crate::usbipd::UsbDevice;
2020
/// has focus. It is suggested to inhibit the `OnWindowClose` event on the
2121
/// parent window (e.g. the parent `nwg::Frame`) to prevent it from closing.
2222
#[derive(Default, NwgPartial)]
23-
pub struct ProfileInfo {
23+
pub struct PersistedInfo {
2424
#[nwg_resource(family: "Segoe UI Semibold", size: 16, weight: 400)]
2525
font_bold: nwg::Font,
2626

2727
#[nwg_resource(family: "Segoe UI Semibold", size: 20, weight: 400)]
2828
font_bold_big: nwg::Font,
2929

3030
#[nwg_layout(flex_direction: FlexDirection::Column, auto_spacing: None)]
31-
device_info_layout: nwg::FlexboxLayout,
31+
info_layout: nwg::FlexboxLayout,
3232

33-
#[nwg_control(text: "Profile Info", font: Some(&data.font_bold_big))]
34-
#[nwg_layout_item(layout: device_info_layout, size: Size { width: D::Auto, height: Pt(20.0) })]
35-
profile_info: nwg::Label,
33+
#[nwg_control(text: "Persisted Info", font: Some(&data.font_bold_big))]
34+
#[nwg_layout_item(layout: info_layout, size: Size { width: D::Auto, height: Pt(20.0) })]
35+
persisted_info: nwg::Label,
3636

3737
#[nwg_control]
38-
#[nwg_layout_item(layout: device_info_layout, size: Size { width: D::Auto, height: Pt(1.0) },
38+
#[nwg_layout_item(layout: info_layout, size: Size { width: D::Auto, height: Pt(1.0) },
3939
margin: Rect { start: Pt(0.0), end: Pt(0.0), top: Pt(5.0), bottom: Pt(0.0)}
4040
)]
4141
separator: nwg::Frame,
4242

4343
#[nwg_control(text: "VID:PID:", font: Some(&data.font_bold), v_align: nwg::VTextAlign::Bottom)]
44-
#[nwg_layout_item(layout: device_info_layout, size: Size { width: D::Auto, height: Pt(20.0)},
44+
#[nwg_layout_item(layout: info_layout, size: Size { width: D::Auto, height: Pt(20.0)},
4545
margin: Rect { start: Pt(0.0), end: Pt(0.0), top: Pt(6.0), bottom: Pt(0.0)}
4646
)]
4747
vid_pid: nwg::Label,
4848

4949
#[nwg_control]
50-
#[nwg_layout_item(layout: device_info_layout, size: Size { width: D::Auto, height: Pt(20.0) })]
50+
#[nwg_layout_item(layout: info_layout, size: Size { width: D::Auto, height: Pt(20.0) })]
5151
vid_pid_content: nwg::RichLabel,
5252

5353
#[nwg_control(text: "Serial number:", font: Some(&data.font_bold), v_align: nwg::VTextAlign::Bottom)]
54-
#[nwg_layout_item(layout: device_info_layout, size: Size { width: D::Auto, height: Pt(20.0) })]
54+
#[nwg_layout_item(layout: info_layout, size: Size { width: D::Auto, height: Pt(20.0) })]
5555
serial: nwg::Label,
5656

5757
#[nwg_control]
58-
#[nwg_layout_item(layout: device_info_layout, size: Size { width: D::Auto, height: Pt(20.0) })]
58+
#[nwg_layout_item(layout: info_layout, size: Size { width: D::Auto, height: Pt(20.0) })]
5959
serial_content: nwg::RichLabel,
6060

6161
#[nwg_control(text: "Persisted ID:", font: Some(&data.font_bold), v_align: nwg::VTextAlign::Bottom)]
62-
#[nwg_layout_item(layout: device_info_layout, size: Size { width: D::Auto, height: Pt(20.0) })]
62+
#[nwg_layout_item(layout: info_layout, size: Size { width: D::Auto, height: Pt(20.0) })]
6363
persisted: nwg::Label,
6464

6565
#[nwg_control]
66-
#[nwg_layout_item(layout: device_info_layout, size: Size { width: D::Auto, height: Pt(20.0) })]
66+
#[nwg_layout_item(layout: info_layout, size: Size { width: D::Auto, height: Pt(20.0) })]
6767
persisted_content: nwg::RichLabel,
6868

6969
#[nwg_control(text: "Description:", font: Some(&data.font_bold), v_align: nwg::VTextAlign::Bottom)]
70-
#[nwg_layout_item(layout: device_info_layout, size: Size { width: D::Auto, height: Pt(20.0) })]
70+
#[nwg_layout_item(layout: info_layout, size: Size { width: D::Auto, height: Pt(20.0) })]
7171
description: nwg::Label,
7272

7373
#[nwg_control(flags: "VISIBLE|MULTI_LINE")]
74-
#[nwg_layout_item(layout: device_info_layout, size: Size { width: D::Auto, height: D::Auto }, flex_grow: 1.0)]
74+
#[nwg_layout_item(layout: info_layout, size: Size { width: D::Auto, height: D::Auto }, flex_grow: 1.0)]
7575
description_content: nwg::RichLabel,
7676
}
7777

78-
impl ProfileInfo {
78+
impl PersistedInfo {
7979
pub fn update(&self, device: Option<&UsbDevice>) {
8080
if let Some(device) = device {
8181
self.vid_pid_content
@@ -94,7 +94,7 @@ impl ProfileInfo {
9494
self.vid_pid_content.set_text("-");
9595
self.serial_content.set_text("-");
9696
self.persisted_content.set_text("-");
97-
self.description_content.set_text("No profile selected");
97+
self.description_content.set_text("No device selected");
9898
}
9999
}
100100
}

0 commit comments

Comments
 (0)