91 lines
3.0 KiB
C++
91 lines
3.0 KiB
C++
#include "camconfig.h"
|
|
|
|
CamConfigurator::CamConfigurator(Pylon::DeviceInfoList_t &deviceList, QWidget *parent) :
|
|
deviceList(deviceList), QDialog(parent) {
|
|
mode_combo = new QComboBox(this);
|
|
mode_combo->addItem("single camera");
|
|
if (deviceList.size() > 1){
|
|
mode_combo->addItem("stereo camera");
|
|
}
|
|
connect(mode_combo, SIGNAL(currentIndexChanged(int)), SLOT(modeChanged(int)));
|
|
|
|
device_combo = new QComboBox(this);
|
|
for (auto d : deviceList) {
|
|
device_combo->addItem(QString(d.GetFullName().c_str()));
|
|
}
|
|
connect(device_combo, SIGNAL(currentIndexChanged(int)), SLOT(primaryDeviceChanged(int)));
|
|
|
|
orientation_combo = new QComboBox(this);
|
|
orientation_combo->addItem("Vertical");
|
|
orientation_combo->addItem("Horizontal");
|
|
orientation_combo->setEnabled(false);
|
|
|
|
QWidget *header = new QWidget(this);
|
|
QGridLayout *grid = new QGridLayout(header);
|
|
grid->addWidget(new QLabel("Recording mode:", this), 0, 0);
|
|
grid->addWidget(mode_combo, 0, 1);
|
|
grid->addWidget(new QLabel("Primary device:", this), 1, 0);
|
|
grid->addWidget(device_combo, 1, 1);
|
|
grid->addWidget(new QLabel("Orientation:", this), 2, 0);
|
|
grid->addWidget(orientation_combo, 2, 1);
|
|
header->setLayout(grid);
|
|
|
|
QVBoxLayout *vbox = new QVBoxLayout(this);
|
|
vbox->addWidget(header);
|
|
|
|
stack = new QStackedWidget(this);
|
|
stack->addWidget(singleCameraView());
|
|
stack->addWidget(new QLabel("Stereo View"));
|
|
stack->setCurrentIndex(0);
|
|
vbox->addWidget(stack);
|
|
|
|
buttonbox = new QDialogButtonBox(QDialogButtonBox::Ok
|
|
| QDialogButtonBox::Cancel);
|
|
connect(buttonbox, &QDialogButtonBox::accepted, this, &QDialog::accept);
|
|
connect(buttonbox, &QDialogButtonBox::rejected, this, &QDialog::reject);
|
|
vbox->addWidget(buttonbox);
|
|
//this->setLayout(vbox);
|
|
}
|
|
|
|
QWidget* CamConfigurator::singleCameraView() {
|
|
QWidget *w = new QWidget(this);
|
|
QVBoxLayout *l = new QVBoxLayout(w);
|
|
l->setParent(w);
|
|
w->setLayout(l);
|
|
|
|
QString cam_name = device_combo->currentText();
|
|
singleCamPreview = new CameraPreview(cam_name, this);
|
|
l->addWidget(singleCamPreview);
|
|
return w;
|
|
}
|
|
|
|
// void CamConfigurator::stereoCameraView() {
|
|
// QWidget *w = new QWidget(this);
|
|
// QVBoxLayout *l = new QVBoxLayout();
|
|
// w->setLayout(l);
|
|
// l->addWidget(orientation_combo);
|
|
// }
|
|
|
|
|
|
void CamConfigurator::modeChanged(int idx) {
|
|
stack->setCurrentIndex(idx);
|
|
orientation_combo->setEnabled(idx == 1);
|
|
}
|
|
|
|
void CamConfigurator::primaryDeviceChanged(int idx) {
|
|
std::cerr << idx << std::endl;
|
|
if (stack->currentIndex() == 0) { // single camera setting
|
|
QString devicename = device_combo->currentText();
|
|
singleCamPreview->updateCamera(devicename);
|
|
}
|
|
}
|
|
|
|
CamConfigurator::~CamConfigurator()
|
|
{
|
|
delete singleCamPreview;
|
|
}
|
|
// void OptionsDialog::file_opened(QString filename)
|
|
// {
|
|
// QObject::connect(this, SLOT(file_opened(QString)), ui->widget, SLOT(file_opened(QString)));
|
|
// }
|