diff --git a/Core/Core.cc b/Core/Core.cc index 425094a0c64fb7a33fdcb63237ac88cd6cdc3886..a89839dbae7c9b74d502ebb3ad8132a1c7998377 100644 --- a/Core/Core.cc +++ b/Core/Core.cc @@ -839,22 +839,6 @@ void Core::slotExit() { qApp->quit(); } -/// Synchronise two viewers -bool Core::add_sync_host(const QString& _name) -{ - // Todo : Only syncing one Viewer - if ( OpenFlipper::Options::gui() ) { - emit log(LOGINFO,"Adding SyncHost"); - bool ok = coreWidget_->examiner_widgets_[0]->add_sync_host(_name); - if (ok) - coreWidget_->examiner_widgets_[0]->setSynchronization(true); - else - emit log(LOGERR,"Sync failed! "); - return ok; - } - return false; -} - /// log to file void Core::slotLogToFile(Logtype _type, QString _message){ diff --git a/Core/ParseIni.cc b/Core/ParseIni.cc index 250eb3269ca01f60abf336f0a188de518ab53deb..8ae8f3a2d5adc1893311d756c9fb0812d1598298 100644 --- a/Core/ParseIni.cc +++ b/Core/ParseIni.cc @@ -432,7 +432,6 @@ void Core::writeApplicationOptions(INIFile& _ini) { _ini.add_entry("Options","BackfaceCulling",coreWidget_->examiner_widgets_[0]->backFaceCulling()); _ini.add_entry("Options","Animation",coreWidget_->examiner_widgets_[0]->animation()); - _ini.add_entry("Options","Synchronization",coreWidget_->examiner_widgets_[0]->synchronization()); _ini.add_entry("Options","twoSidedLighting",coreWidget_->examiner_widgets_[0]->twoSidedLighting()); _ini.add_entry("Options","WheelZoomFactor",coreWidget_->examiner_widgets_[0]->wheelZoomFactor()); diff --git a/widgets/coreWidget/ContextMenu.cc b/widgets/coreWidget/ContextMenu.cc index 4b122a11264393d8e9b359182c944c62736f6d5a..974041bda11bf9e6545f95a0de2c9ab0afc74841 100644 --- a/widgets/coreWidget/ContextMenu.cc +++ b/widgets/coreWidget/ContextMenu.cc @@ -251,16 +251,6 @@ void CoreWidget::updatePopupMenu(const QPoint& _point, unsigned int _examinerId) //==================================================================================================== - action = functionMenu_->addAction("Synchronization"); - action->setToolTip("Synchronize two different viewers"); - action->setCheckable( true ); - action->setChecked( OpenFlipper::Options::synchronization() ); - for ( uint i = 0 ; i < OpenFlipper::Options::examinerWidgets() ; ++i ) - connect(action, SIGNAL(triggered(bool)), examiner_widgets_[i], SLOT(setSynchronization(bool)) ); - connect(action, SIGNAL(triggered(bool)), this, SLOT(updateGlobalOptions(bool)) ); - - //==================================================================================================== - action = functionMenu_->addAction("Animation"); action->setToolTip("Animate rotation of objects"); action->setCheckable( true ); @@ -352,7 +342,6 @@ void CoreWidget::slotCopyView( ) { } void CoreWidget::updateGlobalOptions(bool /*_enable*/){ - OpenFlipper::Options::synchronization( examiner_widgets_[0]->synchronization() ); OpenFlipper::Options::animation( examiner_widgets_[0]->animation() ); OpenFlipper::Options::backfaceCulling( examiner_widgets_[0]->backFaceCulling() ); OpenFlipper::Options::twoSidedLighting( examiner_widgets_[0]->twoSidedLighting() ); diff --git a/widgets/coreWidget/viewerControl.cc b/widgets/coreWidget/viewerControl.cc index 3db7e72268d2e6dde47a5a6fb1354eb634e1f25c..6b8c418a0ccacba0a4dc629508f2da42f85e71fc 100644 --- a/widgets/coreWidget/viewerControl.cc +++ b/widgets/coreWidget/viewerControl.cc @@ -121,9 +121,7 @@ void CoreWidget::slotFunctionMenuUpdate() { QList< QAction *> allActions = functionMenu_->actions(); for ( int i = 0 ; i < allActions.size(); ++i ) { - if ( allActions[i]->text() == "Synchronization" ) - allActions[i]->setChecked(examiner_widgets_[0]->synchronization()); - else if ( allActions[i]->text() == "Animation" ) + if ( allActions[i]->text() == "Animation" ) allActions[i]->setChecked(examiner_widgets_[0]->animation()); else if ( allActions[i]->text() == "Backface Culling" ) allActions[i]->setChecked(examiner_widgets_[0]->backFaceCulling()); diff --git a/widgets/glWidget/QtBaseViewer.cc b/widgets/glWidget/QtBaseViewer.cc index 6bb294e57ff32602a4a2876694a837fc17e579fc..f39e4c15de45054003076b6645020780cdbcc4e2 100644 --- a/widgets/glWidget/QtBaseViewer.cc +++ b/widgets/glWidget/QtBaseViewer.cc @@ -192,23 +192,6 @@ QtBaseViewer::QtBaseViewer( QWidget* _parent, examineMode(); - // clipboard sync stuff - synchronized_ = false; - skipNextSync_ = false; - - socket_ = new QUdpSocket(); - - for (int i=6666; i<6676; ++i) - if ( socket_->bind( i ) ) - { - std::cout << "listen on port " << i << "\n"; - break; - } - - add_sync_host("127.0.0.1"); - - - // Note: we start locked (initialization of updateLocked_) // will be unlocked in initializeGL() @@ -232,8 +215,6 @@ QtBaseViewer::~QtBaseViewer() delete snapshot_; delete glstate_; delete sceneGraphDialog_; - delete socket_; - // delete socket_notifier_; } @@ -1295,10 +1276,6 @@ void QtBaseViewer::actionDrawMenu( QAction * _action ) //----------------------------------------------------------------------------- -bool QtBaseViewer::synchronization(){ - return synchronized_; -} - void QtBaseViewer::createWidgets(const QGLFormat* _format, QStatusBar* _sb, @@ -1539,8 +1516,6 @@ void QtBaseViewer::rotate(const ACG::Vec3d& _axis, glstate_->translate(-t[0], -t[1], -t[2], ACG::MULT_FROM_LEFT); glstate_->rotate(_angle, _axis[0], _axis[1], _axis[2], ACG::MULT_FROM_LEFT); glstate_->translate( t[0], t[1], t[2], ACG::MULT_FROM_LEFT); - - sync_send( glstate_->modelview(), glstate_->inverse_modelview() ); } diff --git a/widgets/glWidget/QtBaseViewer.hh b/widgets/glWidget/QtBaseViewer.hh index df9b6dbdc17630674879b988b0e81df486a8b11e..7afb171c6fce6ff7bd6c0a218a10be305e83ffe1 100644 --- a/widgets/glWidget/QtBaseViewer.hh +++ b/widgets/glWidget/QtBaseViewer.hh @@ -894,57 +894,6 @@ private: /** @} */ - - //=========================================================================== - /** @name Synchronize different viewers - * @{ */ - //=========================================================================== - - public: - /** Synchronize with other QtBaseViewer. A QtBaseViewer can - be synchronized with other instances. The viewing position is - copied from the other widget after each transformation. - */ - void sync_connect(const QtBaseViewer*); - - /// unsync two sync_connect()ed QtBaseViewer's - void sync_disconnect(const QtBaseViewer*); - - - - /// add host to synchronize with, given by its name - bool add_sync_host(const QString& _name); - /// add host to synchronize with, given by its address - void add_sync_host(QHostAddress& _adr); - - bool synchronization(); - - public slots: - - /// toggle global synchronization - virtual void setSynchronization(bool _b); - - private slots: - - void sync_receive(); - void sync_send(const ACG::GLMatrixd& _modelview, - const ACG::GLMatrixd& _inverse_modelview); - - private: - /// synchronized with different viewer? - bool synchronized_; - - /// Skips the next synch event - bool skipNextSync_; - - /// socket used for synchronization - QUdpSocket * socket_; - - /// List of hosts which should receive sync information - std::vector sync_hosts_; - - /** @} */ - //=========================================================================== /** @name Snapshots * @{ */ diff --git a/widgets/glWidget/QtBaseViewerSynchronization.cc b/widgets/glWidget/QtBaseViewerSynchronization.cc deleted file mode 100644 index d0142d00cca1b877912f0715f00893a0e843588c..0000000000000000000000000000000000000000 --- a/widgets/glWidget/QtBaseViewerSynchronization.cc +++ /dev/null @@ -1,238 +0,0 @@ -//============================================================================= -// -// OpenFlipper -// Copyright (C) 2008 by Computer Graphics Group, RWTH Aachen -// www.openflipper.org -// -//----------------------------------------------------------------------------- -// -// License -// -// OpenFlipper is free software: you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// OpenFlipper is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with OpenFlipper. If not, see . -// -//----------------------------------------------------------------------------- -// -// $Revision: 3599 $ -// $Author: moebius $ -// $Date: 2008-10-29 09:01:26 +0100 (Mi, 29. Okt 2008) $ -// -//============================================================================= - - - - -//============================================================================= -// -// CLASS QtBaseViewer - IMPLEMENTATION -// -//============================================================================= - - -//== INCLUDES ================================================================= - -#include "QtBaseViewer.hh" -#include "QtGLGraphicsScene.hh" -#include "QtGLGraphicsView.hh" -#include - -//== NAMESPACES =============================================================== - -//== IMPLEMENTATION ========================================================== - - -void QtBaseViewer::sync_connect(const QtBaseViewer* _other) -{ - connect(_other, - SIGNAL(signalSetView(const GLMatrixd&, const GLMatrixd&)), - this, - SLOT(setView(const GLMatrixd&, const GLMatrixd&))); -} - - -//----------------------------------------------------------------------------- - - -void QtBaseViewer::sync_disconnect(const QtBaseViewer* _other) -{ - disconnect(_other, - SIGNAL(signalSetView(const GLMatrixd&, const GLMatrixd&)), - this, - SLOT(setView(const GLMatrixd&, const GLMatrixd&))); -} - - -//----------------------------------------------------------------------------- - - -void QtBaseViewer::sync_send(const ACG::GLMatrixd&, const ACG::GLMatrixd&) -{ - const ACG::GLMatrixd m = glstate_->modelview(); - const ACG::GLMatrixd p = glstate_->projection(); - - QByteArray datagram; - QDataStream out(&datagram, QIODevice::WriteOnly); - out.setVersion(5); - - quint64 myId = (quint64) winId(); - - out << myId - << m(0,0) << m(0,1) << m(0,2) << m(0,3) - << m(1,0) << m(1,1) << m(1,2) << m(1,3) - << m(2,0) << m(2,1) << m(2,2) << m(2,3) - << m(3,0) << m(3,1) << m(3,2) << m(3,3) - << p(0,0) << p(0,1) << p(0,2) << p(0,3) - << p(1,0) << p(1,1) << p(1,2) << p(1,3) - << p(2,0) << p(2,1) << p(2,2) << p(2,3) - << p(3,0) << p(3,1) << p(3,2) << p(3,3) - << glWidth() << glHeight() - << projectionMode_ - << orthoWidth_; - - for (int h=0, n=sync_hosts_.size(); hlocalPort() || h != 0) - socket_->writeDatagram( datagram, datagram.size(),sync_hosts_[h], i); -} - - -void QtBaseViewer::sync_receive() -{ - ACG::GLMatrixd m, p; - int w, h, pMode; - quint64 id, myId = (quint64) winId(); - - - QByteArray datagram( socket_->pendingDatagramSize(), 'x' ); - socket_->readDatagram( datagram.data(), datagram.size() ); - - - if (datagram.size() < 280) - return; - - QDataStream in( & datagram, QIODevice::ReadOnly); - in.setVersion(5); - - - in >> id; - if (id == myId) - return; - - in >> m(0,0) >> m(0,1) >> m(0,2) >> m(0,3) - >> m(1,0) >> m(1,1) >> m(1,2) >> m(1,3) - >> m(2,0) >> m(2,1) >> m(2,2) >> m(2,3) - >> m(3,0) >> m(3,1) >> m(3,2) >> m(3,3) - >> p(0,0) >> p(0,1) >> p(0,2) >> p(0,3) - >> p(1,0) >> p(1,1) >> p(1,2) >> p(1,3) - >> p(2,0) >> p(2,1) >> p(2,2) >> p(2,3) - >> p(3,0) >> p(3,1) >> p(3,2) >> p(3,3) - >> w >> h >> pMode >> orthoWidth_; - - - blockSignals(true); - - makeCurrent(); - - if (projectionMode_ != (ProjectionMode)pMode) - projectionMode((ProjectionMode)pMode); - - glstate_->set_modelview(m); - - std::cerr << "Todo : Checkbox if size should be applied to" << std::endl; - -// if (w>0 && h>0 && -// action_["PasteDropSize"]->isChecked() ) -// { -// glstate_->set_projection(p); -// glView_->setFixedSize(w,h); -// updateGeometry(); -// } - - blockSignals(false); - - updateGL(); -} - - -//----------------------------------------------------------------------------- - - -void QtBaseViewer::setSynchronization(bool _b) -{ - emit functionMenuUpdate(); - - synchronized_ = _b; - - if (synchronized_) - { - connect(socket_, - SIGNAL(readyRead()), - this, - SLOT(sync_receive())); - - connect(this, - SIGNAL(signalSetView(const GLMatrixd&, const GLMatrixd&)), - this, - SLOT(sync_send(const GLMatrixd&, const GLMatrixd&))); - } - else - { - disconnect(socket_, - SIGNAL( readyRead() ), - this, - SLOT(sync_receive())); - - disconnect(this, - SIGNAL(signalSetView(const GLMatrixd&, const GLMatrixd&)), - this, - SLOT(sync_send(const GLMatrixd&, const GLMatrixd&))); - } - -} - - -//---------------------------------------------------------------------------- - - -bool QtBaseViewer::add_sync_host(const QString& _name) -{ - QHostAddress adr; - if (adr.setAddress(_name)) - { - add_sync_host(adr); - return true; - } - - // QT4 - - // use DNS otherwise - QHostInfo hi = QHostInfo::fromName( _name ); - QList list = hi.addresses(); - if (!list.empty()) - { - add_sync_host(list.front()); - return true; - } - - - return false; -} - - -void QtBaseViewer::add_sync_host(QHostAddress& _adr) -{ - sync_hosts_.push_back(_adr); -} - -//============================================================================= -//=============================================================================