/*!
\brief Get module icon name.
- \param name module name
+ \param name module name or title
\return module icon or null QString if module is not found
*/
QString CAM_Application::moduleIcon( const QString& name )
QString res;
for ( ModuleInfoList::const_iterator it = myInfoList.begin(); it != myInfoList.end() && res.isNull(); ++it )
{
- if ( (*it).name == name )
+ if ( (*it).name == name || (*it).title == name )
res = (*it).icon;
}
return res;
}
+/*!
+ \brief Get module description.
+ \param name module name or title
+ \return module description or null QString if description is not provided in config file.
+*/
+QString CAM_Application::moduleDescription( const QString& name )
+{
+ QString res;
+ for ( ModuleInfoList::const_iterator it = myInfoList.begin(); it != myInfoList.end() && res.isNull(); ++it )
+ {
+ if ( (*it).name == name || (*it).title == name )
+ res = (*it).description;
+ }
+ return res;
+}
+
/*!
\brief Get module library name by its title (user name).
- \param title module title (user name)
+ \param title module name or title
\param full if \c true, return full library name, otherwise return its internal name
\return module library name or null QString if module is not found
*/
-QString CAM_Application::moduleLibrary( const QString& title, const bool full )
+QString CAM_Application::moduleLibrary( const QString& name, const bool full )
{
QString res;
for ( ModuleInfoList::const_iterator it = myInfoList.begin(); it != myInfoList.end() && res.isEmpty(); ++it )
{
- if ( (*it).title == title )
+ if ( (*it).name == name || (*it).title == name )
res = (*it).library;
}
if ( !res.isEmpty() && full )
QString modIcon = resMgr->stringValue( *it, "icon", QString() );
+ QString modDescription = resMgr->stringValue( *it, "description", QString() );
+
QString modLibrary = resMgr->stringValue( *it, "library", QString() ).trimmed();
if ( !modLibrary.isEmpty() )
{
inf.status = hasGui ? stUnknown : stNoGui;
if ( hasGui ) inf.library = modLibrary;
inf.icon = modIcon;
+ inf.description = modDescription;
inf.version = version;
myInfoList.append( inf );
}
static QString moduleName( const QString& );
static QString moduleTitle( const QString& );
static QString moduleIcon( const QString& );
+ static QString moduleDescription( const QString& );
static QString moduleLibrary( const QString&, const bool = true );
virtual void createEmptyStudy();
private:
enum { stUnknown = 0, stNoGui, stInaccessible, stReady };
typedef struct {
- QString name, title, icon, library, version;
+ QString name, title, icon, library, version, description;
int status;
} ModuleInfo;
typedef QList<ModuleInfo> ModuleInfoList;
loadDockWindowsState();
- if (!activeModule() && infoPanel() ) {
+ if (!activeModule() && infoPanel() )
+ {
infoPanel()->clear();
- infoPanel()->addAction( action(ModulesListId) );
+ LightApp_ModuleAction* ma = qobject_cast<LightApp_ModuleAction*>(action(ModulesListId));
+ if ( ma && ma->count() > 0 )
+ {
+ int grp = infoPanel()->addGroup( tr( "INFO_AVAILABLE_MODULES" ) );
+ foreach(QString mname, ma->modules())
+ {
+ infoPanel()->addAction( ma->moduleAction( mname ), grp );
+ if ( !moduleDescription( mname ).isEmpty() )
+ infoPanel()->addLabel( moduleDescription( mname ), grp );
+ }
+ }
}
}
{
}
+/*!
+ \brief Get number of registered modules.
+ \return modules count
+*/
+int LightApp_ModuleAction::count() const
+{
+ return modules().count();
+}
+
/*!
\brief Get list of modules.
\return modules names list
update();
}
+/*!
+ \brief Get module action.
+ \param name module name
+*/
+QAction* LightApp_ModuleAction::moduleAction( const QString& name ) const
+{
+ return mySet->moduleAction( name );
+}
+
/*!
\brief Add module into the list.
\param name module name
LightApp_ModuleAction( const QString&, const QIcon&, QObject* = 0 );
virtual ~LightApp_ModuleAction();
+ int count() const;
QStringList modules() const;
QIcon moduleIcon( const QString& ) const;
void setModuleIcon( const QString&, const QIcon& );
+ QAction* moduleAction( const QString& ) const;
+
void insertModule( const QString&, const QIcon&, const int = -1 );
void removeModule( const QString& );
<source>PREF_PY_NUM_COLUMNS</source>
<translation>Number of columns:</translation>
</message>
+ <message>
+ <source>INFO_GETTING_STARTED</source>
+ <translation>Getting started</translation>
+ </message>
+ <message>
+ <source>INFO_AVAILABLE_MODULES</source>
+ <translation>Available modules</translation>
+ </message>
</context>
<context>
<name>LightApp_Module</name>
<source>PREF_PY_NUM_COLUMNS</source>
<translation>Nombre de colonnes:</translation>
</message>
+ <message>
+ <source>INFO_GETTING_STARTED</source>
+ <translation type="unfinished">Getting started</translation>
+ </message>
+ <message>
+ <source>INFO_AVAILABLE_MODULES</source>
+ <translation type="unfinished">Available modules</translation>
+ </message>
</context>
<context>
<name>LightApp_Module</name>
<source>PREF_PY_NUM_COLUMNS</source>
<translation>列数</translation>
</message>
+ <message>
+ <source>INFO_GETTING_STARTED</source>
+ <translation type="unfinished">Getting started</translation>
+ </message>
+ <message>
+ <source>INFO_AVAILABLE_MODULES</source>
+ <translation type="unfinished">Available modules</translation>
+ </message>
</context>
<context>
<name>LightApp_Module</name>