Audio items is white now.

Media control improved.
Code was cleaned.
preferencesAboutTextFull
Aleksei Kanash 13 years ago
parent fecd1f95c7
commit e6194ef58b
  1. 15
      src/domain/UBGraphicsItemDelegate.cpp
  2. 1
      src/domain/UBGraphicsItemDelegate.h
  3. 13
      src/domain/UBGraphicsMediaItem.cpp
  4. 3
      src/domain/UBGraphicsMediaItemDelegate.cpp

@ -1130,6 +1130,7 @@ DelegateMediaControl::DelegateMediaControl(UBGraphicsMediaItem* pDelegated, QGra
, mCurrentTimeInMs(0)
, mTotalTimeInMs(0)
, mStartWidth(200)
, mSeecAreaBorderHeight(0)
{
setAcceptedMouseButtons(Qt::LeftButton);
setBrush(QBrush(Qt::white));
@ -1153,13 +1154,14 @@ void DelegateMediaControl::paint(QPainter *painter,
mLCDTimerArea.setHeight(rect().height());
mLCDTimerArea.setWidth(rect().height());
mSeecArea = rect();
mSeecArea.setWidth(rect().width()-mLCDTimerArea.width()-2);
mSeecArea.setHeight(rect().height()-2*mSeecAreaBorderHeight);
mSeecArea.setY(mSeecAreaBorderHeight);
path.addRoundedRect(mSeecArea, mSeecArea.height()/2, mSeecArea.height()/2);
painter->fillPath(path, brush());
qreal frameWidth = rect().height() / 2;
qreal frameWidth = mSeecArea.height() / 2;
int position = frameWidth;
if (mTotalTimeInMs > 0)
@ -1169,7 +1171,7 @@ void DelegateMediaControl::paint(QPainter *painter,
int clearance = 2;
int radius = frameWidth-clearance;
QRectF r(position - radius, clearance, radius * 2, radius * 2);
QRectF r(position - radius, clearance+mSeecAreaBorderHeight, radius * 2, radius * 2);
painter->setBrush(UBSettings::documentViewLightColor);
painter->drawEllipse(r);
@ -1190,7 +1192,10 @@ void DelegateMediaControl::positionHandles()
lcdTimer->setRect(mLCDTimerArea);
lcdTimer->setPos(mSeecArea.width()-mLCDTimerArea.width(),0);
mSeecArea.setWidth(rect().width()-mLCDTimerArea.width());
mSeecAreaBorderHeight = rect().height()/20;
mSeecArea.setWidth(rect().width()-mLCDTimerArea.width()-2);
mSeecArea.setHeight(rect().height()-2*mSeecAreaBorderHeight);
mSeecArea.setY(mSeecAreaBorderHeight);
QRectF selfRect = rect();
selfRect.setHeight(parentItem()->boundingRect().height());
@ -1238,7 +1243,7 @@ void DelegateMediaControl::mousePressEvent(QGraphicsSceneMouseEvent *event)
void DelegateMediaControl::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
{
qreal frameWidth = rect().height() / 2;
qreal frameWidth = mSeecArea.height() / 2;
if (boundingRect().contains(event->pos() - QPointF(frameWidth,0))
&& boundingRect().contains(event->pos() + QPointF(frameWidth,0)))
{

@ -149,6 +149,7 @@ class DelegateMediaControl: public QObject, public QGraphicsRectItem
private:
int mStartWidth;
int mSeecAreaBorderHeight;
QRectF mSeecArea;
QRectF mLCDTimerArea;

@ -35,11 +35,20 @@ UBAudioPresentationWidget::UBAudioPresentationWidget(QWidget *parent)
void UBAudioPresentationWidget::paintEvent(QPaintEvent *event)
{
QPainter painter(this);
painter.fillRect(rect(), QBrush(Qt::black));
painter.fillRect(rect(), QBrush(Qt::white));
painter.drawRoundedRect(1,1, width()-2, height()-2, height()/5, height()/5);
QImage mask_img(size(), QImage::Format_Mono);
mask_img.fill(0xff);
QPainter mask_painter(&mask_img);
mask_painter.setBrush(QBrush( QColor(0, 0, 0)));
mask_painter.drawRoundedRect(1,1, width()-3, height()-3, height()/5, height()/5);
setMask(QBitmap::fromImage(mask_img));
if (QString() != mTitle)
{
painter.setPen(QPen(Qt::white));
painter.setPen(QPen(Qt::black));
QRect titleRect = rect();
titleRect.setX(mBorderSize);
titleRect.setY(2);

@ -135,7 +135,6 @@ void UBGraphicsMediaItemDelegate::positionHandles()
if (mediaItem->getMediaType() == UBGraphicsMediaItem::mediaType_Video)
{
mToolBarItem->setPos(0, delegated()->boundingRect().height()-mToolBarItem->rect().height());
// mToolBarItem->setScale(AntiScaleRatio);
toolBarRect.setWidth(delegated()->boundingRect().width());
}
@ -191,8 +190,6 @@ void UBGraphicsMediaItemDelegate::remove(bool canUndo)
if (delegated() && delegated()->mediaObject())
delegated()->mediaObject()->stop();
QGraphicsScene* scene = mDelegated->scene();
UBGraphicsItemDelegate::remove(canUndo);
}

Loading…
Cancel
Save