| 442 | } |
| 443 | |
| 444 | void |
| 445 | ViewerTab::removeTrackerInterface(const NodeGuiPtr& n, |
| 446 | bool permanently, |
| 447 | bool removeAndDontSetAnother) |
| 448 | { |
| 449 | std::map<NodeGuiWPtr, TrackerGui*>::iterator it = _imp->trackerNodes.find(n); |
| 450 | |
| 451 | if ( it != _imp->trackerNodes.end() ) { |
| 452 | if ( !getGui() ) { |
| 453 | if (permanently) { |
| 454 | delete it->second; |
| 455 | } |
| 456 | |
| 457 | return; |
| 458 | } |
| 459 | |
| 460 | if (_imp->currentTracker.first.lock() == n) { |
| 461 | ///Remove the widgets of the current tracker node |
| 462 | |
| 463 | int buttonsBarIndex = _imp->mainLayout->indexOf( _imp->currentTracker.second->getButtonsBar() ); |
| 464 | assert(buttonsBarIndex >= 0); |
| 465 | if (buttonsBarIndex >= 0) { |
| 466 | QLayoutItem* buttonsBar = _imp->mainLayout->itemAt(buttonsBarIndex); |
| 467 | assert(buttonsBar); |
| 468 | if (buttonsBar) { |
| 469 | _imp->mainLayout->removeItem(buttonsBar); |
| 470 | buttonsBar->widget()->hide(); |
| 471 | } |
| 472 | } |
| 473 | if (!removeAndDontSetAnother) { |
| 474 | ///If there's another tracker node, set it as the current tracker interface |
| 475 | std::map<NodeGuiWPtr, TrackerGui*>::iterator newTracker = _imp->trackerNodes.end(); |
| 476 | for (std::map<NodeGuiWPtr, TrackerGui*>::iterator it2 = _imp->trackerNodes.begin(); it2 != _imp->trackerNodes.end(); ++it2) { |
| 477 | if ( (it2->second != it->second) && it2->first.lock()->isSettingsPanelVisible() ) { |
| 478 | newTracker = it2; |
| 479 | break; |
| 480 | } |
| 481 | } |
| 482 | |
| 483 | _imp->currentTracker.first.reset(); |
| 484 | _imp->currentTracker.second = 0; |
| 485 | |
| 486 | if ( newTracker != _imp->trackerNodes.end() ) { |
| 487 | setTrackerInterface( newTracker->first.lock() ); |
| 488 | } |
| 489 | } |
| 490 | } |
| 491 | |
| 492 | if (permanently) { |
| 493 | delete it->second; |
| 494 | _imp->trackerNodes.erase(it); |
| 495 | } |
| 496 | } |
| 497 | } // ViewerTab::removeTrackerInterface |
| 498 | |
| 499 | #endif // if 0 |
| 500 | |