Commit f9d965d3 authored by Mike Kremer's avatar Mike Kremer

Adapted stereo settings context menu to directly change values when changing the sliders.

Added option entries for philips stereo mode.

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@7568 383ad7c9-94d9-4d36-a494-682f7c89f535
parent a8be68eb
......@@ -139,6 +139,18 @@ static std::vector<float> anaglyphRightEyeColors_ = std::vector<float> (9, 0.0);
/// mouse cursor depth picking in stereo mode
static bool stereoMousePick_ = true;
/// philips stereo header content type
static int stereoPhilipsContentType_ = 3; // Game
/// philips stereo header factor
static int stereoPhilipsFactor_ = 64;
/// philips stereo header offset
static int stereoPhilipsOffset_ = 128;
/// philips stereo header select
static int stereoPhilipsSelect_ = 0; // Display's defaults
/// Store the synchronization mode
static bool synchronization_ = false;
......@@ -346,7 +358,7 @@ QString pluginDirStr() { return pluginDir_.absolutePath(); }
QString shaderDirStr() { return shaderDir_.absolutePath(); }
QString textureDirStr() { return textureDir_.absolutePath(); }
QString licenseDirStr() { return licenseDir_.absolutePath(); }
QString scriptDirStr() { return scriptDir_.absolutePath(); }
QString scriptDirStr() { return scriptDir_.absolutePath(); }
QString iconDirStr() { return iconDir_.absolutePath(); }
QString translationsDirStr() { return translationsDir_.absolutePath(); }
QString fontsDirStr() { return fontsDir_.absolutePath(); }
......@@ -639,6 +651,54 @@ bool stereoMousePick( ) {
return stereoMousePick_;
}
/// Store philips stereo header content type
void stereoPhilipsContent( int _content )
{
stereoPhilipsContentType_ = _content;
}
/// get philips stereo header content type
int stereoPhilipsContent( )
{
return stereoPhilipsContentType_;
}
/// Store philips stereo header factor
void stereoPhilipsFactor( int _factor )
{
stereoPhilipsFactor_ = _factor;
}
/// get philips stereo header factor
int stereoPhilipsFactor( )
{
return stereoPhilipsFactor_;
}
/// Store philips stereo header offset
void stereoPhilipsOffset( int _offset )
{
stereoPhilipsOffset_ = _offset;
}
/// get philips stereo header offset
int stereoPhilipsOffset( )
{
return stereoPhilipsOffset_;
}
/// Store philips stereo header select
void stereoPhilipsSelect( int _select )
{
stereoPhilipsSelect_ = _select;
}
/// get philips stereo header select
int stereoPhilipsSelect( )
{
return stereoPhilipsSelect_;
}
/// Store synchronization mode setting
void synchronization( bool _synchronization ) {
synchronization_ = _synchronization;
......
......@@ -496,6 +496,38 @@ bool dataDir(QString _dir);
DLLEXPORT
bool stereoMousePick( );
/// Store philips stereo header content type
DLLEXPORT
void stereoPhilipsContent( int _content );
/// get philips stereo header content type
DLLEXPORT
int stereoPhilipsContent( );
/// Store philips stereo header factor
DLLEXPORT
void stereoPhilipsFactor( int _factor );
/// get philips stereo header factor
DLLEXPORT
int stereoPhilipsFactor( );
/// Store philips stereo header offset cc
DLLEXPORT
void stereoPhilipsOffset( int _offset );
/// get philips stereo header offset cc
DLLEXPORT
int stereoPhilipsOffset( );
/// Store philips stereo header select
DLLEXPORT
void stereoPhilipsSelect( int _select );
/// get philips stereo header select
DLLEXPORT
int stereoPhilipsSelect( );
/// Store synchronization setting
DLLEXPORT
void synchronization( bool _synchronization );
......
......@@ -526,9 +526,33 @@ CoreWidget( QVector<ViewMode*>& _viewModes,
stereoSettingsWidget_ = new StereoSettingsWidget(this);
// Make it look like a dialog
stereoSettingsWidget_->setWindowFlags(Qt::Popup);
// Connect Ok button to local slot
connect(stereoSettingsWidget_->confirmButton, SIGNAL(pressed()),
// Connect combo boxes and sliders to local slots
connect(stereoSettingsWidget_->stereoOpengl, SIGNAL(clicked()),
this, SLOT(slotApplyStereoSettings()));
connect(stereoSettingsWidget_->stereoAnaglyph, SIGNAL(clicked()),
this, SLOT(slotApplyStereoSettings()));
connect(stereoSettingsWidget_->stereoCustomAnaglyph, SIGNAL(clicked()),
this, SLOT(slotApplyStereoSettings()));
connect(stereoSettingsWidget_->stereoPhilips, SIGNAL(clicked()),
this, SLOT(slotApplyStereoSettings()));
connect(stereoSettingsWidget_->focalDistance, SIGNAL(valueChanged(int)),
this, SLOT(slotApplyStereoSettings(int)));
connect(stereoSettingsWidget_->eyeDistance, SIGNAL(editingFinished()),
this, SLOT(slotApplyStereoSettings()));
connect(stereoSettingsWidget_->headerContentType, SIGNAL(currentIndexChanged(int)),
this, SLOT(slotApplyStereoSettings(int)));
connect(stereoSettingsWidget_->headerFactor, SIGNAL(valueChanged(int)),
this, SLOT(slotApplyStereoSettings(int)));
connect(stereoSettingsWidget_->headerOffsetCC, SIGNAL(valueChanged(int)),
this, SLOT(slotApplyStereoSettings(int)));
connect(stereoSettingsWidget_->headerSelect, SIGNAL(currentIndexChanged(int)),
this, SLOT(slotApplyStereoSettings(int)));
// Close button
connect(stereoSettingsWidget_->closeButton, SIGNAL(clicked()),
stereoSettingsWidget_, SLOT(hide()));
}
......
......@@ -811,7 +811,9 @@ public:
void stereoButtonContextMenu(const QPoint& _pos);
/// Is called if the user has changed stereo settings
void slotApplyStereoSettings();
/// Note: The parameter just makes sure, we can connect
/// all necessary signals to this slot. It has no use for now.
void slotApplyStereoSettings(int _tmpParam = 0);
private:
......
......@@ -346,31 +346,69 @@ void CoreWidget::stereoButtonContextMenu(const QPoint& _pos) {
stereoSettingsWidget_->eyeDistance->setValue(OpenFlipper::Options::eyeDistance());
stereoSettingsWidget_->focalDistance->setValue(OpenFlipper::Options::focalDistance() * 1000);
// Philips stereo mode part
stereoSettingsWidget_->headerContentType->setCurrentIndex(OpenFlipper::Options::stereoPhilipsContent());
stereoSettingsWidget_->headerFactor->setValue(OpenFlipper::Options::stereoPhilipsFactor());
stereoSettingsWidget_->headerOffsetCC->setValue(OpenFlipper::Options::stereoPhilipsOffset());
stereoSettingsWidget_->factorCounter->setNum(OpenFlipper::Options::stereoPhilipsFactor());
stereoSettingsWidget_->offsetCounter->setNum(OpenFlipper::Options::stereoPhilipsOffset());
stereoSettingsWidget_->headerSelect->setCurrentIndex(OpenFlipper::Options::stereoPhilipsSelect());
// Default values are strange...
/*
std::cerr << "Content type: " << OpenFlipper::Options::stereoPhilipsContent() << std::endl;
std::cerr << "Factor: " << OpenFlipper::Options::stereoPhilipsFactor() << std::endl;
std::cerr << "Offset: " << OpenFlipper::Options::stereoPhilipsOffset() << std::endl;
std::cerr << "Select: " << OpenFlipper::Options::stereoPhilipsSelect() << std::endl;
*/
// Show right stacked widget
if (stereoSettingsWidget_->stereoPhilips->isChecked()) {
stereoSettingsWidget_->stackedWidget->setCurrentIndex(1);
} else {
stereoSettingsWidget_->stackedWidget->setCurrentIndex(0);
}
// Move widget to the position of the cursor
stereoSettingsWidget_->move(stereoButton_->mapToGlobal(_pos));
stereoSettingsWidget_->move(stereoButton_->mapToGlobal(_pos) - QPoint((int)(stereoSettingsWidget_->width()/2), 0));
// Show widget
stereoSettingsWidget_->show();
}
void CoreWidget::slotApplyStereoSettings() {
// Hide widget
stereoSettingsWidget_->hide();
void CoreWidget::slotApplyStereoSettings(int /*_tmpParam*/) {
// Update values
if (stereoSettingsWidget_->stereoCustomAnaglyph->isChecked()) {
// Update option entry
OpenFlipper::Options::stereoMode(OpenFlipper::Options::AnaglyphCustom);
// Show right stacked widget
stereoSettingsWidget_->stackedWidget->setCurrentIndex(0);
} else if (stereoSettingsWidget_->stereoAnaglyph->isChecked()) {
OpenFlipper::Options::stereoMode(OpenFlipper::Options::AnaglyphRedCyan);
stereoSettingsWidget_->stackedWidget->setCurrentIndex(0);
} else if (stereoSettingsWidget_->stereoPhilips->isChecked()) {
OpenFlipper::Options::stereoMode(OpenFlipper::Options::Philips);
stereoSettingsWidget_->stackedWidget->setCurrentIndex(1);
} else {
OpenFlipper::Options::stereoMode(OpenFlipper::Options::OpenGL);
stereoSettingsWidget_->stackedWidget->setCurrentIndex(0);
}
OpenFlipper::Options::eyeDistance(stereoSettingsWidget_->eyeDistance->value());
OpenFlipper::Options::focalDistance(
(float)stereoSettingsWidget_->focalDistance->value() / 1000);
if(stereoSettingsWidget_->stackedWidget->currentIndex() == 0) {
OpenFlipper::Options::eyeDistance(stereoSettingsWidget_->eyeDistance->value());
OpenFlipper::Options::focalDistance(
(float)stereoSettingsWidget_->focalDistance->value() / 1000);
} else {
// Update labels that display the current values
stereoSettingsWidget_->factorCounter->setNum(stereoSettingsWidget_->headerFactor->value());
stereoSettingsWidget_->offsetCounter->setNum(stereoSettingsWidget_->headerOffsetCC->value());
// Set option entries
OpenFlipper::Options::stereoPhilipsContent(stereoSettingsWidget_->headerContentType->currentIndex());
OpenFlipper::Options::stereoPhilipsFactor(stereoSettingsWidget_->headerFactor->value());
OpenFlipper::Options::stereoPhilipsOffset(stereoSettingsWidget_->headerOffsetCC->value());
OpenFlipper::Options::stereoPhilipsSelect(stereoSettingsWidget_->headerSelect->currentIndex());
}
// Update all views
for (unsigned int i = 0 ; i < OpenFlipper::Options::examinerWidgets() ; ++i) {
......
This diff is collapsed.
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