Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#include "toonzqt/cleanupcamerasettingswidget.h"
Toshihiro Shimizu 890ddd
#include "toonzqt/camerasettingswidget.h"
Toshihiro Shimizu 890ddd
#include "toonz/cleanupparameters.h"
Jeremy Bullock 232276
#include "toonz/preferences.h"
Jeremy Bullock 232276
#include "toonz/stage.h"
Toshihiro Shimizu 890ddd
#include <qhboxlayout></qhboxlayout>
Toshihiro Shimizu 890ddd
#include <qvboxlayout></qvboxlayout>
Toshihiro Shimizu 890ddd
#include <qgridlayout></qgridlayout>
Toshihiro Shimizu 890ddd
#include <qlabel></qlabel>
Toshihiro Shimizu 890ddd
#include <qstringlist></qstringlist>
Toshihiro Shimizu 890ddd
#include <qlist></qlist>
Toshihiro Shimizu 890ddd
#include <qgroupbox></qgroupbox>
Toshihiro Shimizu 890ddd
#include <qcheckbox></qcheckbox>
Toshihiro Shimizu 890ddd
#include "tfilepath.h"
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#include "toonzqt/dvdialog.h"
Toshihiro Shimizu 890ddd
#include "toonzqt/doublefield.h"
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
using namespace std;
Toshihiro Shimizu 890ddd
using namespace DVGui;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
CleanupCameraSettingsWidget::CleanupCameraSettingsWidget() {
Shinya Kitaoka 120a6e
  m_cameraWidget = new CameraSettingsWidget(true);
Shinya Kitaoka 120a6e
  m_offsX        = new MeasuredDoubleLineEdit();
Shinya Kitaoka 120a6e
  m_offsY        = new MeasuredDoubleLineEdit();
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  m_cameraWidget->setOffsetWidgetPointers(m_offsX, m_offsY);
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  /*--- オフセットを軸ごとにロックするかどうか ---*/
Shinya Kitaoka 120a6e
  m_offsx_lock = new QCheckBox("", this);
Shinya Kitaoka 120a6e
  m_offsy_lock = new QCheckBox("", this);
Shinya Kitaoka 120a6e
  //---
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  m_offsX->setMeasure("length.x");
Shinya Kitaoka 120a6e
  m_offsY->setMeasure("length.y");
Shinya Kitaoka 120a6e
  m_offsX->setDecimals(3);
Shinya Kitaoka 120a6e
  m_offsY->setDecimals(3);
Shinya Kitaoka 120a6e
  m_offsx_lock->setObjectName("EditToolLockButton");
Shinya Kitaoka 120a6e
  m_offsy_lock->setObjectName("EditToolLockButton");
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  // m_cameraWidget->hideUseLevelSettingsBtn();
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  //--- layout
Shinya Kitaoka 120a6e
  QVBoxLayout *mainLay = new QVBoxLayout();
Shinya Kitaoka 120a6e
  mainLay->setMargin(5);
Shinya Kitaoka 120a6e
  mainLay->setSpacing(5);
Shinya Kitaoka 120a6e
  {
Shinya Kitaoka 120a6e
    mainLay->addWidget(m_cameraWidget);
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
    QGridLayout *offsetLay = new QGridLayout();
Shinya Kitaoka 120a6e
    offsetLay->setHorizontalSpacing(3);
Shinya Kitaoka 120a6e
    offsetLay->setVerticalSpacing(3);
Shinya Kitaoka 120a6e
    offsetLay->setMargin(3);
Shinya Kitaoka 120a6e
    {
c7649c
      offsetLay->addWidget(new QLabel(tr("Y")), 0, 0);
Shinya Kitaoka 120a6e
      offsetLay->addWidget(m_offsY, 0, 1);
Shinya Kitaoka 120a6e
      offsetLay->addWidget(m_offsy_lock, 0, 2);
c7649c
      offsetLay->addWidget(new QLabel(tr("X")), 1, 0);
Shinya Kitaoka 120a6e
      offsetLay->addWidget(m_offsX, 1, 1);
Shinya Kitaoka 120a6e
      offsetLay->addWidget(m_offsx_lock, 1, 2);
Shinya Kitaoka 120a6e
    }
Shinya Kitaoka 120a6e
    offsetLay->setColumnStretch(0, 0);
Shinya Kitaoka 120a6e
    offsetLay->setColumnStretch(1, 1);
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
    /*--- プリセットComboBoxの上にOffsetを挿入する ---*/
Shinya Kitaoka 120a6e
    QBoxLayout *camLay = qobject_cast<qboxlayout *="">(m_cameraWidget->layout());</qboxlayout>
Shinya Kitaoka 120a6e
    if (camLay) camLay->insertLayout(2, offsetLay, 0);
Shinya Kitaoka 120a6e
  }
Shinya Kitaoka 120a6e
  setLayout(mainLay);
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  bool ret = true;
Shinya Kitaoka 120a6e
  ret      = ret && connect(m_offsX, SIGNAL(editingFinished()),
Shinya Kitaoka 120a6e
                       SIGNAL(cleanupSettingsChanged()));
Shinya Kitaoka 120a6e
  ret = ret && connect(m_offsY, SIGNAL(editingFinished()),
Shinya Kitaoka 120a6e
                       SIGNAL(cleanupSettingsChanged()));
Shinya Kitaoka 120a6e
  ret = ret && connect(m_offsx_lock, SIGNAL(clicked(bool)),
Shinya Kitaoka 120a6e
                       SIGNAL(cleanupSettingsChanged()));
Shinya Kitaoka 120a6e
  ret = ret && connect(m_offsy_lock, SIGNAL(clicked(bool)),
Shinya Kitaoka 120a6e
                       SIGNAL(cleanupSettingsChanged()));
Shinya Kitaoka 120a6e
  ret = ret && connect(m_cameraWidget, SIGNAL(changed()),
Shinya Kitaoka 120a6e
                       SIGNAL(cleanupSettingsChanged()));
Shinya Kitaoka 120a6e
  assert(ret);
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
CleanupCameraSettingsWidget::~CleanupCameraSettingsWidget() {}
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
void CleanupCameraSettingsWidget::setCameraPresetListFile(const TFilePath &fp) {
Shinya Kitaoka 120a6e
  m_cameraWidget->setPresetListFile(fp);
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
void CleanupCameraSettingsWidget::setFields(
Jeremy Bullock 232276
    CleanupParameters *cleanupParameters) {
shun_iwasawa 39baf5
  if (Preferences::instance()->getPixelsOnly()) {
shun_iwasawa 39baf5
    TDimension res = cleanupParameters->m_camera.getRes();
shun_iwasawa 39baf5
    cleanupParameters->m_camera.setSize(
shun_iwasawa d6df3f
        TDimensionD(res.lx / Stage::standardDpi, res.ly / Stage::standardDpi));
shun_iwasawa 39baf5
  }
Shinya Kitaoka 120a6e
  m_cameraWidget->setFields(&cleanupParameters->m_camera);
Shinya Kitaoka 120a6e
  m_offsX->setValue(cleanupParameters->m_offx);
Shinya Kitaoka 120a6e
  m_offsY->setValue(cleanupParameters->m_offy);
Shinya Kitaoka 120a6e
  m_offsx_lock->setChecked(cleanupParameters->m_offx_lock);
Shinya Kitaoka 120a6e
  m_offsy_lock->setChecked(cleanupParameters->m_offy_lock);
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
void CleanupCameraSettingsWidget::getFields(
Shinya Kitaoka 120a6e
    CleanupParameters *cleanupParameters) {
Shinya Kitaoka 120a6e
  m_cameraWidget->getFields(&cleanupParameters->m_camera);
Shinya Kitaoka 120a6e
  cleanupParameters->m_offx      = m_offsX->getValue();
Shinya Kitaoka 120a6e
  cleanupParameters->m_offy      = m_offsY->getValue();
Shinya Kitaoka 120a6e
  cleanupParameters->m_offx_lock = m_offsx_lock->isChecked();
Shinya Kitaoka 120a6e
  cleanupParameters->m_offy_lock = m_offsy_lock->isChecked();
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
double CleanupCameraSettingsWidget::getClosestFieldValue() const { return 999; }
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
void CleanupCameraSettingsWidget::setImageInfo(const TFilePath &imgPath) {}
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
void CleanupCameraSettingsWidget::setImageInfo(int w, int h, double dpix,
Shinya Kitaoka 120a6e
                                               double dpiy) {}
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
void CleanupCameraSettingsWidget::setCurrentLevel(TXshLevel *level) {
Shinya Kitaoka 120a6e
  m_cameraWidget->setCurrentLevel(level);
Toshihiro Shimizu 890ddd
}