Commit f9d965d3 authored by Mike Kremer's avatar Mike Kremer
Browse files

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;
......@@ -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);
}
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) {
......
......@@ -344,7 +344,7 @@ glViewer::drawScenePhilipsStereo()
// 3 Game
// 4 CGI
// 5 Still
header[1] = 3; // Hdr_Content_type (Game) = 00000011 (Gaming Mode)
header[1] = OpenFlipper::Options::stereoPhilipsContent(); // Hdr_Content_type (Game) = 00000011 (Gaming Mode)
// Header Factor
// Each 3D Display has a 'Display recommended depth value', which corresponds to an
......@@ -355,7 +355,7 @@ glViewer::drawScenePhilipsStereo()
// works on a linear scale and is multiplied with the factor controlled by the user in the Display
// Control Tool.
// Value range: 0-255 (default 64)
header[2] = 64; // Hdr_Factor
header[2] = OpenFlipper::Options::stereoPhilipsFactor(); // Hdr_Factor
// Header Offset CC
// Values in the Depth map equal to the header-offset value will be located on the plane of the
......@@ -364,7 +364,7 @@ glViewer::drawScenePhilipsStereo()
// Offset_CC is the offset controlled by the Content Creator. In the system there is also an
// Offset_user present, which is controlled by the user using the Display Control Tool.
// Value Range: 0-255 (default 128)
header[3] = 128; // Hdr_Offset_CC
header[3] = OpenFlipper::Options::stereoPhilipsOffset(); // Hdr_Offset_CC
// Header select
// When all select signals are low the rendering settings are set to optimal settings for the content
......@@ -375,7 +375,7 @@ glViewer::drawScenePhilipsStereo()
// 1 Use Header provided factor
// 2 Use Header provided offset
// 3 Use both factor and offset
header[4] = 0; // Hdr_Factor_select(1) + Hdr_Offset_select(1) + reserved(6)
header[4] = OpenFlipper::Options::stereoPhilipsSelect(); // Hdr_Factor_select(1) + Hdr_Offset_select(1) + reserved(6)
// Unused Header entry (leave at 0 !)
header[5] = 0; // Reserved
......
......@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>496</width>
<height>304</height>
<width>427</width>
<height>362</height>
</rect>
</property>
<property name="windowTitle">
......@@ -19,7 +19,7 @@
<property name="title">
<string>Stereo Mode</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_14">
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QRadioButton" name="stereoOpengl">
<property name="text">
......@@ -44,15 +44,25 @@
<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>0</number>
</property>
<widget class="QWidget" name="page">
<widget class="QGroupBox" name="groupBox_7">
<property name="geometry">
<rect>
<x>0</x>
<y>20</y>
<width>381</width>
<height>101</height>
</rect>
</property>
<property name="title">
<string>View properties</string>
</property>
......@@ -160,44 +170,228 @@
</item>
</layout>
</widget>
</widget>
<widget class="QWidget" name="page_2">
<widget class="QGroupBox" name="groupBox">
<property name="geometry">
<rect>
<x>0</x>
<y>20</y>
<width>391</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>10</x>
<y>30</y>
<width>369</width>
<height>121</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Header Content type</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="headerContentType">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="text">
<string>No depth</string>
</property>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
<property name="text">
<string>Signage</string>
</property>
<property name="sizeHint" stdset="0">
</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_2">
<property name="text">
<string>Header factor</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Header Offset CC</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_4">
<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_2">
<item>
<widget class="QLabel" name="factorCounter">
<property name="minimumSize">
<size>
<width>40</width>
<height>20</height>
<width>30</width>
<height>0</height>
</size>
</property>
</spacer>
<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="QPushButton" name="confirmButton">
<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_3">
<item>
<widget class="QLabel" name="offsetCounter">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>120</width>
<width>30</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>200</width>
<width>30</width>
<height>16777215</height>
</size>
</property>
<property name="layoutDirection">
<enum>Qt::RightToLeft</enum>
</property>
<property name="text">
<string>Ok</string>
<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>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="closeButton">
<property name="minimumSize">
<size>
<width>120</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Close</string>
</property>
</widget>
</item>
......@@ -218,6 +412,9 @@
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>
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