GraphTool  1.0
Tool for analyzing and graphically visualizing code dependencies for Ericsson.
 All Classes Namespaces Functions Variables Typedefs Enumerations Pages
Public Types | Public Slots | Signals | Public Member Functions | List of all members
MainController Class Reference

#include <main_controller.h>

Inheritance diagram for MainController:
Inheritance graph
[legend]
Collaboration diagram for MainController:
Collaboration graph
[legend]

Public Types

typedef SWUGraphBuilder GraphBuilder
 Typedefs to make the application more generalized.
 
typedef SWUGraphModel GraphModel
 
typedef GraphBuilder::GraphType GraphType
 

Public Slots

void search (std::string search_term, std::string search_type)
 
bool expand_item (std::string expand_item_, bool last, bool emit=true, bool update_focus=false, bool recursively=false)
 
bool contract_item (std::string item_name, bool last, bool emit=true)
 Contract an item, that is remove it from expanded items. More...
 
void focus_item (std::string item_name)
 
void exclude_item (std::string item_name, bool last)
 
void remove_pre_filter (std::string filter_name, bool last=true)
 
void remove_post_filter (std::string filter_name, bool last=true)
 
void insert_pre_filter (std::string name, std::string type, bool hide, bool inverted_b, bool enabled, std::string color, std::string opacity, std::map< std::string, std::string > params, bool last)
 
void insert_post_filter (std::string name, std::string type, bool hide, bool inverted_b, bool enabled, std::string color, std::string opacity, std::map< std::string, std::string > params, bool last)
 
void update_pre_filter (std::string name, std::string type, bool hide, bool inverted_b, bool enabled, std::string color, std::string opacity, std::map< std::string, std::string > params, bool last)
 
void update_post_filter (std::string name, std::string type, bool hide, bool inverted_b, bool enabled, std::string color, std::string opacity, std::map< std::string, std::string > params, bool last)
 
void reset_all_pre_filters ()
 
void reset_all_post_filters ()
 

Signals

void graphChanged (std::string focus_node="", bool reset_zoom=false)
 
void unknownItem (std::string item_name)
 
void graphEmpty ()
 
void duplicateFilterName (std::string filter_name)
 
void invalidFilterName (std::string filter_name)
 
void postFilterModelChanged ()
 
void preFilterModelChanged ()
 

Public Member Functions

 MainController ()
 
virtual ~MainController ()
 
std::vector< std::string > excluded_nodes ()
 
QStringList get_run_blocks ()
 
bool was_any_node_focused ()
 
void reinclude_excluded_node (std::string name)
 
void reinclude_all_excluded_nodes ()
 
void undo_focused ()
 
void add_to_focused (std::string name)
 
void load_from_xml (std::string file_name)
 
void load_diff_from_xml (std::string file_name)
 
bool save_to_graphviz (std::string file_name)
 
GraphModelgraphModel ()
 
GraphModeltreeModel (bool dependents, bool dependencies)
 
GraphModelemptyModel ()
 
GraphModelfullModel ()
 
bool is_expanded (std::string item_name)
 
bool has_item (std::string item_name)
 
bool has_pre_layout_filters ()
 
bool has_post_layout_filters ()
 Check if it has pre layout filters. More...
 
void set_linkler (Linkler *linkler, bool free=true)
 
unsigned int num_nodes ()
 
GraphType::node_value_type item (std::string name)
 
std::string focus_item () const
 
int graph_width () const
 Get graph width. More...
 
int graph_height () const
 Get graph height. More...
 
void set_dependents (bool dependents)
 
void set_dependencies (bool dependencies)
 
void set_layout_type (std::string layout_type, bool relayout=true)
 
void import_filters (std::string file_path, bool clear=true)
 
void export_filters (std::string file_path)
 
void import_conditional_formattings (std::string file_path, bool clear=true)
 
void export_conditional_formattings (std::string file_path)
 
GraphFilterList< GraphType > & pre_filters ()
 
GraphFilterList< GraphType > & post_filters ()
 
QStandardItemModel * post_filter_model ()
 
QStandardItemModel * pre_filter_model ()
 

Detailed Description

The main controller class for the QT user interface of GraphTool. This controller class is used to drive the user interface. Primarily it is concerned with building and reconstructing the data model (graph model) on the basis of user interface actions.

Constructor & Destructor Documentation

MainController::MainController ( )

Constructor for the MainController

MainController::~MainController ( )
virtual

Destructor for the MainController

Member Function Documentation

void MainController::add_to_focused ( std::string  name)

Method for adding the currently focused node to a list of focused nodes(used for undoing focus)

Parameters
nameThe name of the node currently focused
bool MainController::contract_item ( std::string  item_name,
bool  last,
bool  emit = true 
)
slot

Contract an item, that is remove it from expanded items.

Slot used to conract a previously expanded item. Will emit the signal graphChanged based on whether emit = true and last = true.

Parameters
item_nameThe name of the item to contract
lastWhether this is the last contraction or more are coming
emitWhether or not to emit an update signal
void MainController::duplicateFilterName ( std::string  filter_name)
signal
Parameters
filter_name
MainController::GraphModel * MainController::emptyModel ( )

Provides an empty model on the basis of the current graph

Returns
A reference to a empty model
void MainController::exclude_item ( std::string  item_name,
bool  last 
)
slot

Slot for excluding items from the graph

Parameters
item_nameThe name of the item to be excluded
lastTrue if it is the last item to be excluded, false if not
std::vector< std::string > MainController::excluded_nodes ( )

An accessor method for the nodes currently excluded by the graph in the node exclusion filter

Returns
A list of the nodes currently excluded in the graph
bool MainController::expand_item ( std::string  expand_item_,
bool  last,
bool  emit = true,
bool  update_focus = false,
bool  recursively = false 
)
slot

Slot for expanding a certain item in the graph

Parameters
expand_itemThe name of the item to be expanded
lastTrue if it is the last item to be expanded, false if not
emitTrue(default) if it should emit the signal graphChanged(), false if it should not.
update_focusTrue if it should update the focus, false(default) if it should not
Returns
True if it succeded in expanding the item, false if not
void MainController::export_conditional_formattings ( std::string  file_path)
Parameters
file_path
void MainController::export_filters ( std::string  file_path)

Export the current list of filters to file with path file_path

Parameters
file_path
std::string MainController::focus_item ( ) const

Accessor for the name of the item currently being focused(used as root) in the graph

Returns
The name of the item currently being focused
void MainController::focus_item ( std::string  item_name)
slot

Slot for changing the current focus

Parameters
item_nameThe name of the item to be focused on
MainController::GraphModel * MainController::fullModel ( )

Provides a full model of the graph

Returns
A full model of the graph
QStringList MainController::get_run_blocks ( )

Accessor to the names of all run blocks in the graph

Returns
A list of all the run blocks in the graph
int MainController::graph_height ( ) const

Get graph height.

Accessor for the height of the graph

Returns
The height of the graph
int MainController::graph_width ( ) const

Get graph width.

Accessor for the width of the graph

Returns
The width of the graph
void MainController::graphChanged ( std::string  focus_node = "",
bool  reset_zoom = false 
)
signal
Parameters
focus_nodeThe node to focus on in the graph, ie. center in the graph
reset_zoomWhether to reset zoom or not
MainController::GraphModel * MainController::graphModel ( )

Fetch a model of the current graph

Returns
A reference to the model of the current graph
bool MainController::has_item ( std::string  item_name)

Check if an item exists in the current graph

Parameters
item_nameThe name of the item to check for
Returns
True if the item existed, false if not
bool MainController::has_post_layout_filters ( )

Check if it has pre layout filters.

Accessor for checking if there are any conditional formattings

Returns
True if there are conditional formattings, false if not
bool MainController::has_pre_layout_filters ( )

Accessor for checking if there are any filters

Returns
True if there are filters, false if not
void MainController::import_conditional_formattings ( std::string  file_path,
bool  clear = true 
)
Parameters
file_path
clear
void MainController::import_filters ( std::string  file_path,
bool  clear = true 
)
Parameters
file_path
clear
void MainController::insert_post_filter ( std::string  name,
std::string  type,
bool  hide,
bool  inverted_b,
bool  enabled,
std::string  color,
std::string  opacity,
std::map< std::string, std::string >  params,
bool  last 
)
slot

Slot for creating a conditional formatting from a set of conditional formatting params and inserting it into the conditional formatting set

Parameters
nameThe name of the conditional formatting
typeThe type of the conditional formatting
hideTrue if the conditional formatting should hide matches, false if not
inverted_bTrue if the conditional formatting should be inverted, false if not
enabledTrue if the conditional formatting should be enabled, false if not
colorA string representing the color, if applicable.
opacityA string representing the opacity, if applicable.
paramsA set of conditional formatting type specific params
lastTrue if this is the last conditional formatting to be inserted(right now), false if not
void MainController::insert_pre_filter ( std::string  name,
std::string  type,
bool  hide,
bool  inverted_b,
bool  enabled,
std::string  color,
std::string  opacity,
std::map< std::string, std::string >  params,
bool  last 
)
slot

Slot for creating a filter from a set of filter params and inserting it into the filter set

Parameters
nameThe name of the filter
typeThe type of the filter
hideTrue if the filter should hide matches, false if not
inverted_bTrue if the filter should be inverted, false if not
enabledTrue if the filter should be enabled, false if not
colorA string representing the color, if applicable.
opacityA string representing the opacity, if applicable.
paramsA set of filter type specific params
lastTrue if this is the last filter to be inserted(right now), false if not
void MainController::invalidFilterName ( std::string  filter_name)
signal
Parameters
filter_name
bool MainController::is_expanded ( std::string  item_name)

Whether or not a given item is expanded

Parameters
Providethe node name for which to check if it is expanded or not
MainController::GraphType::node_value_type MainController::item ( std::string  name)

Accessor for getting specific node items from the builder holding the item

Parameters
nameThe name of the item to fetch
Returns
If found then the item itself, otherwise null.
void MainController::load_diff_from_xml ( std::string  file_name)

Load a new graph from XML stored in file_name and create a diff between the new and the old graph

Parameters
file_nameThe name of the file to be loaded

Clear previous static diff filters

void MainController::load_from_xml ( std::string  file_name)

Load a new graph from XML stored in file_name

Parameters
file_nameThe name of the file to be loaded
unsigned int MainController::num_nodes ( )

Accessor for the amount of nodes currently in the graph

Returns
The amount of nodes in the graph
QStandardItemModel * MainController::post_filter_model ( )

Accessor for the filter model

Returns
The model used by the filters
GraphFilterList<GraphType>& MainController::post_filters ( )
inline

Retrieve the List of all post filters currently active

Returns
QStandardItemModel * MainController::pre_filter_model ( )

Accessor for the conditional formatting model

Returns
The model used by the conditional formattings
GraphFilterList<GraphType>& MainController::pre_filters ( )
inline

Retrieve the List of all pre filters currently active

Returns
void MainController::reinclude_all_excluded_nodes ( )

Method for clearing the exclusion filter and thereby reincluding all excluded nodes in the graph

void MainController::reinclude_excluded_node ( std::string  name)

Method for reincluding excluded nodes in the graph

Parameters
nameThe name of the node to be reincluded
void MainController::remove_post_filter ( std::string  filter_name,
bool  last = true 
)
slot

Slot for removing specific conditional formattings from the conditional formatting set

