Commit a4ccee0e authored by Mathieu Faverge's avatar Mathieu Faverge

Factorize fill_table

parent 5f4a26b3
This diff is collapsed.
......@@ -79,7 +79,15 @@ private:
/*!
* \brief Fill the state table with the states and theirs colors depending on the palette set.
*/
void fill_table(const std::string &palette_name);
void fill_table(QTableWidget *table,
const char *slot,
const std::string pname,
const std::string &palette_name );
void fill_table_states( const std::string &palette_name );
void fill_table_events( const std::string &palette_name );
void fill_table_links( const std::string &palette_name );
/*!
* \brief Reload the general tab.
......
......@@ -884,6 +884,56 @@ void Trace::get_states_colors(map<string, Color * > &nc_map, Container *parent)
}
}
}
void Trace::get_events_colors(map<string, Color * > &nc_map) {
map<Name, EventType *>::const_iterator it;
for(it = _event_types.begin();
it != _event_types.end() ; ++ it)
{
Color *color = NULL;
if( (it->second->get_extra_fields() != NULL) &&
(it->second->get_extra_fields()->find(string("Color")) != it->second->get_extra_fields()->end()) )
{
color = (Color *)( it->second->get_extra_fields()->find(string("Color"))->second );
}
else {
color = new Color();
}
nc_map[ it->first.get_name() ] = color;
}
}
void Trace::get_links_colors(map<string, Color * > &nc_map) {
map<Name, LinkType *>::const_iterator it;
for(it = _link_types.begin();
it != _link_types.end() ; ++ it)
{
Color *color = NULL;
if( (it->second->get_extra_fields() != NULL) &&
(it->second->get_extra_fields()->find(string("Color")) != it->second->get_extra_fields()->end()) )
{
color = (Color *)( it->second->get_extra_fields()->find(string("Color"))->second );
}
else {
color = new Color();
}
nc_map[ it->first.get_name() ] = color;
}
}
void Trace::get_colors(const string type, map<string, Color * > &nc_map) {
if (type == "palette")
get_states_colors( nc_map );
else if (type == "event_types")
get_events_colors( nc_map );
else if (type == "link_types")
get_links_colors( nc_map );
}
/* Fill name_map with the names of the state contained in sub-tree node */
void get_state_names_colors_list(map<string, Color *> &name_map, Node<StateChange> *node) {
if (!node)
......
......@@ -468,6 +468,10 @@ public :
void get_all_variables(std::map<std::string, Variable *> &map_to_fill);
void get_states_colors(std::map<std::string, Color * > &, Container *parent = NULL);
void get_events_colors(std::map<std::string, Color * > &nc_map);
void get_links_colors(std::map<std::string, Color * > &nc_map);
void get_colors(const std::string type, std::map<std::string, Color * > &nc_map);
/*!
* \fn load_config_from_xml(QString filename)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment