Skip to content
Snippets Groups Projects
Commit 4e5013bb authored by Cyrille Valladeau's avatar Cyrille Valladeau
Browse files

ENH: Qt view refactoring

parent 832cf19e
No related branches found
No related tags found
No related merge requests found
...@@ -172,7 +172,7 @@ QWidget* QtWidgetView::CreateDoc() ...@@ -172,7 +172,7 @@ QWidget* QtWidgetView::CreateDoc()
void QtWidgetView::SetDocParameters( std::string & val ) void QtWidgetView::SetDocParameters( std::string & val )
{ {
const std::vector<std::string> appKeyList = m_Application->GetParametersKeys( false ); //true ); const std::vector<std::string> appKeyList = m_Application->GetParametersKeys( false );
const unsigned int nbOfParam = appKeyList.size(); const unsigned int nbOfParam = appKeyList.size();
itk::OStringStream oss; itk::OStringStream oss;
...@@ -180,65 +180,60 @@ void QtWidgetView::SetDocParameters( std::string & val ) ...@@ -180,65 +180,60 @@ void QtWidgetView::SetDocParameters( std::string & val )
// Mandatory parameters // Mandatory parameters
oss << "<h4>Mandatory parameters</h4>"; oss << "<h4>Mandatory parameters</h4>";
std::string paramDocs("");
for( unsigned int i=0; i<nbOfParam; i++ )
{ this->GetDocParameters( paramDocs, true );
Parameter::Pointer param = m_Application->GetParameterByKey( appKeyList[i] ); oss<<paramDocs;
// Check if mandatory parameter are present and have value
if( param->GetMandatory() == true ) paramDocs ="";
{
if( m_Application->GetParameterType(appKeyList[i]) != ParameterType_Group )
{
oss << "<i>" << param->GetName() << ":</i><br />";
oss << param->GetDescription()<< "<br />";
oss << "<br />";
}
else
{
oss << "<b><i>=== "<<param->GetName()<<"</i></b> ("<<param->GetDescription()<<")<br />";
std::string grDoc;
GetDocParameterGroup( grDoc, appKeyList[i], 1);
oss<<grDoc;
}
}
}
// Optional parameters // Optional parameters
oss << "<h4>Optional parameters</h4>"; oss << "<h4>Optional parameters</h4>";
oss << "<body><li>"; oss << "<body><li>";
bool found = false;
for( unsigned int i=0; i<nbOfParam; i++ ) this->GetDocParameters( paramDocs, false );
{
Parameter::Pointer param = m_Application->GetParameterByKey( appKeyList[i] ); oss<<paramDocs;
// Check if mandatory parameter are present and have value
if( param->GetMandatory() == false )
{
if( m_Application->GetParameterType(appKeyList[i]) )
{
oss << "<i>" << param->GetName() << ":</i><br />";
oss << param->GetDescription()<< "<br />";
oss << "<br />";
found = true;
}
else
{
oss << "<b><i>=== "<<param->GetName()<<"</i></b> ("<<param->GetDescription()<<"):<br />";
std::string grDoc;
GetDocParameterGroup( grDoc, appKeyList[i], 1);
oss<<grDoc;
found = true;
}
}
}
if( !found )
oss << "None";
val.append(oss.str()); val.append(oss.str());
} }
void QtWidgetView::GetDocParameters( std::string & val, bool mandatory)
{
itk::OStringStream oss;
const std::vector<std::string> appKeyList = m_Application->GetParametersKeys( false );
const unsigned int nbOfParam = appKeyList.size();
std::string paramDocs("");
for( unsigned int i=0; i<nbOfParam; i++ )
{
const std::string key(appKeyList[i]);
Parameter::Pointer param = m_Application->GetParameterByKey( key );
if( param->GetMandatory() == mandatory )
{
if( m_Application->GetParameterType(key) != ParameterType_Group )
{
oss << "<i>" << param->GetName() << ":</i><br />";
oss << param->GetDescription()<< "<br />";
oss << "<br />";
}
else
{
oss << "<b><i>=== "<<param->GetName()<<"</i></b> ("<<param->GetDescription()<<"):<br />";
std::string grDoc;
GetDocParameterGroup( grDoc, key, 1);
oss<<grDoc;
}
}
}
if( oss.str() == "" )
oss << "None";
val = oss.str();
}
void QtWidgetView::GetDocParameterGroup( std::string & val, const std::string & key, int level ) void QtWidgetView::GetDocParameterGroup( std::string & val, const std::string & key, int level )
{ {
std::string spaces, equals; std::string spaces, equals;
......
...@@ -65,6 +65,9 @@ private: ...@@ -65,6 +65,9 @@ private:
/** Add the parameter description in the flux of the documentation tab. */ /** Add the parameter description in the flux of the documentation tab. */
void SetDocParameters( std::string & val ); void SetDocParameters( std::string & val );
/** Get the parameter description of one parameter. */
void GetDocParameters( std::string & val, bool mandatory );
/** generate the documentation associated to a group.*/ /** generate the documentation associated to a group.*/
void GetDocParameterGroup( std::string & val, const std::string & key, int level); void GetDocParameterGroup( std::string & val, const std::string & key, int level);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment