This repository has been archived on 2020-03-09. You can view files and clone it, but cannot push or open issues or pull requests.
pg-tp4/settingsdialog.cpp
2020-03-08 21:29:11 +01:00

64 lines
2.1 KiB
C++

#include "settingsdialog.h"
SettingsDialog::SettingsDialog(QWidget *parent)
:QDialog(parent)
{
setupUi(this);
}
void SettingsDialog::setGLArea(GLArea *area) {
glarea = area;
// Paramétrage des PropSliders
sli_distance->setMinimum(GLArea::distance_min);
sli_distance->setStep(GLArea::distance_step);
sli_distance->setMaximum(GLArea::distance_max);
sli_distance->setValue(glarea->getDistance());
sli_focal_length->setMinimum(GLArea::focal_length_min);
sli_focal_length->setStep(GLArea::focal_length_step);
sli_focal_length->setMaximum(GLArea::focal_length_max);
sli_focal_length->setValue(glarea->getFocalLength());
sli_near_clip->setMinimum(GLArea::near_clip_min);
sli_near_clip->setStep(GLArea::near_clip_step);
sli_near_clip->setMaximum(GLArea::near_clip_max);
sli_near_clip->setValue(glarea->getNearClip());
sli_far_clip->setMinimum(GLArea::far_clip_min);
sli_far_clip->setStep(GLArea::far_clip_step);
sli_far_clip->setMaximum(GLArea::far_clip_max);
sli_far_clip->setValue(glarea->getFarClip());
sli_angle->setMinimum(GLArea::angle_min);
sli_angle->setStep(GLArea::angle_step);
sli_angle->setMaximum(GLArea::angle_max);
sli_angle->setValue(glarea->getAngle());
// GLArea -> PropSlider
connect(glarea, SIGNAL(distanceChanged(double)),
sli_distance, SLOT(setValue(double)));
connect(glarea, SIGNAL(focalLengthChanged(double)),
sli_focal_length, SLOT(setValue(double)));
connect(glarea, SIGNAL(nearClipChanged(double)),
sli_near_clip, SLOT(setValue(double)));
connect(glarea, SIGNAL(farClipChanged(double)),
sli_far_clip, SLOT(setValue(double)));
connect(glarea, SIGNAL(angleChanged(double)),
sli_angle, SLOT(setValue(double)));
// PropSlider -> GLArea
connect(sli_distance, SIGNAL(valueChanged(double)),
glarea, SLOT(setDistance(double)));
connect(sli_focal_length, SIGNAL(valueChanged(double)),
glarea, SLOT(setFocalLength(double)));
connect(sli_near_clip, SIGNAL(valueChanged(double)),
glarea, SLOT(setNearClip(double)));
connect(sli_far_clip, SIGNAL(valueChanged(double)),
glarea, SLOT(setFarClip(double)));
connect(sli_angle, SIGNAL(valueChanged(double)),
glarea, SLOT(setAngle(double)));
}