aibility to play video with phonon
This commit is contained in:
parent
82c59cf612
commit
74deb97d6a
3 changed files with 158 additions and 49 deletions
|
|
@ -51,6 +51,28 @@
|
|||
<property name="frameShadow">
|
||||
<enum>QFrame::Sunken</enum>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="Phonon::VideoPlayer" name="videoPlayer">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Phonon::SeekSlider" name="seekSlider">
|
||||
<property name="iconVisible">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="tracking">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
|
|
@ -62,8 +84,11 @@
|
|||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="fieldGrowthPolicy">
|
||||
<enum>QFormLayout::ExpandingFieldsGrow</enum>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
|
|
@ -71,65 +96,30 @@
|
|||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Author</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Date</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Rating</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLabel" name="authorLabel">
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLabel" name="dateLabel">
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QLabel" name="ratingLabel">
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
<string>URL</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="durationLabel">
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
<widget class="QLineEdit" name="urlEdit">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="cursor">
|
||||
<cursorShape>ArrowCursor</cursorShape>
|
||||
</property>
|
||||
<property name="mouseTracking">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="autoFillBackground">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="font">
|
||||
<font>
|
||||
|
|
@ -142,11 +132,90 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLabel" name="durationLabel">
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Author</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLabel" name="authorLabel">
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Date</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QLabel" name="dateLabel">
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Rating</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QLabel" name="ratingLabel">
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>Phonon::VideoPlayer</class>
|
||||
<extends>QWidget</extends>
|
||||
<header location="global">phonon/videoplayer.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>Phonon::SeekSlider</class>
|
||||
<extends>QWidget</extends>
|
||||
<header location="global">phonon/seekslider.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
# Form implementation generated from reading ui file 'video.ui'
|
||||
#
|
||||
# Created: Sat Apr 17 10:11:11 2010
|
||||
# Created: Sat Apr 17 12:19:03 2010
|
||||
# by: PyQt4 UI code generator 4.6
|
||||
#
|
||||
# WARNING! All changes made in this file will be lost!
|
||||
|
|
@ -35,53 +35,80 @@ class Ui_Video(object):
|
|||
self.frame.setFrameShape(QtGui.QFrame.StyledPanel)
|
||||
self.frame.setFrameShadow(QtGui.QFrame.Sunken)
|
||||
self.frame.setObjectName("frame")
|
||||
self.verticalLayout_2 = QtGui.QVBoxLayout(self.frame)
|
||||
self.verticalLayout_2.setObjectName("verticalLayout_2")
|
||||
self.videoPlayer = phonon.Phonon.VideoPlayer(self.frame)
|
||||
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.MinimumExpanding)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.videoPlayer.sizePolicy().hasHeightForWidth())
|
||||
self.videoPlayer.setSizePolicy(sizePolicy)
|
||||
self.videoPlayer.setObjectName("videoPlayer")
|
||||
self.verticalLayout_2.addWidget(self.videoPlayer)
|
||||
self.seekSlider = phonon.Phonon.SeekSlider(self.frame)
|
||||
self.seekSlider.setIconVisible(True)
|
||||
self.seekSlider.setTracking(True)
|
||||
self.seekSlider.setObjectName("seekSlider")
|
||||
self.verticalLayout_2.addWidget(self.seekSlider)
|
||||
self.verticalLayout.addWidget(self.frame)
|
||||
self.frame_2 = QtGui.QFrame(Video)
|
||||
self.frame_2.setFrameShape(QtGui.QFrame.StyledPanel)
|
||||
self.frame_2.setFrameShadow(QtGui.QFrame.Raised)
|
||||
self.frame_2.setObjectName("frame_2")
|
||||
self.formLayout = QtGui.QFormLayout(self.frame_2)
|
||||
self.formLayout.setFieldGrowthPolicy(QtGui.QFormLayout.ExpandingFieldsGrow)
|
||||
self.formLayout.setObjectName("formLayout")
|
||||
self.label = QtGui.QLabel(self.frame_2)
|
||||
self.label_4 = QtGui.QLabel(self.frame_2)
|
||||
font = QtGui.QFont()
|
||||
font.setWeight(75)
|
||||
font.setBold(True)
|
||||
self.label.setFont(font)
|
||||
self.label.setObjectName("label")
|
||||
self.formLayout.setWidget(1, QtGui.QFormLayout.LabelRole, self.label)
|
||||
self.label_2 = QtGui.QLabel(self.frame_2)
|
||||
font = QtGui.QFont()
|
||||
font.setWeight(75)
|
||||
font.setBold(True)
|
||||
self.label_2.setFont(font)
|
||||
self.label_2.setObjectName("label_2")
|
||||
self.formLayout.setWidget(2, QtGui.QFormLayout.LabelRole, self.label_2)
|
||||
self.label_3 = QtGui.QLabel(self.frame_2)
|
||||
font = QtGui.QFont()
|
||||
font.setWeight(75)
|
||||
font.setBold(True)
|
||||
self.label_3.setFont(font)
|
||||
self.label_3.setObjectName("label_3")
|
||||
self.formLayout.setWidget(3, QtGui.QFormLayout.LabelRole, self.label_3)
|
||||
self.authorLabel = QtGui.QLabel(self.frame_2)
|
||||
self.authorLabel.setObjectName("authorLabel")
|
||||
self.formLayout.setWidget(1, QtGui.QFormLayout.FieldRole, self.authorLabel)
|
||||
self.dateLabel = QtGui.QLabel(self.frame_2)
|
||||
self.dateLabel.setObjectName("dateLabel")
|
||||
self.formLayout.setWidget(2, QtGui.QFormLayout.FieldRole, self.dateLabel)
|
||||
self.ratingLabel = QtGui.QLabel(self.frame_2)
|
||||
self.ratingLabel.setObjectName("ratingLabel")
|
||||
self.formLayout.setWidget(3, QtGui.QFormLayout.FieldRole, self.ratingLabel)
|
||||
self.durationLabel = QtGui.QLabel(self.frame_2)
|
||||
self.durationLabel.setObjectName("durationLabel")
|
||||
self.formLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.durationLabel)
|
||||
self.label_4.setFont(font)
|
||||
self.label_4.setObjectName("label_4")
|
||||
self.formLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.label_4)
|
||||
self.urlEdit = QtGui.QLineEdit(self.frame_2)
|
||||
self.urlEdit.setReadOnly(True)
|
||||
self.urlEdit.setObjectName("urlEdit")
|
||||
self.formLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.urlEdit)
|
||||
self.label_8 = QtGui.QLabel(self.frame_2)
|
||||
font = QtGui.QFont()
|
||||
font.setWeight(75)
|
||||
font.setBold(True)
|
||||
self.label_8.setFont(font)
|
||||
self.label_8.setObjectName("label_8")
|
||||
self.formLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.label_8)
|
||||
self.formLayout.setWidget(1, QtGui.QFormLayout.LabelRole, self.label_8)
|
||||
self.durationLabel = QtGui.QLabel(self.frame_2)
|
||||
self.durationLabel.setObjectName("durationLabel")
|
||||
self.formLayout.setWidget(1, QtGui.QFormLayout.FieldRole, self.durationLabel)
|
||||
self.label = QtGui.QLabel(self.frame_2)
|
||||
font = QtGui.QFont()
|
||||
font.setWeight(75)
|
||||
font.setBold(True)
|
||||
self.label.setFont(font)
|
||||
self.label.setObjectName("label")
|
||||
self.formLayout.setWidget(2, QtGui.QFormLayout.LabelRole, self.label)
|
||||
self.authorLabel = QtGui.QLabel(self.frame_2)
|
||||
self.authorLabel.setObjectName("authorLabel")
|
||||
self.formLayout.setWidget(2, QtGui.QFormLayout.FieldRole, self.authorLabel)
|
||||
self.label_2 = QtGui.QLabel(self.frame_2)
|
||||
font = QtGui.QFont()
|
||||
font.setWeight(75)
|
||||
font.setBold(True)
|
||||
self.label_2.setFont(font)
|
||||
self.label_2.setObjectName("label_2")
|
||||
self.formLayout.setWidget(3, QtGui.QFormLayout.LabelRole, self.label_2)
|
||||
self.dateLabel = QtGui.QLabel(self.frame_2)
|
||||
self.dateLabel.setObjectName("dateLabel")
|
||||
self.formLayout.setWidget(3, QtGui.QFormLayout.FieldRole, self.dateLabel)
|
||||
self.label_3 = QtGui.QLabel(self.frame_2)
|
||||
font = QtGui.QFont()
|
||||
font.setWeight(75)
|
||||
font.setBold(True)
|
||||
self.label_3.setFont(font)
|
||||
self.label_3.setObjectName("label_3")
|
||||
self.formLayout.setWidget(4, QtGui.QFormLayout.LabelRole, self.label_3)
|
||||
self.ratingLabel = QtGui.QLabel(self.frame_2)
|
||||
self.ratingLabel.setObjectName("ratingLabel")
|
||||
self.formLayout.setWidget(4, QtGui.QFormLayout.FieldRole, self.ratingLabel)
|
||||
self.verticalLayout.addWidget(self.frame_2)
|
||||
|
||||
self.retranslateUi(Video)
|
||||
|
|
@ -90,12 +117,14 @@ class Ui_Video(object):
|
|||
def retranslateUi(self, Video):
|
||||
Video.setWindowTitle(QtGui.QApplication.translate("Video", "Video", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.titleLabel.setText(QtGui.QApplication.translate("Video", "TextLabel", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.label.setText(QtGui.QApplication.translate("Video", "Author", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.label_2.setText(QtGui.QApplication.translate("Video", "Date", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.label_3.setText(QtGui.QApplication.translate("Video", "Rating", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.authorLabel.setText(QtGui.QApplication.translate("Video", "TextLabel", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.dateLabel.setText(QtGui.QApplication.translate("Video", "TextLabel", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.ratingLabel.setText(QtGui.QApplication.translate("Video", "TextLabel", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.durationLabel.setText(QtGui.QApplication.translate("Video", "TextLabel", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.label_4.setText(QtGui.QApplication.translate("Video", "URL", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.label_8.setText(QtGui.QApplication.translate("Video", "Duration", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.durationLabel.setText(QtGui.QApplication.translate("Video", "TextLabel", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.label.setText(QtGui.QApplication.translate("Video", "Author", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.authorLabel.setText(QtGui.QApplication.translate("Video", "TextLabel", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.label_2.setText(QtGui.QApplication.translate("Video", "Date", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.dateLabel.setText(QtGui.QApplication.translate("Video", "TextLabel", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.label_3.setText(QtGui.QApplication.translate("Video", "Rating", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.ratingLabel.setText(QtGui.QApplication.translate("Video", "TextLabel", None, QtGui.QApplication.UnicodeUTF8))
|
||||
|
||||
from PyQt4 import phonon
|
||||
|
|
|
|||
|
|
@ -18,7 +18,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
"""
|
||||
|
||||
from PyQt4.QtCore import QUrl
|
||||
from PyQt4.QtGui import QDialog
|
||||
from PyQt4.phonon import Phonon
|
||||
|
||||
from weboob.frontends.qvideoob.ui.video_ui import Ui_Video
|
||||
|
||||
|
|
@ -30,6 +32,7 @@ class Video(QDialog):
|
|||
|
||||
self.video = video
|
||||
self.setWindowTitle("Video - %s" % video.title)
|
||||
self.ui.urlEdit.setText(video.url)
|
||||
self.ui.titleLabel.setText(video.title)
|
||||
self.ui.durationLabel.setText('%d:%02d:%02d' % (video.duration/3600, (video.duration%3600)/60, video.duration%60))
|
||||
self.ui.authorLabel.setText(unicode(video.author))
|
||||
|
|
@ -38,3 +41,11 @@ class Video(QDialog):
|
|||
self.ui.ratingLabel.setText('%s / %s' % (video.rating, video.rating_max))
|
||||
else:
|
||||
self.ui.ratingLabel.setText('%s' % video.rating)
|
||||
|
||||
self.ui.seekSlider.setMediaObject(self.ui.videoPlayer.mediaObject())
|
||||
self.ui.videoPlayer.load(Phonon.MediaSource(QUrl(video.url)))
|
||||
self.ui.videoPlayer.play()
|
||||
|
||||
def closeEvent(self, event):
|
||||
self.ui.videoPlayer.stop()
|
||||
event.accept()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue