00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055 #include "Core.hh"
00056
00057 #include <QToolBox>
00058
00059 #include "OpenFlipper/BasePlugin/BaseInterface.hh"
00060 #include "OpenFlipper/BasePlugin/ToolboxInterface.hh"
00061 #include "OpenFlipper/BasePlugin/TextureInterface.hh"
00062
00063 #include "OpenFlipper/BasePlugin/PluginFunctionsCore.hh"
00064
00065
00066
00067
00068
00069
00070
00074 void Core::slotObjectUpdated(int _identifier, UpdateType _type) {
00075 if ( OpenFlipper::Options::doSlotDebugging() ) {
00076 if ( sender() != 0 ) {
00077 if ( sender()->metaObject() != 0 ) {
00078 emit log(LOGINFO,"updatedObject( " + QString::number(_identifier) + ", " + updateTypeName(_type)
00079 + tr(" ) called by ") + QString( sender()->metaObject()->className() ) );
00080 }
00081 } else {
00082 emit log(LOGINFO,"updatedObject( " + QString::number(_identifier) + ", " + updateTypeName(_type) + tr(" ) called by Core") );
00083 }
00084 }
00085
00086
00087 OpenFlipper::Options::redrawDisabled(true);
00088
00089
00090 BaseObject* object = 0;
00091 if ( _identifier != -1 ) {
00092 if ( !PluginFunctions::getObject(_identifier,object) ) {
00093 emit log(LOGERR,tr("updated_objects called for non existing object with id : ") + QString::number(_identifier) );
00094 return;
00095 }
00096 }
00097
00098
00099 emit signalObjectUpdated(_identifier);
00100
00101 if ( object != 0 )
00102 object->update(_type);
00103
00104
00105 OpenFlipper::Options::redrawDisabled(false);
00106
00107
00108
00109 resetScenegraph(false);
00110
00111 updateView();
00112 }
00113
00114 void Core::slotVisibilityChanged( int _id ) {
00115
00116
00117 emit visibilityChanged( _id );
00118
00119
00120 resetScenegraph(false);
00121
00122 updateView();
00123 }
00124
00127 void Core::slotObjectSelectionChanged( int _id )
00128 {
00129
00130 emit objectSelectionChanged(_id);
00131
00132 updateView();
00133 }
00134
00135 void Core::slotObjectPropertiesChanged( int _id )
00136 {
00137 emit objectPropertiesChanged(_id);
00138 }
00139
00140
00141
00142
00143
00144
00148 void Core::slotAddTexture( QString _textureName , QString _filename, uint _dimension, int _id) {
00149 if ( OpenFlipper::Options::doSlotDebugging() ) {
00150 if ( sender() != 0 ) {
00151 if ( sender()->metaObject() != 0 ) {
00152 emit log(LOGINFO,"addTexture( " + _textureName + "," + _filename + "," + QString::number(_dimension) + ", " + QString::number(_id) + tr(" ) called by ") +
00153 QString( sender()->metaObject()->className() ) );
00154 }
00155 } else {
00156 emit log(LOGINFO,"addTexture( " + _textureName + "," + _filename + "," + QString::number(_dimension) + ", " + QString::number(_id) + tr(" ) called by Core") );
00157 }
00158 }
00159
00160 emit addTexture(_textureName , _filename,_dimension,_id);
00161 }
00162
00166 void Core::slotAddTexture( QString _textureName , QString _filename, uint _dimension) {
00167
00168 if ( OpenFlipper::Options::doSlotDebugging() ) {
00169 if ( sender() != 0 ) {
00170 if ( sender()->metaObject() != 0 ) {
00171 emit log(LOGINFO,"slotAddTexture( " + _textureName + "," + _filename + "," + QString::number(_dimension) + tr(" ) called by ") +
00172 QString( sender()->metaObject()->className() ) );
00173 }
00174 } else {
00175 emit log(LOGINFO,"slotAddTexture( " + _textureName + "," + _filename + "," +", " + QString::number(_dimension) + tr(" ) called by Core") );
00176 }
00177 }
00178
00179 emit addTexture(_textureName , _filename,_dimension);
00180 }
00181
00185 void Core::slotUpdateTexture( QString _name , int _identifier){
00186
00187 if ( OpenFlipper::Options::doSlotDebugging() ) {
00188 if ( sender() != 0 ) {
00189 if ( sender()->metaObject() != 0 ) {
00190 emit log(LOGINFO,"slotUpdateTexture( " + _name + " , " + QString::number(_identifier) + tr(" ) called by ") +
00191 QString( sender()->metaObject()->className() ) );
00192 }
00193 }
00194 }
00195
00196 emit updateTexture(_name, _identifier);
00197 }
00198
00199
00200 void Core::slotMultiTextureAdded( QString _textureGroup , QString _name , QString _filename , int _id , int& _textureId ) {
00201
00202 if ( OpenFlipper::Options::doSlotDebugging() ) {
00203 if ( sender() != 0 ) {
00204 if ( sender()->metaObject() != 0 ) {
00205 emit log(LOGINFO,"slotMultiTextureAdded( " + _textureGroup + ", " + _name + "," + _filename + "," + QString::number(_id) + tr(" ) called by ") +
00206 QString( sender()->metaObject()->className() ) );
00207 }
00208 } else {
00209 emit log(LOGINFO,"slotMultiTextureAdded( " + _textureGroup + ", " + _name + "," + _filename + "," + QString::number(_id) + tr(" ) called by Core") );
00210 }
00211 }
00212
00213 emit addMultiTexture( _textureGroup , _name , _filename , _id , _textureId );
00214 }
00215
00219 void Core::slotUpdateAllTextures( ){
00220 emit updateAllTextures();
00221 }
00222
00226 void Core::slotSetTextureMode(QString _textureName, QString _mode, int _id) {
00227
00228 if ( OpenFlipper::Options::doSlotDebugging() ) {
00229 if ( sender() != 0 ) {
00230 if ( sender()->metaObject() != 0 ) {
00231 emit log(LOGINFO,"slotSetTextureMode( " + _textureName + " , " + _mode + " , " + QString::number(_id) + tr(" ) called by ") +
00232 QString( sender()->metaObject()->className() ) );
00233 }
00234 }
00235 }
00236
00237 emit setTextureMode(_textureName,_mode,_id);
00238 }
00239
00243 void Core::slotSetTextureMode(QString _textureName ,QString _mode) {
00244
00245 if ( OpenFlipper::Options::doSlotDebugging() ) {
00246 if ( sender() != 0 ) {
00247 if ( sender()->metaObject() != 0 ) {
00248 emit log(LOGINFO,"slotSetTextureMode( " + _textureName + " , " + _mode + tr(" ) called by ") +
00249 QString( sender()->metaObject()->className() ) );
00250 }
00251 }
00252 }
00253
00254 emit setTextureMode(_textureName,_mode);
00255 }
00256
00260 void Core::slotTextureUpdated( QString _textureName , int _identifier ) {
00261 if ( OpenFlipper::Options::doSlotDebugging() ) {
00262 if ( sender() != 0 ) {
00263 if ( sender()->metaObject() != 0 ) {
00264 emit log(LOGINFO,"slotTextureUpdated( " + _textureName + " , " + QString::number(_identifier) + tr(" ) called by ") +
00265 QString( sender()->metaObject()->className() ) );
00266 }
00267 }
00268 }
00269 emit updatedTextures(_textureName,_identifier);
00270 }
00271
00274 void Core::slotSwitchTexture( QString _textureName, int _id ) {
00275 emit switchTexture(_textureName, _id);
00276 }
00277
00280 void Core::slotSwitchTexture( QString _textureName ) {
00281 emit switchTexture(_textureName);
00282 }
00283
00284
00287 void Core::slotTextureChangeImage( QString _textureName , QImage& _image ) {
00288 emit textureChangeImage( _textureName ,_image );
00289 }
00290
00293 void Core::slotTextureChangeImage( QString _textureName , QImage& _image , int _id ) {
00294 emit textureChangeImage( _textureName , _image , _id );
00295 }
00296
00297
00298
00299
00300
00302 void Core::backupRequest( int _id , QString _name ) {
00303 emit createBackup( _id , _name , nextBackupId_);
00304 ++nextBackupId_;
00305 }
00306
00307
00308
00309
00310
00312 void Core::newObject(int _objectId) {
00313
00314 BaseObject* baseObject = 0;
00315 PluginFunctions::getObject(_objectId,baseObject);
00316
00317 if ( baseObject ) {
00318 connect( baseObject, SIGNAL(visibilityChanged(int)), this, SLOT(slotVisibilityChanged(int)), Qt::DirectConnection) ;
00319 connect( baseObject, SIGNAL(objectSelectionChanged(int)), this, SLOT(slotObjectSelectionChanged(int)), Qt::DirectConnection );
00320 connect( baseObject, SIGNAL(objectPropertiesChanged(int)), this, SLOT(slotObjectPropertiesChanged(int)), Qt::DirectConnection );
00321 } else {
00322 emit log(LOGERR,tr("newObject received from objectManager with invalid id! This should not happen. The new Object will not work correctly!"));
00323 }
00324
00325 }
00326
00328 void Core::deletedObject(int _objectId) {
00329 }
00330
00331
00332
00333
00334
00335