Commit c22c8b9a authored by Jan Möbius's avatar Jan Möbius

Added function to get a unique viewer id

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@7092 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 34ed8b86
...@@ -111,6 +111,10 @@ static ViewObjectMarker* defaultMarker_ = 0; ...@@ -111,6 +111,10 @@ static ViewObjectMarker* defaultMarker_ = 0;
*/ */
static QGLWidget* shareGLWidget_ = 0; static QGLWidget* shareGLWidget_ = 0;
/** This is a unique id for the running OpenFlipper instance. Use it to identify yourself on the network
*/
static int viewerId_ = 0;
void setDataRoot( BaseObject* _root ) { void setDataRoot( BaseObject* _root ) {
objectRoot_ = _root; objectRoot_ = _root;
} }
...@@ -119,9 +123,18 @@ int viewers( ) { ...@@ -119,9 +123,18 @@ int viewers( ) {
return examiner_widgets_.size(); return examiner_widgets_.size();
} }
int viewerId() {
return viewerId_;
}
void setViewers( std::vector< glViewer* > _viewerWidgets ) { void setViewers( std::vector< glViewer* > _viewerWidgets ) {
PluginFunctions::examiner_widgets_ = _viewerWidgets; PluginFunctions::examiner_widgets_ = _viewerWidgets;
PluginFunctions::examiner_widget_ = examiner_widgets_[0]; PluginFunctions::examiner_widget_ = examiner_widgets_[0];
// Generate a (hopefully) unique viewer id
QTime time = QTime::currentTime();
qsrand( time.hour() * 10 + time.minute() * 100 + time.second() * 1000 + time.msec() * 10000 );
viewerId_ = qrand();
} }
void setViewerProperties( std::vector< Viewer::ViewerProperties* > _viewerProperties ) { void setViewerProperties( std::vector< Viewer::ViewerProperties* > _viewerProperties ) {
......
...@@ -556,6 +556,15 @@ BaseObjectData* baseObjectData( BaseObject* _object ); ...@@ -556,6 +556,15 @@ BaseObjectData* baseObjectData( BaseObject* _object );
/** @} */ /** @} */
/** \brief Return unique viewer id
*
* This function returns a id which is unique to all running Openflippers on that machine.
* This id changes when you restart the viewer!
*/
DLLEXPORT
int viewerId();
/// Get the root of the object structure /// Get the root of the object structure
DLLEXPORT DLLEXPORT
BaseObject*& objectRoot(); BaseObject*& objectRoot();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment