    #ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QImage>
#include <QLabel>
#include <QPixmap>
#include <QListWidget>
#include <QListWidgetItem>
#include <QStandardItem>
#include "dialogcamera.h"
#include "dialogconfig.h"
#include "GrabBagPresenter.h"

QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE

class MainWindow : public QMainWindow, public IYGrabBagStatus
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();

    void updateStatusLog(const QString& message);
    void Init();

    // 实现IYGrabBagStatus接口
    virtual void OnStatusUpdate(const std::string& statusMessage) override;
    virtual void OnDetectionResult(const DetectionResult& result) override;
    virtual void OnCamera1StatusChanged(bool isConnected) override;
    virtual void OnCamera2StatusChanged(bool isConnected) override;
    virtual void OnRobotConnectionChanged(bool isConnected) override;
    virtual void OnCameraCountChanged(int cameraCount) override;
    virtual void OnWorkStatusChanged(WorkStatus status) override;

private slots:
    // UI操作相关槽
    void on_btn_camera_clicked();
    void on_btn_config_clicked();
    void on_btn_flow_clicked();
    void on_btn_start_clicked();
    void on_btn_stop_clicked();
    void on_menu_camera_triggered();
    void on_menu_config_triggered();
    void on_menu_camera_adjust_triggered();

private:
    Ui::MainWindow *ui;
    DialogCamera*   ui_dialogCamera = nullptr;
    DialogConfig*   ui_dialogConfig = nullptr;

    // 业务逻辑处理类
    GrabBagPresenter* m_presenter = nullptr;
    
    void displayImage(const QImage& image);
    
    // 扩展版本的检测结果添加函数
    void addDetectionResult(const DetectionResult& result);

    // 设置状态圆点的私有成员函数
    void setStatusDot(QLabel* label, bool isOnline);
};
#endif // MAINWINDOW_H
