summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2002-11-10 18:46:52 (UTC)
committer llornkcor <llornkcor>2002-11-10 18:46:52 (UTC)
commit6078687cb1e389751503ae171ed1bea72846a4de (patch) (unidiff)
tree5d725ae35ece948a9184f89c6aa7fb3a89a5c469
parent49e5bbbd35bef879faca0d680f1c4d64a61b7b32 (diff)
downloadopie-6078687cb1e389751503ae171ed1bea72846a4de.zip
opie-6078687cb1e389751503ae171ed1bea72846a4de.tar.gz
opie-6078687cb1e389751503ae171ed1bea72846a4de.tar.bz2
added must restart messagebox when changing skins
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidget.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp
index 86130d5..040ef71 100644
--- a/noncore/multimedia/opieplayer2/playlistwidget.cpp
+++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp
@@ -11,96 +11,98 @@
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 <qpe/qpetoolbar.h> 34#include <qpe/qpetoolbar.h>
35#include <qpe/qpeapplication.h> 35#include <qpe/qpeapplication.h>
36#include <qpe/storage.h> 36#include <qpe/storage.h>
37#include <qpe/mimetype.h> 37#include <qpe/mimetype.h>
38#include <qpe/global.h> 38#include <qpe/global.h>
39#include <qpe/resource.h> 39#include <qpe/resource.h>
40 40
41#include <qdir.h> 41#include <qdir.h>
42#include <qmessagebox.h> 42#include <qmessagebox.h>
43#include <qregexp.h> 43#include <qregexp.h>
44#include <qtextstream.h> 44#include <qtextstream.h>
45 45
46#include "playlistselection.h" 46#include "playlistselection.h"
47#include "playlistwidget.h" 47#include "playlistwidget.h"
48#include "mediaplayerstate.h" 48#include "mediaplayerstate.h"
49#include "inputDialog.h" 49#include "inputDialog.h"
50#include "om3u.h" 50#include "om3u.h"
51 51
52//only needed for the random play 52//only needed for the random play
53#include <stdlib.h> 53#include <stdlib.h>
54 54
55#include "audiowidget.h" 55#include "audiowidget.h"
56#include "videowidget.h" 56#include "videowidget.h"
57 57
58extern MediaPlayerState *mediaPlayerState; 58extern MediaPlayerState *mediaPlayerState;
59// extern AudioWidget *audioUI;
60// extern VideoWidget *videoUI;
59 61
60QString audioMimes ="audio/mpeg;audio/x-wav;audio/x-ogg"; 62QString audioMimes ="audio/mpeg;audio/x-wav;audio/x-ogg";
61// no m3u's here please 63// no m3u's here please
62 64
63PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) 65PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
64 : PlayListWidgetGui( parent, name, fl ) { 66 : PlayListWidgetGui( parent, name, fl ) {
65 67
66 d->tbAddToList = new ToolButton( bar, tr( "Add to Playlist" ), 68 d->tbAddToList = new ToolButton( bar, tr( "Add to Playlist" ),
67 "opieplayer2/add_to_playlist", 69 "opieplayer2/add_to_playlist",
68 this , SLOT(addSelected() ) ); 70 this , SLOT(addSelected() ) );
69 d->tbRemoveFromList = new ToolButton( bar, tr( "Remove from Playlist" ), 71 d->tbRemoveFromList = new ToolButton( bar, tr( "Remove from Playlist" ),
70 "opieplayer2/remove_from_playlist", 72 "opieplayer2/remove_from_playlist",
71 this , SLOT(removeSelected() ) ); 73 this , SLOT(removeSelected() ) );
72 d->tbPlay = new ToolButton( bar, tr( "Play" ), "opieplayer2/play", 74 d->tbPlay = new ToolButton( bar, tr( "Play" ), "opieplayer2/play",
73 this , SLOT( btnPlay( bool) ), TRUE ); 75 this , SLOT( btnPlay( bool) ), TRUE );
74 d->tbShuffle = new ToolButton( bar, tr( "Randomize" ),"opieplayer2/shuffle", 76 d->tbShuffle = new ToolButton( bar, tr( "Randomize" ),"opieplayer2/shuffle",
75 mediaPlayerState, SLOT( setShuffled( bool ) ), TRUE ); 77 mediaPlayerState, SLOT( setShuffled( bool ) ), TRUE );
76 d->tbLoop = new ToolButton( bar, tr( "Loop" ), "opieplayer2/loop", 78 d->tbLoop = new ToolButton( bar, tr( "Loop" ), "opieplayer2/loop",
77 mediaPlayerState, SLOT( setLooping( bool ) ), TRUE ); 79 mediaPlayerState, SLOT( setLooping( bool ) ), TRUE );
78 80
79 (void)new MenuItem( pmPlayList, tr( "Clear List" ), this, SLOT( clearList() ) ); 81 (void)new MenuItem( pmPlayList, tr( "Clear List" ), this, SLOT( clearList() ) );
80 (void)new MenuItem( pmPlayList, tr( "Add all audio files" ), 82 (void)new MenuItem( pmPlayList, tr( "Add all audio files" ),
81 this, SLOT( addAllMusicToList() ) ); 83 this, SLOT( addAllMusicToList() ) );
82 (void)new MenuItem( pmPlayList, tr( "Add all video files" ), 84 (void)new MenuItem( pmPlayList, tr( "Add all video files" ),
83 this, SLOT( addAllVideoToList() ) ); 85 this, SLOT( addAllVideoToList() ) );
84 (void)new MenuItem( pmPlayList, tr( "Add all files" ), 86 (void)new MenuItem( pmPlayList, tr( "Add all files" ),
85 this, SLOT( addAllToList() ) ); 87 this, SLOT( addAllToList() ) );
86 pmPlayList->insertSeparator(-1); 88 pmPlayList->insertSeparator(-1);
87// (void)new MenuItem( pmPlayList, tr( "Save PlayList" ), 89// (void)new MenuItem( pmPlayList, tr( "Save PlayList" ),
88// this, SLOT( saveList() ) ); 90// this, SLOT( saveList() ) );
89 (void)new MenuItem( pmPlayList, tr( "Save Playlist" ), 91 (void)new MenuItem( pmPlayList, tr( "Save Playlist" ),
90 this, SLOT(writem3u() ) ); 92 this, SLOT(writem3u() ) );
91 pmPlayList->insertSeparator(-1); 93 pmPlayList->insertSeparator(-1);
92 (void)new MenuItem( pmPlayList, tr( "Open File or URL" ), 94 (void)new MenuItem( pmPlayList, tr( "Open File or URL" ),
93 this,SLOT( openFile() ) ); 95 this,SLOT( openFile() ) );
94 pmPlayList->insertSeparator(-1); 96 pmPlayList->insertSeparator(-1);
95 (void)new MenuItem( pmPlayList, tr( "Rescan for Audio Files" ), 97 (void)new MenuItem( pmPlayList, tr( "Rescan for Audio Files" ),
96 this,SLOT( scanForAudio() ) ); 98 this,SLOT( scanForAudio() ) );
97 (void)new MenuItem( pmPlayList, tr( "Rescan for Video Files" ), 99 (void)new MenuItem( pmPlayList, tr( "Rescan for Video Files" ),
98 this,SLOT( scanForVideo() ) ); 100 this,SLOT( scanForVideo() ) );
99 101
100 pmView->insertItem( Resource::loadPixmap("fullscreen") , tr( "Full Screen"), 102 pmView->insertItem( Resource::loadPixmap("fullscreen") , tr( "Full Screen"),
101 mediaPlayerState, SLOT( toggleFullscreen() ) ); 103 mediaPlayerState, SLOT( toggleFullscreen() ) );
102 104
103 Config cfg( "OpiePlayer" ); 105 Config cfg( "OpiePlayer" );
104 bool b= cfg.readBoolEntry("FullScreen", 0); 106 bool b= cfg.readBoolEntry("FullScreen", 0);
105 mediaPlayerState->setFullscreen( b ); 107 mediaPlayerState->setFullscreen( b );
106 pmView->setItemChecked( -16, b ); 108 pmView->setItemChecked( -16, b );
@@ -252,97 +254,97 @@ void PlayListWidget::playlistViewPressed( int mouse, QListViewItem *, const QPoi
252 break; 254 break;
253 } 255 }
254} 256}
255 257
256 258
257void PlayListWidget::addAllToList() { 259void PlayListWidget::addAllToList() {
258 DocLnkSet filesAll; 260 DocLnkSet filesAll;
259 Global::findDocuments(&filesAll, "video/*;"+audioMimes); 261 Global::findDocuments(&filesAll, "video/*;"+audioMimes);
260 QListIterator<DocLnk> Adit( filesAll.children() ); 262 QListIterator<DocLnk> Adit( filesAll.children() );
261 for ( ; Adit.current(); ++Adit ) { 263 for ( ; Adit.current(); ++Adit ) {
262 if( QFileInfo( Adit.current()->file() ).exists() ) { 264 if( QFileInfo( Adit.current()->file() ).exists() ) {
263 d->selectedFiles->addToSelection( **Adit ); 265 d->selectedFiles->addToSelection( **Adit );
264 } 266 }
265 } 267 }
266 writeCurrentM3u(); 268 writeCurrentM3u();
267} 269}
268 270
269 271
270void PlayListWidget::addAllMusicToList() { 272void PlayListWidget::addAllMusicToList() {
271 if(!audioScan) 273 if(!audioScan)
272 scanForAudio(); 274 scanForAudio();
273 QListIterator<DocLnk> dit( files.children() ); 275 QListIterator<DocLnk> dit( files.children() );
274 for ( ; dit.current(); ++dit ) { 276 for ( ; dit.current(); ++dit ) {
275 if( QFileInfo(dit.current()->file() ).exists() ) { 277 if( QFileInfo(dit.current()->file() ).exists() ) {
276 d->selectedFiles->addToSelection( **dit ); 278 d->selectedFiles->addToSelection( **dit );
277 } 279 }
278 } 280 }
279 writeCurrentM3u(); 281 writeCurrentM3u();
280} 282}
281 283
282 284
283void PlayListWidget::addAllVideoToList() { 285void PlayListWidget::addAllVideoToList() {
284 if(!videoScan) 286 if(!videoScan)
285 scanForVideo(); 287 scanForVideo();
286 QListIterator<DocLnk> dit( vFiles.children() ); 288 QListIterator<DocLnk> dit( vFiles.children() );
287 for ( ; dit.current(); ++dit ) { 289 for ( ; dit.current(); ++dit ) {
288 if( QFileInfo( dit.current()->file() ).exists() ) { 290 if( QFileInfo( dit.current()->file() ).exists() ) {
289 d->selectedFiles->addToSelection( **dit ); 291 d->selectedFiles->addToSelection( **dit );
290 } 292 }
291 } 293 }
292 writeCurrentM3u(); 294 writeCurrentM3u();
293} 295}
294 296
295 297
296void PlayListWidget::setDocument( const QString& fileref ) { 298void PlayListWidget::setDocument( const QString& fileref ) {
297 qDebug( "<<<<<<<<set document>>>>>>>>>> "+fileref ); 299 qDebug( "<<<<<<<<set document>>>>>>>>>> "+fileref );
298 fromSetDocument = TRUE; 300 fromSetDocument = TRUE;
299 if ( fileref.isNull() ) { 301 if ( fileref.isNull() ) {
300 QMessageBox::critical( 0, tr( "Invalid File" ), 302 QMessageBox::warning( this, tr( "Invalid File" ),
301 tr( "There was a problem in getting the file." ) ); 303 tr( "There was a problem in getting the file." ) );
302 return; 304 return;
303 } 305 }
304 306
305 clearList(); 307 clearList();
306 if( fileref.find( "m3u", 0, TRUE) != -1 ) { //is m3u 308 if( fileref.find( "m3u", 0, TRUE) != -1 ) { //is m3u
307 readm3u( fileref ); 309 readm3u( fileref );
308 } else if( DocLnk( fileref).file().find( "m3u", 0, TRUE) != -1 ) { 310 } else if( DocLnk( fileref).file().find( "m3u", 0, TRUE) != -1 ) {
309 readm3u( DocLnk( fileref).file() ); 311 readm3u( DocLnk( fileref).file() );
310 } else if( fileref.find( "pls", 0, TRUE) != -1 ) { //is pls 312 } else if( fileref.find( "pls", 0, TRUE) != -1 ) { //is pls
311 readPls( fileref ); 313 readPls( fileref );
312 } else if( DocLnk( fileref).file().find( "pls", 0, TRUE) != -1 ) { 314 } else if( DocLnk( fileref).file().find( "pls", 0, TRUE) != -1 ) {
313 readPls( DocLnk( fileref).file() ); 315 readPls( DocLnk( fileref).file() );
314 } else { 316 } else {
315 clearList(); 317 clearList();
316 addToSelection( DocLnk( fileref ) ); 318 addToSelection( DocLnk( fileref ) );
317 writeCurrentM3u(); 319 writeCurrentM3u();
318 320
319 d->setDocumentUsed = TRUE; 321 d->setDocumentUsed = TRUE;
320 mediaPlayerState->setPlaying( FALSE ); 322 mediaPlayerState->setPlaying( FALSE );
321 mediaPlayerState->setPlaying( TRUE ); 323 mediaPlayerState->setPlaying( TRUE );
322 } 324 }
323} 325}
324 326
325 327
326void PlayListWidget::useSelectedDocument() { 328void PlayListWidget::useSelectedDocument() {
327 d->setDocumentUsed = FALSE; 329 d->setDocumentUsed = FALSE;
328} 330}
329 331
330 332
331const DocLnk *PlayListWidget::current() { // this is fugly 333const DocLnk *PlayListWidget::current() { // this is fugly
332 switch ( whichList() ) { 334 switch ( whichList() ) {
333 case 0: //playlist 335 case 0: //playlist
334 { 336 {
335// qDebug("playlist"); 337// qDebug("playlist");
336 if ( mediaPlayerState->playlist() ) { 338 if ( mediaPlayerState->playlist() ) {
337 return d->selectedFiles->current(); 339 return d->selectedFiles->current();
338 } else if ( d->setDocumentUsed && d->current ) { 340 } else if ( d->setDocumentUsed && d->current ) {
339 return d->current; 341 return d->current;
340 } else { 342 } else {
341 return &(d->files->selectedDocument()); 343 return &(d->files->selectedDocument());
342 } 344 }
343 } 345 }
344 break; 346 break;
345 }; 347 };
346 return 0; 348 return 0;
347} 349}
348 350
@@ -1018,65 +1020,67 @@ void PlayListWidget::pmViewActivated(int index) {
1018 bool b=mediaPlayerState->fullscreen(); 1020 bool b=mediaPlayerState->fullscreen();
1019 pmView->setItemChecked( index, b); 1021 pmView->setItemChecked( index, b);
1020 Config cfg( "OpiePlayer" ); 1022 Config cfg( "OpiePlayer" );
1021 cfg.writeEntry( "FullScreen", b ); 1023 cfg.writeEntry( "FullScreen", b );
1022 } 1024 }
1023 break; 1025 break;
1024 }; 1026 };
1025} 1027}
1026 1028
1027void PlayListWidget::populateSkinsMenu() { 1029void PlayListWidget::populateSkinsMenu() {
1028 int item = 0; 1030 int item = 0;
1029 defaultSkinIndex = 0; 1031 defaultSkinIndex = 0;
1030 QString skinName; 1032 QString skinName;
1031 Config cfg( "OpiePlayer" ); 1033 Config cfg( "OpiePlayer" );
1032 cfg.setGroup("Options" ); 1034 cfg.setGroup("Options" );
1033 QString skin = cfg.readEntry( "Skin", "default" ); 1035 QString skin = cfg.readEntry( "Skin", "default" );
1034 1036
1035 QDir skinsDir( QPEApplication::qpeDir() + "/pics/opieplayer2/skins" ); 1037 QDir skinsDir( QPEApplication::qpeDir() + "/pics/opieplayer2/skins" );
1036 skinsDir.setFilter( QDir::Dirs ); 1038 skinsDir.setFilter( QDir::Dirs );
1037 skinsDir.setSorting(QDir::Name ); 1039 skinsDir.setSorting(QDir::Name );
1038 const QFileInfoList *skinslist = skinsDir.entryInfoList(); 1040 const QFileInfoList *skinslist = skinsDir.entryInfoList();
1039 QFileInfoListIterator it( *skinslist ); 1041 QFileInfoListIterator it( *skinslist );
1040 QFileInfo *fi; 1042 QFileInfo *fi;
1041 while ( ( fi = it.current() ) ) { 1043 while ( ( fi = it.current() ) ) {
1042 skinName = fi->fileName(); 1044 skinName = fi->fileName();
1043// qDebug( fi->fileName() ); 1045// qDebug( fi->fileName() );
1044 if( skinName != "." && skinName != ".." && skinName !="CVS" ) { 1046 if( skinName != "." && skinName != ".." && skinName !="CVS" ) {
1045 item = skinsMenu->insertItem( fi->fileName() ) ; 1047 item = skinsMenu->insertItem( fi->fileName() ) ;
1046 } 1048 }
1047 if( skinName == "default" ) { 1049 if( skinName == "default" ) {
1048 defaultSkinIndex = item; 1050 defaultSkinIndex = item;
1049 } 1051 }
1050 if( skinName == skin ) { 1052 if( skinName == skin ) {
1051 skinsMenu->setItemChecked( item, TRUE ); 1053 skinsMenu->setItemChecked( item, TRUE );
1052 } 1054 }
1053 ++it; 1055 ++it;
1054 } 1056 }
1055} 1057}
1056 1058
1057void PlayListWidget::skinsMenuActivated( int item ) { 1059void PlayListWidget::skinsMenuActivated( int item ) {
1058 for( int i = defaultSkinIndex; i > defaultSkinIndex - skinsMenu->count(); i-- ) { 1060 for( int i = defaultSkinIndex; i > defaultSkinIndex - skinsMenu->count(); i-- ) {
1059 skinsMenu->setItemChecked( i, FALSE ); 1061 skinsMenu->setItemChecked( i, FALSE );
1060 } 1062 }
1061 skinsMenu->setItemChecked( item, TRUE ); 1063 skinsMenu->setItemChecked( item, TRUE );
1062 1064
1063 Config cfg( "OpiePlayer" ); 1065 Config cfg( "OpiePlayer" );
1064 cfg.setGroup("Options"); 1066 cfg.setGroup("Options");
1065 cfg.writeEntry("Skin", skinsMenu->text( item ) ); 1067 cfg.writeEntry("Skin", skinsMenu->text( item ) );
1066} 1068 QMessageBox::warning( this, tr( "OpiePlayer" ),
1069 tr( "You must <b>restart</b> Opieplayer<br>to see your changes." ) );
1070}
1067 1071
1068int PlayListWidget::whichList() { 1072int PlayListWidget::whichList() {
1069 return tabWidget->currentPageIndex(); 1073 return tabWidget->currentPageIndex();
1070} 1074}
1071 1075
1072QString PlayListWidget::currentFileListPathName() { 1076QString PlayListWidget::currentFileListPathName() {
1073 switch (whichList()) { 1077 switch (whichList()) {
1074 case 1: 1078 case 1:
1075 return audioView->currentItem()->text(3); 1079 return audioView->currentItem()->text(3);
1076 break; 1080 break;
1077 case 2: 1081 case 2:
1078 return videoView->currentItem()->text(3); 1082 return videoView->currentItem()->text(3);
1079 break; 1083 break;
1080 }; 1084 };
1081 return ""; 1085 return "";
1082} 1086}