94 lines
2.0 KiB
C++
94 lines
2.0 KiB
C++
#ifndef CAMERASETUP_H
|
|
#define CAMERASETUP_H
|
|
|
|
#include <QWidget>
|
|
#include "camerapreview.h"
|
|
#include "mylogger.h"
|
|
|
|
|
|
namespace Ui {
|
|
class SingleCamera;
|
|
}
|
|
|
|
|
|
class CameraSetup : public QWidget {
|
|
Q_OBJECT
|
|
|
|
public:
|
|
CameraSetup(QWidget *parent=0): QWidget(parent){};
|
|
// virtual ROI getRoi() = 0;
|
|
virtual CameraLayout cameraLayout() = 0;
|
|
virtual void setPrimaryCamera(QString &device) = 0;
|
|
virtual void setSecondaryCamera(QString &device) = 0;
|
|
virtual void switchArrangement() = 0;
|
|
};
|
|
|
|
|
|
class SingleCamera : public CameraSetup {
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit SingleCamera(QWidget *parent = 0);
|
|
~SingleCamera();
|
|
|
|
|
|
void setPrimaryCamera(QString &devive) {
|
|
qDebug() << "Update primary camera";
|
|
camera1Preview->setCamera(devive);
|
|
}
|
|
|
|
|
|
void setSecondaryCamera(QString &devive) {
|
|
qDebug()<< "Update secondary camera not supported on SingleCamera";
|
|
}
|
|
|
|
CameraLayout cameraLayout();
|
|
|
|
void switchArrangement() {
|
|
qDebug() << "switch orientation does nothing on SingleCamera";
|
|
}
|
|
|
|
private:
|
|
CameraPreview *camera1Preview;
|
|
};
|
|
|
|
|
|
class DualCamera : public CameraSetup {
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit DualCamera(QWidget *parent = 0);
|
|
~DualCamera();
|
|
|
|
|
|
void setPrimaryCamera(QString &device) {
|
|
qDebug() << "Update primary camera to " << device;
|
|
if (camera1Preview != nullptr) {
|
|
camera1Preview->setCamera(device);
|
|
primary_device = device;
|
|
}
|
|
}
|
|
|
|
|
|
void setSecondaryCamera(QString &device) {
|
|
qDebug()<< "Update secondary camera to " << device;
|
|
if (camera2Preview != nullptr) {
|
|
camera2Preview->setCamera(device);
|
|
}
|
|
}
|
|
|
|
CameraLayout cameraLayout();
|
|
void switchArrangement();
|
|
|
|
|
|
public slots:
|
|
void updateROI1(int x, int y, int width, int height);
|
|
void updateROI2(int x, int y, int width, int height);
|
|
|
|
private:
|
|
QString primary_device;
|
|
CameraPreview *camera1Preview;
|
|
CameraPreview *camera2Preview;
|
|
};
|
|
|
|
#endif //CAMERASETUP_H
|