17#include "cameraoptionswidget.h"
18#include "ui_cameraoptionswidget.h"
21#include "toolmanager.h"
22#include "layermanager.h"
24#include "cameratool.h"
26CameraOptionsWidget::CameraOptionsWidget(
Editor* editor,
QWidget *parent) :
35CameraOptionsWidget::~CameraOptionsWidget()
40void CameraOptionsWidget::initUI()
42 auto toolMan = mEditor->tools();
43 mCameraTool =
static_cast<CameraTool*
>(toolMan->getTool(CAMERA));
45 makeConnectionsFromUIToModel();
46 makeConnectionsFromModelToUI();
49void CameraOptionsWidget::updateUI()
51 Q_ASSERT(mCameraTool->type() == CAMERA);
55 setShowCameraPath(p.showPathEnabled());
56 setPathDotColorType(p.dotColorType());
59void CameraOptionsWidget::makeConnectionsFromModelToUI()
61 connect(mCameraTool, &CameraTool::cameraPathEnabledChanged,
this, [=](
bool enabled) {
65 connect(mCameraTool, &CameraTool::pathColorChanged,
this, [=](DotColorType type) {
66 setPathDotColorType(type);
70void CameraOptionsWidget::makeConnectionsFromUIToModel()
73 mCameraTool->setCameraPathEnabled(enabled);
77 mCameraTool->setPathDotColorType(static_cast<DotColorType>(value));
81 mCameraTool->performAction(CameraTool::RESET_PATH);
85 mCameraTool->performAction(CameraTool::RESET_FIELD);
88 mCameraTool->performAction(CameraTool::RESET_TRANSLATION);
91 mCameraTool->performAction(CameraTool::RESET_ROTATION);
94 mCameraTool->performAction(CameraTool::RESET_SCALING);
98void CameraOptionsWidget::setShowCameraPath(
bool showCameraPath)
101 ui->showCameraPathCheckBox->setChecked(showCameraPath);
104void CameraOptionsWidget::setPathDotColorType(DotColorType index)
107 ui->pathColorComboBox->setCurrentIndex(
static_cast<int>(index));
void currentIndexChanged(int index)
QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)