From 840e44417402bbc6048ca5e8ff3dd6be966e753f Mon Sep 17 00:00:00 2001 From: alwin Date: Sun, 10 Apr 2005 22:18:50 +0000 Subject: added opieplayer3 this moment not just more than another container around xine like opieplayer2 (and uses a lot of code direct from there) difference: first it was a testcontainer to find the bugs in player2 now it is a player looks more like kino2 (eg, no stylesheets) so it has a real resizeable video-display. early stage (saving playlists and so on doesn't work) - but it can display videos on my C860 in bigger box than this small stamp like player2 ;) --- (limited to 'noncore/multimedia/opieplayer3/videowidget.cpp') diff --git a/noncore/multimedia/opieplayer3/videowidget.cpp b/noncore/multimedia/opieplayer3/videowidget.cpp new file mode 100644 index 0000000..c5c63c7 --- a/dev/null +++ b/noncore/multimedia/opieplayer3/videowidget.cpp @@ -0,0 +1,122 @@ +#include "videowidget.h" +#include "../opieplayer2/lib.h" +#include "../opieplayer2/threadutil.h" +#include "../opieplayer2/xinevideowidget.h" + +#include + +#include + +#include +#include +#include + +VideoWidget::VideoWidget( QWidget * parent, const char * name, WFlags f) + :QWidget(parent,name,f) +{ + m_xineLib = 0; + + m_MainLayout = new QVBoxLayout(this); + m_MainLayout->setAutoAdd(true); + m_Videodisplay = new XineVideoWidget(this,"videodisp"); + m_PosSlider = new QSlider(QSlider::Horizontal,this); + m_PosSlider->setTickInterval(60); + connect(m_PosSlider,SIGNAL(valueChanged(int)),this,SLOT(slotNewPos(int))); + connect(m_PosSlider,SIGNAL(sliderMoved(int)),this,SLOT(slotNewPos(int))); + connect(m_PosSlider,SIGNAL(sliderPressed()),this,SLOT(sliderPressed())); + connect(m_PosSlider,SIGNAL(sliderReleased()),this,SLOT(sliderReleased())); + connect(m_Videodisplay,SIGNAL(videoResized ( const QSize & )),this,SLOT(slot_Videoresized(const QSize&))); + connect(m_Videodisplay,SIGNAL(clicked()),this,SLOT(slotClicked())); + m_pressed = false; + m_uppos=0; +} + +VideoWidget::~VideoWidget() +{ +} + +void VideoWidget::slotClicked() +{ + odebug << "clicked " << oendl; + emit videoclicked(); +} + +void VideoWidget::closeEvent(QCloseEvent*e) +{ +} + +void VideoWidget::slotNewPos(int pos) +{ + if (!m_xineLib) return; + if (m_uppos==pos) return; + m_xineLib->seekTo(pos); +} + +void VideoWidget::sliderPressed() +{ + m_pressed = true; +} + +void VideoWidget::sliderReleased() +{ + m_pressed = false; +} + +void VideoWidget::fullScreen(bool how) +{ + if (how) { + m_PosSlider->hide(); + } else { + m_PosSlider->show(); + } +} + +void VideoWidget::playFile(const DocLnk&aLnk,XINE::Lib*aLib) +{ + m_current = aLnk; + if (m_xineLib != aLib) { + disconnect(m_xineLib); + m_xineLib = aLib; + if (aLib) m_xineLib->setWidget(m_Videodisplay); + } + if (!m_xineLib) { + return; + } + connect(m_xineLib,SIGNAL(stopped()),this,SLOT(slotStopped())); + m_uppos=0; + m_PosSlider->setValue(0); + m_xineLib->setWidget(m_Videodisplay); + m_xineLib->setShowVideo(true); + m_xineLib->resize(m_Videodisplay->size()); + m_xineLib->play(m_current.file()); + int l = m_xineLib->length(); + m_PosSlider->setRange(0,l); + m_PosSlider->setPageStep(l/10); +} + +void VideoWidget::stopPlaying() +{ + if (m_xineLib) { + m_xineLib->stop(); + } +} + +void VideoWidget::slotStopped() +{ +// check fullscreen here! +} + +void VideoWidget::slot_Videoresized(const QSize&s) +{ + odebug << "Videoresized: " << s << oendl; + if (m_xineLib) { + m_xineLib->resize(s); + } +} + +void VideoWidget::updatePos(int val) +{ + if (m_pressed) return; + m_uppos = val; + m_PosSlider->setValue(val); +} -- cgit v0.9.0.2