void K3bMediaContentsView::slotMediumChanged( K3bDevice::Device* dev ) { // FIXME: derive a K3bContentsStack from QWidgetStack and let it set an active flag // to replace this hack if( QWidgetStack* stack = dynamic_cast<QWidgetStack*>( parentWidget() ) ) if( stack->visibleWidget() != this ) return; if( !d->autoReload /*|| !isActive()*/ ) return; if( dev == device() ) { K3bMedium m = k3bappcore->mediaCache()->medium( dev ); // no need to reload if the medium did not change (this is even // important since K3b blocks the devices in action and after // the release they are signalled as changed) if( m == medium() ) { kdDebug() << k_funcinfo << " medium did not change" << endl; enableInteraction( true ); } else if( m.content() & supportedMediumContent() && m.diskInfo().mediaType() & supportedMediumTypes() && m.diskInfo().diskState() & supportedMediumStates() ) { kdDebug() << k_funcinfo << " new supported medium found" << endl; reload( m ); } else { kdDebug() << k_funcinfo << " unsupported medium found" << endl; enableInteraction( false ); } } }
void UserInteractionEnabled::setUserInteractionEnabled(bool enabled){ if (enabled) { _userInteractionEnabledCounter--; if (_userInteractionEnabledCounter == 0) enableInteraction(); if (_userInteractionEnabledCounter < 0) _userInteractionEnabledCounter = 0; }else{ _userInteractionEnabledCounter++; if (_userInteractionEnabledCounter == 1) disableInteraction(); } }
void K3bMediaContentsView::reload() { enableInteraction( true ); reloadMedium(); }
void InteractiveMarkerControl::processMessage( const visualization_msgs::InteractiveMarkerControl &message ) { name_ = message.name; description_ = message.description; interaction_mode_ = message.interaction_mode; always_visible_ = message.always_visible; orientation_mode_ = message.orientation_mode; control_orientation_ = Ogre::Quaternion(message.orientation.w, message.orientation.x, message.orientation.y, message.orientation.z); control_orientation_.normalise(); bool new_view_facingness = (message.orientation_mode == visualization_msgs::InteractiveMarkerControl::VIEW_FACING); if( new_view_facingness != view_facing_ ) { if( new_view_facingness ) { context_->getSceneManager()->addListener(this); } else { context_->getSceneManager()->removeListener(this); } view_facing_ = new_view_facingness; } independent_marker_orientation_ = message.independent_marker_orientation; // highlight_passes_ have raw pointers into the markers_, so must // clear them at the same time. highlight_passes_.clear(); markers_.clear(); points_markers_.clear(); // Initially, the pose of this marker's node and the interactive // marker are identical, but that may change. control_frame_node_->setPosition(parent_->getPosition()); markers_node_->setPosition(parent_->getPosition()); if ( orientation_mode_ == visualization_msgs::InteractiveMarkerControl::INHERIT ) { control_frame_node_->setOrientation(parent_->getOrientation()); markers_node_->setOrientation(parent_->getOrientation()); } else { control_frame_node_->setOrientation( Ogre::Quaternion::IDENTITY ); markers_node_->setOrientation( Ogre::Quaternion::IDENTITY ); } makeMarkers( message ); // Create our own custom cursor switch( interaction_mode_ ) { case visualization_msgs::InteractiveMarkerControl::NONE: cursor_ = rviz::getDefaultCursor(); break; case visualization_msgs::InteractiveMarkerControl::MENU: cursor_ = rviz::makeIconCursor( "package://rviz/icons/menu.png" ); break; case visualization_msgs::InteractiveMarkerControl::BUTTON: cursor_ = rviz::getDefaultCursor(); break; case visualization_msgs::InteractiveMarkerControl::MOVE_AXIS: cursor_ = rviz::makeIconCursor( "package://rviz/icons/move1d.png" ); break; case visualization_msgs::InteractiveMarkerControl::MOVE_PLANE: cursor_ = rviz::makeIconCursor( "package://rviz/icons/move2d.png" ); break; case visualization_msgs::InteractiveMarkerControl::ROTATE_AXIS: cursor_ = rviz::makeIconCursor( "package://rviz/icons/rotate.png" ); break; case visualization_msgs::InteractiveMarkerControl::MOVE_ROTATE: cursor_ = rviz::makeIconCursor( "package://rviz/icons/moverotate.png" ); break; } // It's not clear to me why this one setOrientation() call needs to // be here and not above makeMarkers() with the other // setOrientation() calls, but it works correctly when here and // incorrectly when there. Sorry. -hersh if( orientation_mode_ == visualization_msgs::InteractiveMarkerControl::VIEW_FACING && independent_marker_orientation_ ) { markers_node_->setOrientation( parent_->getOrientation() ); } enableInteraction(context_->getSelectionManager()->getInteractionEnabled()); }