Commit 056e1f36 authored by Jan Möbius's avatar Jan Möbius

Ported maxFrameRate Settings to QSettings

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@8847 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 1de1a94c
......@@ -585,7 +585,7 @@ Core::init() {
}
// start checking for scenegraph changes
scenegraphCheckTimer_->setInterval (1000 / OpenFlipper::Options::maxFrameRate());
scenegraphCheckTimer_->setInterval (1000 / OpenFlipperSettings().value("Core/Gui/glViewer/maxFrameRate",35).toInt() );
scenegraphCheckTimer_->start ();
}
......@@ -760,12 +760,12 @@ void Core::updateView() {
if ( !OpenFlipper::Options::gui() )
return;
if ( OpenFlipper::Options::restrictFrameRate() ) {
if ( OpenFlipperSettings().value("Core/Gui/glViewer/restrictFrameRate",false).toBool() ) {
int elapsed = redrawTime_->elapsed ();
if ( elapsed < 1000 / OpenFlipper::Options::maxFrameRate() )
if ( elapsed < 1000 / OpenFlipperSettings().value("Core/Gui/glViewer/maxFrameRate",35).toInt() )
{
// redraw time not reached ... waiting for timer event for next redraw
if ( redrawTimer_->isActive() ) {
......@@ -776,7 +776,7 @@ void Core::updateView() {
}
// Start the timer
redrawTimer_->start( (1000 / OpenFlipper::Options::maxFrameRate()) - elapsed);
redrawTimer_->start( (1000 / OpenFlipperSettings().value("Core/Gui/glViewer/maxFrameRate",35).toInt() ) - elapsed);
return;
}
else if ( redrawTimer_->isActive() )
......@@ -815,17 +815,17 @@ void Core::checkScenegraphDirty() {
//-----------------------------------------------------------------------------
void Core::restrictFrameRate( bool _enable ) {
OpenFlipper::Options::restrictFrameRate( _enable );
OpenFlipperSettings().setValue("Core/Gui/glViewer/restrictFrameRate",_enable);
}
//-----------------------------------------------------------------------------
void Core::setMaxFrameRate( int _rate ) {
OpenFlipper::Options::maxFrameRate( _rate );
OpenFlipper::Options::restrictFrameRate( true );
OpenFlipperSettings().setValue("Core/Gui/glViewer/maxFrameRate",_rate);
OpenFlipperSettings().setValue("Core/Gui/glViewer/restrictFrameRate",true);
// update Timer to new framerate
scenegraphCheckTimer_->setInterval (1000 / OpenFlipper::Options::maxFrameRate());
scenegraphCheckTimer_->setInterval (1000 / OpenFlipperSettings().value("Core/Gui/glViewer/maxFrameRate",35).toInt() );
}
//-----------------------------------------------------------------------------
......
......@@ -282,20 +282,6 @@ void Core::readApplicationOptions(INIFile& _ini) {
OpenFlipper::Options::defaultViewingDirection( mode, i );
}
//============================================================================
// Load restrictFrameRate
//============================================================================
bool restrictFrameRate = false;
if( _ini.get_entry(restrictFrameRate, "Options", "RestrictFrameRate") )
OpenFlipper::Options::restrictFrameRate(restrictFrameRate);
//============================================================================
// Load maxFrameRate
//============================================================================
int maxFrameRate = 35;
if( _ini.get_entry(maxFrameRate, "Options", "MaxFrameRate") )
OpenFlipper::Options::maxFrameRate(maxFrameRate);
//============================================================================
// Load slotDebugging state
//============================================================================
......@@ -472,14 +458,6 @@ void Core::writeApplicationOptions(INIFile& _ini) {
//write default ToolboxMode
_ini.add_entry("Options","DefaultToolboxMode",OpenFlipper::Options::defaultToolboxMode() );
//============================================================================
// other
//============================================================================
// restrict Framerate
_ini.add_entry("Options","RestrictFrameRate",OpenFlipper::Options::restrictFrameRate() );
// max Framerate
_ini.add_entry("Options","MaxFrameRate",OpenFlipper::Options::maxFrameRate() );
//============================================================================
// Debugging
//============================================================================
......
......@@ -144,12 +144,6 @@ static std::vector<float> anaglyphRightEyeColors_ = std::vector<float> (9, 0.0);
/// Store the synchronization mode
static bool synchronization_ = false;
/// Store the restrictFrameRate_ mode
static bool restrictFrameRate_ = false;
/// Store the maxFrameRate_ mode
static int maxFrameRate_ = 35;
/// Store the defaultDrawMode_ mode
static std::vector<ACG::SceneGraph::DrawModes::DrawMode> defaultDrawMode_ = std::vector<ACG::SceneGraph::DrawModes::DrawMode> (4, ACG::SceneGraph::DrawModes::SOLID_SMOOTH_SHADED);
......@@ -232,12 +226,6 @@ static bool loadingRecentFile_ = false;
/// Currently saving Settings?
static bool savingSettings_ = false;
/// Enable picking renderer?
static bool renderPicking_ = false;
/// picking Renderer Mode
static QString pickingRenderMode_ = "PICK_ANYTHING";
static int* argc_;
static char *** argv_;
......@@ -496,22 +484,6 @@ bool synchronization( ) {
return synchronization_;
}
void restrictFrameRate( bool _enable ){
restrictFrameRate_ = _enable;
}
bool restrictFrameRate( ){
return restrictFrameRate_;
}
void maxFrameRate( int _fps ){
maxFrameRate_ = _fps;
}
int maxFrameRate(){
return maxFrameRate_;
}
void defaultDrawMode( ACG::SceneGraph::DrawModes::DrawMode _mode, int _viewer){
defaultDrawMode_[_viewer] = _mode;
}
......@@ -783,22 +755,6 @@ QString coreVersion() {
return QString(CORE_VERSION);
}
void pickingRenderMode( QString _target ) {
pickingRenderMode_ = _target;
}
QString pickingRenderMode( ) {
return pickingRenderMode_;
}
void renderPicking(bool _enable) {
renderPicking_ = _enable;
}
bool renderPicking( ) {
return renderPicking_;
}
bool initializeSettings() {
#if defined(__GNUC__)
......
......@@ -90,6 +90,8 @@
* * Core/Gui/glViewer/showControlWheels This setting controls if the control wheels should be visible in the glViewer (bool)
* * Core/Gui/glViewer/glMouse This setting controls if the mouse is rendered in OpenGL or in the window manager
* * Core/Gui/glViewer/stereoMousePick This setting controls if the mouse depth is picked in stereo mode
* * Core/Gui/glViewer/restrictFrameRate This setting controls if the maximum frame rate should be restricted (bool)
* * Core/Gui/glViewer/maxFrameRate If restrictFrameRate is set to yes, this setting controls the maximum frameRate used (unsigned int)
* * Core/Gui/splash This setting controls if the splash screen is shown at startup(bool)
*
* <b>File Handling</b>
......@@ -118,8 +120,8 @@
* * Core/Stereo/Philips/Select Philips stereo header select (int)\n
* \n
* <b>Rendering debugger Settings<b>\n
* * Core/Debug/Picking/RenderPicking Enable picking rendering\n
* * Core/Debug/Picking/RenderPickingMode The Mode used for picking rendering\n
* * Core/Debug/Picking/RenderPicking Enable picking rendering (bool)\n
* * Core/Debug/Picking/RenderPickingMode The Mode used for picking rendering(QString) \n
* \n
* Anaglyph stereo mode settings:\n
*/
......@@ -439,22 +441,6 @@ QString helpDirStr();
DLLEXPORT
bool synchronization( );
/// Store restrictFrameRate setting
DLLEXPORT
void restrictFrameRate( bool _enable );
/// get restrictFrameRate setting
DLLEXPORT
bool restrictFrameRate( );
/// Store maxFrameRate setting
DLLEXPORT
void maxFrameRate( int _fps );
/// get maxFrameRate setting
DLLEXPORT
int maxFrameRate( );
/// Store defaultDrawMode setting
DLLEXPORT
void defaultDrawMode( ACG::SceneGraph::DrawModes::DrawMode _mode, int _viewer );
......
......@@ -357,8 +357,8 @@ void OptionsWidget::showEvent ( QShowEvent * /*event*/ ) {
wheelBox->setChecked( OpenFlipperSettings().value("Core/Gui/glViewer/showControlWheels").toBool() );
restrictFPS->setChecked( OpenFlipper::Options::restrictFrameRate() );
FPS->setValue( OpenFlipper::Options::maxFrameRate() );
restrictFPS->setChecked( OpenFlipperSettings().value("Core/Gui/glViewer/restrictFrameRate",false).toBool() );
FPS->setValue( OpenFlipperSettings().value("Core/Gui/glViewer/maxFrameRate",35).toInt() );
QPixmap color(16,16);
color.fill( OpenFlipperSettings().value("Core/Gui/glViewer/defaultBackgroundColor").value<QColor>() );
......@@ -576,10 +576,10 @@ void OptionsWidget::slotApply() {
OpenFlipperSettings().setValue("Core/Mouse/Wheel/ZoomFactor", wZoomFactor->text().toDouble());
OpenFlipperSettings().setValue("Core/Mouse/Wheel/ZoomFactorShift", wZoomFactorShift->text().toDouble());
OpenFlipper::Options::restrictFrameRate( restrictFPS->isChecked() );
OpenFlipperSettings().setValue("Core/Gui/glViewer/showControlWheels", wheelBox->isChecked() );
OpenFlipper::Options::maxFrameRate( FPS->value() );
OpenFlipperSettings().setValue("Core/Gui/glViewer/restrictFrameRate", restrictFPS->isChecked());
OpenFlipperSettings().setValue("Core/Gui/glViewer/maxFrameRate", FPS->value() );
OpenFlipper::Options::randomBaseColor( randomBaseColor->isChecked() );
......
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