Skip to content

Commit

Permalink
Merge pull request #197 from martinling/additional-descriptors
Browse files Browse the repository at this point in the history
Display all descriptor types in device view
  • Loading branch information
miek authored Oct 12, 2024
2 parents 107657d + be24322 commit 6331cd3
Show file tree
Hide file tree
Showing 28 changed files with 1,557 additions and 1,130 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/docs/build/
/target
/tests/*/output.txt
/tests/*/devices-output.txt
/tests/ui/*/output.txt
/vcpkg
/wix/LICENSE-dynamic-libraries.txt
Expand Down
590 changes: 365 additions & 225 deletions src/capture.rs

Large diffs are not rendered by default.

11 changes: 5 additions & 6 deletions src/record_ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ impl Recording {
Model: ListModelExt + GenericModel<Item, ViewMode>,
CaptureReader: ItemSource<Item, ViewMode>,
Object: ToGenericRowData<Item>,
Item: Copy,
Item: Clone,
ViewMode: Copy,
{
if (removed, added) == (0, 0) {
Expand Down Expand Up @@ -204,17 +204,16 @@ impl Recording {
where Model: ListModelExt + GenericModel<Item, ViewMode>,
CaptureReader: ItemSource<Item, ViewMode>,
Object: ToGenericRowData<Item>,
Item: Copy,
Item: Clone,
ViewMode: Copy
{
let item = model
let node = &model
.item(position)
.expect("Failed to retrieve row data")
.to_generic_row_data()
.node()
.expect("Failed to fetch item node from row data")
.borrow()
.item;
.expect("Failed to fetch item node from row data");
let item = &node.borrow().item;
self.capture
.description(&item, false)
.expect("Failed to generate item summary")
Expand Down
2 changes: 1 addition & 1 deletion src/row_data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use crate::capture::{TrafficItem, DeviceItem};
use crate::tree_list_model::ItemNodeRc;

/// Trait implemented by each of our row data types.
pub trait GenericRowData<Item> where Item: Copy {
pub trait GenericRowData<Item> where Item: Clone {
/// Create a row for the given node.
fn new(node: Result<ItemNodeRc<Item>, String>) -> Self where Self: Sized;

Expand Down
2 changes: 1 addition & 1 deletion src/test_cynthion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ fn test(save_capture: bool,

// Look for the test device in the capture.
let device_id = DeviceId::from(1);
let device_data = reader.device_data(&device_id)?;
let device_data = reader.device_data(device_id)?;
ensure!(device_data.description() == "USB Analyzer Test Device",
"Device found did not have expected description");
println!("Found test device in capture");
Expand Down
12 changes: 6 additions & 6 deletions src/tree_list_model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ impl<Item> Node<Item> for RootNode<Item> {
}
}

impl<Item> Node<Item> for ItemNode<Item> where Item: Copy {
impl<Item> Node<Item> for ItemNode<Item> where Item: Clone {
fn item(&self) -> Option<&Item> {
Some(&self.item)
}
Expand Down Expand Up @@ -205,7 +205,7 @@ trait UpdateTotal<Item> {
}

impl<T, Item> UpdateTotal<Item> for Rc<RefCell<T>>
where T: Node<Item> + 'static, Item: Copy + 'static
where T: Node<Item> + 'static, Item: Clone + 'static
{
fn update_total(&self, expanded: bool, rows_affected: u64)
-> Result<(), Error>
Expand All @@ -232,7 +232,7 @@ trait NodeRcOps<Item>: UpdateTotal<Item> {
}

impl<Item> NodeRcOps<Item> for RootNodeRc<Item>
where Item: Copy + 'static
where Item: Clone + 'static
{
fn source(&self) -> Source<Item> {
TopLevelItems()
Expand All @@ -244,7 +244,7 @@ where Item: Copy + 'static
}

impl<Item> NodeRcOps<Item> for ItemNodeRc<Item>
where Item: Copy + 'static
where Item: Clone + 'static
{
fn source(&self) -> Source<Item> {
ChildrenOf(self.clone())
Expand All @@ -255,7 +255,7 @@ where Item: Copy + 'static
}
}

impl<Item> ItemNode<Item> where Item: Copy {
impl<Item> ItemNode<Item> where Item: Clone {

pub fn expanded(&self) -> bool {
Node::<Item>::expanded(self)
Expand Down Expand Up @@ -357,7 +357,7 @@ pub struct TreeListModel<Item, Model, RowData, ViewMode> {
}

impl<Item, Model, RowData, ViewMode> TreeListModel<Item, Model, RowData, ViewMode>
where Item: 'static + Copy + Debug,
where Item: 'static + Clone + Debug,
ViewMode: Copy,
Model: GenericModel<Item, ViewMode> + ListModelExt,
RowData: GenericRowData<Item> + IsA<Object> + Cast,
Expand Down
2 changes: 1 addition & 1 deletion src/ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -629,7 +629,7 @@ fn create_view<Item, Model, RowData, ViewMode>(
recording_args: (&Rc<RefCell<Recording>>, &'static str))
-> (Model, SingleSelection, ColumnView)
where
Item: Copy + 'static,
Item: Clone + 'static,
ViewMode: Copy,
Model: GenericModel<Item, ViewMode> + IsA<ListModel> + IsA<Object>,
RowData: GenericRowData<Item> + IsA<Object>,
Expand Down
Loading

0 comments on commit 6331cd3

Please sign in to comment.