Diffstat (limited to 'noncore/multimedia/opieplayer3/videowidget.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/multimedia/opieplayer3/videowidget.cpp | 77 |
1 files changed, 16 insertions, 61 deletions
diff --git a/noncore/multimedia/opieplayer3/videowidget.cpp b/noncore/multimedia/opieplayer3/videowidget.cpp index a28d47d..833ecb4 100644 --- a/noncore/multimedia/opieplayer3/videowidget.cpp +++ b/noncore/multimedia/opieplayer3/videowidget.cpp | |||
@@ -6,140 +6,95 @@ | |||
6 | #include <opie2/odebug.h> | 6 | #include <opie2/odebug.h> |
7 | 7 | ||
8 | #include <qpe/qpeapplication.h> | 8 | #include <qpe/qpeapplication.h> |
9 | 9 | ||
10 | #include <qlayout.h> | 10 | #include <qlayout.h> |
11 | #include <qslider.h> | 11 | #include <qslider.h> |
12 | #include <qlabel.h> | 12 | #include <qlabel.h> |
13 | 13 | ||
14 | VideoWidget::VideoWidget( QWidget * parent, const char * name, WFlags f) | 14 | VideoWidget::VideoWidget( QWidget * parent, const char * name, WFlags f) |
15 | :QWidget(parent,name,f) | 15 | :QWidget(parent,name,f) |
16 | { | 16 | { |
17 | m_xineLib = 0; | 17 | m_xineLib = 0; |
18 | 18 | m_scaleUp = false; | |
19 | m_MainLayout = new QVBoxLayout(this); | 19 | m_MainLayout = new QVBoxLayout(this); |
20 | m_MainLayout->setAutoAdd(true); | 20 | m_MainLayout->setAutoAdd(true); |
21 | m_Videodisplay = new XineVideoWidget(this,"videodisp"); | 21 | m_Videodisplay = new XineVideoWidget(this,"videodisp"); |
22 | #if 0 | ||
23 | m_PosSlider = new QSlider(QSlider::Horizontal,this); | ||
24 | m_PosSlider->setTickInterval(60); | ||
25 | connect(m_PosSlider,SIGNAL(valueChanged(int)),this,SLOT(slotNewPos(int))); | ||
26 | connect(m_PosSlider,SIGNAL(sliderMoved(int)),this,SLOT(slotNewPos(int))); | ||
27 | connect(m_PosSlider,SIGNAL(sliderPressed()),this,SLOT(sliderPressed())); | ||
28 | connect(m_PosSlider,SIGNAL(sliderReleased()),this,SLOT(sliderReleased())); | ||
29 | #endif | ||
30 | connect(m_Videodisplay,SIGNAL(videoResized ( const QSize & )),this,SLOT(slot_Videoresized(const QSize&))); | 22 | connect(m_Videodisplay,SIGNAL(videoResized ( const QSize & )),this,SLOT(slot_Videoresized(const QSize&))); |
31 | connect(m_Videodisplay,SIGNAL(clicked()),this,SLOT(slotClicked())); | 23 | connect(m_Videodisplay,SIGNAL(clicked()),this,SLOT(slotClicked())); |
32 | #if 0 | ||
33 | m_pressed = false; | ||
34 | m_uppos=0; | ||
35 | #endif | ||
36 | } | 24 | } |
37 | 25 | ||
38 | VideoWidget::~VideoWidget() | 26 | VideoWidget::~VideoWidget() |
39 | { | 27 | { |
40 | } | 28 | } |
41 | 29 | ||
42 | void VideoWidget::slotClicked() | 30 | void VideoWidget::slotClicked() |
43 | { | 31 | { |
44 | odebug << "clicked " << oendl; | ||
45 | emit videoclicked(); | 32 | emit videoclicked(); |
46 | } | 33 | } |
47 | 34 | ||
48 | void VideoWidget::closeEvent(QCloseEvent*e) | 35 | void VideoWidget::closeEvent(QCloseEvent*e) |
49 | { | 36 | { |
50 | } | 37 | } |
51 | 38 | ||
52 | void VideoWidget::slotNewPos(int /*pos*/) | ||
53 | { | ||
54 | #if 0 | ||
55 | if (!m_xineLib) return; | ||
56 | if (m_uppos==pos) return; | ||
57 | m_xineLib->seekTo(pos); | ||
58 | #endif | ||
59 | } | ||
60 | |||
61 | void VideoWidget::sliderPressed() | ||
62 | { | ||
63 | #if 0 | ||
64 | m_pressed = true; | ||
65 | #endif | ||
66 | } | ||
67 | |||
68 | void VideoWidget::sliderReleased() | ||
69 | { | ||
70 | #if 0 | ||
71 | m_pressed = false; | ||
72 | #endif | ||
73 | } | ||
74 | |||
75 | void VideoWidget::fullScreen(bool /* how */) | 39 | void VideoWidget::fullScreen(bool /* how */) |
76 | { | 40 | { |
77 | #if 0 | ||
78 | if (how) { | ||
79 | m_PosSlider->hide(); | ||
80 | } else { | ||
81 | m_PosSlider->show(); | ||
82 | } | ||
83 | #endif | ||
84 | } | 41 | } |
85 | 42 | ||
86 | int VideoWidget::playFile(const DocLnk&aLnk,XINE::Lib*aLib) | 43 | int VideoWidget::playFile(const DocLnk&aLnk,XINE::Lib*aLib) |
87 | { | 44 | { |
88 | m_current = aLnk; | 45 | m_current = aLnk; |
89 | bool recon; | 46 | bool recon; |
90 | if (m_xineLib != aLib) { | 47 | if (m_xineLib != aLib) { |
91 | if (m_xineLib) disconnect(m_xineLib); | 48 | if (m_xineLib) disconnect(m_xineLib); |
92 | m_xineLib = aLib; | 49 | m_xineLib = aLib; |
93 | if (aLib) m_xineLib->setWidget(m_Videodisplay); | 50 | if (aLib) m_xineLib->setWidget(m_Videodisplay); |
94 | } | 51 | } |
95 | if (!m_xineLib) { | 52 | if (!m_xineLib) { |
96 | return -1; | 53 | return -1; |
97 | } | 54 | } |
98 | connect(m_xineLib,SIGNAL(stopped()),this,SLOT(slotStopped())); | 55 | connect(m_xineLib,SIGNAL(stopped()),this,SLOT(slotStopped())); |
99 | #if 0 | ||
100 | m_uppos=0; | ||
101 | m_PosSlider->setValue(0); | ||
102 | #endif | ||
103 | m_xineLib->setWidget(m_Videodisplay); | 56 | m_xineLib->setWidget(m_Videodisplay); |
104 | m_xineLib->setShowVideo(true); | 57 | m_xineLib->setShowVideo(true); |
105 | m_xineLib->resize(m_Videodisplay->size()); | ||
106 | int res = m_xineLib->play(m_current.file()); | 58 | int res = m_xineLib->play(m_current.file()); |
59 | vSize = m_xineLib->videoSize(); | ||
60 | slot_Videoresized(m_Videodisplay->size()); | ||
107 | odebug << "Xine play: " << res << oendl; | 61 | odebug << "Xine play: " << res << oendl; |
108 | if (res != 1) { | 62 | if (res != 1) { |
109 | return -2; | 63 | return -2; |
110 | } | 64 | } |
111 | return m_xineLib->length(); | 65 | return m_xineLib->length(); |
112 | #if 0 | ||
113 | m_PosSlider->setRange(0,l); | ||
114 | m_PosSlider->setPageStep(l/10); | ||
115 | #endif | ||
116 | } | 66 | } |
117 | 67 | ||
118 | void VideoWidget::stopPlaying() | 68 | void VideoWidget::stopPlaying() |
119 | { | 69 | { |
120 | if (m_xineLib) { | 70 | if (m_xineLib) { |
121 | m_xineLib->stop(); | 71 | m_xineLib->stop(); |
122 | } | 72 | } |
123 | } | 73 | } |
124 | 74 | ||
125 | void VideoWidget::slotStopped() | 75 | void VideoWidget::slotStopped() |
126 | { | 76 | { |
127 | // check fullscreen here! | ||
128 | } | 77 | } |
129 | 78 | ||
130 | void VideoWidget::slot_Videoresized(const QSize&s) | 79 | void VideoWidget::slot_Videoresized(const QSize&s) |
131 | { | 80 | { |
132 | odebug << "Videoresized: " << s << oendl; | ||
133 | if (m_xineLib) { | 81 | if (m_xineLib) { |
134 | m_xineLib->resize(s); | 82 | if (vSize.width()<s.width()&&vSize.height()<s.height()&&!m_scaleUp) { |
83 | m_xineLib->resize(vSize); | ||
84 | } else { | ||
85 | m_xineLib->resize(s); | ||
86 | } | ||
135 | } | 87 | } |
136 | } | 88 | } |
137 | 89 | ||
90 | void VideoWidget::scaleUp(bool how) | ||
91 | { | ||
92 | if (how == m_scaleUp) return; | ||
93 | m_scaleUp = how; | ||
94 | slot_Videoresized(m_Videodisplay->size()); | ||
95 | m_Videodisplay->repaint(); | ||
96 | } | ||
97 | |||
138 | void VideoWidget::updatePos(int /*val*/) | 98 | void VideoWidget::updatePos(int /*val*/) |
139 | { | 99 | { |
140 | #if 0 | ||
141 | if (m_pressed) return; | ||
142 | m_uppos = val; | ||
143 | m_PosSlider->setValue(val); | ||
144 | #endif | ||
145 | } | 100 | } |