author | alwin <alwin> | 2005-04-10 22:18:50 (UTC) |
---|---|---|
committer | alwin <alwin> | 2005-04-10 22:18:50 (UTC) |
commit | 840e44417402bbc6048ca5e8ff3dd6be966e753f (patch) (unidiff) | |
tree | 61ca099945cff3c995ddf348149cd2690ee17c97 | |
parent | ad2f1bd57cbfb0fdaf4d348ee3a70d3ea370d5d1 (diff) | |
download | opie-840e44417402bbc6048ca5e8ff3dd6be966e753f.zip opie-840e44417402bbc6048ca5e8ff3dd6be966e753f.tar.gz opie-840e44417402bbc6048ca5e8ff3dd6be966e753f.tar.bz2 |
added opieplayer3
this moment not just more than another container around xine like opieplayer2
(and uses a lot of code direct from there)
difference: first it was a testcontainer to find the bugs in player2
now it is a player looks more like kino2 (eg, no stylesheets) so it
has a real resizeable video-display. early stage (saving playlists and so on
doesn't work) - but it can display videos on my C860 in bigger box than this
small stamp like player2 ;)
-rw-r--r-- | apps/Applications/opieplayer3.desktop | 30 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer3/audiowidget.cpp | 125 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer3/audiowidget.h | 46 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer3/config.in | 6 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer3/mwindow.cpp | 320 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer3/mwindow.h | 120 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer3/opieplayer3.pro | 26 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer3/playlist.cpp | 210 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer3/playlist.h | 100 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer3/videowidget.cpp | 122 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer3/videowidget.h | 53 | ||||
-rw-r--r-- | packages | 1 |
12 files changed, 1159 insertions, 0 deletions
diff --git a/apps/Applications/opieplayer3.desktop b/apps/Applications/opieplayer3.desktop new file mode 100644 index 0000000..cc2574d --- a/dev/null +++ b/apps/Applications/opieplayer3.desktop | |||
@@ -0,0 +1,30 @@ | |||
1 | [Desktop Entry] | ||
2 | Exec=opie-mediaplayer3 | ||
3 | Icon=opieplayer2/OpiePlayer | ||
4 | MimeType=audio/mpeg;audio/x-wav;audio/x-mpegurl;audio/x-ogg;video/x-ogm;video/x-ms-asf;video/quicktime;video/mpeg;video/x-msvideo;playlist/plain; | ||
5 | MimeTypeIcons=Sound;Sound;Sound;Sound;MPEGPlayer;MPEGPlayer;MPEGPlayer;MPEGPlayer;MPEGPlayer;opieplayer2/playlist2 | ||
6 | Type=Application | ||
7 | Name=Opie Media Player 3 | ||
8 | Comment=A Media Player | ||
9 | Name[da]=Opie Player 3 | ||
10 | Comment[da]=En medie-afspiller | ||
11 | Name[de]=Media Player 3 | ||
12 | Comment[de]=Ein Abspielprogramm fuer Multimediadateien | ||
13 | Name[es]=Multimedia | ||
14 | Comment[es]=Reproductor de ficheros multimedia | ||
15 | Name[fr]=Opie Media Player 3 | ||
16 | Comment[fr]=Lecteur multimédia | ||
17 | Name[it]=Lettore Multimediale 3 | ||
18 | Comment[it]=Lettore di file multimediali | ||
19 | Name[pt]=Multimédia | ||
20 | Comment[pt]=Leitor de ficheiros multimédia | ||
21 | Name[pt_BR]=Leitor multimédia | ||
22 | Comment[pt_BR]=Leitor de ficheiros multimédia | ||
23 | Name[sl]=Večpredstavnostni predvajalnik | ||
24 | Comment[sl]=Večpredstavnostni predvajalnik | ||
25 | Name[nl]=Mediaspeler | ||
26 | Comment[nl]=Speler voor Audio en Filmpjes | ||
27 | Name[lv]=Medijuplejeris | ||
28 | Comment[lv]=Programma Audio failu atskaņošanai | ||
29 | Name[ru]=Медиаплеер Opie | ||
30 | Comment[ru]=Медиаплеер | ||
diff --git a/noncore/multimedia/opieplayer3/audiowidget.cpp b/noncore/multimedia/opieplayer3/audiowidget.cpp new file mode 100644 index 0000000..7ba6274 --- a/dev/null +++ b/noncore/multimedia/opieplayer3/audiowidget.cpp | |||
@@ -0,0 +1,125 @@ | |||
1 | #include "audiowidget.h" | ||
2 | #include "../opieplayer2/lib.h" | ||
3 | #include "../opieplayer2/threadutil.h" | ||
4 | |||
5 | #include <opie2/odebug.h> | ||
6 | |||
7 | #include <qlayout.h> | ||
8 | #include <qtextview.h> | ||
9 | #include <qslider.h> | ||
10 | #include <qlabel.h> | ||
11 | |||
12 | AudioWidget::AudioWidget( QWidget * parent, const char * name, WFlags f) | ||
13 | :QWidget(parent,name,f) | ||
14 | { | ||
15 | m_xineLib = 0; | ||
16 | |||
17 | m_MainLayout = new QVBoxLayout(this); | ||
18 | m_MainLayout->setAutoAdd(true); | ||
19 | m_InfoBox = new QTextView(this); | ||
20 | m_PosSlider = new QSlider(QSlider::Horizontal,this); | ||
21 | m_PosSlider->setTickInterval(60); | ||
22 | connect(m_PosSlider,SIGNAL(valueChanged(int)),this,SLOT(slotNewPos(int))); | ||
23 | connect(m_PosSlider,SIGNAL(sliderMoved(int)),this,SLOT(slotNewPos(int))); | ||
24 | connect(m_PosSlider,SIGNAL(sliderPressed()),this,SLOT(sliderPressed())); | ||
25 | connect(m_PosSlider,SIGNAL(sliderReleased()),this,SLOT(sliderReleased())); | ||
26 | m_pressed = false; | ||
27 | m_uppos=0; | ||
28 | } | ||
29 | |||
30 | AudioWidget::~AudioWidget() | ||
31 | { | ||
32 | } | ||
33 | |||
34 | void AudioWidget::slotNewPos(int pos) | ||
35 | { | ||
36 | if (!m_xineLib) return; | ||
37 | if (m_uppos==pos) return; | ||
38 | m_xineLib->seekTo(pos); | ||
39 | } | ||
40 | |||
41 | void AudioWidget::sliderPressed() | ||
42 | { | ||
43 | m_pressed = true; | ||
44 | } | ||
45 | |||
46 | void AudioWidget::sliderReleased() | ||
47 | { | ||
48 | m_pressed = false; | ||
49 | } | ||
50 | |||
51 | void AudioWidget::closeEvent(QCloseEvent*e) | ||
52 | { | ||
53 | odebug << "AudioWidget::closeEvent(QCloseEvent*e)" << oendl; | ||
54 | if (m_xineLib) { | ||
55 | m_xineLib->stop(); | ||
56 | } | ||
57 | QWidget::closeEvent(e); | ||
58 | } | ||
59 | |||
60 | void AudioWidget::playFile(const DocLnk&aLnk,XINE::Lib*aLib) | ||
61 | { | ||
62 | m_current = aLnk; | ||
63 | if (m_xineLib != aLib) { | ||
64 | disconnect(m_xineLib); | ||
65 | m_xineLib = aLib; | ||
66 | } | ||
67 | if (!m_xineLib) { | ||
68 | return; | ||
69 | } | ||
70 | m_uppos=0; | ||
71 | m_PosSlider->setValue(0); | ||
72 | m_xineLib->setShowVideo(false); | ||
73 | m_xineLib->play(m_current.file()); | ||
74 | // title | ||
75 | QString title = m_xineLib->metaInfo(0); | ||
76 | // artist | ||
77 | QString artist = m_xineLib->metaInfo(2); | ||
78 | // album | ||
79 | QString album = m_xineLib->metaInfo(4); | ||
80 | |||
81 | int l = m_xineLib->length(); | ||
82 | m_PosSlider->setRange(0,l); | ||
83 | QString laenge=""; | ||
84 | int h = l/3600; | ||
85 | l-=h*3600; | ||
86 | int m = l/60; | ||
87 | l-=m*60; | ||
88 | if (h>0) { | ||
89 | laenge+=QString("%1 h").arg(h); | ||
90 | } | ||
91 | if (m>0) { | ||
92 | if (!laenge.isEmpty()) laenge+=" "; | ||
93 | laenge+=QString("%1 m").arg(m); | ||
94 | } | ||
95 | if (l>0) { | ||
96 | if (!laenge.isEmpty()) laenge+=" "; | ||
97 | laenge+=QString("%1 s").arg(l); | ||
98 | } | ||
99 | QString text = "<qt>"; | ||
100 | if (artist.length()) { | ||
101 | text+="<H2><center>"+artist+"</center></h2>"; | ||
102 | } | ||
103 | if (title.length()) { | ||
104 | text+="<H2><center>"+title+"</center></h2>"; | ||
105 | } | ||
106 | if (album.length()) { | ||
107 | text+="<H2><center>"+album+"</center></h2>"; | ||
108 | } | ||
109 | text+="<h3><center>"+laenge+"</center></h3>"; | ||
110 | m_InfoBox->setText(text); | ||
111 | } | ||
112 | |||
113 | void AudioWidget::stopPlaying() | ||
114 | { | ||
115 | if (m_xineLib) { | ||
116 | m_xineLib->stop(); | ||
117 | } | ||
118 | } | ||
119 | |||
120 | void AudioWidget::updatePos(int val) | ||
121 | { | ||
122 | if (m_pressed) return; | ||
123 | m_uppos = val; | ||
124 | m_PosSlider->setValue(val); | ||
125 | } | ||
diff --git a/noncore/multimedia/opieplayer3/audiowidget.h b/noncore/multimedia/opieplayer3/audiowidget.h new file mode 100644 index 0000000..07b51b6 --- a/dev/null +++ b/noncore/multimedia/opieplayer3/audiowidget.h | |||
@@ -0,0 +1,46 @@ | |||
1 | #ifndef _audiowidget_h | ||
2 | #define _audiowidget_h | ||
3 | |||
4 | #include <qwidget.h> | ||
5 | |||
6 | #include <qpe/applnk.h> | ||
7 | |||
8 | namespace XINE { | ||
9 | class Lib; | ||
10 | } | ||
11 | |||
12 | class QVBoxLayout; | ||
13 | class QTextView; | ||
14 | class QSlider; | ||
15 | class QLabel; | ||
16 | |||
17 | class AudioWidget:public QWidget | ||
18 | { | ||
19 | Q_OBJECT | ||
20 | public: | ||
21 | AudioWidget( QWidget * parent=0, const char * name=0, WFlags f=0 ); | ||
22 | virtual ~AudioWidget(); | ||
23 | |||
24 | void playFile(const DocLnk&,XINE::Lib*); | ||
25 | |||
26 | public slots: | ||
27 | virtual void stopPlaying(); | ||
28 | virtual void updatePos(int); | ||
29 | |||
30 | protected: | ||
31 | XINE::Lib*m_xineLib; | ||
32 | DocLnk m_current; | ||
33 | QVBoxLayout*m_MainLayout; | ||
34 | QTextView*m_InfoBox; | ||
35 | QSlider*m_PosSlider; | ||
36 | bool m_pressed; | ||
37 | int m_uppos; | ||
38 | |||
39 | protected slots: | ||
40 | virtual void closeEvent(QCloseEvent*e); | ||
41 | virtual void slotNewPos(int pos); | ||
42 | virtual void sliderPressed(); | ||
43 | virtual void sliderReleased(); | ||
44 | }; | ||
45 | |||
46 | #endif | ||
diff --git a/noncore/multimedia/opieplayer3/config.in b/noncore/multimedia/opieplayer3/config.in new file mode 100644 index 0000000..f2465a8 --- a/dev/null +++ b/noncore/multimedia/opieplayer3/config.in | |||
@@ -0,0 +1,6 @@ | |||
1 | config OPIEPLAYER3 | ||
2 | boolean "opieplayer3 (multimedia player based on libxine)" | ||
3 | default "n" | ||
4 | depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE && LIBOPIE2UI && LIBXINE_DEP | ||
5 | comment "opieplayer2 requires libopie2core, libopie2ui and libxine" | ||
6 | depends !( ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE && LIBOPIE2UI && LIBXINE_DEP ) | ||
diff --git a/noncore/multimedia/opieplayer3/mwindow.cpp b/noncore/multimedia/opieplayer3/mwindow.cpp new file mode 100644 index 0000000..dab910a --- a/dev/null +++ b/noncore/multimedia/opieplayer3/mwindow.cpp | |||
@@ -0,0 +1,320 @@ | |||
1 | /* | ||
2 | This file is part of the Opie Project | ||
3 | |||
4 | Copyright (c) 2002 Max Reiss <harlekin@handhelds.org> | ||
5 | Copyright (c) 2002 L. Potter <ljp@llornkcor.com> | ||
6 | Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> | ||
7 | =. | ||
8 | .=l. | ||
9 | .>+-= | ||
10 | _;:, .> :=|. This program is free software; you can | ||
11 | .> <`_, > . <= redistribute it and/or modify it under | ||
12 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | ||
13 | .="- .-=="i, .._ License as published by the Free Software | ||
14 | - . .-<_> .<> Foundation; either version 2 of the License, | ||
15 | ._= =} : or (at your option) any later version. | ||
16 | .%`+i> _;_. | ||
17 | .i_,=:_. -<s. This program is distributed in the hope that | ||
18 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | ||
19 | : .. .:, . . . without even the implied warranty of | ||
20 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
21 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | ||
22 | ..}^=.= = ; Library General Public License for more | ||
23 | ++= -. .` .: details. | ||
24 | : = ...= . :.=- | ||
25 | -. .:....=;==+<; You should have received a copy of the GNU | ||
26 | -_. . . )=. = Library General Public License along with | ||
27 | -- :-=` this library; see the file COPYING.LIB. | ||
28 | If not, write to the Free Software Foundation, | ||
29 | Inc., 59 Temple Place - Suite 330, | ||
30 | Boston, MA 02111-1307, USA. | ||
31 | |||
32 | */ | ||
33 | |||
34 | #include "mwindow.h" | ||
35 | #include "playlist.h" | ||
36 | #include "audiowidget.h" | ||
37 | #include "videowidget.h" | ||
38 | #include "../opieplayer2/lib.h" | ||
39 | |||
40 | #include <opie2/oapplicationfactory.h> | ||
41 | #include <opie2/owidgetstack.h> | ||
42 | #include <opie2/ofileselector.h> | ||
43 | #include <opie2/odebug.h> | ||
44 | |||
45 | #include <qpe/resource.h> | ||
46 | |||
47 | #include <qfileinfo.h> | ||
48 | #include <qfile.h> | ||
49 | #include <qtoolbar.h> | ||
50 | #include <qpopupmenu.h> | ||
51 | #include <qmenubar.h> | ||
52 | #include <qtimer.h> | ||
53 | |||
54 | OPIE_EXPORT_APP( Opie::Core::OApplicationFactory<PMainWindow>) | ||
55 | |||
56 | using namespace Opie::Ui; | ||
57 | |||
58 | PMainWindow::PMainWindow(QWidget*w, const char*name, WFlags f) | ||
59 | : QMainWindow(w,name,f) | ||
60 | { | ||
61 | setCaption( QObject::tr("Opie Mediaplayer 3" ) ); | ||
62 | setupActions(); | ||
63 | setupToolBar(); | ||
64 | setupMenu(); | ||
65 | |||
66 | m_stack = new OWidgetStack(this); | ||
67 | m_stack->forceMode(Opie::Ui::OWidgetStack::SmallScreen); | ||
68 | setCentralWidget(m_stack ); | ||
69 | m_playList = new PlaylistView(m_stack,"playlist"); | ||
70 | m_stack->addWidget(m_playList,stack_list); | ||
71 | |||
72 | m_sfl = new OFileSelector("video/*;audio/*",m_stack); | ||
73 | m_stack->addWidget(m_sfl,stack_file); | ||
74 | connect(m_sfl, SIGNAL(fileSelected(const DocLnk &)), m_playList, SLOT(slotAddFile(const DocLnk &))); | ||
75 | m_AudioPlayer = new AudioWidget(m_stack); | ||
76 | m_stack->addWidget(m_AudioPlayer,stack_audio); | ||
77 | connect(this,SIGNAL(sigPos(int)),m_AudioPlayer,SLOT(updatePos(int))); | ||
78 | m_VideoPlayer = new VideoWidget(m_stack); | ||
79 | m_stack->addWidget(m_VideoPlayer,stack_video); | ||
80 | connect(this,SIGNAL(sigPos(int)),m_VideoPlayer,SLOT(updatePos(int))); | ||
81 | connect(m_VideoPlayer,SIGNAL(videoclicked()),this,SLOT(slotVideoclicked())); | ||
82 | |||
83 | m_stack->raiseWidget(stack_list); | ||
84 | m_PlayLib = 0; | ||
85 | m_LastItem = 0; | ||
86 | } | ||
87 | |||
88 | void PMainWindow::checkLib() | ||
89 | { | ||
90 | if (m_PlayLib == 0) { | ||
91 | m_PlayLib = new XINE::Lib(XINE::Lib::InitializeImmediately); | ||
92 | m_PlayLib->ensureInitialized(); | ||
93 | connect(m_PlayLib,SIGNAL(stopped()),this,SLOT(slotStopped())); | ||
94 | } | ||
95 | } | ||
96 | |||
97 | PMainWindow::~PMainWindow() | ||
98 | { | ||
99 | if (m_PlayLib) { | ||
100 | m_PlayLib->stop(); | ||
101 | delete m_PlayLib; | ||
102 | } | ||
103 | } | ||
104 | |||
105 | void PMainWindow::fileSelected(const DocLnk&) | ||
106 | { | ||
107 | } | ||
108 | |||
109 | void PMainWindow::slotAppendFiles() | ||
110 | { | ||
111 | m_stack->raiseWidget(m_sfl); | ||
112 | } | ||
113 | |||
114 | void PMainWindow::slotShowList() | ||
115 | { | ||
116 | m_stack->raiseWidget(m_playList); | ||
117 | } | ||
118 | |||
119 | void PMainWindow::slotPlayList() | ||
120 | { | ||
121 | if (m_playing && m_LastItem && m_PlayLib) { | ||
122 | if (!m_LastItem->isVideo()) { | ||
123 | m_stack->raiseWidget(stack_audio); | ||
124 | } else { | ||
125 | m_stack->raiseWidget(stack_video); | ||
126 | } | ||
127 | return; | ||
128 | } | ||
129 | |||
130 | m_LastItem = m_playList->currentItem(); | ||
131 | if (!m_LastItem) { | ||
132 | slotPlayNext(); | ||
133 | return; | ||
134 | } | ||
135 | //m_VideoPlayer->setFullScreen(a_ShowFull->isOn()); | ||
136 | slotPlayCurrent(); | ||
137 | } | ||
138 | |||
139 | void PMainWindow::hideVideo() | ||
140 | { | ||
141 | if (m_VideoPlayer->isVisible() && a_ShowFull->isOn()) { | ||
142 | m_VideoPlayer->showNormal(); | ||
143 | m_VideoPlayer->hide(); | ||
144 | } | ||
145 | } | ||
146 | |||
147 | void PMainWindow::slotPlayCurrent() | ||
148 | { | ||
149 | if (!m_LastItem) { | ||
150 | if (m_PlayLib) m_PlayLib->stop(); | ||
151 | hideVideo(); | ||
152 | m_stack->raiseWidget(stack_list); | ||
153 | return; | ||
154 | } | ||
155 | checkLib(); | ||
156 | m_CurrentPos = 0; | ||
157 | m_playList->setCurrentItem(m_LastItem); | ||
158 | odebug << "Pos: " << m_PlayLib->currentTime() << oendl; | ||
159 | if (!m_LastItem->isVideo()) { | ||
160 | hideVideo(); | ||
161 | m_playing = true; | ||
162 | QTimer::singleShot( 500, this, SLOT( slotCheckPos() ) ); | ||
163 | m_stack->raiseWidget(stack_audio); | ||
164 | m_AudioPlayer->playFile(m_LastItem->Lnk(),m_PlayLib); | ||
165 | } else { | ||
166 | m_playing = true; | ||
167 | QTimer::singleShot( 500, this, SLOT( slotCheckPos() ) ); | ||
168 | setupVideo(a_ShowFull->isOn()); | ||
169 | m_VideoPlayer->playFile(m_LastItem->Lnk(),m_PlayLib); | ||
170 | } | ||
171 | } | ||
172 | |||
173 | void PMainWindow::slotPlayNext() | ||
174 | { | ||
175 | PlaylistItem*item = m_playList->nextItem(m_LastItem); | ||
176 | if (!item) return; | ||
177 | m_LastItem = item; | ||
178 | slotPlayCurrent(); | ||
179 | } | ||
180 | |||
181 | void PMainWindow::slotGoNext() | ||
182 | { | ||
183 | m_LastItem = m_playList->nextItem(m_LastItem); | ||
184 | slotPlayCurrent(); | ||
185 | } | ||
186 | |||
187 | void PMainWindow::slotPlayPrevious() | ||
188 | { | ||
189 | PlaylistItem*item = m_playList->prevItem(m_LastItem); | ||
190 | if (!item) return; | ||
191 | m_LastItem = item; | ||
192 | slotPlayCurrent(); | ||
193 | } | ||
194 | |||
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() | ||
205 | { | ||
206 | if (!m_playing) return; | ||
207 | m_playing = false; | ||
208 | slotGoNext(); | ||
209 | } | ||
210 | |||
211 | void PMainWindow::slotCheckPos() | ||
212 | { | ||
213 | if (!m_playing) return; | ||
214 | emit sigPos(m_PlayLib->currentTime()); | ||
215 | QTimer::singleShot( 1000, this, SLOT( slotCheckPos() ) ); | ||
216 | } | ||
217 | |||
218 | void PMainWindow::slotRemoveFiles() | ||
219 | { | ||
220 | slotUserStop(); | ||
221 | PlaylistItem* Item = m_playList->currentItem(); | ||
222 | m_stack->raiseWidget(stack_list); | ||
223 | m_playList->removeFromList(Item); | ||
224 | } | ||
225 | |||
226 | void PMainWindow::setupActions() | ||
227 | { | ||
228 | a_appendFiles = new QAction(tr("Open file(s)"),Resource::loadIconSet( "opieplayer2/add_to_playlist" ), 0, 0, this, 0, false ); | ||
229 | connect(a_appendFiles,SIGNAL(activated()),this,SLOT(slotAppendFiles())); | ||
230 | a_showPlaylist = new QAction(tr("Show playlist"),Resource::loadIconSet( "txt" ), 0, 0, this, 0, false ); | ||
231 | connect(a_showPlaylist,SIGNAL(activated()),this,SLOT(slotShowList())); | ||
232 | 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())); | ||
234 | |||
235 | playersGroup = new QActionGroup(this,"playgroup",false); | ||
236 | |||
237 | a_playAction = new QAction(tr("Play list"),Resource::loadIconSet( "opieplayer2/play" ), 0, 0, this, 0, false ); | ||
238 | connect(a_playAction,SIGNAL(activated()),this,SLOT(slotPlayList())); | ||
239 | 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())); | ||
241 | 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())); | ||
243 | 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))); | ||
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 | |||
248 | playersGroup->insert(a_playPrevious); | ||
249 | playersGroup->insert(a_playAction); | ||
250 | playersGroup->insert(a_stopPlay); | ||
251 | playersGroup->insert(a_playNext); | ||
252 | //playersGroup->insert(a_ShowFull); | ||
253 | } | ||
254 | |||
255 | void PMainWindow::setupToolBar() | ||
256 | { | ||
257 | setToolBarsMovable( false ); | ||
258 | m_toolBar = new QToolBar( this ); | ||
259 | //m_menuBar = new QMenuBar(m_toolBar); | ||
260 | m_menuBar=menuBar(); | ||
261 | addToolBar(m_toolBar); | ||
262 | m_toolBar->setHorizontalStretchable( true ); | ||
263 | a_appendFiles->addTo(m_toolBar); | ||
264 | a_removeFiles->addTo(m_toolBar); | ||
265 | a_showPlaylist->addTo(m_toolBar); | ||
266 | a_ShowFull->addTo(m_toolBar); | ||
267 | playersGroup->addTo(m_toolBar); | ||
268 | } | ||
269 | |||
270 | void PMainWindow::setupVideo(bool full) | ||
271 | { | ||
272 | if (full) { | ||
273 | m_VideoPlayer->setBackgroundColor(black); | ||
274 | 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()); | ||
276 | m_VideoPlayer->showFullScreen(); | ||
277 | } else { | ||
278 | m_VideoPlayer->hide(); | ||
279 | m_stack->addWidget(m_VideoPlayer,stack_video); | ||
280 | m_stack->raiseWidget(stack_video); | ||
281 | } | ||
282 | m_VideoPlayer->fullScreen(full); | ||
283 | m_VideoPlayer->disconnect(this); | ||
284 | connect(m_VideoPlayer,SIGNAL(videoclicked()),this,SLOT(slotVideoclicked())); | ||
285 | } | ||
286 | |||
287 | void PMainWindow::slotVideoclicked() | ||
288 | { | ||
289 | odebug << "PMainWindow::slotVideoclicked()" << oendl; | ||
290 | if (a_ShowFull->isOn()) { | ||
291 | a_ShowFull->setOn(false); | ||
292 | slotToggleFull(false); | ||
293 | } | ||
294 | } | ||
295 | |||
296 | void PMainWindow::slotToggleFull(bool how) | ||
297 | { | ||
298 | if (m_PlayLib && m_VideoPlayer->isVisible() && m_PlayLib->isShowingVideo()) { | ||
299 | m_PlayLib->pause(true); | ||
300 | setupVideo(how); | ||
301 | m_PlayLib->pause(false); | ||
302 | } | ||
303 | } | ||
304 | |||
305 | void PMainWindow::setupMenu() | ||
306 | { | ||
307 | fileMenu = new QPopupMenu( m_menuBar ); | ||
308 | m_menuBar->insertItem( tr( "Playlist" ), fileMenu ); | ||
309 | a_appendFiles->addTo(fileMenu); | ||
310 | a_removeFiles->addTo(fileMenu); | ||
311 | |||
312 | dispMenu = new QPopupMenu( m_menuBar ); | ||
313 | m_menuBar->insertItem( tr( "Show" ), dispMenu ); | ||
314 | a_showPlaylist->addTo(dispMenu); | ||
315 | a_ShowFull->addTo(dispMenu); | ||
316 | playMenu = new QPopupMenu(m_menuBar); | ||
317 | m_menuBar->insertItem(tr("Playing"),playMenu); | ||
318 | |||
319 | playersGroup->addTo(playMenu); | ||
320 | } | ||
diff --git a/noncore/multimedia/opieplayer3/mwindow.h b/noncore/multimedia/opieplayer3/mwindow.h new file mode 100644 index 0000000..28f820f --- a/dev/null +++ b/noncore/multimedia/opieplayer3/mwindow.h | |||
@@ -0,0 +1,120 @@ | |||
1 | /* | ||
2 | This file is part of the Opie Project | ||
3 | |||
4 | Copyright (c) 2002 Max Reiss <harlekin@handhelds.org> | ||
5 | Copyright (c) 2002 L. Potter <ljp@llornkcor.com> | ||
6 | Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> | ||
7 | =. | ||
8 | .=l. | ||
9 | .>+-= | ||
10 | _;:, .> :=|. This program is free software; you can | ||
11 | .> <`_, > . <= redistribute it and/or modify it under | ||
12 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | ||
13 | .="- .-=="i, .._ License as published by the Free Software | ||
14 | - . .-<_> .<> Foundation; either version 2 of the License, | ||
15 | ._= =} : or (at your option) any later version. | ||
16 | .%`+i> _;_. | ||
17 | .i_,=:_. -<s. This program is distributed in the hope that | ||
18 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | ||
19 | : .. .:, . . . without even the implied warranty of | ||
20 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
21 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | ||
22 | ..}^=.= = ; Library General Public License for more | ||
23 | ++= -. .` .: details. | ||
24 | : = ...= . :.=- | ||
25 | -. .:....=;==+<; You should have received a copy of the GNU | ||
26 | -_. . . )=. = Library General Public License along with | ||
27 | -- :-=` this library; see the file COPYING.LIB. | ||
28 | If not, write to the Free Software Foundation, | ||
29 | Inc., 59 Temple Place - Suite 330, | ||
30 | Boston, MA 02111-1307, USA. | ||
31 | |||
32 | */ | ||
33 | |||
34 | #ifndef _mwindow_h | ||
35 | #define _mwindow_h | ||
36 | |||
37 | #include <qmainwindow.h> | ||
38 | |||
39 | #include <qpe/applnk.h> | ||
40 | |||
41 | #include <qaction.h> | ||
42 | |||
43 | namespace Opie { | ||
44 | namespace Ui { | ||
45 | class OWidgetStack; | ||
46 | class OFileSelector; | ||
47 | } | ||
48 | } | ||
49 | |||
50 | namespace XINE { | ||
51 | class Lib; | ||
52 | } | ||
53 | |||
54 | class PlaylistView; | ||
55 | class QToolBar; | ||
56 | class QPopupMenu; | ||
57 | class QMenuBar; | ||
58 | class AudioWidget; | ||
59 | class VideoWidget; | ||
60 | class PlaylistItem; | ||
61 | |||
62 | class PMainWindow : public QMainWindow { | ||
63 | Q_OBJECT | ||
64 | public: | ||
65 | static QString appName() { return QString::fromLatin1("opie-mediaplayer3" ); } | ||
66 | PMainWindow(QWidget*, const char*, WFlags ); | ||
67 | virtual ~PMainWindow(); | ||
68 | |||
69 | public slots: | ||
70 | virtual void slotVideoclicked(); | ||
71 | protected: | ||
72 | static const int stack_list = 0; | ||
73 | static const int stack_file = 1; | ||
74 | static const int stack_audio = 2; | ||
75 | static const int stack_video = 3; | ||
76 | Opie::Ui::OWidgetStack *m_stack; | ||
77 | Opie::Ui::OFileSelector*m_sfl; | ||
78 | PlaylistView*m_playList; | ||
79 | AudioWidget*m_AudioPlayer; | ||
80 | VideoWidget*m_VideoPlayer; | ||
81 | |||
82 | QAction*a_appendFiles,*a_removeFiles,*a_showPlaylist,*a_playAction,*a_deleteItem,*a_stopAction; | ||
83 | QAction*a_playNext,*a_playPrevious,*a_ShowFull,*a_stopPlay; | ||
84 | QActionGroup*playersGroup; | ||
85 | QToolBar*m_toolBar; | ||
86 | QPopupMenu *fileMenu,*dispMenu,*playMenu; | ||
87 | QMenuBar*m_menuBar; | ||
88 | XINE::Lib*m_PlayLib; | ||
89 | |||
90 | void setupActions(); | ||
91 | void setupToolBar(); | ||
92 | void setupMenu(); | ||
93 | void checkLib(); | ||
94 | void setupVideo(bool full); | ||
95 | void hideVideo(); | ||
96 | |||
97 | bool m_playing:1; | ||
98 | int m_CurrentPos; | ||
99 | PlaylistItem*m_LastItem; | ||
100 | |||
101 | protected slots: | ||
102 | virtual void fileSelected(const DocLnk&); | ||
103 | virtual void slotAppendFiles(); | ||
104 | virtual void slotRemoveFiles(); | ||
105 | virtual void slotShowList(); | ||
106 | virtual void slotPlayList(); | ||
107 | virtual void slotPlayNext(); | ||
108 | virtual void slotPlayPrevious(); | ||
109 | virtual void slotPlayCurrent(); | ||
110 | virtual void slotStopped(); | ||
111 | virtual void slotCheckPos(); | ||
112 | virtual void slotToggleFull(bool); | ||
113 | virtual void slotUserStop(); | ||
114 | virtual void slotGoNext(); | ||
115 | |||
116 | signals: | ||
117 | void sigPos(int); | ||
118 | }; | ||
119 | |||
120 | #endif | ||
diff --git a/noncore/multimedia/opieplayer3/opieplayer3.pro b/noncore/multimedia/opieplayer3/opieplayer3.pro new file mode 100644 index 0000000..1c7149f --- a/dev/null +++ b/noncore/multimedia/opieplayer3/opieplayer3.pro | |||
@@ -0,0 +1,26 @@ | |||
1 | CONFIG = qt warn_on quick-app | ||
2 | HEADERS = mwindow.h playlist.h ../opieplayer2/lib.h ../opieplayer2/threadutil.h \ | ||
3 | ../opieplayer2/alphablend.h ../opieplayer2/yuv2rgb.h \ | ||
4 | audiowidget.h ../opieplayer2/xinevideowidget.h \ | ||
5 | videowidget.h | ||
6 | SOURCES = mwindow.cpp playlist.cpp ../opieplayer2/lib.cpp ../opieplayer2/threadutil.cpp \ | ||
7 | ../opieplayer2/nullvideo.c \ | ||
8 | ../opieplayer2/alphablend.c ../opieplayer2/yuv2rgb.c \ | ||
9 | audiowidget.cpp ../opieplayer2/xinevideowidget.cpp \ | ||
10 | videowidget.cpp ../opieplayer2/yuv2rgb_arm2.c ../opieplayer2/yuv2rgb_arm4l.S | ||
11 | |||
12 | TARGET = opie-mediaplayer3 | ||
13 | INCLUDEPATH += $(OPIEDIR)/include | ||
14 | DEPENDPATH += $(OPIEDIR)/include | ||
15 | LIBS += -lqpe -lpthread -lopiecore2 -lopieui2 -lqtaux2 -lxine | ||
16 | MOC_DIR = qpeobj | ||
17 | OBJECTS_DIR = qpeobj | ||
18 | |||
19 | include( $(OPIEDIR)/include.pro ) | ||
20 | |||
21 | !isEmpty( LIBXINE_INC_DIR ) { | ||
22 | INCLUDEPATH = $$LIBXINE_INC_DIR $$INCLUDEPATH | ||
23 | } | ||
24 | !isEmpty( LIBXINE_LIB_DIR ) { | ||
25 | LIBS = -L$$LIBXINE_LIB_DIR $$LIBS | ||
26 | } | ||
diff --git a/noncore/multimedia/opieplayer3/playlist.cpp b/noncore/multimedia/opieplayer3/playlist.cpp new file mode 100644 index 0000000..272a71e --- a/dev/null +++ b/noncore/multimedia/opieplayer3/playlist.cpp | |||
@@ -0,0 +1,210 @@ | |||
1 | /* | ||
2 | This file is part of the Opie Project | ||
3 | |||
4 | Copyright (c) 2002 Max Reiss <harlekin@handhelds.org> | ||
5 | Copyright (c) 2002 L. Potter <ljp@llornkcor.com> | ||
6 | Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> | ||
7 | =. | ||
8 | .=l. | ||
9 | .>+-= | ||
10 | _;:, .> :=|. This program is free software; you can | ||
11 | .> <`_, > . <= redistribute it and/or modify it under | ||
12 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | ||
13 | .="- .-=="i, .._ License as published by the Free Software | ||
14 | - . .-<_> .<> Foundation; either version 2 of the License, | ||
15 | ._= =} : or (at your option) any later version. | ||
16 | .%`+i> _;_. | ||
17 | .i_,=:_. -<s. This program is distributed in the hope that | ||
18 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | ||
19 | : .. .:, . . . without even the implied warranty of | ||
20 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
21 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | ||
22 | ..}^=.= = ; Library General Public License for more | ||
23 | ++= -. .` .: details. | ||
24 | : = ...= . :.=- | ||
25 | -. .:....=;==+<; You should have received a copy of the GNU | ||
26 | -_. . . )=. = Library General Public License along with | ||
27 | -- :-=` this library; see the file COPYING.LIB. | ||
28 | If not, write to the Free Software Foundation, | ||
29 | Inc., 59 Temple Place - Suite 330, | ||
30 | Boston, MA 02111-1307, USA. | ||
31 | |||
32 | */ | ||
33 | #include "playlist.h" | ||
34 | #include "../opieplayer2/lib.h" | ||
35 | |||
36 | #include <opie2/odebug.h> | ||
37 | #include <opie2/oresource.h> | ||
38 | |||
39 | #include <qpe/resource.h> | ||
40 | |||
41 | #include <qfileinfo.h> | ||
42 | |||
43 | PlaylistItem::PlaylistItem(const DocLnk& aLink,PlaylistView*parent) | ||
44 | :QListViewItem(parent),m_Content(aLink),m_video(false) | ||
45 | { | ||
46 | } | ||
47 | |||
48 | PlaylistItem::PlaylistItem(const DocLnk&aLink,PlaylistView*parent,PlaylistItem*after) | ||
49 | :QListViewItem(parent,after),m_Content(aLink),m_video(false) | ||
50 | { | ||
51 | } | ||
52 | |||
53 | void PlaylistItem::Video(bool y) | ||
54 | { | ||
55 | m_video=y; | ||
56 | if (m_video) { | ||
57 | setPixmap(0,Opie::Core::OResource::loadPixmap("opieplayer2/videofile")); | ||
58 | } else { | ||
59 | setPixmap(0,Opie::Core::OResource::loadPixmap("opieplayer2/musicfile")); | ||
60 | } | ||
61 | } | ||
62 | |||
63 | PlaylistItem::~PlaylistItem() | ||
64 | { | ||
65 | } | ||
66 | |||
67 | /* PlaylistView Methods */ | ||
68 | PlaylistView::PlaylistView(QWidget *parent, const char *name) | ||
69 | : QListView(parent,name) | ||
70 | { | ||
71 | // columnLabels << tr("FullName"); | ||
72 | columnLabels << tr(""); // icon | ||
73 | columnLabels << tr("File"); | ||
74 | columnLabels << tr("Playtime"); | ||
75 | columnLabels << tr("Artist"); | ||
76 | columnLabels << tr("Album"); | ||
77 | columnLabels << tr("Title"); | ||
78 | columnLabels << tr("Type"); | ||
79 | columnLabels << tr("Size"); | ||
80 | for (QStringList::Iterator it = columnLabels.begin(); it != columnLabels.end(); ++it) { | ||
81 | addColumn(*it); | ||
82 | } | ||
83 | m_Infolib=0; | ||
84 | setAllColumnsShowFocus(true); | ||
85 | setSelectionMode(Single); | ||
86 | setSorting(-1); | ||
87 | m_lastItem = 0; | ||
88 | } | ||
89 | |||
90 | PlaylistView::~PlaylistView() | ||
91 | { | ||
92 | if (m_Infolib) delete m_Infolib; | ||
93 | } | ||
94 | |||
95 | void PlaylistView::checkLib() | ||
96 | { | ||
97 | if (!m_Infolib) { | ||
98 | m_Infolib = new XINE::Lib(XINE::Lib::InitializeImmediately); | ||
99 | m_Infolib->ensureInitialized(); | ||
100 | } | ||
101 | } | ||
102 | |||
103 | void PlaylistView::slotAddFile(const DocLnk&aLink) | ||
104 | { | ||
105 | QFileInfo fileInfo(aLink.file()); | ||
106 | if (!fileInfo.exists()) return; | ||
107 | checkLib(); | ||
108 | |||
109 | m_Infolib->stop(); | ||
110 | |||
111 | if (m_lastItem) { | ||
112 | m_lastItem = new PlaylistItem(aLink,this,m_lastItem); | ||
113 | } else { | ||
114 | m_lastItem = new PlaylistItem(aLink,this); | ||
115 | } | ||
116 | m_lastItem->setExpandable(false); | ||
117 | m_lastItem->setText(1,aLink.name()); | ||
118 | int i = m_Infolib->setfile(aLink.file()); | ||
119 | odebug << "File set: " << i << oendl; | ||
120 | if (i<1) { | ||
121 | return; | ||
122 | } | ||
123 | |||
124 | QString codec = m_Infolib->metaInfo(6); | ||
125 | if (codec.isEmpty()) { | ||
126 | codec = m_Infolib->metaInfo(7); | ||
127 | } | ||
128 | // codec | ||
129 | m_lastItem->setText(COL_TYPE,codec); | ||
130 | // title | ||
131 | m_lastItem->setText(COL_TITLE,m_Infolib->metaInfo(0)); | ||
132 | // artist | ||
133 | m_lastItem->setText(COL_ARTIST,m_Infolib->metaInfo(2)); | ||
134 | // album | ||
135 | m_lastItem->setText(COL_ALBUM,m_Infolib->metaInfo(4)); | ||
136 | int l = m_Infolib->length(); | ||
137 | int h = l/3600; | ||
138 | l-=h*3600; | ||
139 | int m = l/60; | ||
140 | l-=m*60; | ||
141 | codec = ""; | ||
142 | if (h>0) { | ||
143 | codec+=QString("%1 h").arg(h); | ||
144 | } | ||
145 | if (m>0) { | ||
146 | if (!codec.isEmpty()) codec+=" "; | ||
147 | codec+=QString("%1 m").arg(m); | ||
148 | } | ||
149 | if (l>0) { | ||
150 | if (!codec.isEmpty()) codec+=" "; | ||
151 | codec+=QString("%1 s").arg(l); | ||
152 | } | ||
153 | // time | ||
154 | m_lastItem->setText(COL_TIME,codec); | ||
155 | m_lastItem->Video(m_Infolib->hasVideo()); | ||
156 | m_items.append(m_lastItem); | ||
157 | } | ||
158 | |||
159 | void PlaylistView::removeFromList(PlaylistItem*Item) | ||
160 | { | ||
161 | if (!Item)return; | ||
162 | t_itemlist::Iterator iter; | ||
163 | iter = m_items.find(Item); | ||
164 | if (iter!=m_items.end()) { | ||
165 | m_items.remove(iter); | ||
166 | } | ||
167 | delete Item; | ||
168 | } | ||
169 | |||
170 | XINE::Lib*PlaylistView::getXine() | ||
171 | { | ||
172 | checkLib(); | ||
173 | return m_Infolib; | ||
174 | } | ||
175 | |||
176 | void PlaylistView::setCurrentItem(PlaylistItem*aItem) | ||
177 | { | ||
178 | setSelected(aItem,true); | ||
179 | } | ||
180 | |||
181 | PlaylistItem* PlaylistView::currentItem()const | ||
182 | { | ||
183 | QListViewItem*it = selectedItem(); | ||
184 | if (!it) return 0; | ||
185 | return (PlaylistItem*)it; | ||
186 | } | ||
187 | |||
188 | PlaylistItem* PlaylistView::nextItem(PlaylistItem*parent)const | ||
189 | { | ||
190 | if (m_items.count()==0) return 0; | ||
191 | if (!parent) return m_items[0]; | ||
192 | for (unsigned j=0; j<m_items.count()-1;++j) { | ||
193 | if (m_items[j]==parent) { | ||
194 | return m_items[j+1]; | ||
195 | } | ||
196 | } | ||
197 | return 0; | ||
198 | } | ||
199 | |||
200 | PlaylistItem* PlaylistView::prevItem(PlaylistItem*parent)const | ||
201 | { | ||
202 | if (m_items.count()==0) return 0; | ||
203 | if (!parent) return m_items[m_items.count()-1]; | ||
204 | for (unsigned j=m_items.count()-1; j>0;--j) { | ||
205 | if (m_items[j]==parent) { | ||
206 | return m_items[j-1]; | ||
207 | } | ||
208 | } | ||
209 | return 0; | ||
210 | } | ||
diff --git a/noncore/multimedia/opieplayer3/playlist.h b/noncore/multimedia/opieplayer3/playlist.h new file mode 100644 index 0000000..ad4c472 --- a/dev/null +++ b/noncore/multimedia/opieplayer3/playlist.h | |||
@@ -0,0 +1,100 @@ | |||
1 | /* | ||
2 | This file is part of the Opie Project | ||
3 | |||
4 | Copyright (c) 2002 Max Reiss <harlekin@handhelds.org> | ||
5 | Copyright (c) 2002 L. Potter <ljp@llornkcor.com> | ||
6 | Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> | ||
7 | =. | ||
8 | .=l. | ||
9 | .>+-= | ||
10 | _;:, .> :=|. This program is free software; you can | ||
11 | .> <`_, > . <= redistribute it and/or modify it under | ||
12 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | ||
13 | .="- .-=="i, .._ License as published by the Free Software | ||
14 | - . .-<_> .<> Foundation; either version 2 of the License, | ||
15 | ._= =} : or (at your option) any later version. | ||
16 | .%`+i> _;_. | ||
17 | .i_,=:_. -<s. This program is distributed in the hope that | ||
18 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | ||
19 | : .. .:, . . . without even the implied warranty of | ||
20 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
21 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | ||
22 | ..}^=.= = ; Library General Public License for more | ||
23 | ++= -. .` .: details. | ||
24 | : = ...= . :.=- | ||
25 | -. .:....=;==+<; You should have received a copy of the GNU | ||
26 | -_. . . )=. = Library General Public License along with | ||
27 | -- :-=` this library; see the file COPYING.LIB. | ||
28 | If not, write to the Free Software Foundation, | ||
29 | Inc., 59 Temple Place - Suite 330, | ||
30 | Boston, MA 02111-1307, USA. | ||
31 | |||
32 | */ | ||
33 | #ifndef __playlist_h | ||
34 | #define __playlist_h | ||
35 | |||
36 | #include <qpe/applnk.h> | ||
37 | |||
38 | #include <qlistview.h> | ||
39 | #include <qstringlist.h> | ||
40 | |||
41 | namespace XINE { | ||
42 | class Lib; | ||
43 | } | ||
44 | |||
45 | class PlaylistView; | ||
46 | |||
47 | class PlaylistItem:public QListViewItem | ||
48 | { | ||
49 | public: | ||
50 | PlaylistItem(const DocLnk&aLink,PlaylistView*parent); | ||
51 | PlaylistItem(const DocLnk&aLink,PlaylistView*parent,PlaylistItem*after); | ||
52 | virtual ~PlaylistItem(); | ||
53 | |||
54 | const DocLnk&Lnk()const{return m_Content;} | ||
55 | void Video(bool y); | ||
56 | bool isVideo()const{return m_video;} | ||
57 | |||
58 | protected: | ||
59 | DocLnk m_Content; | ||
60 | bool m_video:1; | ||
61 | }; | ||
62 | |||
63 | typedef QValueList<PlaylistItem*> t_itemlist; | ||
64 | |||
65 | class PlaylistView:public QListView | ||
66 | { | ||
67 | Q_OBJECT | ||
68 | public: | ||
69 | PlaylistView( QWidget *parent = 0, const char *name = 0); | ||
70 | virtual ~PlaylistView(); | ||
71 | XINE::Lib*getXine(); | ||
72 | PlaylistItem* currentItem()const; | ||
73 | void setCurrentItem(PlaylistItem*); | ||
74 | PlaylistItem* nextItem(PlaylistItem*parent)const; | ||
75 | PlaylistItem* prevItem(PlaylistItem*parent)const; | ||
76 | |||
77 | void removeFromList(PlaylistItem*Item); | ||
78 | |||
79 | enum itemcolumns{ | ||
80 | COL_ICON=0, | ||
81 | COL_FILE=1, | ||
82 | COL_TIME=2, | ||
83 | COL_ARTIST=3, | ||
84 | COL_ALBUM=4, | ||
85 | COL_TITLE=5, | ||
86 | COL_TYPE=6, | ||
87 | COL_SIZE=7 | ||
88 | }; | ||
89 | public slots: | ||
90 | virtual void slotAddFile(const DocLnk&); | ||
91 | |||
92 | protected: | ||
93 | void checkLib(); | ||
94 | QStringList columnLabels; | ||
95 | XINE::Lib*m_Infolib; | ||
96 | PlaylistItem*m_lastItem; | ||
97 | t_itemlist m_items; | ||
98 | }; | ||
99 | |||
100 | #endif | ||
diff --git a/noncore/multimedia/opieplayer3/videowidget.cpp b/noncore/multimedia/opieplayer3/videowidget.cpp new file mode 100644 index 0000000..c5c63c7 --- a/dev/null +++ b/noncore/multimedia/opieplayer3/videowidget.cpp | |||
@@ -0,0 +1,122 @@ | |||
1 | #include "videowidget.h" | ||
2 | #include "../opieplayer2/lib.h" | ||
3 | #include "../opieplayer2/threadutil.h" | ||
4 | #include "../opieplayer2/xinevideowidget.h" | ||
5 | |||
6 | #include <opie2/odebug.h> | ||
7 | |||
8 | #include <qpe/qpeapplication.h> | ||
9 | |||
10 | #include <qlayout.h> | ||
11 | #include <qslider.h> | ||
12 | #include <qlabel.h> | ||
13 | |||
14 | VideoWidget::VideoWidget( QWidget * parent, const char * name, WFlags f) | ||
15 | :QWidget(parent,name,f) | ||
16 | { | ||
17 | m_xineLib = 0; | ||
18 | |||
19 | m_MainLayout = new QVBoxLayout(this); | ||
20 | m_MainLayout->setAutoAdd(true); | ||
21 | m_Videodisplay = new XineVideoWidget(this,"videodisp"); | ||
22 | m_PosSlider = new QSlider(QSlider::Horizontal,this); | ||
23 | m_PosSlider->setTickInterval(60); | ||
24 | 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(sliderPressed()),this,SLOT(sliderPressed())); | ||
27 | connect(m_PosSlider,SIGNAL(sliderReleased()),this,SLOT(sliderReleased())); | ||
28 | connect(m_Videodisplay,SIGNAL(videoResized ( const QSize & )),this,SLOT(slot_Videoresized(const QSize&))); | ||
29 | connect(m_Videodisplay,SIGNAL(clicked()),this,SLOT(slotClicked())); | ||
30 | m_pressed = false; | ||
31 | m_uppos=0; | ||
32 | } | ||
33 | |||
34 | VideoWidget::~VideoWidget() | ||
35 | { | ||
36 | } | ||
37 | |||
38 | void VideoWidget::slotClicked() | ||
39 | { | ||
40 | odebug << "clicked " << oendl; | ||
41 | emit videoclicked(); | ||
42 | } | ||
43 | |||
44 | void VideoWidget::closeEvent(QCloseEvent*e) | ||
45 | { | ||
46 | } | ||
47 | |||
48 | void VideoWidget::slotNewPos(int pos) | ||
49 | { | ||
50 | if (!m_xineLib) return; | ||
51 | if (m_uppos==pos) return; | ||
52 | m_xineLib->seekTo(pos); | ||
53 | } | ||
54 | |||
55 | void VideoWidget::sliderPressed() | ||
56 | { | ||
57 | m_pressed = true; | ||
58 | } | ||
59 | |||
60 | void VideoWidget::sliderReleased() | ||
61 | { | ||
62 | m_pressed = false; | ||
63 | } | ||
64 | |||
65 | void VideoWidget::fullScreen(bool how) | ||
66 | { | ||
67 | if (how) { | ||
68 | m_PosSlider->hide(); | ||
69 | } else { | ||
70 | m_PosSlider->show(); | ||
71 | } | ||
72 | } | ||
73 | |||
74 | void VideoWidget::playFile(const DocLnk&aLnk,XINE::Lib*aLib) | ||
75 | { | ||
76 | m_current = aLnk; | ||
77 | if (m_xineLib != aLib) { | ||
78 | disconnect(m_xineLib); | ||
79 | m_xineLib = aLib; | ||
80 | if (aLib) m_xineLib->setWidget(m_Videodisplay); | ||
81 | } | ||
82 | if (!m_xineLib) { | ||
83 | return; | ||
84 | } | ||
85 | connect(m_xineLib,SIGNAL(stopped()),this,SLOT(slotStopped())); | ||
86 | m_uppos=0; | ||
87 | m_PosSlider->setValue(0); | ||
88 | m_xineLib->setWidget(m_Videodisplay); | ||
89 | m_xineLib->setShowVideo(true); | ||
90 | m_xineLib->resize(m_Videodisplay->size()); | ||
91 | m_xineLib->play(m_current.file()); | ||
92 | int l = m_xineLib->length(); | ||
93 | m_PosSlider->setRange(0,l); | ||
94 | m_PosSlider->setPageStep(l/10); | ||
95 | } | ||
96 | |||
97 | void VideoWidget::stopPlaying() | ||
98 | { | ||
99 | if (m_xineLib) { | ||
100 | m_xineLib->stop(); | ||
101 | } | ||
102 | } | ||
103 | |||
104 | void VideoWidget::slotStopped() | ||
105 | { | ||
106 | // check fullscreen here! | ||
107 | } | ||
108 | |||
109 | void VideoWidget::slot_Videoresized(const QSize&s) | ||
110 | { | ||
111 | odebug << "Videoresized: " << s << oendl; | ||
112 | if (m_xineLib) { | ||
113 | m_xineLib->resize(s); | ||
114 | } | ||
115 | } | ||
116 | |||
117 | void VideoWidget::updatePos(int val) | ||
118 | { | ||
119 | if (m_pressed) return; | ||
120 | m_uppos = val; | ||
121 | m_PosSlider->setValue(val); | ||
122 | } | ||
diff --git a/noncore/multimedia/opieplayer3/videowidget.h b/noncore/multimedia/opieplayer3/videowidget.h new file mode 100644 index 0000000..f181980 --- a/dev/null +++ b/noncore/multimedia/opieplayer3/videowidget.h | |||
@@ -0,0 +1,53 @@ | |||
1 | #ifndef __videowidget_h | ||
2 | #define __videowidget_h | ||
3 | #include <qwidget.h> | ||
4 | |||
5 | #include <qpe/applnk.h> | ||
6 | |||
7 | namespace XINE { | ||
8 | class Lib; | ||
9 | } | ||
10 | |||
11 | class QVBoxLayout; | ||
12 | class QSlider; | ||
13 | class QLabel; | ||
14 | class XineVideoWidget; | ||
15 | |||
16 | class VideoWidget:public QWidget | ||
17 | { | ||
18 | Q_OBJECT | ||
19 | public: | ||
20 | VideoWidget( QWidget * parent=0, const char * name=0, WFlags f=0 ); | ||
21 | virtual ~VideoWidget(); | ||
22 | |||
23 | void playFile(const DocLnk&,XINE::Lib*); | ||
24 | void fullScreen(bool how); | ||
25 | |||
26 | signals: | ||
27 | void videoclicked(); | ||
28 | |||
29 | public slots: | ||
30 | virtual void stopPlaying(); | ||
31 | virtual void updatePos(int); | ||
32 | |||
33 | protected: | ||
34 | XINE::Lib*m_xineLib; | ||
35 | DocLnk m_current; | ||
36 | QVBoxLayout*m_MainLayout; | ||
37 | XineVideoWidget*m_Videodisplay; | ||
38 | QWidget * m_holder; | ||
39 | QSlider*m_PosSlider; | ||
40 | bool m_pressed:1; | ||
41 | int m_uppos; | ||
42 | |||
43 | protected slots: | ||
44 | virtual void closeEvent(QCloseEvent*e); | ||
45 | virtual void slotNewPos(int pos); | ||
46 | virtual void sliderPressed(); | ||
47 | virtual void sliderReleased(); | ||
48 | virtual void slot_Videoresized(const QSize&); | ||
49 | virtual void slotStopped(); | ||
50 | virtual void slotClicked(); | ||
51 | }; | ||
52 | |||
53 | #endif | ||
@@ -155,16 +155,17 @@ CONFIG_OPIEALARM core/opiealarm opiealarm.pro | |||
155 | CONFIG_OPIE-CONSOLE noncore/apps/opie-consoleopie-console.pro | 155 | CONFIG_OPIE-CONSOLE noncore/apps/opie-consoleopie-console.pro |
156 | CONFIG_OPIE_EYE noncore/graphics/opie-eyephunk_view.pro | 156 | CONFIG_OPIE_EYE noncore/graphics/opie-eyephunk_view.pro |
157 | CONFIG_OPIE_EYE_SLAVE noncore/graphics/opie-eye/slaveslave.pro | 157 | CONFIG_OPIE_EYE_SLAVE noncore/graphics/opie-eye/slaveslave.pro |
158 | CONFIG_OPIEFTP noncore/net/opieftpopieftp.pro | 158 | CONFIG_OPIEFTP noncore/net/opieftpopieftp.pro |
159 | CONFIG_OPIEIRC noncore/net/opieircopieirc.pro | 159 | CONFIG_OPIEIRC noncore/net/opieircopieirc.pro |
160 | CONFIG_OPIE-LOGIN core/opie-loginopie-login.pro | 160 | CONFIG_OPIE-LOGIN core/opie-loginopie-login.pro |
161 | CONFIG_OPIEMAIL2noncore/unsupported/mail2 mail.pro | 161 | CONFIG_OPIEMAIL2noncore/unsupported/mail2 mail.pro |
162 | CONFIG_OPIEPLAYER2 noncore/multimedia/opieplayer2opieplayer2.pro | 162 | CONFIG_OPIEPLAYER2 noncore/multimedia/opieplayer2opieplayer2.pro |
163 | CONFIG_OPIEPLAYER3 noncore/multimedia/opieplayer3opieplayer3.pro | ||
163 | CONFIG_OPIEPLAYER core/multimedia/opieplayeropieplayer.pro | 164 | CONFIG_OPIEPLAYER core/multimedia/opieplayeropieplayer.pro |
164 | CONFIG_OPIE-RDESKTOP noncore/net/opierdesktopopierdesktop.pro | 165 | CONFIG_OPIE-RDESKTOP noncore/net/opierdesktopopierdesktop.pro |
165 | CONFIG_OPIE-READER noncore/apps/opie-readeropie-reader.pro | 166 | CONFIG_OPIE-READER noncore/apps/opie-readeropie-reader.pro |
166 | CONFIG_OPIEREC noncore/multimedia/opierecopierec.pro | 167 | CONFIG_OPIEREC noncore/multimedia/opierecopierec.pro |
167 | CONFIG_OPIE-SHEET noncore/apps/opie-sheetopie-sheet.pro | 168 | CONFIG_OPIE-SHEET noncore/apps/opie-sheetopie-sheet.pro |
168 | CONFIG_OPIE-SH noncore/tools/opie-shopie-sh.pro | 169 | CONFIG_OPIE-SH noncore/tools/opie-shopie-sh.pro |
169 | CONFIG_OPIETOOTH-APPLET noncore/net/opietooth/appletapplet.pro | 170 | CONFIG_OPIETOOTH-APPLET noncore/net/opietooth/appletapplet.pro |
170 | CONFIG_OPIETOOTH-MANAGER noncore/net/opietooth/managermanager.pro | 171 | CONFIG_OPIETOOTH-MANAGER noncore/net/opietooth/managermanager.pro |