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"
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
Toshihiro Shimizu 890ddd
CleanupCameraSettingsWidget::CleanupCameraSettingsWidget()
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	m_cameraWidget = new CameraSettingsWidget(true);
Toshihiro Shimizu 890ddd
	m_offsX = new MeasuredDoubleLineEdit();
Toshihiro Shimizu 890ddd
	m_offsY = new MeasuredDoubleLineEdit();
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	m_cameraWidget->setOffsetWidgetPointers(m_offsX, m_offsY);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	/*--- オフセットを軸ごとにロックするかどうか ---*/
Toshihiro Shimizu 890ddd
	m_offsx_lock = new QCheckBox("", this);
Toshihiro Shimizu 890ddd
	m_offsy_lock = new QCheckBox("", this);
Toshihiro Shimizu 890ddd
	//---
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	m_offsX->setMeasure("length.x");
Toshihiro Shimizu 890ddd
	m_offsY->setMeasure("length.y");
Toshihiro Shimizu 890ddd
	m_offsX->setDecimals(3);
Toshihiro Shimizu 890ddd
	m_offsY->setDecimals(3);
Toshihiro Shimizu 890ddd
	m_offsx_lock->setObjectName("EditToolLockButton");
Toshihiro Shimizu 890ddd
	m_offsy_lock->setObjectName("EditToolLockButton");
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	//m_cameraWidget->hideUseLevelSettingsBtn();
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	//--- layout
Toshihiro Shimizu 890ddd
	QVBoxLayout *mainLay = new QVBoxLayout();
Toshihiro Shimizu 890ddd
	mainLay->setMargin(5);
Toshihiro Shimizu 890ddd
	mainLay->setSpacing(5);
Toshihiro Shimizu 890ddd
	{
Toshihiro Shimizu 890ddd
		mainLay->addWidget(m_cameraWidget);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
		QGridLayout *offsetLay = new QGridLayout();
Toshihiro Shimizu 890ddd
		offsetLay->setHorizontalSpacing(3);
Toshihiro Shimizu 890ddd
		offsetLay->setVerticalSpacing(3);
Toshihiro Shimizu 890ddd
		offsetLay->setMargin(3);
Toshihiro Shimizu 890ddd
		{
Toshihiro Shimizu 890ddd
			offsetLay->addWidget(new QLabel("N/S"), 0, 0);
Toshihiro Shimizu 890ddd
			offsetLay->addWidget(m_offsY, 0, 1);
Toshihiro Shimizu 890ddd
			offsetLay->addWidget(m_offsy_lock, 0, 2);
Toshihiro Shimizu 890ddd
			offsetLay->addWidget(new QLabel("E/W"), 1, 0);
Toshihiro Shimizu 890ddd
			offsetLay->addWidget(m_offsX, 1, 1);
Toshihiro Shimizu 890ddd
			offsetLay->addWidget(m_offsx_lock, 1, 2);
Toshihiro Shimizu 890ddd
		}
Toshihiro Shimizu 890ddd
		offsetLay->setColumnStretch(0, 0);
Toshihiro Shimizu 890ddd
		offsetLay->setColumnStretch(1, 1);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
		/*--- プリセットComboBoxの上にOffsetを挿入する ---*/
Toshihiro Shimizu 890ddd
		QBoxLayout *camLay = qobject_cast<qboxlayout *="">(m_cameraWidget->layout());</qboxlayout>
Toshihiro Shimizu 890ddd
		if (camLay)
Toshihiro Shimizu 890ddd
			camLay->insertLayout(2, offsetLay, 0);
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
	setLayout(mainLay);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	bool ret = true;
Toshihiro Shimizu 890ddd
	ret = ret && connect(m_offsX, SIGNAL(editingFinished()), SIGNAL(cleanupSettingsChanged()));
Toshihiro Shimizu 890ddd
	ret = ret && connect(m_offsY, SIGNAL(editingFinished()), SIGNAL(cleanupSettingsChanged()));
Toshihiro Shimizu 890ddd
	ret = ret && connect(m_offsx_lock, SIGNAL(clicked(bool)), SIGNAL(cleanupSettingsChanged()));
Toshihiro Shimizu 890ddd
	ret = ret && connect(m_offsy_lock, SIGNAL(clicked(bool)), SIGNAL(cleanupSettingsChanged()));
Toshihiro Shimizu 890ddd
	ret = ret && connect(m_cameraWidget, SIGNAL(changed()), SIGNAL(cleanupSettingsChanged()));
Toshihiro Shimizu 890ddd
	assert(ret);
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
CleanupCameraSettingsWidget::~CleanupCameraSettingsWidget()
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
void CleanupCameraSettingsWidget::setCameraPresetListFile(const TFilePath &fp)
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	m_cameraWidget->setPresetListFile(fp);
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
void CleanupCameraSettingsWidget::setFields(const CleanupParameters *cleanupParameters)
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	m_cameraWidget->setFields(&cleanupParameters->m_camera);
Toshihiro Shimizu 890ddd
	m_offsX->setValue(cleanupParameters->m_offx);
Toshihiro Shimizu 890ddd
	m_offsY->setValue(cleanupParameters->m_offy);
Toshihiro Shimizu 890ddd
	m_offsx_lock->setChecked(cleanupParameters->m_offx_lock);
Toshihiro Shimizu 890ddd
	m_offsy_lock->setChecked(cleanupParameters->m_offy_lock);
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
void CleanupCameraSettingsWidget::getFields(CleanupParameters *cleanupParameters)
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	m_cameraWidget->getFields(&cleanupParameters->m_camera);
Toshihiro Shimizu 890ddd
	cleanupParameters->m_offx = m_offsX->getValue();
Toshihiro Shimizu 890ddd
	cleanupParameters->m_offy = m_offsY->getValue();
Toshihiro Shimizu 890ddd
	cleanupParameters->m_offx_lock = m_offsx_lock->isChecked();
Toshihiro Shimizu 890ddd
	cleanupParameters->m_offy_lock = m_offsy_lock->isChecked();
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
double CleanupCameraSettingsWidget::getClosestFieldValue() const
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	return 999;
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
void CleanupCameraSettingsWidget::setImageInfo(const TFilePath &imgPath)
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
void CleanupCameraSettingsWidget::setImageInfo(int w, int h, double dpix, double dpiy)
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
void CleanupCameraSettingsWidget::setCurrentLevel(TXshLevel *level)
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	m_cameraWidget->setCurrentLevel(level);
Toshihiro Shimizu 890ddd
}