diff --git a/Core/Core.cc b/Core/Core.cc index 1717f1d5a0221060e783732bc9b03bb777cb0604..d513b206a23e0a2bde1bec20e4bc4289bb706b3f 100644 --- a/Core/Core.cc +++ b/Core/Core.cc @@ -522,19 +522,30 @@ Core::slotAddHiddenPickMode( const std::string _mode , QCursor _cursor) { /** Update the view in the examiner widget */ void Core::updateView() { + + if ( OpenFlipper::Options::doSlotDebugging() ) { + if ( sender() != 0 ) { + if ( sender()->metaObject() != 0 ) { + emit log(LOGINFO,"updateView() called by " + QString( sender()->metaObject()->className() ) ); + } + } + } + if ( OpenFlipper::Options::restrictFrameRate() ) { // redraw time not reached ... waiting for timer event for next redraw if ( redrawTimer_->isActive() ) { -// std::cerr << "Too early for redraw!" << std::endl; + if ( OpenFlipper::Options::doSlotDebugging() ) + emit log(LOGINFO,"Too early for redraw! Delaying request from " + QString( sender()->metaObject()->className() ) ); return; } // std::cerr << "Redraw" << std::endl; // Start the timer if we are not called by the timer - if ( sender() != redrawTimer_ ) + if ( sender() != redrawTimer_ ) { redrawTimer_->start( 1000 / OpenFlipper::Options::maxFrameRate() ); + } } diff --git a/Core/ParseIni.cc b/Core/ParseIni.cc index ef576915a70fbac3cec208768f470810665f6883..322ff91a40877189731c0e0c302a68320d658729 100644 --- a/Core/ParseIni.cc +++ b/Core/ParseIni.cc @@ -118,7 +118,7 @@ void Core::readApplicationOptions(INIFile& _ini) { QString type; if (_ini.get_entry(type, "Options" , "default_DataType" )) OpenFlipper::Options::lastDataType(type); - + //============================================================================ // Splash Screen //============================================================================ @@ -237,6 +237,14 @@ void Core::readApplicationOptions(INIFile& _ini) { int maxFrameRate = 35; if( _ini.get_entry(maxFrameRate, "Options", "MaxFrameRate") ) OpenFlipper::Options::maxFrameRate(maxFrameRate); + + //============================================================================ + // Load slotDebugging state + //============================================================================ + bool doSlotDebugging = false; + if( _ini.get_entry(doSlotDebugging, "Options", "SlotDebugging") ) + OpenFlipper::Options::doSlotDebugging(doSlotDebugging); + } } @@ -286,7 +294,7 @@ void Core::writeApplicationOptions(INIFile& _ini) { // Splash Screen //============================================================================ _ini.add_entry( "Options" , "Splash" , OpenFlipper::Options::splash() ); - + //write default dataType to INI _ini.add_entry( "Options" , "default_DataType" , OpenFlipper::Options::lastDataType() ); @@ -309,6 +317,12 @@ void Core::writeApplicationOptions(INIFile& _ini) { // max Framerate _ini.add_entry("Options","MaxFrameRate",OpenFlipper::Options::maxFrameRate() ); + //============================================================================ + // Debugging + //============================================================================ + // max Framerate + _ini.add_entry("Options","SlotDebugging",OpenFlipper::Options::doSlotDebugging() ); + //============================================================================ //dontLoad Plugins //============================================================================ @@ -364,7 +378,7 @@ void Core::openIniFile(QString _filename) { emit log(LOGERR,"Failed to connect to ini file" + _filename); return; } - + if ( OpenFlipper::Options::gui() ) { coreWidget_->statusMessage( "Loading ini File " + _filename + " ..."); coreWidget_->setStatus(ApplicationStatus::BLOCKED ); @@ -438,7 +452,7 @@ void Core::openIniFile(QString _filename) { OpenFlipper::Options::openingIni(false); resetScenegraph(); - + if ( OpenFlipper::Options::gui() ) { coreWidget_->statusMessage( "Loading ini File " + _filename + " ... Done", 4000); coreWidget_->setStatus(ApplicationStatus::READY ); @@ -453,7 +467,7 @@ void Core::writeIniFile(QString _filename, bool _relativePaths) { emit log(LOGERR,"Failed to connect to _ini file" + _filename); return; } - + if ( OpenFlipper::Options::gui() ) { coreWidget_->statusMessage( "Saving ini File " + _filename + " ..."); coreWidget_->setStatus(ApplicationStatus::BLOCKED ); @@ -503,7 +517,7 @@ void Core::writeIniFile(QString _filename, bool _relativePaths) { emit iniSaveOptions( ini ); ini.disconnect(); - + if ( OpenFlipper::Options::gui() ) { coreWidget_->statusMessage( "Saving ini File " + _filename + " ... Done", 4000); coreWidget_->setStatus(ApplicationStatus::READY ); diff --git a/Core/PluginCommunication.cc b/Core/PluginCommunication.cc index 923652eb4ed7e81282d85941adb8c88ad194f18d..1cb2a00fc049e46522a2c5739aa871c0ea7c5c58 100644 --- a/Core/PluginCommunication.cc +++ b/Core/PluginCommunication.cc @@ -12,12 +12,12 @@ // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. -// +// // OpenFlipper is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. -// +// // You should have received a copy of the GNU Lesser General Public License // along with OpenFlipper. If not, see . // @@ -49,20 +49,29 @@ #include "OpenFlipper/BasePlugin/ToolboxInterface.hh" #include "OpenFlipper/BasePlugin/TextureInterface.hh" -//== IMPLEMENTATION ========================================================== +//== IMPLEMENTATION ========================================================== //======================================================================================== // === Object List Communication ======================= -//======================================================================================== - +//======================================================================================== + /** This function is called by a plugin if it changed something in the object list (source,target,...). The information is passed to all plugins. * @param _identifier Id of the updated object */ - void Core::slotObjectsListUpdated(int _identifier) { - // just inform the plugins as we dont do anything else - emit ObjectListUpdated(_identifier); - } - +void Core::slotObjectsListUpdated(int _identifier) { + if ( OpenFlipper::Options::doSlotDebugging() ) { + if ( sender() != 0 ) { + if ( sender()->metaObject() != 0 ) { + emit log(LOGINFO,"updated_objects( " + QString::number(_identifier) + " ) called by " + + QString( sender()->metaObject()->className() ) ); + } + } + } + + // just inform the plugins as we dont do anything else + emit ObjectListUpdated(_identifier); +} + /** This function is called if the active object has changed. The information is passed to all plugins. */ void Core::slotActiveObjectChanged() @@ -71,10 +80,10 @@ emit activeObjectChanged(); } - //==================================================================================== +//==================================================================================== // === Toolbox handling ================= //===================================================================================== - + /** If the Toolbox is switched the toolboxActivated function of the each plugin that has a toolbox is called by this function. */ // void @@ -82,18 +91,18 @@ // { // // Check all plugins // for ( uint i = 0 ; i < plugins.size(); ++i) { -// if (plugins[i].toolboxindex == -1) +// if (plugins[i].toolboxindex == -1) // continue; -// +// // ToolboxInterface* toolboxPlugin = qobject_cast< ToolboxInterface * >(plugins[i].plugin); // if (! toolboxPlugin) // continue; -// +// // // Call the corresponding function of the plugins // if ( _index == plugins[i].toolboxindex ) { -// toolboxPlugin->toolboxActivated(true); +// toolboxPlugin->toolboxActivated(true); // } else { -// toolboxPlugin->toolboxActivated(false); +// toolboxPlugin->toolboxActivated(false); // } // } // } @@ -107,35 +116,35 @@ * See in the documentation of the texture plugin interfaces for further detail. */ void Core::slotAddTexture( QString _textureName , QString _filename, uint _dimension) { - emit addTexture(_textureName , _filename,_dimension); + emit addTexture(_textureName , _filename,_dimension); } /** Called by a plugin if a texture has to be updated. The information is passed to all plugins. The Plugin providing the given Texture should react on this event.\n * See in the documentation of the texture plugin interfaces for further detail. */ void Core::slotUpdateTexture( QString _name , int _identifier){ - emit updateTexture(_name, _identifier); + emit updateTexture(_name, _identifier); } /** Called by a plugin if all textures should be updated. The information is passed to all plugins. All plugins providing textures should react on this event.\n * See in the documentation of the texture plugin interfaces for further detail. */ void Core::slotUpdateAllTextures( ){ - emit updateAllTextures(); + emit updateAllTextures(); } /** Called by a plugin if the parameters of a texture should be changed. The information is passed to all plugins. A Texturecontrol plugin should react on this event.\n * See in the documentation of the texture plugin interfaces for further detail. */ void Core::slotSetTextureMode(QString _textureName ,QString _mode) { - emit setTextureMode(_textureName,_mode); + emit setTextureMode(_textureName,_mode); } /** Called by a plugin if it updated a texture. The information is passed to all plugins. If a texture control plugin is available it has to react on the signal and update the visualization of the texture.\n * See in the documentation of the texture plugin interfaces for further detail. */ void Core::slotTextureUpdated( QString _textureName , int _identifier ) { - emit updatedTextures(_textureName,_identifier); + emit updatedTextures(_textureName,_identifier); } /** Called by plugins if texture mode should be switched @@ -150,8 +159,8 @@ void Core::slotSwitchTexture( QString _textureName ) { /// Called if a backup is requested by the plugins void Core::backupRequest( int _id , QString _name ) { - emit createBackup( _id , _name , nextBackupId_); - ++nextBackupId_; + emit createBackup( _id , _name , nextBackupId_); + ++nextBackupId_; } diff --git a/common/GlobalOptions.cc b/common/GlobalOptions.cc index 45e2693641dccfbb7883f95836654b4db945fea0..66fed0f797c5039ac34ea50c9fe36e9c7fb702f8 100644 --- a/common/GlobalOptions.cc +++ b/common/GlobalOptions.cc @@ -12,12 +12,12 @@ // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. -// +// // OpenFlipper is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. -// +// // You should have received a copy of the GNU Lesser General Public License // along with OpenFlipper. If not, see . // @@ -47,11 +47,11 @@ namespace OpenFlipper { namespace Options { - -/// Stores the base Path of the application + +/// Stores the base Path of the application static QDir applicationDir_; -/// Stores the base Path of the application +/// Stores the base Path of the application static QDir configDir_; /// Stores the Path to the Standard Plugins @@ -127,6 +127,9 @@ static bool logToConsole_ = false; /// Extra debug info static bool debug_ = false; +/// Slot Debugging +static bool doSlotDebugging_ = false; + /// enable logging to file static bool logFileEnabled_; @@ -150,8 +153,8 @@ static char *** argv_; const bool is64 = true; #else const bool is64 = false; -#endif - +#endif + #ifdef WIN32 const bool linux_ = false; const bool windows_ = true; @@ -164,16 +167,16 @@ bool is64bit() { return is64; }; bool is32bit() { return !is64; }; bool isLinux() { - return linux_; + return linux_; } - + bool isWindows() { return windows_; } QString lang() { - QString lang = getenv( "LANG" ) ; + QString lang = getenv( "LANG" ) ; return lang; } @@ -183,10 +186,10 @@ QString dirSeparator() { // return QString("\\"); // if (linux_) // return QString("/"); - + return QString("/"); } - + QDir applicationDir() { return applicationDir_; } QDir configDir() { return configDir_; } QDir pluginDir() { return pluginDir_; } @@ -215,19 +218,19 @@ void currentDir(QDir _dir) { currentDir_ = _dir; } void optionFiles(QStringList _list) { optionFiles_ = _list; } -bool applicationDir(QString _dir) { +bool applicationDir(QString _dir) { QDir tmp(_dir); if (tmp.exists()) { - applicationDir_ = tmp; + applicationDir_ = tmp; return true; } return false; } -bool pluginDir(QString _dir) { +bool pluginDir(QString _dir) { QDir tmp(_dir); if (tmp.exists()) { - pluginDir_ = tmp; + pluginDir_ = tmp; return true; } return false; @@ -236,43 +239,43 @@ bool pluginDir(QString _dir) { bool shaderDir(QString _dir) { QDir tmp(_dir); if (tmp.exists()) { - shaderDir_ = tmp; + shaderDir_ = tmp; return true; } return false; } -bool textureDir(QString _dir) { +bool textureDir(QString _dir) { QDir tmp(_dir); if (tmp.exists()) { - textureDir_ = tmp; + textureDir_ = tmp; return true; } return false; } -bool iconDir(QString _dir) { +bool iconDir(QString _dir) { QDir tmp(_dir); if (tmp.exists()) { - iconDir_ = tmp; + iconDir_ = tmp; return true; } return false; } -bool configDir(QString _dir) { +bool configDir(QString _dir) { QDir tmp(_dir); if (tmp.exists()) { - configDir_ = tmp; + configDir_ = tmp; return true; } return false; } -bool currentDir(QString _dir) { +bool currentDir(QString _dir) { QDir tmp(_dir); if (tmp.exists()) { - currentDir_ = tmp; + currentDir_ = tmp; return true; } return false; @@ -280,77 +283,77 @@ bool currentDir(QString _dir) { /// Get experience level Experience getExperience() { - return experienceLevel_; + return experienceLevel_; } /// Set experience level void setExperience( Experience _exp) { - experienceLevel_ = _exp; + experienceLevel_ = _exp; } /// Store if a gui should be visible or not void nogui( bool _nogui ) { - nogui_ = _nogui; + nogui_ = _nogui; } - -/// get if a gui should be visible or not + +/// get if a gui should be visible or not bool nogui( ) { - return nogui_; + return nogui_; } -/// get if a gui should be visible or not +/// get if a gui should be visible or not bool gui( ) { - return !nogui_; + return !nogui_; } /// Store stereo mode setting void stereo( bool _stereo ) { - stereo_ = _stereo; + stereo_ = _stereo; } - + /// get current stereo setting bool stereo( ) { - return stereo_; + return stereo_; } /// Store animation mode setting void animation( bool _animation ) { - animation_ = _animation; + animation_ = _animation; } - + /// get current animation setting bool animation( ) { - return animation_; + return animation_; } /// Store backfaceCulling setting void backfaceCulling( bool _backfaceCulling ) { - backfaceCulling_ = _backfaceCulling; + backfaceCulling_ = _backfaceCulling; } - + /// get backfaceCulling setting bool backfaceCulling( ) { - return backfaceCulling_; + return backfaceCulling_; } /// Store wheelZoomFactor setting void wheelZoomFactor( double _factor ) { - wheelZoomFactor_ = _factor; + wheelZoomFactor_ = _factor; } - + /// get wheelZoomFactor setting double wheelZoomFactor( ) { - return wheelZoomFactor_; + return wheelZoomFactor_; } /// Store wheelZoomFactorShift setting void wheelZoomFactorShift( double _factor ) { - wheelZoomFactorShift_ = _factor; + wheelZoomFactorShift_ = _factor; } - + /// get wheelZoomFactorShift setting double wheelZoomFactorShift( ) { - return wheelZoomFactorShift_; + return wheelZoomFactorShift_; } void restrictFrameRate( bool _enable ){ @@ -399,19 +402,19 @@ bool hideToolbox( ) { /// Start fullscreen Mode? void fullScreen( bool _fs ) { - fullScreen_ = _fs; + fullScreen_ = _fs; } /// Start fullscreen Mode? bool fullScreen( ) { - return fullScreen_; + return fullScreen_; } /// Which mode should be the default for the toolbar? QString defaultToolboxMode( ) { - return defaultToolboxMode_; + return defaultToolboxMode_; } - + /// Which mode should be the default for the toolbar? void defaultToolboxMode( QString _mode ) { defaultToolboxMode_ = _mode; @@ -419,19 +422,19 @@ void defaultToolboxMode( QString _mode ) { QString windowTitle( ) { - return title_; + return title_; } void windowTitle( QString _titel ) { - title_ = _titel; + title_ = _titel; } void splash( bool _splash ) { - splash_ = _splash; + splash_ = _splash; } - + bool splash( ) { - return splash_; + return splash_; } @@ -439,34 +442,34 @@ bool splash( ) { QString lastDataType(){ return lastDataType_; } - + /// set the last used dataType void lastDataType(QString _type){ lastDataType_ = _type; } bool scripting( ) { - return scripting_; + return scripting_; } - + void scripting(bool _status ) { - scripting_ = _status; + scripting_ = _status; } bool logToConsole( ) { - return logToConsole_; + return logToConsole_; } - + void logToConsole(bool _logToConsole ) { - logToConsole_ = _logToConsole; + logToConsole_ = _logToConsole; } bool debug() { - return debug_; + return debug_; } void debug(bool _debug ) { - debug_ = _debug; + debug_ = _debug; } void logFileEnabled(bool _enable ){ @@ -486,7 +489,7 @@ QString logFile(){ } bool backupEnabled( ) { - return enableBackup_; + return enableBackup_; } void enableBackup(bool _enableBackup ) { @@ -494,11 +497,11 @@ void enableBackup(bool _enableBackup ) { } bool openingIni( ) { - return openingIni_; + return openingIni_; } - + void openingIni(bool _openingIni ) { - openingIni_ = _openingIni; + openingIni_ = _openingIni; } int* argc() { @@ -517,6 +520,14 @@ void argv( char*** _argv) { argv_ = _argv; } +void doSlotDebugging( bool _debugging ) { + doSlotDebugging_ = _debugging; +} + +bool doSlotDebugging( ) { + return doSlotDebugging_; +} + } } diff --git a/common/GlobalOptions.hh b/common/GlobalOptions.hh index eabcbac8b59c325b52317fd044cff2e8c77449be..2c846d6c18dc3cb54637658937f8e53d329bab52 100644 --- a/common/GlobalOptions.hh +++ b/common/GlobalOptions.hh @@ -485,7 +485,7 @@ bool iconDir(QString _dir); //=========================================================================== /** @name Core parameters * @{ */ -//=========================================================================== +//=========================================================================== /// Get the argc parameter from the main application DLLEXPORT @@ -503,6 +503,24 @@ void argc( int* _argc ); DLLEXPORT void argv( char*** _argv); + + +//=========================================================================== +/** @name Debugging Options + * @{ */ +//=========================================================================== + +/** If you enable slot debugging, for some slots will be displayed who called them. + * Currently supported slots are:\n + * - updateView() + * - updated_objects( objectId ) + */ +DLLEXPORT +void doSlotDebugging( bool _debugging ); + +DLLEXPORT +bool doSlotDebugging( ); + /** @} */ } diff --git a/widgets/optionsWidget/optionsWidget.cc b/widgets/optionsWidget/optionsWidget.cc index a46eb3add1091dff62657ac0961fa9978bb19ace..11af54e66b3e5a07c8923090ea00c954ec952637 100644 --- a/widgets/optionsWidget/optionsWidget.cc +++ b/widgets/optionsWidget/optionsWidget.cc @@ -57,10 +57,10 @@ OptionsWidget::OptionsWidget(std::vector& _plugins, std::vector dm = drawModeToList( mode ); - + if (dm[0].trimmed() != ""){ QListWidgetItem* item = new QListWidgetItem(dm[0]); - + item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsUserCheckable | Qt::ItemIsSelectable); item->setCheckState(Qt::Unchecked); @@ -77,7 +77,7 @@ break; //Check the drawModes from StandardDrawMode // std::vector< QString > dm = drawModeToList( OpenFlipper::Options::standardDrawMode() ); -// +// // for (uint i=0; i < dm.size(); i++){ // QList found availDrawModes->findItems(dm[i],Qt::MatchExactly); // for(int k=0; k < found.count(); k++) @@ -119,6 +119,9 @@ void OptionsWidget::showEvent ( QShowEvent * event ) { restrictFPS->setChecked( OpenFlipper::Options::restrictFrameRate() ); FPS->setValue( OpenFlipper::Options::maxFrameRate() ); + // debugging + slotDebugging->setChecked(OpenFlipper::Options::doSlotDebugging()); + //set drawmodes @@ -202,6 +205,9 @@ void OptionsWidget::slotApply() { OpenFlipper::Options::restrictFrameRate( restrictFPS->isChecked() ); OpenFlipper::Options::maxFrameRate( FPS->value() ); + // Debugging + OpenFlipper::Options::doSlotDebugging(slotDebugging->isChecked()); + //standardDrawMode std::vector< QString > mode; @@ -209,7 +215,8 @@ void OptionsWidget::slotApply() { if (availDrawModes->item(i)->checkState() == Qt::Checked) mode.push_back( availDrawModes->item(i)->text() ); - OpenFlipper::Options::standardDrawMode( ListToDrawMode(mode) ); + std::cerr << "Optionswidget: standarddrawmode not set yet" << std::endl; +// OpenFlipper::Options::standardDrawMode( ListToDrawMode(mode) ); emit applyOptions(); emit saveOptions(); diff --git a/widgets/optionsWidget/ui_optionsWidget.ui b/widgets/optionsWidget/ui_optionsWidget.ui index 4d33dff6718446ee60f48e892ad6d13981e1003e..fead7f3588a69fe09b49b75191ddc933d998f39b 100644 --- a/widgets/optionsWidget/ui_optionsWidget.ui +++ b/widgets/optionsWidget/ui_optionsWidget.ui @@ -22,7 +22,7 @@ - 2 + 5 true @@ -32,8 +32,8 @@ 0 0 - 644 - 606 + 479 + 394 @@ -132,8 +132,8 @@ 0 0 - 644 - 606 + 479 + 394 @@ -165,7 +165,7 @@ 0 0 479 - 402 + 394 @@ -374,7 +374,7 @@ 0 0 479 - 402 + 394 @@ -397,8 +397,8 @@ 0 0 - 644 - 606 + 479 + 394 @@ -510,6 +510,61 @@ + + + Debug + + + + + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Arial'; font-size:11pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Print information about plugins calling specific slots<br />Currently supported slots:<br />- updateView()</p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">- updated_objects( id )</p></body></html> + + + Print information about plugins calling specific slots + + + Enable slot debugging + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + Qt::Vertical + + + + 20 + 340 + + + + + +