*/
void CAM_Application::start()
{
+ // check modules
+ for ( ModuleInfoList::iterator it = myInfoList.begin();
+ it != myInfoList.end(); ++it )
+ {
+ if ( (*it).status == stUnknown )
+ (*it).status = checkModule( (*it).title ) ? stReady : stInaccessible;
+ }
+
+ // auto-load modules
if ( myAutoLoad )
loadModules();
if ( !modName.isEmpty() )
{
CAM_Module* mod = module( modName );
- if ( !mod && !moduleLibrary( modName ).isEmpty() )
- {
+ if ( !mod )
mod = loadModule( modName );
- addModule( mod );
- }
+ addModule( mod );
if ( mod )
res = activateModule( mod );
STD_Application::setActiveStudy( study );
}
+/*!
+ \brief Check module availability.
+
+ The method can be redefined in successors. Default implementation returns \c true.
+
+ \param title module title
+ \return \c true if module is accessible; \c false otherwise
+*/
+bool CAM_Application::checkModule( const QString& )
+{
+ return true;
+}
+
/*!
\brief Callback function, called when the module is added to the application.
{
bool found = false;
bool blocked = false;
+ bool statusOK = false;
QStringList somewhereLoaded;
QList<SUIT_Application*> apps = SUIT_Session::session()->applications();
{
found = (*it).title == title;
blocked = (*it).isSingleton && somewhereLoaded.contains((*it).title);
+ statusOK = (*it).status == stReady;
}
- return found && !blocked;
+ return found && statusOK && !blocked;
}
/*!
for ( ModuleInfoList::const_iterator it = myInfoList.begin(); it != myInfoList.end() && res.isEmpty(); ++it )
{
if ( (*it).title == title )
- res = (*it).internal;
+ res = (*it).library;
}
if ( !res.isEmpty() && full )
res = SUIT_Tools::library( res );
if ( !moduleTitle( modName ).isEmpty() )
continue; // already added
+ if ( modName == "KERNEL" || modName == "GUI" )
+ continue; // omit KERNEL and GUI modules
+
QString modTitle = resMgr->stringValue( *it, "name", QString() );
if ( modTitle.isEmpty() )
{
printf( "****************************************************************\n" );
- printf( "* Warning: %s GUI resources are not found.\n", qPrintable(*it) );
- printf( "* %s GUI will not be available.\n", qPrintable(*it) );
+ 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;
}
else
modLibrary = modName;
- bool aIsSingleton = resMgr->booleanValue(*it, "singleton", false);
-
- QString ver = resMgr->stringValue(*it, "version", QString());
+ bool aIsSingleton = resMgr->booleanValue( *it, "singleton", false );
+ bool hasGui = resMgr->booleanValue( *it, "gui", true );
+ QString version = resMgr->stringValue( *it, "version", QString() );
ModuleInfo inf;
inf.name = modName;
inf.title = modTitle;
- inf.internal = modLibrary;
+ inf.status = hasGui ? stUnknown : stNoGui;
+ if ( hasGui ) inf.library = modLibrary;
inf.icon = modIcon;
inf.isSingleton = aIsSingleton;
- inf.version = ver;
+ inf.version = version;
myInfoList.append( inf );
}