author | alwin <alwin> | 2005-04-12 16:35:06 (UTC) |
---|---|---|
committer | alwin <alwin> | 2005-04-12 16:35:06 (UTC) |
commit | 4fd936e4096ba9c732bde17a48489bfbb94b19ba (patch) (unidiff) | |
tree | fa96015a24e24298c227bfa19314603debb1586d | |
parent | 6df2eb36803e072ea9db62153b762250742610f0 (diff) | |
download | opie-4fd936e4096ba9c732bde17a48489bfbb94b19ba.zip opie-4fd936e4096ba9c732bde17a48489bfbb94b19ba.tar.gz opie-4fd936e4096ba9c732bde17a48489bfbb94b19ba.tar.bz2 |
some gui stuff
may switch if videos will scaled up even if display size is larger than
video size
-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 | |||
@@ -12,135 +12,85 @@ | |||
12 | AudioWidget::AudioWidget( QWidget * parent, const char * name, WFlags f) | 12 | AudioWidget::AudioWidget( QWidget * parent, const char * name, WFlags f) |
13 | :QWidget(parent,name,f) | 13 | :QWidget(parent,name,f) |
14 | { | 14 | { |
15 | m_xineLib = 0; | 15 | m_xineLib = 0; |
16 | 16 | ||
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 | ||
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 | ||
32 | AudioWidget::~AudioWidget() | 22 | AudioWidget::~AudioWidget() |
33 | { | 23 | { |
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 | { |
70 | m_current = aLnk; | 28 | m_current = aLnk; |
71 | if (m_xineLib != aLib) { | 29 | if (m_xineLib != aLib) { |
72 | if (m_xineLib) disconnect(m_xineLib); | 30 | if (m_xineLib) disconnect(m_xineLib); |
73 | m_xineLib = aLib; | 31 | m_xineLib = aLib; |
74 | } | 32 | } |
75 | if (!m_xineLib) { | 33 | if (!m_xineLib) { |
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); |
89 | // artist | 46 | // artist |
90 | QString artist = m_xineLib->metaInfo(2); | 47 | QString artist = m_xineLib->metaInfo(2); |
91 | // album | 48 | // album |
92 | QString album = m_xineLib->metaInfo(4); | 49 | QString album = m_xineLib->metaInfo(4); |
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 | ||
132 | void AudioWidget::stopPlaying() | 87 | void AudioWidget::stopPlaying() |
133 | { | 88 | { |
134 | if (m_xineLib) { | 89 | if (m_xineLib) { |
135 | m_xineLib->stop(); | 90 | m_xineLib->stop(); |
136 | } | 91 | } |
137 | } | 92 | } |
138 | 93 | ||
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 | |||
@@ -27,22 +27,14 @@ public slots: | |||
27 | virtual void stopPlaying(); | 27 | virtual void stopPlaying(); |
28 | virtual void updatePos(int); | 28 | virtual void updatePos(int); |
29 | 29 | ||
30 | protected: | 30 | protected: |
31 | XINE::Lib*m_xineLib; | 31 | XINE::Lib*m_xineLib; |
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 | ||
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 | ||
48 | #endif | 40 | #endif |
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 | |||
@@ -55,55 +55,63 @@ | |||
55 | 55 | ||
56 | OPIE_EXPORT_APP( Opie::Core::OApplicationFactory<PMainWindow>) | 56 | OPIE_EXPORT_APP( Opie::Core::OApplicationFactory<PMainWindow>) |
57 | 57 | ||
58 | using namespace Opie::Ui; | 58 | using namespace Opie::Ui; |
59 | 59 | ||
60 | PMainWindow::PMainWindow(QWidget*w, const char*name, WFlags f) | 60 | 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 | ||
65 | m_MainBox = new QWidget(this); | 66 | m_MainBox = new QWidget(this); |
66 | 67 | ||
67 | QVBoxLayout*m_l = new QVBoxLayout(m_MainBox); | 68 | QVBoxLayout*m_l = new QVBoxLayout(m_MainBox); |
68 | 69 | ||
69 | m_stack = new OWidgetStack(m_MainBox); | 70 | m_stack = new OWidgetStack(m_MainBox); |
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"); |
77 | m_stack->addWidget(m_playList,stack_list); | 78 | m_stack->addWidget(m_playList,stack_list); |
78 | connect(m_playList,SIGNAL(contentChanged(int)),this,SLOT(slotListChanged(int))); | 79 | connect(m_playList,SIGNAL(contentChanged(int)),this,SLOT(slotListChanged(int))); |
79 | m_sfl = new OFileSelector("video/*;audio/*",m_stack); | 80 | m_sfl = new OFileSelector("video/*;audio/*",m_stack); |
80 | m_stack->addWidget(m_sfl,stack_file); | 81 | m_stack->addWidget(m_sfl,stack_file); |
81 | connect(m_sfl, SIGNAL(fileSelected(const DocLnk &)), m_playList, SLOT(slotAddFile(const DocLnk &))); | 82 | connect(m_sfl, SIGNAL(fileSelected(const DocLnk &)), m_playList, SLOT(slotAddFile(const DocLnk &))); |
82 | m_AudioPlayer = new AudioWidget(m_stack); | 83 | m_AudioPlayer = new AudioWidget(m_stack); |
83 | m_stack->addWidget(m_AudioPlayer,stack_audio); | 84 | m_stack->addWidget(m_AudioPlayer,stack_audio); |
84 | connect(this,SIGNAL(sigPos(int)),m_AudioPlayer,SLOT(updatePos(int))); | 85 | connect(this,SIGNAL(sigPos(int)),m_AudioPlayer,SLOT(updatePos(int))); |
85 | m_VideoPlayer = new VideoWidget(m_stack); | 86 | m_VideoPlayer = new VideoWidget(m_stack); |
86 | m_stack->addWidget(m_VideoPlayer,stack_video); | 87 | m_stack->addWidget(m_VideoPlayer,stack_video); |
87 | connect(this,SIGNAL(sigPos(int)),m_VideoPlayer,SLOT(updatePos(int))); | 88 | connect(this,SIGNAL(sigPos(int)),m_VideoPlayer,SLOT(updatePos(int))); |
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(); |
94 | setupToolBar(); | 101 | setupToolBar(); |
95 | setupMenu(); | 102 | setupMenu(); |
96 | 103 | ||
97 | setCentralWidget(m_MainBox ); | 104 | setCentralWidget(m_MainBox ); |
98 | } | 105 | } |
99 | 106 | ||
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; |
104 | } | 112 | } |
105 | a_removeFiles->setEnabled(count>0); | 113 | a_removeFiles->setEnabled(count>0); |
106 | } | 114 | } |
107 | 115 | ||
108 | void PMainWindow::mediaWindowraised() | 116 | void PMainWindow::mediaWindowraised() |
109 | { | 117 | { |
@@ -112,18 +120,19 @@ void PMainWindow::mediaWindowraised() | |||
112 | a_loadPlaylist->setEnabled(true); | 120 | a_loadPlaylist->setEnabled(true); |
113 | a_showPlaylist->setEnabled(true); | 121 | a_showPlaylist->setEnabled(true); |
114 | a_ShowMedia->setEnabled(false); | 122 | a_ShowMedia->setEnabled(false); |
115 | } | 123 | } |
116 | 124 | ||
117 | void PMainWindow::checkLib() | 125 | 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 | } |
124 | } | 133 | } |
125 | 134 | ||
126 | PMainWindow::~PMainWindow() | 135 | PMainWindow::~PMainWindow() |
127 | { | 136 | { |
128 | if (m_PlayLib) { | 137 | if (m_PlayLib) { |
129 | m_PlayLib->stop(); | 138 | m_PlayLib->stop(); |
@@ -194,17 +203,17 @@ void PMainWindow::slotPlayList() | |||
194 | slotPlayCurrent(); | 203 | slotPlayCurrent(); |
195 | } | 204 | } |
196 | 205 | ||
197 | void PMainWindow::slotUserStop() | 206 | void PMainWindow::slotUserStop() |
198 | { | 207 | { |
199 | if (!m_playing || !m_PlayLib) return; | 208 | if (!m_playing || !m_PlayLib) return; |
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(); |
205 | } | 214 | } |
206 | 215 | ||
207 | void PMainWindow::slotTogglePlay(bool how) | 216 | void PMainWindow::slotTogglePlay(bool how) |
208 | { | 217 | { |
209 | if (how == m_playing) { | 218 | if (how == m_playing) { |
210 | if (how) { | 219 | if (how) { |
@@ -226,26 +235,26 @@ void PMainWindow::hideVideo() | |||
226 | m_VideoPlayer->hide(); | 235 | m_VideoPlayer->hide(); |
227 | } | 236 | } |
228 | } | 237 | } |
229 | 238 | ||
230 | void PMainWindow::slotPlayCurrent() | 239 | void PMainWindow::slotPlayCurrent() |
231 | { | 240 | { |
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(); |
237 | slotShowList(); | 246 | slotShowList(); |
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()) { |
246 | hideVideo(); | 255 | hideVideo(); |
247 | m_playing = true; | 256 | m_playing = true; |
248 | m_stack->raiseWidget(stack_audio); | 257 | m_stack->raiseWidget(stack_audio); |
249 | result = m_AudioPlayer->playFile(m_LastItem->Lnk(),m_PlayLib); | 258 | result = m_AudioPlayer->playFile(m_LastItem->Lnk(),m_PlayLib); |
250 | } else { | 259 | } else { |
251 | m_playing = true; | 260 | m_playing = true; |
@@ -253,19 +262,19 @@ void PMainWindow::slotPlayCurrent() | |||
253 | result = m_VideoPlayer->playFile(m_LastItem->Lnk(),m_PlayLib); | 262 | result = m_VideoPlayer->playFile(m_LastItem->Lnk(),m_PlayLib); |
254 | } | 263 | } |
255 | if (result<0) { | 264 | if (result<0) { |
256 | // fehler | 265 | // fehler |
257 | return; | 266 | return; |
258 | } | 267 | } |
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 | } |
266 | 275 | ||
267 | void PMainWindow::slotPlayNext() | 276 | void PMainWindow::slotPlayNext() |
268 | { | 277 | { |
269 | PlaylistItem*item = m_playList->nextItem(m_LastItem); | 278 | PlaylistItem*item = m_playList->nextItem(m_LastItem); |
270 | if (!item) return; | 279 | if (!item) return; |
271 | m_LastItem = item; | 280 | m_LastItem = item; |
@@ -284,25 +293,29 @@ void PMainWindow::slotPlayPrevious() | |||
284 | if (!item) return; | 293 | if (!item) return; |
285 | m_LastItem = item; | 294 | m_LastItem = item; |
286 | slotPlayCurrent(); | 295 | slotPlayCurrent(); |
287 | } | 296 | } |
288 | 297 | ||
289 | void PMainWindow::slotStopped() | 298 | 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(); |
294 | } | 304 | } |
295 | 305 | ||
296 | void PMainWindow::slotCheckPos() | 306 | 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 | } |
303 | 316 | ||
304 | void PMainWindow::slotRemoveFiles() | 317 | void PMainWindow::slotRemoveFiles() |
305 | { | 318 | { |
306 | if (m_playing||!m_playList->isVisible()) return; | 319 | if (m_playing||!m_playList->isVisible()) return; |
307 | PlaylistItem* Item = m_playList->currentItem(); | 320 | PlaylistItem* Item = m_playList->currentItem(); |
308 | slotShowList(); | 321 | slotShowList(); |
@@ -310,19 +323,19 @@ void PMainWindow::slotRemoveFiles() | |||
310 | } | 323 | } |
311 | 324 | ||
312 | void PMainWindow::setupActions() | 325 | void PMainWindow::setupActions() |
313 | { | 326 | { |
314 | a_appendFiles = new QAction(tr("Append file(s)"),Resource::loadIconSet( "opieplayer2/add_to_playlist" ), 0, 0, this, 0, false ); | 327 | a_appendFiles = new QAction(tr("Append file(s)"),Resource::loadIconSet( "opieplayer2/add_to_playlist" ), 0, 0, this, 0, false ); |
315 | connect(a_appendFiles,SIGNAL(activated()),this,SLOT(slotAppendFiles())); | 328 | 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); | 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 | ||
323 | playlistOnly = new QActionGroup(this,"playlistgroup",false); | 336 | playlistOnly = new QActionGroup(this,"playlistgroup",false); |
324 | playlistOnly->insert(a_appendFiles); | 337 | playlistOnly->insert(a_appendFiles); |
325 | playlistOnly->insert(a_addDir); | 338 | playlistOnly->insert(a_addDir); |
326 | playlistOnly->insert(a_loadPlaylist); | 339 | playlistOnly->insert(a_loadPlaylist); |
327 | playlistOnly->insert(a_savePlaylist); | 340 | playlistOnly->insert(a_savePlaylist); |
328 | 341 | ||
@@ -346,20 +359,28 @@ void PMainWindow::setupActions() | |||
346 | connect(a_playPrevious,SIGNAL(activated()),this,SLOT(slotPlayPrevious())); | 359 | connect(a_playPrevious,SIGNAL(activated()),this,SLOT(slotPlayPrevious())); |
347 | a_ShowFull = new QAction(tr("Show videos fullscreen"),Resource::loadIconSet( "fullscreen" ), 0, 0, this, 0, true ); | 360 | a_ShowFull = new QAction(tr("Show videos fullscreen"),Resource::loadIconSet( "fullscreen" ), 0, 0, this, 0, true ); |
348 | connect(a_ShowFull,SIGNAL(toggled(bool)),this,SLOT(slotToggleFull(bool))); | 361 | connect(a_ShowFull,SIGNAL(toggled(bool)),this,SLOT(slotToggleFull(bool))); |
349 | 362 | ||
350 | playersGroup->insert(a_playPrevious); | 363 | playersGroup->insert(a_playPrevious); |
351 | playersGroup->insert(a_playAction); | 364 | playersGroup->insert(a_playAction); |
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 | ||
360 | void PMainWindow::setupToolBar() | 381 | void PMainWindow::setupToolBar() |
361 | { | 382 | { |
362 | setToolBarsMovable( false ); | 383 | setToolBarsMovable( false ); |
363 | m_toolBar = new QToolBar( this ); | 384 | m_toolBar = new QToolBar( this ); |
364 | //m_menuBar = new QMenuBar(m_toolBar); | 385 | //m_menuBar = new QMenuBar(m_toolBar); |
365 | m_menuBar=menuBar(); | 386 | m_menuBar=menuBar(); |
@@ -422,11 +443,35 @@ void PMainWindow::setupMenu() | |||
422 | 443 | ||
423 | dispMenu = new QPopupMenu( m_menuBar ); | 444 | dispMenu = new QPopupMenu( m_menuBar ); |
424 | m_menuBar->insertItem( tr( "Show" ), dispMenu ); | 445 | m_menuBar->insertItem( tr( "Show" ), dispMenu ); |
425 | a_showPlaylist->addTo(dispMenu); | 446 | a_showPlaylist->addTo(dispMenu); |
426 | a_ShowMedia->addTo(dispMenu); | 447 | a_ShowMedia->addTo(dispMenu); |
427 | a_ShowFull->addTo(dispMenu); | 448 | a_ShowFull->addTo(dispMenu); |
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 | |||
@@ -77,35 +77,38 @@ protected: | |||
77 | static const int stack_audio = 2; | 77 | static const int stack_audio = 2; |
78 | static const int stack_video = 3; | 78 | static const int stack_video = 3; |
79 | Opie::Ui::OWidgetStack *m_stack; | 79 | Opie::Ui::OWidgetStack *m_stack; |
80 | Opie::Ui::OFileSelector*m_sfl; | 80 | Opie::Ui::OFileSelector*m_sfl; |
81 | PlaylistView*m_playList; | 81 | PlaylistView*m_playList; |
82 | AudioWidget*m_AudioPlayer; | 82 | AudioWidget*m_AudioPlayer; |
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; |
95 | 96 | ||
96 | void setupActions(); | 97 | void setupActions(); |
97 | void setupToolBar(); | 98 | void setupToolBar(); |
98 | void setupMenu(); | 99 | void setupMenu(); |
99 | void checkLib(); | 100 | void checkLib(); |
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; |
106 | void mediaWindowraised(); | 109 | void mediaWindowraised(); |
107 | 110 | ||
108 | protected slots: | 111 | protected slots: |
109 | virtual void fileSelected(const DocLnk&); | 112 | virtual void fileSelected(const DocLnk&); |
110 | virtual void slotAppendFiles(); | 113 | virtual void slotAppendFiles(); |
111 | virtual void slotRemoveFiles(); | 114 | virtual void slotRemoveFiles(); |
@@ -117,14 +120,19 @@ protected slots: | |||
117 | virtual void slotStopped(); | 120 | virtual void slotStopped(); |
118 | virtual void slotCheckPos(); | 121 | virtual void slotCheckPos(); |
119 | virtual void slotToggleFull(bool); | 122 | virtual void slotToggleFull(bool); |
120 | virtual void slotUserStop(); | 123 | virtual void slotUserStop(); |
121 | virtual void slotGoNext(); | 124 | virtual void slotGoNext(); |
122 | virtual void slotTogglePlay(bool); | 125 | virtual void slotTogglePlay(bool); |
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: |
127 | void sigPos(int); | 135 | void sigPos(int); |
128 | }; | 136 | }; |
129 | 137 | ||
130 | #endif | 138 | #endif |
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 | |||
@@ -99,38 +99,49 @@ PlaylistView::~PlaylistView() | |||
99 | { | 99 | { |
100 | if (m_Infolib) delete m_Infolib; | 100 | if (m_Infolib) delete m_Infolib; |
101 | } | 101 | } |
102 | 102 | ||
103 | void PlaylistView::checkLib() | 103 | void PlaylistView::checkLib() |
104 | { | 104 | { |
105 | if (!m_Infolib) { | 105 | if (!m_Infolib) { |
106 | m_Infolib = new XINE::Lib(XINE::Lib::InitializeImmediately); | 106 | m_Infolib = new XINE::Lib(XINE::Lib::InitializeImmediately); |
107 | connect(m_Infolib,SIGNAL(stopped()),this,SLOT(slotDummyStop())); | ||
107 | 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 | } |
116 | 127 | ||
117 | void PlaylistView::addFile(const QString&aFile,const QString&aName) | 128 | void PlaylistView::addFile(const QString&aFile,const QString&aName) |
118 | { | 129 | { |
119 | QFileInfo fileInfo(aFile); | 130 | QFileInfo fileInfo(aFile); |
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()) { |
126 | name = fileInfo.fileName(); | 135 | name = fileInfo.fileName(); |
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) { |
131 | i = m_Infolib->error(); | 142 | i = m_Infolib->error(); |
132 | odebug << "Errorcode: " << i << oendl; | 143 | odebug << "Errorcode: " << i << oendl; |
133 | QString msg; | 144 | QString msg; |
134 | msg = QString(tr("Error open file %1: ")).arg(name); | 145 | msg = QString(tr("Error open file %1: ")).arg(name); |
135 | switch (i) { | 146 | switch (i) { |
136 | case 1: | 147 | case 1: |
@@ -175,25 +186,19 @@ void PlaylistView::addFile(const QString&aFile,const QString&aName) | |||
175 | m_lastItem->setText(COL_ALBUM,m_Infolib->metaInfo(4)); | 186 | m_lastItem->setText(COL_ALBUM,m_Infolib->metaInfo(4)); |
176 | int l = m_Infolib->length(); | 187 | int l = m_Infolib->length(); |
177 | int h = l/3600; | 188 | int h = l/3600; |
178 | l-=h*3600; | 189 | l-=h*3600; |
179 | int m = l/60; | 190 | int m = l/60; |
180 | l-=m*60; | 191 | l-=m*60; |
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 |
194 | m_lastItem->setText(COL_TIME,codec); | 199 | m_lastItem->setText(COL_TIME,codec); |
195 | m_lastItem->Video(m_Infolib->hasVideo()); | 200 | m_lastItem->Video(m_Infolib->hasVideo()); |
196 | m_items.append(m_lastItem); | 201 | m_items.append(m_lastItem); |
197 | setSelected(m_lastItem,true); | 202 | setSelected(m_lastItem,true); |
198 | } | 203 | } |
199 | 204 | ||
@@ -211,45 +216,50 @@ void PlaylistView::slotAppendDir() | |||
211 | } | 216 | } |
212 | 217 | ||
213 | void PlaylistView::slotOpenM3u() | 218 | void PlaylistView::slotOpenM3u() |
214 | { | 219 | { |
215 | QStringList types; | 220 | QStringList types; |
216 | QMap<QString, QStringList> mimeTypes; | 221 | QMap<QString, QStringList> mimeTypes; |
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); |
222 | if (fileName.isEmpty()) { | 227 | if (fileName.isEmpty()) { |
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 | ||
227 | Om3u _om3u(fileName, IO_ReadOnly); | 238 | Om3u _om3u(fileName, IO_ReadOnly); |
228 | if (f.extension(FALSE).lower()=="m3u") { | 239 | if (f.extension(FALSE).lower()=="m3u") { |
229 | _om3u.readM3u(); | 240 | _om3u.readM3u(); |
230 | } else if (f.extension(FALSE).lower()=="pls") { | 241 | } else if (f.extension(FALSE).lower()=="pls") { |
231 | _om3u.readPls(); | 242 | _om3u.readPls(); |
232 | } | 243 | } |
233 | for (unsigned int j=0; j<_om3u.count();++j) { | 244 | for (unsigned int j=0; j<_om3u.count();++j) { |
234 | addFile(_om3u[j]); | 245 | addFile(_om3u[j]); |
235 | } | 246 | } |
236 | emit contentChanged(childCount()); | ||
237 | } | 247 | } |
238 | 248 | ||
239 | void PlaylistView::slotSaveAsM3u() | 249 | void PlaylistView::slotSaveAsM3u() |
240 | { | 250 | { |
241 | QStringList types; | 251 | QStringList types; |
242 | QMap<QString, QStringList> mimeTypes; | 252 | QMap<QString, QStringList> mimeTypes; |
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; |
250 | } | 260 | } |
251 | Om3u _om3u(fileName, IO_ReadWrite | IO_Truncate); | 261 | Om3u _om3u(fileName, IO_ReadWrite | IO_Truncate); |
252 | for (unsigned j=0; j<m_items.count();++j) { | 262 | for (unsigned j=0; j<m_items.count();++j) { |
253 | _om3u.add(m_items[j]->Lnk().file()); | 263 | _om3u.add(m_items[j]->Lnk().file()); |
254 | } | 264 | } |
255 | _om3u.write(); | 265 | _om3u.write(); |
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 | |||
@@ -90,19 +90,21 @@ public: | |||
90 | signals: | 90 | signals: |
91 | void contentChanged(int); | 91 | void contentChanged(int); |
92 | 92 | ||
93 | public slots: | 93 | public slots: |
94 | virtual void slotAddFile(const DocLnk&); | 94 | virtual void slotAddFile(const DocLnk&); |
95 | virtual void slotAppendDir(); | 95 | virtual void slotAppendDir(); |
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; |
103 | PlaylistItem*m_lastItem; | 105 | PlaylistItem*m_lastItem; |
104 | t_itemlist m_items; | 106 | t_itemlist m_items; |
105 | QString m_lastDir; | 107 | QString m_lastDir; |
106 | }; | 108 | }; |
107 | 109 | ||
108 | #endif | 110 | #endif |
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 | |||
@@ -10,136 +10,91 @@ | |||
10 | #include <qlayout.h> | 10 | #include <qlayout.h> |
11 | #include <qslider.h> | 11 | #include <qslider.h> |
12 | #include <qlabel.h> | 12 | #include <qlabel.h> |
13 | 13 | ||
14 | VideoWidget::VideoWidget( QWidget * parent, const char * name, WFlags f) | 14 | VideoWidget::VideoWidget( QWidget * parent, const char * name, WFlags f) |
15 | :QWidget(parent,name,f) | 15 | :QWidget(parent,name,f) |
16 | { | 16 | { |
17 | m_xineLib = 0; | 17 | m_xineLib = 0; |
18 | 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 | ||
38 | VideoWidget::~VideoWidget() | 26 | VideoWidget::~VideoWidget() |
39 | { | 27 | { |
40 | } | 28 | } |
41 | 29 | ||
42 | void VideoWidget::slotClicked() | 30 | void VideoWidget::slotClicked() |
43 | { | 31 | { |
44 | odebug << "clicked " << oendl; | ||
45 | emit videoclicked(); | 32 | emit videoclicked(); |
46 | } | 33 | } |
47 | 34 | ||
48 | void VideoWidget::closeEvent(QCloseEvent*e) | 35 | void VideoWidget::closeEvent(QCloseEvent*e) |
49 | { | 36 | { |
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 | ||
86 | int VideoWidget::playFile(const DocLnk&aLnk,XINE::Lib*aLib) | 43 | int VideoWidget::playFile(const DocLnk&aLnk,XINE::Lib*aLib) |
87 | { | 44 | { |
88 | m_current = aLnk; | 45 | m_current = aLnk; |
89 | bool recon; | 46 | bool recon; |
90 | if (m_xineLib != aLib) { | 47 | if (m_xineLib != aLib) { |
91 | if (m_xineLib) disconnect(m_xineLib); | 48 | if (m_xineLib) disconnect(m_xineLib); |
92 | m_xineLib = aLib; | 49 | m_xineLib = aLib; |
93 | if (aLib) m_xineLib->setWidget(m_Videodisplay); | 50 | if (aLib) m_xineLib->setWidget(m_Videodisplay); |
94 | } | 51 | } |
95 | if (!m_xineLib) { | 52 | if (!m_xineLib) { |
96 | return -1; | 53 | return -1; |
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) { |
109 | return -2; | 63 | return -2; |
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 | ||
118 | void VideoWidget::stopPlaying() | 68 | void VideoWidget::stopPlaying() |
119 | { | 69 | { |
120 | if (m_xineLib) { | 70 | if (m_xineLib) { |
121 | m_xineLib->stop(); | 71 | m_xineLib->stop(); |
122 | } | 72 | } |
123 | } | 73 | } |
124 | 74 | ||
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 | |||
@@ -17,39 +17,34 @@ class VideoWidget:public QWidget | |||
17 | { | 17 | { |
18 | Q_OBJECT | 18 | Q_OBJECT |
19 | public: | 19 | 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 | 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: |
27 | void videoclicked(); | 28 | void videoclicked(); |
28 | 29 | ||
29 | public slots: | 30 | public slots: |
30 | virtual void stopPlaying(); | 31 | virtual void stopPlaying(); |
31 | virtual void updatePos(int); | 32 | virtual void updatePos(int); |
32 | 33 | ||
33 | protected: | 34 | protected: |
34 | XINE::Lib*m_xineLib; | 35 | XINE::Lib*m_xineLib; |
35 | DocLnk m_current; | 36 | DocLnk m_current; |
36 | QVBoxLayout*m_MainLayout; | 37 | QVBoxLayout*m_MainLayout; |
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(); |
52 | virtual void slotClicked(); | 47 | virtual void slotClicked(); |
53 | }; | 48 | }; |
54 | 49 | ||
55 | #endif | 50 | #endif |