Commit 3d950a69 authored by Jan Möbius's avatar Jan Möbius

Started to switch to QSettings for program specific settings

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@7734 383ad7c9-94d9-4d36-a494-682f7c89f535
parent e34c74a5
......@@ -949,6 +949,7 @@ void Core::slotExit() {
if (logFile_)
logFile_->close();
OpenFlipper::Options::closeSettings();
qApp->quit();
}
......
......@@ -186,36 +186,6 @@ void Core::readApplicationOptions(INIFile& _ini) {
if ( _ini.get_entry( stereoMode, "Options" , "StereoMode") )
OpenFlipper::Options::stereoMode(static_cast<OpenFlipper::Options::StereoMode> (stereoMode));
//============================================================================
// Load stereo view settings
//============================================================================
float val;
if ( _ini.get_entry( val, "Options" , "EyeDistance") )
OpenFlipper::Options::eyeDistance(val);
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
//============================================================================
......@@ -693,20 +663,11 @@ void Core::writeApplicationOptions(INIFile& _ini) {
_ini.add_entry("Options", "StereoMode",OpenFlipper::Options::stereoMode() );
_ini.add_entry("Options" , "EyeDistance", OpenFlipper::Options::eyeDistance());
_ini.add_entry("Options" , "FocalDistance", OpenFlipper::Options::focalDistance());
_ini.add_entry("Options" , "CustomAnaglyphLeftEye", OpenFlipper::Options::anaglyphLeftEyeColorMatrix() );
_ini.add_entry("Options" , "CustomAnaglyphRightEye", OpenFlipper::Options::anaglyphRightEyeColorMatrix() );
_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() );
}
......
......@@ -57,10 +57,13 @@
// -------------------- ACG
#include <ACG/Scenegraph/DrawModes.hh>
#include "OpenFlipper/INIFile/INIFile.hh"
#include "OpenFlipper/common/GlobalOptions.hh"
#include <OpenFlipper/INIFile/INIFile.hh>
#include <OpenFlipper/common/GlobalOptions.hh>
#include <OpenFlipper/BasePlugin/PluginFunctions.hh>
#include <QCoreApplication>
//== IMPLEMENTATION ==========================================================
void Core::applyOptions(){
......@@ -188,145 +191,6 @@ void Core::setupOptions() {
// initialize the Settings:
OpenFlipper::Options::initializeSettings();
// Get the Main config dir in the home directory and possibly create it
QDir configDir = QDir::home();
if ( ! configDir.cd(".OpenFlipper") ) {
emit log(LOGOUT,tr("Creating config Dir ~/.OpenFlipper"));
configDir.mkdir(".OpenFlipper");
if ( ! configDir.cd(".OpenFlipper") ) {
emit log(LOGERR,tr("Unable to create config dir ~/.OpenFlipper"));
return;
}
}
// Create a local directory to cache icons
QDir iconCacheDir = configDir;
// Create a personal Icon cache dir to save for example user added icons
if ( ! iconCacheDir.exists("Icons") ){
configDir.mkdir("Icons");
emit log(LOGOUT,tr("Creating Icon Cache Dir ~/.OpenFlipper/Icons"));
}
OpenFlipper::Options::configDir(configDir);
// Remember the main application directory (assumed to be one above executable Path)
QDir tempDir = QDir(qApp->applicationDirPath());
#ifdef OPENFLIPPER_APPDIR
tempDir.cd(OPENFLIPPER_APPDIR);
#else
tempDir.cd(".." + OpenFlipper::Options::dirSeparator() );
#endif
OpenFlipper::Options::applicationDir(tempDir.absolutePath());
// Set the standard path to the plugins
#ifdef OPENFLIPPER_PLUGINDIR
tempDir.cd(OPENFLIPPER_PLUGINDIR);
#else
tempDir.cd("Plugins");
#if defined(WIN32)
tempDir.cd("Windows");
#elif defined(ARCH_DARWIN)
tempDir.cd("Darwin");
#else
tempDir.cd("Linux");
#endif
if ( OpenFlipper::Options::is64bit() )
tempDir.cd("64");
else
tempDir.cd("32");
#ifdef WIN32
#ifndef NDEBUG
#define DEBUG
#endif
#endif
#ifdef DEBUG
tempDir.cd("Debug");
#else
tempDir.cd("Release");
#endif
#endif
OpenFlipper::Options::pluginDir(tempDir.absolutePath());
// Set the Path to the shaders
tempDir = QDir(OpenFlipper::Options::applicationDir());
#ifdef OPENFLIPPER_DATADIR
tempDir.cd(OPENFLIPPER_DATADIR);
#endif
tempDir.cd("Shaders");
OpenFlipper::Options::shaderDir(tempDir.absolutePath());
// Set the Path to the textures
tempDir = QDir(OpenFlipper::Options::applicationDir());
#ifdef OPENFLIPPER_DATADIR
tempDir.cd(OPENFLIPPER_DATADIR);
#endif
tempDir.cd("Textures");
OpenFlipper::Options::textureDir(tempDir.absolutePath());
// Set the Path to the Scripts
tempDir = QDir(OpenFlipper::Options::applicationDir());
#ifdef OPENFLIPPER_DATADIR
tempDir.cd(OPENFLIPPER_DATADIR);
#endif
tempDir.cd("Scripts");
OpenFlipper::Options::scriptDir(tempDir.absolutePath());
// Set the Path to the Icons
tempDir = QDir(OpenFlipper::Options::applicationDir());
#ifdef OPENFLIPPER_DATADIR
tempDir.cd(OPENFLIPPER_DATADIR);
#endif
tempDir.cd("Icons");
OpenFlipper::Options::iconDir(tempDir.absolutePath());
// Set the Path to the translations
tempDir = QDir(OpenFlipper::Options::applicationDir());
#ifdef OPENFLIPPER_DATADIR
tempDir.cd(OPENFLIPPER_DATADIR);
#endif
tempDir.cd("Translations");
OpenFlipper::Options::translationsDir(tempDir.absolutePath());
// Set the Path to the Fonts
tempDir = QDir(OpenFlipper::Options::applicationDir());
#ifdef OPENFLIPPER_DATADIR
tempDir.cd(OPENFLIPPER_DATADIR);
#endif
tempDir.cd("Fonts");
OpenFlipper::Options::fontsDir(tempDir.absolutePath());
// Set the Path to the License files
tempDir = QDir(OpenFlipper::Options::applicationDir());
#ifdef OPENFLIPPER_DATADIR
tempDir.cd(OPENFLIPPER_DATADIR);
#endif
tempDir.cd("Licenses");
OpenFlipper::Options::licenseDir(tempDir.absolutePath());
// Set the Path to the Help
tempDir = QDir(OpenFlipper::Options::applicationDir());
#ifdef OPENFLIPPER_DATADIR
tempDir.cd(OPENFLIPPER_DATADIR);
#endif
tempDir.cd("Help");
OpenFlipper::Options::helpDir(tempDir.absolutePath());
// Set the Path to the main data directory
tempDir = QDir(OpenFlipper::Options::applicationDir());
#ifdef OPENFLIPPER_DATADIR
tempDir.cd(OPENFLIPPER_DATADIR);
#endif
OpenFlipper::Options::dataDir(tempDir.absolutePath());
QStringList optionFiles;
......
This diff is collapsed.
......@@ -63,6 +63,42 @@
#include <QStringList>
#include <QColor>
#include <QIcon>
#include <QSettings>
//===========================================================================
/** @name Persistent settings
* @{ */
//===========================================================================
/** \brief QSettings object containing all program settings of OpenFlipper.
*
* To get the settings use:
* OpenFlipperSettings().value("<Key>").toDouble();
* OpenFlipperSettings().value("<Key>").toBool();
*
* To change settings do:
* OpenFlipperSettings().setValue("<Key>",<Value>);
* For detailed info about the values see the documentation of QSettings and the QVariant.
*
* The following entries are available through the settings:
*
* General Stereo Settings:\n
* * Core/Stereo/EyeDistance \t Distance between eyes. Defaults to 7 cm (double)\n
* * Core/Stereo/FocalDistance \t Focal distance. Defaults to center of scene (double)\n
*
* \n
* Philips stereo display settings:\n
* * Core/Stereo/Philips/Content \t Philips stereo header content type (int)
* * Core/Stereo/Philips/Factor \t Philips stereo header factor (int)
* * Core/Stereo/Philips/Offset \t Philips stereo header offset cc (int)
* * Core/Stereo/Philips/Select \t Philips stereo header select (int)
* \n
* Anaglyph stereo mode settings:\n
*/
QSettings& OpenFlipperSettings();
/** @} */
namespace OpenFlipper {
namespace Options {
......@@ -155,95 +191,6 @@ QString fontsDirStr();
DLLEXPORT
QString helpDirStr();
/// Sets the base Path of the application
DLLEXPORT
void applicationDir(QDir _dir);
/// Sets the Path to the Plugins
DLLEXPORT
void pluginDir(QDir _dir);
/// Sets the Path to the shaders
DLLEXPORT
void shaderDir(QDir _dir);
/// Sets the Path to the Textures
DLLEXPORT
void textureDir(QDir _dir);
/// Sets the Path to the Licenses
DLLEXPORT
void licenseDir(QDir _dir);
/// Sets the Path to the Scripts
DLLEXPORT
void scriptDir( QDir _dir);
/// Sets the Path to the Icons
DLLEXPORT
void iconDir(QDir _dir);
/// Sets the Path to the translation files
DLLEXPORT
void translationsDir( QDir _dir);
/// Sets the Path to the Fonts
DLLEXPORT
void fontsDir(QDir _dir);
/// Sets the Path to the Help
DLLEXPORT
void helpDir(QDir _dir);
/// Sets the Path to the data directory
DLLEXPORT
void dataDir(QDir _dir);
/// Sets the base Path of the application
DLLEXPORT
bool applicationDir(QString _dir);
/// Sets the Path to the Plugins
DLLEXPORT
bool pluginDir(QString _dir);
/// Sets the Path to the shaders
DLLEXPORT
bool shaderDir(QString _dir);
/// Sets the Path to the Textures
DLLEXPORT
bool textureDir(QString _dir);
/// Sets the Path to the License files
DLLEXPORT
bool licenseDir(QString _dir);
/// Sets the Path to the Scripts
DLLEXPORT
bool scriptDir(QString _dir);
/// Sets the Path to the Icons
DLLEXPORT
bool iconDir(QString _dir);
/// Sets the Path to the translation files
DLLEXPORT
bool translationsDir(QString _dir);
/// Sets the Path to the Fonts
DLLEXPORT
void fontsDir(QDir _dir);
/// Sets the Path to the Help
DLLEXPORT
void helpDir(QDir _dir);
/// Sets the Path to the data direcotry
DLLEXPORT
bool dataDir(QString _dir);
//===========================================================================
/** @name Option files / paths
* @{ */
......@@ -456,22 +403,6 @@ bool dataDir(QString _dir);
DLLEXPORT
StereoMode stereoMode( );
/// Store stereo eye distance
DLLEXPORT
void eyeDistance( float _eye );
/// get stereo eye distance
DLLEXPORT
float eyeDistance( );
/// Store stereo focal distance relative to scene near plane
DLLEXPORT
void focalDistance( float _focal );
/// get stereo focal distance relative to scene near plane
DLLEXPORT
float focalDistance( );
/// Store the 3x3 left eye color matrix values for custom anaglyph stereo mode
DLLEXPORT
void anaglyphLeftEyeColorMatrix( std::vector<float> _mat );
......@@ -496,38 +427,6 @@ 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 );
......@@ -974,6 +873,9 @@ bool renderPicking( );
DLLEXPORT
bool initializeSettings();
/// Internal function called by the core to write the program options on exit
DLLEXPORT
void closeSettings();
}
}
......
......@@ -349,8 +349,8 @@ void CoreWidget::stereoButtonContextMenu(const QPoint& _pos) {
stereoSettingsWidget_->stereoCustomAnaglyph->setChecked(OpenFlipper::Options::stereoMode() == OpenFlipper::Options::AnaglyphCustom);
stereoSettingsWidget_->stereoPhilips->setChecked(OpenFlipper::Options::stereoMode() == OpenFlipper::Options::Philips);
stereoSettingsWidget_->eyeDistance->setValue(OpenFlipper::Options::eyeDistance());
stereoSettingsWidget_->focalDistance->setValue(OpenFlipper::Options::focalDistance() * 1000);
stereoSettingsWidget_->eyeDistance->setValue( OpenFlipperSettings().value("Core/Stereo/EyeDistance").toDouble() );
stereoSettingsWidget_->focalDistance->setValue( OpenFlipperSettings().value("Core/Stereo/FocalLength").toDouble() * 1000);
// Philips stereo mode part
......@@ -359,12 +359,12 @@ void CoreWidget::stereoButtonContextMenu(const QPoint& _pos) {
stereoSettingsWidget_->headerContentType->blockSignals(true);
stereoSettingsWidget_->headerSelect->blockSignals(true);
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());
stereoSettingsWidget_->headerContentType->setCurrentIndex(OpenFlipperSettings().value("Core/Stereo/Philips/Content").toInt());
stereoSettingsWidget_->headerFactor->setValue(OpenFlipperSettings().value("Core/Stereo/Philips/Factor").toInt());
stereoSettingsWidget_->headerOffsetCC->setValue(OpenFlipperSettings().value("Core/Stereo/Philips/Offset").toInt());
stereoSettingsWidget_->factorCounter->setNum(OpenFlipperSettings().value("Core/Stereo/Philips/Factor").toInt());
stereoSettingsWidget_->offsetCounter->setNum(OpenFlipperSettings().value("Core/Stereo/Philips/Offset").toInt());
stereoSettingsWidget_->headerSelect->setCurrentIndex(OpenFlipperSettings().value("Core/Stereo/Philips/Select").toInt());
// Unblock signals
stereoSettingsWidget_->headerContentType->blockSignals(false);
......@@ -403,18 +403,18 @@ void CoreWidget::slotApplyStereoSettings(int /*_tmpParam*/) {
}
// Save everything
OpenFlipper::Options::eyeDistance(stereoSettingsWidget_->eyeDistance->value());
OpenFlipper::Options::focalDistance((float) stereoSettingsWidget_->focalDistance->value() / 1000);
OpenFlipperSettings().setValue("Core/Stereo/EyeDistance",stereoSettingsWidget_->eyeDistance->value());
OpenFlipperSettings().setValue("Core/Stereo/FocalLength",double(stereoSettingsWidget_->focalDistance->value()/1000.0));
// 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());
OpenFlipperSettings().setValue("Core/Stereo/Philips/Content",stereoSettingsWidget_->headerContentType->currentIndex());
OpenFlipperSettings().setValue("Core/Stereo/Philips/Factor",stereoSettingsWidget_->headerFactor->value());
OpenFlipperSettings().setValue("Core/Stereo/Philips/Offset",stereoSettingsWidget_->headerOffsetCC->value());
OpenFlipperSettings().setValue("Core/Stereo/Philips/Select",stereoSettingsWidget_->headerSelect->currentIndex());
// Update all views
for (unsigned int i = 0 ; i < OpenFlipper::Options::examinerWidgets() ; ++i) {
......
......@@ -119,7 +119,7 @@ glViewer::drawScene_glStereo()
radians = fovy_ * 0.5 / 180.0 * M_PI;
wd2 = near_ * tan(radians);
zerop = near_ + ((far_ - near_) * OpenFlipper::Options::focalDistance ());
zerop = near_ + ((far_ - near_) * OpenFlipperSettings().value("Core/Stereo/FocalDistance").toDouble() );
ndfl = near_ / zerop ;
xrange = a * wd2 * 2 * zerop / near_;
......@@ -128,7 +128,7 @@ glViewer::drawScene_glStereo()
t = wd2;
b = -wd2;
double offset = 0.5 * OpenFlipper::Options::eyeDistance () * xrange;
double offset = 0.5 * OpenFlipperSettings().value("Core/Stereo/EyeDistance").toDouble() * xrange;
double offset2 = offset * ndfl;
// left eye
......@@ -285,7 +285,7 @@ void glViewer::drawScenePhilipsStereo() {
// 3 Game
// 4 CGI
// 5 Still
header[1] = OpenFlipper::Options::stereoPhilipsContent(); // Hdr_Content_type (Game) = 00000011 (Gaming Mode)
header[1] = OpenFlipperSettings().value("Core/Stereo/Philips/Content").toInt(); // Hdr_Content_type (Game) = 00000011 (Gaming Mode)
// Header Factor
// Each 3D Display has a 'Display recommended depth value', which corresponds to an
......@@ -296,7 +296,7 @@ void 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] = OpenFlipper::Options::stereoPhilipsFactor(); // Hdr_Factor
header[2] = OpenFlipperSettings().value("Core/Stereo/Philips/Factor").toInt(); // Hdr_Factor
// Header Offset CC
// Values in the Depth map equal to the header-offset value will be located on the plane of the
......@@ -305,7 +305,7 @@ void 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] = OpenFlipper::Options::stereoPhilipsOffset(); // Hdr_Offset_CC
header[3] = OpenFlipperSettings().value("Core/Stereo/Philips/Offset").toInt(); // Hdr_Offset_CC
// Header select
// When all select signals are low the rendering settings are set to optimal settings for the content
......@@ -316,7 +316,7 @@ void glViewer::drawScenePhilipsStereo() {
// 1 Use Header provided factor
// 2 Use Header provided offset
// 3 Use both factor and offset
header[4] = OpenFlipper::Options::stereoPhilipsSelect(); // Hdr_Factor_select(1) + Hdr_Offset_select(1) + reserved(6)
header[4] = OpenFlipperSettings().value("Core/Stereo/Philips/Select").toInt(); // Hdr_Factor_select(1) + Hdr_Offset_select(1) + reserved(6)
// Unused Header entry (leave at 0 !)
header[5] = 0; // Reserved
......@@ -515,7 +515,7 @@ glViewer::drawScene_anaglyphStereo()
radians = fovy_ * 0.5 / 180.0 * M_PI;
wd2 = near_ * tan(radians);
zerop = near_ + ((far_ - near_) * OpenFlipper::Options::focalDistance ());
zerop = near_ + ((far_ - near_) * OpenFlipperSettings().value("Core/Stereo/FocalDistance").toDouble() );
ndfl = near_ / zerop ;
xrange = a * wd2 * 2 * zerop / near_;
......@@ -524,7 +524,7 @@ glViewer::drawScene_anaglyphStereo()
t = wd2;
b = -wd2;
double offset = 0.5 * OpenFlipper::Options::eyeDistance () * xrange;
double offset = 0.5 * OpenFlipperSettings().value("Core/Stereo/EyeDistance").toDouble() * xrange;
double offset2 = offset * ndfl;
// left eye
......@@ -646,7 +646,7 @@ glViewer::drawScene_customAnaglyphStereo()
radians = fovy_ * 0.5 / 180.0 * M_PI;
wd2 = near_ * tan(radians);
zerop = near_ + ((far_ - near_) * OpenFlipper::Options::focalDistance ());
zerop = near_ + ((far_ - near_) * OpenFlipperSettings().value("Core/Stereo/FocalDistance").toDouble() );
ndfl = near_ / zerop ;
xrange = a * wd2 * 2 * zerop / near_;
......@@ -655,7 +655,7 @@ glViewer::drawScene_customAnaglyphStereo()
t = wd2;
b = -wd2;
double offset = 0.5 * OpenFlipper::Options::eyeDistance () * xrange;
double offset = 0.5 * OpenFlipperSettings().value("Core/Stereo/EyeDistance").toDouble() * xrange;
double offset2 = offset * ndfl;
int vp_l, vp_b, vp_w, vp_h;
......
......@@ -251,16 +251,16 @@ void OptionsWidget::showEvent ( QShowEvent * /*event*/ ) {
stereoCustomAnaglyph->setChecked (OpenFlipper::Options::stereoMode() == OpenFlipper::Options::AnaglyphCustom);
stereoPhilips->setChecked (OpenFlipper::Options::stereoMode() == OpenFlipper::Options::Philips);
eyeDistance->setValue (OpenFlipper::Options::eyeDistance());
focalDistance->setValue (OpenFlipper::Options::focalDistance() * 1000);
eyeDistance->setValue ( OpenFlipperSettings().value("Core/Stereo/EyeDistance").toDouble() );
focalDistance->setValue ( OpenFlipperSettings().value("Core/Stereo/FocalLength").toDouble() * 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());
headerContentType->setCurrentIndex(OpenFlipperSettings().value("Core/Stereo/Philips/Content").toInt());
headerFactor->setValue(OpenFlipperSettings().value("Core/Stereo/Philips/Factor").toInt());
headerOffsetCC->setValue(OpenFlipperSettings().value("Core/Stereo/Philips/Offset").toInt());
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());
std::vector<float> mat = OpenFlipper::Options::anaglyphLeftEyeColorMatrix ();
lcm0->setValue (mat[0]);
......@@ -556,17 +556,18 @@ void OptionsWidget::slotApply() {
else
OpenFlipper::Options::stereoMode(OpenFlipper::Options::OpenGL);
OpenFlipper::Options::eyeDistance(eyeDistance->value ());
OpenFlipper::Options::focalDistance((float)focalDistance->value () / 1000);
OpenFlipperSettings().setValue("Core/Stereo/EyeDistance",eyeDistance->value ());
OpenFlipperSettings().setValue("Core/Stereo/FocalLength",double(focalDistance->value() ) / 1000.0);
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());
// 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());
std::vector<float> mat (9, 0);
mat[0] = lcm0->value ();
mat[1] = lcm1->value ();
......
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