Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
OpenWalnut Core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
44
Issues
44
List
Boards
Labels
Service Desk
Milestones
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
OpenWalnut
OpenWalnut Core
Commits
1665cfc7
Commit
1665cfc7
authored
May 10, 2010
by
Sebastian Eichelbaum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[CHANGE] - Information properties now supported by the prop widgets. Also extended template.
parent
6cb8b3fc
Changes
20
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
236 additions
and
25 deletions
+236
-25
src/gui/qt4/datasetbrowser/WPropertyBoolWidget.cpp
src/gui/qt4/datasetbrowser/WPropertyBoolWidget.cpp
+8
-1
src/gui/qt4/datasetbrowser/WPropertyBoolWidget.h
src/gui/qt4/datasetbrowser/WPropertyBoolWidget.h
+10
-0
src/gui/qt4/datasetbrowser/WPropertyColorWidget.cpp
src/gui/qt4/datasetbrowser/WPropertyColorWidget.cpp
+14
-1
src/gui/qt4/datasetbrowser/WPropertyColorWidget.h
src/gui/qt4/datasetbrowser/WPropertyColorWidget.h
+10
-0
src/gui/qt4/datasetbrowser/WPropertyDoubleWidget.cpp
src/gui/qt4/datasetbrowser/WPropertyDoubleWidget.cpp
+12
-2
src/gui/qt4/datasetbrowser/WPropertyDoubleWidget.h
src/gui/qt4/datasetbrowser/WPropertyDoubleWidget.h
+10
-0
src/gui/qt4/datasetbrowser/WPropertyFilenameWidget.cpp
src/gui/qt4/datasetbrowser/WPropertyFilenameWidget.cpp
+10
-2
src/gui/qt4/datasetbrowser/WPropertyFilenameWidget.h
src/gui/qt4/datasetbrowser/WPropertyFilenameWidget.h
+10
-0
src/gui/qt4/datasetbrowser/WPropertyIntWidget.cpp
src/gui/qt4/datasetbrowser/WPropertyIntWidget.cpp
+15
-7
src/gui/qt4/datasetbrowser/WPropertyIntWidget.h
src/gui/qt4/datasetbrowser/WPropertyIntWidget.h
+10
-0
src/gui/qt4/datasetbrowser/WPropertySelectionWidget.cpp
src/gui/qt4/datasetbrowser/WPropertySelectionWidget.cpp
+20
-2
src/gui/qt4/datasetbrowser/WPropertySelectionWidget.h
src/gui/qt4/datasetbrowser/WPropertySelectionWidget.h
+1
-0
src/gui/qt4/datasetbrowser/WPropertyStringWidget.cpp
src/gui/qt4/datasetbrowser/WPropertyStringWidget.cpp
+13
-2
src/gui/qt4/datasetbrowser/WPropertyStringWidget.h
src/gui/qt4/datasetbrowser/WPropertyStringWidget.h
+10
-0
src/gui/qt4/datasetbrowser/WPropertyTriggerWidget.cpp
src/gui/qt4/datasetbrowser/WPropertyTriggerWidget.cpp
+10
-1
src/gui/qt4/datasetbrowser/WPropertyTriggerWidget.h
src/gui/qt4/datasetbrowser/WPropertyTriggerWidget.h
+10
-0
src/gui/qt4/datasetbrowser/WPropertyWidget.cpp
src/gui/qt4/datasetbrowser/WPropertyWidget.cpp
+9
-0
src/gui/qt4/datasetbrowser/WPropertyWidget.h
src/gui/qt4/datasetbrowser/WPropertyWidget.h
+5
-0
src/modules/template/WMTemplate.cpp
src/modules/template/WMTemplate.cpp
+18
-3
src/modules/template/WMTemplate.h
src/modules/template/WMTemplate.h
+31
-4
No files found.
src/gui/qt4/datasetbrowser/WPropertyBoolWidget.cpp
View file @
1665cfc7
...
...
@@ -32,7 +32,9 @@ WPropertyBoolWidget::WPropertyBoolWidget( WPropBool property, QGridLayout* prope
m_checkbox
(
&
m_parameterWidgets
),
m_button
(
&
m_parameterWidgets
),
m_layout
(
&
m_parameterWidgets
),
m_asButton
(
asButton
)
m_asButton
(
asButton
),
m_asText
(
&
m_informationWidgets
),
m_infoLayout
(
&
m_informationWidgets
)
{
// initialize members
m_button
.
setCheckable
(
true
);
...
...
@@ -49,6 +51,10 @@ WPropertyBoolWidget::WPropertyBoolWidget( WPropBool property, QGridLayout* prope
}
m_parameterWidgets
.
setLayout
(
&
m_layout
);
// Information Output ( Property Purpose = PV_PURPOSE_INFORMATION )
m_infoLayout
.
addWidget
(
&
m_asText
);
m_informationWidgets
.
setLayout
(
&
m_infoLayout
);
// connect the modification signal of m_checkbox with our callback
connect
(
&
m_checkbox
,
SIGNAL
(
toggled
(
bool
)
),
this
,
SLOT
(
changed
()
)
);
connect
(
&
m_button
,
SIGNAL
(
toggled
(
bool
)
),
this
,
SLOT
(
changed
()
)
);
...
...
@@ -64,6 +70,7 @@ void WPropertyBoolWidget::update()
// simply set the new state
m_checkbox
.
setChecked
(
m_boolProperty
->
get
()
);
m_button
.
setChecked
(
m_boolProperty
->
get
()
);
m_asText
.
setText
(
m_boolProperty
->
get
()
?
QString
(
"Yes"
)
:
QString
(
"No"
)
);
}
QPushButton
*
WPropertyBoolWidget
::
getButton
()
...
...
src/gui/qt4/datasetbrowser/WPropertyBoolWidget.h
View file @
1665cfc7
...
...
@@ -96,6 +96,16 @@ protected:
*/
bool
m_asButton
;
/**
* Used to show the property as text.
*/
QLabel
m_asText
;
/**
* The layout used for the pure output (information properties)
*/
QHBoxLayout
m_infoLayout
;
private:
public
slots
:
...
...
src/gui/qt4/datasetbrowser/WPropertyColorWidget.cpp
View file @
1665cfc7
...
...
@@ -38,7 +38,9 @@ WPropertyColorWidget::WPropertyColorWidget( WPropColor property, QGridLayout* pr
WPropertyWidget
(
property
,
propertyGrid
,
parent
),
m_colorProperty
(
property
),
m_button
(
&
m_parameterWidgets
),
m_layout
()
m_layout
(),
m_asText
(
&
m_informationWidgets
),
m_infoLayout
(
&
m_informationWidgets
)
{
// initialize members
m_parameterWidgets
.
setLayout
(
&
m_layout
);
...
...
@@ -46,6 +48,10 @@ WPropertyColorWidget::WPropertyColorWidget( WPropColor property, QGridLayout* pr
// layout both against each other
m_layout
.
addWidget
(
&
m_button
);
// Information Output ( Property Purpose = PV_PURPOSE_INFORMATION )
m_infoLayout
.
addWidget
(
&
m_asText
);
m_informationWidgets
.
setLayout
(
&
m_infoLayout
);
// set the initial values
update
();
...
...
@@ -61,6 +67,13 @@ WPropertyColorWidget::~WPropertyColorWidget()
void
WPropertyColorWidget
::
update
()
{
m_button
.
setPalette
(
QPalette
(
toQColor
(
m_colorProperty
->
get
()
)
)
);
// if this is a info property -> set background of label and some text
m_asText
.
setText
(
QString
::
fromStdString
(
m_colorProperty
->
getAsString
()
)
);
QPalette
pal
=
QPalette
();
pal
.
setColor
(
QPalette
::
Background
,
toQColor
(
m_colorProperty
->
get
()
)
);
m_asText
.
setAutoFillBackground
(
true
);
m_asText
.
setPalette
(
pal
);
}
QColor
WPropertyColorWidget
::
toQColor
(
WColor
color
)
...
...
src/gui/qt4/datasetbrowser/WPropertyColorWidget.h
View file @
1665cfc7
...
...
@@ -76,6 +76,16 @@ protected:
*/
QHBoxLayout
m_layout
;
/**
* Used to show the property as text.
*/
QLabel
m_asText
;
/**
* The layout used for the pure output (information properties)
*/
QHBoxLayout
m_infoLayout
;
private:
/**
...
...
src/gui/qt4/datasetbrowser/WPropertyDoubleWidget.cpp
View file @
1665cfc7
...
...
@@ -38,7 +38,9 @@ WPropertyDoubleWidget::WPropertyDoubleWidget( WPropDouble property, QGridLayout*
m_doubleProperty
(
property
),
m_slider
(
Qt
::
Horizontal
,
&
m_parameterWidgets
),
m_edit
(
&
m_parameterWidgets
),
m_layout
(
&
m_parameterWidgets
)
m_layout
(
&
m_parameterWidgets
),
m_asText
(
&
m_informationWidgets
),
m_infoLayout
(
&
m_informationWidgets
)
{
// initialize members
m_edit
.
resize
(
m_edit
.
minimumSizeHint
().
width
()
*
.8
,
m_edit
.
size
().
height
()
);
...
...
@@ -50,6 +52,10 @@ WPropertyDoubleWidget::WPropertyDoubleWidget( WPropDouble property, QGridLayout*
m_parameterWidgets
.
setLayout
(
&
m_layout
);
// Information Output ( Property Purpose = PV_PURPOSE_INFORMATION )
m_infoLayout
.
addWidget
(
&
m_asText
);
m_informationWidgets
.
setLayout
(
&
m_infoLayout
);
update
();
// connect the modification signal of the edit and slider with our callback
...
...
@@ -132,8 +138,12 @@ void WPropertyDoubleWidget::update()
// m_edit.resize( m_edit.minimumSizeHint().width() * length / 2, m_edit.size().height() );
// set the initial values
m_edit
.
setText
(
QString
(
toString
(
m_doubleProperty
->
get
()
).
c_str
()
)
);
QString
valStr
=
QString
(
toString
(
m_doubleProperty
->
get
()
).
c_str
()
);
m_edit
.
setText
(
valStr
);
m_slider
.
setValue
(
toPercent
(
m_doubleProperty
->
get
()
)
);
// do not forget to update the label
m_asText
.
setText
(
valStr
);
}
int
WPropertyDoubleWidget
::
toPercent
(
double
value
)
...
...
src/gui/qt4/datasetbrowser/WPropertyDoubleWidget.h
View file @
1665cfc7
...
...
@@ -110,6 +110,16 @@ protected:
*/
double
m_max
;
/**
* Used to show the property as text.
*/
QLabel
m_asText
;
/**
* The layout used for the pure output (information properties)
*/
QHBoxLayout
m_infoLayout
;
private:
public
slots
:
...
...
src/gui/qt4/datasetbrowser/WPropertyFilenameWidget.cpp
View file @
1665cfc7
...
...
@@ -39,7 +39,9 @@ WPropertyFilenameWidget::WPropertyFilenameWidget( WPropFilename property, QGridL
WPropertyWidget
(
property
,
propertyGrid
,
parent
),
m_fnProperty
(
property
),
m_button
(
&
m_parameterWidgets
),
m_layout
(
&
m_parameterWidgets
)
m_layout
(
&
m_parameterWidgets
),
m_asText
(
&
m_informationWidgets
),
m_infoLayout
(
&
m_informationWidgets
)
{
// initialize members
m_parameterWidgets
.
setLayout
(
&
m_layout
);
...
...
@@ -50,6 +52,10 @@ WPropertyFilenameWidget::WPropertyFilenameWidget( WPropFilename property, QGridL
// this prevents the button from resizing when a long path is selected
m_button
.
setSizePolicy
(
QSizePolicy
::
Ignored
,
QSizePolicy
::
Preferred
);
// Information Output ( Property Purpose = PV_PURPOSE_INFORMATION )
m_infoLayout
.
addWidget
(
&
m_asText
);
m_informationWidgets
.
setLayout
(
&
m_infoLayout
);
// set the initial values
update
();
...
...
@@ -64,7 +70,9 @@ WPropertyFilenameWidget::~WPropertyFilenameWidget()
void
WPropertyFilenameWidget
::
update
()
{
m_button
.
setText
(
QString
::
fromStdString
(
m_fnProperty
->
get
().
file_string
()
)
);
QString
val
=
QString
::
fromStdString
(
m_fnProperty
->
get
().
file_string
()
);
m_button
.
setText
(
val
);
m_asText
.
setText
(
val
);
}
void
WPropertyFilenameWidget
::
buttonReleased
()
...
...
src/gui/qt4/datasetbrowser/WPropertyFilenameWidget.h
View file @
1665cfc7
...
...
@@ -76,6 +76,16 @@ protected:
*/
QHBoxLayout
m_layout
;
/**
* Used to show the property as text.
*/
QLabel
m_asText
;
/**
* The layout used for the pure output (information properties)
*/
QHBoxLayout
m_infoLayout
;
private:
public
slots
:
...
...
src/gui/qt4/datasetbrowser/WPropertyIntWidget.cpp
View file @
1665cfc7
...
...
@@ -39,7 +39,9 @@ WPropertyIntWidget::WPropertyIntWidget( WPropInt property, QGridLayout* property
m_intProperty
(
property
),
m_slider
(
Qt
::
Horizontal
,
&
m_parameterWidgets
),
m_edit
(
&
m_parameterWidgets
),
m_layout
(
&
m_parameterWidgets
)
m_layout
(
&
m_parameterWidgets
),
m_asText
(
&
m_informationWidgets
),
m_infoLayout
(
&
m_informationWidgets
)
{
// initialize members
m_edit
.
resize
(
m_edit
.
minimumSizeHint
().
width
(),
m_edit
.
size
().
height
()
);
...
...
@@ -48,9 +50,12 @@ WPropertyIntWidget::WPropertyIntWidget( WPropInt property, QGridLayout* property
// layout both against each other
m_layout
.
addWidget
(
&
m_slider
);
m_layout
.
addWidget
(
&
m_edit
);
m_parameterWidgets
.
setLayout
(
&
m_layout
);
// Information Output ( Property Purpose = PV_PURPOSE_INFORMATION )
m_infoLayout
.
addWidget
(
&
m_asText
);
m_informationWidgets
.
setLayout
(
&
m_infoLayout
);
update
();
// connect the modification signal of the edit and slider with our callback
...
...
@@ -112,15 +117,18 @@ void WPropertyIntWidget::update()
int
length
=
6
;
// use fixed length to have a uniform look among several widgets
// resize the text widget
//
m_edit.setMaxLength( length );
//
m_edit.setMaxLength( length );
m_edit
.
setMaximumWidth
(
m_edit
.
minimumSizeHint
().
width
()
*
length
/
2
);
// m_edit.setMinimumWidth( m_edit.minimumSizeHint().width() * length / 4 );
// m_edit.resize( m_edit.minimumSizeHint().width() * length / 4, m_edit.size().height() );
// m_edit.setMinimumWidth( m_edit.minimumSizeHint().width() * length / 4 );
// m_edit.resize( m_edit.minimumSizeHint().width() * length / 4, m_edit.size().height() );
// set the initial values
m_edit
.
setText
(
QString
(
boost
::
lexical_cast
<
std
::
string
>
(
m_intProperty
->
get
()
).
c_str
()
)
);
QString
valStr
=
QString
(
boost
::
lexical_cast
<
std
::
string
>
(
m_intProperty
->
get
()
).
c_str
()
);
m_edit
.
setText
(
valStr
);
m_slider
.
setValue
(
m_intProperty
->
get
()
);
// do not forget to update the label
m_asText
.
setText
(
valStr
);
}
void
WPropertyIntWidget
::
sliderChanged
(
int
value
)
...
...
src/gui/qt4/datasetbrowser/WPropertyIntWidget.h
View file @
1665cfc7
...
...
@@ -82,6 +82,16 @@ protected:
*/
QHBoxLayout
m_layout
;
/**
* Used to show the property as text.
*/
QLabel
m_asText
;
/**
* The layout used for the pure output (information properties)
*/
QHBoxLayout
m_infoLayout
;
private:
public
slots
:
...
...
src/gui/qt4/datasetbrowser/WPropertySelectionWidget.cpp
View file @
1665cfc7
...
...
@@ -44,8 +44,6 @@ WPropertySelectionWidget::WPropertySelectionWidget( WPropSelection property, QGr
m_update
(
false
)
{
// initialize members
m_parameterWidgets
.
setLayout
(
&
m_layout
);
m_combo
=
NULL
;
m_list
=
NULL
;
...
...
@@ -102,6 +100,26 @@ WPropertySelectionWidget::WPropertySelectionWidget( WPropSelection property, QGr
connect
(
m_list
,
SIGNAL
(
itemSelectionChanged
()
),
this
,
SLOT
(
listSelectionChanged
()
)
);
}
// Information Output ( Property Purpose = PV_PURPOSE_INFORMATION )
// In this case -> use some disabled lists/combos here
if
(
m_property
->
getPurpose
()
==
PV_PURPOSE_INFORMATION
)
{
m_informationWidgets
.
setLayout
(
&
m_layout
);
if
(
m_list
)
{
m_list
->
setEnabled
(
false
);
}
else
{
m_combo
->
setEnabled
(
false
);
}
}
else
{
m_parameterWidgets
.
setLayout
(
&
m_layout
);
}
// set the initial values
update
();
}
...
...
src/gui/qt4/datasetbrowser/WPropertySelectionWidget.h
View file @
1665cfc7
...
...
@@ -87,6 +87,7 @@ protected:
* called when changed programmatically.
*/
bool
m_update
;
private:
public
slots
:
...
...
src/gui/qt4/datasetbrowser/WPropertyStringWidget.cpp
View file @
1665cfc7
...
...
@@ -36,7 +36,9 @@ WPropertyStringWidget::WPropertyStringWidget( WPropString property, QGridLayout*
WPropertyWidget
(
property
,
propertyGrid
,
parent
),
m_stringProperty
(
property
),
m_edit
(
&
m_parameterWidgets
),
m_layout
(
&
m_parameterWidgets
)
m_layout
(
&
m_parameterWidgets
),
m_asText
(
&
m_informationWidgets
),
m_infoLayout
(
&
m_informationWidgets
)
{
// initialize members
m_parameterWidgets
.
setLayout
(
&
m_layout
);
...
...
@@ -44,6 +46,13 @@ WPropertyStringWidget::WPropertyStringWidget( WPropString property, QGridLayout*
// layout
m_layout
.
addWidget
(
&
m_edit
);
// Information Output ( Property Purpose = PV_PURPOSE_INFORMATION )
m_infoLayout
.
addWidget
(
&
m_asText
);
m_informationWidgets
.
setLayout
(
&
m_infoLayout
);
m_asText
.
setWordWrap
(
true
);
// To have word warp work correctly -> set size policy
m_asText
.
setSizePolicy
(
QSizePolicy
(
QSizePolicy
::
MinimumExpanding
,
QSizePolicy
::
MinimumExpanding
)
);
// set the initial values
update
();
...
...
@@ -59,7 +68,9 @@ WPropertyStringWidget::~WPropertyStringWidget()
void
WPropertyStringWidget
::
update
()
{
m_edit
.
setText
(
QString
(
m_stringProperty
->
get
().
c_str
()
)
);
QString
val
=
QString
(
m_stringProperty
->
get
().
c_str
()
);
m_edit
.
setText
(
val
);
m_asText
.
setText
(
val
);
}
void
WPropertyStringWidget
::
editChanged
()
...
...
src/gui/qt4/datasetbrowser/WPropertyStringWidget.h
View file @
1665cfc7
...
...
@@ -77,6 +77,16 @@ protected:
*/
QHBoxLayout
m_layout
;
/**
* Used to show the property as text.
*/
QLabel
m_asText
;
/**
* The layout used for the pure output (information properties)
*/
QHBoxLayout
m_infoLayout
;
private:
public
slots
:
...
...
src/gui/qt4/datasetbrowser/WPropertyTriggerWidget.cpp
View file @
1665cfc7
...
...
@@ -30,7 +30,9 @@ WPropertyTriggerWidget::WPropertyTriggerWidget( WPropTrigger property, QGridLayo
WPropertyWidget
(
property
,
propertyGrid
,
parent
),
m_triggerProperty
(
property
),
m_button
(
&
m_parameterWidgets
),
m_layout
(
&
m_parameterWidgets
)
m_layout
(
&
m_parameterWidgets
),
m_asText
(
&
m_informationWidgets
),
m_infoLayout
(
&
m_informationWidgets
)
{
// initialize members
m_button
.
setCheckable
(
true
);
...
...
@@ -43,6 +45,10 @@ WPropertyTriggerWidget::WPropertyTriggerWidget( WPropTrigger property, QGridLayo
m_layout
.
setContentsMargins
(
1
,
1
,
1
,
1
);
m_parameterWidgets
.
setLayout
(
&
m_layout
);
// Information Output ( Property Purpose = PV_PURPOSE_INFORMATION )
m_infoLayout
.
addWidget
(
&
m_asText
);
m_informationWidgets
.
setLayout
(
&
m_infoLayout
);
// connect the modification signal of m_checkbox with our callback
connect
(
&
m_button
,
SIGNAL
(
toggled
(
bool
)
),
this
,
SLOT
(
changed
()
)
);
}
...
...
@@ -57,6 +63,9 @@ void WPropertyTriggerWidget::update()
// simply set the new state
m_button
.
setChecked
(
m_triggerProperty
->
get
()
==
WPVBaseTypes
::
PV_TRIGGER_TRIGGERED
);
m_button
.
setEnabled
(
m_triggerProperty
->
get
()
==
WPVBaseTypes
::
PV_TRIGGER_READY
);
// do not forget to update the label
m_asText
.
setText
(
m_triggerProperty
->
get
()
==
WPVBaseTypes
::
PV_TRIGGER_TRIGGERED
?
QString
(
"Operation triggered"
)
:
QString
(
"Ready"
)
);
}
QPushButton
*
WPropertyTriggerWidget
::
getButton
()
...
...
src/gui/qt4/datasetbrowser/WPropertyTriggerWidget.h
View file @
1665cfc7
...
...
@@ -84,6 +84,16 @@ protected:
*/
QHBoxLayout
m_layout
;
/**
* Used to show the property as text.
*/
QLabel
m_asText
;
/**
* The layout used for the pure output (information properties)
*/
QHBoxLayout
m_infoLayout
;
private:
public
slots
:
...
...
src/gui/qt4/datasetbrowser/WPropertyWidget.cpp
View file @
1665cfc7
...
...
@@ -38,6 +38,7 @@ WPropertyWidget::WPropertyWidget( boost::shared_ptr< WPropertyBase > property,
m_label
(
this
),
m_useLabel
(
m_propertyGrid
),
m_parameterWidgets
(),
// parent gets set by the QStackWidget
m_informationWidgets
(),
// parent gets set by the QStackWidget
m_invalid
(
false
)
{
if
(
m_useLabel
)
...
...
@@ -54,7 +55,15 @@ WPropertyWidget::WPropertyWidget( boost::shared_ptr< WPropertyBase > property,
m_propertyGrid
->
addWidget
(
this
,
row
,
1
);
}
// add both widgets to the stacked widget, it then uses the first as default.
addWidget
(
&
m_parameterWidgets
);
addWidget
(
&
m_informationWidgets
);
// if the purpose of the property is INFORMTION -> activate the information widget
if
(
m_property
->
getPurpose
()
==
PV_PURPOSE_INFORMATION
)
{
setCurrentIndex
(
1
);
}
// setup the update callback
m_connection
=
m_property
->
getUpdateCondition
()
->
subscribeSignal
(
boost
::
bind
(
&
WPropertyWidget
::
propertyChangeNotifier
,
this
)
);
...
...
src/gui/qt4/datasetbrowser/WPropertyWidget.h
View file @
1665cfc7
...
...
@@ -113,6 +113,11 @@ protected:
*/
QWidget
m_parameterWidgets
;
/**
* The widget containing a layout and provides the widgets for showing information properties.
*/
QWidget
m_informationWidgets
;
/**
* Flag denoting whether the widget is set to an invalid value.
*/
...
...
src/modules/template/WMTemplate.cpp
View file @
1665cfc7
...
...
@@ -297,12 +297,21 @@ void WMTemplate::properties()
// In more detail, the purpose type of the property gets set to PV_PURPOSE_INFORMATION automatically by m_infoProperties. You can, of course,
// add information properties to your custom groups or m_properties too. There, you need to set the purpose flag of the property manually:
std
::
string
message
=
std
::
string
(
"Hey you! Besides all these parameters, you also can print values, html formatted strings, colors and "
)
+
std
::
string
(
"so on using
properties
! Isn't it <b>amazing</b>?"
);
std
::
string
(
"so on using
<font color=
\"
#f00
\"
>properties</font>
! Isn't it <b>amazing</b>?"
);
m_aStringOutput
=
m_group1a
->
addProperty
(
"A Message"
,
"A message to the user."
,
message
);
m_aStringOutput
->
setPurpose
(
PV_PURPOSE_INFORMATION
);
// This adds the property m_aStringOutput to your group and sets its purpose. The default purpose for all properties is always
// "PV_PURPOSE_PARAMETER". It simply denotes the meaning of the property - its meant to be used as modifier for the module's behaviour; a
// parameter.
//
// Some more examples. Please note: Although every property type can be used as information property, not everything is really useful.
m_aTriggerOutput
=
m_infoProperties
->
addProperty
(
"A Trigger"
,
"Trigger As String"
,
WPVBaseTypes
::
PV_TRIGGER_READY
);
m_aDoubleOutput
=
m_infoProperties
->
addProperty
(
"Some Double"
,
"a Double. Nice isn't it?"
,
3.1415
);
m_aColorOutput
=
m_infoProperties
->
addProperty
(
"A Color"
,
"Some Color. Nice isn't it?"
,
WColor
(
0.5
,
0.5
,
1.0
,
1.0
)
);
m_aFilenameOutput
=
m_infoProperties
->
addProperty
(
"Nice File"
,
"a Double. Nice isn't it?"
,
WKernel
::
getAppPathObject
()
);
m_aSelectionOutput
=
m_infoProperties
->
addProperty
(
"A Selection"
,
"Selection As String"
,
m_possibleSelections
->
getSelectorFirst
()
);
// We can add info another property here too:
m_infoProperties
->
addProperty
(
m_aStringOutput
);
}
void
WMTemplate
::
moduleMain
()
...
...
@@ -320,7 +329,7 @@ void WMTemplate::moduleMain()
// useful whenever your module needs to do long operations to initialize. No other module can connect to your module before it signals its
// ready state. You can assume the code before ready() to be some kind of initialization code.
debugLog
()
<<
"Doing time consuming operations"
;
sleep
(
5
);
sleep
(
0
);
// Your module can use an moduleState variable to wait for certain events. Most commonly, these events are new data on input connectors or
// changed properties. You can decide which events the moduleState should handle. Therefore, use m_moduleState.add( ... ) to insert every
...
...
@@ -352,7 +361,7 @@ void WMTemplate::moduleMain()
// modified but the module can modify it. This is useful to provide statistics, counts, times or even a "hello world" string to the user
// as an information or status report. Please do not abuse these information properties as progress indicators. A short overview on how
// to make progress indicators is provided some lines below. Here, we simply increase the value.
m_aIntegerOutput
->
set
(
m_aIntegerOutput
->
get
()
+
1
);
m_aIntegerOutput
->
set
(
m_aIntegerOutput
->
get
()
+
1
);
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// After waking up, the module has to check whether the shutdownFlag fired. If yes, simply quit the module.
...
...
@@ -529,6 +538,9 @@ void WMTemplate::moduleMain()
// Now that the trigger has the state "triggered", a time consuming operation can be done here.
debugLog
()
<<
"User triggered an important and time consuming operation."
;
// Update the output property
m_aTriggerOutput
->
set
(
WPVBaseTypes
::
PV_TRIGGER_TRIGGERED
);
// Do something here. As above, do not forget to inform the user about your progress.
int
steps
=
10
;
boost
::
shared_ptr
<
WProgress
>
progress1
=
boost
::
shared_ptr
<
WProgress
>
(
new
WProgress
(
"Doing something important"
,
steps
)
);
...
...
@@ -546,6 +558,9 @@ void WMTemplate::moduleMain()
// To avoid the moduleMain- loop to awake every time we reset the trigger, provide a second parameter to the set() method. It denotes
// whether the change notification should be fired or not. In our case, we avoid this by providing false to the second parameter.
m_aTrigger
->
set
(
WPVBaseTypes
::
PV_TRIGGER_READY
,
false
);
// Also update the information property.
m_aTriggerOutput
->
set
(
WPVBaseTypes
::
PV_TRIGGER_READY
);
}
// This checks the selections.
...
...
src/modules/template/WMTemplate.h
View file @
1665cfc7
...
...
@@ -190,25 +190,52 @@ private:
*/
WPropTrigger
m_aTrigger
;
/**
* A property allowing the user to select ONE item of some list
*/
WPropSelection
m_aSingleSelection
;
/**
* A property allowing the user to select multiple elements of a list.
*/
WPropSelection
m_aMultiSelection
;
// Outputs -> demonstrate the use of information properties:
/**
* A property simply providing a integer value to the outside world.
*/
WPropInt
m_aIntegerOutput
;
/**
* A property simply providing a double value to the outside world.
*/
WPropDouble
m_aDoubleOutput
;
/**
* A property simply providing some text to the outside world.
*/
WPropString
m_aStringOutput
;
/**
* A
property allowing the user to select ONE item of some list
* A
Property used to show some color to the user.
*/
WProp
Selection
m_aSingleSelection
;
WProp
Color
m_aColorOutput
;
/**
* A
property allowing the user to select multiple elements of a list
.
* A
Property used to show some filename to the user
.
*/
WPropSelection
m_aMultiSelection
;
WPropFilename
m_aFilenameOutput
;
/**
* A Property used to show some trigger to the user.
*/
WPropTrigger
m_aTriggerOutput
;
/**
* A Property used to show some selection to the user.
*/
WPropSelection
m_aSelectionOutput
;
/**
* A list of items that can be selected using m_aSingleSelection or m_aMultiSelection.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment