2026-10-26 10:56:56 +08:00
|
|
|
// MainWindow.h — 瘦主窗口:只负责创建后端 + 组装面板 + 跨面板胶水
|
|
|
|
|
#pragma once
|
|
|
|
|
#include <QtWidgets/QMainWindow>
|
|
|
|
|
#include "ui_MainWindow.h"
|
|
|
|
|
#include "StereoPoseFusion.h"
|
2026-10-27 22:14:53 +08:00
|
|
|
#include <QJsonObject>
|
|
|
|
|
class VisionIpcServer;
|
|
|
|
|
class QThread;
|
2026-10-26 10:56:56 +08:00
|
|
|
class CameraManager;
|
|
|
|
|
class LightController;
|
|
|
|
|
class YoloDetector;
|
|
|
|
|
class VisionGuideMatcher;
|
|
|
|
|
class StereoPoseFusion;
|
|
|
|
|
class OpcUaCommManager;
|
|
|
|
|
class VisionAlgorithm;
|
|
|
|
|
class CameraPanel;
|
|
|
|
|
class LightPanel;
|
|
|
|
|
class YoloPanel;
|
|
|
|
|
class VisionGuidePanel;
|
|
|
|
|
class MeasurePanel;
|
|
|
|
|
class CoordTransformPanel;
|
|
|
|
|
class OpcUaPanel;
|
|
|
|
|
class GroovePanel;
|
|
|
|
|
class VisionGuidanceCapturePanel;
|
|
|
|
|
class MeasurementOptionsPanel;
|
|
|
|
|
|
|
|
|
|
class MainWindow : public QMainWindow
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
public:
|
|
|
|
|
explicit MainWindow(QWidget* parent = nullptr);
|
|
|
|
|
~MainWindow();
|
2026-10-27 22:14:53 +08:00
|
|
|
void startIpc(const QString& name);
|
|
|
|
|
signals:
|
|
|
|
|
void ipcStateChanged(const QJsonObject& state);
|
|
|
|
|
void ipcFinished(const QJsonObject& result);
|
2026-10-26 10:56:56 +08:00
|
|
|
private slots:
|
|
|
|
|
void appendLog(const QString& msg);
|
|
|
|
|
void onClearLog();
|
|
|
|
|
void onSaveLog();
|
|
|
|
|
void onAbout();
|
|
|
|
|
// 工具菜单
|
|
|
|
|
void onStereoCalibration();
|
|
|
|
|
void onHandEyeCalibration();
|
|
|
|
|
void onShapeModelGenerator();
|
|
|
|
|
// OPC-UA 测量请求
|
|
|
|
|
void onOpcMeasureRequested(uint32_t timeoutMs);
|
|
|
|
|
void onOpcResetRequested();
|
2026-10-27 22:14:53 +08:00
|
|
|
void onIpcCommand(const QJsonObject& request);
|
2026-10-26 10:56:56 +08:00
|
|
|
private:
|
|
|
|
|
void autoLoadModels();
|
2026-10-27 22:14:53 +08:00
|
|
|
void updateIpcState();
|
|
|
|
|
void updateRemoteLock();
|
|
|
|
|
bool resourceBusy() const;
|
|
|
|
|
VisionIpcServer* m_ipc = nullptr;
|
|
|
|
|
QThread* m_ipcThread = nullptr;
|
|
|
|
|
bool m_controllerAttached = false;
|
|
|
|
|
bool m_initializing = false;
|
|
|
|
|
bool m_modalObserved = false;
|
|
|
|
|
QJsonObject m_initialization;
|
2026-10-26 10:56:56 +08:00
|
|
|
Ui::MainWindowClass ui;
|
|
|
|
|
// ── 后端对象(MainWindow 拥有生命周期) ──
|
|
|
|
|
CameraManager* m_camMgr = nullptr;
|
|
|
|
|
LightController* m_lightCtrl = nullptr;
|
|
|
|
|
YoloDetector* m_yoloDet = nullptr;
|
|
|
|
|
VisionGuideMatcher* m_visionGuide = nullptr;
|
|
|
|
|
StereoPoseFusion* m_fusion = nullptr;
|
|
|
|
|
OpcUaCommManager* m_opcua = nullptr;
|
|
|
|
|
// ── UI 面板(控制器) ──
|
|
|
|
|
CameraPanel* m_panelCam = nullptr;
|
|
|
|
|
LightPanel* m_panelLight = nullptr;
|
|
|
|
|
YoloPanel* m_panelYolo = nullptr;
|
|
|
|
|
VisionGuidePanel* m_panelVisionGuide = nullptr;
|
|
|
|
|
MeasurePanel* m_panelMeas = nullptr;
|
|
|
|
|
CoordTransformPanel* m_panelCoord = nullptr;
|
|
|
|
|
OpcUaPanel* m_panelOpc = nullptr;
|
|
|
|
|
GroovePanel* m_panelGroove = nullptr;
|
|
|
|
|
VisionGuidanceCapturePanel* m_panelGuidanceCapture = nullptr;
|
|
|
|
|
MeasurementOptionsPanel* m_panelMeasurementOptions = nullptr;
|
|
|
|
|
};
|