-rw-r--r-- | noncore/multimedia/opieplayer3/audiowidget.cpp | 33 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer3/audiowidget.h | 4 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer3/mwindow.cpp | 180 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer3/mwindow.h | 16 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer3/opieplayer3.pro | 4 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer3/playlist.cpp | 131 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer3/playlist.h | 8 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer3/videowidget.cpp | 39 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer3/videowidget.h | 4 |
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 | |||
@@ -17,6 +17,7 @@ AudioWidget::AudioWidget( QWidget * parent, const char * name, WFlags f) | |||
17 | m_MainLayout = new QVBoxLayout(this); | 17 | m_MainLayout = new QVBoxLayout(this); |
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 | ||
20 | m_PosSlider = new QSlider(QSlider::Horizontal,this); | 21 | m_PosSlider = new QSlider(QSlider::Horizontal,this); |
21 | m_PosSlider->setTickInterval(60); | 22 | m_PosSlider->setTickInterval(60); |
22 | connect(m_PosSlider,SIGNAL(valueChanged(int)),this,SLOT(slotNewPos(int))); | 23 | connect(m_PosSlider,SIGNAL(valueChanged(int)),this,SLOT(slotNewPos(int))); |
@@ -25,27 +26,34 @@ AudioWidget::AudioWidget( QWidget * parent, const char * name, WFlags f) | |||
25 | connect(m_PosSlider,SIGNAL(sliderReleased()),this,SLOT(sliderReleased())); | 26 | connect(m_PosSlider,SIGNAL(sliderReleased()),this,SLOT(sliderReleased())); |
26 | m_pressed = false; | 27 | m_pressed = false; |
27 | m_uppos=0; | 28 | m_uppos=0; |
29 | #endif | ||
28 | } | 30 | } |
29 | 31 | ||
30 | AudioWidget::~AudioWidget() | 32 | AudioWidget::~AudioWidget() |
31 | { | 33 | { |
32 | } | 34 | } |
33 | 35 | ||
34 | void AudioWidget::slotNewPos(int pos) | 36 | void 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 | } |
40 | 44 | ||
41 | void AudioWidget::sliderPressed() | 45 | void AudioWidget::sliderPressed() |
42 | { | 46 | { |
47 | #if 0 | ||
43 | m_pressed = true; | 48 | m_pressed = true; |
49 | #endif | ||
44 | } | 50 | } |
45 | 51 | ||
46 | void AudioWidget::sliderReleased() | 52 | void AudioWidget::sliderReleased() |
47 | { | 53 | { |
54 | #if 0 | ||
48 | m_pressed = false; | 55 | m_pressed = false; |
56 | #endif | ||
49 | } | 57 | } |
50 | 58 | ||
51 | void AudioWidget::closeEvent(QCloseEvent*e) | 59 | void AudioWidget::closeEvent(QCloseEvent*e) |
@@ -57,20 +65,25 @@ void AudioWidget::closeEvent(QCloseEvent*e) | |||
57 | QWidget::closeEvent(e); | 65 | QWidget::closeEvent(e); |
58 | } | 66 | } |
59 | 67 | ||
60 | void AudioWidget::playFile(const DocLnk&aLnk,XINE::Lib*aLib) | 68 | int AudioWidget::playFile(const DocLnk&aLnk,XINE::Lib*aLib) |
61 | { | 69 | { |
62 | m_current = aLnk; | 70 | m_current = aLnk; |
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; |
66 | } | 74 | } |
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 |
75 | QString title = m_xineLib->metaInfo(0); | 88 | QString title = m_xineLib->metaInfo(0); |
76 | // artist | 89 | // artist |
@@ -79,7 +92,10 @@ void AudioWidget::playFile(const DocLnk&aLnk,XINE::Lib*aLib) | |||
79 | QString album = m_xineLib->metaInfo(4); | 92 | QString album = m_xineLib->metaInfo(4); |
80 | 93 | ||
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=""; |
84 | int h = l/3600; | 100 | int h = l/3600; |
85 | l-=h*3600; | 101 | l-=h*3600; |
@@ -102,12 +118,15 @@ void AudioWidget::playFile(const DocLnk&aLnk,XINE::Lib*aLib) | |||
102 | } | 118 | } |
103 | if (title.length()) { | 119 | if (title.length()) { |
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 | } |
106 | if (album.length()) { | 124 | if (album.length()) { |
107 | text+="<H2><center>"+album+"</center></h2>"; | 125 | text+="<H2><center>"+album+"</center></h2>"; |
108 | } | 126 | } |
109 | text+="<h3><center>"+laenge+"</center></h3>"; | 127 | text+="<h3><center>"+laenge+"</center></h3>"; |
110 | m_InfoBox->setText(text); | 128 | m_InfoBox->setText(text); |
129 | return tmp; | ||
111 | } | 130 | } |
112 | 131 | ||
113 | void AudioWidget::stopPlaying() | 132 | void AudioWidget::stopPlaying() |
@@ -117,9 +136,11 @@ void AudioWidget::stopPlaying() | |||
117 | } | 136 | } |
118 | } | 137 | } |
119 | 138 | ||
120 | void AudioWidget::updatePos(int val) | 139 | void AudioWidget::updatePos(int /* val */) |
121 | { | 140 | { |
141 | #if 0 | ||
122 | if (m_pressed) return; | 142 | if (m_pressed) return; |
123 | m_uppos = val; | 143 | m_uppos = 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 | |||
@@ -21,7 +21,7 @@ public: | |||
21 | AudioWidget( QWidget * parent=0, const char * name=0, WFlags f=0 ); | 21 | AudioWidget( QWidget * parent=0, const char * name=0, WFlags f=0 ); |
22 | virtual ~AudioWidget(); | 22 | virtual ~AudioWidget(); |
23 | 23 | ||
24 | void playFile(const DocLnk&,XINE::Lib*); | 24 | int playFile(const DocLnk&,XINE::Lib*); |
25 | 25 | ||
26 | public slots: | 26 | public slots: |
27 | virtual void stopPlaying(); | 27 | virtual void stopPlaying(); |
@@ -32,9 +32,11 @@ protected: | |||
32 | DocLnk m_current; | 32 | DocLnk m_current; |
33 | QVBoxLayout*m_MainLayout; | 33 | QVBoxLayout*m_MainLayout; |
34 | QTextView*m_InfoBox; | 34 | QTextView*m_InfoBox; |
35 | #if 0 | ||
35 | QSlider*m_PosSlider; | 36 | QSlider*m_PosSlider; |
36 | bool m_pressed; | 37 | bool m_pressed; |
37 | int m_uppos; | 38 | int m_uppos; |
39 | #endif | ||
38 | 40 | ||
39 | protected slots: | 41 | protected slots: |
40 | virtual void closeEvent(QCloseEvent*e); | 42 | virtual void closeEvent(QCloseEvent*e); |
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 | |||
@@ -50,6 +50,8 @@ | |||
50 | #include <qpopupmenu.h> | 50 | #include <qpopupmenu.h> |
51 | #include <qmenubar.h> | 51 | #include <qmenubar.h> |
52 | #include <qtimer.h> | 52 | #include <qtimer.h> |
53 | #include <qslider.h> | ||
54 | #include <qlayout.h> | ||
53 | 55 | ||
54 | OPIE_EXPORT_APP( Opie::Core::OApplicationFactory<PMainWindow>) | 56 | OPIE_EXPORT_APP( Opie::Core::OApplicationFactory<PMainWindow>) |
55 | 57 | ||
@@ -59,16 +61,21 @@ PMainWindow::PMainWindow(QWidget*w, const char*name, WFlags f) | |||
59 | : QMainWindow(w,name,f) | 61 | : QMainWindow(w,name,f) |
60 | { | 62 | { |
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); |
73 | m_stack->addWidget(m_sfl,stack_file); | 80 | m_stack->addWidget(m_sfl,stack_file); |
74 | connect(m_sfl, SIGNAL(fileSelected(const DocLnk &)), m_playList, SLOT(slotAddFile(const DocLnk &))); | 81 | connect(m_sfl, SIGNAL(fileSelected(const DocLnk &)), m_playList, SLOT(slotAddFile(const DocLnk &))); |
@@ -83,6 +90,28 @@ PMainWindow::PMainWindow(QWidget*w, const char*name, WFlags f) | |||
83 | m_stack->raiseWidget(stack_list); | 90 | m_stack->raiseWidget(stack_list); |
84 | m_PlayLib = 0; | 91 | m_PlayLib = 0; |
85 | m_LastItem = 0; | 92 | m_LastItem = 0; |
93 | setupActions(); | ||
94 | setupToolBar(); | ||
95 | setupMenu(); | ||
96 | |||
97 | setCentralWidget(m_MainBox ); | ||
98 | } | ||
99 | |||
100 | void PMainWindow::slotListChanged(int count) | ||
101 | { | ||
102 | if (!m_playList->isVisible()) { | ||
103 | return; | ||
104 | } | ||
105 | a_removeFiles->setEnabled(count>0); | ||
106 | } | ||
107 | |||
108 | void 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 | } |
87 | 116 | ||
88 | void PMainWindow::checkLib() | 117 | void PMainWindow::checkLib() |
@@ -109,14 +138,34 @@ void PMainWindow::fileSelected(const DocLnk&) | |||
109 | void PMainWindow::slotAppendFiles() | 138 | void PMainWindow::slotAppendFiles() |
110 | { | 139 | { |
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 | } |
113 | 150 | ||
114 | void PMainWindow::slotShowList() | 151 | void PMainWindow::slotShowList() |
115 | { | 152 | { |
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 | ||
119 | void PMainWindow::slotPlayList() | 168 | void PMainWindow::slotShowMediaWindow() |
120 | { | 169 | { |
121 | if (m_playing && m_LastItem && m_PlayLib) { | 170 | if (m_playing && m_LastItem && m_PlayLib) { |
122 | if (!m_LastItem->isVideo()) { | 171 | if (!m_LastItem->isVideo()) { |
@@ -124,6 +173,15 @@ void PMainWindow::slotPlayList() | |||
124 | } else { | 173 | } else { |
125 | m_stack->raiseWidget(stack_video); | 174 | m_stack->raiseWidget(stack_video); |
126 | } | 175 | } |
176 | mediaWindowraised(); | ||
177 | return; | ||
178 | } | ||
179 | } | ||
180 | |||
181 | void PMainWindow::slotPlayList() | ||
182 | { | ||
183 | if (m_playing && m_LastItem && m_PlayLib) { | ||
184 | slotShowMediaWindow(); | ||
127 | return; | 185 | return; |
128 | } | 186 | } |
129 | 187 | ||
@@ -136,10 +194,35 @@ void PMainWindow::slotPlayList() | |||
136 | slotPlayCurrent(); | 194 | slotPlayCurrent(); |
137 | } | 195 | } |
138 | 196 | ||
197 | void 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 | |||
207 | void 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 | |||
139 | void PMainWindow::hideVideo() | 222 | void PMainWindow::hideVideo() |
140 | { | 223 | { |
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(); |
144 | } | 227 | } |
145 | } | 228 | } |
@@ -148,26 +231,37 @@ void PMainWindow::slotPlayCurrent() | |||
148 | { | 231 | { |
149 | if (!m_LastItem) { | 232 | if (!m_LastItem) { |
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; |
154 | } | 239 | } |
155 | checkLib(); | 240 | checkLib(); |
156 | m_CurrentPos = 0; | 241 | m_CurrentPos = 0; |
157 | m_playList->setCurrentItem(m_LastItem); | 242 | m_playList->setCurrentItem(m_LastItem); |
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()) { |
160 | hideVideo(); | 246 | hideVideo(); |
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 | } |
172 | 266 | ||
173 | void PMainWindow::slotPlayNext() | 267 | void PMainWindow::slotPlayNext() |
@@ -192,15 +286,6 @@ void PMainWindow::slotPlayPrevious() | |||
192 | slotPlayCurrent(); | 286 | slotPlayCurrent(); |
193 | } | 287 | } |
194 | 288 | ||
195 | void 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 | |||
204 | void PMainWindow::slotStopped() | 289 | void PMainWindow::slotStopped() |
205 | { | 290 | { |
206 | if (!m_playing) return; | 291 | if (!m_playing) return; |
@@ -211,45 +296,65 @@ void PMainWindow::slotStopped() | |||
211 | void PMainWindow::slotCheckPos() | 296 | void PMainWindow::slotCheckPos() |
212 | { | 297 | { |
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() ) ); |
216 | } | 302 | } |
217 | 303 | ||
218 | void PMainWindow::slotRemoveFiles() | 304 | 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); |
224 | } | 310 | } |
225 | 311 | ||
226 | void PMainWindow::setupActions() | 312 | 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 ); |
233 | connect(a_removeFiles,SIGNAL(activated()),this,SLOT(slotRemoveFiles())); | 335 | connect(a_removeFiles,SIGNAL(activated()),this,SLOT(slotRemoveFiles())); |
234 | 336 | ||
235 | playersGroup = new QActionGroup(this,"playgroup",false); | 337 | playersGroup = new QActionGroup(this,"playgroup",false); |
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 ); |
240 | connect(a_playNext,SIGNAL(activated()),this,SLOT(slotPlayNext())); | 344 | connect(a_playNext,SIGNAL(activated()),this,SLOT(slotPlayNext())); |
241 | a_playPrevious = new QAction(tr("Play previous in list"),Resource::loadIconSet( "fastback" ), 0, 0, this, 0, false ); | 345 | a_playPrevious = new QAction(tr("Play previous in list"),Resource::loadIconSet( "fastback" ), 0, 0, this, 0, false ); |
242 | connect(a_playPrevious,SIGNAL(activated()),this,SLOT(slotPlayPrevious())); | 346 | connect(a_playPrevious,SIGNAL(activated()),this,SLOT(slotPlayPrevious())); |
243 | a_ShowFull = new QAction(tr("Show videos fullscreen"),Resource::loadIconSet( "fullscreen" ), 0, 0, this, 0, true ); | 347 | a_ShowFull = new QAction(tr("Show videos fullscreen"),Resource::loadIconSet( "fullscreen" ), 0, 0, this, 0, true ); |
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 | ||
248 | playersGroup->insert(a_playPrevious); | 350 | playersGroup->insert(a_playPrevious); |
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 | } |
254 | 359 | ||
255 | void PMainWindow::setupToolBar() | 360 | void PMainWindow::setupToolBar() |
@@ -263,6 +368,7 @@ void PMainWindow::setupToolBar() | |||
263 | a_appendFiles->addTo(m_toolBar); | 368 | a_appendFiles->addTo(m_toolBar); |
264 | a_removeFiles->addTo(m_toolBar); | 369 | a_removeFiles->addTo(m_toolBar); |
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); |
267 | playersGroup->addTo(m_toolBar); | 373 | playersGroup->addTo(m_toolBar); |
268 | } | 374 | } |
@@ -274,14 +380,15 @@ void PMainWindow::setupVideo(bool full) | |||
274 | m_VideoPlayer->reparent(0, WStyle_Customize | WStyle_NoBorderEx, QPoint(0,0)); | 380 | m_VideoPlayer->reparent(0, WStyle_Customize | WStyle_NoBorderEx, QPoint(0,0)); |
275 | m_VideoPlayer->setGeometry(0,0,qApp->desktop()->size().width(),qApp->desktop()->size().height()); | 381 | m_VideoPlayer->setGeometry(0,0,qApp->desktop()->size().width(),qApp->desktop()->size().height()); |
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); |
280 | m_stack->raiseWidget(stack_video); | 388 | m_stack->raiseWidget(stack_video); |
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 | } |
286 | 393 | ||
287 | void PMainWindow::slotVideoclicked() | 394 | void PMainWindow::slotVideoclicked() |
@@ -308,10 +415,15 @@ void PMainWindow::setupMenu() | |||
308 | m_menuBar->insertItem( tr( "Playlist" ), fileMenu ); | 415 | m_menuBar->insertItem( tr( "Playlist" ), fileMenu ); |
309 | a_appendFiles->addTo(fileMenu); | 416 | a_appendFiles->addTo(fileMenu); |
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 | ||
312 | dispMenu = new QPopupMenu( m_menuBar ); | 423 | dispMenu = new QPopupMenu( m_menuBar ); |
313 | m_menuBar->insertItem( tr( "Show" ), dispMenu ); | 424 | m_menuBar->insertItem( tr( "Show" ), dispMenu ); |
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); |
316 | playMenu = new QPopupMenu(m_menuBar); | 428 | playMenu = new QPopupMenu(m_menuBar); |
317 | m_menuBar->insertItem(tr("Playing"),playMenu); | 429 | m_menuBar->insertItem(tr("Playing"),playMenu); |
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 | |||
@@ -58,6 +58,7 @@ class QMenuBar; | |||
58 | class AudioWidget; | 58 | class AudioWidget; |
59 | class VideoWidget; | 59 | class VideoWidget; |
60 | class PlaylistItem; | 60 | class PlaylistItem; |
61 | class QSlider; | ||
61 | 62 | ||
62 | class PMainWindow : public QMainWindow { | 63 | class PMainWindow : public QMainWindow { |
63 | Q_OBJECT | 64 | Q_OBJECT |
@@ -69,6 +70,8 @@ public: | |||
69 | public slots: | 70 | public slots: |
70 | virtual void slotVideoclicked(); | 71 | virtual void slotVideoclicked(); |
71 | protected: | 72 | protected: |
73 | |||
74 | /* GUI parts */ | ||
72 | static const int stack_list = 0; | 75 | static const int stack_list = 0; |
73 | static const int stack_file = 1; | 76 | static const int stack_file = 1; |
74 | static const int stack_audio = 2; | 77 | static const int stack_audio = 2; |
@@ -78,10 +81,13 @@ protected: | |||
78 | PlaylistView*m_playList; | 81 | PlaylistView*m_playList; |
79 | AudioWidget*m_AudioPlayer; | 82 | AudioWidget*m_AudioPlayer; |
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; |
86 | QPopupMenu *fileMenu,*dispMenu,*playMenu; | 92 | QPopupMenu *fileMenu,*dispMenu,*playMenu; |
87 | QMenuBar*m_menuBar; | 93 | QMenuBar*m_menuBar; |
@@ -97,6 +103,7 @@ protected: | |||
97 | bool m_playing:1; | 103 | bool m_playing:1; |
98 | int m_CurrentPos; | 104 | int m_CurrentPos; |
99 | PlaylistItem*m_LastItem; | 105 | PlaylistItem*m_LastItem; |
106 | void mediaWindowraised(); | ||
100 | 107 | ||
101 | protected slots: | 108 | protected slots: |
102 | virtual void fileSelected(const DocLnk&); | 109 | virtual void fileSelected(const DocLnk&); |
@@ -112,6 +119,9 @@ protected slots: | |||
112 | virtual void slotToggleFull(bool); | 119 | virtual void slotToggleFull(bool); |
113 | virtual void slotUserStop(); | 120 | virtual void slotUserStop(); |
114 | virtual void slotGoNext(); | 121 | virtual void slotGoNext(); |
122 | virtual void slotTogglePlay(bool); | ||
123 | virtual void slotShowMediaWindow(); | ||
124 | virtual void slotListChanged(int); | ||
115 | 125 | ||
116 | signals: | 126 | signals: |
117 | void sigPos(int); | 127 | void sigPos(int); |
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 | |||
@@ -1,10 +1,10 @@ | |||
1 | CONFIG = qt warn_on quick-app | 1 | CONFIG = qt warn_on quick-app |
2 | HEADERS = mwindow.h playlist.h ../opieplayer2/lib.h ../opieplayer2/threadutil.h \ | 2 | HEADERS = 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 \ |
5 | videowidget.h | 5 | videowidget.h |
6 | SOURCES = mwindow.cpp playlist.cpp ../opieplayer2/lib.cpp ../opieplayer2/threadutil.cpp \ | 6 | SOURCES = 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 \ |
9 | audiowidget.cpp ../opieplayer2/xinevideowidget.cpp \ | 9 | audiowidget.cpp ../opieplayer2/xinevideowidget.cpp \ |
10 | videowidget.cpp ../opieplayer2/yuv2rgb_arm2.c ../opieplayer2/yuv2rgb_arm4l.S | 10 | videowidget.cpp ../opieplayer2/yuv2rgb_arm2.c ../opieplayer2/yuv2rgb_arm4l.S |
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 | |||
@@ -32,13 +32,20 @@ | |||
32 | */ | 32 | */ |
33 | #include "playlist.h" | 33 | #include "playlist.h" |
34 | #include "../opieplayer2/lib.h" | 34 | #include "../opieplayer2/lib.h" |
35 | #include "../opieplayer2/om3u.h" | ||
35 | 36 | ||
36 | #include <opie2/odebug.h> | 37 | #include <opie2/odebug.h> |
37 | #include <opie2/oresource.h> | 38 | #include <opie2/oresource.h> |
39 | #include <opie2/ofiledialog.h> | ||
38 | 40 | ||
39 | #include <qpe/resource.h> | 41 | #include <qpe/resource.h> |
40 | 42 | ||
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 | ||
43 | PlaylistItem::PlaylistItem(const DocLnk& aLink,PlaylistView*parent) | 50 | PlaylistItem::PlaylistItem(const DocLnk& aLink,PlaylistView*parent) |
44 | :QListViewItem(parent),m_Content(aLink),m_video(false) | 51 | :QListViewItem(parent),m_Content(aLink),m_video(false) |
@@ -85,6 +92,7 @@ PlaylistView::PlaylistView(QWidget *parent, const char *name) | |||
85 | setSelectionMode(Single); | 92 | setSelectionMode(Single); |
86 | setSorting(-1); | 93 | setSorting(-1); |
87 | m_lastItem = 0; | 94 | m_lastItem = 0; |
95 | m_lastDir = QDir::homeDirPath(); | ||
88 | } | 96 | } |
89 | 97 | ||
90 | PlaylistView::~PlaylistView() | 98 | PlaylistView::~PlaylistView() |
@@ -102,24 +110,56 @@ void PlaylistView::checkLib() | |||
102 | 110 | ||
103 | void PlaylistView::slotAddFile(const DocLnk&aLink) | 111 | 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 | |||
117 | void 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 | ||
124 | QString codec = m_Infolib->metaInfo(6); | 164 | QString codec = m_Infolib->metaInfo(6); |
125 | if (codec.isEmpty()) { | 165 | if (codec.isEmpty()) { |
@@ -154,17 +194,86 @@ void PlaylistView::slotAddFile(const DocLnk&aLink) | |||
154 | m_lastItem->setText(COL_TIME,codec); | 194 | m_lastItem->setText(COL_TIME,codec); |
155 | m_lastItem->Video(m_Infolib->hasVideo()); | 195 | m_lastItem->Video(m_Infolib->hasVideo()); |
156 | m_items.append(m_lastItem); | 196 | m_items.append(m_lastItem); |
197 | setSelected(m_lastItem,true); | ||
198 | } | ||
199 | |||
200 | void 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 | |||
213 | void 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 | |||
239 | void 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 | } |
158 | 257 | ||
159 | void PlaylistView::removeFromList(PlaylistItem*Item) | 258 | void PlaylistView::removeFromList(PlaylistItem*Item) |
160 | { | 259 | { |
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); |
166 | } | 268 | } |
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 | } |
169 | 278 | ||
170 | XINE::Lib*PlaylistView::getXine() | 279 | XINE::Lib*PlaylistView::getXine() |
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 | |||
@@ -86,8 +86,15 @@ public: | |||
86 | COL_TYPE=6, | 86 | COL_TYPE=6, |
87 | COL_SIZE=7 | 87 | COL_SIZE=7 |
88 | }; | 88 | }; |
89 | void addFile(const QString&aFile,const QString&aName=""); | ||
90 | signals: | ||
91 | void contentChanged(int); | ||
92 | |||
89 | public slots: | 93 | public 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 | ||
92 | protected: | 99 | protected: |
93 | void checkLib(); | 100 | void checkLib(); |
@@ -95,6 +102,7 @@ protected: | |||
95 | XINE::Lib*m_Infolib; | 102 | XINE::Lib*m_Infolib; |
96 | PlaylistItem*m_lastItem; | 103 | PlaylistItem*m_lastItem; |
97 | t_itemlist m_items; | 104 | t_itemlist m_items; |
105 | QString m_lastDir; | ||
98 | }; | 106 | }; |
99 | 107 | ||
100 | #endif | 108 | #endif |
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 | |||
@@ -19,16 +19,20 @@ VideoWidget::VideoWidget( QWidget * parent, const char * name, WFlags f) | |||
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 | ||
22 | m_PosSlider = new QSlider(QSlider::Horizontal,this); | 23 | m_PosSlider = new QSlider(QSlider::Horizontal,this); |
23 | m_PosSlider->setTickInterval(60); | 24 | m_PosSlider->setTickInterval(60); |
24 | connect(m_PosSlider,SIGNAL(valueChanged(int)),this,SLOT(slotNewPos(int))); | 25 | connect(m_PosSlider,SIGNAL(valueChanged(int)),this,SLOT(slotNewPos(int))); |
25 | connect(m_PosSlider,SIGNAL(sliderMoved(int)),this,SLOT(slotNewPos(int))); | 26 | connect(m_PosSlider,SIGNAL(sliderMoved(int)),this,SLOT(slotNewPos(int))); |
26 | connect(m_PosSlider,SIGNAL(sliderPressed()),this,SLOT(sliderPressed())); | 27 | connect(m_PosSlider,SIGNAL(sliderPressed()),this,SLOT(sliderPressed())); |
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 | } |
33 | 37 | ||
34 | VideoWidget::~VideoWidget() | 38 | VideoWidget::~VideoWidget() |
@@ -45,53 +49,70 @@ void VideoWidget::closeEvent(QCloseEvent*e) | |||
45 | { | 49 | { |
46 | } | 50 | } |
47 | 51 | ||
48 | void VideoWidget::slotNewPos(int pos) | 52 | void VideoWidget::slotNewPos(int /*pos*/) |
49 | { | 53 | { |
54 | #if 0 | ||
50 | if (!m_xineLib) return; | 55 | if (!m_xineLib) return; |
51 | if (m_uppos==pos) return; | 56 | if (m_uppos==pos) return; |
52 | m_xineLib->seekTo(pos); | 57 | m_xineLib->seekTo(pos); |
58 | #endif | ||
53 | } | 59 | } |
54 | 60 | ||
55 | void VideoWidget::sliderPressed() | 61 | void VideoWidget::sliderPressed() |
56 | { | 62 | { |
63 | #if 0 | ||
57 | m_pressed = true; | 64 | m_pressed = true; |
65 | #endif | ||
58 | } | 66 | } |
59 | 67 | ||
60 | void VideoWidget::sliderReleased() | 68 | void VideoWidget::sliderReleased() |
61 | { | 69 | { |
70 | #if 0 | ||
62 | m_pressed = false; | 71 | m_pressed = false; |
72 | #endif | ||
63 | } | 73 | } |
64 | 74 | ||
65 | void VideoWidget::fullScreen(bool how) | 75 | void VideoWidget::fullScreen(bool /* how */) |
66 | { | 76 | { |
77 | #if 0 | ||
67 | if (how) { | 78 | if (how) { |
68 | m_PosSlider->hide(); | 79 | m_PosSlider->hide(); |
69 | } else { | 80 | } else { |
70 | m_PosSlider->show(); | 81 | m_PosSlider->show(); |
71 | } | 82 | } |
83 | #endif | ||
72 | } | 84 | } |
73 | 85 | ||
74 | void VideoWidget::playFile(const DocLnk&aLnk,XINE::Lib*aLib) | 86 | int 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; |
80 | if (aLib) m_xineLib->setWidget(m_Videodisplay); | 93 | if (aLib) m_xineLib->setWidget(m_Videodisplay); |
81 | } | 94 | } |
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); |
89 | m_xineLib->setShowVideo(true); | 104 | m_xineLib->setShowVideo(true); |
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 | } |
96 | 117 | ||
97 | void VideoWidget::stopPlaying() | 118 | void VideoWidget::stopPlaying() |
@@ -114,9 +135,11 @@ void VideoWidget::slot_Videoresized(const QSize&s) | |||
114 | } | 135 | } |
115 | } | 136 | } |
116 | 137 | ||
117 | void VideoWidget::updatePos(int val) | 138 | void VideoWidget::updatePos(int /*val*/) |
118 | { | 139 | { |
140 | #if 0 | ||
119 | if (m_pressed) return; | 141 | if (m_pressed) return; |
120 | m_uppos = val; | 142 | m_uppos = 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 | |||
@@ -20,7 +20,7 @@ public: | |||
20 | VideoWidget( QWidget * parent=0, const char * name=0, WFlags f=0 ); | 20 | VideoWidget( QWidget * parent=0, const char * name=0, WFlags f=0 ); |
21 | virtual ~VideoWidget(); | 21 | virtual ~VideoWidget(); |
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); |
25 | 25 | ||
26 | signals: | 26 | signals: |
@@ -36,9 +36,11 @@ protected: | |||
36 | QVBoxLayout*m_MainLayout; | 36 | QVBoxLayout*m_MainLayout; |
37 | XineVideoWidget*m_Videodisplay; | 37 | XineVideoWidget*m_Videodisplay; |
38 | QWidget * m_holder; | 38 | QWidget * m_holder; |
39 | #if 0 | ||
39 | QSlider*m_PosSlider; | 40 | QSlider*m_PosSlider; |
40 | bool m_pressed:1; | 41 | bool m_pressed:1; |
41 | int m_uppos; | 42 | int m_uppos; |
43 | #endif | ||
42 | 44 | ||
43 | protected slots: | 45 | protected slots: |
44 | virtual void closeEvent(QCloseEvent*e); | 46 | virtual void closeEvent(QCloseEvent*e); |