Commit 7ab14ab7 authored by Dirk Wilden's avatar Dirk Wilden

added options to restrict framerate

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@2894 383ad7c9-94d9-4d36-a494-682f7c89f535
parent ccf3958b
......@@ -523,7 +523,7 @@ Core::slotAddHiddenPickMode( const std::string _mode , QCursor _cursor) {
/** Update the view in the examiner widget
*/
void Core::updateView() {
if ( true ) {
if ( OpenFlipper::Options::restrictFrameRate() ) {
// redraw time not reached ... waiting for timer event for next redraw
if ( redrawTimer_->isActive() ) {
......@@ -535,7 +535,7 @@ void Core::updateView() {
// Start the timer if we are not called by the timer
if ( sender() != redrawTimer_ )
redrawTimer_->start(35);
redrawTimer_->start( 1000 / OpenFlipper::Options::maxFrameRate() );
}
......
......@@ -216,6 +216,20 @@ void Core::readApplicationOptions(INIFile& _ini) {
QString logFile = "";
if( _ini.get_entry(logFile, "Options", "LogFileLocation") )
OpenFlipper::Options::logFile(logFile);
//============================================================================
// 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);
}
}
......@@ -280,6 +294,14 @@ void Core::writeApplicationOptions(INIFile& _ini) {
//write logfile location
_ini.add_entry("Options","LogFileLocation",OpenFlipper::Options::logFile() );
//============================================================================
// other
//============================================================================
// restrict Framerate
_ini.add_entry("Options","RestrictFrameRate",OpenFlipper::Options::restrictFrameRate() );
// max Framerate
_ini.add_entry("Options","MaxFrameRate",OpenFlipper::Options::maxFrameRate() );
//============================================================================
//dontLoad Plugins
//============================================================================
......
......@@ -92,6 +92,12 @@ static double wheelZoomFactor_ = 1.0;
/// Store the wheelZoomFactorShift mode
static double wheelZoomFactorShift_ = 0.2;
/// Store the restrictFrameRate_ mode
static bool restrictFrameRate_ = false;
/// Store the maxFrameRate_ mode
static int maxFrameRate_ = 35;
/// Store the toolbox gui Mode mode
static bool hideToolbox_ = false;
......@@ -343,6 +349,22 @@ double wheelZoomFactorShift( ) {
return wheelZoomFactorShift_;
}
void restrictFrameRate( bool _enable ){
restrictFrameRate_ = _enable;
}
bool restrictFrameRate( ){
return restrictFrameRate_;
}
void maxFrameRate( int _fps ){
maxFrameRate_ = _fps;
}
int maxFrameRate(){
return maxFrameRate_;
}
/// Set if we start the logging widget closed
void hideLogger( bool _hide) {
hideLogger_ = _hide;
......
......@@ -309,6 +309,22 @@ bool iconDir(QString _dir);
DLLEXPORT
double wheelZoomFactorShift( );
/// 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( );
/** @} */
//===========================================================================
......
......@@ -81,6 +81,9 @@ void OptionsWidget::showEvent ( QShowEvent * event ) {
wZoomFactor->setText( QString::number(OpenFlipper::Options::wheelZoomFactor(), 'f') );
wZoomFactorShift->setText( QString::number(OpenFlipper::Options::wheelZoomFactorShift(), 'f') );
restrictFPS->setChecked( OpenFlipper::Options::restrictFrameRate() );
FPS->setValue( OpenFlipper::Options::maxFrameRate() );
//keyBindings
keyTree->clear();
......@@ -110,6 +113,9 @@ void OptionsWidget::showEvent ( QShowEvent * event ) {
QList<QTreeWidgetItem *> plugins;
for (uint i=0; i < plugins_.size(); i++){
// if (plugins_[i].keys.count() == 0)
// continue;
plugins.append(new QTreeWidgetItem(keyTree, QStringList( plugins_[i].name )));
QList<QTreeWidgetItem *> keys;
......@@ -125,10 +131,10 @@ void OptionsWidget::showEvent ( QShowEvent * event ) {
}
keyTree->addTopLevelItems( plugins );
if (plugins.count() > 0)
keyTree->addTopLevelItems( plugins );
keyTree->resizeColumnToContents(0);
keyTree->resizeColumnToContents(1);
keyTree->setColumnWidth(0,350);
}
void OptionsWidget::slotApply() {
......@@ -148,6 +154,9 @@ void OptionsWidget::slotApply() {
OpenFlipper::Options::wheelZoomFactor( wZoomFactor->text().toDouble() );
OpenFlipper::Options::wheelZoomFactorShift( wZoomFactorShift->text().toDouble() );
OpenFlipper::Options::restrictFrameRate( restrictFPS->isChecked() );
OpenFlipper::Options::maxFrameRate( FPS->value() );
emit applyOptions();
emit saveOptions();
hide();
......
......@@ -171,90 +171,195 @@
<attribute name="title" >
<string>Viewer</string>
</attribute>
<layout class="QFormLayout" name="formLayout" >
<item row="0" column="1" >
<widget class="QCheckBox" name="backfaceCulling" >
<property name="toolTip" >
<string>Enable backface culling</string>
</property>
<property name="statusTip" >
<string>Enable backface culling</string>
</property>
<property name="text" >
<string>Backface culling</string>
</property>
</widget>
</item>
<item row="1" column="0" >
<widget class="QLabel" name="label_2" >
<property name="text" >
<string>MouseWheel Zoomfactor:</string>
</property>
</widget>
</item>
<item row="1" column="1" >
<widget class="QLineEdit" name="wZoomFactor" >
<property name="maximumSize" >
<size>
<width>100</width>
<height>16777215</height>
</size>
</property>
<property name="toolTip" >
<string>Set the factor to control the zooming with the mouse-wheel</string>
</property>
<property name="statusTip" >
<string>Set the factor to control the zooming with the mouse-wheel</string>
</property>
<property name="inputMask" >
<string>9.99; </string>
</property>
</widget>
</item>
<item row="2" column="0" >
<widget class="QLabel" name="label_3" >
<property name="text" >
<string>MouseWheel Zoomfactor (shift):</string>
</property>
</widget>
</item>
<item row="2" column="1" >
<widget class="QLineEdit" name="wZoomFactorShift" >
<property name="maximumSize" >
<size>
<width>100</width>
<height>16777215</height>
</size>
</property>
<property name="toolTip" >
<string>Set the factor to control the zooming with the mouse-wheel while the shift key is pressed</string>
</property>
<property name="statusTip" >
<string>Set the factor to control the zooming with the mouse-wheel while the shift key is pressed</string>
</property>
<property name="inputMask" >
<string>9.99; </string>
</property>
</widget>
</item>
<item row="3" column="1" >
<widget class="QComboBox" name="drawMode" >
<property name="toolTip" >
<string>Set the default drawMode for the viewer</string>
</property>
<property name="statusTip" >
<string>Set the default drawMode for the viewer</string>
</property>
</widget>
</item>
<item row="3" column="0" >
<widget class="QLabel" name="label_7" >
<property name="text" >
<string>Default DrawMode:</string>
</property>
</widget>
</item>
</layout>
<widget class="QCheckBox" name="backfaceCulling" >
<property name="geometry" >
<rect>
<x>20</x>
<y>170</y>
<width>344</width>
<height>21</height>
</rect>
</property>
<property name="toolTip" >
<string>Enable backface culling</string>
</property>
<property name="statusTip" >
<string>Enable backface culling</string>
</property>
<property name="text" >
<string>Backface culling</string>
</property>
</widget>
<widget class="QLabel" name="label_2" >
<property name="geometry" >
<rect>
<x>9</x>
<y>36</y>
<width>143</width>
<height>20</height>
</rect>
</property>
<property name="text" >
<string>MouseWheel Zoomfactor:</string>
</property>
</widget>
<widget class="QLineEdit" name="wZoomFactor" >
<property name="geometry" >
<rect>
<x>192</x>
<y>36</y>
<width>100</width>
<height>22</height>
</rect>
</property>
<property name="maximumSize" >
<size>
<width>100</width>
<height>16777215</height>
</size>
</property>
<property name="toolTip" >
<string>Set the factor to control the zooming with the mouse-wheel</string>
</property>
<property name="statusTip" >
<string>Set the factor to control the zooming with the mouse-wheel</string>
</property>
<property name="inputMask" >
<string>9.99; </string>
</property>
</widget>
<widget class="QLabel" name="label_3" >
<property name="geometry" >
<rect>
<x>9</x>
<y>64</y>
<width>177</width>
<height>20</height>
</rect>
</property>
<property name="text" >
<string>MouseWheel Zoomfactor (shift):</string>
</property>
</widget>
<widget class="QLineEdit" name="wZoomFactorShift" >
<property name="geometry" >
<rect>
<x>192</x>
<y>64</y>
<width>100</width>
<height>22</height>
</rect>
</property>
<property name="maximumSize" >
<size>
<width>100</width>
<height>16777215</height>
</size>
</property>
<property name="toolTip" >
<string>Set the factor to control the zooming with the mouse-wheel while the shift key is pressed</string>
</property>
<property name="statusTip" >
<string>Set the factor to control the zooming with the mouse-wheel while the shift key is pressed</string>
</property>
<property name="inputMask" >
<string>9.99; </string>
</property>
</widget>
<widget class="QComboBox" name="drawMode" >
<property name="geometry" >
<rect>
<x>192</x>
<y>92</y>
<width>344</width>
<height>22</height>
</rect>
</property>
<property name="toolTip" >
<string>Set the default drawMode for the viewer</string>
</property>
<property name="statusTip" >
<string>Set the default drawMode for the viewer</string>
</property>
</widget>
<widget class="QLabel" name="label_7" >
<property name="geometry" >
<rect>
<x>9</x>
<y>92</y>
<width>107</width>
<height>20</height>
</rect>
</property>
<property name="text" >
<string>Default DrawMode:</string>
</property>
</widget>
<widget class="Line" name="line_2" >
<property name="geometry" >
<rect>
<x>25</x>
<y>120</y>
<width>511</width>
<height>20</height>
</rect>
</property>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
</widget>
<widget class="QWidget" name="" >
<property name="geometry" >
<rect>
<x>20</x>
<y>140</y>
<width>219</width>
<height>24</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2" >
<item>
<widget class="QCheckBox" name="restrictFPS" >
<property name="text" >
<string>Restrict Framerate</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_4" >
<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="QSpinBox" name="FPS" >
<property name="enabled" >
<bool>false</bool>
</property>
<property name="minimum" >
<number>1</number>
</property>
<property name="maximum" >
<number>200</number>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_8" >
<property name="text" >
<string>FPS</string>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
<widget class="QWidget" name="key" >
<property name="geometry" >
......@@ -268,7 +373,7 @@
<attribute name="title" >
<string>Key Bindings</string>
</attribute>
<layout class="QHBoxLayout" name="horizontalLayout_2" >
<layout class="QVBoxLayout" name="verticalLayout_6" >
<item>
<widget class="QTreeWidget" name="keyTree" >
<column>
......@@ -434,5 +539,22 @@
</layout>
</widget>
<resources/>
<connections/>
<connections>
<connection>
<sender>restrictFPS</sender>
<signal>toggled(bool)</signal>
<receiver>FPS</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel" >
<x>115</x>
<y>187</y>
</hint>
<hint type="destinationlabel" >
<x>187</x>
<y>184</y>
</hint>
</hints>
</connection>
</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