Jeremy Bullock f15907
#pragma once
Jeremy Bullock f15907
Jeremy Bullock f15907
#ifndef STOPMOTIONCONTROLLER_H
Jeremy Bullock f15907
#define STOPMOTIONCONTROLLER_H
Jeremy Bullock f15907
Jeremy Bullock f15907
// TnzCore includes
Jeremy Bullock f15907
#include "stopmotion.h"
Jeremy Bullock f15907
#include "penciltestpopup.h"
Jeremy Bullock f15907
Jeremy Bullock f15907
// TnzQt includes
Jeremy Bullock f15907
#include "toonzqt/tabbar.h"
Jeremy Bullock f15907
#include "toonzqt/gutil.h"
shun-iwasawa 31accf
#include "toonzqt/colorfield.h"
Jeremy Bullock f15907
Jeremy Bullock f15907
// Qt includes
Jeremy Bullock f15907
#include <qwidget></qwidget>
Jeremy Bullock f15907
#include <qframe></qframe>
Jeremy Bullock f15907
#include <qtabbar></qtabbar>
Jeremy Bullock f15907
#include <qslider></qslider>
Jeremy Bullock f15907
#include <qscrollarea></qscrollarea>
Jeremy Bullock f15907
#include <qpointf></qpointf>
Jeremy Bullock f15907
Jeremy Bullock f15907
#undef DVAPI
Jeremy Bullock f15907
#undef DVVAR
Jeremy Bullock f15907
#ifdef TOONZQT_EXPORTS
Jeremy Bullock f15907
#define DVAPI DV_EXPORT_API
Jeremy Bullock f15907
#define DVVAR DV_EXPORT_VAR
Jeremy Bullock f15907
#else
Jeremy Bullock f15907
#define DVAPI DV_IMPORT_API
Jeremy Bullock f15907
#define DVVAR DV_IMPORT_VAR
Jeremy Bullock f15907
#endif
Jeremy Bullock f15907
Jeremy Bullock f15907
//=============================================
Jeremy Bullock f15907
Jeremy Bullock f15907
//    Forward declarations
Jeremy Bullock f15907
Jeremy Bullock f15907
class TColorStyle;
Jeremy Bullock f15907
class TPalette;
Jeremy Bullock f15907
Jeremy Bullock f15907
class TXshLevelHandle;
Jeremy Bullock f15907
Jeremy Bullock f15907
class QGridLayout;
Jeremy Bullock f15907
class QLabel;
Jeremy Bullock f15907
class QStackedWidget;
Jeremy Bullock f15907
class QSlider;
Jeremy Bullock f15907
class QRadioButton;
Jeremy Bullock f15907
class QButtonGroup;
Jeremy Bullock f15907
class QPushButton;
Jeremy Bullock f15907
class QTabWidget;
Jeremy Bullock f15907
class QToolBar;
Jeremy Bullock f15907
class QTimer;
shun-iwasawa 31accf
class QGroupBox;
Jeremy Bullock f15907
Jeremy Bullock f15907
//=============================================================================
Jeremy Bullock f15907
// StopMotionController
Jeremy Bullock f15907
//-----------------------------------------------------------------------------
Jeremy Bullock f15907
Jeremy Bullock f15907
class StopMotionController final : public QWidget {
Jeremy Bullock f15907
  Q_OBJECT
Jeremy Bullock f15907
  StopMotion *m_stopMotion;
Jeremy Bullock f15907
Jeremy Bullock f15907
  QWidget *m_parent;
Jeremy Bullock f15907
  TXshLevelHandle
Jeremy Bullock f15907
      *m_levelHandle;  //!< for clearing the level cache when the color changed
Jeremy Bullock f15907
Jeremy Bullock f15907
  DVGui::TabBar *m_tabBar;
Jeremy Bullock f15907
  QFrame *m_mainControlsPage;
Jeremy Bullock f15907
  QFrame *m_cameraSettingsPage;
Jeremy Bullock f15907
  QFrame *m_optionsPage;
shun-iwasawa 31accf
  QFrame *m_motionPage;
shun-iwasawa 31accf
  QFrame *m_lightPage;
shun-iwasawa 31accf
  QFrame *m_dslrFrame;
shun-iwasawa 31accf
  QFrame *m_webcamFrame;
shun-iwasawa 31accf
  QFrame *m_noCameraFrame;
Jeremy Bullock f15907
  QStackedWidget *m_stackedChooser;
shun-iwasawa 31accf
  TabBarContainter *m_tabBarContainer;  //!< Tabs container for pages
shun-iwasawa 31accf
  QPushButton *m_toggleLiveViewButton, *m_setToCurrentXSheetFrameButton,
shun-iwasawa 31accf
      *m_alwaysUseLiveViewImagesButton;
shun-iwasawa 31accf
  QPushButton *m_captureButton, *m_zoomButton, *m_fileFormatOptionButton,
Jeremy Bullock f15907
      *m_pickZoomButton, *m_focusNearButton, *m_focusFarButton,
Jeremy Bullock f15907
      *m_focusNear2Button, *m_focusNear3Button, *m_focusFar2Button,
shun-iwasawa 31accf
      *m_focusFar3Button, *m_captureFilterSettingsBtn, *m_testLightsButton;
Jeremy Bullock f15907
  QHBoxLayout *m_focusAndZoomLayout;
Jeremy Bullock f15907
  QLabel *m_frameInfoLabel, *m_cameraSettingsLabel, *m_cameraModeLabel,
shun-iwasawa 31accf
      *m_resolutionLabel, *m_directShowLabel, *m_cameraStatusLabel,
shun-iwasawa 31accf
      *m_apertureLabel, *m_kelvinValueLabel, *m_isoLabel, *m_shutterSpeedLabel,
shun-iwasawa 31accf
      *m_webcamLabel;
Jeremy Bullock f15907
  QToolButton *m_previousLevelButton, *m_previousFrameButton,
Jeremy Bullock f15907
      *m_previousXSheetFrameButton;
shun-iwasawa 31accf
  QSlider *m_apertureSlider, *m_shutterSpeedSlider, *m_isoSlider,
shun-iwasawa 31accf
      *m_kelvinSlider, *m_webcamFocusSlider, *m_webcamWhiteBalanceSlider,
shun-iwasawa 31accf
      *m_webcamExposureSlider, *m_webcamBrightnessSlider,
shun-iwasawa 31accf
      *m_webcamContrastSlider, *m_webcamGainSlider, *m_webcamSaturationSlider;
shun-iwasawa 31accf
  QComboBox *m_cameraListCombo, *m_exposureCombo, *m_fileTypeCombo,
shun-iwasawa 31accf
      *m_whiteBalanceCombo, *m_resolutionCombo, *m_imageQualityCombo,
shun-iwasawa 31accf
      *m_pictureStyleCombo, *m_controlDeviceCombo;
Jeremy Bullock f15907
  LevelNameLineEdit *m_levelNameEdit;
Jeremy Bullock f15907
  QCheckBox *m_blackScreenForCapture, *m_useScaledFullSizeImages,
Jeremy Bullock f15907
      *m_placeOnXSheetCB, *m_directShowCB, *m_liveViewOnAllFramesCB,
shun-iwasawa 31accf
      *m_useMjpgCB, *m_useNumpadCB, *m_drawBeneathCB, *m_timerCB;
Jeremy Bullock f15907
  DVGui::FileField *m_saveInFileFld;
Jeremy Bullock f15907
  DVGui::IntLineEdit *m_xSheetFrameNumberEdit;
Jeremy Bullock f15907
  FrameNumberLineEdit *m_frameNumberEdit;
Jeremy Bullock f15907
  DVGui::IntField *m_onionOpacityFld, *m_postCaptureReviewFld,
Jeremy Bullock f15907
      *m_subsamplingFld;
Jeremy Bullock f15907
  PencilTestSaveInFolderPopup *m_saveInFolderPopup;
shun-iwasawa 31accf
  DVGui::IntField *m_timerIntervalFld;
shun-iwasawa 31accf
  DVGui::ColorField *m_screen1ColorFld, *m_screen2ColorFld, *m_screen3ColorFld;
shun-iwasawa 31accf
  QGroupBox *m_screen1Box;
shun-iwasawa 31accf
  QGroupBox *m_screen2Box;
shun-iwasawa 31accf
  QGroupBox *m_screen3Box;
shun-iwasawa 31accf
  QGroupBox *m_webcamAutoFocusGB;
shun-iwasawa 31accf
  QTimer *m_lightTestTimer;
Jeremy Bullock f15907
Jeremy Bullock f15907
public:
Jeremy Bullock f15907
  StopMotionController(QWidget *parent = 0);
Jeremy Bullock f15907
  ~StopMotionController();
Jeremy Bullock f15907
Jeremy Bullock f15907
protected:
Jeremy Bullock f15907
  void updateStopMotion();
shun-iwasawa 31accf
  void showEvent(QShowEvent *event) override;
shun-iwasawa 31accf
  void hideEvent(QHideEvent *event) override;
Jeremy Bullock f15907
  // void mousePressEvent(QMouseEvent *event) override;
Jeremy Bullock f15907
  // void keyPressEvent(QKeyEvent *event);
shun-iwasawa 31accf
  void keyPressEvent(QKeyEvent *event) override;
Jeremy Bullock f15907
Jeremy Bullock f15907
protected slots:
shun-iwasawa 31accf
  void refreshCameraList(QString activeCamera = "");
Jeremy Bullock f15907
  void refreshCameraListCalled();
Jeremy Bullock f15907
  void refreshOptionsLists();
Jeremy Bullock f15907
  void onCameraListComboActivated(int index);
Jeremy Bullock f15907
  void onResolutionComboActivated(const QString &itemText);
Jeremy Bullock f15907
  void onCaptureFilterSettingsBtnPressed();
Jeremy Bullock f15907
  void onFileFormatOptionButtonPressed();
Jeremy Bullock f15907
  void onLevelNameEdited();
Jeremy Bullock f15907
  void onNextName();
Jeremy Bullock f15907
  void onPreviousName();
Jeremy Bullock f15907
  void onNextFrame();
Jeremy Bullock f15907
  void onPreviousFrame();
Jeremy Bullock f15907
  void onNextNewLevel();
Jeremy Bullock f15907
  void onLastFrame();
shun-iwasawa 31accf
Jeremy Bullock f15907
  void onFileTypeActivated();
Jeremy Bullock f15907
  void onFrameNumberChanged();
Jeremy Bullock f15907
  void onXSheetFrameNumberChanged();
Jeremy Bullock f15907
  void onFrameCaptured(QImage &image);
Jeremy Bullock f15907
  void onOnionOpacityFldEdited();
Jeremy Bullock f15907
  void onOnionOpacitySliderChanged(bool ignore);
Jeremy Bullock f15907
  void onLiveViewToggleClicked();
Jeremy Bullock f15907
  void onCaptureButtonClicked(bool);
Jeremy Bullock f15907
  void setPage(int);
Jeremy Bullock f15907
  void onScaleFullSizeImagesChanged(int checked);
Jeremy Bullock f15907
  void onBlackScreenForCaptureChanged(int checked);
Jeremy Bullock f15907
  void onPlaceOnXSheetChanged(int checked);
Jeremy Bullock f15907
  void onUseMjpgChanged(int checked);
Jeremy Bullock f15907
  void onUseDirectShowChanged(int checked);
Jeremy Bullock f15907
  void onLiveViewOnAllFramesChanged(int checked);
Jeremy Bullock f15907
  void onUseNumpadChanged(int checked);
shun-iwasawa 31accf
  void onDrawBeneathChanged(int checked);
Jeremy Bullock f15907
  void updateDimensions();
Jeremy Bullock f15907
  void onSaveInPathEdited();
Jeremy Bullock f15907
  void onSceneSwitched();
Jeremy Bullock f15907
  void onPreviousXSheetFrame();
Jeremy Bullock f15907
  void onNextXSheetFrame();
Jeremy Bullock f15907
  void setToCurrentXSheetFrame();
shun-iwasawa 31accf
shun-iwasawa 31accf
  // motion control
shun-iwasawa 31accf
  void serialPortChanged(int);
shun-iwasawa 31accf
shun-iwasawa 31accf
  // time lapse
shun-iwasawa 31accf
  void onIntervalTimerCBToggled(bool);
shun-iwasawa 31accf
  void onIntervalSliderValueChanged(bool);
shun-iwasawa 31accf
  void onIntervalCaptureTimerTimeout();
shun-iwasawa 31accf
  void onIntervalCountDownTimeout();
shun-iwasawa 31accf
  void onIntervalAmountChanged(int);
shun-iwasawa 31accf
  void onIntervalToggled(bool);
shun-iwasawa 31accf
  void onIntervalStarted();
shun-iwasawa 31accf
  void onIntervalStopped();
shun-iwasawa 31accf
shun-iwasawa 31accf
  // lights and screens
shun-iwasawa 31accf
  void setScreen1Color(const TPixel32 &value, bool isDragging);
shun-iwasawa 31accf
  void setScreen2Color(const TPixel32 &value, bool isDragging);
shun-iwasawa 31accf
  void setScreen3Color(const TPixel32 &value, bool isDragging);
shun-iwasawa 31accf
  void onScreen1OverlayToggled(bool);
shun-iwasawa 31accf
  void onScreen2OverlayToggled(bool);
shun-iwasawa 31accf
  void onScreen3OverlayToggled(bool);
shun-iwasawa 31accf
  void onTestLightsPressed();
shun-iwasawa 31accf
  void onTestLightsTimeout();
shun-iwasawa 31accf
  void onScreen1ColorChanged(TPixel32);
shun-iwasawa 31accf
  void onScreen2ColorChanged(TPixel32);
shun-iwasawa 31accf
  void onScreen3ColorChanged(TPixel32);
shun-iwasawa 31accf
  void onScreen1OverlayChanged(bool);
shun-iwasawa 31accf
  void onScreen2OverlayChanged(bool);
shun-iwasawa 31accf
  void onScreen3OverlayChanged(bool);
shun-iwasawa 31accf
shun-iwasawa 31accf
  // canon stuff
Jeremy Bullock f15907
  void onApertureChanged(int index);
Jeremy Bullock f15907
  void onShutterSpeedChanged(int index);
Jeremy Bullock f15907
  void onIsoChanged(int index);
Jeremy Bullock f15907
  void onExposureChanged(int index);
Jeremy Bullock f15907
  void onWhiteBalanceChanged(int index);
Jeremy Bullock f15907
  void onColorTemperatureChanged(int index);
Jeremy Bullock f15907
  void onImageQualityChanged(int index);
Jeremy Bullock f15907
  void onPictureStyleChanged(int index);
Jeremy Bullock f15907
  void onZoomPressed();
Jeremy Bullock f15907
  void onPickZoomPressed();
Jeremy Bullock f15907
  void onFocusNear();
Jeremy Bullock f15907
  void onFocusFar();
Jeremy Bullock f15907
  void onFocusNear2();
Jeremy Bullock f15907
  void onFocusFar2();
Jeremy Bullock f15907
  void onFocusNear3();
Jeremy Bullock f15907
  void onFocusFar3();
shun-iwasawa 31accf
  void onApertureChangedSignal(QString);
shun-iwasawa 31accf
  void onIsoChangedSignal(QString);
shun-iwasawa 31accf
  void onShutterSpeedChangedSignal(QString);
shun-iwasawa 31accf
  void onExposureChangedSignal(QString);
shun-iwasawa 31accf
  void onWhiteBalanceChangedSignal(QString);
shun-iwasawa 31accf
  void onColorTemperatureChangedSignal(QString);
shun-iwasawa 31accf
  void onImageQualityChangedSignal(QString);
shun-iwasawa 31accf
  void onPictureStyleChangedSignal(QString);
shun-iwasawa 31accf
  void refreshApertureList();
shun-iwasawa 31accf
  void refreshShutterSpeedList();
shun-iwasawa 31accf
  void refreshIsoList();
shun-iwasawa 31accf
  void refreshExposureList();
shun-iwasawa 31accf
  void refreshWhiteBalanceList();
shun-iwasawa 31accf
  void refreshColorTemperatureList();
shun-iwasawa 31accf
  void refreshImageQualityList();
shun-iwasawa 31accf
  void refreshPictureStyleList();
shun-iwasawa 31accf
  void refreshMode();
shun-iwasawa 31accf
  void onFocusCheckToggled(bool on);
shun-iwasawa 31accf
  void onPickFocusCheckToggled(bool on);
shun-iwasawa 31accf
  void onAlwaysUseLiveViewImagesButtonClicked();
shun-iwasawa 31accf
  void onAlwaysUseLiveViewImagesToggled(bool);
shun-iwasawa 31accf
Jeremy Bullock f15907
  void onCaptureReviewFldEdited();
Jeremy Bullock f15907
  void onCaptureReviewSliderChanged(bool ignore);
Jeremy Bullock f15907
  void onSubsamplingFldEdited();
Jeremy Bullock f15907
  void onSubsamplingSliderChanged(bool ignore);
Jeremy Bullock f15907
  void onSubsamplingChanged(int);
Jeremy Bullock f15907
  void onFilePathChanged(QString);
Jeremy Bullock f15907
  void onLevelNameChanged(QString);
Jeremy Bullock f15907
  void onFileTypeChanged(QString);
Jeremy Bullock f15907
  void onXSheetFrameNumberChanged(int);
Jeremy Bullock f15907
  void onFrameNumberChanged(int);
Jeremy Bullock f15907
  void onFrameInfoTextChanged(QString);
Jeremy Bullock f15907
  void onOpacityChanged(int opacity);
Jeremy Bullock f15907
  void onScaleFullSizeImagesSignal(bool);
Jeremy Bullock f15907
  void onBlackCaptureSignal(bool);
Jeremy Bullock f15907
  void onLiveViewOnAllFramesSignal(bool);
Jeremy Bullock f15907
  void onPlaceOnXSheetSignal(bool);
Jeremy Bullock f15907
  void onUseMjpgSignal(bool);
Jeremy Bullock f15907
  void onUseDirectShowSignal(bool);
Jeremy Bullock f15907
  void onReviewTimeChangedSignal(int);
Jeremy Bullock f15907
  void onUseNumpadSignal(bool);
shun-iwasawa 31accf
  void onDrawBeneathSignal(bool);
Jeremy Bullock f15907
  void onLiveViewChanged(bool);
Jeremy Bullock f15907
  void onNewCameraSelected(int, bool);
shun-iwasawa 31accf
shun-iwasawa 31accf
  // webcam
Jeremy Bullock f15907
  void onWebcamResolutionsChanged();
Jeremy Bullock f15907
  void onNewWebcamResolutionSelected(int);
shun-iwasawa 31accf
  void onWebcamAutofocusToggled(bool);
shun-iwasawa 31accf
  void onWebcamFocusSliderChanged(int value);
shun-iwasawa 31accf
  void onWebcamExposureSliderChanged(int value);
shun-iwasawa 31accf
  void onWebcamBrightnessSliderChanged(int value);
shun-iwasawa 31accf
  void onWebcamContrastSliderChanged(int value);
shun-iwasawa 31accf
  void onWebcamGainSliderChanged(int value);
shun-iwasawa 31accf
  void onWebcamSaturationSliderChanged(int value);
shun-iwasawa 31accf
  void getWebcamStatus();
Jeremy Bullock f15907
Jeremy Bullock f15907
public slots:
Jeremy Bullock f15907
  void openSaveInFolderPopup();
Jeremy Bullock f15907
};
Jeremy Bullock f15907
Jeremy Bullock f15907
#endif  // STOPMOTIONCONTROLLER_H