-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDataStructures.h
More file actions
38 lines (33 loc) · 1.38 KB
/
DataStructures.h
File metadata and controls
38 lines (33 loc) · 1.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#ifndef DATASTRUCTURES_H
#define DATASTRUCTURES_H
#include <QObject>
#include <QString>
#include <QList>
#include <QVariantMap> // Include for the QVariantMap in the original UsbGuardDevice structure (though not used in the final UsbDeviceData)
// ----------------------------------------------------------------------
// Data Structure used for clean data transfer
// This structure holds the parsed data for a single USB device.
// ----------------------------------------------------------------------
struct UsbDeviceData
{
uint id;
QString status;
QString name;
QString vidPid;
QString serial;
QString port;
};
// ----------------------------------------------------------------------
// Qt Metatype Registration
// This is essential for passing the struct and its list counterpart
// across signal/slot connections (especially queued/cross-thread),
// and when storing them in QVariant.
// ----------------------------------------------------------------------
Q_DECLARE_METATYPE(UsbDeviceData)
Q_DECLARE_METATYPE(QList<UsbDeviceData>)
// Note: Although Q_DECLARE_METATYPE is enough, sometimes it's good practice
// to also perform a qRegisterMetaType call if you expect queued connections
// to ensure the type is known immediately. We can place that in the
// UsbGuardManager or main.cpp if needed, but the declarations suffice for
// definition.
#endif // DATASTRUCTURES_H