Commit 9a42e668 authored by Mike Kremer's avatar Mike Kremer

Implemented real time stereo settings update out of options dialog.

Fixed some bugs including "FocalLength" -> "FocalDistance" (access the right property).

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@7765 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 7b147c1d
......@@ -350,7 +350,7 @@ void CoreWidget::stereoButtonContextMenu(const QPoint& _pos) {
stereoSettingsWidget_->stereoPhilips->setChecked(OpenFlipper::Options::stereoMode() == OpenFlipper::Options::Philips);
stereoSettingsWidget_->eyeDistance->setValue( OpenFlipperSettings().value("Core/Stereo/EyeDistance").toDouble() );
stereoSettingsWidget_->focalDistance->setValue( OpenFlipperSettings().value("Core/Stereo/FocalLength").toDouble() * 1000);
stereoSettingsWidget_->focalDistance->setValue( OpenFlipperSettings().value("Core/Stereo/FocalDistance").toDouble() * 1000);
// Philips stereo mode part
......@@ -404,7 +404,7 @@ void CoreWidget::slotApplyStereoSettings(int /*_tmpParam*/) {
// Save everything
OpenFlipperSettings().setValue("Core/Stereo/EyeDistance",stereoSettingsWidget_->eyeDistance->value());
OpenFlipperSettings().setValue("Core/Stereo/FocalLength",double(stereoSettingsWidget_->focalDistance->value()/1000.0));
OpenFlipperSettings().setValue("Core/Stereo/FocalDistance",double(stereoSettingsWidget_->focalDistance->value()/1000.0));
// Update labels that display the current values
stereoSettingsWidget_->factorCounter->setNum(stereoSettingsWidget_->headerFactor->value());
......
......@@ -86,11 +86,20 @@ OptionsWidget::OptionsWidget(std::vector<PluginInfo>& _plugins, std::vector<KeyB
this, SLOT(switchStackedWidget()));
connect(stereoPhilips, SIGNAL(clicked()),
this, SLOT(switchStackedWidget()));
connect(headerFactor, SIGNAL(valueChanged(int)),
this, SLOT(updateSliderCounter(int)));
connect(headerOffsetCC, SIGNAL(valueChanged(int)),
this, SLOT(updateSliderCounter(int)));
connect(focalDistance, SIGNAL(sliderReleased()),
this, SLOT(slotPreviewStereoSettings()));
connect(eyeDistance, SIGNAL(editingFinished()),
this, SLOT(slotPreviewStereoSettings()));
connect(headerContentType, SIGNAL(currentIndexChanged(int)),
this, SLOT(slotPreviewStereoSettings(int)));
connect(headerFactor, SIGNAL(sliderReleased()),
this, SLOT(updateSliderCounter()));
connect(headerOffsetCC, SIGNAL(sliderReleased()),
this, SLOT(updateSliderCounter()));
connect(headerSelect, SIGNAL(currentIndexChanged(int)),
this, SLOT(slotPreviewStereoSettings(int)));
uint mode = 2;
for (uint i=1; i < 22; i++) {
......@@ -191,12 +200,9 @@ void OptionsWidget::switchStackedWidget() {
} else {
stackedWidget->setCurrentIndex(0);
}
}
void OptionsWidget::updateSliderCounter(int /*_tmpParam*/) {
// Update labels that display the current values
factorCounter->setNum(headerFactor->value());
offsetCounter->setNum(headerOffsetCC->value());
// Preview new settings
slotPreviewStereoSettings();
}
void OptionsWidget::updateViewerSettings(int _row){
......@@ -252,8 +258,13 @@ void OptionsWidget::showEvent ( QShowEvent * /*event*/ ) {
stereoPhilips->setChecked (OpenFlipper::Options::stereoMode() == OpenFlipper::Options::Philips);
eyeDistance->setValue ( OpenFlipperSettings().value("Core/Stereo/EyeDistance").toDouble() );
focalDistance->setValue ( OpenFlipperSettings().value("Core/Stereo/FocalLength").toDouble() * 1000);
focalDistance->setValue ( OpenFlipperSettings().value("Core/Stereo/FocalDistance").toDouble() * 1000);
// Block signals such that slotApplyStereoSettings
// won't be called when setting the initial values here...
headerContentType->blockSignals(true);
headerSelect->blockSignals(true);
// Philips stereo mode part
headerContentType->setCurrentIndex(OpenFlipperSettings().value("Core/Stereo/Philips/Content").toInt());
headerFactor->setValue(OpenFlipperSettings().value("Core/Stereo/Philips/Factor").toInt());
......@@ -261,6 +272,17 @@ void OptionsWidget::showEvent ( QShowEvent * /*event*/ ) {
factorCounter->setNum(OpenFlipperSettings().value("Core/Stereo/Philips/Factor").toInt());
offsetCounter->setNum(OpenFlipperSettings().value("Core/Stereo/Philips/Offset").toInt());
headerSelect->setCurrentIndex(OpenFlipperSettings().value("Core/Stereo/Philips/Select").toInt());
// Unblock signals
headerContentType->blockSignals(false);
headerSelect->blockSignals(false);
// Show right stacked widget
if (stereoPhilips->isChecked()) {
stackedWidget->setCurrentIndex(1);
} else {
stackedWidget->setCurrentIndex(0);
}
std::vector<float> mat = OpenFlipper::Options::anaglyphLeftEyeColorMatrix ();
lcm0->setValue (mat[0]);
......@@ -557,7 +579,7 @@ void OptionsWidget::slotApply() {
OpenFlipper::Options::stereoMode(OpenFlipper::Options::OpenGL);
OpenFlipperSettings().setValue("Core/Stereo/EyeDistance",eyeDistance->value ());
OpenFlipperSettings().setValue("Core/Stereo/FocalLength",double(focalDistance->value() ) / 1000.0);
OpenFlipperSettings().setValue("Core/Stereo/FocalDistance",double(focalDistance->value() / 1000.0));
OpenFlipper::Options::stereoMousePick(!noMousePick->isChecked ());
......@@ -828,3 +850,37 @@ void OptionsWidget::compareVersions() {
updateVersionsTable();
}
void OptionsWidget::updateSliderCounter() {
// Update labels that display the current values
factorCounter->setNum(headerFactor->value());
offsetCounter->setNum(headerOffsetCC->value());
// Preview settings
slotPreviewStereoSettings();
}
void OptionsWidget::slotPreviewStereoSettings(int /*_tmpParam*/) {
if (stereoCustomAnaglyph->isChecked ())
OpenFlipper::Options::stereoMode(OpenFlipper::Options::AnaglyphCustom);
else if (stereoAnaglyph->isChecked ())
OpenFlipper::Options::stereoMode(OpenFlipper::Options::AnaglyphRedCyan);
else if (stereoPhilips->isChecked() )
OpenFlipper::Options::stereoMode(OpenFlipper::Options::Philips);
else
OpenFlipper::Options::stereoMode(OpenFlipper::Options::OpenGL);
OpenFlipperSettings().setValue("Core/Stereo/EyeDistance", eyeDistance->value());
OpenFlipperSettings().setValue("Core/Stereo/FocalDistance", double(focalDistance->value() / 1000.0));
// Set option entries for philips stereo mode
// Set option entries
OpenFlipperSettings().setValue("Core/Stereo/Philips/Content", headerContentType->currentIndex());
OpenFlipperSettings().setValue("Core/Stereo/Philips/Factor", headerFactor->value());
OpenFlipperSettings().setValue("Core/Stereo/Philips/Offset", headerOffsetCC->value());
OpenFlipperSettings().setValue("Core/Stereo/Philips/Select", headerSelect->currentIndex());
// Update all views
emit applyOptions();
}
\ No newline at end of file
......@@ -113,8 +113,12 @@ private slots:
void switchStackedWidget();
/// Update the labels that show th current values of the sliders
/// Note: The parameter just makes sure the signal and slot can be connected
void updateSliderCounter(int _tmpParam);
void updateSliderCounter();
/// This function is called to update stereo settings for real-time preview
/// Note: The parameter only makes sure that the signals can be connected
/// to this slot.
void slotPreviewStereoSettings(int _tmpParam = 0);
protected:
void showEvent ( QShowEvent * event );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment