{
for ( ModuleInfoList::const_iterator it = myInfoList.begin();
it != myInfoList.end(); ++it )
- lst.append( (*it).title );
+ if ( (*it).status != stNoGui )
+ lst.append( (*it).title );
}
}
return res;
}
+/*!
+ \brief Get displayer proxy for given module, by its title (user name).
+ \param title module title (user name)
+ \return name of module which provides displayer for requested module
+ */
+QString CAM_Application::moduleDisplayer( const QString& title )
+{
+ QString res;
+ for ( ModuleInfoList::const_iterator it = myInfoList.begin(); it != myInfoList.end() && res.isEmpty(); ++it )
+ {
+ if ( (*it).title == title )
+ res = (*it).displayer;
+ }
+ return res.isEmpty() ? title : res;
+}
+
/*!
\brief Read modules information list
continue; // omit KERNEL and GUI modules
bool hasGui = resMgr->booleanValue( *it, "gui", true );
- if ( !hasGui )
- continue; // omit if module is explicitly declared as not having GUI
- QString modTitle = resMgr->stringValue( *it, "name", QString() );
- if ( modTitle.isEmpty() )
+ QString modTitle, modIcon, modLibrary;
+
+ if ( hasGui )
{
- printf( "****************************************************************\n" );
- printf( " Warning: module %s is improperly configured!\n", qPrintable(*it) );
- printf( " Module %s will not be available in GUI mode!\n", qPrintable(*it) );
- printf( "****************************************************************\n" );
- continue;
- }
+ // if module has GUI, check that it is present
+ modTitle = resMgr->stringValue( *it, "name", QString() );
+ if ( modTitle.isEmpty() )
+ {
+ printf( "****************************************************************\n" );
+ printf( " Warning: module %s is improperly configured!\n", qPrintable(*it) );
+ printf( " Module %s will not be available in GUI mode!\n", qPrintable(*it) );
+ printf( "****************************************************************\n" );
+ continue;
+ }
- QString modIcon = resMgr->stringValue( *it, "icon", QString() );
+ QString modIcon = resMgr->stringValue( *it, "icon", QString() );
- QString modLibrary = resMgr->stringValue( *it, "library", QString() ).trimmed();
- if ( !modLibrary.isEmpty() )
- {
- modLibrary = SUIT_Tools::file( modLibrary.trimmed() );
+ modLibrary = resMgr->stringValue( *it, "library", QString() ).trimmed();
+ if ( !modLibrary.isEmpty() )
+ {
+ modLibrary = SUIT_Tools::file( modLibrary.trimmed() );
#if defined(WIN32)
- QString libExt = QString( "dll" );
+ QString libExt = QString( "dll" );
#elif defined(__APPLE__)
- QString libExt = QString( "dylib" );
+ QString libExt = QString( "dylib" );
#else
- QString libExt = QString( "so" );
+ QString libExt = QString( "so" );
#endif
- if ( SUIT_Tools::extension( modLibrary ).toLower() == libExt )
- modLibrary.truncate( modLibrary.length() - libExt.length() - 1 );
+ if ( SUIT_Tools::extension( modLibrary ).toLower() == libExt )
+ modLibrary.truncate( modLibrary.length() - libExt.length() - 1 );
#ifndef WIN32
- QString prefix = QString( "lib" );
- if ( modLibrary.startsWith( prefix ) )
- modLibrary.remove( 0, prefix.length() );
+ QString prefix = QString( "lib" );
+ if ( modLibrary.startsWith( prefix ) )
+ modLibrary.remove( 0, prefix.length() );
#endif
+ }
+ else
+ modLibrary = modName;
}
- else
- modLibrary = modName;
QString version = resMgr->stringValue( *it, "version", QString() );
+ QString modDisplayer = resMgr->stringValue( *it, "displayer", QString() );
+
ModuleInfo inf;
inf.name = modName;
inf.title = modTitle;
inf.status = hasGui ? stUnknown : stNoGui;
if ( hasGui ) inf.library = modLibrary;
inf.icon = modIcon;
+ inf.displayer = modDisplayer;
inf.version = version;
myInfoList.append( inf );
}
*/
LightApp_Displayer* LightApp_Displayer::FindDisplayer( const QString& mod_name, const bool load )
{
+ QString mname = LightApp_Application::moduleDisplayer( mod_name );
SUIT_Session* session = SUIT_Session::session();
SUIT_Application* sapp = session ? session->activeApplication() : 0;
LightApp_Application* app = dynamic_cast<LightApp_Application*>( sapp );
if( !app )
return 0;
- LightApp_Module* m = dynamic_cast<LightApp_Module*>( app ? app->module( mod_name ) : 0 );
+ LightApp_Module* m = dynamic_cast<LightApp_Module*>( app ? app->module( mname ) : 0 );
bool wasLoaded = false;
if( !m && load )
{
- m = dynamic_cast<LightApp_Module*>( app->loadModule( mod_name, false ) );
- if( m ) {
+ m = dynamic_cast<LightApp_Module*>( app->loadModule( mname, false ) );
+ if( m ) {
app->addModule( m );
- wasLoaded = true;
- }
+ wasLoaded = true;
+ }
}
if( m )
{
m->connectToStudy( dynamic_cast<CAM_Study*>( app->activeStudy() ) );
- if( wasLoaded )
- m->updateModuleVisibilityState();
+ if( wasLoaded )
+ m->updateModuleVisibilityState();
}
return m ? m->displayer() : 0;
}