![]() |
tuchulcha
0.10.1
Graphical Workflow Configuration Editor
|
This model serves to provide a model frontend to access a ParameterFile instance. More...
#include <ParameterFileModel.h>
Public Slots | |
virtual void | clear () |
Clear ParameterFile content. | |
virtual bool | load (const QString &fName="") |
Load model content from parameterFile. More... | |
virtual void | loadMetaInfo (const QString &fileName) |
load metaFile More... | |
virtual void | save (const QString &fileName="") |
Save model content to a text file. More... | |
virtual void | setFileName (const QString &fileName) |
Set new value for Property _fileName. More... | |
void | setHandleDynamics (bool) |
set _handleDynamics | |
void | setMinPriority (int value) |
Set property _minPriority. More... | |
void | setOnlyParams (bool value) |
Set property _onlyparams. More... | |
virtual QString | setPrefix (const QString &prefix) |
Change prefix. More... | |
void | setUseMetaInfo (bool value) |
Set property _useMetadata. More... | |
Signals | |
void | commentChanged (QString comment) |
inform about editor comment change | |
void | dynamicUpdate () |
inform about dynamic plugin update | |
void | fileNameChanged (QString fileName) |
Property _fileName has changed. More... | |
void | metaInfoChanged (bool valid) |
New metadata have been loaded. More... | |
void | minPriorityChanged (int value) |
Property _minPriority changed. More... | |
void | modified (bool val) |
inform about modifications More... | |
void | onlyParamsChanged (bool value) |
Property _onlyParams changed. More... | |
void | prefixChanged (const QString &prefix) |
Property _prefix has changed. More... | |
void | statusMessage (const QString &msg) |
send status message More... | |
void | useMetaInfoChanged (bool value) |
Property _useMetadata changed. More... | |
Public Member Functions | |
ParameterFileModel (QString fileName="", QObject *parent=0, QString metaFile="") | |
Constructor initializing the model with the given file. More... | |
virtual | ~ParameterFileModel () |
Default destructor. | |
bool | active () const |
Returns the bool value of the Active Parameter. | |
void | deactivate () |
Deactivate all following plugins. | |
QString | fileName () const |
Get property _fileName. | |
int | minPriority () const |
Get property _minPriority. | |
bool | onlyParams () const |
Get property _onlyparams. | |
const QParameterFile & | parameterFile () const |
Get const pointer of ParameterFile. | |
QString | prefix () const |
Get property _prefix. | |
bool | prefixValid () const |
Check prefix. | |
void | reactivate () |
Reactivate all following plugins. | |
void | reactivatePreviousPlugins () |
Reactivates all previous plugins. | |
bool | useMetaInfo () const |
Get property _useMetadata;. | |
model/view interface | |
virtual int | rowCount (const QModelIndex &parent=QModelIndex()) const |
Return number of table rows. More... | |
virtual int | columnCount (const QModelIndex &parent=QModelIndex()) const |
Return number of table columns. More... | |
virtual QVariant | data (const QModelIndex &index, int role=Qt::DisplayRole) const |
Access to item content. More... | |
virtual bool | setData (const QModelIndex &index, const QVariant &value, int role=Qt::EditRole) |
Set item content. More... | |
virtual Qt::ItemFlags | flags (const QModelIndex &index) const |
Item flags (editable etc). More... | |
virtual QVariant | headerData (int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const |
Data for the table headers. More... | |
virtual bool | insertRows (int row, int count, const QModelIndex &parent=QModelIndex()) |
Add data to the model. More... | |
virtual bool | removeRows (int row, int count, const QModelIndex &parent=QModelIndex()) |
Remove data from the model. More... | |
virtual Qt::DropActions | supportedDropActions () const |
virtual QStringList | mimeTypes () const |
virtual bool | dropMimeData (const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) |
Metadata Queries with dynamic Information | |
bool | metaInfoValid () const |
check for available metaInfos | |
QStringList | getClasses () const |
get classes contained in metadata file | |
QString | getClass (QString objName, bool fixCase=false) const |
get class of some given object More... | |
QString | getType (QString parName, bool applyTmplType=true) const |
Get type of some parameter or slot. More... | |
QString | getDefault (QString parName) const |
pass to metaInfo, use dynamic metadata if needed | |
QString | getDoc (QString parName) const |
pass to metaInfo, use dynamic metadata if needed | |
QStringList | getInputs (QString objName) const |
Get input slots of object. More... | |
QStringList | getInputDisplayNames (QString objName) const |
Get input slots of object. More... | |
QStringList | getOutputs (QString objName) const |
Get output slots of object. More... | |
QStringList | getOutputDisplayNames (QString objName) const |
Get output slots of object. More... | |
QStringList | getParameters (QString objName) const |
Get parameters of object. More... | |
bool | isParameter (QString name) const |
Check if some parameter/slot is a parameter. More... | |
bool | isInputSlot (QString name) const |
Check if some parameter/slot is an input slot. More... | |
bool | isOutputSlot (QString name) const |
Check if some parameter/slot is an output slot. More... | |
bool | isMultiSlot (QString name) const |
Check if some slot is a multi slot. More... | |
QParameterFile wrapper functions | |
QString | getValue (QString parName) const |
Get a parameter from the underlying parameter file. More... | |
void | setValue (QString parName, QString value) |
Set a parameter in the underlying parameter file. More... | |
bool | isSet (QString parName) const |
pass to QParameterFile::isSet | |
void | erase (QString parName) |
Delete a parameter from the the underlying parameter file. More... | |
bool | rename (QString oldPrefix, QString newPrefix) |
rename prefix More... | |
Protected Slots | |
virtual bool | _load () |
Load data without showing OpenFile Dialog. More... | |
virtual void | _update () |
Update content (e.g. when prefix has changed) | |
virtual void | _updatePriority (const QModelIndex &topLeft, const QModelIndex &bottomRight) |
Update filter if priority changed. | |
Protected Attributes | |
QMutex * | _resetMutex |
avoid multiple reset model calls | |
Properties | |
QString | _fileName |
Store filename of the model data file. | |
int | _minPriority |
minimum priority to be listed | |
bool | _onlyParams |
only show configurable parameters | |
QString | _prefix |
Parameter prefix. | |
bool | _useMetaInfo |
toggle usage of metadata | |
Private Member Functions | |
QStringList | _collectObjects (QStringList list) const |
Return set of objects contained in given parameter list. More... | |
QString | _getDynamicMetaFile (QString objName) const |
creates path to dynamic meta info file for object | |
QStringList | _paramFilter (QStringList list) const |
filter keys listed in the classes parameter section More... | |
QStringList | _prefixFilter (QStringList list) const |
filter keys starting with the given prefix More... | |
QStringList | _priorityFilter (QStringList list) const |
filter keys depending on their priority More... | |
QStringList | _priorityTagFilter (QStringList list) const |
filter keys containing priority information More... | |
void | _updateDynamics () |
update dynamic objects | |
Private Attributes | |
QMap< QString, QString > | _classCaseMap |
map to fix class name cases | |
bool | _handleDynamics |
handle dynamics by calling update-dynamics process | |
QStringList | _keys |
Cache stored parameter names. | |
const MetaData * | _metaInfos |
ParameterFile describing classes and in-/output slots. | |
QParameterFile * | _parameterFile |
Pointer to the ParameterFile instance storing the model content. | |
It can be used in a TableView.
Definition at line 37 of file ParameterFileModel.h.
ParameterFileModel::ParameterFileModel | ( | QString | fileName = "" , |
QObject * | parent = 0 , |
||
QString | metaFile = "" |
||
) |
parent | parent QObject passed to inherited constructor. |
fileName | filename of the textfile to load. |
metaFile | ParameterFile describing classes and in-/outputs |
Definition at line 44 of file ParameterFileModel.cpp.
References _fileName, _load(), _updatePriority(), loadMetaInfo(), and setOnlyParams().
|
private |
list | parameter list |
Definition at line 863 of file ParameterFileModel.cpp.
|
protectedvirtualslot |
false | error during load |
Definition at line 646 of file ParameterFileModel.cpp.
References _fileName, _parameterFile, _resetMutex, _update(), _updateDynamics(), clear(), QParameterFile::load(), and statusMessage().
|
private |
list | list to filter |
Definition at line 872 of file ParameterFileModel.cpp.
References _collectObjects(), _onlyParams, and getParameters().
|
private |
list | list to filter |
Definition at line 851 of file ParameterFileModel.cpp.
References _prefix, and prefixValid().
|
private |
list | list to filter |
Definition at line 901 of file ParameterFileModel.cpp.
References _minPriority, and getValue().
|
private |
list | list to filter |
Definition at line 891 of file ParameterFileModel.cpp.
|
virtual |
parent | index of parent item |
Definition at line 82 of file ParameterFileModel.cpp.
|
virtual |
Returns data specific to the given role (display, icon, ...)
index | item index |
role | display role |
Definition at line 86 of file ParameterFileModel.cpp.
References _keys, _metaInfos, _onlyParams, _parameterFile, _prefix, _useMetaInfo, QParameterFile::get(), getClass(), getDefault(), MetaData::getDocString(), getType(), getValue(), VarTypeMap::instance(), isParameter(), QParameterFile::isSet(), isSet(), and type().
void ParameterFileModel::erase | ( | QString | parName | ) |
parName | name of the parameter |
Definition at line 984 of file ParameterFileModel.cpp.
References _keys, _parameterFile, QParameterFile::isSet(), and modified().
|
signal |
fileName | new value |
|
virtual |
index | item index |
Definition at line 460 of file ParameterFileModel.cpp.
References _keys, _onlyParams, _useMetaInfo, data(), getType(), isParameter(), and prefixValid().
QString ParameterFileModel::getClass | ( | QString | objName, |
bool | fixCase = false |
||
) | const |
objName | name of the object |
fixCase | class list lookup to get name case right |
Definition at line 842 of file ParameterFileModel.cpp.
References _classCaseMap, and getValue().
QStringList ParameterFileModel::getInputDisplayNames | ( | QString | objName | ) | const |
objName | name of the object |
Definition at line 1082 of file ParameterFileModel.cpp.
References _getDynamicMetaFile(), _metaInfos, getClass(), MetaData::getInputDisplayNames(), and MetaData::isDynamic().
QStringList ParameterFileModel::getInputs | ( | QString | objName | ) | const |
objName | name of the object |
Definition at line 1069 of file ParameterFileModel.cpp.
References _getDynamicMetaFile(), _metaInfos, getClass(), MetaData::getInputs(), and MetaData::isDynamic().
QStringList ParameterFileModel::getOutputDisplayNames | ( | QString | objName | ) | const |
objName | name of the object |
Definition at line 1108 of file ParameterFileModel.cpp.
References _getDynamicMetaFile(), _metaInfos, getClass(), MetaData::getOutputDisplayNames(), and MetaData::isDynamic().
QStringList ParameterFileModel::getOutputs | ( | QString | objName | ) | const |
objName | name of the object |
Definition at line 1095 of file ParameterFileModel.cpp.
References _getDynamicMetaFile(), _metaInfos, getClass(), MetaData::getOutputs(), and MetaData::isDynamic().
QStringList ParameterFileModel::getParameters | ( | QString | objName | ) | const |
objName | name of the object |
Definition at line 1122 of file ParameterFileModel.cpp.
References _getDynamicMetaFile(), _metaInfos, getClass(), MetaData::getParameters(), and MetaData::isDynamic().
QString ParameterFileModel::getType | ( | QString | parName, |
bool | applyTmplType = true |
||
) | const |
This also handles presence of some template parameters.
parName | name of the parameter |
applyTmplType | replace template parameter by selected type |
Definition at line 914 of file ParameterFileModel.cpp.
References _getDynamicMetaFile(), _metaInfos, _useMetaInfo, QParameterFile::get(), getClass(), getDefault(), MetaData::getType(), getValue(), and MetaData::isDynamic().
QString ParameterFileModel::getValue | ( | QString | parName | ) | const |
parName | name of the parameter |
Definition at line 946 of file ParameterFileModel.cpp.
References _parameterFile.
|
virtual |
section | row/column number |
orientation | horizontal or vertical header |
role | display role |
Definition at line 514 of file ParameterFileModel.cpp.
|
virtual |
row | row to prepend the new rows to |
count | number of rows to append |
parent | parent item (here unused) |
Definition at line 530 of file ParameterFileModel.cpp.
References _keys, _minPriority, _onlyParams, _parameterFile, _prefix, _prefixFilter(), _priorityFilter(), _priorityTagFilter(), QParameterFile::getKeyList(), QParameterFile::isSet(), prefixValid(), and setValue().
bool ParameterFileModel::isInputSlot | ( | QString | name | ) | const |
name | name of the slot |
true | given object is an input slot |
Definition at line 1142 of file ParameterFileModel.cpp.
References getInputs().
bool ParameterFileModel::isMultiSlot | ( | QString | name | ) | const |
name | name of the slot |
true | slot may have multiple targets |
Definition at line 1156 of file ParameterFileModel.cpp.
References _getDynamicMetaFile(), _metaInfos, getClass(), MetaData::isDynamic(), and MetaData::isMultiSlot().
bool ParameterFileModel::isOutputSlot | ( | QString | name | ) | const |
name | name of the slot |
true | given object is an output slot |
Definition at line 1149 of file ParameterFileModel.cpp.
References getOutputs().
bool ParameterFileModel::isParameter | ( | QString | name | ) | const |
name | name of the parameter/slot |
true | given object is a parameter |
Definition at line 1135 of file ParameterFileModel.cpp.
References getParameters().
|
virtualslot |
Shows OpenFile Dialog and loads the selected file.
fName | file to load, shows OpenFile dialog if empty. |
false | error during load |
Definition at line 693 of file ParameterFileModel.cpp.
References _fileName, _load(), setFileName(), and statusMessage().
|
virtualslot |
fileName | filename to load from |
Definition at line 782 of file ParameterFileModel.cpp.
References _classCaseMap, _metaInfos, MetaData::getClasses(), metaInfoChanged(), and setUseMetaInfo().
|
signal |
valid | true, if metadata are valid |
|
signal |
value | new value |
|
signal |
val | new modification status |
|
signal |
value | new value |
|
signal |
prefix | new value |
|
virtual |
row | first row to delete |
count | number of rows to append |
parent | parent item (here unused) |
Reimplemented in GraphModel.
Definition at line 575 of file ParameterFileModel.cpp.
References _keys, _onlyParams, _parameterFile, _prefix, QParameterFile::erase(), QParameterFile::getKeyList(), isSet(), and prefixValid().
bool ParameterFileModel::rename | ( | QString | oldPrefix, |
QString | newPrefix | ||
) |
renames all keys starting with oldPrefix to ones with the given new prefix and also renames occurrences of the oldPrefix in values of other parameters (like slot connections)
The new prefix must match the rules for parameter file prefixes (as specified in QParameterFile::prefixCheck ). The old prefix is not checked, if there are dots, the part before the dots is used. In the worst case, there are no occurrences of an invalid keys which causes the function to return and skip the parameter renaming.
oldPrefix | old prefix |
newPrefix | new prefix (checks for valid prefix) |
true | renaming successful |
false | some error occured, nothing changed at all |
Definition at line 998 of file ParameterFileModel.cpp.
References _parameterFile, _resetMutex, modified(), QParameterFile::rename(), and setPrefix().
|
virtual |
parent | index of parent item |
Definition at line 78 of file ParameterFileModel.cpp.
References _keys.
|
virtualslot |
When filename is empty, the old filename will be used (if avaiable). When filename is given, the internal filename will be overwritten.
fileName | name of the file to store |
Definition at line 731 of file ParameterFileModel.cpp.
References _fileName, _parameterFile, modified(), QParameterFile::save(), setFileName(), and statusMessage().
|
virtual |
Overwrite the current value with the given one.
index | item index |
value | new value to set |
role | display role |
true | data successfully set |
false | failure setting value |
Reimplemented in GraphModel.
Definition at line 212 of file ParameterFileModel.cpp.
References _keys, _metaInfos, _onlyParams, _parameterFile, _prefix, _update(), _updateDynamics(), _useMetaInfo, deactivate(), dynamicUpdate(), erase(), getClass(), getType(), getValue(), MetaData::isDynamic(), isParameter(), QParameterFile::isSet(), isSet(), prefixValid(), reactivatePreviousPlugins(), save(), and setValue().
|
virtualslot |
fileName | new value for _fileName |
Definition at line 748 of file ParameterFileModel.cpp.
References _fileName, and fileNameChanged().
|
slot |
value | new value to set |
Definition at line 1016 of file ParameterFileModel.cpp.
References _minPriority, _update(), and minPriorityChanged().
|
slot |
value | new value to set |
Definition at line 832 of file ParameterFileModel.cpp.
References _onlyParams, _update(), _useMetaInfo, onlyParamsChanged(), and setUseMetaInfo().
|
virtualslot |
prefix | new prefix |
Definition at line 755 of file ParameterFileModel.cpp.
References _prefix, _update(), and prefixChanged().
|
slot |
value | new value to set |
Definition at line 808 of file ParameterFileModel.cpp.
References _onlyParams, _useMetaInfo, rowCount(), setOnlyParams(), and useMetaInfoChanged().
void ParameterFileModel::setValue | ( | QString | parName, |
QString | value | ||
) |
parName | name of the parameter |
value | new value of the parameter |
Definition at line 954 of file ParameterFileModel.cpp.
References _parameterFile, _update(), commentChanged(), getValue(), isSet(), and modified().
|
signal |
msg | message |
|
signal |
value | new value |