48 lines
1.5 KiB
C++
48 lines
1.5 KiB
C++
// CameraPanel.h — 相机连接/预览/冻结/参数 (QObject 控制器)
|
|
#pragma once
|
|
#include <QObject>
|
|
#include <QImage>
|
|
namespace Ui { class MainWindowClass; }
|
|
class CameraManager;
|
|
class QComboBox;
|
|
|
|
class CameraPanel : public QObject
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
CameraPanel(Ui::MainWindowClass& ui, CameraManager* mgr, QObject* parent);
|
|
QImage lastLeftFrame() const { return m_lastLeft; }
|
|
QImage lastRightFrame() const { return m_lastRight; }
|
|
QImage captureLeft();
|
|
QImage captureRight();
|
|
bool leftConnected() const;
|
|
bool rightConnected() const;
|
|
bool leftPreviewing() const { return m_lPrev; }
|
|
bool rightPreviewing() const { return m_rPrev; }
|
|
|
|
signals:
|
|
void logMessage(const QString& msg);
|
|
|
|
private slots:
|
|
void onLeftConnect(); void onLeftDisconnect();
|
|
void onLeftPreviewToggle(); void onLeftFreeze();
|
|
void onRightConnect(); void onRightDisconnect();
|
|
void onRightPreviewToggle(); void onRightFreeze();
|
|
void onLeftFrameReady(const QImage& img);
|
|
void onRightFrameReady(const QImage& img);
|
|
void onCameraError(int idx, const QString& msg);
|
|
void onApplyParams();
|
|
void onApplyWhiteBalance();
|
|
void onCamTargetChanged(int);
|
|
void refreshComPorts();
|
|
|
|
private:
|
|
void updateStates();
|
|
Ui::MainWindowClass& ui;
|
|
CameraManager* m_mgr;
|
|
QComboBox* m_comboCamTarget = nullptr;
|
|
bool m_lPrev = false, m_rPrev = false;
|
|
bool m_lFrozen = false, m_rFrozen = false;
|
|
QImage m_lastLeft, m_lastRight;
|
|
};
|