|
|
@ -31,29 +31,6 @@ |
|
|
|
#include "board/UBBoardController.h" |
|
|
|
#include "board/UBBoardController.h" |
|
|
|
#include "core/memcheck.h" |
|
|
|
#include "core/memcheck.h" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UBAudioPresentationWidget::UBAudioPresentationWidget(QWidget *parent) |
|
|
|
|
|
|
|
: QWidget(parent) |
|
|
|
|
|
|
|
, mBorderSize(10) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void UBAudioPresentationWidget::paintEvent(QPaintEvent *event) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
QPainter painter(this); |
|
|
|
|
|
|
|
painter.fillRect(rect(), QBrush(Qt::white)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QPen borderPen; |
|
|
|
|
|
|
|
borderPen.setWidth(2); |
|
|
|
|
|
|
|
borderPen.setColor(QColor(Qt::black)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
painter.setPen(borderPen); |
|
|
|
|
|
|
|
painter.drawRect(0,0, width(), height()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QWidget::paintEvent(event); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool UBGraphicsMediaItem::sIsMutedByDefault = false; |
|
|
|
bool UBGraphicsMediaItem::sIsMutedByDefault = false; |
|
|
|
|
|
|
|
|
|
|
|
UBGraphicsMediaItem::UBGraphicsMediaItem(const QUrl& pMediaFileUrl, QGraphicsItem *parent) |
|
|
|
UBGraphicsMediaItem::UBGraphicsMediaItem(const QUrl& pMediaFileUrl, QGraphicsItem *parent) |
|
|
@ -97,14 +74,9 @@ UBGraphicsMediaItem::UBGraphicsMediaItem(const QUrl& pMediaFileUrl, QGraphicsIte |
|
|
|
mAudioOutput = new Phonon::AudioOutput(Phonon::MusicCategory, this); |
|
|
|
mAudioOutput = new Phonon::AudioOutput(Phonon::MusicCategory, this); |
|
|
|
|
|
|
|
|
|
|
|
mMediaObject->setTickInterval(1000); |
|
|
|
mMediaObject->setTickInterval(1000); |
|
|
|
mAudioWidget = new UBAudioPresentationWidget(); |
|
|
|
mAudioWidget = new QWidget(); |
|
|
|
int borderSize = 0; |
|
|
|
mAudioWidget->resize(320,26); |
|
|
|
UBAudioPresentationWidget* pAudioWidget = dynamic_cast<UBAudioPresentationWidget*>(mAudioWidget); |
|
|
|
mAudioWidget->setMinimumSize(150,26); |
|
|
|
if (pAudioWidget) |
|
|
|
|
|
|
|
borderSize = pAudioWidget->borderSize(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mAudioWidget->resize(320,26+2*borderSize); //3*border size with enabled title
|
|
|
|
|
|
|
|
mAudioWidget->setMinimumSize(150,26+borderSize); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
haveLinkedImage = false; |
|
|
|
haveLinkedImage = false; |
|
|
|
} |
|
|
|
} |
|
|
@ -117,10 +89,7 @@ UBGraphicsMediaItem::UBGraphicsMediaItem(const QUrl& pMediaFileUrl, QGraphicsIte |
|
|
|
// we should create delegate after media objects because delegate uses his properties at creation.
|
|
|
|
// we should create delegate after media objects because delegate uses his properties at creation.
|
|
|
|
setDelegate(new UBGraphicsMediaItemDelegate(this, mMediaObject)); |
|
|
|
setDelegate(new UBGraphicsMediaItemDelegate(this, mMediaObject)); |
|
|
|
|
|
|
|
|
|
|
|
// TODO claudio remove this because in contrast with the fact the frame should be created on demand.
|
|
|
|
|
|
|
|
// but without without forcing the control creation we do not have the frame and all the calculation
|
|
|
|
|
|
|
|
// for the different element of the interface will fail
|
|
|
|
|
|
|
|
Delegate()->createControls(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// delegate should be created earler because we setWidget calls resize event for graphics proxy widgt.
|
|
|
|
// delegate should be created earler because we setWidget calls resize event for graphics proxy widgt.
|
|
|
|
// resize uses delegate.
|
|
|
|
// resize uses delegate.
|
|
|
@ -130,6 +99,10 @@ UBGraphicsMediaItem::UBGraphicsMediaItem(const QUrl& pMediaFileUrl, QGraphicsIte |
|
|
|
setWidget(mAudioWidget); |
|
|
|
setWidget(mAudioWidget); |
|
|
|
|
|
|
|
|
|
|
|
// media widget should be created and placed on proxy widget here.
|
|
|
|
// media widget should be created and placed on proxy widget here.
|
|
|
|
|
|
|
|
// TODO claudio remove this because in contrast with the fact the frame should be created on demand.
|
|
|
|
|
|
|
|
// but without forcing the control creation we do not have the frame and all the calculation
|
|
|
|
|
|
|
|
// for the different element of the interface will fail
|
|
|
|
|
|
|
|
Delegate()->createControls(); |
|
|
|
if (mediaType_Audio == mMediaType) |
|
|
|
if (mediaType_Audio == mMediaType) |
|
|
|
Delegate()->frame()->setOperationMode(UBGraphicsDelegateFrame::ResizingHorizontally); |
|
|
|
Delegate()->frame()->setOperationMode(UBGraphicsDelegateFrame::ResizingHorizontally); |
|
|
|
else |
|
|
|
else |
|
|
@ -196,11 +169,6 @@ void UBGraphicsMediaItem::clearSource() |
|
|
|
qDebug() << "cannot delete file: " << path; |
|
|
|
qDebug() << "cannot delete file: " << path; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void UBGraphicsMediaItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
UBGraphicsProxyWidget::paint(painter, option, widget); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void UBGraphicsMediaItem::toggleMute() |
|
|
|
void UBGraphicsMediaItem::toggleMute() |
|
|
|
{ |
|
|
|
{ |
|
|
|
mMuted = !mMuted; |
|
|
|
mMuted = !mMuted; |
|
|
|