+bool CAM_Application::appendModuleInfo( const QString& modName )
+{
+ MESSAGE("Start to append module info for a given module name: ");
+ SCRUTE(modName.toStdString());
+
+ if ( modName.isEmpty() )
+ return false; // empty module name
+
+ if ( !moduleTitle( modName ).isEmpty() )
+ return false; // already added
+
+ if ( modName == "KERNEL" || modName == "GUI" )
+ return false; // skip KERNEL and GUI modules
+
+ // we cannot use own resourceMgr() as this method can be called from constructor
+ SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
+
+ ModuleInfo inf;
+
+ // module internal name
+ inf.name = modName;
+ // module version
+ inf.version = resMgr->stringValue( modName, "version", QString() ).trimmed();
+ // displayer, if module does not have GUI, displayer may be delegated to other module
+ inf.displayer = resMgr->stringValue( modName, "displayer", QString() ).trimmed();
+
+ // "gui" option explicitly says that module has GUI
+ // Now trying to get the "gui" option value, we always get a default one,
+ // then we can't rely on it.
+ bool hasGui = resMgr->booleanValue(modName, "gui", false);
+
+ // Additional check if the module actually has a title and icon.
+ // Module with GUI must explicitly specify title (GUI name).
+ inf.title = resMgr->stringValue(modName, "name", QString()).trimmed();
+ const bool hasTitle = !inf.title.isEmpty();
+ SCRUTE(hasGui);
+ SCRUTE(hasTitle);
+ if (hasGui && !hasTitle)
+ {
+ MESSAGE("Invalid config! The module has gui option, but doesn't have a title.");
+ return false;
+ }
+
+ // While we can't rely on gui option, use a title to make a decision about gui.
+ hasGui = hasTitle;
+
+ // status; if module has GUI, availability will be checked on activation
+ inf.status = hasGui ? stUnknown : stNoGui;
+
+ if ( hasGui )
+ {
+ // icon
+ inf.icon = resMgr->stringValue( modName, "icon", QString() ).trimmed();
+ // description, for Info panel
+ inf.description = resMgr->stringValue( modName, "description", QString() );
+ // library; if not specified, we use internal module name
+ inf.library = SUIT_Tools::libraryName( resMgr->stringValue( modName, "library", QString() ).trimmed() );
+ if ( inf.library.isEmpty() )
+ inf.library = modName;
+ }
+
+ // At this point we should have only valid inf object.
+ myInfoList.append(inf);
+
+ SCRUTE(inf.name.toStdString());
+ SCRUTE(inf.version.toStdString());
+ SCRUTE(inf.displayer.toStdString());
+ SCRUTE(inf.status);
+ SCRUTE(inf.title.toStdString());
+ SCRUTE(inf.icon.toStdString());
+ SCRUTE(inf.description.toStdString());
+ SCRUTE(inf.library.toStdString());
+
+ return true;
+}
+
+void CAM_Application::removeModuleInfo( const QString& modName )
+{
+ QMutableListIterator<ModuleInfo> it( myInfoList );
+ while ( it.hasNext() )
+ {
+ ModuleInfo info = it.next();
+ if ( info.name == modName )
+ {
+ it.remove();
+ break;
+ }
+ }
+}
+