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() { ...@@ -585,7 +585,7 @@ Core::init() {
} }
// start checking for scenegraph changes // start checking for scenegraph changes
scenegraphCheckTimer_->setInterval (1000 / OpenFlipper::Options::maxFrameRate()); scenegraphCheckTimer_->setInterval (1000 / OpenFlipperSettings().value("Core/Gui/glViewer/maxFrameRate",35).toInt() );
scenegraphCheckTimer_->start (); scenegraphCheckTimer_->start ();
} }
...@@ -760,12 +760,12 @@ void Core::updateView() { ...@@ -760,12 +760,12 @@ void Core::updateView() {
if ( !OpenFlipper::Options::gui() ) if ( !OpenFlipper::Options::gui() )
return; return;
if ( OpenFlipper::Options::restrictFrameRate() ) { if ( OpenFlipperSettings().value("Core/Gui/glViewer/restrictFrameRate",false).toBool() ) {
int elapsed = redrawTime_->elapsed (); 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 // redraw time not reached ... waiting for timer event for next redraw
if ( redrawTimer_->isActive() ) { if ( redrawTimer_->isActive() ) {
...@@ -776,7 +776,7 @@ void Core::updateView() { ...@@ -776,7 +776,7 @@ void Core::updateView() {
} }
// Start the timer // Start the timer
redrawTimer_->start( (1000 / OpenFlipper::Options::maxFrameRate()) - elapsed); redrawTimer_->start( (1000 / OpenFlipperSettings().value("Core/Gui/glViewer/maxFrameRate",35).toInt() ) - elapsed);
return; return;
} }
else if ( redrawTimer_->isActive() ) else if ( redrawTimer_->isActive() )
...@@ -815,17 +815,17 @@ void Core::checkScenegraphDirty() { ...@@ -815,17 +815,17 @@ void Core::checkScenegraphDirty() {
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void Core::restrictFrameRate( bool _enable ) { void Core::restrictFrameRate( bool _enable ) {
OpenFlipper::Options::restrictFrameRate( _enable ); OpenFlipperSettings().setValue("Core/Gui/glViewer/restrictFrameRate",_enable);
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void Core::setMaxFrameRate( int _rate ) { void Core::setMaxFrameRate( int _rate ) {
OpenFlipper::Options::maxFrameRate( _rate ); OpenFlipperSettings().setValue("Core/Gui/glViewer/maxFrameRate",_rate);
OpenFlipper::Options::restrictFrameRate( true ); OpenFlipperSettings().setValue("Core/Gui/glViewer/restrictFrameRate",true);
// update Timer to new framerate // 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) { ...@@ -282,20 +282,6 @@ void Core::readApplicationOptions(INIFile& _ini) {
OpenFlipper::Options::defaultViewingDirection( mode, i ); 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 // Load slotDebugging state
//============================================================================ //============================================================================
...@@ -472,14 +458,6 @@ void Core::writeApplicationOptions(INIFile& _ini) { ...@@ -472,14 +458,6 @@ void Core::writeApplicationOptions(INIFile& _ini) {
//write default ToolboxMode //write default ToolboxMode
_ini.add_entry("Options","DefaultToolboxMode",OpenFlipper::Options::defaultToolboxMode() ); _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 // Debugging
//============================================================================ //============================================================================
......
...@@ -144,12 +144,6 @@ static std::vector<float> anaglyphRightEyeColors_ = std::vector<float> (9, 0.0); ...@@ -144,12 +144,6 @@ static std::vector<float> anaglyphRightEyeColors_ = std::vector<float> (9, 0.0);
/// Store the synchronization mode /// Store the synchronization mode
static bool synchronization_ = false; static bool synchronization_ = false;
/// Store the restrictFrameRate_ mode
static bool restrictFrameRate_ = false;
/// Store the maxFrameRate_ mode
static int maxFrameRate_ = 35;
/// Store the defaultDrawMode_ mode /// 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); 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; ...@@ -232,12 +226,6 @@ static bool loadingRecentFile_ = false;
/// Currently saving Settings? /// Currently saving Settings?
static bool savingSettings_ = false; static bool savingSettings_ = false;
/// Enable picking renderer?
static bool renderPicking_ = false;
/// picking Renderer Mode
static QString pickingRenderMode_ = "PICK_ANYTHING";
static int* argc_; static int* argc_;
static char *** argv_; static char *** argv_;
...@@ -496,22 +484,6 @@ bool synchronization( ) { ...@@ -496,22 +484,6 @@ bool synchronization( ) {
return 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){ void defaultDrawMode( ACG::SceneGraph::DrawModes::DrawMode _mode, int _viewer){
defaultDrawMode_[_viewer] = _mode; defaultDrawMode_[_viewer] = _mode;
} }
...@@ -783,22 +755,6 @@ QString coreVersion() { ...@@ -783,22 +755,6 @@ QString coreVersion() {
return QString(CORE_VERSION); 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() { bool initializeSettings() {
#if defined(__GNUC__) #if defined(__GNUC__)
......
...@@ -90,6 +90,8 @@ ...@@ -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/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/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/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) * * Core/Gui/splash This setting controls if the splash screen is shown at startup(bool)
* *
* <b>File Handling</b> * <b>File Handling</b>
...@@ -118,8 +120,8 @@ ...@@ -118,8 +120,8 @@
* * Core/Stereo/Philips/Select Philips stereo header select (int)\n * * Core/Stereo/Philips/Select Philips stereo header select (int)\n
* \n * \n
* <b>Rendering debugger Settings<b>\n * <b>Rendering debugger Settings<b>\n
* * Core/Debug/Picking/RenderPicking Enable picking rendering\n * * Core/Debug/Picking/RenderPicking Enable picking rendering (bool)\n
* * Core/Debug/Picking/RenderPickingMode The Mode used for picking rendering\n * * Core/Debug/Picking/RenderPickingMode The Mode used for picking rendering(QString) \n
* \n * \n
* Anaglyph stereo mode settings:\n * Anaglyph stereo mode settings:\n
*/ */
...@@ -439,22 +441,6 @@ QString helpDirStr(); ...@@ -439,22 +441,6 @@ QString helpDirStr();
DLLEXPORT DLLEXPORT
bool synchronization( ); 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 /// Store defaultDrawMode setting
DLLEXPORT DLLEXPORT
void defaultDrawMode( ACG::SceneGraph::DrawModes::DrawMode _mode, int _viewer ); void defaultDrawMode( ACG::SceneGraph::DrawModes::DrawMode _mode, int _viewer );
......
...@@ -357,8 +357,8 @@ void OptionsWidget::showEvent ( QShowEvent * /*event*/ ) { ...@@ -357,8 +357,8 @@ void OptionsWidget::showEvent ( QShowEvent * /*event*/ ) {
wheelBox->setChecked( OpenFlipperSettings().value("Core/Gui/glViewer/showControlWheels").toBool() ); wheelBox->setChecked( OpenFlipperSettings().value("Core/Gui/glViewer/showControlWheels").toBool() );
restrictFPS->setChecked( OpenFlipper::Options::restrictFrameRate() ); restrictFPS->setChecked( OpenFlipperSettings().value("Core/Gui/glViewer/restrictFrameRate",false).toBool() );
FPS->setValue( OpenFlipper::Options::maxFrameRate() ); FPS->setValue( OpenFlipperSettings().value("Core/Gui/glViewer/maxFrameRate",35).toInt() );
QPixmap color(16,16); QPixmap color(16,16);
color.fill( OpenFlipperSettings().value("Core/Gui/glViewer/defaultBackgroundColor").value<QColor>() ); color.fill( OpenFlipperSettings().value("Core/Gui/glViewer/defaultBackgroundColor").value<QColor>() );
...@@ -576,10 +576,10 @@ void OptionsWidget::slotApply() { ...@@ -576,10 +576,10 @@ void OptionsWidget::slotApply() {
OpenFlipperSettings().setValue("Core/Mouse/Wheel/ZoomFactor", wZoomFactor->text().toDouble()); OpenFlipperSettings().setValue("Core/Mouse/Wheel/ZoomFactor", wZoomFactor->text().toDouble());
OpenFlipperSettings().setValue("Core/Mouse/Wheel/ZoomFactorShift", wZoomFactorShift->text().toDouble()); OpenFlipperSettings().setValue("Core/Mouse/Wheel/ZoomFactorShift", wZoomFactorShift->text().toDouble());
OpenFlipper::Options::restrictFrameRate( restrictFPS->isChecked() );
OpenFlipperSettings().setValue("Core/Gui/glViewer/showControlWheels", wheelBox->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() ); 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