summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidget.cpp1
-rw-r--r--noncore/multimedia/opieplayer2/xinecontrol.cpp48
-rw-r--r--noncore/multimedia/opieplayer2/xinecontrol.h4
3 files changed, 30 insertions, 23 deletions
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp
index d73f0cd..37b998f 100644
--- a/noncore/multimedia/opieplayer2/playlistwidget.cpp
+++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp
@@ -1,312 +1,313 @@
1/* 1/*
2                This file is part of the Opie Project 2                This file is part of the Opie Project
3 3
4              Copyright (c) 2002,2003 Max Reiss <harlekin@handhelds.org> 4              Copyright (c) 2002,2003 Max Reiss <harlekin@handhelds.org>
5 Copyright (c) 2002 L. Potter <ljp@llornkcor.com> 5 Copyright (c) 2002 L. Potter <ljp@llornkcor.com>
6 Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> 6 Copyright (c) 2002 Holger Freyther <zecke@handhelds.org>
7 =. 7 =.
8 .=l. 8 .=l.
9           .>+-= 9           .>+-=
10 _;:,     .>    :=|. This program is free software; you can 10 _;:,     .>    :=|. This program is free software; you can
11.> <`_,   >  .   <= redistribute it and/or modify it under 11.> <`_,   >  .   <= redistribute it and/or modify it under
12:`=1 )Y*s>-.--   : the terms of the GNU General Public 12:`=1 )Y*s>-.--   : the terms of the GNU General Public
13.="- .-=="i,     .._ License as published by the Free Software 13.="- .-=="i,     .._ License as published by the Free Software
14 - .   .-<_>     .<> Foundation; either version 2 of the License, 14 - .   .-<_>     .<> Foundation; either version 2 of the License,
15     ._= =}       : or (at your option) any later version. 15     ._= =}       : or (at your option) any later version.
16    .%`+i>       _;_. 16    .%`+i>       _;_.
17    .i_,=:_.      -<s. This program is distributed in the hope that 17    .i_,=:_.      -<s. This program is distributed in the hope that
18     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 18     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
19    : ..    .:,     . . . without even the implied warranty of 19    : ..    .:,     . . . without even the implied warranty of
20    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 20    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
21  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 21  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
22..}^=.=       =       ; General Public License for more 22..}^=.=       =       ; General Public License for more
23++=   -.     .`     .: details. 23++=   -.     .`     .: details.
24 :     =  ...= . :.=- 24 :     =  ...= . :.=-
25 -.   .:....=;==+<; You should have received a copy of the GNU 25 -.   .:....=;==+<; You should have received a copy of the GNU
26  -_. . .   )=.  = General Public License along with 26  -_. . .   )=.  = General Public License along with
27    --        :-=` this library; see the file COPYING.LIB. 27    --        :-=` this library; see the file COPYING.LIB.
28 If not, write to the Free Software Foundation, 28 If not, write to the Free Software Foundation,
29 Inc., 59 Temple Place - Suite 330, 29 Inc., 59 Temple Place - Suite 330,
30 Boston, MA 02111-1307, USA. 30 Boston, MA 02111-1307, USA.
31 31
32*/ 32*/
33 33
34#include "playlistselection.h" 34#include "playlistselection.h"
35#include "playlistwidget.h" 35#include "playlistwidget.h"
36#include "mediaplayer.h" 36#include "mediaplayer.h"
37#include "inputDialog.h" 37#include "inputDialog.h"
38#include "om3u.h" 38#include "om3u.h"
39#include "playlistfileview.h" 39#include "playlistfileview.h"
40 40
41/* OPIE */ 41/* OPIE */
42#include <opie2/odebug.h> 42#include <opie2/odebug.h>
43#include <opie2/ofiledialog.h> 43#include <opie2/ofiledialog.h>
44using namespace Opie::Core; 44using namespace Opie::Core;
45using namespace Opie::Ui; 45using namespace Opie::Ui;
46 46
47/* QT */ 47/* QT */
48#include <qmessagebox.h> 48#include <qmessagebox.h>
49#include <qtoolbar.h> 49#include <qtoolbar.h>
50 50
51/* STD */ 51/* STD */
52#include <assert.h> 52#include <assert.h>
53 53
54PlayListWidget::PlayListWidget(QWidget* parent, const char* name, WFlags fl ) 54PlayListWidget::PlayListWidget(QWidget* parent, const char* name, WFlags fl )
55 : PlayListWidgetGui( parent, "playList" ) , currentFileListView( 0 ) 55 : PlayListWidgetGui( parent, "playList" ) , currentFileListView( 0 )
56{ 56{
57 Global::statusMessage( tr( "Loading of Skin started" ) );
57 mediaPlayerState = new MediaPlayerState(0, "mediaPlayerState" ); 58 mediaPlayerState = new MediaPlayerState(0, "mediaPlayerState" );
58 m_mp = new MediaPlayer(*this, *mediaPlayerState, 0, "mediaPlayer"); 59 m_mp = new MediaPlayer(*this, *mediaPlayerState, 0, "mediaPlayer");
59 60
60 61
61 62
62 d->tbAddToList = new ToolButton( bar, tr( "Add to Playlist" ), 63 d->tbAddToList = new ToolButton( bar, tr( "Add to Playlist" ),
63 "opieplayer2/add_to_playlist", 64 "opieplayer2/add_to_playlist",
64 this , SLOT(addSelected() ) ); 65 this , SLOT(addSelected() ) );
65 d->tbRemoveFromList = new ToolButton( bar, tr( "Remove from Playlist" ), 66 d->tbRemoveFromList = new ToolButton( bar, tr( "Remove from Playlist" ),
66 "opieplayer2/remove_from_playlist", 67 "opieplayer2/remove_from_playlist",
67 this , SLOT(removeSelected() ) ); 68 this , SLOT(removeSelected() ) );
68 d->tbPlay = new ToolButton( bar, tr( "Play" ), "opieplayer2/play", 69 d->tbPlay = new ToolButton( bar, tr( "Play" ), "opieplayer2/play",
69 this , SLOT( btnPlay(bool) ), TRUE ); 70 this , SLOT( btnPlay(bool) ), TRUE );
70 d->tbShuffle = new ToolButton( bar, tr( "Randomize" ),"opieplayer2/shuffle", 71 d->tbShuffle = new ToolButton( bar, tr( "Randomize" ),"opieplayer2/shuffle",
71 mediaPlayerState, SLOT( setShuffled(bool) ), TRUE ); 72 mediaPlayerState, SLOT( setShuffled(bool) ), TRUE );
72 d->tbLoop = new ToolButton( bar, tr( "Loop" ), "opieplayer2/loop", 73 d->tbLoop = new ToolButton( bar, tr( "Loop" ), "opieplayer2/loop",
73 mediaPlayerState, SLOT( setLooping(bool) ), TRUE ); 74 mediaPlayerState, SLOT( setLooping(bool) ), TRUE );
74 75
75 (void)new MenuItem( pmPlayList, tr( "Clear List" ), this, SLOT( clearList() ) ); 76 (void)new MenuItem( pmPlayList, tr( "Clear List" ), this, SLOT( clearList() ) );
76 (void)new MenuItem( pmPlayList, tr( "Add all audio files" ), 77 (void)new MenuItem( pmPlayList, tr( "Add all audio files" ),
77 this, SLOT( addAllMusicToList() ) ); 78 this, SLOT( addAllMusicToList() ) );
78 (void)new MenuItem( pmPlayList, tr( "Add all video files" ), 79 (void)new MenuItem( pmPlayList, tr( "Add all video files" ),
79 this, SLOT( addAllVideoToList() ) ); 80 this, SLOT( addAllVideoToList() ) );
80 (void)new MenuItem( pmPlayList, tr( "Add all files" ), 81 (void)new MenuItem( pmPlayList, tr( "Add all files" ),
81 this, SLOT( addAllToList() ) ); 82 this, SLOT( addAllToList() ) );
82 pmPlayList->insertSeparator(-1); 83 pmPlayList->insertSeparator(-1);
83 (void)new MenuItem( pmPlayList, tr( "Add File" ), 84 (void)new MenuItem( pmPlayList, tr( "Add File" ),
84 this,SLOT( openFile() ) ); 85 this,SLOT( openFile() ) );
85 (void)new MenuItem( pmPlayList, tr("Add URL"), 86 (void)new MenuItem( pmPlayList, tr("Add URL"),
86 this,SLOT( openURL() ) ); 87 this,SLOT( openURL() ) );
87 pmPlayList->insertSeparator(-1); 88 pmPlayList->insertSeparator(-1);
88 (void)new MenuItem( pmPlayList, tr( "Save Playlist" ), 89 (void)new MenuItem( pmPlayList, tr( "Save Playlist" ),
89 this, SLOT(writem3u() ) ); 90 this, SLOT(writem3u() ) );
90 pmPlayList->insertSeparator(-1); 91 pmPlayList->insertSeparator(-1);
91 (void)new MenuItem( pmPlayList, tr( "Rescan for Audio Files" ), 92 (void)new MenuItem( pmPlayList, tr( "Rescan for Audio Files" ),
92 audioView, SLOT( scanFiles() ) ); 93 audioView, SLOT( scanFiles() ) );
93 (void)new MenuItem( pmPlayList, tr( "Rescan for Video Files" ), 94 (void)new MenuItem( pmPlayList, tr( "Rescan for Video Files" ),
94 videoView, SLOT( scanFiles() ) ); 95 videoView, SLOT( scanFiles() ) );
95 96
96 pmView->insertItem( Resource::loadPixmap("fullscreen") , tr( "Full Screen"), 97 pmView->insertItem( Resource::loadPixmap("fullscreen") , tr( "Full Screen"),
97 mediaPlayerState, SLOT( toggleFullscreen() ) ); 98 mediaPlayerState, SLOT( toggleFullscreen() ) );
98 99
99 Config cfg( "OpiePlayer" ); 100 Config cfg( "OpiePlayer" );
100 bool b= cfg.readBoolEntry("FullScreen", 0); 101 bool b= cfg.readBoolEntry("FullScreen", 0);
101 mediaPlayerState->setFullscreen( b ); 102 mediaPlayerState->setFullscreen( b );
102 pmView->setItemChecked( -16, b ); 103 pmView->setItemChecked( -16, b );
103 104
104 (void)new ToolButton( vbox1, tr( "Move Up" ), "opieplayer2/up", 105 (void)new ToolButton( vbox1, tr( "Move Up" ), "opieplayer2/up",
105 d->selectedFiles, SLOT(moveSelectedUp() ) ); 106 d->selectedFiles, SLOT(moveSelectedUp() ) );
106 (void)new ToolButton( vbox1, tr( "Remove" ), "opieplayer2/cut", 107 (void)new ToolButton( vbox1, tr( "Remove" ), "opieplayer2/cut",
107 d->selectedFiles, SLOT(removeSelected() ) ); 108 d->selectedFiles, SLOT(removeSelected() ) );
108 (void)new ToolButton( vbox1, tr( "Move Down" ), "opieplayer2/down", 109 (void)new ToolButton( vbox1, tr( "Move Down" ), "opieplayer2/down",
109 d->selectedFiles, SLOT(moveSelectedDown() ) ); 110 d->selectedFiles, SLOT(moveSelectedDown() ) );
110 QVBox *stretch2 = new QVBox( vbox1 ); 111 QVBox *stretch2 = new QVBox( vbox1 );
111 112
112 connect( tbDeletePlaylist, ( SIGNAL( released() ) ), 113 connect( tbDeletePlaylist, ( SIGNAL( released() ) ),
113 SLOT( deletePlaylist() ) ); 114 SLOT( deletePlaylist() ) );
114 connect( pmView, SIGNAL( activated(int) ), 115 connect( pmView, SIGNAL( activated(int) ),
115 this, SLOT( pmViewActivated(int) ) ); 116 this, SLOT( pmViewActivated(int) ) );
116 connect( skinsMenu, SIGNAL( activated(int) ) , 117 connect( skinsMenu, SIGNAL( activated(int) ) ,
117 this, SLOT( skinsMenuActivated(int) ) ); 118 this, SLOT( skinsMenuActivated(int) ) );
118 connect( d->selectedFiles, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ), 119 connect( d->selectedFiles, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ),
119 this,SLOT( playlistViewPressed(int,QListViewItem*,const QPoint&,int) ) ); 120 this,SLOT( playlistViewPressed(int,QListViewItem*,const QPoint&,int) ) );
120 connect( audioView, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ), 121 connect( audioView, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ),
121 this,SLOT( viewPressed(int,QListViewItem*,const QPoint&,int) ) ); 122 this,SLOT( viewPressed(int,QListViewItem*,const QPoint&,int) ) );
122 connect( audioView, SIGNAL( returnPressed(QListViewItem*) ), 123 connect( audioView, SIGNAL( returnPressed(QListViewItem*) ),
123 this,SLOT( playIt(QListViewItem*) ) ); 124 this,SLOT( playIt(QListViewItem*) ) );
124 connect( audioView, SIGNAL( doubleClicked(QListViewItem*) ), 125 connect( audioView, SIGNAL( doubleClicked(QListViewItem*) ),
125 this, SLOT( addToSelection(QListViewItem*) ) ); 126 this, SLOT( addToSelection(QListViewItem*) ) );
126 connect( videoView, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ), 127 connect( videoView, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ),
127 this,SLOT( viewPressed(int,QListViewItem*,const QPoint&,int) ) ); 128 this,SLOT( viewPressed(int,QListViewItem*,const QPoint&,int) ) );
128 connect( videoView, SIGNAL( returnPressed(QListViewItem*) ), 129 connect( videoView, SIGNAL( returnPressed(QListViewItem*) ),
129 this,SLOT( playIt(QListViewItem*) ) ); 130 this,SLOT( playIt(QListViewItem*) ) );
130 connect( videoView, SIGNAL( doubleClicked(QListViewItem*) ), 131 connect( videoView, SIGNAL( doubleClicked(QListViewItem*) ),
131 this, SLOT( addToSelection(QListViewItem*) ) ); 132 this, SLOT( addToSelection(QListViewItem*) ) );
132 connect( playLists, SIGNAL( fileSelected(const DocLnk&) ), 133 connect( playLists, SIGNAL( fileSelected(const DocLnk&) ),
133 this, SLOT( loadList(const DocLnk&) ) ); 134 this, SLOT( loadList(const DocLnk&) ) );
134 connect( tabWidget, SIGNAL ( currentChanged(QWidget*) ), 135 connect( tabWidget, SIGNAL ( currentChanged(QWidget*) ),
135 this, SLOT( tabChanged(QWidget*) ) ); 136 this, SLOT( tabChanged(QWidget*) ) );
136 connect( mediaPlayerState, SIGNAL( playingToggled(bool) ), 137 connect( mediaPlayerState, SIGNAL( playingToggled(bool) ),
137 d->tbPlay, SLOT( setOn(bool) ) ); 138 d->tbPlay, SLOT( setOn(bool) ) );
138 connect( mediaPlayerState, SIGNAL( loopingToggled(bool) ), 139 connect( mediaPlayerState, SIGNAL( loopingToggled(bool) ),
139 d->tbLoop, SLOT( setOn(bool) ) ); 140 d->tbLoop, SLOT( setOn(bool) ) );
140 connect( mediaPlayerState, SIGNAL( shuffledToggled(bool) ), 141 connect( mediaPlayerState, SIGNAL( shuffledToggled(bool) ),
141 d->tbShuffle, SLOT( setOn(bool) ) ); 142 d->tbShuffle, SLOT( setOn(bool) ) );
142 connect( d->selectedFiles, SIGNAL( doubleClicked(QListViewItem*) ), 143 connect( d->selectedFiles, SIGNAL( doubleClicked(QListViewItem*) ),
143 this, SLOT( playIt(QListViewItem*) ) ); 144 this, SLOT( playIt(QListViewItem*) ) );
144 connect ( gammaSlider, SIGNAL( valueChanged(int) ), 145 connect ( gammaSlider, SIGNAL( valueChanged(int) ),
145 mediaPlayerState, SLOT( setVideoGamma(int) ) ); 146 mediaPlayerState, SLOT( setVideoGamma(int) ) );
146 147
147 connect( this, SIGNAL(skinSelected() ), 148 connect( this, SIGNAL(skinSelected() ),
148 m_mp, SLOT( reloadSkins() ) ); 149 m_mp, SLOT( reloadSkins() ) );
149 150
150 // see which skins are installed 151 // see which skins are installed
151 populateSkinsMenu(); 152 populateSkinsMenu();
152 initializeStates(); 153 initializeStates();
153 154
154 channel = new QCopChannel( "QPE/Application/opieplayer2", this ); 155 channel = new QCopChannel( "QPE/Application/opieplayer2", this );
155 connect( channel, SIGNAL(received(const QCString&,const QByteArray&)), 156 connect( channel, SIGNAL(received(const QCString&,const QByteArray&)),
156 this, SLOT( qcopReceive(const QCString&,const QByteArray&)) ); 157 this, SLOT( qcopReceive(const QCString&,const QByteArray&)) );
157 158
158 159
159 cfg.setGroup("PlayList"); 160 cfg.setGroup("PlayList");
160 QString currentPlaylist = cfg.readEntry( "CurrentPlaylist", "default"); 161 QString currentPlaylist = cfg.readEntry( "CurrentPlaylist", "default");
161 loadList(DocLnk( currentPlaylist ) ); 162 loadList(DocLnk( currentPlaylist ) );
162 163
163 tabWidget->showPage( playListTab ); 164 tabWidget->showPage( playListTab );
164} 165}
165 166
166 167
167PlayListWidget::~PlayListWidget() { 168PlayListWidget::~PlayListWidget() {
168 delete d; 169 delete d;
169 delete m_mp; 170 delete m_mp;
170} 171}
171 172
172 173
173void PlayListWidget::initializeStates() { 174void PlayListWidget::initializeStates() {
174 d->tbPlay->setOn( mediaPlayerState->isPlaying() ); 175 d->tbPlay->setOn( mediaPlayerState->isPlaying() );
175 d->tbLoop->setOn( mediaPlayerState->isLooping() ); 176 d->tbLoop->setOn( mediaPlayerState->isLooping() );
176 d->tbShuffle->setOn( mediaPlayerState->isShuffled() ); 177 d->tbShuffle->setOn( mediaPlayerState->isShuffled() );
177 d->playListFrame->show(); 178 d->playListFrame->show();
178} 179}
179 180
180void PlayListWidget::writeDefaultPlaylist() { 181void PlayListWidget::writeDefaultPlaylist() {
181 182
182 Config config( "OpiePlayer" ); 183 Config config( "OpiePlayer" );
183 config.setGroup( "PlayList" ); 184 config.setGroup( "PlayList" );
184 QString filename=QPEApplication::documentDir() + "/default.m3u"; 185 QString filename=QPEApplication::documentDir() + "/default.m3u";
185 QString currentString = config.readEntry( "CurrentPlaylist", filename); 186 QString currentString = config.readEntry( "CurrentPlaylist", filename);
186 if( currentString == filename) { 187 if( currentString == filename) {
187 Om3u *m3uList; 188 Om3u *m3uList;
188 if( d->selectedFiles->first() ) { 189 if( d->selectedFiles->first() ) {
189 m3uList = new Om3u(filename, IO_ReadWrite | IO_Truncate); 190 m3uList = new Om3u(filename, IO_ReadWrite | IO_Truncate);
190 do { 191 do {
191 m3uList->add( d->selectedFiles->current()->file() ); 192 m3uList->add( d->selectedFiles->current()->file() );
192 } 193 }
193 while ( d->selectedFiles->next() ); 194 while ( d->selectedFiles->next() );
194 195
195 m3uList->write(); 196 m3uList->write();
196 m3uList->close(); 197 m3uList->close();
197 delete m3uList; 198 delete m3uList;
198 199
199 } 200 }
200 } 201 }
201} 202}
202 203
203void PlayListWidget::addToSelection( const DocLnk& lnk ) { 204void PlayListWidget::addToSelection( const DocLnk& lnk ) {
204 d->setDocumentUsed = FALSE; 205 d->setDocumentUsed = FALSE;
205 if( QFileInfo( lnk.file() ).exists() || 206 if( QFileInfo( lnk.file() ).exists() ||
206 lnk.file().left(4) == "http" ) { 207 lnk.file().left(4) == "http" ) {
207 d->selectedFiles->addToSelection( lnk ); 208 d->selectedFiles->addToSelection( lnk );
208 } 209 }
209} 210}
210 211
211 212
212void PlayListWidget::clearList() { 213void PlayListWidget::clearList() {
213 while ( first() ) { 214 while ( first() ) {
214 d->selectedFiles->removeSelected(); 215 d->selectedFiles->removeSelected();
215 } 216 }
216 Config cfg( "OpiePlayer" ); 217 Config cfg( "OpiePlayer" );
217 cfg.setGroup("PlayList"); 218 cfg.setGroup("PlayList");
218 cfg.writeEntry("CurrentPlaylist","default"); 219 cfg.writeEntry("CurrentPlaylist","default");
219 setCaption("OpiePlayer"); 220 setCaption("OpiePlayer");
220} 221}
221 222
222void PlayListWidget::viewPressed( int mouse, QListViewItem *, const QPoint& , int) { 223void PlayListWidget::viewPressed( int mouse, QListViewItem *, const QPoint& , int) {
223 switch (mouse) { 224 switch (mouse) {
224 case LeftButton: 225 case LeftButton:
225 break; 226 break;
226 case RightButton: 227 case RightButton:
227 { 228 {
228 QPopupMenu m; 229 QPopupMenu m;
229 m.insertItem( tr( "Play Selected" ), this, SLOT( playSelected() )); 230 m.insertItem( tr( "Play Selected" ), this, SLOT( playSelected() ));
230 m.insertItem( tr( "Add to Playlist" ), this, SLOT( addSelected() )); 231 m.insertItem( tr( "Add to Playlist" ), this, SLOT( addSelected() ));
231 m.exec( QCursor::pos() ); 232 m.exec( QCursor::pos() );
232 } 233 }
233 break; 234 break;
234 } 235 }
235} 236}
236 237
237 238
238void PlayListWidget::playlistViewPressed( int mouse, QListViewItem *, const QPoint& , int ) { 239void PlayListWidget::playlistViewPressed( int mouse, QListViewItem *, const QPoint& , int ) {
239 switch (mouse) { 240 switch (mouse) {
240 case LeftButton: 241 case LeftButton:
241 break; 242 break;
242 case RightButton: 243 case RightButton:
243 { 244 {
244 QPopupMenu m; 245 QPopupMenu m;
245 m.insertItem( tr( "Play" ), this, SLOT( playSelected() )); 246 m.insertItem( tr( "Play" ), this, SLOT( playSelected() ));
246 m.insertItem( tr( "Remove" ), this, SLOT( removeSelected() )); 247 m.insertItem( tr( "Remove" ), this, SLOT( removeSelected() ));
247 m.exec( QCursor::pos() ); 248 m.exec( QCursor::pos() );
248 } 249 }
249 break; 250 break;
250 } 251 }
251} 252}
252 253
253 254
254void PlayListWidget::addAllToList() { 255void PlayListWidget::addAllToList() {
255 256
256 257
257 audioView->populateView(); 258 audioView->populateView();
258 259
259 QListViewItemIterator audioIt( audioView ); 260 QListViewItemIterator audioIt( audioView );
260 DocLnk lnk; 261 DocLnk lnk;
261 QString filename; 262 QString filename;
262 // iterate through all items of the listview 263 // iterate through all items of the listview
263 for ( ; audioIt.current(); ++audioIt ) { 264 for ( ; audioIt.current(); ++audioIt ) {
264 filename = audioIt.current()->text(3); 265 filename = audioIt.current()->text(3);
265 lnk.setName( QFileInfo(filename).baseName() ); //sets name 266 lnk.setName( QFileInfo(filename).baseName() ); //sets name
266 lnk.setFile( filename ); //sets file name 267 lnk.setFile( filename ); //sets file name
267 d->selectedFiles->addToSelection( lnk); 268 d->selectedFiles->addToSelection( lnk);
268 } 269 }
269 270
270 videoView->populateView(); 271 videoView->populateView();
271 272
272 QListViewItemIterator videoIt( videoView ); 273 QListViewItemIterator videoIt( videoView );
273 for ( ; videoIt.current(); ++videoIt ) { 274 for ( ; videoIt.current(); ++videoIt ) {
274 filename = videoIt.current()->text(3); 275 filename = videoIt.current()->text(3);
275 lnk.setName( QFileInfo(filename).baseName() ); //sets name 276 lnk.setName( QFileInfo(filename).baseName() ); //sets name
276 lnk.setFile( filename ); //sets file name 277 lnk.setFile( filename ); //sets file name
277 d->selectedFiles->addToSelection( lnk); 278 d->selectedFiles->addToSelection( lnk);
278 } 279 }
279 280
280 tabWidget->setCurrentPage(0); 281 tabWidget->setCurrentPage(0);
281 282
282 writeCurrentM3u(); 283 writeCurrentM3u();
283 d->selectedFiles->first(); 284 d->selectedFiles->first();
284} 285}
285 286
286 287
287void PlayListWidget::addAllMusicToList() { 288void PlayListWidget::addAllMusicToList() {
288 289
289 audioView->populateView(); 290 audioView->populateView();
290 291
291 QListViewItemIterator audioIt( audioView ); 292 QListViewItemIterator audioIt( audioView );
292 DocLnk lnk; 293 DocLnk lnk;
293 QString filename; 294 QString filename;
294 // iterate through all items of the listview 295 // iterate through all items of the listview
295 for ( ; audioIt.current(); ++audioIt ) { 296 for ( ; audioIt.current(); ++audioIt ) {
296 filename = audioIt.current()->text(3); 297 filename = audioIt.current()->text(3);
297 lnk.setName( QFileInfo(filename).baseName() ); //sets name 298 lnk.setName( QFileInfo(filename).baseName() ); //sets name
298 lnk.setFile( filename ); //sets file name 299 lnk.setFile( filename ); //sets file name
299 d->selectedFiles->addToSelection( lnk); 300 d->selectedFiles->addToSelection( lnk);
300 } 301 }
301 302
302 tabWidget->setCurrentPage(0); 303 tabWidget->setCurrentPage(0);
303 writeCurrentM3u(); 304 writeCurrentM3u();
304 d->selectedFiles->first(); 305 d->selectedFiles->first();
305} 306}
306 307
307 308
308void PlayListWidget::addAllVideoToList() { 309void PlayListWidget::addAllVideoToList() {
309 310
310 videoView->populateView(); 311 videoView->populateView();
311 312
312 QListViewItemIterator videoIt( videoView ); 313 QListViewItemIterator videoIt( videoView );
diff --git a/noncore/multimedia/opieplayer2/xinecontrol.cpp b/noncore/multimedia/opieplayer2/xinecontrol.cpp
index e1816c8..c47a773 100644
--- a/noncore/multimedia/opieplayer2/xinecontrol.cpp
+++ b/noncore/multimedia/opieplayer2/xinecontrol.cpp
@@ -1,274 +1,282 @@
1/* 1/*
2                This file is part of the Opie Project 2                This file is part of the Opie Project
3 3
4              Copyright (c) 2002 Max Reiss <harlekin@handhelds.org> 4              Copyright (c) 2002 Max Reiss <harlekin@handhelds.org>
5 Copyright (c) 2002 L. Potter <ljp@llornkcor.com> 5 Copyright (c) 2002 L. Potter <ljp@llornkcor.com>
6 Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> 6 Copyright (c) 2002 Holger Freyther <zecke@handhelds.org>
7 =. 7 =.
8 .=l. 8 .=l.
9           .>+-= 9           .>+-=
10 _;:,     .>    :=|. This program is free software; you can 10 _;:,     .>    :=|. This program is free software; you can
11.> <`_,   >  .   <= redistribute it and/or modify it under 11.> <`_,   >  .   <= redistribute it and/or modify it under
12:`=1 )Y*s>-.--   : the terms of the GNU General Public 12:`=1 )Y*s>-.--   : the terms of the GNU General Public
13.="- .-=="i,     .._ License as published by the Free Software 13.="- .-=="i,     .._ License as published by the Free Software
14 - .   .-<_>     .<> Foundation; either version 2 of the License, 14 - .   .-<_>     .<> Foundation; either version 2 of the License,
15     ._= =}       : or (at your option) any later version. 15     ._= =}       : or (at your option) any later version.
16    .%`+i>       _;_. 16    .%`+i>       _;_.
17    .i_,=:_.      -<s. This program is distributed in the hope that 17    .i_,=:_.      -<s. This program is distributed in the hope that
18     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 18     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
19    : ..    .:,     . . . without even the implied warranty of 19    : ..    .:,     . . . without even the implied warranty of
20    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 20    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
21  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 21  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
22..}^=.=       =       ; General Public License for more 22..}^=.=       =       ; General Public License for more
23++=   -.     .`     .: details. 23++=   -.     .`     .: details.
24 :     =  ...= . :.=- 24 :     =  ...= . :.=-
25 -.   .:....=;==+<; You should have received a copy of the GNU 25 -.   .:....=;==+<; You should have received a copy of the GNU
26  -_. . .   )=.  = General Public License along with 26  -_. . .   )=.  = General Public License along with
27    --        :-=` this library; see the file COPYING.LIB. 27    --        :-=` this library; see the file COPYING.LIB.
28 If not, write to the Free Software Foundation, 28 If not, write to the Free Software Foundation,
29 Inc., 59 Temple Place - Suite 330, 29 Inc., 59 Temple Place - Suite 330,
30 Boston, MA 02111-1307, USA. 30 Boston, MA 02111-1307, USA.
31 31
32*/ 32*/
33 33
34#include "xinecontrol.h" 34#include "xinecontrol.h"
35#include "xinevideowidget.h" 35#include "xinevideowidget.h"
36 36
37/* OPIE */ 37/* OPIE */
38#include <opie2/odebug.h> 38#include <opie2/odebug.h>
39#include <qpe/qcopenvelope_qws.h> 39#include <qpe/qcopenvelope_qws.h>
40#include <qpe/qpeapplication.h> 40#include <qpe/qpeapplication.h>
41using namespace Opie::Core; 41using namespace Opie::Core;
42 42
43/* QT */ 43/* QT */
44#include <qtimer.h> 44#include <qtimer.h>
45#include <qmessagebox.h> 45#include <qmessagebox.h>
46 46
47XineControl::XineControl( XineVideoWidget *xineWidget,
48 MediaPlayerState &_mediaPlayerState,
49 QObject *parent, const char *name )
50 : QObject( parent, name ), mediaPlayerState( _mediaPlayerState ), xineVideoWidget( xineWidget )
51{
52 libXine = new XINE::Lib( XINE::Lib::InitializeImmediately, xineWidget );
53
54 init();
55}
56
57XineControl::XineControl( XINE::Lib *xine, XineVideoWidget *xineWidget, 47XineControl::XineControl( XINE::Lib *xine, XineVideoWidget *xineWidget,
58 MediaPlayerState &_mediaPlayerState, 48 MediaPlayerState &_mediaPlayerState,
59 QObject *parent, const char *name ) 49 QObject *parent, const char *name )
60 : QObject( parent, name ), libXine( xine ), mediaPlayerState( _mediaPlayerState ), xineVideoWidget( xineWidget ) 50 : QObject( parent, name ), libXine( xine ), mediaPlayerState( _mediaPlayerState ), xineVideoWidget( xineWidget )
61{ 51{
52 m_wasError = false;
53
62 xine->ensureInitialized(); 54 xine->ensureInitialized();
63 55
64 xine->setWidget( xineWidget ); 56 xine->setWidget( xineWidget );
65 57
66 init(); 58 init();
67} 59}
68 60
69void XineControl::init() 61void XineControl::init()
70{ 62{
71 connect( &mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( pause(bool) ) ); 63 connect( &mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( pause(bool) ) );
72 connect( this, SIGNAL( positionChanged(long) ), &mediaPlayerState, SLOT( updatePosition(long) ) ); 64 connect( this, SIGNAL( positionChanged(long) ), &mediaPlayerState, SLOT( updatePosition(long) ) );
73 connect( &mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( stop(bool) ) ); 65 connect( &mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( stop(bool) ) );
74 connect( &mediaPlayerState, SIGNAL( fullscreenToggled(bool) ), this, SLOT( setFullscreen(bool) ) ); 66 connect( &mediaPlayerState, SIGNAL( fullscreenToggled(bool) ), this, SLOT( setFullscreen(bool) ) );
75 connect( &mediaPlayerState, SIGNAL( positionChanged(long) ), this, SLOT( seekTo(long) ) ); 67 connect( &mediaPlayerState, SIGNAL( positionChanged(long) ), this, SLOT( seekTo(long) ) );
76 connect( &mediaPlayerState, SIGNAL( videoGammaChanged(int) ), this, SLOT( setGamma(int) ) ); 68 connect( &mediaPlayerState, SIGNAL( videoGammaChanged(int) ), this, SLOT( setGamma(int) ) );
77 connect( libXine, SIGNAL( stopped() ), this, SLOT( nextMedia() ) ); 69 connect( libXine, SIGNAL( stopped() ), this, SLOT( nextMedia() ) );
78 connect( xineVideoWidget, SIGNAL( videoResized(const QSize&) ), this, SLOT( videoResized(const QSize&) ) ); 70 connect( xineVideoWidget, SIGNAL( videoResized(const QSize&) ), this, SLOT( videoResized(const QSize&) ) );
79 71
80 disabledSuspendScreenSaver = FALSE; 72 disabledSuspendScreenSaver = FALSE;
81} 73}
82 74
83XineControl::~XineControl() { 75XineControl::~XineControl() {
84#if !defined(QT_NO_COP) 76#if !defined(QT_NO_COP)
85 if ( disabledSuspendScreenSaver ) { 77 if ( disabledSuspendScreenSaver ) {
86 disabledSuspendScreenSaver = FALSE; 78 disabledSuspendScreenSaver = FALSE;
87 // Re-enable the suspend mode 79 // Re-enable the suspend mode
88 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable; 80 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable;
89 } 81 }
90#endif 82#endif
91 delete libXine; 83 delete libXine;
92} 84}
93 85
94void XineControl::play( const QString& fileName ) { 86void XineControl::play( const QString& fileName ) {
95 87
96 hasVideoChannel = FALSE; 88 hasVideoChannel = FALSE;
97 hasAudioChannel = FALSE; 89 hasAudioChannel = FALSE;
98 m_fileName = fileName; 90 m_fileName = fileName;
91 m_wasError = false;
99 92
100 odebug << "<<FILENAME: " + fileName + ">>>>" << oendl;
101 93
94 /*
95 * If Playing Fails we will fire up an MessgaeBox
96 * but present the AudioWidget so the User can
97 * either Quit and change the Playlist or Continue
98 */
102 if ( !libXine->play( fileName, 0, 0 ) ) { 99 if ( !libXine->play( fileName, 0, 0 ) ) {
103 QMessageBox::warning( 0l , tr( "Failure" ), getErrorCode() ); 100 QMessageBox::warning( 0l , tr( "Failure" ), getErrorCode() );
104 // toggle stop so the the play button is reset 101 m_wasError = true;
105 mediaPlayerState.setPlaying( false );
106 return;
107 } 102 }
108 mediaPlayerState.setPlaying( true ); 103 mediaPlayerState.setPlaying( true );
109 104
110 MediaPlayerState::DisplayType displayType; 105 MediaPlayerState::DisplayType displayType;
111 if ( !libXine->hasVideo() ) { 106 if ( !libXine->hasVideo() ) {
112 displayType = MediaPlayerState::Audio; 107 displayType = MediaPlayerState::Audio;
113 libXine->setShowVideo( false ); 108 libXine->setShowVideo( false );
114 hasAudioChannel = TRUE; 109 hasAudioChannel = TRUE;
115 } else { 110 } else {
116 displayType = MediaPlayerState::Video; 111 displayType = MediaPlayerState::Video;
117 libXine->setShowVideo( true ); 112 libXine->setShowVideo( true );
118 hasVideoChannel = TRUE; 113 hasVideoChannel = TRUE;
119 } 114 }
120 // determine if slider is shown 115 // determine if slider is shown
121 mediaPlayerState.setIsSeekable( libXine->isSeekable() ); 116 mediaPlayerState.setIsSeekable( libXine->isSeekable() );
122 117
123 // which gui (video / audio) 118 // which gui (video / audio)
124 mediaPlayerState.setDisplayType( displayType ); 119 mediaPlayerState.setDisplayType( displayType );
125 120
126#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 121#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
127 if ( !disabledSuspendScreenSaver ) { 122 if ( !disabledSuspendScreenSaver ) {
128 disabledSuspendScreenSaver = TRUE; 123 disabledSuspendScreenSaver = TRUE;
129 // Stop the screen from blanking and power saving state 124 // Stop the screen from blanking and power saving state
130 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) 125 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" )
131 << ( displayType == MediaPlayerState::Video ? QPEApplication::Disable : QPEApplication::DisableSuspend ); 126 << ( displayType == MediaPlayerState::Video ? QPEApplication::Disable : QPEApplication::DisableSuspend );
132 } 127 }
133#endif 128#endif
134 129
135 length(); 130 length();
136 position(); 131 position();
137} 132}
138 133
139void XineControl::nextMedia() { 134void XineControl::nextMedia() {
140 mediaPlayerState.setNext(); 135 mediaPlayerState.setNext();
141} 136}
142 137
143void XineControl::setGamma( int value ) { 138void XineControl::setGamma( int value ) {
144 libXine->setGamma( value ); 139 libXine->setGamma( value );
145} 140}
146 141
147void XineControl::stop( bool isSet ) { 142void XineControl::stop( bool isSet ) {
148 if ( !isSet ) { 143 if ( !isSet ) {
149 libXine->stop(); 144 libXine->stop();
150 145
151#if !defined(QT_NO_COP) 146#if !defined(QT_NO_COP)
152 if ( disabledSuspendScreenSaver ) { 147 if ( disabledSuspendScreenSaver ) {
153 disabledSuspendScreenSaver = FALSE; 148 disabledSuspendScreenSaver = FALSE;
154 // Re-enable the suspend mode 149 // Re-enable the suspend mode
155 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable; 150 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable;
156 } 151 }
157#endif 152#endif
158 } 153 }
159} 154}
160 155
161/** 156/**
162 * Pause playback 157 * Pause playback
163 * @isSet 158 * @isSet
164 */ 159 */
165void XineControl::pause( bool isSet) { 160void XineControl::pause( bool isSet) {
166 libXine->pause( isSet ); 161 libXine->pause( isSet );
167} 162}
168 163
169 164
170/** 165/**
171 * get current time in playback 166 * get current time in playback
172 */ 167 */
173long XineControl::currentTime() { 168long XineControl::currentTime() {
174 // todo: jede sekunde überprüfen 169 // todo: jede sekunde überprüfen
175 m_currentTime = libXine->currentTime(); 170 m_currentTime = libXine->currentTime();
176 return m_currentTime; 171 return m_currentTime;
177} 172}
178 173
179/** 174/**
180 * Set the length of the media file 175 * Set the length of the media file
181 */ 176 */
182void XineControl::length() { 177void XineControl::length() {
183 m_length = libXine->length(); 178 m_length = libXine->length();
184 mediaPlayerState.setLength( m_length ); 179 mediaPlayerState.setLength( m_length );
185} 180}
186 181
187 182
188/** 183/**
189 * Reports the position the xine backend is at right now 184 * Reports the position the xine backend is at right now
190 * @return long the postion in seconds 185 * @return long the postion in seconds
191 */ 186 */
192long XineControl::position() { 187long XineControl::position() {
193 m_position = ( currentTime() ); 188 m_position = ( currentTime() );
194 mediaPlayerState.updatePosition( m_position ); 189 mediaPlayerState.updatePosition( m_position );
195 long emitPos = (long)m_position; 190 long emitPos = (long)m_position;
196 emit positionChanged( emitPos ); 191 emit positionChanged( emitPos );
197 if( mediaPlayerState.isPlaying() ) { 192 if( mediaPlayerState.isPlaying() ) {
198 // needs to be stopped the media is stopped 193 // needs to be stopped the media is stopped
199 QTimer::singleShot( 1000, this, SLOT( position() ) ); 194 QTimer::singleShot( 1000, this, SLOT( position() ) );
200 } 195 }
201 return m_position; 196 return m_position;
202} 197}
203 198
204/** 199/**
205 * Set videoplayback to fullscreen 200 * Set videoplayback to fullscreen
206 * @param isSet 201 * @param isSet
207 */ 202 */
208void XineControl::setFullscreen( bool isSet ) { 203void XineControl::setFullscreen( bool isSet ) {
209 libXine->showVideoFullScreen( isSet ); 204 libXine->showVideoFullScreen( isSet );
210} 205}
211 206
212 207
213QString XineControl::getMetaInfo() { 208QString XineControl::getMetaInfo() {
214 209
215 QString returnString; 210 QString returnString;
216 211
212 /*
213 * If there was an error let us
214 * change the Meta Info to contain the Error Message
215 */
216 if ( m_wasError ) {
217 returnString = tr("Error on file '%1' with reason: ",
218 "Error when playing a file" ).arg( m_fileName );
219 returnString += getErrorCode();
220 returnString.replace( QRegExp("<qt>", false), "" );
221 returnString.replace( QRegExp("</qt>", false), "" );
222 return returnString;
223 }
224
217 if ( !libXine->metaInfo( 0 ).isEmpty() ) { 225 if ( !libXine->metaInfo( 0 ).isEmpty() ) {
218 returnString += tr( " Title: " + libXine->metaInfo( 0 ) ); 226 returnString += tr( " Title: " + libXine->metaInfo( 0 ) );
219 } 227 }
220 228
221 if ( !libXine->metaInfo( 1 ).isEmpty() ) { 229 if ( !libXine->metaInfo( 1 ).isEmpty() ) {
222 returnString += tr( " Comment: " + libXine->metaInfo( 1 ) ); 230 returnString += tr( " Comment: " + libXine->metaInfo( 1 ) );
223 } 231 }
224 232
225 if ( !libXine->metaInfo( 2 ).isEmpty() ) { 233 if ( !libXine->metaInfo( 2 ).isEmpty() ) {
226 returnString += tr( " Artist: " + libXine->metaInfo( 2 ) ); 234 returnString += tr( " Artist: " + libXine->metaInfo( 2 ) );
227 } 235 }
228 236
229 if ( !libXine->metaInfo( 3 ).isEmpty() ) { 237 if ( !libXine->metaInfo( 3 ).isEmpty() ) {
230 returnString += tr( " Genre: " + libXine->metaInfo( 3 ) ); 238 returnString += tr( " Genre: " + libXine->metaInfo( 3 ) );
231 } 239 }
232 240
233 if ( !libXine->metaInfo( 4 ).isEmpty() ) { 241 if ( !libXine->metaInfo( 4 ).isEmpty() ) {
234 returnString += tr( " Album: " + libXine->metaInfo( 4 ) ); 242 returnString += tr( " Album: " + libXine->metaInfo( 4 ) );
235 } 243 }
236 244
237 if ( !libXine->metaInfo( 5 ).isEmpty() ) { 245 if ( !libXine->metaInfo( 5 ).isEmpty() ) {
238 returnString += tr( " Year: " + libXine->metaInfo( 5 ) ); 246 returnString += tr( " Year: " + libXine->metaInfo( 5 ) );
239 } 247 }
240 return returnString; 248 return returnString;
241} 249}
242 250
243QString XineControl::getErrorCode() { 251QString XineControl::getErrorCode() {
244 252
245 int errorCode = libXine->error(); 253 int errorCode = libXine->error();
246 254
247 odebug << QString("ERRORCODE: %1 ").arg(errorCode) << oendl; 255 odebug << QString("ERRORCODE: %1 ").arg(errorCode) << oendl;
248 256
249 if ( errorCode == 1 ) { 257 if ( errorCode == 1 ) {
250 return tr( "No input plugin found for this media type" ); 258 return tr( "<qt>No input plugin found for this media type</qt>" );
251 } else if ( errorCode == 2 ) { 259 } else if ( errorCode == 2 ) {
252 return tr( "No demux plugin found for this media type" ); 260 return tr( "<qt>No demux plugin found for this media type</qt>" );
253 } else if ( errorCode == 3 ) { 261 } else if ( errorCode == 3 ) {
254 return tr( "Demuxing failed for this media type" ); 262 return tr( "<qt>Demuxing failed for this media type</qt>" );
255 } else if ( errorCode == 4 ) { 263 } else if ( errorCode == 4 ) {
256 return tr( "Malformed MRL" ); 264 return tr( "<qt>Malformed MRL</qt>" );
257 } else if ( errorCode == 5 ) { 265 } else if ( errorCode == 5 ) {
258 return tr( "Input failed" ); 266 return tr( "<qt>Input failed</qt>" );
259 } else { 267 } else {
260 return tr( "Some other error" ); 268 return tr( "<qt>Some other error</qt>" );
261 } 269 }
262} 270}
263 271
264/** 272/**
265 * Seek to a position in the track 273 * Seek to a position in the track
266 * @param second the second to jump to 274 * @param second the second to jump to
267 */ 275 */
268void XineControl::seekTo( long second ) { 276void XineControl::seekTo( long second ) {
269 libXine->seekTo( (int)second ); 277 libXine->seekTo( (int)second );
270} 278}
271 279
272void XineControl::videoResized ( const QSize &s ) { 280void XineControl::videoResized ( const QSize &s ) {
273 libXine->resize( s ); 281 libXine->resize( s );
274} 282}
diff --git a/noncore/multimedia/opieplayer2/xinecontrol.h b/noncore/multimedia/opieplayer2/xinecontrol.h
index 3f44f2e..848bd05 100644
--- a/noncore/multimedia/opieplayer2/xinecontrol.h
+++ b/noncore/multimedia/opieplayer2/xinecontrol.h
@@ -1,126 +1,124 @@
1/* 1/*
2                This file is part of the Opie Project 2                This file is part of the Opie Project
3 3
4              Copyright (c) 2002 Max Reiss <harlekin@handhelds.org> 4              Copyright (c) 2002 Max Reiss <harlekin@handhelds.org>
5 Copyright (c) 2002 L. Potter <ljp@llornkcor.com> 5 Copyright (c) 2002 L. Potter <ljp@llornkcor.com>
6 Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> 6 Copyright (c) 2002 Holger Freyther <zecke@handhelds.org>
7 =. 7 =.
8 .=l. 8 .=l.
9           .>+-= 9           .>+-=
10 _;:,     .>    :=|. This program is free software; you can 10 _;:,     .>    :=|. This program is free software; you can
11.> <`_,   >  .   <= redistribute it and/or modify it under 11.> <`_,   >  .   <= redistribute it and/or modify it under
12:`=1 )Y*s>-.--   : the terms of the GNU General Public 12:`=1 )Y*s>-.--   : the terms of the GNU General Public
13.="- .-=="i,     .._ License as published by the Free Software 13.="- .-=="i,     .._ License as published by the Free Software
14 - .   .-<_>     .<> Foundation; either version 2 of the License, 14 - .   .-<_>     .<> Foundation; either version 2 of the License,
15     ._= =}       : or (at your option) any later version. 15     ._= =}       : or (at your option) any later version.
16    .%`+i>       _;_. 16    .%`+i>       _;_.
17    .i_,=:_.      -<s. This program is distributed in the hope that 17    .i_,=:_.      -<s. This program is distributed in the hope that
18     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 18     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
19    : ..    .:,     . . . without even the implied warranty of 19    : ..    .:,     . . . without even the implied warranty of
20    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 20    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
21  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 21  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
22..}^=.=       =       ; General Public License for more 22..}^=.=       =       ; General Public License for more
23++=   -.     .`     .: details. 23++=   -.     .`     .: details.
24 :     =  ...= . :.=- 24 :     =  ...= . :.=-
25 -.   .:....=;==+<; You should have received a copy of the GNU 25 -.   .:....=;==+<; You should have received a copy of the GNU
26  -_. . .   )=.  = General Public License along with 26  -_. . .   )=.  = General Public License along with
27    --        :-=` this library; see the file COPYING.LIB. 27    --        :-=` this library; see the file COPYING.LIB.
28 If not, write to the Free Software Foundation, 28 If not, write to the Free Software Foundation,
29 Inc., 59 Temple Place - Suite 330, 29 Inc., 59 Temple Place - Suite 330,
30 Boston, MA 02111-1307, USA. 30 Boston, MA 02111-1307, USA.
31 31
32*/ 32*/
33 33
34#ifndef XINECONTROL_H 34#ifndef XINECONTROL_H
35#define XINECONTROL_H 35#define XINECONTROL_H
36 36
37#include "lib.h" 37#include "lib.h"
38 38
39#include "mediaplayerstate.h" 39#include "mediaplayerstate.h"
40 40
41class XineControl : public QObject { 41class XineControl : public QObject {
42 Q_OBJECT 42 Q_OBJECT
43public: 43public:
44 XineControl( XineVideoWidget *xineWidget,
45 MediaPlayerState &_mediaPlayerState,
46 QObject *parent = 0, const char *name =0 );
47 // note that this constructor takes over ownership of the passed 44 // note that this constructor takes over ownership of the passed
48 // XINE::Lib object. 45 // XINE::Lib object.
49 XineControl( XINE::Lib *xine, XineVideoWidget *xineWidget, 46 XineControl( XINE::Lib *xine, XineVideoWidget *xineWidget,
50 MediaPlayerState &_mediaPlayerState, 47 MediaPlayerState &_mediaPlayerState,
51 QObject *parent = 0, const char *name =0 ); 48 QObject *parent = 0, const char *name =0 );
52 ~XineControl(); 49 ~XineControl();
53 50
54 bool hasVideo() const { return hasVideoChannel; } 51 bool hasVideo() const { return hasVideoChannel; }
55 bool hasAudio() const { return hasAudioChannel; } 52 bool hasAudio() const { return hasAudioChannel; }
56 53
57public slots: 54public slots:
58 void play( const QString& fileName ); 55 void play( const QString& fileName );
59 void stop( bool ); 56 void stop( bool );
60 57
61 /** 58 /**
62 * Pause the media stream 59 * Pause the media stream
63 * @param if pause or not 60 * @param if pause or not
64 */ 61 */
65 void pause( bool ); 62 void pause( bool );
66 63
67 /** 64 /**
68 * Set videos fullscreen 65 * Set videos fullscreen
69 * @param yes or no 66 * @param yes or no
70 */ 67 */
71 void setFullscreen( bool ); 68 void setFullscreen( bool );
72 69
73 /** 70 /**
74 * 71 *
75 */ 72 */
76 long currentTime(); 73 long currentTime();
77 void seekTo( long ); 74 void seekTo( long );
78 // get length of media file and set it 75 // get length of media file and set it
79 void length(); 76 void length();
80 long position(); 77 long position();
81 78
82 /** 79 /**
83 * Proceed to the next media file in playlist 80 * Proceed to the next media file in playlist
84 */ 81 */
85 void nextMedia(); 82 void nextMedia();
86 83
87 /** 84 /**
88 * Get as much info about the stream from xine as possible 85 * Get as much info about the stream from xine as possible
89 */ 86 */
90 QString getMetaInfo(); 87 QString getMetaInfo();
91 88
92 /** 89 /**
93 * get the error code and "translate" it for the user 90 * get the error code and "translate" it for the user
94 * 91 *
95 */ 92 */
96 QString getErrorCode(); 93 QString getErrorCode();
97 94
98 95
99 void videoResized ( const QSize &s ); 96 void videoResized ( const QSize &s );
100 97
101 /** 98 /**
102 * Set the gamma value of the video output 99 * Set the gamma value of the video output
103 * @param int value between -100 and 100, 0 is original 100 * @param int value between -100 and 100, 0 is original
104 */ 101 */
105 void setGamma( int ); 102 void setGamma( int );
106 103
107private: 104private:
108 void init(); 105 void init();
109 106
110 XINE::Lib *libXine; 107 XINE::Lib *libXine;
111 long m_currentTime; 108 long m_currentTime;
112 long m_position; 109 long m_position;
113 int m_length; 110 int m_length;
114 QString m_fileName; 111 QString m_fileName;
115 bool disabledSuspendScreenSaver : 1; 112 bool disabledSuspendScreenSaver : 1;
116 bool hasVideoChannel : 1; 113 bool hasVideoChannel : 1;
117 bool hasAudioChannel : 1; 114 bool hasAudioChannel : 1;
118 MediaPlayerState &mediaPlayerState; 115 MediaPlayerState &mediaPlayerState;
119 XineVideoWidget *xineVideoWidget; 116 XineVideoWidget *xineVideoWidget;
117 bool m_wasError : 1; // used for chaeting on the metainfo
120 118
121signals: 119signals:
122 void positionChanged( long ); 120 void positionChanged( long );
123}; 121};
124 122
125 123
126#endif 124#endif