Parameters
filter_nameThe name of the conditional formatting to be removed
lastTrue(default) if it is the last conditional formatting to be removed, false if not
void MainController::remove_pre_filter ( std::string  filter_name,
bool  last = true 
)
slot

Slot for removing specific filters from the filter set

Parameters
filter_nameThe name of the filter to be removed
lastTrue(default) if it is the last filter to be removed, false if not
void MainController::reset_all_post_filters ( )
slot

Slot for removing all conditional formattings from MainController

void MainController::reset_all_pre_filters ( )
slot

Slot for removing all filters from MainController

bool MainController::save_to_graphviz ( std::string  file_name)

Save the current graph to graphml

Parameters
file_nameThe name of the file to be saved
void MainController::search ( std::string  search_term,
std::string  search_type 
)
slot

Search for a specific item or run block

Parameters
search_term
search_type
void MainController::set_dependencies ( bool  dependencies)

Set whether dependencies should be graphed or not

Parameters
dependenciesTrue if dependencies should be graphed, false if not
void MainController::set_dependents ( bool  dependents)

Set whether dependents should be graphed or not

Parameters
dependentsTrue if dependents should be graphed, false if not
void MainController::set_layout_type ( std::string  layout_type,
bool  relayout = true 
)

Set the type of layout

Parameters
layout_typeThe layout type {Bubble, Hierarchical, Force}
relayoutTrue if force relayout of the graph(default), false if not
void MainController::set_linkler ( Linkler linkler,
bool  free = true 
)

Set the linkler of the MainController

Parameters
linklerA reference to the new linkler
freeWhether or not to free the memory associated with the old linkler (sometimes we might need to old linkler, so then do not free)
MainController::GraphModel * MainController::treeModel ( bool  dependents,
bool  dependencies 
)

Provedes a tree consisting of incoming/outgoing/both

Parameters
dependentsTrue if dependents should be included in the treemodel, false if not
dependenciesTrue if dependencies should be included in the treemodel, false if not
Returns
A reference to the treemodel requested
void MainController::undo_focused ( )

Method for undoing the previously focused node

void MainController::update_post_filter ( std::string  name,
std::string  type,
bool  hide,
bool  inverted_b,
bool  enabled,
std::string  color,
std::string  opacity,
std::map< std::string, std::string >  params,
bool  last 
)
slot

Slot for creating a conditional formatting from a set of conditional formatting params and inserting it into the conditional formatting set What it really does it that it removes the conditional formatting with the same name then adding the new conditional formatting to the set.

Parameters
nameThe name of the conditional formatting
typeThe type of the conditional formatting
hideTrue if the conditional formatting should hide matches, false if not
inverted_bTrue if the conditional formatting should be inverted, false if not
enabledTrue if the conditional formatting should be enabled, false if not
colorA string representing the color, if applicable.
opacityA string representing the opacity, if applicable.
paramsA set of conditional formatting type specific params
lastTrue if this is the last conditional formatting to be inserted(right now), false if not
void MainController::update_pre_filter ( std::string  name,
std::string  type,
bool  hide,
bool  inverted_b,
bool  enabled,
std::string  color,
std::string  opacity,
std::map< std::string, std::string >  params,
bool  last 
)
slot

Slot for "updating" a filter from a set of filter params and inserting it into the filter set. What it really does it that it removes the filter with the same name then adding the new filter to the set.

Parameters
nameThe name of the filter
typeThe type of the filter
hideTrue if the filter should hide matches, false if not
inverted_bTrue if the filter should be inverted, false if not
enabledTrue if the filter should be enabled, false if not
colorA string representing the color, if applicable.
opacityA string representing the opacity, if applicable.
paramsA set of filter type specific params
lastTrue if this is the last filter to be inserted(right now), false if not
bool MainController::was_any_node_focused ( )

Method for checking whether any node has been focused(used as root) in the graph

Returns
True if any node has been focused, false if not

The documentation for this class was generated from the following files: