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
3719723b
Commit
3719723b
authored
Aug 16, 2010
by
Sebastian Eichelbaum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[CHANGE] - switched items to be pointers for easier handling.
parent
d8e07c2a
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
36 additions
and
24 deletions
+36
-24
src/common/WItemSelection.cpp
src/common/WItemSelection.cpp
+3
-2
src/common/WItemSelection.h
src/common/WItemSelection.h
+3
-3
src/common/WItemSelector.cpp
src/common/WItemSelector.cpp
+2
-2
src/common/WItemSelector.h
src/common/WItemSelector.h
+2
-2
src/gui/qt4/datasetbrowser/WPropertySelectionWidget.cpp
src/gui/qt4/datasetbrowser/WPropertySelectionWidget.cpp
+8
-8
src/kernel/modules/data/WMData.cpp
src/kernel/modules/data/WMData.cpp
+11
-0
src/modules/coordinateHUD/WMCoordinateHUD.cpp
src/modules/coordinateHUD/WMCoordinateHUD.cpp
+4
-4
src/modules/coordinateSystem/WMCoordinateSystem.cpp
src/modules/coordinateSystem/WMCoordinateSystem.cpp
+1
-1
src/modules/template/WMTemplate.cpp
src/modules/template/WMTemplate.cpp
+2
-2
No files found.
src/common/WItemSelection.cpp
View file @
3719723b
...
...
@@ -32,7 +32,8 @@
#include "WItemSelection.h"
WItemSelection
::
WItemSelection
()
WItemSelection
::
WItemSelection
()
:
WSharedSequenceContainer
<
std
::
vector
<
boost
::
shared_ptr
<
WItemSelectionItem
>
>
>
()
{
// initialize members
}
...
...
@@ -88,6 +89,6 @@ WItemSelector WItemSelection::getSelector( size_t item )
void
WItemSelection
::
addItem
(
std
::
string
name
,
std
::
string
description
,
const
char
**
icon
)
{
push_back
(
WItemSelectionItem
(
name
,
description
,
icon
)
);
push_back
(
boost
::
shared_ptr
<
WItemSelectionItem
>
(
new
WItemSelectionItem
(
name
,
description
,
icon
)
)
);
}
src/common/WItemSelection.h
View file @
3719723b
...
...
@@ -48,7 +48,7 @@ class WItemSelector;
* automatically using the change condition of the inherited WSharedSequenceContainer.
*/
class
OWCOMMON_EXPORT
WItemSelection
:
public
boost
::
enable_shared_from_this
<
WItemSelection
>
,
public
WSharedSequenceContainer
<
std
::
vector
<
WItemSelectionItem
>
>
public
WSharedSequenceContainer
<
std
::
vector
<
boost
::
shared_ptr
<
WItemSelectionItem
>
>
>
{
friend
class
WItemSelector
;
// for proper locking and unlocking
public:
...
...
@@ -101,9 +101,9 @@ public:
*
* \return the Item.
*/
static
WItemSelectionItem
Item
(
std
::
string
name
,
std
::
string
description
=
""
,
const
char
**
icon
=
NULL
)
static
boost
::
shared_ptr
<
WItemSelectionItem
>
Item
(
std
::
string
name
,
std
::
string
description
=
""
,
const
char
**
icon
=
NULL
)
{
return
WItemSelectionItem
(
name
,
description
,
icon
);
return
boost
::
shared_ptr
<
WItemSelectionItem
>
(
new
WItemSelectionItem
(
name
,
description
,
icon
)
);
}
/**
...
...
src/common/WItemSelector.cpp
View file @
3719723b
...
...
@@ -145,12 +145,12 @@ size_t WItemSelector::size() const
return
m_selected
.
size
();
}
const
WItemSelectionItem
&
WItemSelector
::
atAll
(
size_t
index
)
const
const
boost
::
shared_ptr
<
WItemSelectionItem
>
WItemSelector
::
atAll
(
size_t
index
)
const
{
return
m_selection
->
at
(
index
);
}
const
WItemSelectionItem
&
WItemSelector
::
at
(
size_t
index
)
const
const
boost
::
shared_ptr
<
WItemSelectionItem
>
WItemSelector
::
at
(
size_t
index
)
const
{
return
m_selection
->
at
(
getItemIndexOfSelected
(
index
)
);
}
...
...
src/common/WItemSelector.h
View file @
3719723b
...
...
@@ -176,7 +176,7 @@ public:
*
* \return the item
*/
virtual
const
WItemSelectionItem
&
atAll
(
size_t
index
)
const
;
virtual
const
boost
::
shared_ptr
<
WItemSelectionItem
>
atAll
(
size_t
index
)
const
;
/**
* Gets the selected item with the given index. This is not the same index as the element has in the corresponding WItemSelection!
...
...
@@ -186,7 +186,7 @@ public:
*
* \return the item
*/
virtual
const
WItemSelectionItem
&
at
(
size_t
index
)
const
;
virtual
const
boost
::
shared_ptr
<
WItemSelectionItem
>
at
(
size_t
index
)
const
;
/**
* Helps to get the index of an selected item in the WItemSelection. This is somehow similar to \ref at, but does not return the item but the
...
...
src/gui/qt4/datasetbrowser/WPropertySelectionWidget.cpp
View file @
3719723b
...
...
@@ -152,12 +152,12 @@ void WPropertySelectionWidget::update()
// add all items from the selection set:
for
(
size_t
i
=
0
;
i
<
sValid
.
sizeAll
();
++
i
)
{
m_combo
->
addItem
(
QString
::
fromStdString
(
sValid
.
atAll
(
i
)
.
getName
()
)
);
m_combo
->
addItem
(
QString
::
fromStdString
(
sValid
.
atAll
(
i
)
->
getName
()
)
);
// if there is an icon -> show it
if
(
sValid
.
atAll
(
i
)
.
getIcon
()
)
if
(
sValid
.
atAll
(
i
)
->
getIcon
()
)
{
// scale the pixmap to a maximum size if larger
QPixmap
pix
=
ensureSize
(
QPixmap
(
sValid
.
atAll
(
i
)
.
getIcon
()
)
);
QPixmap
pix
=
ensureSize
(
QPixmap
(
sValid
.
atAll
(
i
)
->
getIcon
()
)
);
// set icon
m_combo
->
setItemIcon
(
i
,
QIcon
(
pix
)
);
...
...
@@ -194,23 +194,23 @@ void WPropertySelectionWidget::update()
int
column
=
0
;
// if there is an icon -> show it
if
(
sValid
.
atAll
(
i
)
.
getIcon
()
)
if
(
sValid
.
atAll
(
i
)
->
getIcon
()
)
{
QLabel
*
icon
=
new
QLabel
();
QSizePolicy
sizePolicy
(
QSizePolicy
::
Maximum
,
QSizePolicy
::
Preferred
);
// <-- scale it down
icon
->
setSizePolicy
(
sizePolicy
);
icon
->
setPixmap
(
ensureSize
(
QPixmap
(
sValid
.
atAll
(
i
)
.
getIcon
()
)
)
);
icon
->
setPixmap
(
ensureSize
(
QPixmap
(
sValid
.
atAll
(
i
)
->
getIcon
()
)
)
);
layoutWidget
->
addWidget
(
icon
,
0
,
0
,
2
,
1
);
++
column
;
}
// Add Name and Description
layoutWidget
->
addWidget
(
new
QLabel
(
"<b>"
+
QString
::
fromStdString
(
sValid
.
atAll
(
i
)
.
getName
()
)
+
"</b>"
),
0
,
column
);
layoutWidget
->
addWidget
(
new
QLabel
(
"<b>"
+
QString
::
fromStdString
(
sValid
.
atAll
(
i
)
->
getName
()
)
+
"</b>"
),
0
,
column
);
// if there is no description -> no widget added to save space
if
(
!
sValid
.
atAll
(
i
)
.
getDescription
().
empty
()
)
if
(
!
sValid
.
atAll
(
i
)
->
getDescription
().
empty
()
)
{
layoutWidget
->
addWidget
(
new
QLabel
(
QString
::
fromStdString
(
sValid
.
atAll
(
i
)
.
getDescription
()
)
),
1
,
column
);
layoutWidget
->
addWidget
(
new
QLabel
(
QString
::
fromStdString
(
sValid
.
atAll
(
i
)
->
getDescription
()
)
),
1
,
column
);
}
layoutWidget
->
setSizeConstraint
(
QLayout
::
SetMaximumSize
);
...
...
src/kernel/modules/data/WMData.cpp
View file @
3719723b
...
...
@@ -402,6 +402,17 @@ void WMData::moduleMain()
debugLog
()
<<
"Loading data done."
;
// register the dataset properties
m_properties
->
addProperty
(
m_dataSet
->
getProperties
()
);
m_infoProperties
->
addProperty
(
m_dataSet
->
getInformationProperties
()
);
// textures also provide properties
if
(
m_dataSet
->
isTexture
()
)
{
m_properties
->
addProperty
(
m_dataSet
->
getTexture
()
->
getProperties
()
);
m_infoProperties
->
addProperty
(
m_dataSet
->
getTexture
()
->
getInformationProperties
()
);
}
// i am interested in the active property ( manually subscribe signal )
m_active
->
getCondition
()
->
subscribeSignal
(
boost
::
bind
(
&
WMData
::
propertyChanged
,
this
,
m_active
)
);
...
...
src/modules/coordinateHUD/WMCoordinateHUD.cpp
View file @
3719723b
...
...
@@ -122,17 +122,17 @@ void WMCoordinateHUD::moduleMain()
while
(
!
m_shutdownFlag
()
)
{
WItemSelector
s
=
m_aSingleSelection
->
get
(
true
);
debugLog
()
<<
"New mode selected: "
<<
s
.
at
(
0
)
.
getName
();
debugLog
()
<<
"New mode selected: "
<<
s
.
at
(
0
)
->
getName
();
if
(
s
.
at
(
0
)
.
getName
()
==
"colored axis"
)
if
(
s
.
at
(
0
)
->
getName
()
==
"colored axis"
)
{
buildColorAxis
();
}
else
if
(
s
.
at
(
0
)
.
getName
()
==
"b/w axis"
)
else
if
(
s
.
at
(
0
)
->
getName
()
==
"b/w axis"
)
{
buildBWAxis
();
}
else
if
(
s
.
at
(
0
)
.
getName
()
==
"colored cube"
)
else
if
(
s
.
at
(
0
)
->
getName
()
==
"colored cube"
)
{
buildColorCube
();
}
...
...
src/modules/coordinateSystem/WMCoordinateSystem.cpp
View file @
3719723b
...
...
@@ -162,7 +162,7 @@ void WMCoordinateSystem::propertyChanged()
if
(
m_csSelection
->
changed
()
)
{
WItemSelector
s
=
m_csSelection
->
get
(
true
);
infoLog
()
<<
"Selected "
<<
s
.
at
(
0
)
.
getName
()
<<
" coordinate system."
;
infoLog
()
<<
"Selected "
<<
s
.
at
(
0
)
->
getName
()
<<
" coordinate system."
;
m_coordConverter
->
setCoordinateSystemMode
(
static_cast
<
coordinateSystemMode
>
(
s
.
getItemIndexOfSelected
(
0
)
)
);
}
...
...
src/modules/template/WMTemplate.cpp
View file @
3719723b
...
...
@@ -609,13 +609,13 @@ void WMTemplate::moduleMain()
// The single selector allows only one selected item and requires one item to be selected all the time. So accessing it by index
// is trivial:
WItemSelector
s
=
m_aSingleSelection
->
get
(
true
);
infoLog
()
<<
"The user likes "
<<
s
.
at
(
0
)
.
getName
()
<<
" the most."
;
infoLog
()
<<
"The user likes "
<<
s
.
at
(
0
)
->
getName
()
<<
" the most."
;
// The multi property allows the selection of several items. So, iteration needs to be done here:
s
=
m_aMultiSelection
->
get
(
true
);
for
(
size_t
i
=
0
;
i
<
s
.
size
();
++
i
)
{
infoLog
()
<<
"The user likes "
<<
s
.
at
(
i
)
.
getName
();
infoLog
()
<<
"The user likes "
<<
s
.
at
(
i
)
->
getName
();
}
}
}
...
...
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