summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer3/audiowidget.cpp33
-rw-r--r--noncore/multimedia/opieplayer3/audiowidget.h4
-rw-r--r--noncore/multimedia/opieplayer3/mwindow.cpp180
-rw-r--r--noncore/multimedia/opieplayer3/mwindow.h16
-rw-r--r--noncore/multimedia/opieplayer3/opieplayer3.pro4
-rw-r--r--noncore/multimedia/opieplayer3/playlist.cpp131
-rw-r--r--noncore/multimedia/opieplayer3/playlist.h8
-rw-r--r--noncore/multimedia/opieplayer3/videowidget.cpp39
-rw-r--r--noncore/multimedia/opieplayer3/videowidget.h4
9 files changed, 353 insertions, 66 deletions
diff --git a/noncore/multimedia/opieplayer3/audiowidget.cpp b/noncore/multimedia/opieplayer3/audiowidget.cpp
index 7ba6274..b435c1b 100644
--- a/noncore/multimedia/opieplayer3/audiowidget.cpp
+++ b/noncore/multimedia/opieplayer3/audiowidget.cpp
@@ -19,2 +19,3 @@ AudioWidget::AudioWidget( QWidget * parent, const char * name, WFlags f)
19 m_InfoBox = new QTextView(this); 19 m_InfoBox = new QTextView(this);
20#if 0
20 m_PosSlider = new QSlider(QSlider::Horizontal,this); 21 m_PosSlider = new QSlider(QSlider::Horizontal,this);
@@ -27,2 +28,3 @@ AudioWidget::AudioWidget( QWidget * parent, const char * name, WFlags f)
27 m_uppos=0; 28 m_uppos=0;
29#endif
28} 30}
@@ -33,7 +35,9 @@ AudioWidget::~AudioWidget()
33 35
34void AudioWidget::slotNewPos(int pos) 36void AudioWidget::slotNewPos(int /* pos*/)
35{ 37{
36 if (!m_xineLib) return; 38 if (!m_xineLib) return;
39#if 0
37 if (m_uppos==pos) return; 40 if (m_uppos==pos) return;
38 m_xineLib->seekTo(pos); 41 m_xineLib->seekTo(pos);
42#endif
39} 43}
@@ -42,3 +46,5 @@ void AudioWidget::sliderPressed()
42{ 46{
47#if 0
43 m_pressed = true; 48 m_pressed = true;
49#endif
44} 50}
@@ -47,3 +53,5 @@ void AudioWidget::sliderReleased()
47{ 53{
54#if 0
48 m_pressed = false; 55 m_pressed = false;
56#endif
49} 57}
@@ -59,3 +67,3 @@ void AudioWidget::closeEvent(QCloseEvent*e)
59 67
60void AudioWidget::playFile(const DocLnk&aLnk,XINE::Lib*aLib) 68int AudioWidget::playFile(const DocLnk&aLnk,XINE::Lib*aLib)
61{ 69{
@@ -63,3 +71,3 @@ void AudioWidget::playFile(const DocLnk&aLnk,XINE::Lib*aLib)
63 if (m_xineLib != aLib) { 71 if (m_xineLib != aLib) {
64 disconnect(m_xineLib); 72 if (m_xineLib) disconnect(m_xineLib);
65 m_xineLib = aLib; 73 m_xineLib = aLib;
@@ -67,8 +75,13 @@ void AudioWidget::playFile(const DocLnk&aLnk,XINE::Lib*aLib)
67 if (!m_xineLib) { 75 if (!m_xineLib) {
68 return; 76 return -1;
69 } 77 }
78#if 0
70 m_uppos=0; 79 m_uppos=0;
71 m_PosSlider->setValue(0); 80 m_PosSlider->setValue(0);
81#endif
72 m_xineLib->setShowVideo(false); 82 m_xineLib->setShowVideo(false);
73 m_xineLib->play(m_current.file()); 83 int res = m_xineLib->play(m_current.file());
84 if (res != 1) {
85 return -2;
86 }
74 // title 87 // title
@@ -81,3 +94,6 @@ void AudioWidget::playFile(const DocLnk&aLnk,XINE::Lib*aLib)
81 int l = m_xineLib->length(); 94 int l = m_xineLib->length();
95 int tmp = l;
96#if 0
82 m_PosSlider->setRange(0,l); 97 m_PosSlider->setRange(0,l);
98#endif
83 QString laenge=""; 99 QString laenge="";
@@ -104,2 +120,4 @@ void AudioWidget::playFile(const DocLnk&aLnk,XINE::Lib*aLib)
104 text+="<H2><center>"+title+"</center></h2>"; 120 text+="<H2><center>"+title+"</center></h2>";
121 } else {
122 text+="<H2><center>"+m_current.name()+"</center></h2>";
105 } 123 }
@@ -110,2 +128,3 @@ void AudioWidget::playFile(const DocLnk&aLnk,XINE::Lib*aLib)
110 m_InfoBox->setText(text); 128 m_InfoBox->setText(text);
129 return tmp;
111} 130}
@@ -119,4 +138,5 @@ void AudioWidget::stopPlaying()
119 138
120void AudioWidget::updatePos(int val) 139void AudioWidget::updatePos(int /* val */)
121{ 140{
141#if 0
122 if (m_pressed) return; 142 if (m_pressed) return;
@@ -124,2 +144,3 @@ void AudioWidget::updatePos(int val)
124 m_PosSlider->setValue(val); 144 m_PosSlider->setValue(val);
145#endif
125} 146}
diff --git a/noncore/multimedia/opieplayer3/audiowidget.h b/noncore/multimedia/opieplayer3/audiowidget.h
index 07b51b6..5e5dc09 100644
--- a/noncore/multimedia/opieplayer3/audiowidget.h
+++ b/noncore/multimedia/opieplayer3/audiowidget.h
@@ -23,3 +23,3 @@ public:
23 23
24 void playFile(const DocLnk&,XINE::Lib*); 24 int playFile(const DocLnk&,XINE::Lib*);
25 25
@@ -34,2 +34,3 @@ protected:
34 QTextView*m_InfoBox; 34 QTextView*m_InfoBox;
35#if 0
35 QSlider*m_PosSlider; 36 QSlider*m_PosSlider;
@@ -37,2 +38,3 @@ protected:
37 int m_uppos; 38 int m_uppos;
39#endif
38 40
diff --git a/noncore/multimedia/opieplayer3/mwindow.cpp b/noncore/multimedia/opieplayer3/mwindow.cpp
index dab910a..57418f0 100644
--- a/noncore/multimedia/opieplayer3/mwindow.cpp
+++ b/noncore/multimedia/opieplayer3/mwindow.cpp
@@ -52,2 +52,4 @@
52#include <qtimer.h> 52#include <qtimer.h>
53#include <qslider.h>
54#include <qlayout.h>
53 55
@@ -61,12 +63,17 @@ PMainWindow::PMainWindow(QWidget*w, const char*name, WFlags f)
61 setCaption( QObject::tr("Opie Mediaplayer 3" ) ); 63 setCaption( QObject::tr("Opie Mediaplayer 3" ) );
62 setupActions();
63 setupToolBar();
64 setupMenu();
65 64
66 m_stack = new OWidgetStack(this); 65 m_MainBox = new QWidget(this);
66
67 QVBoxLayout*m_l = new QVBoxLayout(m_MainBox);
68
69 m_stack = new OWidgetStack(m_MainBox);
67 m_stack->forceMode(Opie::Ui::OWidgetStack::SmallScreen); 70 m_stack->forceMode(Opie::Ui::OWidgetStack::SmallScreen);
68 setCentralWidget(m_stack ); 71 m_l->addWidget(m_stack);
72 m_scrollBar = new QSlider(QSlider::Horizontal,m_MainBox);
73 m_l->addWidget(m_scrollBar);
74 m_scrollBar->setEnabled(false);
75
69 m_playList = new PlaylistView(m_stack,"playlist"); 76 m_playList = new PlaylistView(m_stack,"playlist");
70 m_stack->addWidget(m_playList,stack_list); 77 m_stack->addWidget(m_playList,stack_list);
71 78 connect(m_playList,SIGNAL(contentChanged(int)),this,SLOT(slotListChanged(int)));
72 m_sfl = new OFileSelector("video/*;audio/*",m_stack); 79 m_sfl = new OFileSelector("video/*;audio/*",m_stack);
@@ -85,2 +92,24 @@ PMainWindow::PMainWindow(QWidget*w, const char*name, WFlags f)
85 m_LastItem = 0; 92 m_LastItem = 0;
93 setupActions();
94 setupToolBar();
95 setupMenu();
96
97 setCentralWidget(m_MainBox );
98}
99
100void PMainWindow::slotListChanged(int count)
101{
102 if (!m_playList->isVisible()) {
103 return;
104 }
105 a_removeFiles->setEnabled(count>0);
106}
107
108void PMainWindow::mediaWindowraised()
109{
110 playlistOnly->setEnabled(false);
111 a_appendFiles->setEnabled(true);
112 a_loadPlaylist->setEnabled(true);
113 a_showPlaylist->setEnabled(true);
114 a_ShowMedia->setEnabled(false);
86} 115}
@@ -111,2 +140,10 @@ void PMainWindow::slotAppendFiles()
111 m_stack->raiseWidget(m_sfl); 140 m_stack->raiseWidget(m_sfl);
141 playlistOnly->setEnabled(false);
142
143 a_showPlaylist->setEnabled(true);
144 if (m_PlayLib && m_playing) {
145 a_ShowMedia->setEnabled(true);
146 } else {
147 a_ShowMedia->setEnabled(false);
148 }
112} 149}
@@ -116,5 +153,17 @@ void PMainWindow::slotShowList()
116 m_stack->raiseWidget(m_playList); 153 m_stack->raiseWidget(m_playList);
154 playlistOnly->setEnabled(true);
155 a_showPlaylist->setEnabled(false);
156 if (m_playList->childCount()) {
157 a_removeFiles->setEnabled(true);
158 } else {
159 a_removeFiles->setEnabled(false);
160 }
161 if (m_PlayLib && m_playing) {
162 a_ShowMedia->setEnabled(true);
163 } else {
164 a_ShowMedia->setEnabled(false);
165 }
117} 166}
118 167
119void PMainWindow::slotPlayList() 168void PMainWindow::slotShowMediaWindow()
120{ 169{
@@ -126,2 +175,11 @@ void PMainWindow::slotPlayList()
126 } 175 }
176 mediaWindowraised();
177 return;
178 }
179}
180
181void PMainWindow::slotPlayList()
182{
183 if (m_playing && m_LastItem && m_PlayLib) {
184 slotShowMediaWindow();
127 return; 185 return;
@@ -138,2 +196,27 @@ void PMainWindow::slotPlayList()
138 196
197void PMainWindow::slotUserStop()
198{
199 if (!m_playing || !m_PlayLib) return;
200 m_playing = false;
201 m_PlayLib->stop();
202 m_scrollBar->setEnabled(false);
203 hideVideo();
204 slotShowList();
205}
206
207void PMainWindow::slotTogglePlay(bool how)
208{
209 if (how == m_playing) {
210 if (how) {
211 slotShowMediaWindow();
212 }
213 return;
214 }
215 if (how) {
216 slotPlayList();
217 } else {
218 slotUserStop();
219 }
220}
221
139void PMainWindow::hideVideo() 222void PMainWindow::hideVideo()
@@ -141,3 +224,3 @@ void PMainWindow::hideVideo()
141 if (m_VideoPlayer->isVisible() && a_ShowFull->isOn()) { 224 if (m_VideoPlayer->isVisible() && a_ShowFull->isOn()) {
142 m_VideoPlayer->showNormal(); 225 //m_VideoPlayer->showNormal();
143 m_VideoPlayer->hide(); 226 m_VideoPlayer->hide();
@@ -150,4 +233,6 @@ void PMainWindow::slotPlayCurrent()
150 if (m_PlayLib) m_PlayLib->stop(); 233 if (m_PlayLib) m_PlayLib->stop();
234 m_scrollBar->setEnabled(false);
235 a_playAction->setOn(false);
151 hideVideo(); 236 hideVideo();
152 m_stack->raiseWidget(stack_list); 237 slotShowList();
153 return; 238 return;
@@ -158,2 +243,3 @@ void PMainWindow::slotPlayCurrent()
158 odebug << "Pos: " << m_PlayLib->currentTime() << oendl; 243 odebug << "Pos: " << m_PlayLib->currentTime() << oendl;
244 int result = 0;
159 if (!m_LastItem->isVideo()) { 245 if (!m_LastItem->isVideo()) {
@@ -161,11 +247,19 @@ void PMainWindow::slotPlayCurrent()
161 m_playing = true; 247 m_playing = true;
162 QTimer::singleShot( 500, this, SLOT( slotCheckPos() ) );
163 m_stack->raiseWidget(stack_audio); 248 m_stack->raiseWidget(stack_audio);
164 m_AudioPlayer->playFile(m_LastItem->Lnk(),m_PlayLib); 249 result = m_AudioPlayer->playFile(m_LastItem->Lnk(),m_PlayLib);
165 } else { 250 } else {
166 m_playing = true; 251 m_playing = true;
167 QTimer::singleShot( 500, this, SLOT( slotCheckPos() ) );
168 setupVideo(a_ShowFull->isOn()); 252 setupVideo(a_ShowFull->isOn());
169 m_VideoPlayer->playFile(m_LastItem->Lnk(),m_PlayLib); 253 result = m_VideoPlayer->playFile(m_LastItem->Lnk(),m_PlayLib);
170 } 254 }
255 if (result<0) {
256 // fehler
257 return;
258 }
259 mediaWindowraised();
260 odebug << "Range: " << result << oendl;
261 m_scrollBar->setRange(0,result);
262 m_scrollBar->setValue(0);
263 m_scrollBar->setEnabled(true);
264 QTimer::singleShot( 500, this, SLOT( slotCheckPos() ) );
171} 265}
@@ -194,11 +288,2 @@ void PMainWindow::slotPlayPrevious()
194 288
195void PMainWindow::slotUserStop()
196{
197 if (!m_playing || !m_PlayLib) return;
198 m_playing = false;
199 m_PlayLib->stop();
200 hideVideo();
201 m_stack->raiseWidget(stack_list);
202}
203
204void PMainWindow::slotStopped() 289void PMainWindow::slotStopped()
@@ -213,3 +298,4 @@ void PMainWindow::slotCheckPos()
213 if (!m_playing) return; 298 if (!m_playing) return;
214 emit sigPos(m_PlayLib->currentTime()); 299 //emit sigPos(m_PlayLib->currentTime());
300 m_scrollBar->setValue(m_PlayLib->currentTime());
215 QTimer::singleShot( 1000, this, SLOT( slotCheckPos() ) ); 301 QTimer::singleShot( 1000, this, SLOT( slotCheckPos() ) );
@@ -219,5 +305,5 @@ void PMainWindow::slotRemoveFiles()
219{ 305{
220 slotUserStop(); 306 if (m_playing||!m_playList->isVisible()) return;
221 PlaylistItem* Item = m_playList->currentItem(); 307 PlaylistItem* Item = m_playList->currentItem();
222 m_stack->raiseWidget(stack_list); 308 slotShowList();
223 m_playList->removeFromList(Item); 309 m_playList->removeFromList(Item);
@@ -227,6 +313,22 @@ void PMainWindow::setupActions()
227{ 313{
228 a_appendFiles = new QAction(tr("Open file(s)"),Resource::loadIconSet( "opieplayer2/add_to_playlist" ), 0, 0, this, 0, false ); 314 a_appendFiles = new QAction(tr("Append file(s)"),Resource::loadIconSet( "opieplayer2/add_to_playlist" ), 0, 0, this, 0, false );
229 connect(a_appendFiles,SIGNAL(activated()),this,SLOT(slotAppendFiles())); 315 connect(a_appendFiles,SIGNAL(activated()),this,SLOT(slotAppendFiles()));
316 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()));
318 a_loadPlaylist = new QAction(tr("Append .m3u playlist"),Resource::loadIconSet("opieplayer2/add_to_playlist"),0,0,this,0,false);
319 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);
321 connect(a_savePlaylist,SIGNAL(activated()),m_playList,SLOT(slotSaveAsM3u()));
322
323 playlistOnly = new QActionGroup(this,"playlistgroup",false);
324 playlistOnly->insert(a_appendFiles);
325 playlistOnly->insert(a_addDir);
326 playlistOnly->insert(a_loadPlaylist);
327 playlistOnly->insert(a_savePlaylist);
328
230 a_showPlaylist = new QAction(tr("Show playlist"),Resource::loadIconSet( "txt" ), 0, 0, this, 0, false ); 329 a_showPlaylist = new QAction(tr("Show playlist"),Resource::loadIconSet( "txt" ), 0, 0, this, 0, false );
231 connect(a_showPlaylist,SIGNAL(activated()),this,SLOT(slotShowList())); 330 connect(a_showPlaylist,SIGNAL(activated()),this,SLOT(slotShowList()));
331 a_ShowMedia = new QAction(tr("Show media window"),Resource::loadIconSet("opieplayer2/musicfile"), 0, 0, this, 0, false );
332 connect(a_ShowMedia,SIGNAL(activated()),this,SLOT(slotShowMediaWindow()));
333
232 a_removeFiles = new QAction(tr("Remove file"),Resource::loadIconSet( "opieplayer2/remove_from_playlist" ), 0, 0, this, 0, false ); 334 a_removeFiles = new QAction(tr("Remove file"),Resource::loadIconSet( "opieplayer2/remove_from_playlist" ), 0, 0, this, 0, false );
@@ -236,4 +338,6 @@ void PMainWindow::setupActions()
236 338
237 a_playAction = new QAction(tr("Play list"),Resource::loadIconSet( "opieplayer2/play" ), 0, 0, this, 0, false ); 339 a_playAction = new QAction(tr("Play list"),Resource::loadIconSet( "opieplayer2/play" ), 0, 0, this, 0, true);
238 connect(a_playAction,SIGNAL(activated()),this,SLOT(slotPlayList())); 340 a_playAction->setOn(false);
341 connect(a_playAction,SIGNAL(toggled(bool)),this,SLOT(slotTogglePlay(bool)));
342
239 a_playNext = new QAction(tr("Play next in list"),Resource::loadIconSet( "fastforward" ), 0, 0, this, 0, false ); 343 a_playNext = new QAction(tr("Play next in list"),Resource::loadIconSet( "fastforward" ), 0, 0, this, 0, false );
@@ -244,4 +348,2 @@ void PMainWindow::setupActions()
244 connect(a_ShowFull,SIGNAL(toggled(bool)),this,SLOT(slotToggleFull(bool))); 348 connect(a_ShowFull,SIGNAL(toggled(bool)),this,SLOT(slotToggleFull(bool)));
245 a_stopPlay = new QAction(tr("Show videos fullscreen"),Resource::loadIconSet( "stop" ), 0, 0, this, 0, false );
246 connect(a_stopPlay,SIGNAL(activated()),this,SLOT(slotUserStop()));
247 349
@@ -249,5 +351,8 @@ void PMainWindow::setupActions()
249 playersGroup->insert(a_playAction); 351 playersGroup->insert(a_playAction);
250 playersGroup->insert(a_stopPlay);
251 playersGroup->insert(a_playNext); 352 playersGroup->insert(a_playNext);
252 //playersGroup->insert(a_ShowFull); 353
354 /* initial states of actions */
355 a_showPlaylist->setEnabled(false);
356 a_removeFiles->setEnabled(false);
357 a_ShowMedia->setEnabled(false);
253} 358}
@@ -265,2 +370,3 @@ void PMainWindow::setupToolBar()
265 a_showPlaylist->addTo(m_toolBar); 370 a_showPlaylist->addTo(m_toolBar);
371 a_ShowMedia->addTo(m_toolBar);
266 a_ShowFull->addTo(m_toolBar); 372 a_ShowFull->addTo(m_toolBar);
@@ -276,4 +382,6 @@ void PMainWindow::setupVideo(bool full)
276 m_VideoPlayer->showFullScreen(); 382 m_VideoPlayer->showFullScreen();
383 connect(m_VideoPlayer,SIGNAL(videoclicked()),this,SLOT(slotVideoclicked()));
277 } else { 384 } else {
278 m_VideoPlayer->hide(); 385 m_VideoPlayer->hide();
386 m_VideoPlayer->disconnect(this);
279 m_stack->addWidget(m_VideoPlayer,stack_video); 387 m_stack->addWidget(m_VideoPlayer,stack_video);
@@ -281,5 +389,4 @@ void PMainWindow::setupVideo(bool full)
281 } 389 }
390 mediaWindowraised();
282 m_VideoPlayer->fullScreen(full); 391 m_VideoPlayer->fullScreen(full);
283 m_VideoPlayer->disconnect(this);
284 connect(m_VideoPlayer,SIGNAL(videoclicked()),this,SLOT(slotVideoclicked()));
285} 392}
@@ -310,2 +417,6 @@ void PMainWindow::setupMenu()
310 a_removeFiles->addTo(fileMenu); 417 a_removeFiles->addTo(fileMenu);
418 a_addDir->addTo(fileMenu);
419 fileMenu->insertSeparator();
420 a_loadPlaylist->addTo(fileMenu);
421 a_savePlaylist->addTo(fileMenu);
311 422
@@ -314,2 +425,3 @@ void PMainWindow::setupMenu()
314 a_showPlaylist->addTo(dispMenu); 425 a_showPlaylist->addTo(dispMenu);
426 a_ShowMedia->addTo(dispMenu);
315 a_ShowFull->addTo(dispMenu); 427 a_ShowFull->addTo(dispMenu);
diff --git a/noncore/multimedia/opieplayer3/mwindow.h b/noncore/multimedia/opieplayer3/mwindow.h
index 28f820f..10c7a29 100644
--- a/noncore/multimedia/opieplayer3/mwindow.h
+++ b/noncore/multimedia/opieplayer3/mwindow.h
@@ -60,2 +60,3 @@ class VideoWidget;
60class PlaylistItem; 60class PlaylistItem;
61class QSlider;
61 62
@@ -71,2 +72,4 @@ public slots:
71protected: 72protected:
73
74 /* GUI parts */
72 static const int stack_list = 0; 75 static const int stack_list = 0;
@@ -80,6 +83,9 @@ protected:
80 VideoWidget*m_VideoPlayer; 83 VideoWidget*m_VideoPlayer;
84 QWidget*m_MainBox;
85 QSlider*m_scrollBar;
81 86
82 QAction*a_appendFiles,*a_removeFiles,*a_showPlaylist,*a_playAction,*a_deleteItem,*a_stopAction; 87 QAction*a_appendFiles,*a_removeFiles,*a_showPlaylist,*a_playAction,*a_stopAction;
83 QAction*a_playNext,*a_playPrevious,*a_ShowFull,*a_stopPlay; 88 QAction*a_playNext,*a_playPrevious,*a_ShowFull,*a_stopPlay,*a_ShowMedia;
84 QActionGroup*playersGroup; 89 QAction*a_addDir,*a_loadPlaylist,*a_savePlaylist;
90 QActionGroup*playersGroup,*playlistOnly;
85 QToolBar*m_toolBar; 91 QToolBar*m_toolBar;
@@ -99,2 +105,3 @@ protected:
99 PlaylistItem*m_LastItem; 105 PlaylistItem*m_LastItem;
106 void mediaWindowraised();
100 107
@@ -114,2 +121,5 @@ protected slots:
114 virtual void slotGoNext(); 121 virtual void slotGoNext();
122 virtual void slotTogglePlay(bool);
123 virtual void slotShowMediaWindow();
124 virtual void slotListChanged(int);
115 125
diff --git a/noncore/multimedia/opieplayer3/opieplayer3.pro b/noncore/multimedia/opieplayer3/opieplayer3.pro
index 1c7149f..a5d5def 100644
--- a/noncore/multimedia/opieplayer3/opieplayer3.pro
+++ b/noncore/multimedia/opieplayer3/opieplayer3.pro
@@ -2,3 +2,3 @@ CONFIG = qt warn_on quick-app
2HEADERS = mwindow.h playlist.h ../opieplayer2/lib.h ../opieplayer2/threadutil.h \ 2HEADERS = mwindow.h playlist.h ../opieplayer2/lib.h ../opieplayer2/threadutil.h \
3 ../opieplayer2/alphablend.h ../opieplayer2/yuv2rgb.h \ 3 ../opieplayer2/alphablend.h ../opieplayer2/yuv2rgb.h ../opieplayer2/om3u.h \
4 audiowidget.h ../opieplayer2/xinevideowidget.h \ 4 audiowidget.h ../opieplayer2/xinevideowidget.h \
@@ -6,3 +6,3 @@ HEADERS = mwindow.h playlist.h ../opieplayer2/lib.h ../opieplayer2/threadutil.
6SOURCES = mwindow.cpp playlist.cpp ../opieplayer2/lib.cpp ../opieplayer2/threadutil.cpp \ 6SOURCES = mwindow.cpp playlist.cpp ../opieplayer2/lib.cpp ../opieplayer2/threadutil.cpp \
7 ../opieplayer2/nullvideo.c \ 7 ../opieplayer2/nullvideo.c ../opieplayer2/om3u.cpp \
8 ../opieplayer2/alphablend.c ../opieplayer2/yuv2rgb.c \ 8 ../opieplayer2/alphablend.c ../opieplayer2/yuv2rgb.c \
diff --git a/noncore/multimedia/opieplayer3/playlist.cpp b/noncore/multimedia/opieplayer3/playlist.cpp
index 272a71e..babe8ce 100644
--- a/noncore/multimedia/opieplayer3/playlist.cpp
+++ b/noncore/multimedia/opieplayer3/playlist.cpp
@@ -34,2 +34,3 @@
34#include "../opieplayer2/lib.h" 34#include "../opieplayer2/lib.h"
35#include "../opieplayer2/om3u.h"
35 36
@@ -37,2 +38,3 @@
37#include <opie2/oresource.h> 38#include <opie2/oresource.h>
39#include <opie2/ofiledialog.h>
38 40
@@ -41,2 +43,7 @@
41#include <qfileinfo.h> 43#include <qfileinfo.h>
44#include <qmessagebox.h>
45#include <qdir.h>
46
47//#define DEFAULT_FILE_TYPES "*.mp3;*.ogg;*.ogm;*.wma;*.wav;*.asf;*.au;*.avi;*.mpeg;*.mpg;*.mv1;*.mov;*.wmv;*.pls;*.m3u;*.mp4;*.m4a"
48#define DEFAULT_FILE_TYPES "*.mp3;*.ogg;*.ogm;*.wma;*.wav;*.asf;*.au;*.avi;*.mpeg;*.mpg;*.mv1;*.mov;*.wmv;*.mp4;*.m4a"
42 49
@@ -87,2 +94,3 @@ PlaylistView::PlaylistView(QWidget *parent, const char *name)
87 m_lastItem = 0; 94 m_lastItem = 0;
95 m_lastDir = QDir::homeDirPath();
88} 96}
@@ -104,20 +112,52 @@ void PlaylistView::slotAddFile(const DocLnk&aLink)
104{ 112{
105 QFileInfo fileInfo(aLink.file()); 113 addFile(aLink.file(),aLink.name());
114 emit contentChanged(childCount());
115}
116
117void PlaylistView::addFile(const QString&aFile,const QString&aName)
118{
119 QFileInfo fileInfo(aFile);
106 if (!fileInfo.exists()) return; 120 if (!fileInfo.exists()) return;
107 checkLib(); 121 checkLib();
108
109 m_Infolib->stop(); 122 m_Infolib->stop();
110 123
111 if (m_lastItem) { 124 QString name = aName;
112 m_lastItem = new PlaylistItem(aLink,this,m_lastItem); 125 if (name.isEmpty()) {
113 } else { 126 name = fileInfo.fileName();
114 m_lastItem = new PlaylistItem(aLink,this);
115 } 127 }
116 m_lastItem->setExpandable(false); 128 int i = m_Infolib->setfile(aFile.utf8().data());
117 m_lastItem->setText(1,aLink.name()); 129 odebug << "File set: " << i << " ("<<aFile.utf8().data()<<")"<<oendl;
118 int i = m_Infolib->setfile(aLink.file());
119 odebug << "File set: " << i << oendl;
120 if (i<1) { 130 if (i<1) {
131 i = m_Infolib->error();
132 odebug << "Errorcode: " << i << oendl;
133 QString msg;
134 msg = QString(tr("Error open file %1: ")).arg(name);
135 switch (i) {
136 case 1:
137 msg += tr("No input plugin");
138 break;
139 case 2:
140 msg += tr("No demuxer plugin");
141 break;
142 case 3:
143 msg += tr("Demuxer failed");
144 break;
145 case 4:
146 msg+=tr("Malformed mrl");
147 break;
148 default:
149 msg += tr("Unknown error");
150 break;
151 }
152 QMessageBox::warning(0,tr("Error reading fileheader"),msg);
121 return; 153 return;
122 } 154 }
155 m_lastItem = m_items.last();
156 if (m_lastItem) {
157 m_lastItem = new PlaylistItem(aFile,this,m_lastItem);
158 } else {
159 m_lastItem = new PlaylistItem(aFile,this);
160 }
161 m_lastItem->setExpandable(false);
162 m_lastItem->setText(1,name);
123 163
@@ -156,2 +196,61 @@ void PlaylistView::slotAddFile(const DocLnk&aLink)
156 m_items.append(m_lastItem); 196 m_items.append(m_lastItem);
197 setSelected(m_lastItem,true);
198}
199
200void PlaylistView::slotAppendDir()
201{
202 QString _dir = Opie::Ui::OFileDialog::getDirectory(Opie::Ui::OFileSelector::Extended,m_lastDir,0,m_lastDir);
203 if (_dir.isEmpty()) return;
204 m_lastDir = _dir;
205 QDir sDir(_dir);
206 QStringList list = sDir.entryList(DEFAULT_FILE_TYPES,QDir::Files,QDir::Name | QDir::IgnoreCase);
207 for (unsigned i = 0; i < list.count();++i) {
208 addFile(_dir+QString("/")+list[i]);
209 }
210 emit contentChanged(childCount());
211}
212
213void PlaylistView::slotOpenM3u()
214{
215 QStringList types;
216 QMap<QString, QStringList> mimeTypes;
217 types << "audio/x-mpegurl";
218 mimeTypes.insert("Playlists",types);
219 mimeTypes.insert("All",types);
220 QString fileName= Opie::Ui::OFileDialog::getOpenFileName(Opie::Ui::OFileSelector::EXTENDED,
221 m_lastDir,"playlist.m3u", mimeTypes);
222 if (fileName.isEmpty()) {
223 return;
224 }
225 QFileInfo f(fileName);
226
227 Om3u _om3u(fileName, IO_ReadOnly);
228 if (f.extension(FALSE).lower()=="m3u") {
229 _om3u.readM3u();
230 } else if (f.extension(FALSE).lower()=="pls") {
231 _om3u.readPls();
232 }
233 for (unsigned int j=0; j<_om3u.count();++j) {
234 addFile(_om3u[j]);
235 }
236 emit contentChanged(childCount());
237}
238
239void PlaylistView::slotSaveAsM3u()
240{
241 QStringList types;
242 QMap<QString, QStringList> mimeTypes;
243 types << "audio/x-mpegurl";
244 mimeTypes.insert("Playlists",types);
245 mimeTypes.insert("All",types);
246 QString fileName= Opie::Ui::OFileDialog::getSaveFileName(Opie::Ui::OFileSelector::EXTENDED,
247 m_lastDir,"playlist.m3u", mimeTypes);
248 if (fileName.isEmpty()) {
249 return;
250 }
251 Om3u _om3u(fileName, IO_ReadWrite | IO_Truncate);
252 for (unsigned j=0; j<m_items.count();++j) {
253 _om3u.add(m_items[j]->Lnk().file());
254 }
255 _om3u.write();
157} 256}
@@ -161,5 +260,8 @@ void PlaylistView::removeFromList(PlaylistItem*Item)
161 if (!Item)return; 260 if (!Item)return;
162 t_itemlist::Iterator iter; 261 t_itemlist::Iterator iter,it2;
163 iter = m_items.find(Item); 262 iter = m_items.find(Item);
263 it2 = m_items.end();
164 if (iter!=m_items.end()) { 264 if (iter!=m_items.end()) {
265 it2 = iter;
266 ++it2;
165 m_items.remove(iter); 267 m_items.remove(iter);
@@ -167,2 +269,9 @@ void PlaylistView::removeFromList(PlaylistItem*Item)
167 delete Item; 269 delete Item;
270 if (it2!=m_items.end()) {
271 setSelected((*it2),true);
272 } else if (m_items.count()) {
273 QListViewItem * it = m_items.last();
274 setSelected(it,true);
275 }
276 emit contentChanged(childCount());
168} 277}
diff --git a/noncore/multimedia/opieplayer3/playlist.h b/noncore/multimedia/opieplayer3/playlist.h
index ad4c472..4a9268c 100644
--- a/noncore/multimedia/opieplayer3/playlist.h
+++ b/noncore/multimedia/opieplayer3/playlist.h
@@ -88,4 +88,11 @@ public:
88 }; 88 };
89 void addFile(const QString&aFile,const QString&aName="");
90signals:
91 void contentChanged(int);
92
89public slots: 93public slots:
90 virtual void slotAddFile(const DocLnk&); 94 virtual void slotAddFile(const DocLnk&);
95 virtual void slotAppendDir();
96 virtual void slotOpenM3u();
97 virtual void slotSaveAsM3u();
91 98
@@ -97,2 +104,3 @@ protected:
97 t_itemlist m_items; 104 t_itemlist m_items;
105 QString m_lastDir;
98}; 106};
diff --git a/noncore/multimedia/opieplayer3/videowidget.cpp b/noncore/multimedia/opieplayer3/videowidget.cpp
index c5c63c7..a28d47d 100644
--- a/noncore/multimedia/opieplayer3/videowidget.cpp
+++ b/noncore/multimedia/opieplayer3/videowidget.cpp
@@ -21,2 +21,3 @@ VideoWidget::VideoWidget( QWidget * parent, const char * name, WFlags f)
21 m_Videodisplay = new XineVideoWidget(this,"videodisp"); 21 m_Videodisplay = new XineVideoWidget(this,"videodisp");
22#if 0
22 m_PosSlider = new QSlider(QSlider::Horizontal,this); 23 m_PosSlider = new QSlider(QSlider::Horizontal,this);
@@ -27,6 +28,9 @@ VideoWidget::VideoWidget( QWidget * parent, const char * name, WFlags f)
27 connect(m_PosSlider,SIGNAL(sliderReleased()),this,SLOT(sliderReleased())); 28 connect(m_PosSlider,SIGNAL(sliderReleased()),this,SLOT(sliderReleased()));
29#endif
28 connect(m_Videodisplay,SIGNAL(videoResized ( const QSize & )),this,SLOT(slot_Videoresized(const QSize&))); 30 connect(m_Videodisplay,SIGNAL(videoResized ( const QSize & )),this,SLOT(slot_Videoresized(const QSize&)));
29 connect(m_Videodisplay,SIGNAL(clicked()),this,SLOT(slotClicked())); 31 connect(m_Videodisplay,SIGNAL(clicked()),this,SLOT(slotClicked()));
32#if 0
30 m_pressed = false; 33 m_pressed = false;
31 m_uppos=0; 34 m_uppos=0;
35#endif
32} 36}
@@ -47,4 +51,5 @@ void VideoWidget::closeEvent(QCloseEvent*e)
47 51
48void VideoWidget::slotNewPos(int pos) 52void VideoWidget::slotNewPos(int /*pos*/)
49{ 53{
54#if 0
50 if (!m_xineLib) return; 55 if (!m_xineLib) return;
@@ -52,2 +57,3 @@ void VideoWidget::slotNewPos(int pos)
52 m_xineLib->seekTo(pos); 57 m_xineLib->seekTo(pos);
58#endif
53} 59}
@@ -56,3 +62,5 @@ void VideoWidget::sliderPressed()
56{ 62{
63#if 0
57 m_pressed = true; 64 m_pressed = true;
65#endif
58} 66}
@@ -61,7 +69,10 @@ void VideoWidget::sliderReleased()
61{ 69{
70#if 0
62 m_pressed = false; 71 m_pressed = false;
72#endif
63} 73}
64 74
65void VideoWidget::fullScreen(bool how) 75void VideoWidget::fullScreen(bool /* how */)
66{ 76{
77#if 0
67 if (how) { 78 if (how) {
@@ -71,9 +82,11 @@ void VideoWidget::fullScreen(bool how)
71 } 82 }
83#endif
72} 84}
73 85
74void VideoWidget::playFile(const DocLnk&aLnk,XINE::Lib*aLib) 86int VideoWidget::playFile(const DocLnk&aLnk,XINE::Lib*aLib)
75{ 87{
76 m_current = aLnk; 88 m_current = aLnk;
89 bool recon;
77 if (m_xineLib != aLib) { 90 if (m_xineLib != aLib) {
78 disconnect(m_xineLib); 91 if (m_xineLib) disconnect(m_xineLib);
79 m_xineLib = aLib; 92 m_xineLib = aLib;
@@ -82,7 +95,9 @@ void VideoWidget::playFile(const DocLnk&aLnk,XINE::Lib*aLib)
82 if (!m_xineLib) { 95 if (!m_xineLib) {
83 return; 96 return -1;
84 } 97 }
85 connect(m_xineLib,SIGNAL(stopped()),this,SLOT(slotStopped())); 98 connect(m_xineLib,SIGNAL(stopped()),this,SLOT(slotStopped()));
99#if 0
86 m_uppos=0; 100 m_uppos=0;
87 m_PosSlider->setValue(0); 101 m_PosSlider->setValue(0);
102#endif
88 m_xineLib->setWidget(m_Videodisplay); 103 m_xineLib->setWidget(m_Videodisplay);
@@ -90,6 +105,12 @@ void VideoWidget::playFile(const DocLnk&aLnk,XINE::Lib*aLib)
90 m_xineLib->resize(m_Videodisplay->size()); 105 m_xineLib->resize(m_Videodisplay->size());
91 m_xineLib->play(m_current.file()); 106 int res = m_xineLib->play(m_current.file());
92 int l = m_xineLib->length(); 107 odebug << "Xine play: " << res << oendl;
108 if (res != 1) {
109 return -2;
110 }
111 return m_xineLib->length();
112#if 0
93 m_PosSlider->setRange(0,l); 113 m_PosSlider->setRange(0,l);
94 m_PosSlider->setPageStep(l/10); 114 m_PosSlider->setPageStep(l/10);
115#endif
95} 116}
@@ -116,4 +137,5 @@ void VideoWidget::slot_Videoresized(const QSize&s)
116 137
117void VideoWidget::updatePos(int val) 138void VideoWidget::updatePos(int /*val*/)
118{ 139{
140#if 0
119 if (m_pressed) return; 141 if (m_pressed) return;
@@ -121,2 +143,3 @@ void VideoWidget::updatePos(int val)
121 m_PosSlider->setValue(val); 143 m_PosSlider->setValue(val);
144#endif
122} 145}
diff --git a/noncore/multimedia/opieplayer3/videowidget.h b/noncore/multimedia/opieplayer3/videowidget.h
index f181980..935a648 100644
--- a/noncore/multimedia/opieplayer3/videowidget.h
+++ b/noncore/multimedia/opieplayer3/videowidget.h
@@ -22,3 +22,3 @@ public:
22 22
23 void playFile(const DocLnk&,XINE::Lib*); 23 int playFile(const DocLnk&,XINE::Lib*);
24 void fullScreen(bool how); 24 void fullScreen(bool how);
@@ -38,2 +38,3 @@ protected:
38 QWidget * m_holder; 38 QWidget * m_holder;
39#if 0
39 QSlider*m_PosSlider; 40 QSlider*m_PosSlider;
@@ -41,2 +42,3 @@ protected:
41 int m_uppos; 42 int m_uppos;
43#endif
42 44