Cube GUI Plugin User Guide  (CubeGUI 4.4.4, revision 18494)
How to develop a Cube GUI Plugin, road map and examples
Signals | Public Member Functions | List of all members
cubepluginapi::PluginServices Class Reference

#include <PluginServices.h>

Inheritance diagram for cubepluginapi::PluginServices:
QObject

Signals

void treeItemIsSelected (cubepluginapi::TreeType type, cubepluginapi::TreeItem *item)
 
void orderHasChanged (const QList< cubepluginapi::DisplayType > &order)
 
void contextMenuIsShown (cubepluginapi::TreeType type, cubepluginapi::TreeItem *item)
 
void genericUserAction (cubepluginapi::UserAction action)
 
void globalValueChanged (const QString &name)
 
void tabActivated (cubepluginapi::TreeType type)
 

Public Member Functions

cube::Cube * getCube () const
 
const QString & getCubeFileName () const
 
QString getCubeBaseName () const
 
QString getStatName () const
 
QWidget * getParentWidget () const
 
const QList< TreeItem * > & getTreeItems (TreeType type) const
 
const QList< TreeItem * > getTopLevelItems (TreeType type) const
 
TreeItem * getSystemTreeItem (uint32_t sysId) const
 
TreeItem * getCallTreeItem (uint32_t cnodeId) const
 
TreeItem * getMetricTreeItem (std::string metricId) const
 
void addMarker (const TreeItemMarker *marker, TreeItem *metric, TreeItem *call, TreeItem *system)
 
void addMarker (TreeItem *item, const TreeItemMarker *marker, bool isDependency=false)
 
void removeMarker (TreeItem *item, const TreeItemMarker *marker)
 
void removeMarker ()
 
void removeMarker (TreeType type)
 
const TreeItemMarker * getTreeItemMarker (const QString &label, const QList< QPixmap > &icons=QList< QPixmap >(), bool isInsignificant=false, MarkerLabel *markerLabel=0)
 
const QList< cubepluginapi::DisplayType > & getOrder () const
 
ValueModus getValueModus () const
 
TreeItem * getSelection (TreeType type) const
 
const QList< TreeItem * > & getSelections (TreeType type) const
 
bool intMetricSelected () const
 
void selectItem (TreeItem *item, bool add)
 
QAction * addContextMenuItem (TreeType type, const QString &menuItemText)
 
QMenu * enablePluginMenu ()
 
void addToolBar (QToolBar *toolbar, TabInterface *tab=0)
 
void removeToolBar (QToolBar *toolbar, TabInterface *tab=0)
 
void setMessage (const QString &str, cubepluginapi::MessageType type=cubepluginapi::Information)
 
int getActiveSubsetIndex () const
 
const QList< TreeItem * > & getActiveSubset () const
 
void setActiveSubset (int index)
 
QStringList getSubsetLabelList () const
 
void addTab (cubepluginapi::DisplayType type, TabInterface *tab, TabType tabType=DEFAULT_TAB)
 
void removeTab (TabInterface *tab)
 
void enableTab (TabInterface *tab, bool enabled)
 
void toFront (TabInterface *tab)
 
void clearValueWidget ()
 
void updateValueWidget (double minValue, double maxValue, double selectedValue, double minAbsValue, double maxAbsValue, double absValue, bool intType, bool userDefinedMinMaxValues, double _mean, double _variance)
 
void updateValueWidget (double minValue, double maxValue, double selectedValue, bool intType, bool userDefinedMinMaxValues, double _mean, double _variance)
 
void updateValueWidget (double minValue, double maxValue, bool intType, bool userDefinedMinMaxValues, double _mean, double _variance)
 
void addSettingsHandler (SettingsHandler *s)
 
void addColorMap (ColorMap *map)
 
void addValueView (ValueView *view)
 
void setGlobalValue (const QString &name, const QVariant &value, bool notifyMyself=false)
 
QVariant getGlobalValue (const QString &name) const
 
QColor getColor (double value, double minValue, double maxValue, bool whiteForZero=true) const
 
QPair< QString, QString > formatNumberAndUnit (double value, const QString &unit, PrecisionFormat format, bool integerType=false) const
 
QString formatNumber (double value, PrecisionFormat format, bool integerType=false) const
 
QString formatNumber (double value, bool integerType=false) const
 
void recalculateTreeItems ()
 
void recalculateTreeItem (cubegui::TreeItem *item)
 
void updateTreeItems ()
 
void updateTreeView (TreeType treeType)
 
QTextStream & debug ()
 
void getStatisticValues (TreeType type, double &minValue, double &maxValue, double &selectedValue, double &minAbsValue, double &maxAbsValue, double &absValue, double &mean, double &varianceSqrt) const
 
void setUserDefinedMinMaxValues (TreeType type)
 
bool getUserDefinedMinValues (TreeType type, double &min, double &max) const
 
void addMetric (cube::Metric *metric, TreeItem *parent=0, bool show=true)
 
void removeMetric (TreeItem *metricItem)
 
void updateMetric (TreeItem *metricItem)
 
TreeType getActiveTreeType (DisplayType type)
 
bool hasIterations ()
 

Member Function Documentation

void cubepluginapi::PluginServices::addColorMap ( ColorMap map)

Adds a colormap to the list of available colormaps from which the user can choose the active one.

QAction* cubepluginapi::PluginServices::addContextMenuItem ( TreeType  type,
const QString &  menuItemText 
)

Inserts a menu item to the context menu of the treeWidget of the given type and returns the corresponding action. The action is automatically deleted after the context menu is closed.

Parameters
typeMETRICTREE, CALLTREE, CALLFLAT, SYSTEMTREE
menuItemTextthe label of the created context menu item
void cubepluginapi::PluginServices::addMarker ( const TreeItemMarker *  marker,
TreeItem *  metric,
TreeItem *  call,
TreeItem *  system 
)

Marks the given tree item item combination with a marker. The items of the left and the middle tree are marked as dependency, the item of the rightmost tree is marked with the given marker. If an item with NULL value is given, the rightmost item left to this item is marked. Examples: DemoPlugin, StatisticPlugin, LaunchPlugin

Parameters
markersee getTreeItemMarker
See also
Pluginservices::getTreeItemMarker
void cubepluginapi::PluginServices::addMarker ( TreeItem *  item,
const TreeItemMarker *  marker,
bool  isDependency = false 
)

Marks the given tree item with a marker, use updateTreeView to activate it. The plugin has to manage the dependencies, e.g. to add or remove the markers if the tree order changes. This function should only be used, if the marker depends on runtime values.

Parameters
itemthe item to which the marker is added
markersee getTreeItemMarker
isDependencyif true, the item is marked as a dependency to another marked item (usually of another tree)
void cubepluginapi::PluginServices::addMetric ( cube::Metric *  metric,
TreeItem *  parent = 0,
bool  show = true 
)

adds a new metric to the metric tree

Parameters
metricthe new metric to add
parentthe parent item or NULL for top level metrics
showmake the new metric visible, otherwise it is hidden
void cubepluginapi::PluginServices::addSettingsHandler ( SettingsHandler s)

Allows the plugin to save and load settings.

See also
cubepluginapi::SettingsHandler
void cubepluginapi::PluginServices::addTab ( cubepluginapi::DisplayType  type,
TabInterface tab,
TabType  tabType = DEFAULT_TAB 
)

Adds a tab to METRICTAB, CALLTAB or SYSTEMTAB Adds a the given tab. Currently only SYSTEMTAB is supported.

Parameters
typecubepluginapi::SYSTEMTAB
addAtIndexthe desired position of the tab
typeuse OTHER_PLUGIN_TAB, if the plugin isn't related to the system tree. In that case, the value mode combo box and the value view aren't shown
void cubepluginapi::PluginServices::addToolBar ( QToolBar *  toolbar,
TabInterface tab = 0 
)

Adds the given toolbar below the menu bar.

Parameters
tabIf tab is 0, the toolbar is always visible. Otherwise the toolbar is initially hidden and gets only visible, if the corresponding tab becomes visible. If the tab is detached, the toolbar is moved from the main panel to the new window.
void cubepluginapi::PluginServices::addValueView ( ValueView view)

Adds a value view to the list of available views from which the user can choose the active one.

void cubepluginapi::PluginServices::clearValueWidget ( )

Clears the value widget, the widget only shows an empty area.

void cubepluginapi::PluginServices::contextMenuIsShown ( cubepluginapi::TreeType  type,
cubepluginapi::TreeItem *  item 
)
signal

This signal is emitted if the context menu of the given tree item in tree widget type will be shown. Additional menu items may be added now.

Parameters
typeMETRICTREE, CALLTREE, CALLFLAT, SYSTEMTREE
itemthe item, the user has clicked with the right mouse
QTextStream& cubepluginapi::PluginServices::debug ( )

Returns a stream to write debug messages; only active if -verbose command line option is set.

QMenu* cubepluginapi::PluginServices::enablePluginMenu ( )

Adds a submenu with the plugin label to the plugin menu and returns a pointer to the created QMenu.

void cubepluginapi::PluginServices::enableTab ( TabInterface tab,
bool  enabled 
)

Enables or disables the given tab. If disabled, the tab gets inactive and greyed out.

QString cubepluginapi::PluginServices::formatNumber ( double  value,
PrecisionFormat  format,
bool  integerType = false 
) const

formatNumber writes the given value into a string using the given format. If integerType is true, the value is formatted without decimal places.

Parameters
formatFORMAT_TREES for treeWidgets and FORMAT_DEFAULT for all other widgets
QString cubepluginapi::PluginServices::formatNumber ( double  value,
bool  integerType = false 
) const

Convenience function, equivalent to formatNumber(double value, PrecisionFormat format, bool integerType = false) with PrecisionFormat = FORMAT_DEFAULT

QPair<QString, QString> cubepluginapi::PluginServices::formatNumberAndUnit ( double  value,
const QString &  unit,
PrecisionFormat  format,
bool  integerType = false 
) const

formatNumberAndUnit writes the given value into a string using the given format. If integerType is true, the value is formatted without decimal places.

Parameters
formatFORMAT_TREES for treeWidgets and FORMAT_DEFAULT for all other widgets
void cubepluginapi::PluginServices::genericUserAction ( cubepluginapi::UserAction  action)
signal

This signal is emitted for special user actions, eg. if a tree item is marked as loop.

const QList<TreeItem*>& cubepluginapi::PluginServices::getActiveSubset ( ) const

Returns the contents of the currenly selected subset of the system tree.

int cubepluginapi::PluginServices::getActiveSubsetIndex ( ) const

Returns the index of the currenly selected subset of the system tree.

TreeType cubepluginapi::PluginServices::getActiveTreeType ( DisplayType  type)

Returns the tree type of the active tab. Currently only the DisplayType CALL has different tree tabs (CALLTREE / CALLFLAT)

TreeItem* cubepluginapi::PluginServices::getCallTreeItem ( uint32_t  cnodeId) const

Returns the call tree item with the given id.

QColor cubepluginapi::PluginServices::getColor ( double  value,
double  minValue,
double  maxValue,
bool  whiteForZero = true 
) const

Calculates a color corresponding to the value parameter having minValue at color position 0.0 and maxValue at color position 1.0 on the color scale. If whiteForZero is set to true, the zero value is assigned the color white.

cube::Cube* cubepluginapi::PluginServices::getCube ( ) const

Returns a pointer to the cube data.

QString cubepluginapi::PluginServices::getCubeBaseName ( ) const

Returns the basename of the currently loaded cube file including the path.

const QString& cubepluginapi::PluginServices::getCubeFileName ( ) const

Returns the name of the loaded cube file including the path.

QVariant cubepluginapi::PluginServices::getGlobalValue ( const QString &  name) const

Retreives the global value of the given identifier name.

TreeItem* cubepluginapi::PluginServices::getMetricTreeItem ( std::string  metricId) const

Returns the metric tree item with the given id.

const QList<cubepluginapi::DisplayType>& cubepluginapi::PluginServices::getOrder ( ) const

Returns order of tabs, default order is METRICWIDGET, CALLWIDGET, SYSTEMWIDGET

QWidget* cubepluginapi::PluginServices::getParentWidget ( ) const

Returns a widget which can be used e.g. as parent widget of dialogs, if the plugins doesn't define tabs.

TreeItem* cubepluginapi::PluginServices::getSelection ( TreeType  type) const

Returns last selected item in the given tree.

Parameters
typeMETRICTREE, CALLTREE, CALLFLAT, SYSTEMTREE
const QList<TreeItem*>& cubepluginapi::PluginServices::getSelections ( TreeType  type) const

Returns selected items in the given tree.

Parameters
typeMETRICTREE, CALLTREE, CALLFLAT, SYSTEMTREE
void cubepluginapi::PluginServices::getStatisticValues ( TreeType  type,
double &  minValue,
double &  maxValue,
double &  selectedValue,
double &  minAbsValue,
double &  maxAbsValue,
double &  absValue,
double &  mean,
double &  varianceSqrt 
) const

Returns statistical information about the given tree.

QString cubepluginapi::PluginServices::getStatName ( ) const

If a statistics file exists, the filename of that file is returned, otherwise an empty string.

QStringList cubepluginapi::PluginServices::getSubsetLabelList ( ) const

Returns a list of all names of the defined subsets for the system tree.

TreeItem* cubepluginapi::PluginServices::getSystemTreeItem ( uint32_t  sysId) const

Returns the system tree item with the given id.

const QList<TreeItem*> cubepluginapi::PluginServices::getTopLevelItems ( TreeType  type) const

Returns a list with the top level tree items of the given tree. For the calltree and systemtree, the top level tree items refer to the visible root nodes in CUBE.

const TreeItemMarker* cubepluginapi::PluginServices::getTreeItemMarker ( const QString &  label,
const QList< QPixmap > &  icons = QList< QPixmap >(),
bool  isInsignificant = false,
MarkerLabel *  markerLabel = 0 
)

returns a new tree item marker, which can be used to marks tree items with different background color or other attributes, which can be chosen by the user

Parameters
labeltext for the color legend
iconslist of pixmaps of ascending size. The best fitting icon will be shrunk to tree item height and displayed for each marked item.
isInsignificantmarks item as insignificant, if true. Insignificant items will be grayed out.
markerLabelcontains a function, that returns a label which depends on the choosen tree item; if markerLabel is not set, the first parameter (label) is always used. Example: TreeItemMarker plugin
const QList<TreeItem*>& cubepluginapi::PluginServices::getTreeItems ( TreeType  type) const

Returns a list with all tree items of the given tree.

bool cubepluginapi::PluginServices::getUserDefinedMinValues ( TreeType  type,
double &  min,
double &  max 
) const

Returns true, if user defined values are set.

ValueModus cubepluginapi::PluginServices::getValueModus ( ) const

Returns the currenly selected value modus.

void cubepluginapi::PluginServices::globalValueChanged ( const QString &  name)
signal

This signal is emitted if a global value has changed.

Parameters
namethe name of the global value
See also
PluginServices::getGlobalValue
bool cubepluginapi::PluginServices::hasIterations ( )

true, if iterations are defined in calltree

bool cubepluginapi::PluginServices::intMetricSelected ( ) const

Returns true, if the currenly selected metric item uses integer values.

void cubepluginapi::PluginServices::orderHasChanged ( const QList< cubepluginapi::DisplayType > &  order)
signal

This signal is emitted if the order of the tabs has changed.

Parameters
orderlist which contains METRICWIDGET, CALLWIDGET, SYSTEMWIDGET in the order the user has selected
void cubepluginapi::PluginServices::recalculateTreeItem ( cubegui::TreeItem *  item)

Recalculates the value of the given item and its children and updates the corresponding view.

void cubepluginapi::PluginServices::recalculateTreeItems ( )

Recalculates the values of the items of all trees and updates the views.

void cubepluginapi::PluginServices::removeMarker ( TreeItem *  item,
const TreeItemMarker *  marker 
)

Removes the given marker from the given tree item.

void cubepluginapi::PluginServices::removeMarker ( )

Removes all plugin managed marker which have been set by this plugin.

void cubepluginapi::PluginServices::removeMarker ( TreeType  type)

Removes all plugin managed marker from the given tree which have been set by this plugin.

void cubepluginapi::PluginServices::removeMetric ( TreeItem *  metricItem)

Removes the given metric item from the metric tree.

void cubepluginapi::PluginServices::removeTab ( TabInterface tab)

Removes the previously added tab.

See also
PluginServices::addTab
void cubepluginapi::PluginServices::removeToolBar ( QToolBar *  toolbar,
TabInterface tab = 0 
)

Removes the previously added toolbar.

void cubepluginapi::PluginServices::selectItem ( TreeItem *  item,
bool  add 
)

Selects the given item.

Parameters
itemThe tree item to select
addIf add is false, all previously selected items are deselected. If add is true and the item already is selected, it becomes deselected.
void cubepluginapi::PluginServices::setActiveSubset ( int  index)

Sets the currenly selected subset of the system tree to the given index.

void cubepluginapi::PluginServices::setGlobalValue ( const QString &  name,
const QVariant &  value,
bool  notifyMyself = false 
)

Sets a global value:

Parameters
nameidentifier of the value
valuethe value which can be of any type
notifyMyselfif true, the signal globalValueChanged is also sent to the caller of this method. Causes infinite recursion, if called inside the slot connected to globalValueChanged.
void cubepluginapi::PluginServices::setMessage ( const QString &  str,
cubepluginapi::MessageType  type = cubepluginapi::Information 
)

Writes the given message to the status line at the bottom of the cube window.

void cubepluginapi::PluginServices::setUserDefinedMinMaxValues ( TreeType  type)

Shows a dialog to let the user set the minimum and maximum value for coloring.

void cubepluginapi::PluginServices::tabActivated ( cubepluginapi::TreeType  type)
signal

This signal is emitted if the selected tree has changed

void cubepluginapi::PluginServices::toFront ( TabInterface tab)

Sets the given tab selected or brings the detached tab to front.

void cubepluginapi::PluginServices::treeItemIsSelected ( cubepluginapi::TreeType  type,
cubepluginapi::TreeItem *  item 
)
signal

This signal is emitted if the user selects one ore more tree items. To get all selected items

See also
Pluginservices::getSelections( TreeType type )
Parameters
typeMETRICTREE, CALLTREE, CALLFLAT, SYSTEMTREE
itemthe recently selected item
void cubepluginapi::PluginServices::updateMetric ( TreeItem *  metricItem)

Recalculates the values of the given metric item.

void cubepluginapi::PluginServices::updateTreeItems ( )

Updates the items of all trees, if their values (cube::Values) have been changed by a plugin and notifies all tabs that values have been changed.

void cubepluginapi::PluginServices::updateTreeView ( TreeType  treeType)

Updates the properties (label, color, font...) of the given tree. This method has to be called if tree items have been marked

void cubepluginapi::PluginServices::updateValueWidget ( double  minValue,
double  maxValue,
double  selectedValue,
double  minAbsValue,
double  maxAbsValue,
double  absValue,
bool  intType,
bool  userDefinedMinMaxValues,
double  _mean,
double  _variance 
)

Updates the value widget which shows three lines.

Parameters
minValuethe minimum value
maxValuethe maximum value
selectedValuethe currently selected value or the aggragation of selected values
minAbsValuethe minimum absolute value
maxAbsValuethe maximum absolute value
absValue
intTypetrue, if integer values should be shown
userDefinedMinMaxValues
_meanthe mean of all values
_variancethe variance of all values
void cubepluginapi::PluginServices::updateValueWidget ( double  minValue,
double  maxValue,
double  selectedValue,
bool  intType,
bool  userDefinedMinMaxValues,
double  _mean,
double  _variance 
)

Updates the value widget but doesn't display the absolute value line (current modus is absolute value)

void cubepluginapi::PluginServices::updateValueWidget ( double  minValue,
double  maxValue,
bool  intType,
bool  userDefinedMinMaxValues,
double  _mean,
double  _variance 
)

Updates the value widget if no current selected value exists, or is undefined


Cube Writer Library    Copyright © 1998–2017 Forschungszentrum Jülich GmbH, Jülich Supercomputing Centre
Copyright © 2009–2015 German Research School for Simulation Sciences GmbH, Laboratory for Parallel Programming