|
|
@ -37,7 +37,6 @@ UBMediaWidget::UBMediaWidget(eMediaType type, QWidget *parent, const char *name) |
|
|
|
, mpMediaContainer(NULL) |
|
|
|
, mpMediaContainer(NULL) |
|
|
|
, mMediaLayout(NULL) |
|
|
|
, mMediaLayout(NULL) |
|
|
|
, mpCover(NULL) |
|
|
|
, mpCover(NULL) |
|
|
|
, mpSnapshotVideoWidget(NULL) |
|
|
|
|
|
|
|
{ |
|
|
|
{ |
|
|
|
SET_STYLE_SHEET(); |
|
|
|
SET_STYLE_SHEET(); |
|
|
|
|
|
|
|
|
|
|
@ -73,15 +72,13 @@ UBMediaWidget::UBMediaWidget(eMediaType type, QWidget *parent, const char *name) |
|
|
|
UBMediaWidget::~UBMediaWidget() |
|
|
|
UBMediaWidget::~UBMediaWidget() |
|
|
|
{ |
|
|
|
{ |
|
|
|
unsetActionsParent(); |
|
|
|
unsetActionsParent(); |
|
|
|
|
|
|
|
DELETEPTR(mpMediaObject); |
|
|
|
DELETEPTR(mpSlider); |
|
|
|
DELETEPTR(mpSlider); |
|
|
|
DELETEPTR(mpPauseButton); |
|
|
|
DELETEPTR(mpPauseButton); |
|
|
|
DELETEPTR(mpPlayStopButton); |
|
|
|
DELETEPTR(mpPlayStopButton); |
|
|
|
DELETEPTR(mpAudioOutput); |
|
|
|
DELETEPTR(mpAudioOutput); |
|
|
|
DELETEPTR(mpVideoWidget); |
|
|
|
DELETEPTR(mpVideoWidget); |
|
|
|
DELETEPTR(mpMediaObject); |
|
|
|
|
|
|
|
DELETEPTR(mpCover); |
|
|
|
DELETEPTR(mpCover); |
|
|
|
DELETEPTR(mpSnapshotVideoWidget); |
|
|
|
|
|
|
|
DELETEPTR(mpVideoStackedWidget); |
|
|
|
|
|
|
|
DELETEPTR(mpMediaContainer); |
|
|
|
DELETEPTR(mpMediaContainer); |
|
|
|
DELETEPTR(mpSeekerLayout); |
|
|
|
DELETEPTR(mpSeekerLayout); |
|
|
|
DELETEPTR(mpLayout); |
|
|
|
DELETEPTR(mpLayout); |
|
|
@ -116,13 +113,9 @@ eMediaType UBMediaWidget::mediaType() |
|
|
|
void UBMediaWidget::showEvent(QShowEvent* event) |
|
|
|
void UBMediaWidget::showEvent(QShowEvent* event) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if(!mpVideoWidget){ |
|
|
|
if(!mpVideoWidget){ |
|
|
|
mpSnapshotVideoWidget = new QLabel(this); |
|
|
|
|
|
|
|
mpVideoWidget = new Phonon::VideoWidget(this); |
|
|
|
mpVideoWidget = new Phonon::VideoWidget(this); |
|
|
|
mpVideoStackedWidget = new QStackedWidget(this); |
|
|
|
|
|
|
|
mpVideoStackedWidget->addWidget(mpVideoWidget); |
|
|
|
|
|
|
|
mpVideoStackedWidget->addWidget(mpSnapshotVideoWidget); |
|
|
|
|
|
|
|
mMediaLayout->addStretch(1); |
|
|
|
mMediaLayout->addStretch(1); |
|
|
|
mMediaLayout->addWidget(mpVideoStackedWidget,0); |
|
|
|
mMediaLayout->addWidget(mpVideoWidget); |
|
|
|
mMediaLayout->addStretch(1); |
|
|
|
mMediaLayout->addStretch(1); |
|
|
|
Phonon::createPath(mpMediaObject, mpVideoWidget); |
|
|
|
Phonon::createPath(mpMediaObject, mpVideoWidget); |
|
|
|
adaptSizeToVideo(); |
|
|
|
adaptSizeToVideo(); |
|
|
@ -152,13 +145,9 @@ void UBMediaWidget::createMediaPlayer() |
|
|
|
if(eMediaType_Video == mType){ |
|
|
|
if(eMediaType_Video == mType){ |
|
|
|
mMediaLayout->setContentsMargins(10, 10, 10, 10); |
|
|
|
mMediaLayout->setContentsMargins(10, 10, 10, 10); |
|
|
|
if(isVisible()){ |
|
|
|
if(isVisible()){ |
|
|
|
mpSnapshotVideoWidget = new QLabel(this); |
|
|
|
|
|
|
|
mpVideoWidget = new Phonon::VideoWidget(this); |
|
|
|
mpVideoWidget = new Phonon::VideoWidget(this); |
|
|
|
mpVideoStackedWidget = new QStackedWidget(this); |
|
|
|
|
|
|
|
mpVideoStackedWidget->addWidget(mpVideoWidget); |
|
|
|
|
|
|
|
mpVideoStackedWidget->addWidget(mpSnapshotVideoWidget); |
|
|
|
|
|
|
|
mMediaLayout->addStretch(1); |
|
|
|
mMediaLayout->addStretch(1); |
|
|
|
mMediaLayout->addWidget(mpVideoStackedWidget, 0); |
|
|
|
mMediaLayout->addWidget(mpVideoWidget); |
|
|
|
mMediaLayout->addStretch(1); |
|
|
|
mMediaLayout->addStretch(1); |
|
|
|
Phonon::createPath(mpMediaObject, mpVideoWidget); |
|
|
|
Phonon::createPath(mpMediaObject, mpVideoWidget); |
|
|
|
adaptSizeToVideo(); |
|
|
|
adaptSizeToVideo(); |
|
|
@ -197,20 +186,6 @@ void UBMediaWidget::adaptSizeToVideo() |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void UBMediaWidget::updateView(Phonon::State nextState) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if(isVisible() && eMediaType_Video == mType){ |
|
|
|
|
|
|
|
if(nextState != Phonon::PlayingState){ |
|
|
|
|
|
|
|
const QPixmap& snapshot = QPixmap::grabWindow(mpVideoWidget->winId()); |
|
|
|
|
|
|
|
mpSnapshotVideoWidget->setPixmap(snapshot); |
|
|
|
|
|
|
|
mpVideoStackedWidget->setCurrentWidget(mpSnapshotVideoWidget); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
mpVideoStackedWidget->setCurrentWidget(mpVideoWidget); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* \brief Handle the media state change notification |
|
|
|
* \brief Handle the media state change notification |
|
|
|
* @param newState as the new state |
|
|
|
* @param newState as the new state |
|
|
@ -239,9 +214,10 @@ void UBMediaWidget::onStateChanged(Phonon::State newState, Phonon::State oldStat |
|
|
|
mpPauseButton->setEnabled(false); |
|
|
|
mpPauseButton->setEnabled(false); |
|
|
|
mpSlider->setValue(0); |
|
|
|
mpSlider->setValue(0); |
|
|
|
} |
|
|
|
} |
|
|
|
if(mType == eMediaType_Video) |
|
|
|
|
|
|
|
updateView(newState); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// if(mType == eMediaType_Video)
|
|
|
|
|
|
|
|
// updateView(newState);
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|