Make loadEffect() return bool

svn path=/trunk/KDE/kdebase/workspace/; revision=690381
This commit is contained in:
Rivo Laks 2007-07-20 21:13:10 +00:00
parent e96e352513
commit da0450f67f
2 changed files with 9 additions and 7 deletions

View file

@ -613,7 +613,7 @@ void EffectsHandlerImpl::toggleEffect( const QString& name )
loadEffect( name ); loadEffect( name );
} }
void EffectsHandlerImpl::loadEffect( const QString& name ) bool EffectsHandlerImpl::loadEffect( const QString& name )
{ {
Workspace::self()->addRepaintFull(); Workspace::self()->addRepaintFull();
assert( current_paint_screen == 0 ); assert( current_paint_screen == 0 );
@ -630,7 +630,7 @@ void EffectsHandlerImpl::loadEffect( const QString& name )
if( (*it).first == name ) if( (*it).first == name )
{ {
kDebug( 1212 ) << "EffectsHandler::loadEffect : Effect already loaded : " << name << endl; kDebug( 1212 ) << "EffectsHandler::loadEffect : Effect already loaded : " << name << endl;
return; return true;
} }
} }
@ -643,14 +643,14 @@ void EffectsHandlerImpl::loadEffect( const QString& name )
if(offers.isEmpty()) if(offers.isEmpty())
{ {
kError( 1212 ) << k_funcinfo << "Couldn't find effect " << name << endl; kError( 1212 ) << k_funcinfo << "Couldn't find effect " << name << endl;
return; return false;
} }
KSharedPtr<KService> service = offers.first(); KSharedPtr<KService> service = offers.first();
KLibrary* library = findEffectLibrary( service.data() ); KLibrary* library = findEffectLibrary( service.data() );
if( !library ) if( !library )
{ {
return; return false;
} }
QString supported_symbol = "effect_supported_" + name; QString supported_symbol = "effect_supported_" + name;
@ -665,14 +665,14 @@ void EffectsHandlerImpl::loadEffect( const QString& name )
{ {
kWarning( 1212 ) << "EffectsHandler::loadEffect : Effect " << name << " is not supported" << endl; kWarning( 1212 ) << "EffectsHandler::loadEffect : Effect " << name << " is not supported" << endl;
library->unload(); library->unload();
return; return false;
} }
} }
if(!create_func) if(!create_func)
{ {
kError( 1212 ) << "EffectsHandler::loadEffect : effect_create function not found" << endl; kError( 1212 ) << "EffectsHandler::loadEffect : effect_create function not found" << endl;
library->unload(); library->unload();
return; return false;
} }
typedef Effect* (*t_createfunc)(); typedef Effect* (*t_createfunc)();
t_createfunc create = reinterpret_cast<t_createfunc>(create_func); t_createfunc create = reinterpret_cast<t_createfunc>(create_func);
@ -682,6 +682,8 @@ void EffectsHandlerImpl::loadEffect( const QString& name )
effect_order.insert( service->property( "X-Ordering" ).toInt(), EffectPair( name, e )); effect_order.insert( service->property( "X-Ordering" ).toInt(), EffectPair( name, e ));
effectsChanged(); effectsChanged();
effect_libraries[ name ] = library; effect_libraries[ name ] = library;
return true;
} }
void EffectsHandlerImpl::unloadEffect( const QString& name ) void EffectsHandlerImpl::unloadEffect( const QString& name )

View file

@ -111,7 +111,7 @@ class EffectsHandlerImpl : public EffectsHandler
void grabbedKeyboardEvent( QKeyEvent* e ); void grabbedKeyboardEvent( QKeyEvent* e );
bool hasKeyboardGrab() const; bool hasKeyboardGrab() const;
void loadEffect( const QString& name ); bool loadEffect( const QString& name );
void toggleEffect( const QString& name ); void toggleEffect( const QString& name );
void unloadEffect( const QString& name ); void unloadEffect( const QString& name );
void reloadEffect( const QString& name ); void reloadEffect( const QString& name );