mirror of
https://github.com/iDescriptor/iDescriptor.git
synced 2026-06-22 03:45:51 +08:00
94f85bd8fe
- Implement CableInfoWidget to display detailed information about connected cables. - Create associated methods for initializing cable info, analyzing data, and updating the UI. - Introduce get_cable_info function to retrieve cable details from the device. - Replace ClickableWidget with iDescriptor-ui.h in DeviceSidebarWidget and ToolboxWidget. - Update ToolboxWidget to include CableInfoWidget as a selectable tool. - Remove unused ClickableWidget header file.
76 lines
1.7 KiB
C++
76 lines
1.7 KiB
C++
#pragma once
|
|
#include <QGraphicsView>
|
|
#include <QMainWindow>
|
|
#include <QMouseEvent>
|
|
#include <QWidget>
|
|
|
|
#define COLOR_GREEN QColor(0, 180, 0) // Green
|
|
#define COLOR_ORANGE QColor(255, 140, 0) // Orange
|
|
#define COLOR_RED QColor(255, 0, 0) // Red
|
|
|
|
// A custom QGraphicsView that keeps the content fitted with aspect ratio on
|
|
// resize
|
|
class ResponsiveGraphicsView : public QGraphicsView
|
|
{
|
|
public:
|
|
ResponsiveGraphicsView(QGraphicsScene *scene, QWidget *parent = nullptr)
|
|
: QGraphicsView(scene, parent)
|
|
{
|
|
}
|
|
|
|
protected:
|
|
void resizeEvent(QResizeEvent *event) override
|
|
{
|
|
if (scene() && !scene()->items().isEmpty()) {
|
|
fitInView(scene()->itemsBoundingRect(), Qt::KeepAspectRatio);
|
|
}
|
|
QGraphicsView::resizeEvent(event);
|
|
}
|
|
};
|
|
|
|
class ClickableWidget : public QWidget
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
using QWidget::QWidget;
|
|
|
|
signals:
|
|
void clicked();
|
|
|
|
protected:
|
|
// On mouse release, if the click is inside the widget, emit the clicked
|
|
// signal
|
|
void mouseReleaseEvent(QMouseEvent *event) override
|
|
{
|
|
if (event->button() == Qt::LeftButton &&
|
|
rect().contains(event->pos())) {
|
|
emit clicked();
|
|
}
|
|
QWidget::mouseReleaseEvent(event);
|
|
}
|
|
};
|
|
|
|
#ifdef Q_OS_MAC
|
|
void setupMacOSWindow(QMainWindow *window);
|
|
#endif
|
|
|
|
enum class iDescriptorTool {
|
|
Airplayer,
|
|
RealtimeScreen,
|
|
EnterRecoveryMode,
|
|
MountDevImage,
|
|
VirtualLocation,
|
|
Restart,
|
|
Shutdown,
|
|
RecoveryMode,
|
|
QueryMobileGestalt,
|
|
DeveloperDiskImages,
|
|
WirelessFileImport,
|
|
MountIphone,
|
|
CableInfoWidget,
|
|
TouchIdTest,
|
|
FaceIdTest,
|
|
UnmountDevImage,
|
|
Unknown,
|
|
iFuse
|
|
}; |