From ff7fe04fe19e31f43e8ae4b24b88bd0092f23c62 Mon Sep 17 00:00:00 2001 From: shibakaneki Date: Fri, 13 Jan 2012 09:50:48 +0100 Subject: [PATCH] Updated the video widget rendering --- resources/style.qss | 2 -- src/customWidgets/UBMediaWidget.cpp | 13 +++++++------ src/gui/UBTeacherBarWidget.cpp | 4 ++-- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/resources/style.qss b/resources/style.qss index a3fec87d..d80964a1 100644 --- a/resources/style.qss +++ b/resources/style.qss @@ -18,8 +18,6 @@ QWidget#UBMediaVideoContainer background: #000000; border-radius: 10px; border: 2px solid #999999; - margin: 0px 0px 0px 0px; - padding: 0px 0px 0px 0px; } QWidget#UBTeacherBarPreviewWidget diff --git a/src/customWidgets/UBMediaWidget.cpp b/src/customWidgets/UBMediaWidget.cpp index eabe51bd..24be6760 100644 --- a/src/customWidgets/UBMediaWidget.cpp +++ b/src/customWidgets/UBMediaWidget.cpp @@ -35,6 +35,7 @@ UBMediaWidget::UBMediaWidget(eMediaType type, QWidget *parent, const char *name) mSeekerLayout.addWidget(mpPlayStopButton, 0); mSeekerLayout.addWidget(mpPauseButton, 0); mSeekerLayout.addWidget(mpSlider, 1); + mSeekerLayout.setContentsMargins(0, 0, 0, 0); connect(mpPlayStopButton, SIGNAL(clicked()), this, SLOT(onPlayStopClicked())); connect(mpPauseButton, SIGNAL(clicked()), this, SLOT(onPauseClicked())); @@ -74,9 +75,9 @@ void UBMediaWidget::createMediaPlayer() { if(eMediaType_Video == mType){ mpVideoWidget = new Phonon::VideoWidget(this); - mpVideoWidget->setStyleSheet(QString("margin: 0px 0px 0px 0px; padding: 0px 0px 0px 0px;")); mpVideoContainer = new QWidget(this); mpVideoContainer->setObjectName("UBMediaVideoContainer"); + mVideoLayout.setContentsMargins(10, 10, 25, 10); mpVideoContainer->setLayout(&mVideoLayout); mVideoLayout.addWidget(mpVideoWidget, 1); Phonon::createPath(mpMediaObject, mpVideoWidget); @@ -93,13 +94,13 @@ void UBMediaWidget::createMediaPlayer() void UBMediaWidget::adaptSizeToVideo() { - if(NULL != mpVideoWidget){ - int origW = mpVideoWidget->width(); - int origH = mpVideoWidget->height(); + if(NULL != mpVideoContainer){ + int origW = mpVideoContainer->width(); + int origH = mpVideoContainer->height(); int newW = width(); float scaleFactor = (float)origW/(float)newW; int newH = origH/scaleFactor; - resize(width(), height() + newH); + resize(newW, height() + newH); } } @@ -185,7 +186,7 @@ UBMediaButton::UBMediaButton(QWidget *parent, const char *name):QLabel(parent) { setObjectName(name); resize(UBMEDIABUTTON_SIZE, UBMEDIABUTTON_SIZE); - setStyleSheet(QString("padding:0px 0px 0px 0px;")); + setStyleSheet(QString("padding:0px 0px 0px 0px; margin:0px 0px 0px 0px;")); } UBMediaButton::~UBMediaButton() diff --git a/src/gui/UBTeacherBarWidget.cpp b/src/gui/UBTeacherBarWidget.cpp index a718a40a..0f439cf7 100644 --- a/src/gui/UBTeacherBarWidget.cpp +++ b/src/gui/UBTeacherBarWidget.cpp @@ -1235,8 +1235,8 @@ QWidget* UBTBMediaContainer::generateMediaWidget(const QString& url) pW = label; } else if(mimeType.contains("video") || mimeType.contains("audio")){ - UBMediaPlayer* mediaPlayer = new UBMediaPlayer(); - //UBMediaWidget* mediaPlayer = new UBMediaWidget(mimeType.contains("audio")?eMediaType_Audio:eMediaType_Video); + //UBMediaPlayer* mediaPlayer = new UBMediaPlayer(); + UBMediaWidget* mediaPlayer = new UBMediaWidget(mimeType.contains("audio")?eMediaType_Audio:eMediaType_Video); mediaPlayer->setFile(url); pW = mediaPlayer; }