WIP: Add webcam resolutions on linux (#302)

* Add webcam resolutions on linux

* More resolutions
This commit is contained in:
Jeremy Bullock 2020-10-06 21:34:14 -06:00 committed by GitHub
parent 0decaa114e
commit e155d48bbe
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 2 deletions

View file

@ -203,7 +203,7 @@ StopMotionController::StopMotionController(QWidget *parent) : QWidget(parent) {
m_saveInFolderPopup = new PencilTestSaveInFolderPopup(this);
m_cameraListCombo = new QComboBox(this);
m_resolutionCombo = new QComboBox(this);
m_resolutionCombo->setFixedWidth(fontMetrics().width("0000 x 0000") + 25);
m_resolutionCombo->setFixedWidth(fontMetrics().width("0000 x 0000") + 40);
m_resolutionLabel = new QLabel(tr("Resolution: "), this);
m_cameraStatusLabel = new QLabel(tr("Camera Status"), this);
QPushButton *refreshCamListButton = new QPushButton(tr("Refresh"), this);
@ -1782,7 +1782,7 @@ void StopMotionController::refreshCameraList(QString activeCamera) {
maxTextLength = std::max(maxTextLength, fontMetrics().width(name));
}
#endif
m_cameraListCombo->setMaximumWidth(maxTextLength + 25);
m_cameraListCombo->setMaximumWidth(maxTextLength + 40);
m_cameraListCombo->setEnabled(true);
m_cameraListCombo->setCurrentIndex(0);
m_captureButton->setEnabled(true);

View file

@ -179,6 +179,21 @@ void Webcam::clearWebcamResolutions() { m_webcamResolutions.clear(); }
void Webcam::refreshWebcamResolutions() {
clearWebcamResolutions();
m_webcamResolutions = getWebcam()->supportedViewfinderResolutions();
if (m_webcamResolutions.size() == 0) {
m_webcamResolutions.push_back(QSize(640,360));
m_webcamResolutions.push_back(QSize(640,480));
m_webcamResolutions.push_back(QSize(800,448));
m_webcamResolutions.push_back(QSize(800,600));
m_webcamResolutions.push_back(QSize(848,480));
m_webcamResolutions.push_back(QSize(864,480));
m_webcamResolutions.push_back(QSize(960,540));
m_webcamResolutions.push_back(QSize(960,720));
m_webcamResolutions.push_back(QSize(1024,576));
m_webcamResolutions.push_back(QSize(1280,720));
m_webcamResolutions.push_back(QSize(1600,896));
m_webcamResolutions.push_back(QSize(1600,900));
m_webcamResolutions.push_back(QSize(1920, 1080));
}
}
//-----------------------------------------------------------------