itom 2.2.0
|
class for visualizing the available (loaded) plugins More...
#include <PlugInModel.h>
Public Types | |
enum | tItemType { itemUnknown = 0x0000, itemCatDataIO = 0x0001, itemCatActuator = 0x0002, itemCatAlgo = 0x0004, itemSubCategoryDataIO_Grabber = 0x0008, itemSubCategoryDataIO_ADDA = 0x0010, itemSubCategoryDataIO_RawIO = 0x0020, itemPlugin = 0x0040, itemInstance = 0x0080, itemFilter = 0x0100, itemWidget = 0x0200, itemCatMainAll = itemCatDataIO | itemCatActuator | itemCatAlgo, itemCatSubAll = itemSubCategoryDataIO_Grabber | itemSubCategoryDataIO_ADDA | itemSubCategoryDataIO_RawIO, itemCatAll = itemCatMainAll | itemCatSubAll } |
Public Member Functions | |
PlugInModel () | |
~PlugInModel () | |
QVariant | data (const QModelIndex &index, int role) const |
Qt::ItemFlags | flags (const QModelIndex &index) const |
QVariant | headerData (int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const |
QModelIndex | index (int row, int column, const QModelIndex &parent=QModelIndex()) const |
QModelIndex | parent (const QModelIndex &index) const |
int | rowCount (const QModelIndex &parent=QModelIndex()) const |
int | columnCount (const QModelIndex &parent=QModelIndex()) const |
int | update (void) |
bool | insertInstance (ito::AddInInterfaceBase *addInInterface, bool beginOperation) |
bool | deleteInstance (ito::AddInBase *addInInstance, const bool beginOperation) |
bool | resetModel (bool beginOperation) |
QModelIndex | getIndexByAddIn (ito::AddInBase *ai) const |
QModelIndex | getIndexByAddInInterface (ito::AddInInterfaceBase *aib) const |
bool | getModelIndexInfo (const QModelIndex &index, tItemType &type, size_t &internalData) const |
bool | getIsAlgoPlugIn (tItemType &itemType, size_t &internalData) const |
bool | getIsGrabberInstance (tItemType &itemType, size_t &internalData) const |
QModelIndex | getTypeNode (const int type) const |
Protected Member Functions | |
QVariant | getFixedNodeInfo (const QModelIndex &index, const QVariant &name, const tItemType &itemType, const int &role, const QIcon icon) const |
QVariant | getPluginNodeInfo (const QModelIndex &index, const int &role) const |
QVariant | getInstanceNodeInfo (const QModelIndex &index, const int &role) const |
QVariant | getFilterOrWidgetNodeInfo (const QModelIndex &index, const int &role, bool filterNotWidget) const |
Private Attributes | |
QList< QString > | m_headers |
string list of names of column headers | |
QList< QVariant > | m_alignment |
list of alignments for the corresponding headers | |
int | m_treeFixNodes [6] |
QModelIndex | m_treeFixIndizes [6] |
QIcon | m_iconActuator |
QIcon | m_iconGrabber |
QIcon | m_iconADDA |
QIcon | m_iconRawIO |
QIcon | m_iconFilter |
QIcon | m_iconDataIO |
QIcon | m_iconAlgo |
QIcon | m_iconWidget |
QIcon | m_iconPlots |
class for visualizing the available (loaded) plugins
The PlugInModel supplies a widget showing the available plugins (libraries) with their name, filename, version and so on. In addition below each plugin its running instances are shown and if a plugin offers a configuration dialog it can be opened using a right click on the instance and selecting "open configuration dialog" in the context menu. The tree view is automatically updated when a new instance is created or an existing one had been deleted.
ito::PlugInModel::PlugInModel | ( | ) |
constructor
contructor, creating column headers for the tree view
ito::PlugInModel::~PlugInModel | ( | ) |
destructor - clean up, clear header and alignment list
int ito::PlugInModel::columnCount | ( | const QModelIndex & | parent = QModelIndex() | ) | const |
return column count
[in] | parent | parent of current item |
QVariant ito::PlugInModel::data | ( | const QModelIndex & | index, |
int | role | ||
) | const |
return data elements for a given row
[in] | index | index for which the data elements should be delivered |
[in] | role | the current role of the model |
This method is actually used to fill the tree view. It returns the data for the selected element, depending as well on the column of the selected element, passed in index.column. The method here is divded into two parts. The first one handels requests for root elements (plugins) the second one is used for child elements (instances of plugins).
bool ito::PlugInModel::deleteInstance | ( | ito::AddInBase * | addInInstance, |
const bool | beginOperation | ||
) |
addInInterface | |
addInInstance | |
beginOperation |
Qt::ItemFlags ito::PlugInModel::flags | ( | const QModelIndex & | index | ) | const |
@return |
QVariant ito::PlugInModel::getFilterOrWidgetNodeInfo | ( | const QModelIndex & | index, |
const int & | role, | ||
bool | filterNotWidget | ||
) | const [protected] |
index | |
role | |
filterNotWidget |
QVariant ito::PlugInModel::getFixedNodeInfo | ( | const QModelIndex & | index, |
const QVariant & | name, | ||
const tItemType & | itemType, | ||
const int & | role, | ||
const QIcon | icon | ||
) | const [protected] |
index | |
name | |
itemType | |
role | |
icon |
QModelIndex ito::PlugInModel::getIndexByAddIn | ( | ito::AddInBase * | ai | ) | const |
ai |
QModelIndex ito::PlugInModel::getIndexByAddInInterface | ( | ito::AddInInterfaceBase * | aib | ) | const |
aib |
QVariant ito::PlugInModel::getInstanceNodeInfo | ( | const QModelIndex & | index, |
const int & | role | ||
) | const [protected] |
index | |
role |
bool ito::PlugInModel::getIsAlgoPlugIn | ( | tItemType & | itemType, |
size_t & | internalData | ||
) | const |
itemType | |
internalData |
bool ito::PlugInModel::getIsGrabberInstance | ( | tItemType & | itemType, |
size_t & | internalData | ||
) | const |
itemType | |
internalData |
bool ito::PlugInModel::getModelIndexInfo | ( | const QModelIndex & | index, |
tItemType & | type, | ||
size_t & | internalData | ||
) | const |
index | |
type | |
internalData |
QVariant ito::PlugInModel::getPluginNodeInfo | ( | const QModelIndex & | index, |
const int & | role | ||
) | const [protected] |
index | |
role |
QVariant ito::PlugInModel::headerData | ( | int | section, |
Qt::Orientation | orientation, | ||
int | role = Qt::DisplayRole |
||
) | const |
return the header / captions for the tree view model
QModelIndex ito::PlugInModel::index | ( | int | row, |
int | column, | ||
const QModelIndex & | parent = QModelIndex() |
||
) | const |
return current index element
[in] | row | row of current element |
[in] | column | column of current element |
[in] | parent | parent of current element |
This method returns the QModelIndex for the current element. As the tree structure is not cached it has to be "calculated" on each call. An invalid parent means were in the top most "plane" of the tree, i.e. the plugin-plane. If the passed index is out of range we return an empty element. Otherwise a new element marked as root level element (i.e. interal pointer = ROOTPOINTER) is returned. If the parent element is valid the index for an instance is requested. In that case it is first checked if the index for a child child element is queried. In that case again an empty element is returned else the plugin for the selected instance is searched in the plugin lists and an according index is created.
bool ito::PlugInModel::insertInstance | ( | ito::AddInInterfaceBase * | addInInterface, |
bool | beginOperation | ||
) |
addInInterface | |
beginOperation |
QModelIndex ito::PlugInModel::parent | ( | const QModelIndex & | index | ) | const |
return parent element
[in] | index | the element's index for which the parent should be returned |
bool ito::PlugInModel::resetModel | ( | bool | beginOperation | ) |
beginOperation |
int ito::PlugInModel::rowCount | ( | const QModelIndex & | parent = QModelIndex() | ) | const |
return number of rows
[in] | parent | parent of current item |