|
|
@ -44,6 +44,7 @@ UBGraphicsMediaItemDelegate::UBGraphicsMediaItemDelegate(UBGraphicsMediaItem* pD |
|
|
|
| GF_RESPECT_RATIO |
|
|
|
| GF_RESPECT_RATIO |
|
|
|
| GF_TOOLBAR_USED |
|
|
|
| GF_TOOLBAR_USED |
|
|
|
| GF_SHOW_CONTENT_SOURCE) |
|
|
|
| GF_SHOW_CONTENT_SOURCE) |
|
|
|
|
|
|
|
, mPlayPauseButton(NULL) |
|
|
|
, mMedia(pMedia) |
|
|
|
, mMedia(pMedia) |
|
|
|
, mToolBarShowTimer(NULL) |
|
|
|
, mToolBarShowTimer(NULL) |
|
|
|
, m_iToolBarShowingInterval(5000) |
|
|
|
, m_iToolBarShowingInterval(5000) |
|
|
@ -88,40 +89,42 @@ void UBGraphicsMediaItemDelegate::hideToolBar() |
|
|
|
|
|
|
|
|
|
|
|
void UBGraphicsMediaItemDelegate::buildButtons() |
|
|
|
void UBGraphicsMediaItemDelegate::buildButtons() |
|
|
|
{ |
|
|
|
{ |
|
|
|
mPlayPauseButton = new DelegateButton(":/images/play.svg", mDelegated, mToolBarItem, Qt::TitleBarArea); |
|
|
|
if(!mPlayPauseButton){ |
|
|
|
connect(mPlayPauseButton, SIGNAL(clicked(bool)), this, SLOT(togglePlayPause())); |
|
|
|
mPlayPauseButton = new DelegateButton(":/images/play.svg", mDelegated, mToolBarItem, Qt::TitleBarArea); |
|
|
|
|
|
|
|
connect(mPlayPauseButton, SIGNAL(clicked(bool)), this, SLOT(togglePlayPause())); |
|
|
|
|
|
|
|
|
|
|
|
mStopButton = new DelegateButton(":/images/stop.svg", mDelegated, mToolBarItem, Qt::TitleBarArea); |
|
|
|
mStopButton = new DelegateButton(":/images/stop.svg", mDelegated, mToolBarItem, Qt::TitleBarArea); |
|
|
|
connect(mStopButton, SIGNAL(clicked(bool)), mMedia, SLOT(stop())); |
|
|
|
connect(mStopButton, SIGNAL(clicked(bool)), mMedia, SLOT(stop())); |
|
|
|
|
|
|
|
|
|
|
|
mMediaControl = new DelegateMediaControl(delegated(), mToolBarItem); |
|
|
|
mMediaControl = new DelegateMediaControl(delegated(), mToolBarItem); |
|
|
|
mMediaControl->setFlag(QGraphicsItem::ItemIsSelectable, true); |
|
|
|
mMediaControl->setFlag(QGraphicsItem::ItemIsSelectable, true); |
|
|
|
UBGraphicsItem::assignZValue(mMediaControl, delegated()->zValue()); |
|
|
|
UBGraphicsItem::assignZValue(mMediaControl, delegated()->zValue()); |
|
|
|
|
|
|
|
|
|
|
|
if (delegated()->isMuted()) |
|
|
|
if (delegated()->isMuted()) |
|
|
|
mMuteButton = new DelegateButton(":/images/soundOff.svg", mDelegated, mToolBarItem, Qt::TitleBarArea); |
|
|
|
mMuteButton = new DelegateButton(":/images/soundOff.svg", mDelegated, mToolBarItem, Qt::TitleBarArea); |
|
|
|
else |
|
|
|
else |
|
|
|
mMuteButton = new DelegateButton(":/images/soundOn.svg", mDelegated, mToolBarItem, Qt::TitleBarArea); |
|
|
|
mMuteButton = new DelegateButton(":/images/soundOn.svg", mDelegated, mToolBarItem, Qt::TitleBarArea); |
|
|
|
|
|
|
|
|
|
|
|
connect(mMuteButton, SIGNAL(clicked(bool)), delegated(), SLOT(toggleMute())); |
|
|
|
connect(mMuteButton, SIGNAL(clicked(bool)), delegated(), SLOT(toggleMute())); |
|
|
|
connect(mMuteButton, SIGNAL(clicked(bool)), this, SLOT(toggleMute())); // for changing button image
|
|
|
|
connect(mMuteButton, SIGNAL(clicked(bool)), this, SLOT(toggleMute())); // for changing button image
|
|
|
|
|
|
|
|
|
|
|
|
mToolBarButtons << mPlayPauseButton << mStopButton << mMuteButton; |
|
|
|
mToolBarButtons << mPlayPauseButton << mStopButton << mMuteButton; |
|
|
|
|
|
|
|
|
|
|
|
mToolBarItem->setItemsOnToolBar(QList<QGraphicsItem*>() << mPlayPauseButton << mStopButton << mMediaControl << mMuteButton); |
|
|
|
mToolBarItem->setItemsOnToolBar(QList<QGraphicsItem*>() << mPlayPauseButton << mStopButton << mMediaControl << mMuteButton ); |
|
|
|
mToolBarItem->setVisibleOnBoard(true); |
|
|
|
mToolBarItem->setVisibleOnBoard(true); |
|
|
|
mToolBarItem->setShifting(false); |
|
|
|
mToolBarItem->setShifting(false); |
|
|
|
|
|
|
|
|
|
|
|
if (mToolBarShowTimer) |
|
|
|
if (mToolBarShowTimer) |
|
|
|
{ |
|
|
|
{ |
|
|
|
connect(mPlayPauseButton, SIGNAL(clicked(bool)), mToolBarShowTimer, SLOT(start())); |
|
|
|
connect(mPlayPauseButton, SIGNAL(clicked(bool)), mToolBarShowTimer, SLOT(start())); |
|
|
|
connect(mStopButton, SIGNAL(clicked(bool)), mToolBarShowTimer, SLOT(start())); |
|
|
|
connect(mStopButton, SIGNAL(clicked(bool)), mToolBarShowTimer, SLOT(start())); |
|
|
|
connect(mMediaControl, SIGNAL(used()), mToolBarShowTimer, SLOT(start())); |
|
|
|
connect(mMediaControl, SIGNAL(used()), mToolBarShowTimer, SLOT(start())); |
|
|
|
connect(mMuteButton, SIGNAL(clicked(bool)), mToolBarShowTimer, SLOT(start())); |
|
|
|
connect(mMuteButton, SIGNAL(clicked(bool)), mToolBarShowTimer, SLOT(start())); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
positionHandles(); |
|
|
|
positionHandles(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
UBGraphicsMediaItemDelegate::~UBGraphicsMediaItemDelegate() |
|
|
|
UBGraphicsMediaItemDelegate::~UBGraphicsMediaItemDelegate() |
|
|
@ -149,12 +152,12 @@ void UBGraphicsMediaItemDelegate::positionHandles() |
|
|
|
mToolBarItem->setRect(toolBarRect); |
|
|
|
mToolBarItem->setRect(toolBarRect); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
int toolBarButtons= 0; |
|
|
|
int toolBarButtonsWidth = 0; |
|
|
|
foreach (DelegateButton* button, mToolBarButtons) |
|
|
|
foreach (DelegateButton* button, mToolBarButtons) |
|
|
|
toolBarButtons += button->boundingRect().width() + mToolBarItem->getElementsPadding(); |
|
|
|
toolBarButtonsWidth += button->boundingRect().width() + mToolBarItem->getElementsPadding(); |
|
|
|
|
|
|
|
|
|
|
|
QRectF mediaItemRect = mMediaControl->rect(); |
|
|
|
QRectF mediaItemRect = mMediaControl->rect(); |
|
|
|
mediaItemRect.setWidth(mediaItem->boundingRect().width() - toolBarButtons); |
|
|
|
mediaItemRect.setWidth(mediaItem->boundingRect().width() - toolBarButtonsWidth); |
|
|
|
mediaItemRect.setHeight(mToolBarItem->boundingRect().height()); |
|
|
|
mediaItemRect.setHeight(mToolBarItem->boundingRect().height()); |
|
|
|
mMediaControl->setRect(mediaItemRect); |
|
|
|
mMediaControl->setRect(mediaItemRect); |
|
|
|
|
|
|
|
|
|
|
|