Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
CAMP
campvis-public
Commits
97c25b99
Commit
97c25b99
authored
Aug 03, 2014
by
Christian Schulte zu Berge
Browse files
Merge branch 'async-signals' into 'development'
Async signals See merge request !87
parents
60ffea65
88feb87d
Changes
84
Hide whitespace changes
Inline
Side-by-side
CMakeLists.txt
View file @
97c25b99
...
...
@@ -45,6 +45,7 @@ MESSAGE(STATUS "----------------------------------------------------------------
IF
(
CAMPVIS_BUILD_LIB_TGT
)
ADD_SUBDIRECTORY
(
ext/tgt
)
ADD_SUBDIRECTORY
(
ext/sigslot
)
ENDIF
()
IF
(
CAMPVIS_BUILD_LIB_LUA
)
...
...
application/CMakeLists.txt
View file @
97c25b99
...
...
@@ -94,7 +94,7 @@ LIST(APPEND CampvisApplicationSources ${CampvisApplicationFormsHeaders})
LINK_DIRECTORIES
(
${
CampvisGlobalLinkDirectories
}
${
CampvisModulesLinkDirectories
}
)
SET
(
CampvisMainLibs campvis-core campvis-modules tgt
)
SET
(
CampvisMainLibs campvis-core campvis-modules tgt
sigslot
)
IF
(
CAMPVIS_ENABLE_SCRIPTING
)
LIST
(
APPEND CampvisMainLibs campvis-scripting
)
...
...
application/campvisapplication.cpp
View file @
97c25b99
...
...
@@ -67,6 +67,8 @@ namespace campvis {
// Make Xlib and GLX thread safe under X11
QApplication
::
setAttribute
(
Qt
::
AA_X11InitThreads
);
sigslot
::
signal_manager
::
init
();
sigslot
::
signal_manager
::
getRef
().
start
();
_mainWindow
=
new
MainWindow
(
this
);
tgt
::
GlContextManager
::
init
();
...
...
@@ -85,6 +87,9 @@ namespace campvis {
for
(
std
::
vector
<
DataContainer
*>::
iterator
it
=
_dataContainers
.
begin
();
it
!=
_dataContainers
.
end
();
++
it
)
{
delete
*
it
;
}
sigslot
::
signal_manager
::
getRef
().
stop
();
sigslot
::
signal_manager
::
deinit
();
}
void
CampVisApplication
::
init
()
{
...
...
@@ -264,7 +269,7 @@ namespace campvis {
_luaVmState
->
execString
(
"inspect(pipelines)"
);
#endif
s_PipelinesChanged
();
s_PipelinesChanged
.
emitSignal
();
}
void
CampVisApplication
::
initGlContextAndPipeline
(
tgt
::
GLCanvas
*
canvas
,
AbstractPipeline
*
pipeline
)
{
...
...
@@ -291,7 +296,7 @@ namespace campvis {
DataContainer
*
CampVisApplication
::
createAndAddDataContainer
(
const
std
::
string
&
name
)
{
DataContainer
*
dc
=
new
DataContainer
(
name
);
_dataContainers
.
push_back
(
dc
);
s_DataContainersChanged
();
s_DataContainersChanged
.
emitSignal
();
return
dc
;
}
...
...
application/campvisapplication.h
View file @
97c25b99
...
...
@@ -145,10 +145,10 @@ namespace campvis {
/// Signal emitted when the collection of pipelines has changed.
sigslot
::
signal0
<>
s_PipelinesChanged
;
sigslot
::
signal0
s_PipelinesChanged
;
/// Signal emitted when the collection of DataContainers has changed.
sigslot
::
signal0
<>
s_DataContainersChanged
;
sigslot
::
signal0
s_DataContainersChanged
;
private:
void
initGlContextAndPipeline
(
tgt
::
GLCanvas
*
canvas
,
AbstractPipeline
*
pipeline
);
...
...
application/campvispainter.h
View file @
97c25b99
...
...
@@ -45,7 +45,7 @@ namespace campvis {
/**
* Painter class for CAMPVis, rendering the render target of an AbstractPipeline.
*/
class
CampVisPainter
:
public
tgt
::
Painter
,
public
sigslot
::
has_slots
<>
{
class
CampVisPainter
:
public
tgt
::
Painter
,
public
sigslot
::
has_slots
{
public:
/**
* Creates a new CampVisPainter rendering the render target of \a pipeline on \a canvas.
...
...
application/gui/datacontainerfileloaderwidget.h
View file @
97c25b99
...
...
@@ -37,7 +37,7 @@
namespace
campvis
{
class
DataContainerFileLoaderWidget
:
public
QWidget
,
public
sigslot
::
has_slots
<>
{
class
DataContainerFileLoaderWidget
:
public
QWidget
,
public
sigslot
::
has_slots
{
Q_OBJECT
;
public:
...
...
application/gui/datacontainerinspectorcanvas.cpp
View file @
97c25b99
...
...
@@ -450,7 +450,7 @@ namespace campvis {
_geometryRenderer
.
p_geometryID
.
setValue
(
name
+
".geometry"
);
_geometryRenderer
.
p_renderTargetID
.
setValue
(
name
+
".rendered"
);
_geometryRenderer
.
validate
(
AbstractProcessor
::
INVALID_PROPERTIES
);
_geometryRenderer
.
process
(
_localDataContainer
,
false
);
_geometryRenderer
.
process
(
_localDataContainer
);
// grab render result texture from local DataContainer and push into texture vector.
ScopedTypedData
<
RenderData
>
rd
(
_localDataContainer
,
name
+
".rendered"
);
...
...
application/gui/datacontainerinspectorcanvas.h
View file @
97c25b99
...
...
@@ -150,7 +150,7 @@ namespace campvis {
* \param name Name of the added data.
* \param dh DataHandle to the newly added data.
*/
void
onDataContainerDataAdded
(
const
std
::
string
&
name
,
const
DataHandle
&
dh
);
void
onDataContainerDataAdded
(
const
std
::
string
&
name
,
DataHandle
dh
);
/**
* Slot getting called when one of the observed properties changed and notifies its observers.
...
...
application/gui/datacontainerinspectorwidget.cpp
View file @
97c25b99
...
...
@@ -115,7 +115,7 @@ namespace campvis {
return
_dataContainer
;
}
void
DataContainerInspectorWidget
::
onDataContainerDataAdded
(
const
std
::
string
&
key
,
const
DataHandle
&
dh
)
{
void
DataContainerInspectorWidget
::
onDataContainerDataAdded
(
const
std
::
string
&
key
,
DataHandle
dh
)
{
// copy QtDataHandle because signal will be handled by a different thread an indefinite amount of time later:
emit
dataContainerChanged
(
QString
::
fromStdString
(
key
),
QtDataHandle
(
dh
));
}
...
...
application/gui/datacontainerinspectorwidget.h
View file @
97c25b99
...
...
@@ -58,7 +58,7 @@ namespace campvis {
class
FaceGeometry
;
class
DataContainerFileLoaderWidget
;
class
DataContainerInspectorWidget
:
public
QWidget
,
public
sigslot
::
has_slots
<>
{
class
DataContainerInspectorWidget
:
public
QWidget
,
public
sigslot
::
has_slots
{
Q_OBJECT
;
public:
...
...
@@ -87,7 +87,7 @@ namespace campvis {
/**
* Slot called when _dataContainer has changed and emitted the s_dataAdded signal.
*/
void
onDataContainerDataAdded
(
const
std
::
string
&
,
const
DataHandle
&
);
void
onDataContainerDataAdded
(
const
std
::
string
&
,
DataHandle
);
/**
* Size hint for the default window size
...
...
application/gui/datacontainertreewidget.cpp
View file @
97c25b99
...
...
@@ -82,7 +82,7 @@ namespace campvis {
// ================================================================================================
DataHandleTreeItem
::
DataHandleTreeItem
(
const
QtDataHandle
&
dataHandle
,
const
std
::
string
&
name
,
TreeItem
*
parent
)
DataHandleTreeItem
::
DataHandleTreeItem
(
QtDataHandle
dataHandle
,
const
std
::
string
&
name
,
TreeItem
*
parent
)
:
TreeItem
(
parent
)
,
_dataHandle
(
dataHandle
)
,
_name
(
name
)
...
...
@@ -150,7 +150,7 @@ namespace campvis {
DataHandleTreeItem
::~
DataHandleTreeItem
()
{
}
void
DataHandleTreeItem
::
setDataHandle
(
const
QtDataHandle
&
dataHandle
)
{
void
DataHandleTreeItem
::
setDataHandle
(
QtDataHandle
dataHandle
)
{
_dataHandle
=
dataHandle
;
updateChildren
();
}
...
...
application/gui/datacontainertreewidget.h
View file @
97c25b99
...
...
@@ -62,7 +62,7 @@ namespace campvis {
* \param name Name of the QtDataHandle
* \param parent Parent TreeItem
*/
DataHandleTreeItem
(
const
QtDataHandle
&
dataHandle
,
const
std
::
string
&
name
,
TreeItem
*
parent
);
DataHandleTreeItem
(
QtDataHandle
dataHandle
,
const
std
::
string
&
name
,
TreeItem
*
parent
);
/**
* Destructor, deletes the QtDataHandle
...
...
@@ -77,7 +77,7 @@ namespace campvis {
* \note DataHandleTreeItem takes ownership of this pointer.
* \param dataHandle The QtDataHandle to wrap around, DataHandleTreeItem takes ownership of this pointer!
*/
void
setDataHandle
(
const
QtDataHandle
&
dataHandle
);
void
setDataHandle
(
QtDataHandle
dataHandle
);
private:
/**
...
...
application/gui/mainwindow.cpp
View file @
97c25b99
...
...
@@ -142,6 +142,8 @@ namespace campvis {
_dcInspectorWidget
=
new
DataContainerInspectorWidget
();
this
->
populateMainMenu
();
qRegisterMetaType
<
std
::
vector
<
DataContainer
*>
>
(
"std::vector<DataContainer*>"
);
qRegisterMetaType
<
std
::
vector
<
AbstractPipeline
*>
>
(
"std::vector<AbstractPipeline*>"
);
connect
(
this
,
SIGNAL
(
updatePipelineWidget
(
const
std
::
vector
<
DataContainer
*>&
,
const
std
::
vector
<
AbstractPipeline
*>&
)),
_pipelineWidget
,
SLOT
(
update
(
const
std
::
vector
<
DataContainer
*>&
,
const
std
::
vector
<
AbstractPipeline
*>&
)));
...
...
application/gui/mainwindow.h
View file @
97c25b99
...
...
@@ -52,7 +52,7 @@ namespace campvis {
* Main Window for the CAMPVis application.
* Wraps a nice Qt GUI around the CampVisApplication instance given during creation.
*/
class
MainWindow
:
public
QMainWindow
,
public
sigslot
::
has_slots
<>
{
class
MainWindow
:
public
QMainWindow
,
public
sigslot
::
has_slots
{
Q_OBJECT
public:
...
...
application/gui/properties/abstractpropertywidget.h
View file @
97c25b99
...
...
@@ -38,7 +38,7 @@ namespace campvis {
/**
* Abstract base class for property widgets.
*/
class
AbstractPropertyWidget
:
public
QWidget
,
public
sigslot
::
has_slots
<>
{
class
AbstractPropertyWidget
:
public
QWidget
,
public
sigslot
::
has_slots
{
Q_OBJECT
;
public:
...
...
application/gui/properties/abstracttransferfunctioneditor.cpp
View file @
97c25b99
...
...
@@ -38,7 +38,8 @@ namespace campvis {
}
AbstractTransferFunctionEditor
::~
AbstractTransferFunctionEditor
()
{
_transferFunction
->
s_changed
.
disconnect
(
this
);
if
(
_transferFunction
!=
nullptr
)
_transferFunction
->
s_changed
.
disconnect
(
this
);
}
void
AbstractTransferFunctionEditor
::
onTFChanged
()
{
...
...
application/gui/properties/abstracttransferfunctioneditor.h
View file @
97c25b99
...
...
@@ -40,7 +40,7 @@ namespace campvis {
/**
* Abstract base class for transfer function editors.
*/
class
AbstractTransferFunctionEditor
:
public
QWidget
,
public
sigslot
::
has_slots
<>
{
class
AbstractTransferFunctionEditor
:
public
QWidget
,
public
sigslot
::
has_slots
{
Q_OBJECT
;
public:
...
...
application/gui/properties/datanamepropertywidget.cpp
View file @
97c25b99
...
...
@@ -46,6 +46,7 @@ namespace campvis {
sl
.
append
(
QString
::
fromStdString
(
tmp
[
i
].
first
));
_combobox
->
addItems
(
sl
);
dc
->
s_dataAdded
.
connect
(
this
,
&
DataNamePropertyWidget
::
onDataAdded
);
connect
(
this
,
SIGNAL
(
s_dataAddedQt
(
const
QString
&
,
QtDataHandle
)),
this
,
SLOT
(
onDataAddedQt
(
const
QString
&
,
QtDataHandle
)));
setCurrentComboBoxText
(
QString
::
fromStdString
(
property
->
getValue
()));
}
...
...
@@ -98,9 +99,13 @@ namespace campvis {
--
_ignorePropertyUpdates
;
}
void
DataNamePropertyWidget
::
onDataAdded
(
const
std
::
string
&
key
,
const
DataHandle
&
/*dh*/
)
{
if
(
_combobox
->
findText
(
QString
::
fromStdString
(
key
))
==
-
1
)
{
_combobox
->
addItem
(
QString
::
fromStdString
(
key
));
void
DataNamePropertyWidget
::
onDataAdded
(
const
std
::
string
&
key
,
DataHandle
dh
)
{
emit
s_dataAddedQt
(
QString
::
fromStdString
(
key
),
dh
);
}
void
DataNamePropertyWidget
::
onDataAddedQt
(
const
QString
&
key
,
QtDataHandle
dh
)
{
if
(
_combobox
->
findText
(
key
)
==
-
1
)
{
_combobox
->
addItem
(
key
);
}
}
...
...
application/gui/properties/datanamepropertywidget.h
View file @
97c25b99
...
...
@@ -27,6 +27,7 @@
#include "sigslot/sigslot.h"
#include "core/properties/datanameproperty.h"
#include "application/gui/qtdatahandle.h"
#include "application/gui/properties/abstractpropertywidget.h"
#include "application/gui/properties/propertywidgetfactory.h"
...
...
@@ -64,10 +65,14 @@ namespace campvis {
*/
virtual
void
updateWidgetFromProperty
();
void
onDataAdded
(
const
std
::
string
&
key
,
const
DataHandle
&
dh
);
void
onDataAdded
(
const
std
::
string
&
key
,
DataHandle
dh
);
private
slots
:
void
onTextChanged
(
const
QString
&
text
);
void
onDataAddedQt
(
const
QString
&
key
,
QtDataHandle
dh
);
signals:
void
s_dataAddedQt
(
const
QString
&
key
,
QtDataHandle
dh
);
private:
/**
...
...
application/gui/properties/geometry1dtransferfunctioneditor.cpp
View file @
97c25b99
...
...
@@ -59,25 +59,16 @@ namespace campvis {
{
_selectedGeometry
=
0
;
setupGUI
();
tf
->
s_geometryCollectionChanged
.
connect
(
this
,
&
Geometry1DTransferFunctionEditor
::
onGeometryCollectionChanged
);
tf
->
s_aboutToBeDeleted
.
connect
(
this
,
&
Geometry1DTransferFunctionEditor
::
onTfAboutToBeDeleted
);
updateManipulators
();
setEventTypes
(
tgt
::
Event
::
MOUSEPRESSEVENT
);
}
Geometry1DTransferFunctionEditor
::~
Geometry1DTransferFunctionEditor
()
{
tbb
::
mutex
::
scoped_lock
lock
(
_localMutex
);
// clearEventListeners and delete former stuff
_selectedGeometry
=
0
;
for
(
std
::
vector
<
AbstractTFGeometryManipulator
*>::
iterator
it
=
_manipulators
.
begin
();
it
!=
_manipulators
.
end
();
++
it
)
{
if
(
WholeTFGeometryManipulator
*
tester
=
dynamic_cast
<
WholeTFGeometryManipulator
*>
(
*
it
))
{
tester
->
s_selected
.
disconnect
(
this
);
}
delete
*
it
;
}
Geometry1DTransferFunction
*
gtf
=
static_cast
<
Geometry1DTransferFunction
*>
(
_transferFunction
);
gtf
->
s_geometryCollectionChanged
.
disconnect
(
this
);
disconnectFromTf
();
if
(
OpenGLJobProcessor
::
isInited
())
GLJobProc
.
deregisterContext
(
_canvas
);
...
...
@@ -215,7 +206,7 @@ namespace campvis {
}
updateManipulators
();
g
->
s_changed
();
g
->
s_changed
.
emitSignal
();
}
else
{
_selectedGeometry
=
0
;
...
...
@@ -352,5 +343,31 @@ namespace campvis {
invalidate
();
}
void
Geometry1DTransferFunctionEditor
::
onTfAboutToBeDeleted
()
{
disconnectFromTf
();
}
void
Geometry1DTransferFunctionEditor
::
disconnectFromTf
()
{
tbb
::
mutex
::
scoped_lock
lock
(
_localMutex
);
// clearEventListeners and delete former stuff
_selectedGeometry
=
0
;
for
(
std
::
vector
<
AbstractTFGeometryManipulator
*>::
iterator
it
=
_manipulators
.
begin
();
it
!=
_manipulators
.
end
();
++
it
)
{
if
(
WholeTFGeometryManipulator
*
tester
=
dynamic_cast
<
WholeTFGeometryManipulator
*>
(
*
it
))
{
tester
->
s_selected
.
disconnect
(
this
);
}
delete
*
it
;
}
_manipulators
.
clear
();
Geometry1DTransferFunction
*
gtf
=
static_cast
<
Geometry1DTransferFunction
*>
(
_transferFunction
);
if
(
gtf
!=
nullptr
)
{
gtf
->
s_geometryCollectionChanged
.
disconnect
(
this
);
gtf
->
s_aboutToBeDeleted
.
disconnect
(
this
);
_transferFunction
->
s_changed
.
disconnect
(
this
);
_transferFunction
=
nullptr
;
}
}
}
Prev
1
2
3
4
5
Next
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