Commit 5d247de5 authored by Mike Kremer's avatar Mike Kremer
Browse files

Added option handling and new gui elements for stereo mode settings.

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@7570 383ad7c9-94d9-4d36-a494-682f7c89f535
parent dc27f00c
......@@ -196,6 +196,26 @@ void Core::readApplicationOptions(INIFile& _ini) {
if ( _ini.get_entry( val, "Options" , "FocalDistance") )
OpenFlipper::Options::focalDistance(val);
//============================================================================
// Load philips stereo mode settings
//============================================================================
int philipsContent = 0;
if ( _ini.get_entry( philipsContent, "Options" , "PhilipsContent") )
OpenFlipper::Options::stereoPhilipsContent(philipsContent);
int philipsFactor = 0;
if ( _ini.get_entry( philipsFactor, "Options" , "PhilipsFactor") )
OpenFlipper::Options::stereoPhilipsFactor(philipsFactor);
int philipsOffset = 0;
if ( _ini.get_entry( philipsOffset, "Options" , "PhilipsOffset") )
OpenFlipper::Options::stereoPhilipsOffset(philipsOffset);
int philipsSelect = 0;
if ( _ini.get_entry( philipsSelect, "Options" , "PhilipsSelect") )
OpenFlipper::Options::stereoPhilipsSelect(philipsSelect);
//============================================================================
// Load the custom anaglyph stereo mode color matrices
//============================================================================
......@@ -671,7 +691,7 @@ void Core::writeApplicationOptions(INIFile& _ini) {
_ini.add_entry("Options","DefaultBackgroundColor", (uint)OpenFlipper::Options::defaultBackgroundColor().rgba () );
_ini.add_entry("Options","DefaultBaseColor", (uint)OpenFlipper::Options::defaultBaseColor().rgba () );
_ini.add_entry("Options","StereoMode",OpenFlipper::Options::stereoMode() );
_ini.add_entry("Options", "StereoMode",OpenFlipper::Options::stereoMode() );
_ini.add_entry("Options" , "EyeDistance", OpenFlipper::Options::eyeDistance());
_ini.add_entry("Options" , "FocalDistance", OpenFlipper::Options::focalDistance());
......@@ -681,6 +701,12 @@ void Core::writeApplicationOptions(INIFile& _ini) {
_ini.add_entry("Options", "StereoMousePick", OpenFlipper::Options::stereoMousePick() );
// Philips stereo mode
_ini.add_entry("Options" , "PhilipsContent", OpenFlipper::Options::stereoPhilipsContent());
_ini.add_entry("Options" , "PhilipsFactor", OpenFlipper::Options::stereoPhilipsFactor());
_ini.add_entry("Options" , "PhilipsOffset", OpenFlipper::Options::stereoPhilipsOffset());
_ini.add_entry("Options" , "PhilipsSelect", OpenFlipper::Options::stereoPhilipsSelect());
_ini.add_entry("Options", "GlMouse", OpenFlipper::Options::glMouse() );
}
......
......@@ -140,7 +140,7 @@ static std::vector<float> anaglyphRightEyeColors_ = std::vector<float> (9, 0.0);
static bool stereoMousePick_ = true;
/// philips stereo header content type
static int stereoPhilipsContentType_ = 3; // Game
static int stereoPhilipsContent_ = 3; // Game
/// philips stereo header factor
static int stereoPhilipsFactor_ = 64;
......@@ -654,13 +654,13 @@ bool stereoMousePick( ) {
/// Store philips stereo header content type
void stereoPhilipsContent( int _content )
{
stereoPhilipsContentType_ = _content;
stereoPhilipsContent_ = _content;
}
/// get philips stereo header content type
int stereoPhilipsContent( )
{
return stereoPhilipsContentType_;
return stereoPhilipsContent_;
}
/// Store philips stereo header factor
......
......@@ -354,13 +354,11 @@ void CoreWidget::stereoButtonContextMenu(const QPoint& _pos) {
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;
*/
// // 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()) {
......@@ -394,11 +392,10 @@ void CoreWidget::slotApplyStereoSettings(int /*_tmpParam*/) {
stereoSettingsWidget_->stackedWidget->setCurrentIndex(0);
}
if(stereoSettingsWidget_->stackedWidget->currentIndex() == 0) {
// Save everything
OpenFlipper::Options::eyeDistance(stereoSettingsWidget_->eyeDistance->value());
OpenFlipper::Options::focalDistance(
(float)stereoSettingsWidget_->focalDistance->value() / 1000);
} else {
OpenFlipper::Options::focalDistance((float) stereoSettingsWidget_->focalDistance->value() / 1000);
// Update labels that display the current values
stereoSettingsWidget_->factorCounter->setNum(stereoSettingsWidget_->headerFactor->value());
stereoSettingsWidget_->offsetCounter->setNum(stereoSettingsWidget_->headerOffsetCC->value());
......@@ -408,7 +405,6 @@ void CoreWidget::slotApplyStereoSettings(int /*_tmpParam*/) {
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) {
......
......@@ -77,6 +77,16 @@ OptionsWidget::OptionsWidget(std::vector<PluginInfo>& _plugins, std::vector<KeyB
connect( projectionBox, SIGNAL(currentIndexChanged(int)), this, SLOT(viewerSettingsChanged(int)));
connect( directionBox, SIGNAL(currentIndexChanged(int)), this, SLOT(viewerSettingsChanged(int)));
// Switch stacked widget of stereo settings
connect(stereoOpengl, SIGNAL(clicked()),
this, SLOT(switchStackedWidget()));
connect(stereoAnaglyph, SIGNAL(clicked()),
this, SLOT(switchStackedWidget()));
connect(stereoCustomAnaglyph, SIGNAL(clicked()),
this, SLOT(switchStackedWidget()));
connect(stereoPhilips, SIGNAL(clicked()),
this, SLOT(switchStackedWidget()));
uint mode = 2;
for (uint i=1; i < 22; i++) {
std::vector< QString > dm = drawModeToDescriptions( mode );
......@@ -164,6 +174,20 @@ void OptionsWidget::viewerSettingsChanged(int /*_index*/){
}
};
void OptionsWidget::switchStackedWidget() {
// Show right stacked widget of stereo settings
if (stereoCustomAnaglyph->isChecked()) {
stackedWidget->setCurrentIndex(0);
} else if (stereoAnaglyph->isChecked()) {
stackedWidget->setCurrentIndex(0);
} else if (stereoPhilips->isChecked()) {
stackedWidget->setCurrentIndex(1);
} else {
stackedWidget->setCurrentIndex(0);
}
}
void OptionsWidget::updateViewerSettings(int _row){
updatingViewerSettings_ = true;
......@@ -212,6 +236,14 @@ void OptionsWidget::showEvent ( QShowEvent * /*event*/ ) {
eyeDistance->setValue (OpenFlipper::Options::eyeDistance());
focalDistance->setValue (OpenFlipper::Options::focalDistance() * 1000);
// Philips stereo mode part
headerContentType->setCurrentIndex(OpenFlipper::Options::stereoPhilipsContent());
headerFactor->setValue(OpenFlipper::Options::stereoPhilipsFactor());
headerOffsetCC->setValue(OpenFlipper::Options::stereoPhilipsOffset());
factorCounter->setNum(OpenFlipper::Options::stereoPhilipsFactor());
offsetCounter->setNum(OpenFlipper::Options::stereoPhilipsOffset());
headerSelect->setCurrentIndex(OpenFlipper::Options::stereoPhilipsSelect());
std::vector<float> mat = OpenFlipper::Options::anaglyphLeftEyeColorMatrix ();
lcm0->setValue (mat[0]);
lcm1->setValue (mat[1]);
......@@ -511,6 +543,12 @@ void OptionsWidget::slotApply() {
OpenFlipper::Options::stereoMousePick(!noMousePick->isChecked ());
// Set option entries for philips stereo mode
OpenFlipper::Options::stereoPhilipsContent(headerContentType->currentIndex());
OpenFlipper::Options::stereoPhilipsFactor(headerFactor->value());
OpenFlipper::Options::stereoPhilipsOffset(headerOffsetCC->value());
OpenFlipper::Options::stereoPhilipsSelect(headerSelect->currentIndex());
std::vector<float> mat (9, 0);
mat[0] = lcm0->value ();
mat[1] = lcm1->value ();
......
......@@ -109,6 +109,9 @@ private slots:
void viewerSettingsChanged(QListWidgetItem* _item);
void viewerSettingsChanged(int _index);
/// Switch between the stacked widgets of the stereo settings
void switchStackedWidget();
protected:
void showEvent ( QShowEvent * event );
......
......@@ -661,15 +661,25 @@ You can select multiple modes at the same time.</string>
<item>
<widget class="QRadioButton" name="stereoPhilips">
<property name="text">
<string>Philips Stereo Mode (For 3D autostereoskopic displays)</string>
<string>Philips Stereo Mode (For 3D autostereoscopic displays)</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QStackedWidget" name="stackedWidget">
<property name="currentIndex">
<number>1</number>
</property>
<widget class="QWidget" name="page">
<widget class="QGroupBox" name="groupBox_7">
<property name="geometry">
<rect>
<x>0</x>
<y>20</y>
<width>611</width>
<height>101</height>
</rect>
</property>
<property name="title">
<string>View properties</string>
</property>
......@@ -777,6 +787,205 @@ You can select multiple modes at the same time.</string>
</item>
</layout>
</widget>
</widget>
<widget class="QWidget" name="page_2">
<widget class="QGroupBox" name="groupBox_10">
<property name="geometry">
<rect>
<x>0</x>
<y>20</y>
<width>611</width>
<height>161</height>
</rect>
</property>
<property name="title">
<string>Philips Stereo properties</string>
</property>
<widget class="QWidget" name="gridLayoutWidget">
<property name="geometry">
<rect>
<x>40</x>
<y>30</y>
<width>531</width>
<height>121</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0">
<widget class="QLabel" name="label_20">
<property name="text">
<string>Header Content type</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="headerContentType">
<item>
<property name="text">
<string>No depth</string>
</property>
</item>
<item>
<property name="text">
<string>Signage</string>
</property>
</item>
<item>
<property name="text">
<string>Movie</string>
</property>
</item>
<item>
<property name="text">
<string>Game</string>
</property>
</item>
<item>
<property name="text">
<string>CGI</string>
</property>
</item>
<item>
<property name="text">
<string>Still</string>
</property>
</item>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_21">
<property name="text">
<string>Header factor</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_22">
<property name="text">
<string>Header Offset CC</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_23">
<property name="text">
<string>Header Select</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QComboBox" name="headerSelect">
<item>
<property name="text">
<string>Automatic optimizations</string>
</property>
</item>
<item>
<property name="text">
<string>Header provided factor</string>
</property>
</item>
<item>
<property name="text">
<string>Header provided offset</string>
</property>
</item>
<item>
<property name="text">
<string>Header provided factor and offset</string>
</property>
</item>
</widget>
</item>
<item row="1" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_20">
<item>
<widget class="QLabel" name="factorCounter">
<property name="minimumSize">
<size>
<width>30</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>30</width>
<height>16777215</height>
</size>
</property>
<property name="layoutDirection">
<enum>Qt::RightToLeft</enum>
</property>
<property name="text">
<string>0</string>
</property>
</widget>
</item>
<item>
<widget class="QSlider" name="headerFactor">
<property name="maximum">
<number>255</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
</layout>
</item>
<item row="2" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_21">
<item>
<widget class="QLabel" name="offsetCounter">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>30</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>30</width>
<height>16777215</height>
</size>
</property>
<property name="layoutDirection">
<enum>Qt::RightToLeft</enum>
</property>
<property name="text">
<string>0</string>
</property>
</widget>
</item>
<item>
<widget class="QSlider" name="headerOffsetCC">
<property name="enabled">
<bool>true</bool>
</property>
<property name="maximum">
<number>255</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</widget>
</widget>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_6">
......@@ -1126,7 +1335,7 @@ You can select multiple modes at the same time.</string>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>374</height>
<height>100</height>
</size>
</property>
</spacer>
......
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