author | alwin <alwin> | 2005-04-14 09:23:25 (UTC) |
---|---|---|
committer | alwin <alwin> | 2005-04-14 09:23:25 (UTC) |
commit | c643e152dc7d2167381d3fc0568ad4043de5604e (patch) (unidiff) | |
tree | 3050f49d659a1d6eb54cca2a08ed64cf0d04842a | |
parent | cb10570b4118161a066b741c2674d8d522670623 (diff) | |
download | opie-c643e152dc7d2167381d3fc0568ad4043de5604e.zip opie-c643e152dc7d2167381d3fc0568ad4043de5604e.tar.gz opie-c643e152dc7d2167381d3fc0568ad4043de5604e.tar.bz2 |
gui polish
-rw-r--r-- | noncore/multimedia/opieplayer3/mwindow.cpp | 9 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer3/mwindow.h | 1 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer3/playlist.cpp | 6 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer3/videowidget.cpp | 1 |
4 files changed, 14 insertions, 3 deletions
diff --git a/noncore/multimedia/opieplayer3/mwindow.cpp b/noncore/multimedia/opieplayer3/mwindow.cpp index 75d1490..0898c7b 100644 --- a/noncore/multimedia/opieplayer3/mwindow.cpp +++ b/noncore/multimedia/opieplayer3/mwindow.cpp | |||
@@ -1,128 +1,129 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | 3 | ||
4 | Copyright (c) 2002 Max Reiss <harlekin@handhelds.org> | 4 | Copyright (c) 2002 Max Reiss <harlekin@handhelds.org> |
5 | Copyright (c) 2002 L. Potter <ljp@llornkcor.com> | 5 | Copyright (c) 2002 L. Potter <ljp@llornkcor.com> |
6 | Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> | 6 | Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> |
7 | =. | 7 | =. |
8 | .=l. | 8 | .=l. |
9 | .>+-= | 9 | .>+-= |
10 | _;:, .> :=|. This program is free software; you can | 10 | _;:, .> :=|. This program is free software; you can |
11 | .> <`_, > . <= redistribute it and/or modify it under | 11 | .> <`_, > . <= redistribute it and/or modify it under |
12 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | 12 | :`=1 )Y*s>-.-- : the terms of the GNU General Public |
13 | .="- .-=="i, .._ License as published by the Free Software | 13 | .="- .-=="i, .._ License as published by the Free Software |
14 | - . .-<_> .<> Foundation; either version 2 of the License, | 14 | - . .-<_> .<> Foundation; either version 2 of the License, |
15 | ._= =} : or (at your option) any later version. | 15 | ._= =} : or (at your option) any later version. |
16 | .%`+i> _;_. | 16 | .%`+i> _;_. |
17 | .i_,=:_. -<s. This program is distributed in the hope that | 17 | .i_,=:_. -<s. This program is distributed in the hope that |
18 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 18 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
19 | : .. .:, . . . without even the implied warranty of | 19 | : .. .:, . . . without even the implied warranty of |
20 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 20 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
21 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 21 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
22 | ..}^=.= = ; Library General Public License for more | 22 | ..}^=.= = ; Library General Public License for more |
23 | ++= -. .` .: details. | 23 | ++= -. .` .: details. |
24 | : = ...= . :.=- | 24 | : = ...= . :.=- |
25 | -. .:....=;==+<; You should have received a copy of the GNU | 25 | -. .:....=;==+<; You should have received a copy of the GNU |
26 | -_. . . )=. = Library General Public License along with | 26 | -_. . . )=. = Library General Public License along with |
27 | -- :-=` this library; see the file COPYING.LIB. | 27 | -- :-=` this library; see the file COPYING.LIB. |
28 | If not, write to the Free Software Foundation, | 28 | If not, write to the Free Software Foundation, |
29 | Inc., 59 Temple Place - Suite 330, | 29 | Inc., 59 Temple Place - Suite 330, |
30 | Boston, MA 02111-1307, USA. | 30 | Boston, MA 02111-1307, USA. |
31 | 31 | ||
32 | */ | 32 | */ |
33 | 33 | ||
34 | #include "mwindow.h" | 34 | #include "mwindow.h" |
35 | #include "playlist.h" | 35 | #include "playlist.h" |
36 | #include "audiowidget.h" | 36 | #include "audiowidget.h" |
37 | #include "videowidget.h" | 37 | #include "videowidget.h" |
38 | #include "../opieplayer2/lib.h" | 38 | #include "../opieplayer2/lib.h" |
39 | 39 | ||
40 | #include <opie2/oapplicationfactory.h> | 40 | #include <opie2/oapplicationfactory.h> |
41 | #include <opie2/owidgetstack.h> | 41 | #include <opie2/owidgetstack.h> |
42 | #include <opie2/ofileselector.h> | 42 | #include <opie2/ofileselector.h> |
43 | #include <opie2/odebug.h> | 43 | #include <opie2/odebug.h> |
44 | 44 | ||
45 | #include <qpe/resource.h> | 45 | #include <qpe/resource.h> |
46 | #include <qpe/qpeapplication.h> | ||
46 | 47 | ||
47 | #include <qfileinfo.h> | 48 | #include <qfileinfo.h> |
48 | #include <qfile.h> | 49 | #include <qfile.h> |
49 | #include <qtoolbar.h> | 50 | #include <qtoolbar.h> |
50 | #include <qpopupmenu.h> | 51 | #include <qpopupmenu.h> |
51 | #include <qmenubar.h> | 52 | #include <qmenubar.h> |
52 | #include <qtimer.h> | 53 | #include <qtimer.h> |
53 | #include <qslider.h> | 54 | #include <qslider.h> |
54 | #include <qlayout.h> | 55 | #include <qlayout.h> |
55 | 56 | ||
56 | OPIE_EXPORT_APP( Opie::Core::OApplicationFactory<PMainWindow>) | 57 | OPIE_EXPORT_APP( Opie::Core::OApplicationFactory<PMainWindow>) |
57 | 58 | ||
58 | using namespace Opie::Ui; | 59 | using namespace Opie::Ui; |
59 | 60 | ||
60 | PMainWindow::PMainWindow(QWidget*w, const char*name, WFlags f) | 61 | PMainWindow::PMainWindow(QWidget*w, const char*name, WFlags f) |
61 | : QMainWindow(w,name,f) | 62 | : QMainWindow(w,name,f) |
62 | { | 63 | { |
63 | checkLib(); | 64 | checkLib(); |
64 | setCaption( QObject::tr("Opie Mediaplayer 3" ) ); | 65 | setCaption(appTitle()); |
65 | 66 | ||
66 | m_MainBox = new QWidget(this); | 67 | m_MainBox = new QWidget(this); |
67 | 68 | ||
68 | QVBoxLayout*m_l = new QVBoxLayout(m_MainBox); | 69 | QVBoxLayout*m_l = new QVBoxLayout(m_MainBox); |
69 | 70 | ||
70 | m_stack = new OWidgetStack(m_MainBox); | 71 | m_stack = new OWidgetStack(m_MainBox); |
71 | m_stack->forceMode(Opie::Ui::OWidgetStack::SmallScreen); | 72 | m_stack->forceMode(Opie::Ui::OWidgetStack::SmallScreen); |
72 | m_l->addWidget(m_stack); | 73 | m_l->addWidget(m_stack); |
73 | m_PosSlider = new QSlider(QSlider::Horizontal,m_MainBox); | 74 | m_PosSlider = new QSlider(QSlider::Horizontal,m_MainBox); |
74 | m_l->addWidget(m_PosSlider); | 75 | m_l->addWidget(m_PosSlider); |
75 | m_PosSlider->setEnabled(false); | 76 | m_PosSlider->setEnabled(false); |
76 | 77 | ||
77 | m_playList = new PlaylistView(m_stack,"playlist"); | 78 | m_playList = new PlaylistView(m_stack,"playlist"); |
78 | m_stack->addWidget(m_playList,stack_list); | 79 | m_stack->addWidget(m_playList,stack_list); |
79 | connect(m_playList,SIGNAL(contentChanged(int)),this,SLOT(slotListChanged(int))); | 80 | connect(m_playList,SIGNAL(contentChanged(int)),this,SLOT(slotListChanged(int))); |
80 | m_sfl = new OFileSelector("video/*;audio/*",m_stack); | 81 | m_sfl = new OFileSelector("video/*;audio/*",m_stack); |
81 | m_stack->addWidget(m_sfl,stack_file); | 82 | m_stack->addWidget(m_sfl,stack_file); |
82 | connect(m_sfl, SIGNAL(fileSelected(const DocLnk &)), m_playList, SLOT(slotAddFile(const DocLnk &))); | 83 | connect(m_sfl, SIGNAL(fileSelected(const DocLnk &)), m_playList, SLOT(slotAddFile(const DocLnk &))); |
83 | m_AudioPlayer = new AudioWidget(m_stack); | 84 | m_AudioPlayer = new AudioWidget(m_stack); |
84 | m_stack->addWidget(m_AudioPlayer,stack_audio); | 85 | m_stack->addWidget(m_AudioPlayer,stack_audio); |
85 | connect(this,SIGNAL(sigPos(int)),m_AudioPlayer,SLOT(updatePos(int))); | 86 | connect(this,SIGNAL(sigPos(int)),m_AudioPlayer,SLOT(updatePos(int))); |
86 | m_VideoPlayer = new VideoWidget(m_stack); | 87 | m_VideoPlayer = new VideoWidget(m_stack); |
87 | m_stack->addWidget(m_VideoPlayer,stack_video); | 88 | m_stack->addWidget(m_VideoPlayer,stack_video); |
88 | connect(this,SIGNAL(sigPos(int)),m_VideoPlayer,SLOT(updatePos(int))); | 89 | connect(this,SIGNAL(sigPos(int)),m_VideoPlayer,SLOT(updatePos(int))); |
89 | connect(m_VideoPlayer,SIGNAL(videoclicked()),this,SLOT(slotVideoclicked())); | 90 | connect(m_VideoPlayer,SIGNAL(videoclicked()),this,SLOT(slotVideoclicked())); |
90 | 91 | ||
91 | connect(m_PosSlider,SIGNAL(valueChanged(int)),this,SLOT(slotNewPos(int))); | 92 | connect(m_PosSlider,SIGNAL(valueChanged(int)),this,SLOT(slotNewPos(int))); |
92 | connect(m_PosSlider,SIGNAL(sliderMoved(int)),this,SLOT(slotNewPos(int))); | 93 | connect(m_PosSlider,SIGNAL(sliderMoved(int)),this,SLOT(slotNewPos(int))); |
93 | connect(m_PosSlider,SIGNAL(sliderPressed()),this,SLOT(sliderPressed())); | 94 | connect(m_PosSlider,SIGNAL(sliderPressed()),this,SLOT(sliderPressed())); |
94 | connect(m_PosSlider,SIGNAL(sliderReleased()),this,SLOT(sliderReleased())); | 95 | connect(m_PosSlider,SIGNAL(sliderReleased()),this,SLOT(sliderReleased())); |
95 | m_pressed = false; | 96 | m_pressed = false; |
96 | m_uppos=0; | 97 | m_uppos=0; |
97 | 98 | ||
98 | m_stack->raiseWidget(stack_list); | 99 | m_stack->raiseWidget(stack_list); |
99 | m_LastItem = 0; | 100 | m_LastItem = 0; |
100 | setupActions(); | 101 | setupActions(); |
101 | setupToolBar(); | 102 | setupToolBar(); |
102 | setupMenu(); | 103 | setupMenu(); |
103 | 104 | ||
104 | setCentralWidget(m_MainBox ); | 105 | setCentralWidget(m_MainBox ); |
105 | } | 106 | } |
106 | 107 | ||
107 | void PMainWindow::slotListChanged(int count) | 108 | void PMainWindow::slotListChanged(int count) |
108 | { | 109 | { |
109 | playersGroup->setEnabled(count>0); | 110 | playersGroup->setEnabled(count>0); |
110 | if (!m_playList->isVisible()) { | 111 | if (!m_playList->isVisible()) { |
111 | return; | 112 | return; |
112 | } | 113 | } |
113 | a_removeFiles->setEnabled(count>0); | 114 | a_removeFiles->setEnabled(count>0); |
114 | } | 115 | } |
115 | 116 | ||
116 | void PMainWindow::mediaWindowraised() | 117 | void PMainWindow::mediaWindowraised() |
117 | { | 118 | { |
118 | playlistOnly->setEnabled(false); | 119 | playlistOnly->setEnabled(false); |
119 | a_appendFiles->setEnabled(true); | 120 | a_appendFiles->setEnabled(true); |
120 | a_loadPlaylist->setEnabled(true); | 121 | a_loadPlaylist->setEnabled(true); |
121 | a_showPlaylist->setEnabled(true); | 122 | a_showPlaylist->setEnabled(true); |
122 | a_ShowMedia->setEnabled(false); | 123 | a_ShowMedia->setEnabled(false); |
123 | } | 124 | } |
124 | 125 | ||
125 | void PMainWindow::checkLib() | 126 | void PMainWindow::checkLib() |
126 | { | 127 | { |
127 | if (m_PlayLib == 0) { | 128 | if (m_PlayLib == 0) { |
128 | m_PlayLib = new XINE::Lib(XINE::Lib::InitializeInThread); | 129 | m_PlayLib = new XINE::Lib(XINE::Lib::InitializeInThread); |
@@ -150,229 +151,233 @@ void PMainWindow::slotAppendFiles() | |||
150 | playlistOnly->setEnabled(false); | 151 | playlistOnly->setEnabled(false); |
151 | 152 | ||
152 | a_showPlaylist->setEnabled(true); | 153 | a_showPlaylist->setEnabled(true); |
153 | if (m_PlayLib && m_playing) { | 154 | if (m_PlayLib && m_playing) { |
154 | a_ShowMedia->setEnabled(true); | 155 | a_ShowMedia->setEnabled(true); |
155 | } else { | 156 | } else { |
156 | a_ShowMedia->setEnabled(false); | 157 | a_ShowMedia->setEnabled(false); |
157 | } | 158 | } |
158 | } | 159 | } |
159 | 160 | ||
160 | void PMainWindow::slotShowList() | 161 | void PMainWindow::slotShowList() |
161 | { | 162 | { |
162 | m_stack->raiseWidget(m_playList); | 163 | m_stack->raiseWidget(m_playList); |
163 | playlistOnly->setEnabled(true); | 164 | playlistOnly->setEnabled(true); |
164 | a_showPlaylist->setEnabled(false); | 165 | a_showPlaylist->setEnabled(false); |
165 | if (m_playList->childCount()) { | 166 | if (m_playList->childCount()) { |
166 | a_removeFiles->setEnabled(true); | 167 | a_removeFiles->setEnabled(true); |
167 | } else { | 168 | } else { |
168 | a_removeFiles->setEnabled(false); | 169 | a_removeFiles->setEnabled(false); |
169 | } | 170 | } |
170 | if (m_PlayLib && m_playing) { | 171 | if (m_PlayLib && m_playing) { |
171 | a_ShowMedia->setEnabled(true); | 172 | a_ShowMedia->setEnabled(true); |
172 | } else { | 173 | } else { |
173 | a_ShowMedia->setEnabled(false); | 174 | a_ShowMedia->setEnabled(false); |
174 | } | 175 | } |
175 | } | 176 | } |
176 | 177 | ||
177 | void PMainWindow::slotShowMediaWindow() | 178 | void PMainWindow::slotShowMediaWindow() |
178 | { | 179 | { |
179 | if (m_playing && m_LastItem && m_PlayLib) { | 180 | if (m_playing && m_LastItem && m_PlayLib) { |
180 | if (!m_LastItem->isVideo()) { | 181 | if (!m_LastItem->isVideo()) { |
181 | m_stack->raiseWidget(stack_audio); | 182 | m_stack->raiseWidget(stack_audio); |
182 | } else { | 183 | } else { |
183 | m_stack->raiseWidget(stack_video); | 184 | m_stack->raiseWidget(stack_video); |
184 | } | 185 | } |
185 | mediaWindowraised(); | 186 | mediaWindowraised(); |
186 | return; | 187 | return; |
187 | } | 188 | } |
188 | } | 189 | } |
189 | 190 | ||
190 | void PMainWindow::slotPlayList() | 191 | void PMainWindow::slotPlayList() |
191 | { | 192 | { |
192 | if (m_playing && m_LastItem && m_PlayLib) { | 193 | if (m_playing && m_LastItem && m_PlayLib) { |
193 | slotShowMediaWindow(); | 194 | slotShowMediaWindow(); |
194 | return; | 195 | return; |
195 | } | 196 | } |
196 | 197 | ||
197 | m_LastItem = m_playList->currentItem(); | 198 | m_LastItem = m_playList->currentItem(); |
198 | if (!m_LastItem) { | 199 | if (!m_LastItem) { |
199 | slotPlayNext(); | 200 | slotPlayNext(); |
200 | return; | 201 | return; |
201 | } | 202 | } |
202 | //m_VideoPlayer->setFullScreen(a_ShowFull->isOn()); | 203 | //m_VideoPlayer->setFullScreen(a_ShowFull->isOn()); |
203 | slotPlayCurrent(); | 204 | slotPlayCurrent(); |
204 | } | 205 | } |
205 | 206 | ||
206 | void PMainWindow::slotUserStop() | 207 | void PMainWindow::slotUserStop() |
207 | { | 208 | { |
208 | if (!m_playing || !m_PlayLib) return; | 209 | if (!m_playing || !m_PlayLib) return; |
209 | m_playing = false; | 210 | m_playing = false; |
210 | m_PlayLib->stop(); | 211 | m_PlayLib->stop(); |
211 | m_PosSlider->setEnabled(false); | 212 | m_PosSlider->setEnabled(false); |
212 | hideVideo(); | 213 | hideVideo(); |
213 | slotShowList(); | 214 | slotShowList(); |
215 | setCaption(appTitle()); | ||
214 | } | 216 | } |
215 | 217 | ||
216 | void PMainWindow::slotTogglePlay(bool how) | 218 | void PMainWindow::slotTogglePlay(bool how) |
217 | { | 219 | { |
218 | if (how == m_playing) { | 220 | if (how == m_playing) { |
219 | if (how) { | 221 | if (how) { |
220 | slotShowMediaWindow(); | 222 | slotShowMediaWindow(); |
221 | } | 223 | } |
222 | return; | 224 | return; |
223 | } | 225 | } |
224 | if (how) { | 226 | if (how) { |
225 | slotPlayList(); | 227 | slotPlayList(); |
226 | } else { | 228 | } else { |
227 | slotUserStop(); | 229 | slotUserStop(); |
228 | } | 230 | } |
229 | } | 231 | } |
230 | 232 | ||
231 | void PMainWindow::hideVideo() | 233 | void PMainWindow::hideVideo() |
232 | { | 234 | { |
233 | if (m_VideoPlayer->isVisible() && a_ShowFull->isOn()) { | 235 | if (m_VideoPlayer->isVisible() && a_ShowFull->isOn()) { |
234 | //m_VideoPlayer->showNormal(); | 236 | //m_VideoPlayer->showNormal(); |
235 | m_VideoPlayer->hide(); | 237 | m_VideoPlayer->hide(); |
236 | } | 238 | } |
237 | } | 239 | } |
238 | 240 | ||
239 | void PMainWindow::slotPlayCurrent() | 241 | void PMainWindow::slotPlayCurrent() |
240 | { | 242 | { |
241 | if (!m_LastItem) { | 243 | if (!m_LastItem) { |
242 | if (m_PlayLib) m_PlayLib->stop(); | 244 | if (m_PlayLib) m_PlayLib->stop(); |
243 | m_PosSlider->setEnabled(false); | 245 | m_PosSlider->setEnabled(false); |
244 | a_playAction->setOn(false); | 246 | a_playAction->setOn(false); |
245 | hideVideo(); | 247 | hideVideo(); |
246 | slotShowList(); | 248 | slotShowList(); |
249 | setCaption(appTitle()); | ||
247 | return; | 250 | return; |
248 | } | 251 | } |
249 | m_CurrentPos = 0; | 252 | m_CurrentPos = 0; |
250 | m_playList->setCurrentItem(m_LastItem); | 253 | m_playList->setCurrentItem(m_LastItem); |
251 | m_uppos = 0; | 254 | m_uppos = 0; |
252 | m_PosSlider->setValue(0); | 255 | m_PosSlider->setValue(0); |
253 | int result = 0; | 256 | int result = 0; |
254 | if (!m_LastItem->isVideo()) { | 257 | if (!m_LastItem->isVideo()) { |
255 | hideVideo(); | 258 | hideVideo(); |
256 | m_playing = true; | 259 | m_playing = true; |
257 | m_stack->raiseWidget(stack_audio); | 260 | m_stack->raiseWidget(stack_audio); |
258 | result = m_AudioPlayer->playFile(m_LastItem->Lnk(),m_PlayLib); | 261 | result = m_AudioPlayer->playFile(m_LastItem->Lnk(),m_PlayLib); |
259 | } else { | 262 | } else { |
260 | m_playing = true; | 263 | m_playing = true; |
261 | setupVideo(a_ShowFull->isOn()); | 264 | setupVideo(a_ShowFull->isOn()); |
262 | result = m_VideoPlayer->playFile(m_LastItem->Lnk(),m_PlayLib); | 265 | result = m_VideoPlayer->playFile(m_LastItem->Lnk(),m_PlayLib); |
263 | } | 266 | } |
264 | if (result<0) { | 267 | if (result<0) { |
265 | // fehler | 268 | // fehler |
266 | return; | 269 | return; |
267 | } | 270 | } |
268 | mediaWindowraised(); | 271 | mediaWindowraised(); |
272 | setCaption(appTitle()+" - "+m_LastItem->Lnk().name()); | ||
269 | odebug << "Range: " << result << oendl; | 273 | odebug << "Range: " << result << oendl; |
270 | m_PosSlider->setEnabled(true); | 274 | m_PosSlider->setEnabled(true); |
271 | m_PosSlider->setRange(0,m_PlayLib->length()); | 275 | m_PosSlider->setRange(0,m_PlayLib->length()); |
272 | m_PosSlider->setValue(m_PlayLib->currentTime()); | 276 | m_PosSlider->setValue(m_PlayLib->currentTime()); |
273 | QTimer::singleShot( 500, this, SLOT( slotCheckPos() ) ); | 277 | QTimer::singleShot( 500, this, SLOT( slotCheckPos() ) ); |
274 | } | 278 | } |
275 | 279 | ||
276 | void PMainWindow::slotPlayNext() | 280 | void PMainWindow::slotPlayNext() |
277 | { | 281 | { |
278 | PlaylistItem*item = m_playList->nextItem(m_LastItem); | 282 | PlaylistItem*item = m_playList->nextItem(m_LastItem); |
279 | if (!item) return; | 283 | if (!item) return; |
280 | m_LastItem = item; | 284 | m_LastItem = item; |
281 | slotPlayCurrent(); | 285 | slotPlayCurrent(); |
282 | } | 286 | } |
283 | 287 | ||
284 | void PMainWindow::slotGoNext() | 288 | void PMainWindow::slotGoNext() |
285 | { | 289 | { |
286 | m_LastItem = m_playList->nextItem(m_LastItem); | 290 | m_LastItem = m_playList->nextItem(m_LastItem); |
287 | slotPlayCurrent(); | 291 | slotPlayCurrent(); |
288 | } | 292 | } |
289 | 293 | ||
290 | void PMainWindow::slotPlayPrevious() | 294 | void PMainWindow::slotPlayPrevious() |
291 | { | 295 | { |
292 | PlaylistItem*item = m_playList->prevItem(m_LastItem); | 296 | PlaylistItem*item = m_playList->prevItem(m_LastItem); |
293 | if (!item) return; | 297 | if (!item) return; |
294 | m_LastItem = item; | 298 | m_LastItem = item; |
295 | slotPlayCurrent(); | 299 | slotPlayCurrent(); |
296 | } | 300 | } |
297 | 301 | ||
298 | void PMainWindow::slotStopped() | 302 | void PMainWindow::slotStopped() |
299 | { | 303 | { |
300 | if (!m_playing) return; | 304 | if (!m_playing) return; |
301 | odebug << "Slot stopped" << oendl; | 305 | odebug << "Slot stopped" << oendl; |
302 | m_playing = false; | 306 | m_playing = false; |
303 | slotGoNext(); | 307 | slotGoNext(); |
304 | } | 308 | } |
305 | 309 | ||
306 | void PMainWindow::slotCheckPos() | 310 | void PMainWindow::slotCheckPos() |
307 | { | 311 | { |
308 | if (!m_playing) return; | 312 | if (!m_playing) return; |
309 | if (!m_pressed) { | 313 | if (!m_pressed) { |
310 | m_uppos = m_PlayLib->currentTime(); | 314 | m_uppos = m_PlayLib->currentTime(); |
311 | emit sigPos(m_uppos); | 315 | emit sigPos(m_uppos); |
312 | m_PosSlider->setValue(m_PlayLib->currentTime()); | 316 | m_PosSlider->setValue(m_PlayLib->currentTime()); |
313 | } | 317 | } |
314 | QTimer::singleShot( 1000, this, SLOT( slotCheckPos() ) ); | 318 | qApp->processEvents(100); |
319 | QTimer::singleShot( 900, this, SLOT( slotCheckPos() ) ); | ||
315 | } | 320 | } |
316 | 321 | ||
317 | void PMainWindow::slotRemoveFiles() | 322 | void PMainWindow::slotRemoveFiles() |
318 | { | 323 | { |
319 | if (m_playing||!m_playList->isVisible()) return; | 324 | if (m_playing||!m_playList->isVisible()) return; |
320 | PlaylistItem* Item = m_playList->currentItem(); | 325 | PlaylistItem* Item = m_playList->currentItem(); |
321 | slotShowList(); | 326 | slotShowList(); |
322 | m_playList->removeFromList(Item); | 327 | m_playList->removeFromList(Item); |
323 | } | 328 | } |
324 | 329 | ||
325 | void PMainWindow::setupActions() | 330 | void PMainWindow::setupActions() |
326 | { | 331 | { |
327 | a_appendFiles = new QAction(tr("Append file(s)"),Resource::loadIconSet( "opieplayer2/add_to_playlist" ), 0, 0, this, 0, false ); | 332 | a_appendFiles = new QAction(tr("Append file(s)"),Resource::loadIconSet( "opieplayer2/add_to_playlist" ), 0, 0, this, 0, false ); |
328 | connect(a_appendFiles,SIGNAL(activated()),this,SLOT(slotAppendFiles())); | 333 | connect(a_appendFiles,SIGNAL(activated()),this,SLOT(slotAppendFiles())); |
329 | a_addDir = new QAction(tr("Add directory"),Resource::loadIconSet("folder_open"),0,0,this,0,false); | 334 | a_addDir = new QAction(tr("Add directory"),Resource::loadIconSet("folder_open"),0,0,this,0,false); |
330 | connect(a_addDir,SIGNAL(activated()),m_playList,SLOT(slotAppendDir())); | 335 | connect(a_addDir,SIGNAL(activated()),m_playList,SLOT(slotAppendDir())); |
331 | a_loadPlaylist = new QAction(tr("Append playlist"),Resource::loadIconSet("opieplayer2/add_to_playlist"),0,0,this,0,false); | 336 | a_loadPlaylist = new QAction(tr("Append playlist"),Resource::loadIconSet("opieplayer2/add_to_playlist"),0,0,this,0,false); |
332 | connect(a_loadPlaylist,SIGNAL(activated()),m_playList,SLOT(slotOpenM3u())); | 337 | connect(a_loadPlaylist,SIGNAL(activated()),m_playList,SLOT(slotOpenM3u())); |
333 | a_savePlaylist = new QAction(tr("Save playlist"),Resource::loadIconSet("save"),0,0,this,0,false); | 338 | a_savePlaylist = new QAction(tr("Save playlist"),Resource::loadIconSet("save"),0,0,this,0,false); |
334 | connect(a_savePlaylist,SIGNAL(activated()),m_playList,SLOT(slotSaveAsM3u())); | 339 | connect(a_savePlaylist,SIGNAL(activated()),m_playList,SLOT(slotSaveAsM3u())); |
335 | 340 | ||
336 | playlistOnly = new QActionGroup(this,"playlistgroup",false); | 341 | playlistOnly = new QActionGroup(this,"playlistgroup",false); |
337 | playlistOnly->insert(a_appendFiles); | 342 | playlistOnly->insert(a_appendFiles); |
338 | playlistOnly->insert(a_addDir); | 343 | playlistOnly->insert(a_addDir); |
339 | playlistOnly->insert(a_loadPlaylist); | 344 | playlistOnly->insert(a_loadPlaylist); |
340 | playlistOnly->insert(a_savePlaylist); | 345 | playlistOnly->insert(a_savePlaylist); |
341 | 346 | ||
342 | a_showPlaylist = new QAction(tr("Show playlist"),Resource::loadIconSet( "txt" ), 0, 0, this, 0, false ); | 347 | a_showPlaylist = new QAction(tr("Show playlist"),Resource::loadIconSet( "txt" ), 0, 0, this, 0, false ); |
343 | connect(a_showPlaylist,SIGNAL(activated()),this,SLOT(slotShowList())); | 348 | connect(a_showPlaylist,SIGNAL(activated()),this,SLOT(slotShowList())); |
344 | a_ShowMedia = new QAction(tr("Show media window"),Resource::loadIconSet("opieplayer2/musicfile"), 0, 0, this, 0, false ); | 349 | a_ShowMedia = new QAction(tr("Show media window"),Resource::loadIconSet("opieplayer2/musicfile"), 0, 0, this, 0, false ); |
345 | connect(a_ShowMedia,SIGNAL(activated()),this,SLOT(slotShowMediaWindow())); | 350 | connect(a_ShowMedia,SIGNAL(activated()),this,SLOT(slotShowMediaWindow())); |
346 | 351 | ||
347 | a_removeFiles = new QAction(tr("Remove file"),Resource::loadIconSet( "opieplayer2/remove_from_playlist" ), 0, 0, this, 0, false ); | 352 | a_removeFiles = new QAction(tr("Remove file"),Resource::loadIconSet( "opieplayer2/remove_from_playlist" ), 0, 0, this, 0, false ); |
348 | connect(a_removeFiles,SIGNAL(activated()),this,SLOT(slotRemoveFiles())); | 353 | connect(a_removeFiles,SIGNAL(activated()),this,SLOT(slotRemoveFiles())); |
349 | 354 | ||
350 | playersGroup = new QActionGroup(this,"playgroup",false); | 355 | playersGroup = new QActionGroup(this,"playgroup",false); |
351 | 356 | ||
352 | a_playAction = new QAction(tr("Play list"),Resource::loadIconSet( "opieplayer2/play" ), 0, 0, this, 0, true); | 357 | a_playAction = new QAction(tr("Play list"),Resource::loadIconSet( "opieplayer2/play" ), 0, 0, this, 0, true); |
353 | a_playAction->setOn(false); | 358 | a_playAction->setOn(false); |
354 | connect(a_playAction,SIGNAL(toggled(bool)),this,SLOT(slotTogglePlay(bool))); | 359 | connect(a_playAction,SIGNAL(toggled(bool)),this,SLOT(slotTogglePlay(bool))); |
355 | 360 | ||
356 | a_playNext = new QAction(tr("Play next in list"),Resource::loadIconSet( "fastforward" ), 0, 0, this, 0, false ); | 361 | a_playNext = new QAction(tr("Play next in list"),Resource::loadIconSet( "fastforward" ), 0, 0, this, 0, false ); |
357 | connect(a_playNext,SIGNAL(activated()),this,SLOT(slotPlayNext())); | 362 | connect(a_playNext,SIGNAL(activated()),this,SLOT(slotPlayNext())); |
358 | a_playPrevious = new QAction(tr("Play previous in list"),Resource::loadIconSet( "fastback" ), 0, 0, this, 0, false ); | 363 | a_playPrevious = new QAction(tr("Play previous in list"),Resource::loadIconSet( "fastback" ), 0, 0, this, 0, false ); |
359 | connect(a_playPrevious,SIGNAL(activated()),this,SLOT(slotPlayPrevious())); | 364 | connect(a_playPrevious,SIGNAL(activated()),this,SLOT(slotPlayPrevious())); |
360 | a_ShowFull = new QAction(tr("Show videos fullscreen"),Resource::loadIconSet( "fullscreen" ), 0, 0, this, 0, true ); | 365 | a_ShowFull = new QAction(tr("Show videos fullscreen"),Resource::loadIconSet( "fullscreen" ), 0, 0, this, 0, true ); |
361 | connect(a_ShowFull,SIGNAL(toggled(bool)),this,SLOT(slotToggleFull(bool))); | 366 | connect(a_ShowFull,SIGNAL(toggled(bool)),this,SLOT(slotToggleFull(bool))); |
362 | 367 | ||
363 | playersGroup->insert(a_playPrevious); | 368 | playersGroup->insert(a_playPrevious); |
364 | playersGroup->insert(a_playAction); | 369 | playersGroup->insert(a_playAction); |
365 | playersGroup->insert(a_playNext); | 370 | playersGroup->insert(a_playNext); |
366 | 371 | ||
367 | 372 | ||
368 | /* initial states of actions */ | 373 | /* initial states of actions */ |
369 | a_showPlaylist->setEnabled(false); | 374 | a_showPlaylist->setEnabled(false); |
370 | a_removeFiles->setEnabled(false); | 375 | a_removeFiles->setEnabled(false); |
371 | a_ShowMedia->setEnabled(false); | 376 | a_ShowMedia->setEnabled(false); |
372 | playersGroup->setEnabled(false); | 377 | playersGroup->setEnabled(false); |
373 | 378 | ||
374 | settingsGroup = new QActionGroup(this,"configgroup",false); | 379 | settingsGroup = new QActionGroup(this,"configgroup",false); |
375 | 380 | ||
376 | a_Scaleup = new QAction(tr("Scale videos larger"),Resource::loadIconSet( "fullscreen" ), 0, 0, this, 0, true ); | 381 | a_Scaleup = new QAction(tr("Scale videos larger"),Resource::loadIconSet( "fullscreen" ), 0, 0, this, 0, true ); |
377 | connect(a_Scaleup,SIGNAL(toggled(bool)),this,SLOT(slot_scaleupToggled(bool))); | 382 | connect(a_Scaleup,SIGNAL(toggled(bool)),this,SLOT(slot_scaleupToggled(bool))); |
378 | settingsGroup->insert(a_Scaleup); | 383 | settingsGroup->insert(a_Scaleup); |
diff --git a/noncore/multimedia/opieplayer3/mwindow.h b/noncore/multimedia/opieplayer3/mwindow.h index 5d011d5..3ea9a52 100644 --- a/noncore/multimedia/opieplayer3/mwindow.h +++ b/noncore/multimedia/opieplayer3/mwindow.h | |||
@@ -3,128 +3,129 @@ | |||
3 | 3 | ||
4 | Copyright (c) 2002 Max Reiss <harlekin@handhelds.org> | 4 | Copyright (c) 2002 Max Reiss <harlekin@handhelds.org> |
5 | Copyright (c) 2002 L. Potter <ljp@llornkcor.com> | 5 | Copyright (c) 2002 L. Potter <ljp@llornkcor.com> |
6 | Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> | 6 | Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> |
7 | =. | 7 | =. |
8 | .=l. | 8 | .=l. |
9 | .>+-= | 9 | .>+-= |
10 | _;:, .> :=|. This program is free software; you can | 10 | _;:, .> :=|. This program is free software; you can |
11 | .> <`_, > . <= redistribute it and/or modify it under | 11 | .> <`_, > . <= redistribute it and/or modify it under |
12 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | 12 | :`=1 )Y*s>-.-- : the terms of the GNU General Public |
13 | .="- .-=="i, .._ License as published by the Free Software | 13 | .="- .-=="i, .._ License as published by the Free Software |
14 | - . .-<_> .<> Foundation; either version 2 of the License, | 14 | - . .-<_> .<> Foundation; either version 2 of the License, |
15 | ._= =} : or (at your option) any later version. | 15 | ._= =} : or (at your option) any later version. |
16 | .%`+i> _;_. | 16 | .%`+i> _;_. |
17 | .i_,=:_. -<s. This program is distributed in the hope that | 17 | .i_,=:_. -<s. This program is distributed in the hope that |
18 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 18 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
19 | : .. .:, . . . without even the implied warranty of | 19 | : .. .:, . . . without even the implied warranty of |
20 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 20 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
21 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 21 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
22 | ..}^=.= = ; Library General Public License for more | 22 | ..}^=.= = ; Library General Public License for more |
23 | ++= -. .` .: details. | 23 | ++= -. .` .: details. |
24 | : = ...= . :.=- | 24 | : = ...= . :.=- |
25 | -. .:....=;==+<; You should have received a copy of the GNU | 25 | -. .:....=;==+<; You should have received a copy of the GNU |
26 | -_. . . )=. = Library General Public License along with | 26 | -_. . . )=. = Library General Public License along with |
27 | -- :-=` this library; see the file COPYING.LIB. | 27 | -- :-=` this library; see the file COPYING.LIB. |
28 | If not, write to the Free Software Foundation, | 28 | If not, write to the Free Software Foundation, |
29 | Inc., 59 Temple Place - Suite 330, | 29 | Inc., 59 Temple Place - Suite 330, |
30 | Boston, MA 02111-1307, USA. | 30 | Boston, MA 02111-1307, USA. |
31 | 31 | ||
32 | */ | 32 | */ |
33 | 33 | ||
34 | #ifndef _mwindow_h | 34 | #ifndef _mwindow_h |
35 | #define _mwindow_h | 35 | #define _mwindow_h |
36 | 36 | ||
37 | #include <qmainwindow.h> | 37 | #include <qmainwindow.h> |
38 | 38 | ||
39 | #include <qpe/applnk.h> | 39 | #include <qpe/applnk.h> |
40 | 40 | ||
41 | #include <qaction.h> | 41 | #include <qaction.h> |
42 | 42 | ||
43 | namespace Opie { | 43 | namespace Opie { |
44 | namespace Ui { | 44 | namespace Ui { |
45 | class OWidgetStack; | 45 | class OWidgetStack; |
46 | class OFileSelector; | 46 | class OFileSelector; |
47 | } | 47 | } |
48 | } | 48 | } |
49 | 49 | ||
50 | namespace XINE { | 50 | namespace XINE { |
51 | class Lib; | 51 | class Lib; |
52 | } | 52 | } |
53 | 53 | ||
54 | class PlaylistView; | 54 | class PlaylistView; |
55 | class QToolBar; | 55 | class QToolBar; |
56 | class QPopupMenu; | 56 | class QPopupMenu; |
57 | class QMenuBar; | 57 | class QMenuBar; |
58 | class AudioWidget; | 58 | class AudioWidget; |
59 | class VideoWidget; | 59 | class VideoWidget; |
60 | class PlaylistItem; | 60 | class PlaylistItem; |
61 | class QSlider; | 61 | class QSlider; |
62 | 62 | ||
63 | class PMainWindow : public QMainWindow { | 63 | class PMainWindow : public QMainWindow { |
64 | Q_OBJECT | 64 | Q_OBJECT |
65 | public: | 65 | public: |
66 | static QString appName() { return QString::fromLatin1("opie-mediaplayer3" ); } | 66 | static QString appName() { return QString::fromLatin1("opie-mediaplayer3" ); } |
67 | static QString appTitle() {return QString::fromLatin1("Opie Mediaplayer 3" ); } | ||
67 | PMainWindow(QWidget*, const char*, WFlags ); | 68 | PMainWindow(QWidget*, const char*, WFlags ); |
68 | virtual ~PMainWindow(); | 69 | virtual ~PMainWindow(); |
69 | 70 | ||
70 | public slots: | 71 | public slots: |
71 | virtual void slotVideoclicked(); | 72 | virtual void slotVideoclicked(); |
72 | protected: | 73 | protected: |
73 | 74 | ||
74 | /* GUI parts */ | 75 | /* GUI parts */ |
75 | static const int stack_list = 0; | 76 | static const int stack_list = 0; |
76 | static const int stack_file = 1; | 77 | static const int stack_file = 1; |
77 | static const int stack_audio = 2; | 78 | static const int stack_audio = 2; |
78 | static const int stack_video = 3; | 79 | static const int stack_video = 3; |
79 | Opie::Ui::OWidgetStack *m_stack; | 80 | Opie::Ui::OWidgetStack *m_stack; |
80 | Opie::Ui::OFileSelector*m_sfl; | 81 | Opie::Ui::OFileSelector*m_sfl; |
81 | PlaylistView*m_playList; | 82 | PlaylistView*m_playList; |
82 | AudioWidget*m_AudioPlayer; | 83 | AudioWidget*m_AudioPlayer; |
83 | VideoWidget*m_VideoPlayer; | 84 | VideoWidget*m_VideoPlayer; |
84 | QWidget*m_MainBox; | 85 | QWidget*m_MainBox; |
85 | QSlider*m_PosSlider; | 86 | QSlider*m_PosSlider; |
86 | 87 | ||
87 | QAction*a_appendFiles,*a_removeFiles,*a_showPlaylist,*a_playAction,*a_stopAction; | 88 | QAction*a_appendFiles,*a_removeFiles,*a_showPlaylist,*a_playAction,*a_stopAction; |
88 | QAction*a_playNext,*a_playPrevious,*a_ShowFull,*a_stopPlay,*a_ShowMedia; | 89 | QAction*a_playNext,*a_playPrevious,*a_ShowFull,*a_stopPlay,*a_ShowMedia; |
89 | QAction*a_addDir,*a_loadPlaylist,*a_savePlaylist; | 90 | QAction*a_addDir,*a_loadPlaylist,*a_savePlaylist; |
90 | QAction*a_Scaleup; | 91 | QAction*a_Scaleup; |
91 | QActionGroup*playersGroup,*playlistOnly,*settingsGroup; | 92 | QActionGroup*playersGroup,*playlistOnly,*settingsGroup; |
92 | QToolBar*m_toolBar; | 93 | QToolBar*m_toolBar; |
93 | QPopupMenu *fileMenu,*dispMenu,*playMenu,*configMenu; | 94 | QPopupMenu *fileMenu,*dispMenu,*playMenu,*configMenu; |
94 | QMenuBar*m_menuBar; | 95 | QMenuBar*m_menuBar; |
95 | XINE::Lib*m_PlayLib; | 96 | XINE::Lib*m_PlayLib; |
96 | 97 | ||
97 | void setupActions(); | 98 | void setupActions(); |
98 | void setupToolBar(); | 99 | void setupToolBar(); |
99 | void setupMenu(); | 100 | void setupMenu(); |
100 | void checkLib(); | 101 | void checkLib(); |
101 | void setupVideo(bool full); | 102 | void setupVideo(bool full); |
102 | void hideVideo(); | 103 | void hideVideo(); |
103 | bool m_playing:1; | 104 | bool m_playing:1; |
104 | bool m_pressed:1; | 105 | bool m_pressed:1; |
105 | int m_uppos; | 106 | int m_uppos; |
106 | 107 | ||
107 | int m_CurrentPos; | 108 | int m_CurrentPos; |
108 | PlaylistItem*m_LastItem; | 109 | PlaylistItem*m_LastItem; |
109 | void mediaWindowraised(); | 110 | void mediaWindowraised(); |
110 | 111 | ||
111 | protected slots: | 112 | protected slots: |
112 | virtual void fileSelected(const DocLnk&); | 113 | virtual void fileSelected(const DocLnk&); |
113 | virtual void slotAppendFiles(); | 114 | virtual void slotAppendFiles(); |
114 | virtual void slotRemoveFiles(); | 115 | virtual void slotRemoveFiles(); |
115 | virtual void slotShowList(); | 116 | virtual void slotShowList(); |
116 | virtual void slotPlayList(); | 117 | virtual void slotPlayList(); |
117 | virtual void slotPlayNext(); | 118 | virtual void slotPlayNext(); |
118 | virtual void slotPlayPrevious(); | 119 | virtual void slotPlayPrevious(); |
119 | virtual void slotPlayCurrent(); | 120 | virtual void slotPlayCurrent(); |
120 | virtual void slotStopped(); | 121 | virtual void slotStopped(); |
121 | virtual void slotCheckPos(); | 122 | virtual void slotCheckPos(); |
122 | virtual void slotToggleFull(bool); | 123 | virtual void slotToggleFull(bool); |
123 | virtual void slotUserStop(); | 124 | virtual void slotUserStop(); |
124 | virtual void slotGoNext(); | 125 | virtual void slotGoNext(); |
125 | virtual void slotTogglePlay(bool); | 126 | virtual void slotTogglePlay(bool); |
126 | virtual void slotShowMediaWindow(); | 127 | virtual void slotShowMediaWindow(); |
127 | virtual void slotListChanged(int); | 128 | virtual void slotListChanged(int); |
128 | virtual void slotNewPos(int pos); | 129 | virtual void slotNewPos(int pos); |
129 | virtual void sliderPressed(); | 130 | virtual void sliderPressed(); |
130 | virtual void sliderReleased(); | 131 | virtual void sliderReleased(); |
diff --git a/noncore/multimedia/opieplayer3/playlist.cpp b/noncore/multimedia/opieplayer3/playlist.cpp index 2eb40e3..6f2e668 100644 --- a/noncore/multimedia/opieplayer3/playlist.cpp +++ b/noncore/multimedia/opieplayer3/playlist.cpp | |||
@@ -103,164 +103,168 @@ PlaylistView::~PlaylistView() | |||
103 | void PlaylistView::checkLib() | 103 | void PlaylistView::checkLib() |
104 | { | 104 | { |
105 | if (!m_Infolib) { | 105 | if (!m_Infolib) { |
106 | m_Infolib = new XINE::Lib(XINE::Lib::InitializeImmediately); | 106 | m_Infolib = new XINE::Lib(XINE::Lib::InitializeImmediately); |
107 | connect(m_Infolib,SIGNAL(stopped()),this,SLOT(slotDummyStop())); | 107 | connect(m_Infolib,SIGNAL(stopped()),this,SLOT(slotDummyStop())); |
108 | m_Infolib->ensureInitialized(); | 108 | m_Infolib->ensureInitialized(); |
109 | } | 109 | } |
110 | } | 110 | } |
111 | 111 | ||
112 | void PlaylistView::slotDummyStop() | 112 | void PlaylistView::slotDummyStop() |
113 | { | 113 | { |
114 | odebug << "void PlaylistView::slotDummyStop()" << oendl; | 114 | odebug << "void PlaylistView::slotDummyStop()" << oendl; |
115 | } | 115 | } |
116 | 116 | ||
117 | void PlaylistView::slotAddFile(const DocLnk&aLink) | 117 | void PlaylistView::slotAddFile(const DocLnk&aLink) |
118 | { | 118 | { |
119 | QFileInfo f(aLink.file()); | 119 | QFileInfo f(aLink.file()); |
120 | if (f.extension(FALSE).lower()=="m3u"||f.extension(FALSE).lower()=="pls") { | 120 | if (f.extension(FALSE).lower()=="m3u"||f.extension(FALSE).lower()=="pls") { |
121 | readPlayList(aLink.file()); | 121 | readPlayList(aLink.file()); |
122 | } else { | 122 | } else { |
123 | addFile(aLink.file(),aLink.name()); | 123 | addFile(aLink.file(),aLink.name()); |
124 | } | 124 | } |
125 | emit contentChanged(childCount()); | 125 | emit contentChanged(childCount()); |
126 | } | 126 | } |
127 | 127 | ||
128 | void PlaylistView::addFile(const QString&aFile,const QString&aName) | 128 | void PlaylistView::addFile(const QString&aFile,const QString&aName) |
129 | { | 129 | { |
130 | QFileInfo fileInfo(aFile); | 130 | QFileInfo fileInfo(aFile); |
131 | if (!fileInfo.exists()) return; | 131 | if (!fileInfo.exists()) return; |
132 | checkLib(); | 132 | checkLib(); |
133 | QString name = aName; | 133 | QString name = aName; |
134 | if (name.isEmpty()) { | 134 | if (name.isEmpty()) { |
135 | name = fileInfo.fileName(); | 135 | name = fileInfo.fileName(); |
136 | } | 136 | } |
137 | int i = m_Infolib->setfile(aFile.utf8().data()); | 137 | int i = m_Infolib->setfile(aFile.utf8().data()); |
138 | /* realy! otherwise we get an "stopped" signal when playing! - I don't know why */ | 138 | /* realy! otherwise we get an "stopped" signal when playing! - I don't know why */ |
139 | m_Infolib->stop(); | 139 | m_Infolib->stop(); |
140 | odebug << "File set: " << i << " ("<<aFile.utf8().data()<<")"<<oendl; | 140 | odebug << "File set: " << i << " ("<<aFile.utf8().data()<<")"<<oendl; |
141 | if (i<1) { | 141 | if (i<1) { |
142 | i = m_Infolib->error(); | 142 | i = m_Infolib->error(); |
143 | odebug << "Errorcode: " << i << oendl; | 143 | odebug << "Errorcode: " << i << oendl; |
144 | QString msg; | 144 | QString msg; |
145 | msg = QString(tr("Error open file %1: ")).arg(name); | 145 | msg = QString(tr("Error open file %1: ")).arg(name); |
146 | switch (i) { | 146 | switch (i) { |
147 | case 1: | 147 | case 1: |
148 | msg += tr("No input plugin"); | 148 | msg += tr("No input plugin"); |
149 | break; | 149 | break; |
150 | case 2: | 150 | case 2: |
151 | msg += tr("No demuxer plugin"); | 151 | msg += tr("No demuxer plugin"); |
152 | break; | 152 | break; |
153 | case 3: | 153 | case 3: |
154 | msg += tr("Demuxer failed"); | 154 | msg += tr("Demuxer failed"); |
155 | break; | 155 | break; |
156 | case 4: | 156 | case 4: |
157 | msg+=tr("Malformed mrl"); | 157 | msg+=tr("Malformed mrl"); |
158 | break; | 158 | break; |
159 | default: | 159 | default: |
160 | msg += tr("Unknown error"); | 160 | msg += tr("Unknown error"); |
161 | break; | 161 | break; |
162 | } | 162 | } |
163 | QMessageBox::warning(0,tr("Error reading fileheader"),msg); | 163 | QMessageBox::warning(0,tr("Error reading fileheader"),msg); |
164 | return; | 164 | return; |
165 | } | 165 | } |
166 | m_lastItem = m_items.last(); | 166 | m_lastItem = m_items.last(); |
167 | PlaylistItem*_it = currentItem(); | ||
168 | |||
167 | if (m_lastItem) { | 169 | if (m_lastItem) { |
168 | m_lastItem = new PlaylistItem(aFile,this,m_lastItem); | 170 | m_lastItem = new PlaylistItem(aFile,this,m_lastItem); |
169 | } else { | 171 | } else { |
170 | m_lastItem = new PlaylistItem(aFile,this); | 172 | m_lastItem = new PlaylistItem(aFile,this); |
171 | } | 173 | } |
172 | m_lastItem->setExpandable(false); | 174 | m_lastItem->setExpandable(false); |
173 | m_lastItem->setText(1,name); | 175 | m_lastItem->setText(1,name); |
174 | 176 | ||
175 | QString codec = m_Infolib->metaInfo(6); | 177 | QString codec = m_Infolib->metaInfo(6); |
176 | if (codec.isEmpty()) { | 178 | if (codec.isEmpty()) { |
177 | codec = m_Infolib->metaInfo(7); | 179 | codec = m_Infolib->metaInfo(7); |
178 | } | 180 | } |
179 | // codec | 181 | // codec |
180 | m_lastItem->setText(COL_TYPE,codec); | 182 | m_lastItem->setText(COL_TYPE,codec); |
181 | // title | 183 | // title |
182 | m_lastItem->setText(COL_TITLE,m_Infolib->metaInfo(0)); | 184 | m_lastItem->setText(COL_TITLE,m_Infolib->metaInfo(0)); |
183 | // artist | 185 | // artist |
184 | m_lastItem->setText(COL_ARTIST,m_Infolib->metaInfo(2)); | 186 | m_lastItem->setText(COL_ARTIST,m_Infolib->metaInfo(2)); |
185 | // album | 187 | // album |
186 | m_lastItem->setText(COL_ALBUM,m_Infolib->metaInfo(4)); | 188 | m_lastItem->setText(COL_ALBUM,m_Infolib->metaInfo(4)); |
187 | int l = m_Infolib->length(); | 189 | int l = m_Infolib->length(); |
188 | int h = l/3600; | 190 | int h = l/3600; |
189 | l-=h*3600; | 191 | l-=h*3600; |
190 | int m = l/60; | 192 | int m = l/60; |
191 | l-=m*60; | 193 | l-=m*60; |
192 | codec = ""; | 194 | codec = ""; |
193 | if (h>0) { | 195 | if (h>0) { |
194 | codec.sprintf("%2i:%2i:%2i h",h,m,l); | 196 | codec.sprintf("%2i:%2i:%2i h",h,m,l); |
195 | } else { | 197 | } else { |
196 | codec.sprintf("%02i:%02i m",m,l); | 198 | codec.sprintf("%02i:%02i m",m,l); |
197 | } | 199 | } |
198 | // time | 200 | // time |
199 | m_lastItem->setText(COL_TIME,codec); | 201 | m_lastItem->setText(COL_TIME,codec); |
200 | m_lastItem->Video(m_Infolib->hasVideo()); | 202 | m_lastItem->Video(m_Infolib->hasVideo()); |
201 | m_items.append(m_lastItem); | 203 | m_items.append(m_lastItem); |
202 | setSelected(m_lastItem,true); | 204 | if (_it==NULL) { |
205 | setSelected(m_lastItem,true); | ||
206 | } | ||
203 | } | 207 | } |
204 | 208 | ||
205 | void PlaylistView::slotAppendDir() | 209 | void PlaylistView::slotAppendDir() |
206 | { | 210 | { |
207 | QString _dir = Opie::Ui::OFileDialog::getDirectory(Opie::Ui::OFileSelector::Extended,m_lastDir,0,m_lastDir); | 211 | QString _dir = Opie::Ui::OFileDialog::getDirectory(Opie::Ui::OFileSelector::Extended,m_lastDir,0,m_lastDir); |
208 | if (_dir.isEmpty()) return; | 212 | if (_dir.isEmpty()) return; |
209 | m_lastDir = _dir; | 213 | m_lastDir = _dir; |
210 | QDir sDir(_dir); | 214 | QDir sDir(_dir); |
211 | QStringList list = sDir.entryList(DEFAULT_FILE_TYPES,QDir::Files,QDir::Name | QDir::IgnoreCase); | 215 | QStringList list = sDir.entryList(DEFAULT_FILE_TYPES,QDir::Files,QDir::Name | QDir::IgnoreCase); |
212 | for (unsigned i = 0; i < list.count();++i) { | 216 | for (unsigned i = 0; i < list.count();++i) { |
213 | addFile(_dir+QString("/")+list[i]); | 217 | addFile(_dir+QString("/")+list[i]); |
214 | } | 218 | } |
215 | emit contentChanged(childCount()); | 219 | emit contentChanged(childCount()); |
216 | } | 220 | } |
217 | 221 | ||
218 | void PlaylistView::slotOpenM3u() | 222 | void PlaylistView::slotOpenM3u() |
219 | { | 223 | { |
220 | QStringList types; | 224 | QStringList types; |
221 | QMap<QString, QStringList> mimeTypes; | 225 | QMap<QString, QStringList> mimeTypes; |
222 | types << "audio/x-mpegurl"; | 226 | types << "audio/x-mpegurl"; |
223 | mimeTypes.insert("Playlists",types); | 227 | mimeTypes.insert("Playlists",types); |
224 | // mimeTypes.insert("All",types); | 228 | // mimeTypes.insert("All",types); |
225 | QString fileName= Opie::Ui::OFileDialog::getOpenFileName(Opie::Ui::OFileSelector::EXTENDED, | 229 | QString fileName= Opie::Ui::OFileDialog::getOpenFileName(Opie::Ui::OFileSelector::EXTENDED, |
226 | m_lastDir,"playlist.m3u", mimeTypes); | 230 | m_lastDir,"playlist.m3u", mimeTypes); |
227 | if (fileName.isEmpty()) { | 231 | if (fileName.isEmpty()) { |
228 | return; | 232 | return; |
229 | } | 233 | } |
230 | readPlayList(fileName); | 234 | readPlayList(fileName); |
231 | emit contentChanged(childCount()); | 235 | emit contentChanged(childCount()); |
232 | } | 236 | } |
233 | 237 | ||
234 | void PlaylistView::readPlayList(const QString&fileName) | 238 | void PlaylistView::readPlayList(const QString&fileName) |
235 | { | 239 | { |
236 | QFileInfo f(fileName); | 240 | QFileInfo f(fileName); |
237 | 241 | ||
238 | Om3u _om3u(fileName, IO_ReadOnly); | 242 | Om3u _om3u(fileName, IO_ReadOnly); |
239 | if (f.extension(FALSE).lower()=="m3u") { | 243 | if (f.extension(FALSE).lower()=="m3u") { |
240 | _om3u.readM3u(); | 244 | _om3u.readM3u(); |
241 | } else if (f.extension(FALSE).lower()=="pls") { | 245 | } else if (f.extension(FALSE).lower()=="pls") { |
242 | _om3u.readPls(); | 246 | _om3u.readPls(); |
243 | } | 247 | } |
244 | for (unsigned int j=0; j<_om3u.count();++j) { | 248 | for (unsigned int j=0; j<_om3u.count();++j) { |
245 | addFile(_om3u[j]); | 249 | addFile(_om3u[j]); |
246 | } | 250 | } |
247 | } | 251 | } |
248 | 252 | ||
249 | void PlaylistView::slotSaveAsM3u() | 253 | void PlaylistView::slotSaveAsM3u() |
250 | { | 254 | { |
251 | QStringList types; | 255 | QStringList types; |
252 | QMap<QString, QStringList> mimeTypes; | 256 | QMap<QString, QStringList> mimeTypes; |
253 | types << "audio/x-mpegurl"; | 257 | types << "audio/x-mpegurl"; |
254 | mimeTypes.insert("Playlists",types); | 258 | mimeTypes.insert("Playlists",types); |
255 | QString fileName= Opie::Ui::OFileDialog::getSaveFileName(Opie::Ui::OFileSelector::EXTENDED, | 259 | QString fileName= Opie::Ui::OFileDialog::getSaveFileName(Opie::Ui::OFileSelector::EXTENDED, |
256 | m_lastDir,"playlist.m3u", mimeTypes); | 260 | m_lastDir,"playlist.m3u", mimeTypes); |
257 | odebug << "Save as " << fileName << oendl; | 261 | odebug << "Save as " << fileName << oendl; |
258 | if (fileName.isEmpty()) { | 262 | if (fileName.isEmpty()) { |
259 | return; | 263 | return; |
260 | } | 264 | } |
261 | Om3u _om3u(fileName, IO_ReadWrite | IO_Truncate); | 265 | Om3u _om3u(fileName, IO_ReadWrite | IO_Truncate); |
262 | for (unsigned j=0; j<m_items.count();++j) { | 266 | for (unsigned j=0; j<m_items.count();++j) { |
263 | _om3u.add(m_items[j]->Lnk().file()); | 267 | _om3u.add(m_items[j]->Lnk().file()); |
264 | } | 268 | } |
265 | _om3u.write(); | 269 | _om3u.write(); |
266 | } | 270 | } |
diff --git a/noncore/multimedia/opieplayer3/videowidget.cpp b/noncore/multimedia/opieplayer3/videowidget.cpp index 833ecb4..414400b 100644 --- a/noncore/multimedia/opieplayer3/videowidget.cpp +++ b/noncore/multimedia/opieplayer3/videowidget.cpp | |||
@@ -1,100 +1,101 @@ | |||
1 | #include "videowidget.h" | 1 | #include "videowidget.h" |
2 | #include "../opieplayer2/lib.h" | 2 | #include "../opieplayer2/lib.h" |
3 | #include "../opieplayer2/threadutil.h" | 3 | #include "../opieplayer2/threadutil.h" |
4 | #include "../opieplayer2/xinevideowidget.h" | 4 | #include "../opieplayer2/xinevideowidget.h" |
5 | 5 | ||
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 | m_scaleUp = false; | 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 | 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&))); |
23 | connect(m_Videodisplay,SIGNAL(clicked()),this,SLOT(slotClicked())); | 23 | connect(m_Videodisplay,SIGNAL(clicked()),this,SLOT(slotClicked())); |
24 | } | 24 | } |
25 | 25 | ||
26 | VideoWidget::~VideoWidget() | 26 | VideoWidget::~VideoWidget() |
27 | { | 27 | { |
28 | } | 28 | } |
29 | 29 | ||
30 | void VideoWidget::slotClicked() | 30 | void VideoWidget::slotClicked() |
31 | { | 31 | { |
32 | emit videoclicked(); | 32 | emit videoclicked(); |
33 | } | 33 | } |
34 | 34 | ||
35 | void VideoWidget::closeEvent(QCloseEvent*e) | 35 | void VideoWidget::closeEvent(QCloseEvent*e) |
36 | { | 36 | { |
37 | } | 37 | } |
38 | 38 | ||
39 | void VideoWidget::fullScreen(bool /* how */) | 39 | void VideoWidget::fullScreen(bool /* how */) |
40 | { | 40 | { |
41 | } | 41 | } |
42 | 42 | ||
43 | int VideoWidget::playFile(const DocLnk&aLnk,XINE::Lib*aLib) | 43 | int VideoWidget::playFile(const DocLnk&aLnk,XINE::Lib*aLib) |
44 | { | 44 | { |
45 | m_current = aLnk; | 45 | m_current = aLnk; |
46 | bool recon; | 46 | bool recon; |
47 | if (m_xineLib != aLib) { | 47 | if (m_xineLib != aLib) { |
48 | if (m_xineLib) disconnect(m_xineLib); | 48 | if (m_xineLib) disconnect(m_xineLib); |
49 | m_xineLib = aLib; | 49 | m_xineLib = aLib; |
50 | if (aLib) m_xineLib->setWidget(m_Videodisplay); | 50 | if (aLib) m_xineLib->setWidget(m_Videodisplay); |
51 | } | 51 | } |
52 | if (!m_xineLib) { | 52 | if (!m_xineLib) { |
53 | return -1; | 53 | return -1; |
54 | } | 54 | } |
55 | connect(m_xineLib,SIGNAL(stopped()),this,SLOT(slotStopped())); | 55 | connect(m_xineLib,SIGNAL(stopped()),this,SLOT(slotStopped())); |
56 | m_xineLib->setWidget(m_Videodisplay); | 56 | m_xineLib->setWidget(m_Videodisplay); |
57 | m_xineLib->setShowVideo(true); | 57 | m_xineLib->setShowVideo(true); |
58 | int res = m_xineLib->play(m_current.file()); | 58 | int res = m_xineLib->play(m_current.file()); |
59 | vSize = m_xineLib->videoSize(); | 59 | vSize = m_xineLib->videoSize(); |
60 | |||
60 | slot_Videoresized(m_Videodisplay->size()); | 61 | slot_Videoresized(m_Videodisplay->size()); |
61 | odebug << "Xine play: " << res << oendl; | 62 | odebug << "Xine play: " << res << oendl; |
62 | if (res != 1) { | 63 | if (res != 1) { |
63 | return -2; | 64 | return -2; |
64 | } | 65 | } |
65 | return m_xineLib->length(); | 66 | return m_xineLib->length(); |
66 | } | 67 | } |
67 | 68 | ||
68 | void VideoWidget::stopPlaying() | 69 | void VideoWidget::stopPlaying() |
69 | { | 70 | { |
70 | if (m_xineLib) { | 71 | if (m_xineLib) { |
71 | m_xineLib->stop(); | 72 | m_xineLib->stop(); |
72 | } | 73 | } |
73 | } | 74 | } |
74 | 75 | ||
75 | void VideoWidget::slotStopped() | 76 | void VideoWidget::slotStopped() |
76 | { | 77 | { |
77 | } | 78 | } |
78 | 79 | ||
79 | void VideoWidget::slot_Videoresized(const QSize&s) | 80 | void VideoWidget::slot_Videoresized(const QSize&s) |
80 | { | 81 | { |
81 | if (m_xineLib) { | 82 | if (m_xineLib) { |
82 | if (vSize.width()<s.width()&&vSize.height()<s.height()&&!m_scaleUp) { | 83 | if (vSize.width()<s.width()&&vSize.height()<s.height()&&!m_scaleUp) { |
83 | m_xineLib->resize(vSize); | 84 | m_xineLib->resize(vSize); |
84 | } else { | 85 | } else { |
85 | m_xineLib->resize(s); | 86 | m_xineLib->resize(s); |
86 | } | 87 | } |
87 | } | 88 | } |
88 | } | 89 | } |
89 | 90 | ||
90 | void VideoWidget::scaleUp(bool how) | 91 | void VideoWidget::scaleUp(bool how) |
91 | { | 92 | { |
92 | if (how == m_scaleUp) return; | 93 | if (how == m_scaleUp) return; |
93 | m_scaleUp = how; | 94 | m_scaleUp = how; |
94 | slot_Videoresized(m_Videodisplay->size()); | 95 | slot_Videoresized(m_Videodisplay->size()); |
95 | m_Videodisplay->repaint(); | 96 | m_Videodisplay->repaint(); |
96 | } | 97 | } |
97 | 98 | ||
98 | void VideoWidget::updatePos(int /*val*/) | 99 | void VideoWidget::updatePos(int /*val*/) |
99 | { | 100 | { |
100 | } | 101 | } |