@ -36,7 +36,6 @@ UBGraphicsMediaItemDelegate::UBGraphicsMediaItemDelegate(UBGraphicsMediaItem* pD
, mMedia ( pMedia )
, mMedia ( pMedia )
, mToolBarShowTimer ( NULL )
, mToolBarShowTimer ( NULL )
, m_iToolBarShowingInterval ( 5000 )
, m_iToolBarShowingInterval ( 5000 )
, mToolBarIsShown ( false )
{
{
QPalette palette ;
QPalette palette ;
palette . setBrush ( QPalette : : Light , Qt : : darkGray ) ;
palette . setBrush ( QPalette : : Light , Qt : : darkGray ) ;
@ -53,18 +52,12 @@ UBGraphicsMediaItemDelegate::UBGraphicsMediaItemDelegate(UBGraphicsMediaItem* pD
connect ( mToolBarShowTimer , SIGNAL ( timeout ( ) ) , this , SLOT ( hideToolBar ( ) ) ) ;
connect ( mToolBarShowTimer , SIGNAL ( timeout ( ) ) , this , SLOT ( hideToolBar ( ) ) ) ;
mToolBarShowTimer - > setInterval ( m_iToolBarShowingInterval ) ;
mToolBarShowTimer - > setInterval ( m_iToolBarShowingInterval ) ;
}
}
if ( delegated ( ) - > getMediaType ( ) = = UBGraphicsMediaItem : : mediaType_Video )
{
connect ( UBApplication : : boardController , SIGNAL ( zoomChanged ( qreal ) ) , this , SLOT ( onZoomChanged ( ) ) ) ;
}
}
}
bool UBGraphicsMediaItemDelegate : : mousePressEvent ( QGraphicsSceneMouseEvent * event )
bool UBGraphicsMediaItemDelegate : : mousePressEvent ( QGraphicsSceneMouseEvent * event )
{
{
Q_UNUSED ( event ) ;
Q_UNUSED ( event ) ;
mToolBarItem - > show ( ) ;
mToolBarItem - > show ( ) ;
mToolBarIsShown = true ;
if ( mToolBarShowTimer )
if ( mToolBarShowTimer )
mToolBarShowTimer - > start ( ) ;
mToolBarShowTimer - > start ( ) ;
@ -75,14 +68,6 @@ bool UBGraphicsMediaItemDelegate::mousePressEvent(QGraphicsSceneMouseEvent *even
void UBGraphicsMediaItemDelegate : : hideToolBar ( )
void UBGraphicsMediaItemDelegate : : hideToolBar ( )
{
{
mToolBarItem - > hide ( ) ;
mToolBarItem - > hide ( ) ;
mToolBarIsShown = false ;
}
void UBGraphicsMediaItemDelegate : : onZoomChanged ( )
{
positionHandles ( ) ;
if ( ! mToolBarIsShown )
hideToolBar ( ) ;
}
}
void UBGraphicsMediaItemDelegate : : buildButtons ( )
void UBGraphicsMediaItemDelegate : : buildButtons ( )
@ -136,18 +121,16 @@ void UBGraphicsMediaItemDelegate::positionHandles()
{
{
UBGraphicsItemDelegate : : positionHandles ( ) ;
UBGraphicsItemDelegate : : positionHandles ( ) ;
qreal AntiScaleRatio = 1 / ( UBApplication : : boardController - > systemScaleFactor ( ) * UBApplication : : boardController - > currentZoom ( ) ) ;
UBGraphicsMediaItem * mediaItem = dynamic_cast < UBGraphicsMediaItem * > ( mDelegated ) ;
UBGraphicsMediaItem * mediaItem = dynamic_cast < UBGraphicsMediaItem * > ( mDelegated ) ;
if ( mediaItem )
if ( mediaItem )
{
{
QRectF toolBarRect = mToolBarItem - > rect ( ) ;
QRectF toolBarRect = mToolBarItem - > rect ( ) ;
if ( mediaItem - > getMediaType ( ) = = UBGraphicsMediaItem : : mediaType_Video )
if ( mediaItem - > getMediaType ( ) = = UBGraphicsMediaItem : : mediaType_Video )
{
{
mToolBarItem - > setPos ( 0 , delegated ( ) - > boundingRect ( ) . height ( ) - mToolBarItem - > rect ( ) . height ( ) ) ; //*AntiScaleRatio);
mToolBarItem - > setPos ( 0 , delegated ( ) - > boundingRect ( ) . height ( ) - mToolBarItem - > rect ( ) . height ( ) ) ;
// mToolBarItem->setScale(AntiScaleRatio);
// mToolBarItem->setScale(AntiScaleRatio);
toolBarRect . setWidth ( delegated ( ) - > boundingRect ( ) . width ( ) ) ; //AntiScaleRatio);
toolBarRect . setWidth ( delegated ( ) - > boundingRect ( ) . width ( ) ) ;
}
}
else if ( mediaItem - > getMediaType ( ) = = UBGraphicsMediaItem : : mediaType_Audio )
else if ( mediaItem - > getMediaType ( ) = = UBGraphicsMediaItem : : mediaType_Audio )
{
{
@ -156,8 +139,8 @@ void UBGraphicsMediaItemDelegate::positionHandles()
if ( audioWidget )
if ( audioWidget )
borderSize = audioWidget - > borderSize ( ) ;
borderSize = audioWidget - > borderSize ( ) ;
mToolBarItem - > setPos ( borderSize , delegated ( ) - > boundingRect ( ) . height ( ) - ( mToolBarItem - > rect ( ) . height ( ) + borderSize ) ) ; //*AntiScaleRatio);
mToolBarItem - > setPos ( borderSize , delegated ( ) - > boundingRect ( ) . height ( ) - ( mToolBarItem - > rect ( ) . height ( ) + borderSize ) ) ;
toolBarRect . setWidth ( ( delegated ( ) - > boundingRect ( ) . width ( ) - 2 * borderSize ) ) ; ///AntiScaleRatio);
toolBarRect . setWidth ( ( delegated ( ) - > boundingRect ( ) . width ( ) - 2 * borderSize ) ) ;
mToolBarItem - > show ( ) ;
mToolBarItem - > show ( ) ;
}
}