improvements of the control media bar

preferencesAboutTextFull
Claudio Valerio 11 years ago
parent f619a0f2f4
commit 830a7f20bf
  1. 11
      src/domain/UBGraphicsItemDelegate.cpp
  2. 11
      src/domain/UBGraphicsMediaItemDelegate.cpp

@ -1120,8 +1120,7 @@ void MediaTimer::addPoint(QPolygon &a, const QPoint &p)
a.setPoint(n, p);
}
void MediaTimer::paint(QPainter *p,
const QStyleOptionGraphicsItem *option, QWidget *widget)
void MediaTimer::paint(QPainter *p, const QStyleOptionGraphicsItem *option, QWidget *widget)
{
Q_UNUSED(option);
Q_UNUSED(widget);
@ -1300,10 +1299,6 @@ QPainterPath DelegateMediaControl::shape() const
void DelegateMediaControl::positionHandles()
{
QRectF selfRect = rect();
selfRect.setHeight(parentItem()->boundingRect().height());
setRect(selfRect);
QTime tTotal;
tTotal = tTotal.addMSecs(mTotalTimeInMs);
mLCDTimerArea.setHeight(parentItem()->boundingRect().height());
@ -1329,10 +1324,6 @@ void DelegateMediaControl::positionHandles()
mLCDTimerArea.setWidth(timerWidth);
lcdTimer->setRect(mLCDTimerArea);
// not the best solution, but it works.
lcdTimer->positionHandles();
mLCDTimerArea = lcdTimer->rect();
// -------------------------------------
lcdTimer->setPos(rect().width() - mLCDTimerArea.width(), 0);

@ -44,6 +44,7 @@ UBGraphicsMediaItemDelegate::UBGraphicsMediaItemDelegate(UBGraphicsMediaItem* pD
| GF_RESPECT_RATIO
| GF_TOOLBAR_USED
| GF_SHOW_CONTENT_SOURCE)
, mPlayPauseButton(NULL)
, mMedia(pMedia)
, mToolBarShowTimer(NULL)
, m_iToolBarShowingInterval(5000)
@ -88,6 +89,7 @@ void UBGraphicsMediaItemDelegate::hideToolBar()
void UBGraphicsMediaItemDelegate::buildButtons()
{
if(!mPlayPauseButton){
mPlayPauseButton = new DelegateButton(":/images/play.svg", mDelegated, mToolBarItem, Qt::TitleBarArea);
connect(mPlayPauseButton, SIGNAL(clicked(bool)), this, SLOT(togglePlayPause()));
@ -108,7 +110,7 @@ void UBGraphicsMediaItemDelegate::buildButtons()
mToolBarButtons << mPlayPauseButton << mStopButton << mMuteButton;
mToolBarItem->setItemsOnToolBar(QList<QGraphicsItem*>() << mPlayPauseButton << mStopButton << mMediaControl << mMuteButton);
mToolBarItem->setItemsOnToolBar(QList<QGraphicsItem*>() << mPlayPauseButton << mStopButton << mMediaControl << mMuteButton );
mToolBarItem->setVisibleOnBoard(true);
mToolBarItem->setShifting(false);
@ -122,6 +124,7 @@ void UBGraphicsMediaItemDelegate::buildButtons()
positionHandles();
}
}
UBGraphicsMediaItemDelegate::~UBGraphicsMediaItemDelegate()
@ -149,12 +152,12 @@ void UBGraphicsMediaItemDelegate::positionHandles()
mToolBarItem->setRect(toolBarRect);
}
int toolBarButtons= 0;
int toolBarButtonsWidth = 0;
foreach (DelegateButton* button, mToolBarButtons)
toolBarButtons += button->boundingRect().width() + mToolBarItem->getElementsPadding();
toolBarButtonsWidth += button->boundingRect().width() + mToolBarItem->getElementsPadding();
QRectF mediaItemRect = mMediaControl->rect();
mediaItemRect.setWidth(mediaItem->boundingRect().width() - toolBarButtons);
mediaItemRect.setWidth(mediaItem->boundingRect().width() - toolBarButtonsWidth);
mediaItemRect.setHeight(mToolBarItem->boundingRect().height());
mMediaControl->setRect(mediaItemRect);

Loading…
Cancel
Save