#include "stopmotioncontroller.h" // TnzLib includes #include "toonz/levelset.h" #include "toonz/preferences.h" #include "toonz/sceneproperties.h" #include "toonz/toonzscene.h" #include "toonz/tcamera.h" #include "toonz/tcolumnhandle.h" #include "toonz/tframehandle.h" #include "toonz/tscenehandle.h" #include "toonz/txshcell.h" #include "toonz/txsheethandle.h" #include "toonz/txshlevelhandle.h" #include "toonz/txshsimplelevel.h" #include "toonz/tstageobjecttree.h" // TnzCore includes #include "filebrowsermodel.h" #include "formatsettingspopups.h" #include "tapp.h" #include "tenv.h" #include "tlevel_io.h" #include "toutputproperties.h" #include "tsystem.h" // TnzQt includes #include "toonzqt/filefield.h" #include "toonzqt/intfield.h" #include "toonzqt/menubarcommand.h" // Qt includes #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #ifdef _WIN32 #include #endif namespace { //----------------------------------------------------------------------------- #ifdef _WIN32 void openCaptureFilterSettings(const QWidget *parent, const QString &cameraName) { HRESULT hr; ICreateDevEnum *createDevEnum = NULL; IEnumMoniker *enumMoniker = NULL; IMoniker *moniker = NULL; IBaseFilter *deviceFilter; ISpecifyPropertyPages *specifyPropertyPages; CAUUID cauuid; // set parent's window handle in order to make the dialog modal HWND ghwndApp = (HWND)(parent->winId()); // initialize COM CoInitialize(NULL); // get device list CoCreateInstance(CLSID_SystemDeviceEnum, NULL, CLSCTX_INPROC_SERVER, IID_ICreateDevEnum, (PVOID *)&createDevEnum); // create EnumMoniker createDevEnum->CreateClassEnumerator(CLSID_VideoInputDeviceCategory, &enumMoniker, 0); if (enumMoniker == NULL) { // if no connected devices found return; } // reset EnumMoniker enumMoniker->Reset(); // find target camera ULONG fetched = 0; bool isCameraFound = false; while (hr = enumMoniker->Next(1, &moniker, &fetched), hr == S_OK) { // get friendly name (= device name) of the camera IPropertyBag *pPropertyBag; moniker->BindToStorage(0, 0, IID_IPropertyBag, (void **)&pPropertyBag); VARIANT var; var.vt = VT_BSTR; VariantInit(&var); pPropertyBag->Read(L"FriendlyName", &var, 0); QString deviceName = QString::fromWCharArray(var.bstrVal); VariantClear(&var); if (deviceName == cameraName) { // bind monkier to the filter moniker->BindToObject(0, 0, IID_IBaseFilter, (void **)&deviceFilter); // release moniker etc. moniker->Release(); enumMoniker->Release(); createDevEnum->Release(); isCameraFound = true; break; } } // if no matching camera found if (!isCameraFound) return; // open capture filter popup hr = deviceFilter->QueryInterface(IID_ISpecifyPropertyPages, (void **)&specifyPropertyPages); if (hr == S_OK) { hr = specifyPropertyPages->GetPages(&cauuid); hr = OleCreatePropertyFrame(ghwndApp, 30, 30, NULL, 1, (IUnknown **)&deviceFilter, cauuid.cElems, (GUID *)cauuid.pElems, 0, 0, NULL); CoTaskMemFree(cauuid.pElems); specifyPropertyPages->Release(); } } #endif //----------------------------------------------------------------------------- QScrollArea *makeChooserPage(QWidget *chooser) { QScrollArea *scrollArea = new QScrollArea(); scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn); scrollArea->setWidgetResizable(true); scrollArea->setWidget(chooser); return scrollArea; } //----------------------------------------------------------------------------- QScrollArea *makeChooserPageWithoutScrollBar(QWidget *chooser) { QScrollArea *scrollArea = new QScrollArea(); scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); scrollArea->setWidgetResizable(true); scrollArea->setWidget(chooser); return scrollArea; } } // namespace //***************************************************************************** // StopMotionController implementation //***************************************************************************** StopMotionController::StopMotionController(QWidget *parent) : QWidget(parent) { m_stopMotion = StopMotion::instance(); m_tabBar = new DVGui::TabBar(this); m_tabBar->setDrawBase(false); m_tabBar->setObjectName("StopMotionTabBar"); m_tabBar->addSimpleTab(tr("Controls")); m_tabBar->addSimpleTab(tr("Settings")); m_tabBar->addSimpleTab(tr("Options")); // m_tabBar->addSimpleTab(tr("Control")); m_tabBarContainer = new TabBarContainter(this); m_mainControlsPage = new QFrame(); m_cameraSettingsPage = new QFrame(); m_optionsPage = new QFrame(); // m_controlPage = new QFrame(); // ********************** // Make Control Page // ********************** 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_resolutionLabel = new QLabel(tr("Resolution: "), this); m_cameraStatusLabel = new QLabel(tr("Camera Status"), this); QPushButton *refreshCamListButton = new QPushButton(tr("Refresh"), this); refreshCamListButton->setFixedHeight(28); refreshCamListButton->setStyleSheet("padding: 0 2;"); QGroupBox *fileFrame = new QGroupBox(tr("File"), this); m_levelNameEdit = new LevelNameLineEdit(this); #ifdef _WIN32 m_captureFilterSettingsBtn = new QPushButton(this); #else m_captureFilterSettingsBtn = 0; #endif if (m_captureFilterSettingsBtn) { m_captureFilterSettingsBtn->setObjectName("GearButton"); m_captureFilterSettingsBtn->setFixedSize(28, 28); m_captureFilterSettingsBtn->setIconSize(QSize(15, 15)); m_captureFilterSettingsBtn->setToolTip(tr("Webcam Settings...")); } // set the start frame 10 if the option in preferences // "Show ABC Appendix to the Frame Number in Xsheet Cell" is active. // (frame 10 is displayed as "1" with this option) int startFrame = Preferences::instance()->isShowFrameNumberWithLettersEnabled() ? 10 : 1; m_frameNumberEdit = new FrameNumberLineEdit(this, startFrame); m_frameInfoLabel = new QLabel("", this); m_fileTypeCombo = new QComboBox(this); m_fileFormatOptionButton = new QPushButton(tr("Options"), this); m_fileFormatOptionButton->setFixedHeight(28); m_fileFormatOptionButton->setStyleSheet("padding: 0 2;"); m_xSheetFrameNumberEdit = new DVGui::IntLineEdit(this, 1, 1); m_saveInFileFld = new DVGui::FileField(this, m_saveInFolderPopup->getParentPath()); QToolButton *nextLevelButton = new QToolButton(this); m_previousLevelButton = new QToolButton(this); QPushButton *nextOpenLevelButton = new QPushButton(this); QToolButton *nextFrameButton = new QToolButton(this); m_previousFrameButton = new QToolButton(this); QPushButton *lastFrameButton = new QPushButton(this); QToolButton *nextXSheetFrameButton = new QToolButton(this); m_previousXSheetFrameButton = new QToolButton(this); m_onionOpacityFld = new DVGui::IntField(this); m_captureButton = new QPushButton(tr("Capture"), this); // QPushButton *subfolderButton = new QPushButton(tr("Subfolder"), this); m_fileTypeCombo->addItems({"jpg", "png", "tga", "tif"}); m_fileTypeCombo->setCurrentIndex(0); fileFrame->setObjectName("CleanupSettingsFrame"); m_frameNumberEdit->setObjectName("LargeSizedText"); m_frameInfoLabel->setAlignment(Qt::AlignRight); nextLevelButton->setFixedSize(24, 24); nextLevelButton->setArrowType(Qt::RightArrow); nextLevelButton->setToolTip(tr("Next Level")); nextOpenLevelButton->setText(tr("Next New")); nextOpenLevelButton->setFixedHeight(28); nextOpenLevelButton->setStyleSheet("padding: 0 2;"); nextOpenLevelButton->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum); m_previousLevelButton->setFixedSize(24, 24); m_previousLevelButton->setArrowType(Qt::LeftArrow); m_previousLevelButton->setToolTip(tr("Previous Level")); nextFrameButton->setFixedSize(24, 24); nextFrameButton->setArrowType(Qt::RightArrow); nextFrameButton->setToolTip(tr("Next Frame")); lastFrameButton->setText(tr("Last Frame")); lastFrameButton->setFixedHeight(28); lastFrameButton->setStyleSheet("padding: 0 2;"); lastFrameButton->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum); m_previousFrameButton->setFixedSize(24, 24); m_previousFrameButton->setArrowType(Qt::LeftArrow); m_previousFrameButton->setToolTip(tr("Previous Frame")); m_xSheetFrameNumberEdit->setObjectName("LargeSizedText"); nextXSheetFrameButton->setFixedSize(24, 24); nextXSheetFrameButton->setArrowType(Qt::RightArrow); nextXSheetFrameButton->setToolTip(tr("Next XSheet Frame")); m_previousXSheetFrameButton->setFixedSize(24, 24); m_previousXSheetFrameButton->setArrowType(Qt::LeftArrow); m_previousXSheetFrameButton->setToolTip(tr("Previous XSheet Frame")); m_setToCurrentXSheetFrameButton = new QPushButton(this); m_setToCurrentXSheetFrameButton->setText(tr("Current Frame")); m_setToCurrentXSheetFrameButton->setFixedHeight(28); m_setToCurrentXSheetFrameButton->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum); m_setToCurrentXSheetFrameButton->setStyleSheet("padding: 2px;"); m_setToCurrentXSheetFrameButton->setToolTip( tr("Set to the Current Playhead Location")); m_onionOpacityFld->setRange(0, 100); m_onionOpacityFld->setValue(100); m_onionOpacityFld->setDisabled(false); m_toggleLiveViewButton = new QPushButton(tr("Start Live View")); m_toggleLiveViewButton->setObjectName("LargeSizedText"); m_toggleLiveViewButton->setFixedHeight(35); m_captureButton->setObjectName("LargeSizedText"); m_captureButton->setFixedHeight(35); QCommonStyle style; m_captureButton->setIcon(style.standardIcon(QStyle::SP_DialogOkButton)); m_captureButton->setIconSize(QSize(20, 20)); // subfolderButton->setObjectName("SubfolderButton"); // subfolderButton->setIconSize(QSize(15, 15)); m_saveInFileFld->setMaximumWidth(380); m_levelNameEdit->setMaximumWidth(380); m_saveInFolderPopup->hide(); m_zoomButton = new QPushButton(tr("Check"), this); m_zoomButton->setFixedHeight(28); m_zoomButton->setStyleSheet("padding: 5 2;"); m_zoomButton->setMaximumWidth(100); m_zoomButton->setToolTip(tr("Check the focus by zooming in")); m_pickZoomButton = new QPushButton(tr("Pick"), this); m_pickZoomButton->setStyleSheet("padding: 5 2;"); m_pickZoomButton->setMaximumWidth(100); m_pickZoomButton->setFixedHeight(28); m_pickZoomButton->setToolTip(tr("Pick the location for focus checking")); m_focusNearButton = new QPushButton(tr("<"), this); m_focusNearButton->setFixedSize(32, 28); m_focusFarButton = new QPushButton(tr(">"), this); m_focusFarButton->setFixedSize(32, 28); m_focusNear2Button = new QPushButton(tr("<<"), this); m_focusNear2Button->setFixedSize(32, 28); m_focusFar2Button = new QPushButton(tr(">>"), this); m_focusFar2Button->setFixedSize(32, 28); m_focusNear3Button = new QPushButton(tr("<<<"), this); m_focusNear3Button->setFixedSize(32, 28); m_focusFar3Button = new QPushButton(tr(">>>"), this); m_focusFar3Button->setFixedSize(32, 28); //*****//**** QVBoxLayout *controlLayout = new QVBoxLayout(); controlLayout->setSpacing(0); controlLayout->setMargin(5); { { QGridLayout *camLay = new QGridLayout(); camLay->setMargin(0); camLay->setSpacing(3); { camLay->addWidget(new QLabel(tr("Camera:"), this), 0, 0, Qt::AlignRight); camLay->addWidget(m_cameraListCombo, 0, 1, Qt::AlignLeft); camLay->addWidget(refreshCamListButton, 0, 2, Qt::AlignLeft); if (m_captureFilterSettingsBtn) { camLay->addWidget(m_captureFilterSettingsBtn, 0, 3, Qt::AlignLeft); camLay->addWidget(m_resolutionLabel, 1, 0, Qt::AlignRight); camLay->addWidget(m_resolutionCombo, 1, 1, 1, 3, Qt::AlignLeft); camLay->setColumnStretch(3, 30); } else { camLay->addWidget(m_resolutionLabel, 1, 0, Qt::AlignRight); camLay->addWidget(m_resolutionCombo, 1, 1, 1, 2, Qt::AlignLeft); camLay->setColumnStretch(2, 30); } camLay->addWidget(m_cameraStatusLabel, 2, 1, 1, 2, Qt::AlignLeft); } controlLayout->addLayout(camLay, 0); QVBoxLayout *fileLay = new QVBoxLayout(); fileLay->setMargin(8); fileLay->setSpacing(5); { QGridLayout *levelLay = new QGridLayout(); levelLay->setMargin(0); levelLay->setHorizontalSpacing(3); levelLay->setVerticalSpacing(5); { levelLay->addWidget(new QLabel(tr("Name:"), this), 0, 0, Qt::AlignRight); QHBoxLayout *nameLay = new QHBoxLayout(); nameLay->setMargin(0); nameLay->setSpacing(2); { nameLay->addWidget(m_previousLevelButton, 0); nameLay->addWidget(m_levelNameEdit, 1); nameLay->addWidget(nextLevelButton, 0); nameLay->addWidget(nextOpenLevelButton, 0); } levelLay->addLayout(nameLay, 0, 1); levelLay->addWidget(new QLabel(tr("Frame:"), this), 1, 0, Qt::AlignRight); QHBoxLayout *frameLay = new QHBoxLayout(); frameLay->setMargin(0); frameLay->setSpacing(2); { frameLay->addWidget(m_previousFrameButton, 0); frameLay->addWidget(m_frameNumberEdit, 1); frameLay->addWidget(nextFrameButton, 0); frameLay->addWidget(lastFrameButton, 0); frameLay->addWidget(m_frameInfoLabel, 1, Qt::AlignVCenter); } levelLay->addLayout(frameLay, 1, 1); } levelLay->setColumnStretch(0, 0); levelLay->setColumnStretch(1, 1); fileLay->addLayout(levelLay, 0); QHBoxLayout *fileTypeLay = new QHBoxLayout(); fileTypeLay->setMargin(0); fileTypeLay->setSpacing(3); { fileTypeLay->addWidget(new QLabel(tr("File Type:"), this), 0); fileTypeLay->addWidget(m_fileTypeCombo, 1); fileTypeLay->addSpacing(10); fileTypeLay->addWidget(m_fileFormatOptionButton); } fileLay->addLayout(fileTypeLay, 0); QHBoxLayout *saveInLay = new QHBoxLayout(); saveInLay->setMargin(0); saveInLay->setSpacing(3); { saveInLay->addWidget(new QLabel(tr("Save In:"), this), 0); saveInLay->addWidget(m_saveInFileFld, 1); } fileLay->addLayout(saveInLay, 0); // fileLay->addWidget(subfolderButton, 0); } fileFrame->setLayout(fileLay); controlLayout->addWidget(fileFrame, 0); QGridLayout *displayLay = new QGridLayout(); displayLay->setMargin(8); displayLay->setHorizontalSpacing(3); displayLay->setVerticalSpacing(5); { displayLay->addWidget(new QLabel(tr("XSheet Frame:"), this), 0, 0, Qt::AlignRight); QHBoxLayout *xsheetLay = new QHBoxLayout(); xsheetLay->setMargin(0); xsheetLay->setSpacing(2); { xsheetLay->addWidget(m_previousXSheetFrameButton, Qt::AlignLeft); xsheetLay->addWidget(m_xSheetFrameNumberEdit, Qt::AlignLeft); xsheetLay->addWidget(nextXSheetFrameButton, Qt::AlignLeft); xsheetLay->addWidget(m_setToCurrentXSheetFrameButton, Qt::AlignCenter); xsheetLay->addStretch(50); } displayLay->addLayout(xsheetLay, 0, 1); } displayLay->setColumnStretch(0, 0); displayLay->setColumnStretch(1, 1); controlLayout->addLayout(displayLay, 0); controlLayout->addStretch(1); controlLayout->addSpacing(5); controlLayout->addStretch(1); } m_mainControlsPage->setLayout(controlLayout); // Make Settings Page m_apertureLabel = new QLabel(tr(""), this); m_apertureSlider = new QSlider(Qt::Horizontal, this); m_apertureSlider->setRange(0, 10); m_apertureSlider->setTickInterval(1); m_apertureSlider->setFixedWidth(260); m_isoLabel = new QLabel(tr(""), this); m_isoSlider = new QSlider(Qt::Horizontal, this); m_isoSlider->setRange(0, 10); m_isoSlider->setTickInterval(1); m_isoSlider->setFixedWidth(260); m_shutterSpeedLabel = new QLabel(tr(""), this); m_shutterSpeedSlider = new QSlider(Qt::Horizontal, this); m_shutterSpeedSlider->setRange(0, 10); m_shutterSpeedSlider->setTickInterval(1); m_shutterSpeedSlider->setFixedWidth(260); m_kelvinValueLabel = new QLabel(tr("Temperature: "), this); m_kelvinSlider = new QSlider(Qt::Horizontal, this); m_kelvinSlider->setRange(0, 10); m_kelvinSlider->setTickInterval(1); m_kelvinSlider->setFixedWidth(260); m_exposureCombo = new QComboBox(this); m_whiteBalanceCombo = new QComboBox(this); m_imageQualityCombo = new QComboBox(this); m_pictureStyleCombo = new QComboBox(this); m_cameraSettingsLabel = new QLabel(tr("Camera Model"), this); m_cameraModeLabel = new QLabel(tr("Camera Mode"), this); m_exposureCombo->setFixedWidth(fontMetrics().width("000000") + 25); QVBoxLayout *settingsLayout = new QVBoxLayout; settingsLayout->setSpacing(0); settingsLayout->setMargin(5); QGridLayout *settingsGridLayout = new QGridLayout; { settingsGridLayout->setMargin(0); settingsGridLayout->setSpacing(3); settingsGridLayout->addWidget(m_cameraSettingsLabel, 0, 0, 1, 2, Qt::AlignCenter); settingsGridLayout->addWidget(m_cameraModeLabel, 1, 0, 1, 2, Qt::AlignCenter); settingsGridLayout->addWidget(new QLabel(" ", this), 2, 0, 1, 2, Qt::AlignCenter); settingsGridLayout->addWidget(m_shutterSpeedLabel, 3, 0, 1, 2, Qt::AlignCenter); settingsGridLayout->addWidget(m_shutterSpeedSlider, 4, 0, 1, 2, Qt::AlignCenter); settingsGridLayout->addWidget(m_apertureLabel, 5, 0, 1, 2, Qt::AlignCenter); settingsGridLayout->addWidget(m_apertureSlider, 6, 0, 1, 2, Qt::AlignCenter); settingsGridLayout->addWidget(m_isoLabel, 7, 0, 1, 2, Qt::AlignCenter); settingsGridLayout->addWidget(m_isoSlider, 8, 0, 1, 2, Qt::AlignCenter); settingsGridLayout->addWidget(new QLabel(" ", this), 9, 0, 1, 2, Qt::AlignCenter); settingsGridLayout->addWidget(new QLabel(tr("White Balance: ")), 10, 0, Qt::AlignRight); settingsGridLayout->addWidget(m_whiteBalanceCombo, 10, 1, Qt::AlignLeft); settingsGridLayout->addWidget(m_kelvinValueLabel, 11, 0, 1, 2, Qt::AlignCenter); settingsGridLayout->addWidget(m_kelvinSlider, 12, 0, 1, 2, Qt::AlignCenter); settingsGridLayout->addWidget(new QLabel(" ", this), 13, 0, 1, 2, Qt::AlignCenter); settingsGridLayout->addWidget(new QLabel(tr("Picture Style: ")), 14, 0, Qt::AlignRight); settingsGridLayout->addWidget(m_pictureStyleCombo, 14, 1, Qt::AlignLeft); settingsGridLayout->addWidget(new QLabel(tr("Image Quality: ")), 15, 0, Qt::AlignRight); settingsGridLayout->addWidget(m_imageQualityCombo, 15, 1, Qt::AlignLeft); settingsGridLayout->addWidget(new QLabel(tr("Exposure: ")), 16, 0, Qt::AlignRight); settingsGridLayout->addWidget(m_exposureCombo, 16, 1, Qt::AlignLeft); settingsGridLayout->addWidget(new QLabel(" ", this), 17, 0, 1, 2, Qt::AlignCenter); settingsGridLayout->addWidget(new QLabel(" ", this), 19, 0, 1, 2, Qt::AlignCenter); settingsGridLayout->setColumnStretch(1, 30); } settingsLayout->addLayout(settingsGridLayout, 0); m_focusAndZoomLayout = new QHBoxLayout; m_focusAndZoomLayout->addStretch(); m_focusAndZoomLayout->addWidget(m_focusNear3Button, Qt::AlignCenter); m_focusAndZoomLayout->addWidget(m_focusNear2Button, Qt::AlignCenter); m_focusAndZoomLayout->addWidget(m_focusNearButton, Qt::AlignCenter); m_focusAndZoomLayout->addWidget(m_zoomButton, Qt::AlignCenter); m_focusAndZoomLayout->addWidget(m_pickZoomButton, Qt::AlignCenter); m_focusAndZoomLayout->addWidget(m_focusFarButton, Qt::AlignCenter); m_focusAndZoomLayout->addWidget(m_focusFar2Button, Qt::AlignCenter); m_focusAndZoomLayout->addWidget(m_focusFar3Button, Qt::AlignCenter); m_focusAndZoomLayout->addStretch(); // settingsLayout->addStretch(); settingsLayout->addLayout(m_focusAndZoomLayout); settingsLayout->addStretch(); m_cameraSettingsPage->setLayout(settingsLayout); // Make Options Page QGroupBox *webcamBox = new QGroupBox(tr("Webcam Options"), this); QGroupBox *dslrBox = new QGroupBox(tr("DSLR Options"), this); QGroupBox *controlBox = new QGroupBox(tr("Motion Control"), this); QGroupBox *timerFrame = new QGroupBox(tr("Time Lapse"), this); m_timerCB = new QCheckBox(tr("Use time lapse"), this); m_timerIntervalFld = new DVGui::IntField(this); m_captureTimer = new QTimer(this); timerFrame->setObjectName("CleanupSettingsFrame"); m_timerCB->setChecked(false); m_timerIntervalFld->setRange(0, 60); m_timerIntervalFld->setValue(10); m_timerIntervalFld->setDisabled(true); m_countdownTimer = new QTimer(this); // Make the interval timer single-shot. When the capture finished, restart // timer for next frame. // This is because capturing and saving the image needs some time. m_captureTimer->setSingleShot(true); m_postCaptureReviewFld = new DVGui::IntField(this); m_postCaptureReviewFld->setRange(0, 10); m_subsamplingFld = new DVGui::IntField(this); m_subsamplingFld->setRange(1, 30); m_subsamplingFld->setDisabled(true); m_blackScreenForCapture = new QCheckBox(this); m_placeOnXSheetCB = new QCheckBox(this); m_placeOnXSheetCB->setToolTip(tr("Place the frame in the XSheet")); m_useScaledFullSizeImages = new QCheckBox(this); m_directShowLabel = new QLabel(tr("Use Direct Show Webcam Drivers"), this); m_directShowCB = new QCheckBox(this); m_useMjpgCB = new QCheckBox(this); m_useNumpadCB = new QCheckBox(this); m_drawBeneathCB = new QCheckBox(this); m_controlDeviceCombo = new QComboBox(this); m_controlDeviceCombo->addItems(m_stopMotion->getAvailableSerialPorts()); m_liveViewOnAllFramesCB = new QCheckBox(this); QVBoxLayout *optionsOutsideLayout = new QVBoxLayout; QGridLayout *optionsLayout = new QGridLayout; optionsLayout->setSpacing(3); optionsLayout->setMargin(5); QGridLayout *webcamLayout = new QGridLayout; QGridLayout *dslrLayout = new QGridLayout; QGridLayout *controlLayout = new QGridLayout; QGridLayout *checkboxLayout = new QGridLayout; dslrLayout->addWidget(m_blackScreenForCapture, 0, 0, Qt::AlignRight); dslrLayout->addWidget(new QLabel(tr("Black Screen for Capture")), 0, 1, Qt::AlignLeft); dslrLayout->addWidget(m_useScaledFullSizeImages, 1, 0, Qt::AlignRight); dslrLayout->addWidget(new QLabel(tr("Use Reduced Resolution Images")), 1, 1, Qt::AlignLeft); dslrLayout->setColumnStretch(1, 30); dslrBox->setLayout(dslrLayout); dslrBox->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Maximum); optionsOutsideLayout->addWidget(dslrBox, Qt::AlignCenter); webcamLayout->addWidget(m_directShowCB, 0, 0, Qt::AlignRight); webcamLayout->addWidget(m_directShowLabel, 0, 1, Qt::AlignLeft); webcamLayout->addWidget(m_useMjpgCB, 1, 0, Qt::AlignRight); webcamLayout->addWidget(new QLabel(tr("Use MJPG with Webcam")), 1, 1, Qt::AlignLeft); webcamLayout->setColumnStretch(1, 30); webcamBox->setLayout(webcamLayout); webcamBox->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Maximum); optionsOutsideLayout->addWidget(webcamBox, Qt::AlignCenter); controlLayout->addWidget(new QLabel(tr("Port: ")), 0, 0, Qt::AlignRight); controlLayout->addWidget(m_controlDeviceCombo, 0, 1, Qt::AlignLeft); controlLayout->setColumnStretch(1, 30); controlBox->setLayout(controlLayout); controlBox->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Maximum); optionsOutsideLayout->addWidget(controlBox, Qt::AlignCenter); QGridLayout *timerLay = new QGridLayout(); timerLay->setMargin(8); timerLay->setHorizontalSpacing(3); timerLay->setVerticalSpacing(5); { timerLay->addWidget(m_timerCB, 0, 0, 1, 2); timerLay->addWidget(new QLabel(tr("Interval(sec):"), this), 1, 0, Qt::AlignRight); timerLay->addWidget(m_timerIntervalFld, 1, 1); } timerLay->setColumnStretch(0, 0); timerLay->setColumnStretch(1, 1); timerFrame->setLayout(timerLay); optionsOutsideLayout->addWidget(timerFrame); checkboxLayout->addWidget(m_placeOnXSheetCB, 0, 0, 1, 1, Qt::AlignRight); checkboxLayout->addWidget(new QLabel(tr("Place on XSheet")), 0, 1, Qt::AlignLeft); checkboxLayout->addWidget(m_useNumpadCB, 1, 0, Qt::AlignRight); checkboxLayout->addWidget( new QLabel(tr("Use Numpad Shortcuts When Active")), 1, 1, Qt::AlignLeft); checkboxLayout->addWidget(m_liveViewOnAllFramesCB, 2, 0, Qt::AlignRight); checkboxLayout->addWidget(new QLabel(tr("Show Live View on All Frames")), 2, 1, Qt::AlignLeft); checkboxLayout->addWidget(m_drawBeneathCB, 3, 0, Qt::AlignRight); checkboxLayout->addWidget(new QLabel(tr("Show Camera Below Other Levels")), 3, 1, Qt::AlignLeft); checkboxLayout->setColumnStretch(1, 30); optionsOutsideLayout->addLayout(checkboxLayout, Qt::AlignLeft); optionsLayout->addWidget(new QLabel(tr("Capture Review Time: ")), 0, 0, Qt::AlignRight); optionsLayout->addWidget(m_postCaptureReviewFld, 0, 1); optionsLayout->addWidget(new QLabel(tr("Level Subsampling: ")), 1, 0, Qt::AlignRight); optionsLayout->addWidget(m_subsamplingFld, 1, 1); optionsLayout->setColumnStretch(1, 30); optionsLayout->setRowStretch(2, 30); optionsOutsideLayout->addLayout(optionsLayout, Qt::AlignLeft); optionsOutsideLayout->addStretch(); m_optionsPage->setLayout(optionsOutsideLayout); // QVBoxLayout *controlOutsideLayout = new QVBoxLayout; // QGridLayout* controlInsideLayout = new QGridLayout; // m_controlBaudRateCombo = new QComboBox(this); // controlInsideLayout->addWidget(m_controlDeviceCombo, 0, 0, 1, 2, // Qt::AlignCenter); // controlInsideLayout->addWidget(m_controlBaudRateCombo, 1, 0, 1, 2, // Qt::AlignCenter); // controlOutsideLayout->addLayout(controlInsideLayout); // m_controlPage->setLayout(controlOutsideLayout); QScrollArea *mainArea = makeChooserPageWithoutScrollBar(m_mainControlsPage); QScrollArea *settingsArea = makeChooserPageWithoutScrollBar(m_cameraSettingsPage); QScrollArea *optionsArea = makeChooserPageWithoutScrollBar(m_optionsPage); // QScrollArea* controlArea = // makeChooserPageWithoutScrollBar(m_controlPage); m_stackedChooser = new QStackedWidget(this); m_stackedChooser->addWidget(mainArea); m_stackedChooser->addWidget(settingsArea); m_stackedChooser->addWidget(optionsArea); // m_stackedChooser->addWidget(controlArea); m_stackedChooser->setFocusPolicy(Qt::NoFocus); QFrame *opacityFrame = new QFrame(); QHBoxLayout *opacityLay = new QHBoxLayout(); opacityLay->addWidget(new QLabel(tr("Opacity:"), this), 0); opacityLay->addWidget(m_onionOpacityFld, 1); opacityFrame->setLayout(opacityLay); opacityFrame->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Maximum); QFrame *controlButtonFrame = new QFrame(); QHBoxLayout *controlButtonLay = new QHBoxLayout(); controlButtonLay->addWidget(m_captureButton, 0); controlButtonLay->addWidget(m_toggleLiveViewButton, 0); controlButtonFrame->setLayout(controlButtonLay); QVBoxLayout *mainLayout = new QVBoxLayout; mainLayout->setMargin(0); mainLayout->setSpacing(0); { QHBoxLayout *hLayout = new QHBoxLayout; hLayout->setMargin(0); { hLayout->addSpacing(4); hLayout->addWidget(m_tabBar); hLayout->addStretch(); } m_tabBarContainer->setLayout(hLayout); mainLayout->addWidget(m_tabBarContainer, 0, 0); mainLayout->addWidget(m_stackedChooser, 1, 0); mainLayout->addWidget(opacityFrame, 0); mainLayout->addWidget(controlButtonFrame, 0); setLayout(mainLayout); m_tabBarContainer->layout()->update(); } } TSceneHandle *sceneHandle = TApp::instance()->getCurrentScene(); TXsheetHandle *xsheetHandle = TApp::instance()->getCurrentXsheet(); bool ret = true; // Outside Connections ret = ret && connect(sceneHandle, SIGNAL(sceneSwitched()), this, SLOT(onSceneSwitched())); ret = ret && connect(xsheetHandle, SIGNAL(xsheetSwitched()), this, SLOT(update())); // UI SIGNALS ret = ret && connect(m_tabBar, SIGNAL(currentChanged(int)), this, SLOT(setPage(int))); // Control Page ret = ret && connect(refreshCamListButton, SIGNAL(pressed()), this, SLOT(refreshCameraListCalled())); ret = ret && connect(m_cameraListCombo, SIGNAL(activated(int)), this, SLOT(onCameraListComboActivated(int))); ret = ret && connect(m_resolutionCombo, SIGNAL(activated(const QString &)), this, SLOT(onResolutionComboActivated(const QString &))); if (m_captureFilterSettingsBtn) ret = ret && connect(m_captureFilterSettingsBtn, SIGNAL(pressed()), this, SLOT(onCaptureFilterSettingsBtnPressed())); ret = ret && connect(m_fileFormatOptionButton, SIGNAL(pressed()), this, SLOT(onFileFormatOptionButtonPressed())); ret = ret && connect(m_levelNameEdit, SIGNAL(levelNameEdited()), this, SLOT(onLevelNameEdited())); ret = ret && connect(nextLevelButton, SIGNAL(pressed()), this, SLOT(onNextName())); ret = ret && connect(m_previousLevelButton, SIGNAL(pressed()), this, SLOT(onPreviousName())); ret = ret && connect(nextOpenLevelButton, SIGNAL(pressed()), this, SLOT(onNextNewLevel())); ret = ret && connect(nextFrameButton, SIGNAL(pressed()), this, SLOT(onNextFrame())); ret = ret && connect(lastFrameButton, SIGNAL(pressed()), this, SLOT(onLastFrame())); ret = ret && connect(m_previousFrameButton, SIGNAL(pressed()), this, SLOT(onPreviousFrame())); ret = ret && connect(nextXSheetFrameButton, SIGNAL(pressed()), this, SLOT(onNextXSheetFrame())); ret = ret && connect(m_previousXSheetFrameButton, SIGNAL(pressed()), this, SLOT(onPreviousXSheetFrame())); ret = ret && connect(m_setToCurrentXSheetFrameButton, SIGNAL(pressed()), this, SLOT(setToCurrentXSheetFrame())); ret = ret && connect(m_onionOpacityFld, SIGNAL(valueEditedByHand()), this, SLOT(onOnionOpacityFldEdited())); ret = ret && connect(m_onionOpacityFld, SIGNAL(valueChanged(bool)), this, SLOT(onOnionOpacitySliderChanged(bool))); ret = ret && connect(m_captureButton, SIGNAL(clicked(bool)), this, SLOT(onCaptureButtonClicked(bool))); // ret = ret && connect(subfolderButton, SIGNAL(clicked(bool)), this, // SLOT(openSaveInFolderPopup())); ret = ret && connect(m_saveInFileFld, SIGNAL(pathChanged()), this, SLOT(onSaveInPathEdited())); ret = ret && connect(m_fileTypeCombo, SIGNAL(activated(int)), this, SLOT(onFileTypeActivated())); ret = ret && connect(m_frameNumberEdit, SIGNAL(editingFinished()), this, SLOT(onFrameNumberChanged())); ret = ret && connect(m_xSheetFrameNumberEdit, SIGNAL(editingFinished()), this, SLOT(onXSheetFrameNumberChanged())); ret = ret && connect(m_toggleLiveViewButton, SIGNAL(clicked()), this, SLOT(onLiveViewToggleClicked())); ret = ret && connect(m_stopMotion, SIGNAL(filePathChanged(QString)), this, SLOT(onFilePathChanged(QString))); ret = ret && connect(m_stopMotion, SIGNAL(levelNameChanged(QString)), this, SLOT(onLevelNameChanged(QString))); ret = ret && connect(m_stopMotion, SIGNAL(fileTypeChanged(QString)), this, SLOT(onFileTypeChanged(QString))); ret = ret && connect(m_stopMotion, SIGNAL(frameInfoTextChanged(QString)), this, SLOT(onFrameInfoTextChanged(QString))); ret = ret && connect(m_stopMotion, SIGNAL(xSheetFrameNumberChanged(int)), this, SLOT(onXSheetFrameNumberChanged(int))); ret = ret && connect(m_stopMotion, SIGNAL(frameNumberChanged(int)), this, SLOT(onFrameNumberChanged(int))); ret = ret && connect(m_stopMotion, SIGNAL(opacityChanged(int)), this, SLOT(onOpacityChanged(int))); // Options Page ret = ret && connect(m_useScaledFullSizeImages, SIGNAL(stateChanged(int)), this, SLOT(onScaleFullSizeImagesChanged(int))); ret = ret && connect(m_liveViewOnAllFramesCB, SIGNAL(stateChanged(int)), this, SLOT(onLiveViewOnAllFramesChanged(int))); ret = ret && connect(m_blackScreenForCapture, SIGNAL(stateChanged(int)), this, SLOT(onBlackScreenForCaptureChanged(int))); ret = ret && connect(m_placeOnXSheetCB, SIGNAL(stateChanged(int)), this, SLOT(onPlaceOnXSheetChanged(int))); ret = ret && connect(m_directShowCB, SIGNAL(stateChanged(int)), this, SLOT(onUseDirectShowChanged(int))); ret = ret && connect(m_useMjpgCB, SIGNAL(stateChanged(int)), this, SLOT(onUseMjpgChanged(int))); ret = ret && connect(m_useNumpadCB, SIGNAL(stateChanged(int)), this, SLOT(onUseNumpadChanged(int))); ret = ret && connect(m_drawBeneathCB, SIGNAL(stateChanged(int)), this, SLOT(onDrawBeneathChanged(int))); ret = ret && connect(m_postCaptureReviewFld, SIGNAL(valueEditedByHand()), this, SLOT(onCaptureReviewFldEdited())); ret = ret && connect(m_postCaptureReviewFld, SIGNAL(valueChanged(bool)), this, SLOT(onCaptureReviewSliderChanged(bool))); ret = ret && connect(m_subsamplingFld, SIGNAL(valueEditedByHand()), this, SLOT(onSubsamplingFldEdited())); ret = ret && connect(m_subsamplingFld, SIGNAL(valueChanged(bool)), this, SLOT(onSubsamplingSliderChanged(bool))); ret = ret && connect(m_stopMotion, SIGNAL(subsamplingChanged(int)), this, SLOT(onSubsamplingChanged(int))); ret = ret && connect(m_stopMotion, SIGNAL(scaleFullSizeImagesSignal(bool)), this, SLOT(onScaleFullSizeImagesSignal(bool))); ret = ret && connect(m_stopMotion, SIGNAL(blackCaptureSignal(bool)), this, SLOT(onBlackCaptureSignal(bool))); ret = ret && connect(m_stopMotion, SIGNAL(liveViewOnAllFramesSignal(bool)), this, SLOT(onLiveViewOnAllFramesSignal(bool))); ret = ret && connect(m_stopMotion, SIGNAL(placeOnXSheetSignal(bool)), this, SLOT(onPlaceOnXSheetSignal(bool))); ret = ret && connect(m_stopMotion, SIGNAL(useDirectShowSignal(bool)), this, SLOT(onUseDirectShowSignal(bool))); ret = ret && connect(m_stopMotion, SIGNAL(useMjpgSignal(bool)), this, SLOT(onUseMjpgSignal(bool))); ret = ret && connect(m_stopMotion, SIGNAL(useNumpadSignal(bool)), this, SLOT(onUseNumpadSignal(bool))); ret = ret && connect(m_stopMotion, SIGNAL(drawBeneathLevelsSignal(bool)), this, SLOT(onDrawBeneathSignal(bool))); ret = ret && connect(m_stopMotion, SIGNAL(reviewTimeChangedSignal(int)), this, SLOT(onReviewTimeChangedSignal(int))); // From Stop Motion Main ret = ret && connect(m_stopMotion, SIGNAL(newDimensions()), this, SLOT(updateDimensions())); ret = ret && connect(m_stopMotion, SIGNAL(updateCameraList(QString)), this, SLOT(refreshCameraList(QString))); ret = ret && connect(m_stopMotion, SIGNAL(liveViewChanged(bool)), this, SLOT(onLiveViewChanged(bool))); ret = ret && connect(m_stopMotion, SIGNAL(newCameraSelected(int, bool)), this, SLOT(onNewCameraSelected(int, bool))); ret = ret && connect(m_stopMotion, SIGNAL(cameraChanged(QString)), this, SLOT(refreshCameraList(QString))); ret = ret && connect(m_stopMotion, SIGNAL(optionsChanged()), this, SLOT(refreshOptionsLists())); // EOS Connections ret = ret && connect(m_zoomButton, SIGNAL(pressed()), this, SLOT(onZoomPressed())); ret = ret && connect(m_pickZoomButton, SIGNAL(pressed()), this, SLOT(onPickZoomPressed())); ret = ret && connect(m_focusNearButton, SIGNAL(pressed()), this, SLOT(onFocusNear())); ret = ret && connect(m_focusFarButton, SIGNAL(pressed()), this, SLOT(onFocusFar())); ret = ret && connect(m_focusNear2Button, SIGNAL(pressed()), this, SLOT(onFocusNear2())); ret = ret && connect(m_focusFar2Button, SIGNAL(pressed()), this, SLOT(onFocusFar2())); ret = ret && connect(m_focusNear3Button, SIGNAL(pressed()), this, SLOT(onFocusNear3())); ret = ret && connect(m_focusFar3Button, SIGNAL(pressed()), this, SLOT(onFocusFar3())); ret = ret && connect(m_stopMotion, SIGNAL(apertureChangedSignal(QString)), this, SLOT(onApertureChangedSignal(QString))); ret = ret && connect(m_stopMotion, SIGNAL(isoChangedSignal(QString)), this, SLOT(onIsoChangedSignal(QString))); ret = ret && connect(m_stopMotion, SIGNAL(shutterSpeedChangedSignal(QString)), this, SLOT(onShutterSpeedChangedSignal(QString))); ret = ret && connect(m_stopMotion, SIGNAL(exposureChangedSignal(QString)), this, SLOT(onExposureChangedSignal(QString))); ret = ret && connect(m_stopMotion, SIGNAL(whiteBalanceChangedSignal(QString)), this, SLOT(onWhiteBalanceChangedSignal(QString))); ret = ret && connect(m_stopMotion, SIGNAL(imageQualityChangedSignal(QString)), this, SLOT(onImageQualityChangedSignal(QString))); ret = ret && connect(m_stopMotion, SIGNAL(pictureStyleChangedSignal(QString)), this, SLOT(onPictureStyleChangedSignal(QString))); ret = ret && connect(m_stopMotion, SIGNAL(colorTemperatureChangedSignal(QString)), this, SLOT(onColorTemperatureChangedSignal(QString))); // ret = ret && connect(m_apertureCombo, SIGNAL(currentIndexChanged(int)), // this, // SLOT(onApertureChanged(int))); ret = ret && connect(m_apertureSlider, SIGNAL(valueChanged(int)), this, SLOT(onApertureChanged(int))); ret = ret && connect(m_shutterSpeedSlider, SIGNAL(valueChanged(int)), this, SLOT(onShutterSpeedChanged(int))); ret = ret && connect(m_isoSlider, SIGNAL(valueChanged(int)), this, SLOT(onIsoChanged(int))); ret = ret && connect(m_exposureCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(onExposureChanged(int))); ret = ret && connect(m_whiteBalanceCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(onWhiteBalanceChanged(int))); ret = ret && connect(m_kelvinSlider, SIGNAL(valueChanged(int)), this, SLOT(onColorTemperatureChanged(int))); ret = ret && connect(m_imageQualityCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(onImageQualityChanged(int))); ret = ret && connect(m_pictureStyleCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(onPictureStyleChanged(int))); ret = ret && connect(m_stopMotion, SIGNAL(apertureOptionsChanged()), this, SLOT(refreshApertureList())); ret = ret && connect(m_stopMotion, SIGNAL(shutterSpeedOptionsChanged()), this, SLOT(refreshShutterSpeedList())); ret = ret && connect(m_stopMotion, SIGNAL(isoOptionsChanged()), this, SLOT(refreshIsoList())); ret = ret && connect(m_stopMotion, SIGNAL(exposureOptionsChanged()), this, SLOT(refreshExposureList())); ret = ret && connect(m_stopMotion, SIGNAL(whiteBalanceOptionsChanged()), this, SLOT(refreshWhiteBalanceList())); ret = ret && connect(m_stopMotion, SIGNAL(imageQualityOptionsChanged()), this, SLOT(refreshImageQualityList())); ret = ret && connect(m_stopMotion, SIGNAL(pictureStyleOptionsChanged()), this, SLOT(refreshPictureStyleList())); ret = ret && connect(m_stopMotion, SIGNAL(modeChanged()), this, SLOT(refreshMode())); ret = ret && connect(m_stopMotion, SIGNAL(focusCheckToggled(bool)), this, SLOT(onFocusCheckToggled(bool))); ret = ret && connect(m_stopMotion, SIGNAL(pickFocusCheckToggled(bool)), this, SLOT(onPickFocusCheckToggled(bool))); // Webcam Specific Connections ret = ret && connect(m_stopMotion, SIGNAL(webcamResolutionsChanged()), this, SLOT(onWebcamResolutionsChanged())); ret = ret && connect(m_stopMotion, SIGNAL(newWebcamResolutionSelected(int)), this, SLOT(onNewWebcamResolutionSelected(int))); // Serial Port Connections ret = ret && connect(m_controlDeviceCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(serialPortChanged(int))); // Time Lapse ret = ret && connect(m_timerCB, SIGNAL(toggled(bool)), this, SLOT(onTimerCBToggled(bool))); ret = ret && connect(m_captureTimer, SIGNAL(timeout()), this, SLOT(onCaptureTimerTimeout())); ret = ret && connect(m_countdownTimer, SIGNAL(timeout()), this, SLOT(onCountDown())); assert(ret); m_placeOnXSheetCB->setChecked( m_stopMotion->getPlaceOnXSheet() == true ? true : false); m_useScaledFullSizeImages->setChecked(m_stopMotion->m_useScaledImages); m_onionOpacityFld->setValue(double(100 * m_stopMotion->getOpacity()) / 255.0); m_directShowCB->setChecked(m_stopMotion->getUseDirectShow()); m_useMjpgCB->setChecked(m_stopMotion->getUseMjpg()); m_useNumpadCB->setChecked(m_stopMotion->getUseNumpadShortcuts()); m_drawBeneathCB->setChecked(m_stopMotion->m_drawBeneathLevels); m_liveViewOnAllFramesCB->setChecked(m_stopMotion->getAlwaysLiveView()); m_blackScreenForCapture->setChecked( m_stopMotion->getBlackCapture() == true ? true : false); m_postCaptureReviewFld->setValue(m_stopMotion->getReviewTime()); refreshCameraList(QString("")); onSceneSwitched(); m_stopMotion->setToNextNewLevel(); m_saveInFileFld->setPath(m_stopMotion->getFilePath()); } //----------------------------------------------------------------------------- StopMotionController::~StopMotionController() {} //----------------------------------------------------------------------------- void StopMotionController::setPage(int index) { if (m_stopMotion->m_usingWebcam && index > 0) index += 1; m_stackedChooser->setCurrentIndex(index); } //----------------------------------------------------------------------------- void StopMotionController::onScaleFullSizeImagesChanged(int checked) { m_stopMotion->setUseScaledImages(checked > 0 ? true : false); } //----------------------------------------------------------------------------- void StopMotionController::onScaleFullSizeImagesSignal(bool on) { m_useScaledFullSizeImages->setChecked(on); } //----------------------------------------------------------------------------- void StopMotionController::onLiveViewOnAllFramesChanged(int checked) { m_stopMotion->setAlwaysLiveView(checked > 0 ? true : false); } //----------------------------------------------------------------------------- void StopMotionController::onLiveViewOnAllFramesSignal(bool on) { m_liveViewOnAllFramesCB->setChecked(on); } //----------------------------------------------------------------------------- void StopMotionController::onBlackScreenForCaptureChanged(int checked) { m_stopMotion->setBlackCapture(checked); } //----------------------------------------------------------------------------- void StopMotionController::onBlackCaptureSignal(bool on) { m_blackScreenForCapture->setChecked(on); } //----------------------------------------------------------------------------- void StopMotionController::onPlaceOnXSheetChanged(int checked) { m_stopMotion->setPlaceOnXSheet(checked); } //----------------------------------------------------------------------------- void StopMotionController::onPlaceOnXSheetSignal(bool on) { m_placeOnXSheetCB->setChecked(on); } //----------------------------------------------------------------------------- void StopMotionController::onUseDirectShowChanged(int checked) { m_stopMotion->setUseDirectShow(checked); } //----------------------------------------------------------------------------- void StopMotionController::onUseDirectShowSignal(bool on) { m_directShowCB->setChecked(on); } //----------------------------------------------------------------------------- void StopMotionController::onUseMjpgChanged(int checked) { m_stopMotion->setUseMjpg(checked); } //----------------------------------------------------------------------------- void StopMotionController::onUseMjpgSignal(bool on) { m_useMjpgCB->setChecked(on); } //----------------------------------------------------------------------------- void StopMotionController::onUseNumpadChanged(int checked) { m_stopMotion->setUseNumpadShortcuts(checked); } //----------------------------------------------------------------------------- void StopMotionController::onUseNumpadSignal(bool on) { m_useNumpadCB->setChecked(on); } //----------------------------------------------------------------------------- void StopMotionController::onDrawBeneathChanged(int checked) { m_stopMotion->setDrawBeneathLevels(checked); } //----------------------------------------------------------------------------- void StopMotionController::onDrawBeneathSignal(bool on) { m_drawBeneathCB->setChecked(on); } //----------------------------------------------------------------------------- void StopMotionController::onCaptureReviewFldEdited() { m_stopMotion->setReviewTime(m_postCaptureReviewFld->getValue()); } //----------------------------------------------------------------------------- void StopMotionController::onCaptureReviewSliderChanged(bool ignore) { m_stopMotion->setReviewTime(m_postCaptureReviewFld->getValue()); } //----------------------------------------------------------------------------- void StopMotionController::onReviewTimeChangedSignal(int time) { m_postCaptureReviewFld->setValue(time); } //----------------------------------------------------------------------------- void StopMotionController::onSubsamplingChanged(int subsampling) { if (subsampling < 1) { m_subsamplingFld->setValue(1); m_subsamplingFld->setDisabled(true); } else { m_subsamplingFld->setValue(subsampling); m_subsamplingFld->setEnabled(true); } } //----------------------------------------------------------------------------- void StopMotionController::onFrameNumberChanged(int frameNumber) { m_frameNumberEdit->setValue(frameNumber); m_previousFrameButton->setDisabled(frameNumber == 1); } //----------------------------------------------------------------------------- void StopMotionController::onXSheetFrameNumberChanged(int frameNumber) { m_xSheetFrameNumberEdit->setValue(frameNumber); } //----------------------------------------------------------------------------- void StopMotionController::onFilePathChanged(QString filePath) { m_saveInFileFld->setPath(filePath); } //----------------------------------------------------------------------------- void StopMotionController::onLevelNameChanged(QString levelName) { m_levelNameEdit->setText(levelName); } //----------------------------------------------------------------------------- void StopMotionController::onFileTypeChanged(QString fileType) { m_fileTypeCombo->setCurrentText(fileType); } //----------------------------------------------------------------------------- void StopMotionController::onFrameInfoTextChanged(QString infoText) { m_frameInfoLabel->setText(infoText); m_frameInfoLabel->setStyleSheet(QString("QLabel{color: %1;}\ QLabel QWidget{ color: black;}") .arg(m_stopMotion->getInfoColorName())); m_frameInfoLabel->setToolTip(m_stopMotion->getFrameInfoToolTip()); } //----------------------------------------------------------------------------- void StopMotionController::onSubsamplingFldEdited() { m_stopMotion->setSubsamplingValue(m_subsamplingFld->getValue()); m_stopMotion->setSubsampling(); } //----------------------------------------------------------------------------- void StopMotionController::onSubsamplingSliderChanged(bool ignore) { m_stopMotion->setSubsamplingValue(m_subsamplingFld->getValue()); m_stopMotion->setSubsampling(); } //----------------------------------------------------------------------------- void StopMotionController::refreshCameraListCalled() { m_stopMotion->refreshCameraList(); } //----------------------------------------------------------------------------- void StopMotionController::refreshCameraList(QString activeCamera) { m_cameraListCombo->blockSignals(true); m_cameraListCombo->clear(); m_cameraStatusLabel->hide(); QList webcams = m_stopMotion->getWebcams(); int count = webcams.count(); #ifdef WITH_CANON count += m_stopMotion->getCameraCount(); #endif if (count < 1) { m_cameraListCombo->addItem(tr("No camera detected.")); m_cameraSettingsLabel->setText(tr("No camera detected")); m_cameraModeLabel->setText(""); m_cameraListCombo->setDisabled(true); m_captureButton->setDisabled(true); m_toggleLiveViewButton->setDisabled(true); m_toggleLiveViewButton->setText(tr("Start Live View")); } else { int maxTextLength = 0; m_cameraListCombo->addItem(tr("- Select camera -")); if (webcams.count() > 0) { for (int c = 0; c < webcams.size(); c++) { std::string name = webcams.at(c).deviceName().toStdString(); QString camDesc = webcams.at(c).description(); m_cameraListCombo->addItem(camDesc); maxTextLength = std::max(maxTextLength, fontMetrics().width(camDesc)); } } #ifdef WITH_CANON if (m_stopMotion->getCameraCount() > 0) { QString name; m_stopMotion->getCamera(0); bool open = m_stopMotion->m_sessionOpen; if (!open) m_stopMotion->openCameraSession(); name = QString::fromStdString(m_stopMotion->getCameraName()); if (!open) m_stopMotion->closeCameraSession(); m_cameraSettingsLabel->setText(name); m_cameraListCombo->addItem(name); maxTextLength = std::max(maxTextLength, fontMetrics().width(name)); } #endif m_cameraListCombo->setMaximumWidth(maxTextLength + 25); m_cameraListCombo->setEnabled(true); m_cameraListCombo->setCurrentIndex(0); m_captureButton->setEnabled(true); m_toggleLiveViewButton->setEnabled(true); } if (activeCamera != "") m_cameraListCombo->setCurrentText(activeCamera); m_cameraListCombo->blockSignals(false); m_stopMotion->updateLevelNameAndFrame(m_levelNameEdit->text().toStdWString()); refreshOptionsLists(); #ifdef WITH_CANON refreshMode(); #endif } //----------------------------------------------------------------------------- void StopMotionController::refreshOptionsLists() { m_apertureSlider->blockSignals(true); m_isoSlider->blockSignals(true); m_shutterSpeedSlider->blockSignals(true); m_exposureCombo->blockSignals(true); m_whiteBalanceCombo->blockSignals(true); m_kelvinSlider->blockSignals(true); m_imageQualityCombo->blockSignals(true); m_pictureStyleCombo->blockSignals(true); // m_isoCombo->clear(); // m_shutterSpeedCombo->clear(); // m_apertureSlider->clear(); m_exposureCombo->clear(); #ifdef WITH_CANON if (m_stopMotion->getCameraCount() == 0) { m_shutterSpeedSlider->setDisabled(true); m_isoSlider->setDisabled(true); m_apertureSlider->setDisabled(true); m_exposureCombo->setDisabled(true); m_whiteBalanceCombo->setDisabled(true); m_kelvinSlider->setDisabled(true); m_imageQualityCombo->setDisabled(true); m_pictureStyleCombo->setDisabled(true); return; } refreshApertureList(); refreshShutterSpeedList(); refreshIsoList(); refreshExposureList(); refreshWhiteBalanceList(); refreshImageQualityList(); refreshPictureStyleList(); #endif } //----------------------------------------------------------------------------- void StopMotionController::refreshMode() { #ifdef WITH_CANON if (m_stopMotion->getCameraCount() == 0) { m_cameraModeLabel->setText(""); m_cameraStatusLabel->hide(); return; } QString mode = m_stopMotion->getMode(); QString battery = m_stopMotion->getCurrentBatteryLevel(); m_cameraModeLabel->setText(tr("Mode: ") + mode); m_cameraStatusLabel->setText("Mode: " + mode + " - Battery: " + battery); #endif } //----------------------------------------------------------------------------- void StopMotionController::refreshApertureList() { #ifdef WITH_CANON m_apertureSlider->blockSignals(true); int count = 0; m_stopMotion->getAvailableApertures(); count = m_stopMotion->getApertureOptions().size(); if (count == 0) { m_apertureLabel->setText(tr("Aperture: Auto")); m_apertureSlider->setDisabled(true); m_apertureSlider->setRange(0, 0); } else { m_apertureSlider->setEnabled(true); m_apertureLabel->setText(tr("Aperture: ") + m_stopMotion->getCurrentAperture()); m_apertureSlider->setRange(0, count - 1); m_apertureSlider->setValue(m_stopMotion->getApertureOptions().lastIndexOf( m_stopMotion->getCurrentAperture())); } m_apertureSlider->blockSignals(false); #endif } //----------------------------------------------------------------------------- void StopMotionController::refreshShutterSpeedList() { #ifdef WITH_CANON m_shutterSpeedSlider->blockSignals(true); int count = 0; m_stopMotion->getAvailableShutterSpeeds(); count = m_stopMotion->getShutterSpeedOptions().size(); if (count == 0) { m_shutterSpeedLabel->setText(tr("Shutter Speed: Auto")); m_shutterSpeedSlider->setDisabled(true); m_shutterSpeedSlider->setRange(0, 0); } else { m_shutterSpeedSlider->setEnabled(true); m_shutterSpeedLabel->setText(tr("Shutter Speed: ") + m_stopMotion->getCurrentShutterSpeed()); m_shutterSpeedSlider->setRange(0, count - 1); m_shutterSpeedSlider->setValue( m_stopMotion->getShutterSpeedOptions().lastIndexOf( m_stopMotion->getCurrentShutterSpeed())); } m_shutterSpeedSlider->blockSignals(false); #endif } //----------------------------------------------------------------------------- void StopMotionController::refreshIsoList() { #ifdef WITH_CANON m_isoSlider->blockSignals(true); int count = 0; m_stopMotion->getAvailableIso(); count = m_stopMotion->getIsoOptions().size(); if (count == 0) { m_isoLabel->setText(tr("Iso: ") + tr("Auto")); m_isoSlider->setDisabled(true); m_isoSlider->setRange(0, 0); } else { m_isoSlider->setEnabled(true); m_isoLabel->setText(tr("Iso: ") + m_stopMotion->getCurrentIso()); m_isoSlider->setRange(0, count - 1); m_isoSlider->setValue(m_stopMotion->getIsoOptions().lastIndexOf( m_stopMotion->getCurrentIso())); } m_isoSlider->blockSignals(false); #endif } //----------------------------------------------------------------------------- void StopMotionController::refreshExposureList() { #ifdef WITH_CANON m_exposureCombo->blockSignals(true); m_exposureCombo->clear(); m_stopMotion->getAvailableExposureCompensations(); m_exposureCombo->addItems(m_stopMotion->getExposureOptions()); if (m_exposureCombo->count() == 0) { m_exposureCombo->addItem(tr("Disabled")); m_exposureCombo->setDisabled(true); } else { m_exposureCombo->setEnabled(true); m_exposureCombo->setCurrentText( m_stopMotion->getCurrentExposureCompensation()); } m_exposureCombo->blockSignals(false); #endif } //----------------------------------------------------------------------------- void StopMotionController::refreshWhiteBalanceList() { #ifdef WITH_CANON m_whiteBalanceCombo->blockSignals(true); m_whiteBalanceCombo->clear(); m_stopMotion->getAvailableWhiteBalances(); m_whiteBalanceCombo->addItems(m_stopMotion->getWhiteBalanceOptions()); if (m_whiteBalanceCombo->count() == 0) { m_whiteBalanceCombo->addItem(tr("Disabled")); m_whiteBalanceCombo->setDisabled(true); } else { m_whiteBalanceCombo->setEnabled(true); m_whiteBalanceCombo->setCurrentText(m_stopMotion->getCurrentWhiteBalance()); } m_whiteBalanceCombo->blockSignals(false); refreshColorTemperatureList(); #endif } //----------------------------------------------------------------------------- void StopMotionController::refreshColorTemperatureList() { #ifdef WITH_CANON m_kelvinSlider->blockSignals(true); int count = 0; count = m_stopMotion->getColorTemperatureOptions().size(); if (count == 0 || m_stopMotion->getCurrentWhiteBalance() != "Color Temperature") { // m_kelvinCombo->addItem(tr("Disabled")); m_kelvinSlider->setDisabled(true); m_kelvinSlider->hide(); m_kelvinValueLabel->hide(); } else { m_kelvinSlider->show(); m_kelvinValueLabel->show(); m_kelvinSlider->setEnabled(true); m_kelvinSlider->setRange(0, count - 1); m_kelvinValueLabel->setText(tr("Temperature: ") + m_stopMotion->getCurrentColorTemperature()); } m_kelvinSlider->blockSignals(false); #endif } //----------------------------------------------------------------------------- void StopMotionController::refreshImageQualityList() { #ifdef WITH_CANON m_imageQualityCombo->blockSignals(true); m_imageQualityCombo->clear(); m_stopMotion->getAvailableImageQualities(); m_imageQualityCombo->addItems(m_stopMotion->getImageQualityOptions()); if (m_imageQualityCombo->count() == 0) { m_imageQualityCombo->addItem(tr("Disabled")); m_imageQualityCombo->setDisabled(true); } else { m_imageQualityCombo->setEnabled(true); m_imageQualityCombo->setCurrentText(m_stopMotion->getCurrentImageQuality()); } m_imageQualityCombo->blockSignals(false); #endif } //----------------------------------------------------------------------------- void StopMotionController::refreshPictureStyleList() { #ifdef WITH_CANON m_pictureStyleCombo->blockSignals(true); m_pictureStyleCombo->clear(); m_stopMotion->getAvailablePictureStyles(); m_pictureStyleCombo->addItems(m_stopMotion->getPictureStyleOptions()); if (m_pictureStyleCombo->count() == 0) { m_pictureStyleCombo->addItem(tr("Disabled")); m_pictureStyleCombo->setDisabled(true); } else { m_pictureStyleCombo->setEnabled(true); m_pictureStyleCombo->setCurrentText(m_stopMotion->getCurrentPictureStyle()); } m_pictureStyleCombo->blockSignals(false); #endif } //----------------------------------------------------------------------------- void StopMotionController::onCameraListComboActivated(int comboIndex) { QList cameras = QCameraInfo::availableCameras(); int cameraCount = cameras.size(); #ifdef WITH_CANON cameraCount += m_stopMotion->getCameraCount(); #endif if (cameraCount != m_cameraListCombo->count() - 1) return; m_stopMotion->changeCameras(comboIndex); } //----------------------------------------------------------------------------- void StopMotionController::onNewCameraSelected(int index, bool useWebcam) { if (index < m_cameraListCombo->count()) m_cameraListCombo->setCurrentIndex(index); if (index == 0) { m_cameraListCombo->setCurrentIndex(index); m_resolutionCombo->hide(); m_resolutionLabel->hide(); m_cameraStatusLabel->hide(); m_pickZoomButton->setStyleSheet("border:1px solid rgb(0, 0, 0, 0);"); m_zoomButton->setStyleSheet("border:1px solid rgb(0, 0, 0, 0);"); } else if (useWebcam) { if (m_tabBar->tabText(1) == tr("Settings")) { m_tabBar->removeTab(1); } m_resolutionCombo->show(); m_resolutionCombo->setEnabled(true); m_resolutionLabel->show(); if (m_captureFilterSettingsBtn) m_captureFilterSettingsBtn->show(); m_cameraStatusLabel->hide(); } else { m_resolutionCombo->hide(); m_resolutionLabel->hide(); if (m_captureFilterSettingsBtn) m_captureFilterSettingsBtn->hide(); m_cameraStatusLabel->show(); if (m_tabBar->tabText(1) == tr("Options")) { m_tabBar->insertTab(1, tr("Settings")); } } } //----------------------------------------------------------------------------- void StopMotionController::onWebcamResolutionsChanged() { m_resolutionCombo->clear(); QList resolutions = m_stopMotion->getWebcamResolutions(); for (int s = 0; s < resolutions.size(); s++) { m_resolutionCombo->addItem(QString("%1 x %2") .arg(resolutions.at(s).width()) .arg(resolutions.at(s).height())); } } //----------------------------------------------------------------------------- void StopMotionController::onNewWebcamResolutionSelected(int index) { m_resolutionCombo->setCurrentIndex(index); } //----------------------------------------------------------------------------- void StopMotionController::onResolutionComboActivated(const QString &itemText) { m_stopMotion->setWebcamResolution(itemText); } //----------------------------------------------------------------------------- void StopMotionController::onCaptureFilterSettingsBtnPressed() { if (!m_stopMotion->getWebcam() || m_stopMotion->m_webcamDeviceName.isNull()) return; QList cameras = QCameraInfo::availableCameras(); for (int c = 0; c < cameras.size(); c++) { if (cameras.at(c).deviceName() == m_stopMotion->m_webcamDeviceName) { #ifdef _WIN32 openCaptureFilterSettings(this, cameras.at(c).description()); #endif return; } } } //----------------------------------------------------------------------------- void StopMotionController::onFileFormatOptionButtonPressed() { if (m_fileTypeCombo->currentIndex() == 0) return; // Tentatively use the preview output settings ToonzScene *scene = TApp::instance()->getCurrentScene()->getScene(); if (!scene) return; TOutputProperties *prop = scene->getProperties()->getPreviewProperties(); std::string ext = m_fileTypeCombo->currentText().toStdString(); openFormatSettingsPopup(this, ext, prop->getFileFormatProperties(ext)); } //----------------------------------------------------------------------------- void StopMotionController::onLevelNameEdited() { m_stopMotion->updateLevelNameAndFrame(m_levelNameEdit->text().toStdWString()); } //----------------------------------------------------------------------------- void StopMotionController::onNextName() { m_stopMotion->nextName(); } //----------------------------------------------------------------------------- void StopMotionController::onNextNewLevel() { m_stopMotion->setToNextNewLevel(); } //----------------------------------------------------------------------------- void StopMotionController::onPreviousName() { m_stopMotion->previousName(); } //----------------------------------------------------------------------------- void StopMotionController::onNextFrame() { m_stopMotion->nextFrame(); } //----------------------------------------------------------------------------- void StopMotionController::onLastFrame() {} //----------------------------------------------------------------------------- void StopMotionController::onPreviousFrame() { m_stopMotion->previousFrame(); } //----------------------------------------------------------------------------- void StopMotionController::onNextXSheetFrame() { m_stopMotion->setXSheetFrameNumber(m_stopMotion->getXSheetFrameNumber() + 1); } //----------------------------------------------------------------------------- void StopMotionController::onPreviousXSheetFrame() { m_stopMotion->setXSheetFrameNumber(m_stopMotion->getXSheetFrameNumber() - 1); } //----------------------------------------------------------------------------- void StopMotionController::setToCurrentXSheetFrame() { int frameNumber = TApp::instance()->getCurrentFrame()->getFrame() + 1; m_stopMotion->setXSheetFrameNumber(frameNumber); } //----------------------------------------------------------------------------- void StopMotionController::updateDimensions() { m_stopMotion->refreshFrameInfo(); } //----------------------------------------------------------------------------- void StopMotionController::onFrameCaptured(QImage &image) {} //----------------------------------------------------------------------------- void StopMotionController::onApertureChanged(int index) { #ifdef WITH_CANON m_apertureSlider->blockSignals(true); QStringList apertureOptions = m_stopMotion->getApertureOptions(); m_stopMotion->setAperture(apertureOptions.at(m_apertureSlider->value())); m_apertureSlider->setRange(0, apertureOptions.size() - 1); m_apertureSlider->setValue( apertureOptions.lastIndexOf(m_stopMotion->getCurrentAperture())); m_apertureLabel->setText(tr("Aperture: ") + m_stopMotion->getCurrentAperture()); m_apertureSlider->blockSignals(false); #endif } //----------------------------------------------------------------------------- void StopMotionController::onApertureChangedSignal(QString text) { #ifdef WITH_CANON m_apertureSlider->blockSignals(true); QStringList apertureOptions = m_stopMotion->getApertureOptions(); m_apertureLabel->setText(tr("Aperture: ") + m_stopMotion->getCurrentAperture()); m_apertureSlider->setRange(0, apertureOptions.size() - 1); m_apertureSlider->setValue( apertureOptions.lastIndexOf(m_stopMotion->getCurrentAperture())); m_apertureSlider->blockSignals(false); #endif } //----------------------------------------------------------------------------- void StopMotionController::onShutterSpeedChanged(int index) { #ifdef WITH_CANON m_shutterSpeedSlider->blockSignals(true); QStringList shutterSpeedOptions = m_stopMotion->getShutterSpeedOptions(); m_stopMotion->setShutterSpeed( shutterSpeedOptions.at(m_shutterSpeedSlider->value())); m_shutterSpeedSlider->setRange(0, shutterSpeedOptions.size() - 1); m_shutterSpeedSlider->setValue( shutterSpeedOptions.lastIndexOf(m_stopMotion->getCurrentShutterSpeed())); m_shutterSpeedLabel->setText(tr("Shutter Speed: ") + m_stopMotion->getCurrentShutterSpeed()); m_shutterSpeedSlider->blockSignals(false); #endif } //----------------------------------------------------------------------------- void StopMotionController::onShutterSpeedChangedSignal(QString text) { #ifdef WITH_CANON m_shutterSpeedSlider->blockSignals(true); QStringList shutterSpeedOptions = m_stopMotion->getShutterSpeedOptions(); m_shutterSpeedLabel->setText(tr("Shutter Speed: ") + m_stopMotion->getCurrentShutterSpeed()); m_shutterSpeedSlider->setRange(0, shutterSpeedOptions.size() - 1); m_shutterSpeedSlider->setValue( shutterSpeedOptions.lastIndexOf(m_stopMotion->getCurrentShutterSpeed())); m_shutterSpeedSlider->blockSignals(false); #endif } //----------------------------------------------------------------------------- void StopMotionController::onIsoChanged(int index) { #ifdef WITH_CANON m_isoSlider->blockSignals(true); QStringList isoOptions = m_stopMotion->getIsoOptions(); m_stopMotion->setIso(isoOptions.at(m_isoSlider->value())); m_isoSlider->setRange(0, isoOptions.size() - 1); m_isoSlider->setValue(isoOptions.lastIndexOf(m_stopMotion->getCurrentIso())); m_isoLabel->setText(tr("Iso: ") + m_stopMotion->getCurrentIso()); m_isoSlider->blockSignals(false); #endif } //----------------------------------------------------------------------------- void StopMotionController::onIsoChangedSignal(QString text) { #ifdef WITH_CANON m_isoSlider->blockSignals(true); QStringList isoOptions = m_stopMotion->getIsoOptions(); m_isoSlider->setRange(0, isoOptions.size() - 1); m_isoSlider->setValue(isoOptions.lastIndexOf(m_stopMotion->getCurrentIso())); m_isoLabel->setText(tr("Iso: ") + m_stopMotion->getCurrentIso()); m_isoSlider->blockSignals(false); #endif } //----------------------------------------------------------------------------- void StopMotionController::onExposureChanged(int index) { #ifdef WITH_CANON m_exposureCombo->blockSignals(true); m_stopMotion->setExposureCompensation(m_exposureCombo->currentText()); m_exposureCombo->blockSignals(false); #endif } //----------------------------------------------------------------------------- void StopMotionController::onExposureChangedSignal(QString text) { #ifdef WITH_CANON m_exposureCombo->blockSignals(true); m_exposureCombo->setCurrentText( m_stopMotion->getCurrentExposureCompensation()); m_exposureCombo->blockSignals(false); #endif } //----------------------------------------------------------------------------- void StopMotionController::onWhiteBalanceChanged(int index) { #ifdef WITH_CANON m_whiteBalanceCombo->blockSignals(true); m_stopMotion->setWhiteBalance(m_whiteBalanceCombo->currentText()); m_whiteBalanceCombo->blockSignals(false); #endif } //----------------------------------------------------------------------------- void StopMotionController::onWhiteBalanceChangedSignal(QString text) { #ifdef WITH_CANON m_whiteBalanceCombo->blockSignals(true); m_whiteBalanceCombo->setCurrentText(m_stopMotion->getCurrentWhiteBalance()); refreshColorTemperatureList(); m_whiteBalanceCombo->blockSignals(false); #endif } //----------------------------------------------------------------------------- void StopMotionController::onColorTemperatureChanged(int index) { #ifdef WITH_CANON m_kelvinSlider->blockSignals(true); QStringList kelvinOptions = m_stopMotion->getColorTemperatureOptions(); m_stopMotion->setColorTemperature(kelvinOptions.at(m_kelvinSlider->value())); m_kelvinSlider->setRange(0, kelvinOptions.size() - 1); m_kelvinSlider->setValue( kelvinOptions.lastIndexOf(m_stopMotion->getCurrentColorTemperature())); m_kelvinValueLabel->setText(tr("Temperature: ") + m_stopMotion->getCurrentColorTemperature()); m_kelvinSlider->blockSignals(false); #endif } //----------------------------------------------------------------------------- void StopMotionController::onColorTemperatureChangedSignal(QString text) { #ifdef WITH_CANON m_kelvinSlider->blockSignals(true); QStringList kelvinOptions = m_stopMotion->getColorTemperatureOptions(); m_kelvinSlider->setRange(0, kelvinOptions.size() - 1); m_kelvinSlider->setValue( kelvinOptions.lastIndexOf(m_stopMotion->getCurrentColorTemperature())); m_kelvinValueLabel->setText(tr("Temperature: ") + m_stopMotion->getCurrentColorTemperature()); m_kelvinSlider->blockSignals(false); #endif } //----------------------------------------------------------------------------- void StopMotionController::onImageQualityChanged(int index) { #ifdef WITH_CANON m_imageQualityCombo->blockSignals(true); m_stopMotion->setImageQuality(m_imageQualityCombo->currentText()); m_imageQualityCombo->blockSignals(false); #endif } //----------------------------------------------------------------------------- void StopMotionController::onImageQualityChangedSignal(QString text) { #ifdef WITH_CANON m_imageQualityCombo->blockSignals(true); m_imageQualityCombo->setCurrentText(m_stopMotion->getCurrentImageQuality()); m_imageQualityCombo->blockSignals(false); #endif } //----------------------------------------------------------------------------- void StopMotionController::onPictureStyleChanged(int index) { #ifdef WITH_CANON m_pictureStyleCombo->blockSignals(true); m_stopMotion->setPictureStyle(m_pictureStyleCombo->currentText()); m_pictureStyleCombo->blockSignals(false); #endif } //----------------------------------------------------------------------------- void StopMotionController::onPictureStyleChangedSignal(QString text) { #ifdef WITH_CANON m_pictureStyleCombo->blockSignals(true); m_pictureStyleCombo->setCurrentText(m_stopMotion->getCurrentPictureStyle()); m_pictureStyleCombo->blockSignals(false); #endif } //----------------------------------------------------------------------------- void StopMotionController::onFocusCheckToggled(bool on) { #ifdef WITH_CANON if (on) m_zoomButton->setStyleSheet("border:1px solid rgb(0, 255, 0, 255);"); else m_zoomButton->setStyleSheet("border:1px solid rgb(0, 0, 0, 0);"); #endif } //----------------------------------------------------------------------------- void StopMotionController::onPickFocusCheckToggled(bool on) { #ifdef WITH_CANON if (on) m_pickZoomButton->setStyleSheet("border:1px solid rgb(0, 255, 0, 255);"); else m_pickZoomButton->setStyleSheet("border:1px solid rgb(0, 0, 0, 0);"); #endif } //----------------------------------------------------------------------------- void StopMotionController::onZoomPressed() { #ifdef WITH_CANON m_stopMotion->zoomLiveView(); #endif } //----------------------------------------------------------------------------- void StopMotionController::onPickZoomPressed() { #ifdef WITH_CANON m_stopMotion->toggleZoomPicking(); #endif } //----------------------------------------------------------------------------- void StopMotionController::onFocusNear() { #ifdef WITH_CANON m_stopMotion->focusNear(); #endif } //----------------------------------------------------------------------------- void StopMotionController::onFocusFar() { #ifdef WITH_CANON m_stopMotion->focusFar(); #endif } //----------------------------------------------------------------------------- void StopMotionController::onFocusNear2() { #ifdef WITH_CANON m_stopMotion->focusNear2(); #endif } //----------------------------------------------------------------------------- void StopMotionController::onFocusFar2() { #ifdef WITH_CANON m_stopMotion->focusFar2(); #endif } //----------------------------------------------------------------------------- void StopMotionController::onFocusNear3() { #ifdef WITH_CANON m_stopMotion->focusNear3(); #endif } //----------------------------------------------------------------------------- void StopMotionController::onFocusFar3() { #ifdef WITH_CANON m_stopMotion->focusFar3(); #endif } //----------------------------------------------------------------------------- void StopMotionController::showEvent(QShowEvent *event) { #ifdef WITH_CANON m_stopMotion->initializeCanonSDK(); #endif } //----------------------------------------------------------------------------- void StopMotionController::hideEvent(QHideEvent *event) { // stop interval timer if it is active if (m_timerCB->isChecked() && m_captureButton->isChecked()) { m_captureButton->setChecked(false); onCaptureButtonClicked(false); } } //----------------------------------------------------------------------------- void StopMotionController::keyPressEvent(QKeyEvent *event) { int key = event->key(); TFrameHandle *fh = TApp::instance()->getCurrentFrame(); int origFrame = fh->getFrame(); #ifdef WITH_CANON if ((m_stopMotion->m_pickLiveViewZoom || m_stopMotion->m_zooming) && (key == Qt::Key_Left || key == Qt::Key_Right || key == Qt::Key_Up || key == Qt::Key_Down || key == Qt::Key_2 || key == Qt::Key_4 || key == Qt::Key_6 || key == Qt::Key_8)) { if (m_stopMotion->m_liveViewZoomReadyToPick == true) { if (key == Qt::Key_Left || key == Qt::Key_4) { m_stopMotion->m_liveViewZoomPickPoint.x -= 10; } if (key == Qt::Key_Right || key == Qt::Key_6) { m_stopMotion->m_liveViewZoomPickPoint.x += 10; } if (key == Qt::Key_Up || key == Qt::Key_8) { m_stopMotion->m_liveViewZoomPickPoint.y += 10; } if (key == Qt::Key_Down || key == Qt::Key_2) { m_stopMotion->m_liveViewZoomPickPoint.y -= 10; } if (m_stopMotion->m_zooming) { m_stopMotion->setZoomPoint(); } } m_stopMotion->calculateZoomPoint(); event->accept(); } else if (m_stopMotion->m_pickLiveViewZoom && (key == Qt::Key_Escape || key == Qt::Key_Enter || key == Qt::Key_Return)) { m_stopMotion->toggleZoomPicking(); } else #endif if (key == Qt::Key_Up || key == Qt::Key_Left) { fh->prevFrame(); event->accept(); } else if (key == Qt::Key_Down || key == Qt::Key_Right) { fh->nextFrame(); event->accept(); } else if (key == Qt::Key_Home) { fh->firstFrame(); event->accept(); } else if (key == Qt::Key_End) { fh->lastFrame(); event->accept(); } else if (key == Qt::Key_Return || key == Qt::Key_Enter) { m_captureButton->animateClick(); event->accept(); } else event->ignore(); } // ////----------------------------------------------------------------------------- // // void StopMotionController::mousePressEvent(QMouseEvent *event) {} //----------------------------------------------------------------------------- void StopMotionController::onLiveViewToggleClicked() { m_stopMotion->toggleLiveView(); } //----------------------------------------------------------------------------- void StopMotionController::onLiveViewChanged(bool on) { if (on) { m_toggleLiveViewButton->setText(tr("Stop Live View")); } else m_toggleLiveViewButton->setText(tr("Start Live View")); } //----------------------------------------------------------------------------- void StopMotionController::onOnionOpacityFldEdited() { int value = (int)(255.0f * (float)m_onionOpacityFld->getValue() / 100.0f); m_stopMotion->setOpacity(value); } //----------------------------------------------------------------------------- void StopMotionController::onOnionOpacitySliderChanged(bool ignore) { int value = (int)(255.0f * (float)m_onionOpacityFld->getValue() / 100.0f); m_stopMotion->setOpacity(value); } //----------------------------------------------------------------------------- void StopMotionController::onOpacityChanged(int opacity) { m_onionOpacityFld->setValue(double(100 * opacity) / 255.0); } //----------------------------------------------------------------------------- void StopMotionController::onCaptureButtonClicked(bool on) { if (m_timerCB->isChecked()) { m_timerCB->setDisabled(on); m_timerIntervalFld->setDisabled(on); // start interval capturing if (on) { if (m_stopMotion->m_liveViewStatus > 1) { m_captureButton->setText(tr("Stop Capturing")); m_captureTimer->start(m_timerIntervalFld->getValue() * 1000); if (m_timerIntervalFld->getValue() != 0) m_countdownTimer->start(100); } } // stop interval capturing else { m_captureButton->setText(tr("Start Capturing")); m_captureTimer->stop(); m_countdownTimer->stop(); // hide the count down text // m_videoWidget->showCountDownTime(0); } } // capture immediately else { m_stopMotion->captureImage(); } } //----------------------------------------------------------------------------- void StopMotionController::onTimerCBToggled(bool on) { m_timerIntervalFld->setEnabled(on); m_captureButton->setCheckable(on); m_stopMotion->m_isTimeLapse = on; if (on) m_captureButton->setText(tr("Start Capturing")); else m_captureButton->setText(tr("Capture")); } //----------------------------------------------------------------------------- void StopMotionController::onCaptureTimerTimeout() { if (m_stopMotion->m_liveViewStatus > 0) { m_stopMotion->captureImage(); // restart interval timer for capturing next frame (it is single shot) if (m_timerCB->isChecked() && m_captureButton->isChecked()) { m_captureTimer->start(m_timerIntervalFld->getValue() * 1000); // restart the count down as well (for aligning the timing. It is not // single shot) if (m_timerIntervalFld->getValue() != 0) m_countdownTimer->start(100); } } else onCaptureButtonClicked(false); } //----------------------------------------------------------------------------- void StopMotionController::onCountDown() { m_captureButton->setText(QString::number( m_captureTimer->isActive() ? (m_captureTimer->remainingTime() / 1000 + 1) : 0)); } //----------------------------------------------------------------------------- void StopMotionController::openSaveInFolderPopup() { if (m_saveInFolderPopup->exec()) { QString oldPath = m_saveInFileFld->getPath(); m_saveInFileFld->setPath(m_saveInFolderPopup->getPath()); if (oldPath == m_saveInFileFld->getPath()) m_stopMotion->setToNextNewLevel(); else { onSaveInPathEdited(); } } } //----------------------------------------------------------------------------- void StopMotionController::onFileTypeActivated() { m_stopMotion->setFileType(m_fileTypeCombo->currentText()); } //----------------------------------------------------------------------------- void StopMotionController::onFrameNumberChanged() { m_stopMotion->setFrameNumber(m_frameNumberEdit->getValue()); } //----------------------------------------------------------------------------- void StopMotionController::onXSheetFrameNumberChanged() { m_stopMotion->setXSheetFrameNumber(m_xSheetFrameNumberEdit->getValue()); } //----------------------------------------------------------------------------- void StopMotionController::onSaveInPathEdited() { m_stopMotion->setFilePath(m_saveInFileFld->getPath()); } //----------------------------------------------------------------------------- void StopMotionController::onSceneSwitched() { // m_saveInFolderPopup->updateParentFolder(); // m_saveInFileFld->setPath(m_saveInFolderPopup->getParentPath()); // m_stopMotion->refreshFrameInfo(); } //----------------------------------------------------------------------------- void StopMotionController::serialPortChanged(int index) { m_stopMotion->setSerialPort(m_controlDeviceCombo->currentText()); } //----------------------------------------------------------------------------- void StopMotionController::updateStopMotion() {}