-rw-r--r-- | noncore/multimedia/opieplayer3/audiowidget.cpp | 110 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer3/audiowidget.h | 10 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer3/mwindow.cpp | 81 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer3/mwindow.h | 16 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer3/playlist.cpp | 40 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer3/playlist.h | 2 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer3/videowidget.cpp | 77 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer3/videowidget.h | 11 |
8 files changed, 152 insertions, 195 deletions
diff --git a/noncore/multimedia/opieplayer3/audiowidget.cpp b/noncore/multimedia/opieplayer3/audiowidget.cpp index b435c1b..aeebf45 100644 --- a/noncore/multimedia/opieplayer3/audiowidget.cpp +++ b/noncore/multimedia/opieplayer3/audiowidget.cpp | |||
@@ -18,14 +18,4 @@ AudioWidget::AudioWidget( QWidget * parent, const char * name, WFlags f) | |||
18 | m_MainLayout->setAutoAdd(true); | 18 | m_MainLayout->setAutoAdd(true); |
19 | m_InfoBox = new QTextView(this); | 19 | m_InfoBox = new QTextView(this); |
20 | #if 0 | ||
21 | m_PosSlider = new QSlider(QSlider::Horizontal,this); | ||
22 | m_PosSlider->setTickInterval(60); | ||
23 | connect(m_PosSlider,SIGNAL(valueChanged(int)),this,SLOT(slotNewPos(int))); | ||
24 | connect(m_PosSlider,SIGNAL(sliderMoved(int)),this,SLOT(slotNewPos(int))); | ||
25 | connect(m_PosSlider,SIGNAL(sliderPressed()),this,SLOT(sliderPressed())); | ||
26 | connect(m_PosSlider,SIGNAL(sliderReleased()),this,SLOT(sliderReleased())); | ||
27 | m_pressed = false; | ||
28 | m_uppos=0; | ||
29 | #endif | ||
30 | } | 20 | } |
31 | 21 | ||
@@ -34,36 +24,4 @@ AudioWidget::~AudioWidget() | |||
34 | } | 24 | } |
35 | 25 | ||
36 | void AudioWidget::slotNewPos(int /* pos*/) | ||
37 | { | ||
38 | if (!m_xineLib) return; | ||
39 | #if 0 | ||
40 | if (m_uppos==pos) return; | ||
41 | m_xineLib->seekTo(pos); | ||
42 | #endif | ||
43 | } | ||
44 | |||
45 | void AudioWidget::sliderPressed() | ||
46 | { | ||
47 | #if 0 | ||
48 | m_pressed = true; | ||
49 | #endif | ||
50 | } | ||
51 | |||
52 | void AudioWidget::sliderReleased() | ||
53 | { | ||
54 | #if 0 | ||
55 | m_pressed = false; | ||
56 | #endif | ||
57 | } | ||
58 | |||
59 | void AudioWidget::closeEvent(QCloseEvent*e) | ||
60 | { | ||
61 | odebug << "AudioWidget::closeEvent(QCloseEvent*e)" << oendl; | ||
62 | if (m_xineLib) { | ||
63 | m_xineLib->stop(); | ||
64 | } | ||
65 | QWidget::closeEvent(e); | ||
66 | } | ||
67 | |||
68 | int AudioWidget::playFile(const DocLnk&aLnk,XINE::Lib*aLib) | 26 | int AudioWidget::playFile(const DocLnk&aLnk,XINE::Lib*aLib) |
69 | { | 27 | { |
@@ -76,13 +34,12 @@ int AudioWidget::playFile(const DocLnk&aLnk,XINE::Lib*aLib) | |||
76 | return -1; | 34 | return -1; |
77 | } | 35 | } |
78 | #if 0 | 36 | int res = m_xineLib->play(m_current.file(),0,0); |
79 | m_uppos=0; | ||
80 | m_PosSlider->setValue(0); | ||
81 | #endif | ||
82 | m_xineLib->setShowVideo(false); | ||
83 | int res = m_xineLib->play(m_current.file()); | ||
84 | if (res != 1) { | 37 | if (res != 1) { |
85 | return -2; | 38 | return -2; |
86 | } | 39 | } |
40 | if (!m_xineLib->hasVideo()) { | ||
41 | m_xineLib->setShowVideo( false ); | ||
42 | } | ||
43 | |||
87 | // title | 44 | // title |
88 | QString title = m_xineLib->metaInfo(0); | 45 | QString title = m_xineLib->metaInfo(0); |
@@ -93,39 +50,37 @@ int AudioWidget::playFile(const DocLnk&aLnk,XINE::Lib*aLib) | |||
93 | 50 | ||
94 | int l = m_xineLib->length(); | 51 | int l = m_xineLib->length(); |
95 | int tmp = l; | 52 | QString laenge = secToString(l); |
96 | #if 0 | 53 | QString text = "<qt><center><table border=\"0\">"; |
97 | m_PosSlider->setRange(0,l); | ||
98 | #endif | ||
99 | QString laenge=""; | ||
100 | int h = l/3600; | ||
101 | l-=h*3600; | ||
102 | int m = l/60; | ||
103 | l-=m*60; | ||
104 | if (h>0) { | ||
105 | laenge+=QString("%1 h").arg(h); | ||
106 | } | ||
107 | if (m>0) { | ||
108 | if (!laenge.isEmpty()) laenge+=" "; | ||
109 | laenge+=QString("%1 m").arg(m); | ||
110 | } | ||
111 | if (l>0) { | ||
112 | if (!laenge.isEmpty()) laenge+=" "; | ||
113 | laenge+=QString("%1 s").arg(l); | ||
114 | } | ||
115 | QString text = "<qt>"; | ||
116 | if (artist.length()) { | 54 | if (artist.length()) { |
117 | text+="<H2><center>"+artist+"</center></h2>"; | 55 | text+="<tr><td>"+tr("Artist: ")+"</td><td><b>"+artist+"</b></td></tr>"; |
118 | } | 56 | } |
119 | if (title.length()) { | 57 | if (title.length()) { |
120 | text+="<H2><center>"+title+"</center></h2>"; | 58 | text+="<tr><td>"+tr("Title: ")+"</td><td><font size=\"+2\">"+title+"</font></td></tr>"; |
121 | } else { | 59 | } else { |
122 | text+="<H2><center>"+m_current.name()+"</center></h2>"; | 60 | text+="<tr><td>"+tr("Filename: ")+"</td><td><b>"+m_current.name()+"</b></td></tr>"; |
123 | } | 61 | } |
124 | if (album.length()) { | 62 | if (album.length()) { |
125 | text+="<H2><center>"+album+"</center></h2>"; | 63 | text+="<tr><td>"+tr("Album: ")+"</td><td><b>"+album+"</b></td></tr>"; |
126 | } | 64 | } |
127 | text+="<h3><center>"+laenge+"</center></h3>"; | 65 | text+="<tr><td>"+tr("Length: ")+"</td><td><b>"+laenge+"</b></td></tr>"; |
66 | text+="</table></center></qt>"; | ||
128 | m_InfoBox->setText(text); | 67 | m_InfoBox->setText(text); |
129 | return tmp; | 68 | return l; |
69 | } | ||
70 | |||
71 | QString AudioWidget::secToString(int sec) | ||
72 | { | ||
73 | int l = sec; | ||
74 | int h = l/3600; | ||
75 | l-=h*3600; | ||
76 | int m = l/60; | ||
77 | l-=m*60; | ||
78 | QString s = ""; | ||
79 | if (h>0) { | ||
80 | s.sprintf("%2i:%2i:%2i",h,m,l); | ||
81 | } else { | ||
82 | s.sprintf("%02i:%02i",m,l); | ||
83 | } | ||
84 | return s; | ||
130 | } | 85 | } |
131 | 86 | ||
@@ -139,8 +94,3 @@ void AudioWidget::stopPlaying() | |||
139 | void AudioWidget::updatePos(int /* val */) | 94 | void AudioWidget::updatePos(int /* val */) |
140 | { | 95 | { |
141 | #if 0 | ||
142 | if (m_pressed) return; | ||
143 | m_uppos = val; | ||
144 | m_PosSlider->setValue(val); | ||
145 | #endif | ||
146 | } | 96 | } |
diff --git a/noncore/multimedia/opieplayer3/audiowidget.h b/noncore/multimedia/opieplayer3/audiowidget.h index 5e5dc09..abdd781 100644 --- a/noncore/multimedia/opieplayer3/audiowidget.h +++ b/noncore/multimedia/opieplayer3/audiowidget.h | |||
@@ -33,15 +33,7 @@ protected: | |||
33 | QVBoxLayout*m_MainLayout; | 33 | QVBoxLayout*m_MainLayout; |
34 | QTextView*m_InfoBox; | 34 | QTextView*m_InfoBox; |
35 | #if 0 | ||
36 | QSlider*m_PosSlider; | ||
37 | bool m_pressed; | ||
38 | int m_uppos; | ||
39 | #endif | ||
40 | 35 | ||
36 | static QString secToString(int sec); | ||
41 | protected slots: | 37 | protected slots: |
42 | virtual void closeEvent(QCloseEvent*e); | ||
43 | virtual void slotNewPos(int pos); | ||
44 | virtual void sliderPressed(); | ||
45 | virtual void sliderReleased(); | ||
46 | }; | 38 | }; |
47 | 39 | ||
diff --git a/noncore/multimedia/opieplayer3/mwindow.cpp b/noncore/multimedia/opieplayer3/mwindow.cpp index 57418f0..75d1490 100644 --- a/noncore/multimedia/opieplayer3/mwindow.cpp +++ b/noncore/multimedia/opieplayer3/mwindow.cpp | |||
@@ -61,4 +61,5 @@ PMainWindow::PMainWindow(QWidget*w, const char*name, WFlags f) | |||
61 | : QMainWindow(w,name,f) | 61 | : QMainWindow(w,name,f) |
62 | { | 62 | { |
63 | checkLib(); | ||
63 | setCaption( QObject::tr("Opie Mediaplayer 3" ) ); | 64 | setCaption( QObject::tr("Opie Mediaplayer 3" ) ); |
64 | 65 | ||
@@ -70,7 +71,7 @@ PMainWindow::PMainWindow(QWidget*w, const char*name, WFlags f) | |||
70 | m_stack->forceMode(Opie::Ui::OWidgetStack::SmallScreen); | 71 | m_stack->forceMode(Opie::Ui::OWidgetStack::SmallScreen); |
71 | m_l->addWidget(m_stack); | 72 | m_l->addWidget(m_stack); |
72 | m_scrollBar = new QSlider(QSlider::Horizontal,m_MainBox); | 73 | m_PosSlider = new QSlider(QSlider::Horizontal,m_MainBox); |
73 | m_l->addWidget(m_scrollBar); | 74 | m_l->addWidget(m_PosSlider); |
74 | m_scrollBar->setEnabled(false); | 75 | m_PosSlider->setEnabled(false); |
75 | 76 | ||
76 | m_playList = new PlaylistView(m_stack,"playlist"); | 77 | m_playList = new PlaylistView(m_stack,"playlist"); |
@@ -88,6 +89,12 @@ PMainWindow::PMainWindow(QWidget*w, const char*name, WFlags f) | |||
88 | connect(m_VideoPlayer,SIGNAL(videoclicked()),this,SLOT(slotVideoclicked())); | 89 | connect(m_VideoPlayer,SIGNAL(videoclicked()),this,SLOT(slotVideoclicked())); |
89 | 90 | ||
91 | 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(sliderPressed()),this,SLOT(sliderPressed())); | ||
94 | connect(m_PosSlider,SIGNAL(sliderReleased()),this,SLOT(sliderReleased())); | ||
95 | m_pressed = false; | ||
96 | m_uppos=0; | ||
97 | |||
90 | m_stack->raiseWidget(stack_list); | 98 | m_stack->raiseWidget(stack_list); |
91 | m_PlayLib = 0; | ||
92 | m_LastItem = 0; | 99 | m_LastItem = 0; |
93 | setupActions(); | 100 | setupActions(); |
@@ -100,4 +107,5 @@ PMainWindow::PMainWindow(QWidget*w, const char*name, WFlags f) | |||
100 | void PMainWindow::slotListChanged(int count) | 107 | void PMainWindow::slotListChanged(int count) |
101 | { | 108 | { |
109 | playersGroup->setEnabled(count>0); | ||
102 | if (!m_playList->isVisible()) { | 110 | if (!m_playList->isVisible()) { |
103 | return; | 111 | return; |
@@ -118,6 +126,7 @@ void PMainWindow::checkLib() | |||
118 | { | 126 | { |
119 | if (m_PlayLib == 0) { | 127 | if (m_PlayLib == 0) { |
120 | m_PlayLib = new XINE::Lib(XINE::Lib::InitializeImmediately); | 128 | m_PlayLib = new XINE::Lib(XINE::Lib::InitializeInThread); |
121 | m_PlayLib->ensureInitialized(); | 129 | qApp->processEvents(); |
130 | // m_PlayLib->ensureInitialized(); | ||
122 | connect(m_PlayLib,SIGNAL(stopped()),this,SLOT(slotStopped())); | 131 | connect(m_PlayLib,SIGNAL(stopped()),this,SLOT(slotStopped())); |
123 | } | 132 | } |
@@ -200,5 +209,5 @@ void PMainWindow::slotUserStop() | |||
200 | m_playing = false; | 209 | m_playing = false; |
201 | m_PlayLib->stop(); | 210 | m_PlayLib->stop(); |
202 | m_scrollBar->setEnabled(false); | 211 | m_PosSlider->setEnabled(false); |
203 | hideVideo(); | 212 | hideVideo(); |
204 | slotShowList(); | 213 | slotShowList(); |
@@ -232,5 +241,5 @@ void PMainWindow::slotPlayCurrent() | |||
232 | if (!m_LastItem) { | 241 | if (!m_LastItem) { |
233 | if (m_PlayLib) m_PlayLib->stop(); | 242 | if (m_PlayLib) m_PlayLib->stop(); |
234 | m_scrollBar->setEnabled(false); | 243 | m_PosSlider->setEnabled(false); |
235 | a_playAction->setOn(false); | 244 | a_playAction->setOn(false); |
236 | hideVideo(); | 245 | hideVideo(); |
@@ -238,8 +247,8 @@ void PMainWindow::slotPlayCurrent() | |||
238 | return; | 247 | return; |
239 | } | 248 | } |
240 | checkLib(); | ||
241 | m_CurrentPos = 0; | 249 | m_CurrentPos = 0; |
242 | m_playList->setCurrentItem(m_LastItem); | 250 | m_playList->setCurrentItem(m_LastItem); |
243 | odebug << "Pos: " << m_PlayLib->currentTime() << oendl; | 251 | m_uppos = 0; |
252 | m_PosSlider->setValue(0); | ||
244 | int result = 0; | 253 | int result = 0; |
245 | if (!m_LastItem->isVideo()) { | 254 | if (!m_LastItem->isVideo()) { |
@@ -259,7 +268,7 @@ void PMainWindow::slotPlayCurrent() | |||
259 | mediaWindowraised(); | 268 | mediaWindowraised(); |
260 | odebug << "Range: " << result << oendl; | 269 | odebug << "Range: " << result << oendl; |
261 | m_scrollBar->setRange(0,result); | 270 | m_PosSlider->setEnabled(true); |
262 | m_scrollBar->setValue(0); | 271 | m_PosSlider->setRange(0,m_PlayLib->length()); |
263 | m_scrollBar->setEnabled(true); | 272 | m_PosSlider->setValue(m_PlayLib->currentTime()); |
264 | QTimer::singleShot( 500, this, SLOT( slotCheckPos() ) ); | 273 | QTimer::singleShot( 500, this, SLOT( slotCheckPos() ) ); |
265 | } | 274 | } |
@@ -290,4 +299,5 @@ void PMainWindow::slotStopped() | |||
290 | { | 299 | { |
291 | if (!m_playing) return; | 300 | if (!m_playing) return; |
301 | odebug << "Slot stopped" << oendl; | ||
292 | m_playing = false; | 302 | m_playing = false; |
293 | slotGoNext(); | 303 | slotGoNext(); |
@@ -297,6 +307,9 @@ void PMainWindow::slotCheckPos() | |||
297 | { | 307 | { |
298 | if (!m_playing) return; | 308 | if (!m_playing) return; |
299 | //emit sigPos(m_PlayLib->currentTime()); | 309 | if (!m_pressed) { |
300 | m_scrollBar->setValue(m_PlayLib->currentTime()); | 310 | m_uppos = m_PlayLib->currentTime(); |
311 | emit sigPos(m_uppos); | ||
312 | m_PosSlider->setValue(m_PlayLib->currentTime()); | ||
313 | } | ||
301 | QTimer::singleShot( 1000, this, SLOT( slotCheckPos() ) ); | 314 | QTimer::singleShot( 1000, this, SLOT( slotCheckPos() ) ); |
302 | } | 315 | } |
@@ -316,7 +329,7 @@ void PMainWindow::setupActions() | |||
316 | a_addDir = new QAction(tr("Add directory"),Resource::loadIconSet("folder_open"),0,0,this,0,false); | 329 | a_addDir = new QAction(tr("Add directory"),Resource::loadIconSet("folder_open"),0,0,this,0,false); |
317 | connect(a_addDir,SIGNAL(activated()),m_playList,SLOT(slotAppendDir())); | 330 | connect(a_addDir,SIGNAL(activated()),m_playList,SLOT(slotAppendDir())); |
318 | a_loadPlaylist = new QAction(tr("Append .m3u playlist"),Resource::loadIconSet("opieplayer2/add_to_playlist"),0,0,this,0,false); | 331 | a_loadPlaylist = new QAction(tr("Append playlist"),Resource::loadIconSet("opieplayer2/add_to_playlist"),0,0,this,0,false); |
319 | connect(a_loadPlaylist,SIGNAL(activated()),m_playList,SLOT(slotOpenM3u())); | 332 | connect(a_loadPlaylist,SIGNAL(activated()),m_playList,SLOT(slotOpenM3u())); |
320 | a_savePlaylist = new QAction(tr("Save .m3u playlist"),Resource::loadIconSet("save"),0,0,this,0,false); | 333 | a_savePlaylist = new QAction(tr("Save playlist"),Resource::loadIconSet("save"),0,0,this,0,false); |
321 | connect(a_savePlaylist,SIGNAL(activated()),m_playList,SLOT(slotSaveAsM3u())); | 334 | connect(a_savePlaylist,SIGNAL(activated()),m_playList,SLOT(slotSaveAsM3u())); |
322 | 335 | ||
@@ -352,8 +365,16 @@ void PMainWindow::setupActions() | |||
352 | playersGroup->insert(a_playNext); | 365 | playersGroup->insert(a_playNext); |
353 | 366 | ||
367 | |||
354 | /* initial states of actions */ | 368 | /* initial states of actions */ |
355 | a_showPlaylist->setEnabled(false); | 369 | a_showPlaylist->setEnabled(false); |
356 | a_removeFiles->setEnabled(false); | 370 | a_removeFiles->setEnabled(false); |
357 | a_ShowMedia->setEnabled(false); | 371 | a_ShowMedia->setEnabled(false); |
372 | playersGroup->setEnabled(false); | ||
373 | |||
374 | settingsGroup = new QActionGroup(this,"configgroup",false); | ||
375 | |||
376 | 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))); | ||
378 | settingsGroup->insert(a_Scaleup); | ||
358 | } | 379 | } |
359 | 380 | ||
@@ -428,5 +449,29 @@ void PMainWindow::setupMenu() | |||
428 | playMenu = new QPopupMenu(m_menuBar); | 449 | playMenu = new QPopupMenu(m_menuBar); |
429 | m_menuBar->insertItem(tr("Playing"),playMenu); | 450 | m_menuBar->insertItem(tr("Playing"),playMenu); |
430 | |||
431 | playersGroup->addTo(playMenu); | 451 | playersGroup->addTo(playMenu); |
452 | configMenu = new QPopupMenu(m_menuBar); | ||
453 | m_menuBar->insertItem(tr("Config"),configMenu); | ||
454 | settingsGroup->addTo(configMenu); | ||
455 | } | ||
456 | |||
457 | void PMainWindow::slotNewPos(int pos) | ||
458 | { | ||
459 | if (!m_PlayLib) return; | ||
460 | if (m_uppos==pos) return; | ||
461 | m_PlayLib->seekTo(pos); | ||
462 | } | ||
463 | |||
464 | void PMainWindow::sliderPressed() | ||
465 | { | ||
466 | m_pressed = true; | ||
467 | } | ||
468 | |||
469 | void PMainWindow::sliderReleased() | ||
470 | { | ||
471 | m_pressed = false; | ||
472 | } | ||
473 | |||
474 | void PMainWindow::slot_scaleupToggled(bool how) | ||
475 | { | ||
476 | m_VideoPlayer->scaleUp(how); | ||
432 | } | 477 | } |
diff --git a/noncore/multimedia/opieplayer3/mwindow.h b/noncore/multimedia/opieplayer3/mwindow.h index 10c7a29..5d011d5 100644 --- a/noncore/multimedia/opieplayer3/mwindow.h +++ b/noncore/multimedia/opieplayer3/mwindow.h | |||
@@ -83,12 +83,13 @@ protected: | |||
83 | VideoWidget*m_VideoPlayer; | 83 | VideoWidget*m_VideoPlayer; |
84 | QWidget*m_MainBox; | 84 | QWidget*m_MainBox; |
85 | QSlider*m_scrollBar; | 85 | QSlider*m_PosSlider; |
86 | 86 | ||
87 | QAction*a_appendFiles,*a_removeFiles,*a_showPlaylist,*a_playAction,*a_stopAction; | 87 | QAction*a_appendFiles,*a_removeFiles,*a_showPlaylist,*a_playAction,*a_stopAction; |
88 | QAction*a_playNext,*a_playPrevious,*a_ShowFull,*a_stopPlay,*a_ShowMedia; | 88 | QAction*a_playNext,*a_playPrevious,*a_ShowFull,*a_stopPlay,*a_ShowMedia; |
89 | QAction*a_addDir,*a_loadPlaylist,*a_savePlaylist; | 89 | QAction*a_addDir,*a_loadPlaylist,*a_savePlaylist; |
90 | QActionGroup*playersGroup,*playlistOnly; | 90 | QAction*a_Scaleup; |
91 | QActionGroup*playersGroup,*playlistOnly,*settingsGroup; | ||
91 | QToolBar*m_toolBar; | 92 | QToolBar*m_toolBar; |
92 | QPopupMenu *fileMenu,*dispMenu,*playMenu; | 93 | QPopupMenu *fileMenu,*dispMenu,*playMenu,*configMenu; |
93 | QMenuBar*m_menuBar; | 94 | QMenuBar*m_menuBar; |
94 | XINE::Lib*m_PlayLib; | 95 | XINE::Lib*m_PlayLib; |
@@ -100,6 +101,8 @@ protected: | |||
100 | void setupVideo(bool full); | 101 | void setupVideo(bool full); |
101 | void hideVideo(); | 102 | void hideVideo(); |
102 | |||
103 | bool m_playing:1; | 103 | bool m_playing:1; |
104 | bool m_pressed:1; | ||
105 | int m_uppos; | ||
106 | |||
104 | int m_CurrentPos; | 107 | int m_CurrentPos; |
105 | PlaylistItem*m_LastItem; | 108 | PlaylistItem*m_LastItem; |
@@ -123,4 +126,9 @@ protected slots: | |||
123 | virtual void slotShowMediaWindow(); | 126 | virtual void slotShowMediaWindow(); |
124 | virtual void slotListChanged(int); | 127 | virtual void slotListChanged(int); |
128 | virtual void slotNewPos(int pos); | ||
129 | virtual void sliderPressed(); | ||
130 | virtual void sliderReleased(); | ||
131 | virtual void slot_scaleupToggled(bool); | ||
132 | |||
125 | 133 | ||
126 | signals: | 134 | signals: |
diff --git a/noncore/multimedia/opieplayer3/playlist.cpp b/noncore/multimedia/opieplayer3/playlist.cpp index babe8ce..2eb40e3 100644 --- a/noncore/multimedia/opieplayer3/playlist.cpp +++ b/noncore/multimedia/opieplayer3/playlist.cpp | |||
@@ -105,11 +105,22 @@ void PlaylistView::checkLib() | |||
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 | m_Infolib->ensureInitialized(); | 108 | m_Infolib->ensureInitialized(); |
108 | } | 109 | } |
109 | } | 110 | } |
110 | 111 | ||
112 | void PlaylistView::slotDummyStop() | ||
113 | { | ||
114 | odebug << "void PlaylistView::slotDummyStop()" << oendl; | ||
115 | } | ||
116 | |||
111 | void PlaylistView::slotAddFile(const DocLnk&aLink) | 117 | void PlaylistView::slotAddFile(const DocLnk&aLink) |
112 | { | 118 | { |
113 | addFile(aLink.file(),aLink.name()); | 119 | QFileInfo f(aLink.file()); |
120 | if (f.extension(FALSE).lower()=="m3u"||f.extension(FALSE).lower()=="pls") { | ||
121 | readPlayList(aLink.file()); | ||
122 | } else { | ||
123 | addFile(aLink.file(),aLink.name()); | ||
124 | } | ||
114 | emit contentChanged(childCount()); | 125 | emit contentChanged(childCount()); |
115 | } | 126 | } |
@@ -120,6 +131,4 @@ void PlaylistView::addFile(const QString&aFile,const QString&aName) | |||
120 | if (!fileInfo.exists()) return; | 131 | if (!fileInfo.exists()) return; |
121 | checkLib(); | 132 | checkLib(); |
122 | m_Infolib->stop(); | ||
123 | |||
124 | QString name = aName; | 133 | QString name = aName; |
125 | if (name.isEmpty()) { | 134 | if (name.isEmpty()) { |
@@ -127,4 +136,6 @@ void PlaylistView::addFile(const QString&aFile,const QString&aName) | |||
127 | } | 136 | } |
128 | 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 */ | ||
139 | m_Infolib->stop(); | ||
129 | odebug << "File set: " << i << " ("<<aFile.utf8().data()<<")"<<oendl; | 140 | odebug << "File set: " << i << " ("<<aFile.utf8().data()<<")"<<oendl; |
130 | if (i<1) { | 141 | if (i<1) { |
@@ -181,13 +192,7 @@ void PlaylistView::addFile(const QString&aFile,const QString&aName) | |||
181 | codec = ""; | 192 | codec = ""; |
182 | if (h>0) { | 193 | if (h>0) { |
183 | codec+=QString("%1 h").arg(h); | 194 | codec.sprintf("%2i:%2i:%2i h",h,m,l); |
184 | } | 195 | } else { |
185 | if (m>0) { | 196 | codec.sprintf("%02i:%02i m",m,l); |
186 | if (!codec.isEmpty()) codec+=" "; | ||
187 | codec+=QString("%1 m").arg(m); | ||
188 | } | ||
189 | if (l>0) { | ||
190 | if (!codec.isEmpty()) codec+=" "; | ||
191 | codec+=QString("%1 s").arg(l); | ||
192 | } | 197 | } |
193 | // time | 198 | // time |
@@ -217,5 +222,5 @@ void PlaylistView::slotOpenM3u() | |||
217 | types << "audio/x-mpegurl"; | 222 | types << "audio/x-mpegurl"; |
218 | mimeTypes.insert("Playlists",types); | 223 | mimeTypes.insert("Playlists",types); |
219 | mimeTypes.insert("All",types); | 224 | // mimeTypes.insert("All",types); |
220 | QString fileName= Opie::Ui::OFileDialog::getOpenFileName(Opie::Ui::OFileSelector::EXTENDED, | 225 | QString fileName= Opie::Ui::OFileDialog::getOpenFileName(Opie::Ui::OFileSelector::EXTENDED, |
221 | m_lastDir,"playlist.m3u", mimeTypes); | 226 | m_lastDir,"playlist.m3u", mimeTypes); |
@@ -223,4 +228,10 @@ void PlaylistView::slotOpenM3u() | |||
223 | return; | 228 | return; |
224 | } | 229 | } |
230 | readPlayList(fileName); | ||
231 | emit contentChanged(childCount()); | ||
232 | } | ||
233 | |||
234 | void PlaylistView::readPlayList(const QString&fileName) | ||
235 | { | ||
225 | QFileInfo f(fileName); | 236 | QFileInfo f(fileName); |
226 | 237 | ||
@@ -234,5 +245,4 @@ void PlaylistView::slotOpenM3u() | |||
234 | addFile(_om3u[j]); | 245 | addFile(_om3u[j]); |
235 | } | 246 | } |
236 | emit contentChanged(childCount()); | ||
237 | } | 247 | } |
238 | 248 | ||
@@ -243,7 +253,7 @@ void PlaylistView::slotSaveAsM3u() | |||
243 | types << "audio/x-mpegurl"; | 253 | types << "audio/x-mpegurl"; |
244 | mimeTypes.insert("Playlists",types); | 254 | mimeTypes.insert("Playlists",types); |
245 | mimeTypes.insert("All",types); | ||
246 | QString fileName= Opie::Ui::OFileDialog::getSaveFileName(Opie::Ui::OFileSelector::EXTENDED, | 255 | QString fileName= Opie::Ui::OFileDialog::getSaveFileName(Opie::Ui::OFileSelector::EXTENDED, |
247 | m_lastDir,"playlist.m3u", mimeTypes); | 256 | m_lastDir,"playlist.m3u", mimeTypes); |
257 | odebug << "Save as " << fileName << oendl; | ||
248 | if (fileName.isEmpty()) { | 258 | if (fileName.isEmpty()) { |
249 | return; | 259 | return; |
diff --git a/noncore/multimedia/opieplayer3/playlist.h b/noncore/multimedia/opieplayer3/playlist.h index 4a9268c..3c9a68d 100644 --- a/noncore/multimedia/opieplayer3/playlist.h +++ b/noncore/multimedia/opieplayer3/playlist.h | |||
@@ -96,7 +96,9 @@ public slots: | |||
96 | virtual void slotOpenM3u(); | 96 | virtual void slotOpenM3u(); |
97 | virtual void slotSaveAsM3u(); | 97 | virtual void slotSaveAsM3u(); |
98 | virtual void slotDummyStop(); | ||
98 | 99 | ||
99 | protected: | 100 | protected: |
100 | void checkLib(); | 101 | void checkLib(); |
102 | void readPlayList(const QString&); | ||
101 | QStringList columnLabels; | 103 | QStringList columnLabels; |
102 | XINE::Lib*m_Infolib; | 104 | XINE::Lib*m_Infolib; |
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 | |||
@@ -16,22 +16,10 @@ VideoWidget::VideoWidget( QWidget * parent, const char * name, WFlags 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 | ||
@@ -42,5 +30,4 @@ VideoWidget::~VideoWidget() | |||
42 | void VideoWidget::slotClicked() | 30 | void VideoWidget::slotClicked() |
43 | { | 31 | { |
44 | odebug << "clicked " << oendl; | ||
45 | emit videoclicked(); | 32 | emit videoclicked(); |
46 | } | 33 | } |
@@ -50,36 +37,6 @@ void VideoWidget::closeEvent(QCloseEvent*e) | |||
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 | ||
@@ -97,12 +54,9 @@ int VideoWidget::playFile(const DocLnk&aLnk,XINE::Lib*aLib) | |||
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) { |
@@ -110,8 +64,4 @@ int VideoWidget::playFile(const DocLnk&aLnk,XINE::Lib*aLib) | |||
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 | ||
@@ -125,21 +75,26 @@ void VideoWidget::stopPlaying() | |||
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 | } |
diff --git a/noncore/multimedia/opieplayer3/videowidget.h b/noncore/multimedia/opieplayer3/videowidget.h index 935a648..e082407 100644 --- a/noncore/multimedia/opieplayer3/videowidget.h +++ b/noncore/multimedia/opieplayer3/videowidget.h | |||
@@ -23,4 +23,5 @@ public: | |||
23 | int playFile(const DocLnk&,XINE::Lib*); | 23 | int playFile(const DocLnk&,XINE::Lib*); |
24 | void fullScreen(bool how); | 24 | void fullScreen(bool how); |
25 | void scaleUp(bool how); | ||
25 | 26 | ||
26 | signals: | 27 | signals: |
@@ -37,15 +38,9 @@ protected: | |||
37 | XineVideoWidget*m_Videodisplay; | 38 | XineVideoWidget*m_Videodisplay; |
38 | QWidget * m_holder; | 39 | QWidget * m_holder; |
39 | #if 0 | 40 | QSize vSize; |
40 | QSlider*m_PosSlider; | 41 | bool m_scaleUp:1; |
41 | bool m_pressed:1; | ||
42 | int m_uppos; | ||
43 | #endif | ||
44 | 42 | ||
45 | protected slots: | 43 | protected slots: |
46 | virtual void closeEvent(QCloseEvent*e); | 44 | virtual void closeEvent(QCloseEvent*e); |
47 | virtual void slotNewPos(int pos); | ||
48 | virtual void sliderPressed(); | ||
49 | virtual void sliderReleased(); | ||
50 | virtual void slot_Videoresized(const QSize&); | 45 | virtual void slot_Videoresized(const QSize&); |
51 | virtual void slotStopped(); | 46 | virtual void slotStopped(); |