Diffstat (limited to 'noncore/multimedia/opieplayer3/mwindow.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/multimedia/opieplayer3/mwindow.cpp | 9 |
1 files changed, 7 insertions, 2 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 | |||
@@ -34,43 +34,44 @@ | |||
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 | ||
@@ -202,24 +203,25 @@ void PMainWindow::slotPlayList() | |||
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(); |
@@ -235,46 +237,48 @@ void PMainWindow::hideVideo() | |||
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; |
@@ -302,25 +306,26 @@ void PMainWindow::slotStopped() | |||
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 | { |