media item no more resized on click. First try to fix the lcdwidget

preferencesAboutTextFull
Claudio Valerio 12 years ago
parent 954dfa60ba
commit f619a0f2f4
  1. 12
      src/domain/UBGraphicsItemDelegate.cpp
  2. 2
      src/domain/UBGraphicsItemDelegate.h
  3. 37
      src/domain/UBGraphicsMediaItemDelegate.cpp

@ -1312,12 +1312,11 @@ void DelegateMediaControl::positionHandles()
mDisplayFormat = "ss";
if (tTotal.minute() > 0)
{
mDisplayFormat = "mm:" + mDisplayFormat;
digitsCount += 3;
timerWidth += mLCDTimerArea.height()*0.5;
}
//Explanation at least the second and minutes are diplayed
mDisplayFormat = "mm:" + mDisplayFormat;
digitsCount += 3;
timerWidth += mLCDTimerArea.height();
if (tTotal.hour() > 0)
{
@ -1348,6 +1347,7 @@ void DelegateMediaControl::update()
QTime tCurrent;
tCurrent = tCurrent.addMSecs(mCurrentTimeInMs < 0 ? 0 : mCurrentTimeInMs);
lcdTimer->display(tCurrent.toString(mDisplayFormat));
QGraphicsRectItem::update();

@ -174,7 +174,6 @@ class DelegateMediaControl: public QObject, public QGraphicsRectItem
void positionHandles();
void updateTicker(qint64 time);
void totalTimeChanged(qint64 newTotalTime);
QSizeF lcdAreaSize() {return mLCDTimerArea.size();}
signals:
void used();
@ -286,7 +285,6 @@ class UBGraphicsItemDelegate : public QObject
UBGraphicsFlags ubflags() const {return mFlags;}
bool testUBFlags(UBGraphicsFlags pf) const {return mFlags & pf;}
void setUBFlags(UBGraphicsFlags pf);
// void addUBFlags(UBGraphicsFlags pf) {setUBFlags(ubflags() | pf);}
void setUBFlag(UBGraphicsFlags pf, bool set = true);
signals:

@ -73,6 +73,7 @@ bool UBGraphicsMediaItemDelegate::mousePressEvent(QGraphicsSceneMouseEvent *even
{
Q_UNUSED(event);
mToolBarItem->show();
positionHandles();
if (mToolBarShowTimer)
mToolBarShowTimer->start();
@ -119,20 +120,16 @@ void UBGraphicsMediaItemDelegate::buildButtons()
connect(mMuteButton, SIGNAL(clicked(bool)), mToolBarShowTimer, SLOT(start()));
}
// UBGraphicsMediaItem *audioItem = dynamic_cast<UBGraphicsMediaItem*>(mDelegated);
// if (audioItem)
// {
// if (audioItem->getMediaType() == UBGraphicsMediaItem::mediaType_Audio)
// {
positionHandles();
// }
// }
positionHandles();
}
UBGraphicsMediaItemDelegate::~UBGraphicsMediaItemDelegate()
{
if (mToolBarShowTimer)
if (mToolBarShowTimer){
delete mToolBarShowTimer;
mToolBarShowTimer = NULL;
}
}
void UBGraphicsMediaItemDelegate::positionHandles()
@ -144,32 +141,20 @@ void UBGraphicsMediaItemDelegate::positionHandles()
{
QRectF toolBarRect = mToolBarItem->rect();
mToolBarItem->setPos(0, delegated()->boundingRect().height()-mToolBarItem->rect().height());
mToolBarItem->setPos(0, mediaItem->boundingRect().height()-mToolBarItem->rect().height());
toolBarRect.setWidth(delegated()->boundingRect().width());
toolBarRect.setWidth(mediaItem->boundingRect().width());
mToolBarItem->show();
mToolBarItem->setRect(toolBarRect);
}
int toolBarMinimumWidth = 0;
int mediaItemWidth = mToolBarItem->boundingRect().width();
int toolBarButtons= 0;
foreach (DelegateButton* button, mToolBarButtons)
{
mediaItemWidth -= button->boundingRect().width() + mToolBarItem->getElementsPadding();
toolBarMinimumWidth += button->boundingRect().width() + mToolBarItem->getElementsPadding();
}
toolBarMinimumWidth += mToolBarItem->boundingRect().height();
QWidget* pAudioWidget = delegated()->widget();
if (pAudioWidget)
{
pAudioWidget->setMinimumSize(toolBarMinimumWidth + (int)mMediaControl->lcdAreaSize().width() + (int)mMediaControl->rect().height(),26);
}
toolBarButtons += button->boundingRect().width() + mToolBarItem->getElementsPadding();
QRectF mediaItemRect = mMediaControl->rect();
mediaItemRect.setWidth(mediaItemWidth);
mediaItemRect.setWidth(mediaItem->boundingRect().width() - toolBarButtons);
mediaItemRect.setHeight(mToolBarItem->boundingRect().height());
mMediaControl->setRect(mediaItemRect);

Loading…
Cancel
Save