From e155d48bbe94b836b3b4aa85dfd5aafdf261c66f Mon Sep 17 00:00:00 2001 From: Jeremy Bullock Date: Tue, 6 Oct 2020 21:34:14 -0600 Subject: [PATCH] WIP: Add webcam resolutions on linux (#302) * Add webcam resolutions on linux * More resolutions --- toonz/sources/stopmotion/stopmotioncontroller.cpp | 4 ++-- toonz/sources/stopmotion/webcam.cpp | 15 +++++++++++++++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/toonz/sources/stopmotion/stopmotioncontroller.cpp b/toonz/sources/stopmotion/stopmotioncontroller.cpp index c69250f2..37f6ddfc 100644 --- a/toonz/sources/stopmotion/stopmotioncontroller.cpp +++ b/toonz/sources/stopmotion/stopmotioncontroller.cpp @@ -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); diff --git a/toonz/sources/stopmotion/webcam.cpp b/toonz/sources/stopmotion/webcam.cpp index d09de819..4120dc08 100644 --- a/toonz/sources/stopmotion/webcam.cpp +++ b/toonz/sources/stopmotion/webcam.cpp @@ -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)); + } } //-----------------------------------------------------------------