summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/lib.cpp5
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidget.cpp19
-rw-r--r--noncore/multimedia/opieplayer2/videowidget.cpp2
3 files changed, 17 insertions, 9 deletions
diff --git a/noncore/multimedia/opieplayer2/lib.cpp b/noncore/multimedia/opieplayer2/lib.cpp
index c187f52..b2143a0 100644
--- a/noncore/multimedia/opieplayer2/lib.cpp
+++ b/noncore/multimedia/opieplayer2/lib.cpp
@@ -77,68 +77,69 @@ Lib::Lib(XineVideoWidget* widget) {
77 if ( !QFile(str).exists() ) { 77 if ( !QFile(str).exists() ) {
78 QFile f(str); 78 QFile f(str);
79 f.open(IO_WriteOnly); 79 f.open(IO_WriteOnly);
80 QTextStream ts( &f ); 80 QTextStream ts( &f );
81 ts << "misc.memcpy_method:glibc\n"; 81 ts << "misc.memcpy_method:glibc\n";
82 f.close(); 82 f.close();
83 } 83 }
84 84
85 m_config = xine_config_file_init( str.data() ); 85 m_config = xine_config_file_init( str.data() );
86 86
87 // allocate oss for sound 87 // allocate oss for sound
88 // and fb for framebuffer 88 // and fb for framebuffer
89 m_audioOutput= xine_load_audio_output_plugin( m_config, "oss") ; 89 m_audioOutput= xine_load_audio_output_plugin( m_config, "oss") ;
90 m_videoOutput = ::init_video_out_plugin( m_config, NULL ); 90 m_videoOutput = ::init_video_out_plugin( m_config, NULL );
91 if (m_wid != 0 ) { 91 if (m_wid != 0 ) {
92 printf("!0\n" ); 92 printf("!0\n" );
93 resize ( m_wid-> size ( )); 93 resize ( m_wid-> size ( ));
94 ::null_set_mode( m_videoOutput, qt_screen->depth(), qt_screen->pixelType() ); 94 ::null_set_mode( m_videoOutput, qt_screen->depth(), qt_screen->pixelType() );
95 m_wid-> setImage ( new QImage ( Resource::loadImage(""))); 95 m_wid-> setImage ( new QImage ( Resource::loadImage("")));
96 m_wid->repaint(); 96 m_wid->repaint();
97 } 97 }
98 null_display_handler( m_videoOutput, 98 null_display_handler( m_videoOutput,
99 xine_display_frame, 99 xine_display_frame,
100 this ); 100 this );
101 101
102 m_xine = xine_init( m_videoOutput, 102 m_xine = xine_init( m_videoOutput,
103 m_audioOutput, m_config ); 103 m_audioOutput, m_config );
104 // install the event handler 104 // install the event handler
105 xine_register_event_listener( m_xine, xine_event_handler, this ); 105 xine_register_event_listener( m_xine, xine_event_handler, this );
106} 106}
107 107
108Lib::~Lib() { 108Lib::~Lib() {
109 delete m_config; 109 free( m_config );
110 xine_remove_event_listener( m_xine, xine_event_handler ); 110 xine_remove_event_listener( m_xine, xine_event_handler );
111 xine_exit( m_xine ); 111 xine_exit( m_xine );
112 delete m_videoOutput; 112 /* FIXME either free or delete but valgrind bitches against both */
113 //free( m_videoOutput );
113 //delete m_audioOutput; 114 //delete m_audioOutput;
114 115
115} 116}
116 117
117void Lib::resize ( const QSize &s ) 118void Lib::resize ( const QSize &s )
118{ 119{
119 if ( s. width ( ) && s. height ( )) { 120 if ( s. width ( ) && s. height ( )) {
120 ::null_set_gui_width( m_videoOutput, s. width() ); 121 ::null_set_gui_width( m_videoOutput, s. width() );
121 ::null_set_gui_height(m_videoOutput, s. height() ); 122 ::null_set_gui_height(m_videoOutput, s. height() );
122 } 123 }
123} 124}
124 125
125QCString Lib::version() { 126QCString Lib::version() {
126 QCString str( xine_get_str_version() ); 127 QCString str( xine_get_str_version() );
127 return str; 128 return str;
128}; 129};
129 130
130int Lib::majorVersion() { 131int Lib::majorVersion() {
131 return xine_get_major_version(); 132 return xine_get_major_version();
132} 133}
133int Lib::minorVersion() { 134int Lib::minorVersion() {
134 return xine_get_minor_version(); 135 return xine_get_minor_version();
135}; 136};
136 137
137int Lib::subVersion() { 138int Lib::subVersion() {
138 return xine_get_sub_version(); 139 return xine_get_sub_version();
139} 140}
140int Lib::play( const QString& fileName, 141int Lib::play( const QString& fileName,
141 int startPos, 142 int startPos,
142 int start_time ) { 143 int start_time ) {
143 QString str = fileName.stripWhiteSpace(); 144 QString str = fileName.stripWhiteSpace();
144 //workaround OpiePlayer bug 145 //workaround OpiePlayer bug
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp
index 75e2979..098322b 100644
--- a/noncore/multimedia/opieplayer2/playlistwidget.cpp
+++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp
@@ -1,40 +1,41 @@
1 1
2#define QTOPIA_INTERNAL_FSLP 2#define QTOPIA_INTERNAL_FSLP
3#include <qpe/qpemenubar.h> 3#include <qpe/qpemenubar.h>
4#include <qpe/qpetoolbar.h> 4#include <qpe/qpetoolbar.h>
5#include <qpe/fileselector.h> 5#include <qpe/fileselector.h>
6#include <qpe/qpeapplication.h> 6#include <qpe/qpeapplication.h>
7#include <qpe/lnkproperties.h> 7#include <qpe/lnkproperties.h>
8#include <qpe/storage.h> 8#include <qpe/storage.h>
9#include <qpe/mimetype.h>
9 10
10#include <qpe/applnk.h> 11#include <qpe/applnk.h>
11#include <qpopupmenu.h> 12#include <qpopupmenu.h>
12#include <qpe/config.h> 13#include <qpe/config.h>
13#include <qpe/global.h> 14#include <qpe/global.h>
14#include <qpe/resource.h> 15#include <qpe/resource.h>
15#include <qaction.h> 16#include <qaction.h>
16#include <qcursor.h> 17#include <qcursor.h>
17#include <qimage.h> 18#include <qimage.h>
18#include <qfile.h> 19#include <qfile.h>
19#include <qdir.h> 20#include <qdir.h>
20#include <qlayout.h> 21#include <qlayout.h>
21#include <qlabel.h> 22#include <qlabel.h>
22#include <qlist.h> 23#include <qlist.h>
23#include <qlistbox.h> 24#include <qlistbox.h>
24#include <qmainwindow.h> 25#include <qmainwindow.h>
25#include <qmessagebox.h> 26#include <qmessagebox.h>
26#include <qtoolbutton.h> 27#include <qtoolbutton.h>
27#include <qtabwidget.h> 28#include <qtabwidget.h>
28#include <qlistview.h> 29#include <qlistview.h>
29#include <qpoint.h> 30#include <qpoint.h>
30#include <qlineedit.h> 31#include <qlineedit.h>
31#include <qpushbutton.h> 32#include <qpushbutton.h>
32#include <qregexp.h> 33#include <qregexp.h>
33#include <qtextstream.h> 34#include <qtextstream.h>
34 35
35 36
36#include "playlistselection.h" 37#include "playlistselection.h"
37#include "playlistwidget.h" 38#include "playlistwidget.h"
38#include "mediaplayerstate.h" 39#include "mediaplayerstate.h"
39 40
40#include "inputDialog.h" 41#include "inputDialog.h"
@@ -278,68 +279,72 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
278 connect( d->selectedFiles, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), 279 connect( d->selectedFiles, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)),
279 this,SLOT( playlistViewPressed(int, QListViewItem *, const QPoint&, int)) ); 280 this,SLOT( playlistViewPressed(int, QListViewItem *, const QPoint&, int)) );
280 connect( audioView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), 281 connect( audioView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)),
281 this,SLOT( viewPressed(int, QListViewItem *, const QPoint&, int)) ); 282 this,SLOT( viewPressed(int, QListViewItem *, const QPoint&, int)) );
282 connect( audioView, SIGNAL( returnPressed( QListViewItem *)), 283 connect( audioView, SIGNAL( returnPressed( QListViewItem *)),
283 this,SLOT( playIt( QListViewItem *)) ); 284 this,SLOT( playIt( QListViewItem *)) );
284 connect( audioView, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) ); 285 connect( audioView, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) );
285 connect( videoView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), 286 connect( videoView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)),
286 this,SLOT( viewPressed(int, QListViewItem *, const QPoint&, int)) ); 287 this,SLOT( viewPressed(int, QListViewItem *, const QPoint&, int)) );
287 connect( videoView, SIGNAL( returnPressed( QListViewItem *)), 288 connect( videoView, SIGNAL( returnPressed( QListViewItem *)),
288 this,SLOT( playIt( QListViewItem *)) ); 289 this,SLOT( playIt( QListViewItem *)) );
289 connect( videoView, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) ); 290 connect( videoView, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) );
290 connect( playLists, SIGNAL( fileSelected( const DocLnk &) ), this, SLOT( loadList( const DocLnk & ) ) ); 291 connect( playLists, SIGNAL( fileSelected( const DocLnk &) ), this, SLOT( loadList( const DocLnk & ) ) );
291 connect( tabWidget, SIGNAL (currentChanged(QWidget*)),this,SLOT(tabChanged(QWidget*))); 292 connect( tabWidget, SIGNAL (currentChanged(QWidget*)),this,SLOT(tabChanged(QWidget*)));
292 connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), d->tbPlay, SLOT( setOn( bool ) ) ); 293 connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), d->tbPlay, SLOT( setOn( bool ) ) );
293 connect( mediaPlayerState, SIGNAL( loopingToggled( bool ) ), d->tbLoop, SLOT( setOn( bool ) ) ); 294 connect( mediaPlayerState, SIGNAL( loopingToggled( bool ) ), d->tbLoop, SLOT( setOn( bool ) ) );
294 connect( mediaPlayerState, SIGNAL( shuffledToggled( bool ) ), d->tbShuffle, SLOT( setOn( bool ) ) ); 295 connect( mediaPlayerState, SIGNAL( shuffledToggled( bool ) ), d->tbShuffle, SLOT( setOn( bool ) ) );
295 connect( mediaPlayerState, SIGNAL( playlistToggled( bool ) ), this, SLOT( setPlaylist( bool ) ) ); 296 connect( mediaPlayerState, SIGNAL( playlistToggled( bool ) ), this, SLOT( setPlaylist( bool ) ) );
296 connect( d->selectedFiles, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( playIt( QListViewItem *) ) ); 297 connect( d->selectedFiles, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( playIt( QListViewItem *) ) );
297 298
298 setCentralWidget( vbox5 ); 299 setCentralWidget( vbox5 );
299 300
300 readConfig( cfg ); 301 readConfig( cfg );
301 QString currentPlaylist = cfg.readEntry("CurrentPlaylist",""); 302 QString currentPlaylist = cfg.readEntry("CurrentPlaylist","");
302 loadList(DocLnk( currentPlaylist)); 303 loadList(DocLnk( currentPlaylist));
303 setCaption(tr("OpiePlayer: ")+ currentPlaylist ); 304 setCaption(tr("OpiePlayer: ")+ currentPlaylist );
304 305
305 initializeStates(); 306 initializeStates();
306} 307}
307 308
308 309
309PlayListWidget::~PlayListWidget() { 310PlayListWidget::~PlayListWidget() {
310 if ( d->current ) { 311/* fixing symptoms and not sources is entirely stupid - zecke */
311 delete d->current; 312// Config cfg( "OpiePlayer" );
312 } 313// writeConfig( cfg );
313 delete d; 314
315 if ( d->current ) {
316 delete d->current;
317 }
318 delete d;
314} 319}
315 320
316 321
317void PlayListWidget::initializeStates() { 322void PlayListWidget::initializeStates() {
318 323
319 d->tbPlay->setOn( mediaPlayerState->playing() ); 324 d->tbPlay->setOn( mediaPlayerState->playing() );
320 d->tbLoop->setOn( mediaPlayerState->looping() ); 325 d->tbLoop->setOn( mediaPlayerState->looping() );
321 d->tbShuffle->setOn( mediaPlayerState->shuffled() ); 326 d->tbShuffle->setOn( mediaPlayerState->shuffled() );
322 setPlaylist( true); 327 setPlaylist( true);
323} 328}
324 329
325 330
326void PlayListWidget::readConfig( Config& cfg ) { 331void PlayListWidget::readConfig( Config& cfg ) {
327 cfg.setGroup("PlayList"); 332 cfg.setGroup("PlayList");
328 QString currentString = cfg.readEntry("current", "" ); 333 QString currentString = cfg.readEntry("current", "" );
329 int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 ); 334 int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 );
330 for ( int i = 0; i < noOfFiles; i++ ) { 335 for ( int i = 0; i < noOfFiles; i++ ) {
331 QString entryName; 336 QString entryName;
332 entryName.sprintf( "File%i", i + 1 ); 337 entryName.sprintf( "File%i", i + 1 );
333 QString linkFile = cfg.readEntry( entryName ); 338 QString linkFile = cfg.readEntry( entryName );
334 if(QFileInfo( linkFile).exists() ) { 339 if(QFileInfo( linkFile).exists() ) {
335 DocLnk lnk( linkFile ); 340 DocLnk lnk( linkFile );
336 if ( QFileInfo( lnk.file()).exists() || linkFile.find("http",0,TRUE) != -1) { 341 if ( QFileInfo( lnk.file()).exists() || linkFile.find("http",0,TRUE) != -1) {
337 d->selectedFiles->addToSelection( lnk ); 342 d->selectedFiles->addToSelection( lnk );
338 } 343 }
339 } 344 }
340 } 345 }
341 d->selectedFiles->setSelectedItem( currentString); 346 d->selectedFiles->setSelectedItem( currentString);
342} 347}
343 348
344 349
345void PlayListWidget::writeConfig( Config& cfg ) const { 350void PlayListWidget::writeConfig( Config& cfg ) const {
@@ -923,69 +928,71 @@ void PlayListWidget::populateVideoView() {
923 videoView->clear(); 928 videoView->clear();
924 QString storage; 929 QString storage;
925 for ( ; Vdit.current(); ++Vdit ) { 930 for ( ; Vdit.current(); ++Vdit ) {
926 for( ; it.current(); ++it ){ 931 for( ; it.current(); ++it ){
927 const QString name = (*it)->name(); 932 const QString name = (*it)->name();
928 const QString path = (*it)->path(); 933 const QString path = (*it)->path();
929 if( Vdit.current()->file().find(path) != -1 ) storage=name; 934 if( Vdit.current()->file().find(path) != -1 ) storage=name;
930 } 935 }
931 936
932 QListViewItem * newItem; 937 QListViewItem * newItem;
933 if ( QFile( Vdit.current()->file()).exists() ) { 938 if ( QFile( Vdit.current()->file()).exists() ) {
934 newItem= /*(void)*/ new QListViewItem( videoView, Vdit.current()->name(), 939 newItem= /*(void)*/ new QListViewItem( videoView, Vdit.current()->name(),
935 QString::number( QFile( Vdit.current()->file()).size() ), storage); 940 QString::number( QFile( Vdit.current()->file()).size() ), storage);
936 newItem->setPixmap(0, Resource::loadPixmap( "opieplayer2/videofile" )); 941 newItem->setPixmap(0, Resource::loadPixmap( "opieplayer2/videofile" ));
937 } 942 }
938 } 943 }
939} 944}
940 945
941void PlayListWidget::openFile() { 946void PlayListWidget::openFile() {
942 QString filename, name; 947 QString filename, name;
943 InputDialog *fileDlg; 948 InputDialog *fileDlg;
944 fileDlg = new InputDialog(this,tr("Open file or URL"),TRUE, 0); 949 fileDlg = new InputDialog(this,tr("Open file or URL"),TRUE, 0);
945 fileDlg->exec(); 950 fileDlg->exec();
946 if( fileDlg->result() == 1 ) { 951 if( fileDlg->result() == 1 ) {
947 filename = fileDlg->text(); 952 filename = fileDlg->text();
948 953
949 qDebug("Selected filename is "+filename); 954 qDebug("Selected filename is "+filename);
950 if(filename.right(3) == "m3u") { 955 if(filename.right(3) == "m3u") {
951 readm3u( filename ); 956 readm3u( filename );
952 } else if(filename.right(3) == "pls") { 957 } else if(filename.right(3) == "pls") {
953 readPls( filename ); 958 readPls( filename );
954 } else { 959 } else {
960 /* FIXME ....... AUDIO/X-MPEGURL is bad*/
955 DocLnk lnk; 961 DocLnk lnk;
956 962
957 lnk.setName(filename); //sets file name 963 lnk.setName(filename); //sets file name
958 lnk.setFile(filename); //sets File property 964 lnk.setFile(filename); //sets File property
959 lnk.setType("audio/x-mpegurl"); 965 //qWarning( "Mimetype: " + MimeType( QFile::encodeName(filename) ).id() );
966 lnk.setType( MimeType( QFile::encodeName(filename) ).id() );
960 lnk.setExec("opieplayer"); 967 lnk.setExec("opieplayer");
961 lnk.setIcon("opieplayer2/MPEGPlayer"); 968 lnk.setIcon("opieplayer2/MPEGPlayer");
962 969
963 if(!lnk.writeLink()) { 970 if(!lnk.writeLink()) {
964 qDebug("Writing doclink did not work"); 971 qDebug("Writing doclink did not work");
965 } 972 }
966 d->selectedFiles->addToSelection( lnk); 973 d->selectedFiles->addToSelection( lnk);
967 } 974 }
968 } 975 }
969 if(fileDlg) { 976 if(fileDlg) {
970 delete fileDlg; 977 delete fileDlg;
971 } 978 }
972} 979}
973 980
974void PlayListWidget::keyReleaseEvent( QKeyEvent *e) 981void PlayListWidget::keyReleaseEvent( QKeyEvent *e)
975{ 982{
976 switch ( e->key() ) { 983 switch ( e->key() ) {
977 ////////////////////////////// Zaurus keys 984 ////////////////////////////// Zaurus keys
978 case Key_F9: //activity 985 case Key_F9: //activity
979 // if(audioUI->isHidden()) 986 // if(audioUI->isHidden())
980 // audioUI->showMaximized(); 987 // audioUI->showMaximized();
981 break; 988 break;
982 case Key_F10: //contacts 989 case Key_F10: //contacts
983 // if( videoUI->isHidden()) 990 // if( videoUI->isHidden())
984 // videoUI->showMaximized(); 991 // videoUI->showMaximized();
985 break; 992 break;
986 case Key_F11: //menu 993 case Key_F11: //menu
987 break; 994 break;
988 case Key_F12: //home 995 case Key_F12: //home
989 // doBlank(); 996 // doBlank();
990 break; 997 break;
991 case Key_F13: //mail 998 case Key_F13: //mail
@@ -1207,41 +1214,41 @@ void PlayListWidget::pmViewActivated(int index) {
1207 }; 1214 };
1208} 1215}
1209 1216
1210void PlayListWidget::populateSkinsMenu() { 1217void PlayListWidget::populateSkinsMenu() {
1211 int item=0; 1218 int item=0;
1212 defaultSkinIndex=0; 1219 defaultSkinIndex=0;
1213 QString skinName; 1220 QString skinName;
1214 Config cfg( "OpiePlayer" ); 1221 Config cfg( "OpiePlayer" );
1215 cfg.setGroup("Options"); 1222 cfg.setGroup("Options");
1216 QString skin = cfg.readEntry("Skin","default"); 1223 QString skin = cfg.readEntry("Skin","default");
1217 1224
1218 QDir skinsDir(QPEApplication::qpeDir()+"/pics/opieplayer2/skins"); 1225 QDir skinsDir(QPEApplication::qpeDir()+"/pics/opieplayer2/skins");
1219 skinsDir.setFilter( QDir::Dirs); 1226 skinsDir.setFilter( QDir::Dirs);
1220 skinsDir.setSorting(QDir::Name); 1227 skinsDir.setSorting(QDir::Name);
1221 const QFileInfoList *skinslist = skinsDir.entryInfoList(); 1228 const QFileInfoList *skinslist = skinsDir.entryInfoList();
1222 QFileInfoListIterator it( *skinslist ); 1229 QFileInfoListIterator it( *skinslist );
1223 QFileInfo *fi; 1230 QFileInfo *fi;
1224 while ( (fi=it.current()) ) { 1231 while ( (fi=it.current()) ) {
1225 skinName = fi->fileName(); 1232 skinName = fi->fileName();
1226 qDebug( fi->fileName()); 1233 qDebug( fi->fileName());
1227 if( skinName != "." && skinName != ".." && skinName !="CVS") 1234 if( skinName != "." && skinName != ".." && skinName !="CVS")
1228 item = skinsMenu->insertItem( fi->fileName()); 1235 item = skinsMenu->insertItem( fi->fileName());
1229 if( skinName == "default") 1236 if( skinName == "default")
1230 defaultSkinIndex = item; 1237 defaultSkinIndex = item;
1231 if( skinName == skin) 1238 if( skinName == skin)
1232 skinsMenu->setItemChecked( item, TRUE); 1239 skinsMenu->setItemChecked( item, TRUE);
1233 1240
1234 ++it; 1241 ++it;
1235 } 1242 }
1236} 1243}
1237 1244
1238void PlayListWidget::skinsMenuActivated(int item) { 1245void PlayListWidget::skinsMenuActivated(int item) {
1239 for(int i = defaultSkinIndex; i > defaultSkinIndex - skinsMenu->count(); i--) { 1246 for(uint i = defaultSkinIndex; i > defaultSkinIndex - skinsMenu->count(); i--) {
1240 skinsMenu->setItemChecked( i, FALSE); 1247 skinsMenu->setItemChecked( i, FALSE);
1241 } 1248 }
1242 skinsMenu->setItemChecked( item, TRUE); 1249 skinsMenu->setItemChecked( item, TRUE);
1243 1250
1244 Config cfg( "OpiePlayer" ); 1251 Config cfg( "OpiePlayer" );
1245 cfg.setGroup("Options"); 1252 cfg.setGroup("Options");
1246 cfg.writeEntry("Skin", skinsMenu->text( item)); 1253 cfg.writeEntry("Skin", skinsMenu->text( item));
1247} 1254}
diff --git a/noncore/multimedia/opieplayer2/videowidget.cpp b/noncore/multimedia/opieplayer2/videowidget.cpp
index 53837c7..ffda2e4 100644
--- a/noncore/multimedia/opieplayer2/videowidget.cpp
+++ b/noncore/multimedia/opieplayer2/videowidget.cpp
@@ -350,65 +350,65 @@ void VideoWidget::mouseMoveEvent( QMouseEvent *event ) {
350} 350}
351 351
352void VideoWidget::mousePressEvent( QMouseEvent *event ) { 352void VideoWidget::mousePressEvent( QMouseEvent *event ) {
353 mouseMoveEvent( event ); 353 mouseMoveEvent( event );
354} 354}
355 355
356void VideoWidget::mouseReleaseEvent( QMouseEvent *event ) { 356void VideoWidget::mouseReleaseEvent( QMouseEvent *event ) {
357 if ( mediaPlayerState->fullscreen() ) { 357 if ( mediaPlayerState->fullscreen() ) {
358 mediaPlayerState->setFullscreen( FALSE ); 358 mediaPlayerState->setFullscreen( FALSE );
359 makeVisible(); 359 makeVisible();
360 } 360 }
361 mouseMoveEvent( event ); 361 mouseMoveEvent( event );
362} 362}
363 363
364void VideoWidget::showEvent( QShowEvent* ) { 364void VideoWidget::showEvent( QShowEvent* ) {
365 QMouseEvent event( QEvent::MouseMove, QPoint( 0, 0 ), 0, 0 ); 365 QMouseEvent event( QEvent::MouseMove, QPoint( 0, 0 ), 0, 0 );
366 mouseMoveEvent( &event ); 366 mouseMoveEvent( &event );
367} 367}
368 368
369 369
370 void VideoWidget::backToNormal() { 370 void VideoWidget::backToNormal() {
371 mediaPlayerState->setFullscreen( FALSE ); 371 mediaPlayerState->setFullscreen( FALSE );
372 makeVisible(); 372 makeVisible();
373 } 373 }
374 374
375void VideoWidget::makeVisible() { 375void VideoWidget::makeVisible() {
376 if ( mediaPlayerState->fullscreen() ) { 376 if ( mediaPlayerState->fullscreen() ) {
377 setBackgroundMode( QWidget::NoBackground ); 377 setBackgroundMode( QWidget::NoBackground );
378 showFullScreen(); 378 showFullScreen();
379 resize( qApp->desktop()->size() ); 379 resize( qApp->desktop()->size() );
380 slider->hide(); 380 slider->hide();
381 videoFrame-> setGeometry ( 0, 0, width ( ), height ( )); 381 videoFrame-> setGeometry ( 0, 0, width ( ), height ( ));
382 382 qApp->processEvents();
383 } else { 383 } else {
384 showNormal(); 384 showNormal();
385 showMaximized(); 385 showMaximized();
386 setBackgroundPixmap( *pixBg ); 386 setBackgroundPixmap( *pixBg );
387 if ( mediaPlayerState->streaming() ) { 387 if ( mediaPlayerState->streaming() ) {
388 slider->hide(); 388 slider->hide();
389 disconnect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); 389 disconnect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) );
390 disconnect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); 390 disconnect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) );
391 } else { 391 } else {
392 slider->show(); 392 slider->show();
393 connect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); 393 connect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) );
394 connect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); 394 connect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) );
395 } 395 }
396 videoFrame->setGeometry( QRect( 0, 30, 240, 170 ) ); 396 videoFrame->setGeometry( QRect( 0, 30, 240, 170 ) );
397 qApp->processEvents(); 397 qApp->processEvents();
398 } 398 }
399} 399}
400 400
401 401
402void VideoWidget::paintEvent( QPaintEvent * pe) { 402void VideoWidget::paintEvent( QPaintEvent * pe) {
403 QPainter p( this ); 403 QPainter p( this );
404 404
405 if ( mediaPlayerState->fullscreen() ) { 405 if ( mediaPlayerState->fullscreen() ) {
406 // Clear the background 406 // Clear the background
407 p.setBrush( QBrush( Qt::black ) ); 407 p.setBrush( QBrush( Qt::black ) );
408 } else { 408 } else {
409 if ( !pe->erased() ) { 409 if ( !pe->erased() ) {
410 // Combine with background and double buffer 410 // Combine with background and double buffer
411 QPixmap pix( pe->rect().size() ); 411 QPixmap pix( pe->rect().size() );
412 QPainter p( &pix ); 412 QPainter p( &pix );
413 p.translate( -pe->rect().topLeft().x(), -pe->rect().topLeft().y() ); 413 p.translate( -pe->rect().topLeft().x(), -pe->rect().topLeft().y() );
414 p.drawTiledPixmap( pe->rect(), *pixBg, pe->rect().topLeft() ); 414 p.drawTiledPixmap( pe->rect(), *pixBg, pe->rect().topLeft() );